From 5b0a53a6d3f1b8d70b34631d96d3815d0a334dd3 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Mon, 16 Jul 2012 16:31:53 +0000 Subject: Clist_mw, Clist_nicer, CmdLine, Console: folder structure change git-svn-id: http://svn.miranda-ng.org/main/trunk@988 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_mw/BkgrCfg.cpp | 318 -- plugins/Clist_mw/BkgrCfg.h | 18 - plugins/Clist_mw/CLUIFrames/cluiframes.cpp | 3013 ---------------- plugins/Clist_mw/CLUIFrames/cluiframes.h | 44 - plugins/Clist_mw/CLUIFrames/extraimage.cpp | 404 --- plugins/Clist_mw/CLUIFrames/framesmenu.cpp | 219 -- plugins/Clist_mw/CLUIFrames/statusbar.cpp | 599 ---- plugins/Clist_mw/clc.cpp | 294 -- plugins/Clist_mw/clc.h | 151 - plugins/Clist_mw/clcfonts.cpp | 136 - plugins/Clist_mw/clcidents.cpp | 303 -- plugins/Clist_mw/clcitems.cpp | 693 ---- plugins/Clist_mw/clcopts.cpp | 561 --- plugins/Clist_mw/clcpaint.cpp | 688 ---- plugins/Clist_mw/clcutils.cpp | 289 -- plugins/Clist_mw/clist.h | 55 - plugins/Clist_mw/clist_mw-translation.txt | 230 -- plugins/Clist_mw/clist_mw_10.vcxproj | 91 +- plugins/Clist_mw/clist_mw_10.vcxproj.filters | 130 +- plugins/Clist_mw/clistmenus.cpp | 60 - plugins/Clist_mw/clistmod.cpp | 153 - plugins/Clist_mw/clistopts.cpp | 243 -- plugins/Clist_mw/clistsettings.cpp | 374 -- plugins/Clist_mw/clisttray.cpp | 281 -- plugins/Clist_mw/clui.cpp | 922 ----- plugins/Clist_mw/cluiopts.cpp | 435 --- plugins/Clist_mw/cluiservices.cpp | 176 - plugins/Clist_mw/commonheaders.cpp | 29 - plugins/Clist_mw/commonheaders.h | 125 - plugins/Clist_mw/contact.cpp | 197 -- plugins/Clist_mw/docs/clist_mw-translation.txt | 230 ++ plugins/Clist_mw/groupmenu.cpp | 651 ---- plugins/Clist_mw/init.cpp | 240 -- plugins/Clist_mw/keyboard.cpp | 65 - plugins/Clist_mw/res/blank1.ico | Bin 318 -> 0 bytes plugins/Clist_mw/res/resource.rc | 781 +++++ plugins/Clist_mw/resource.h | 649 ---- plugins/Clist_mw/resource.rc | 781 ----- plugins/Clist_mw/src/BkgrCfg.cpp | 318 ++ plugins/Clist_mw/src/BkgrCfg.h | 18 + plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp | 3013 ++++++++++++++++ plugins/Clist_mw/src/CLUIFrames/cluiframes.h | 44 + plugins/Clist_mw/src/CLUIFrames/extraimage.cpp | 404 +++ plugins/Clist_mw/src/CLUIFrames/framesmenu.cpp | 219 ++ plugins/Clist_mw/src/CLUIFrames/statusbar.cpp | 599 ++++ plugins/Clist_mw/src/clc.cpp | 294 ++ plugins/Clist_mw/src/clc.h | 151 + plugins/Clist_mw/src/clcfonts.cpp | 136 + plugins/Clist_mw/src/clcidents.cpp | 303 ++ plugins/Clist_mw/src/clcitems.cpp | 693 ++++ plugins/Clist_mw/src/clcopts.cpp | 561 +++ plugins/Clist_mw/src/clcpaint.cpp | 688 ++++ plugins/Clist_mw/src/clcutils.cpp | 289 ++ plugins/Clist_mw/src/clist.h | 55 + plugins/Clist_mw/src/clistmenus.cpp | 60 + plugins/Clist_mw/src/clistmod.cpp | 153 + plugins/Clist_mw/src/clistopts.cpp | 243 ++ plugins/Clist_mw/src/clistsettings.cpp | 374 ++ plugins/Clist_mw/src/clisttray.cpp | 281 ++ plugins/Clist_mw/src/clui.cpp | 922 +++++ plugins/Clist_mw/src/cluiopts.cpp | 435 +++ plugins/Clist_mw/src/cluiservices.cpp | 176 + plugins/Clist_mw/src/commonheaders.cpp | 29 + plugins/Clist_mw/src/commonheaders.h | 126 + plugins/Clist_mw/src/contact.cpp | 197 ++ plugins/Clist_mw/src/groupmenu.cpp | 651 ++++ plugins/Clist_mw/src/init.cpp | 240 ++ plugins/Clist_mw/src/keyboard.cpp | 65 + plugins/Clist_mw/src/resource.h | 649 ++++ plugins/Clist_nicer/CLUIFrames/cluiframes.cpp | 3584 -------------------- plugins/Clist_nicer/CLUIFrames/cluiframes.h | 105 - plugins/Clist_nicer/CLUIFrames/framesmenu.cpp | 228 -- plugins/Clist_nicer/CLUIFrames/groupmenu.cpp | 704 ---- plugins/Clist_nicer/CLUIFrames/movetogroup.cpp | 60 - plugins/Clist_nicer/INCLUDE/alphablend.h | 30 - plugins/Clist_nicer/INCLUDE/clc.h | 632 ---- plugins/Clist_nicer/INCLUDE/clist.h | 48 - plugins/Clist_nicer/INCLUDE/commonheaders.h | 224 -- plugins/Clist_nicer/INCLUDE/config.h | 209 -- plugins/Clist_nicer/INCLUDE/extBackg.h | 97 - plugins/Clist_nicer/INCLUDE/m_cln_skinedit.h | 174 - plugins/Clist_nicer/INCLUDE/resource.h | 416 --- plugins/Clist_nicer/INCLUDE/rowheight_funcs.h | 85 - plugins/Clist_nicer/INCLUDE/vsstyle.h | 1606 --------- plugins/Clist_nicer/INCLUDE/vssym32.h | 712 ---- plugins/Clist_nicer/SRC/CLUIFrames/cluiframes.cpp | 3584 ++++++++++++++++++++ plugins/Clist_nicer/SRC/CLUIFrames/cluiframes.h | 105 + plugins/Clist_nicer/SRC/CLUIFrames/framesmenu.cpp | 228 ++ plugins/Clist_nicer/SRC/CLUIFrames/groupmenu.cpp | 704 ++++ plugins/Clist_nicer/SRC/CLUIFrames/movetogroup.cpp | 60 + plugins/Clist_nicer/SRC/Coolsb/coolsb_internal.h | 95 + plugins/Clist_nicer/SRC/Coolsb/coolsblib.cpp | 1003 ++++++ plugins/Clist_nicer/SRC/Coolsb/coolsblib.h | 41 + plugins/Clist_nicer/SRC/Coolsb/coolscroll.cpp | 3206 +++++++++++++++++ plugins/Clist_nicer/SRC/Coolsb/coolscroll.h | 232 ++ plugins/Clist_nicer/SRC/Coolsb/userdefs.h | 79 + plugins/Clist_nicer/SRC/Include/alphablend.h | 30 + plugins/Clist_nicer/SRC/Include/clc.h | 632 ++++ plugins/Clist_nicer/SRC/Include/clist.h | 48 + plugins/Clist_nicer/SRC/Include/commonheaders.h | 224 ++ plugins/Clist_nicer/SRC/Include/config.h | 209 ++ plugins/Clist_nicer/SRC/Include/extBackg.h | 97 + plugins/Clist_nicer/SRC/Include/m_cln_skinedit.h | 174 + plugins/Clist_nicer/SRC/Include/resource.h | 416 +++ plugins/Clist_nicer/SRC/Include/rowheight_funcs.h | 85 + plugins/Clist_nicer/SRC/Include/vsstyle.h | 1606 +++++++++ plugins/Clist_nicer/SRC/Include/vssym32.h | 712 ++++ plugins/Clist_nicer/clist_nicer-translation.txt | 498 --- plugins/Clist_nicer/clist_nicer_10.vcxproj | 157 +- plugins/Clist_nicer/clist_nicer_10.vcxproj.filters | 218 +- plugins/Clist_nicer/coolsb/coolsb_internal.h | 95 - plugins/Clist_nicer/coolsb/coolsblib.cpp | 1003 ------ plugins/Clist_nicer/coolsb/coolsblib.h | 41 - plugins/Clist_nicer/coolsb/coolscroll.cpp | 3206 ----------------- plugins/Clist_nicer/coolsb/coolscroll.h | 232 -- plugins/Clist_nicer/coolsb/userdefs.h | 79 - .../Clist_nicer/docs/clist_nicer-translation.txt | 498 +++ plugins/Clist_nicer/res/resource.rc | 773 +++++ plugins/Clist_nicer/res/version.rc | 47 + plugins/Clist_nicer/resource.rc | 788 ----- plugins/Clist_nicer/skineditor/CHANGELOG | 0 plugins/Clist_nicer/skineditor/README | 27 - plugins/Clist_nicer/skineditor/commonheaders.h | 60 - plugins/Clist_nicer/skineditor/docs/CHANGELOG | 0 plugins/Clist_nicer/skineditor/docs/README | 27 + plugins/Clist_nicer/skineditor/main.cpp | 970 ------ plugins/Clist_nicer/skineditor/res/skinedit.rc | 177 + plugins/Clist_nicer/skineditor/skinedit.rc | 177 - plugins/Clist_nicer/skineditor/skinedit_10.vcxproj | 28 +- .../skineditor/skinedit_10.vcxproj.filters | 13 +- plugins/Clist_nicer/skineditor/skineditres.h | 51 - plugins/Clist_nicer/skineditor/src/commonheaders.h | 61 + plugins/Clist_nicer/skineditor/src/main.cpp | 970 ++++++ plugins/Clist_nicer/skineditor/src/skineditres.h | 51 + plugins/Clist_nicer/version.rc | 54 - plugins/CmdLine/CmdLine.cpp | 87 - plugins/CmdLine/CmdLine.rc | 63 - plugins/CmdLine/CmdLine.vcxproj | 35 +- plugins/CmdLine/CmdLine.vcxproj.filters | 37 +- plugins/CmdLine/MimCmd/MimCmd.cpp | 117 - plugins/CmdLine/MimCmd/MimCmd.vcxproj | 14 +- plugins/CmdLine/MimCmd/MimCmd.vcxproj.filters | 14 +- plugins/CmdLine/MimCmd/commands.cpp | 239 -- plugins/CmdLine/MimCmd/commands.h | 42 - plugins/CmdLine/MimCmd/common.h | 36 - plugins/CmdLine/MimCmd/res/version.rc | 103 + plugins/CmdLine/MimCmd/resource.h | 14 - plugins/CmdLine/MimCmd/src/MimCmd.cpp | 117 + plugins/CmdLine/MimCmd/src/commands.cpp | 239 ++ plugins/CmdLine/MimCmd/src/commands.h | 42 + plugins/CmdLine/MimCmd/src/common.h | 36 + plugins/CmdLine/MimCmd/src/resource.h | 14 + plugins/CmdLine/MimCmd/version.rc | 104 - plugins/CmdLine/commonheaders.h | 112 - plugins/CmdLine/hooked_events.cpp | 113 - plugins/CmdLine/hooked_events.h | 43 - plugins/CmdLine/mimcmd_data.cpp | 43 - plugins/CmdLine/mimcmd_data.h | 120 - plugins/CmdLine/mimcmd_handlers.cpp | 2307 ------------- plugins/CmdLine/mimcmd_handlers.h | 55 - plugins/CmdLine/mimcmd_ipc.cpp | 105 - plugins/CmdLine/mimcmd_ipc.h | 56 - plugins/CmdLine/res/version.rc | 103 + plugins/CmdLine/resource.h | 15 - plugins/CmdLine/services.cpp | 106 - plugins/CmdLine/services.h | 34 - plugins/CmdLine/src/CmdLine.cpp | 87 + plugins/CmdLine/src/commonheaders.h | 112 + plugins/CmdLine/src/hooked_events.cpp | 113 + plugins/CmdLine/src/hooked_events.h | 43 + plugins/CmdLine/src/mimcmd_data.cpp | 43 + plugins/CmdLine/src/mimcmd_data.h | 120 + plugins/CmdLine/src/mimcmd_handlers.cpp | 2307 +++++++++++++ plugins/CmdLine/src/mimcmd_handlers.h | 55 + plugins/CmdLine/src/mimcmd_ipc.cpp | 105 + plugins/CmdLine/src/mimcmd_ipc.h | 56 + plugins/CmdLine/src/resource.h | 15 + plugins/CmdLine/src/services.cpp | 106 + plugins/CmdLine/src/services.h | 34 + plugins/CmdLine/src/utils.cpp | 461 +++ plugins/CmdLine/src/utils.h | 62 + plugins/CmdLine/src/version.h | 49 + plugins/CmdLine/utils.cpp | 461 --- plugins/CmdLine/utils.h | 62 - plugins/CmdLine/version.h | 49 - plugins/CmdLine/version.rc | 104 - plugins/Console/Console.cpp | 1430 -------- plugins/Console/Console.vcxproj | 42 +- plugins/Console/Console.vcxproj.filters | 66 +- plugins/Console/Console_history.txt | 179 - plugins/Console/Console_readme.txt | 21 - plugins/Console/commonheaders.cpp | 24 - plugins/Console/commonheaders.h | 68 - plugins/Console/console-translation.txt | 38 - plugins/Console/docs/Console_history.txt | 179 + plugins/Console/docs/Console_readme.txt | 21 + plugins/Console/docs/console-translation.txt | 38 + plugins/Console/docs/gpl.txt | 340 ++ plugins/Console/gpl.txt | 340 -- plugins/Console/init.cpp | 74 - plugins/Console/res/resource.rc | 171 + plugins/Console/res/version.rc | 63 + plugins/Console/resource.h | 58 - plugins/Console/resource.rc | 176 - plugins/Console/src/Console.cpp | 1430 ++++++++ plugins/Console/src/commonheaders.cpp | 24 + plugins/Console/src/commonheaders.h | 68 + plugins/Console/src/init.cpp | 74 + plugins/Console/src/resource.h | 58 + plugins/Console/src/version.h | 41 + plugins/Console/version.h | 41 - plugins/Console/version.rc | 65 - 212 files changed, 36756 insertions(+), 37181 deletions(-) delete mode 100644 plugins/Clist_mw/BkgrCfg.cpp delete mode 100644 plugins/Clist_mw/BkgrCfg.h delete mode 100644 plugins/Clist_mw/CLUIFrames/cluiframes.cpp delete mode 100644 plugins/Clist_mw/CLUIFrames/cluiframes.h delete mode 100644 plugins/Clist_mw/CLUIFrames/extraimage.cpp delete mode 100644 plugins/Clist_mw/CLUIFrames/framesmenu.cpp delete mode 100644 plugins/Clist_mw/CLUIFrames/statusbar.cpp delete mode 100644 plugins/Clist_mw/clc.cpp delete mode 100644 plugins/Clist_mw/clc.h delete mode 100644 plugins/Clist_mw/clcfonts.cpp delete mode 100644 plugins/Clist_mw/clcidents.cpp delete mode 100644 plugins/Clist_mw/clcitems.cpp delete mode 100644 plugins/Clist_mw/clcopts.cpp delete mode 100644 plugins/Clist_mw/clcpaint.cpp delete mode 100644 plugins/Clist_mw/clcutils.cpp delete mode 100644 plugins/Clist_mw/clist.h delete mode 100644 plugins/Clist_mw/clist_mw-translation.txt delete mode 100644 plugins/Clist_mw/clistmenus.cpp delete mode 100644 plugins/Clist_mw/clistmod.cpp delete mode 100644 plugins/Clist_mw/clistopts.cpp delete mode 100644 plugins/Clist_mw/clistsettings.cpp delete mode 100644 plugins/Clist_mw/clisttray.cpp delete mode 100644 plugins/Clist_mw/clui.cpp delete mode 100644 plugins/Clist_mw/cluiopts.cpp delete mode 100644 plugins/Clist_mw/cluiservices.cpp delete mode 100644 plugins/Clist_mw/commonheaders.cpp delete mode 100644 plugins/Clist_mw/commonheaders.h delete mode 100644 plugins/Clist_mw/contact.cpp create mode 100644 plugins/Clist_mw/docs/clist_mw-translation.txt delete mode 100644 plugins/Clist_mw/groupmenu.cpp delete mode 100644 plugins/Clist_mw/init.cpp delete mode 100644 plugins/Clist_mw/keyboard.cpp delete mode 100644 plugins/Clist_mw/res/blank1.ico create mode 100644 plugins/Clist_mw/res/resource.rc delete mode 100644 plugins/Clist_mw/resource.h delete mode 100644 plugins/Clist_mw/resource.rc create mode 100644 plugins/Clist_mw/src/BkgrCfg.cpp create mode 100644 plugins/Clist_mw/src/BkgrCfg.h create mode 100644 plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp create mode 100644 plugins/Clist_mw/src/CLUIFrames/cluiframes.h create mode 100644 plugins/Clist_mw/src/CLUIFrames/extraimage.cpp create mode 100644 plugins/Clist_mw/src/CLUIFrames/framesmenu.cpp create mode 100644 plugins/Clist_mw/src/CLUIFrames/statusbar.cpp create mode 100644 plugins/Clist_mw/src/clc.cpp create mode 100644 plugins/Clist_mw/src/clc.h create mode 100644 plugins/Clist_mw/src/clcfonts.cpp create mode 100644 plugins/Clist_mw/src/clcidents.cpp create mode 100644 plugins/Clist_mw/src/clcitems.cpp create mode 100644 plugins/Clist_mw/src/clcopts.cpp create mode 100644 plugins/Clist_mw/src/clcpaint.cpp create mode 100644 plugins/Clist_mw/src/clcutils.cpp create mode 100644 plugins/Clist_mw/src/clist.h create mode 100644 plugins/Clist_mw/src/clistmenus.cpp create mode 100644 plugins/Clist_mw/src/clistmod.cpp create mode 100644 plugins/Clist_mw/src/clistopts.cpp create mode 100644 plugins/Clist_mw/src/clistsettings.cpp create mode 100644 plugins/Clist_mw/src/clisttray.cpp create mode 100644 plugins/Clist_mw/src/clui.cpp create mode 100644 plugins/Clist_mw/src/cluiopts.cpp create mode 100644 plugins/Clist_mw/src/cluiservices.cpp create mode 100644 plugins/Clist_mw/src/commonheaders.cpp create mode 100644 plugins/Clist_mw/src/commonheaders.h create mode 100644 plugins/Clist_mw/src/contact.cpp create mode 100644 plugins/Clist_mw/src/groupmenu.cpp create mode 100644 plugins/Clist_mw/src/init.cpp create mode 100644 plugins/Clist_mw/src/keyboard.cpp create mode 100644 plugins/Clist_mw/src/resource.h delete mode 100644 plugins/Clist_nicer/CLUIFrames/cluiframes.cpp delete mode 100644 plugins/Clist_nicer/CLUIFrames/cluiframes.h delete mode 100644 plugins/Clist_nicer/CLUIFrames/framesmenu.cpp delete mode 100644 plugins/Clist_nicer/CLUIFrames/groupmenu.cpp delete mode 100644 plugins/Clist_nicer/CLUIFrames/movetogroup.cpp delete mode 100644 plugins/Clist_nicer/INCLUDE/alphablend.h delete mode 100644 plugins/Clist_nicer/INCLUDE/clc.h delete mode 100644 plugins/Clist_nicer/INCLUDE/clist.h delete mode 100644 plugins/Clist_nicer/INCLUDE/commonheaders.h delete mode 100644 plugins/Clist_nicer/INCLUDE/config.h delete mode 100644 plugins/Clist_nicer/INCLUDE/extBackg.h delete mode 100644 plugins/Clist_nicer/INCLUDE/m_cln_skinedit.h delete mode 100644 plugins/Clist_nicer/INCLUDE/resource.h delete mode 100644 plugins/Clist_nicer/INCLUDE/rowheight_funcs.h delete mode 100644 plugins/Clist_nicer/INCLUDE/vsstyle.h delete mode 100644 plugins/Clist_nicer/INCLUDE/vssym32.h create mode 100644 plugins/Clist_nicer/SRC/CLUIFrames/cluiframes.cpp create mode 100644 plugins/Clist_nicer/SRC/CLUIFrames/cluiframes.h create mode 100644 plugins/Clist_nicer/SRC/CLUIFrames/framesmenu.cpp create mode 100644 plugins/Clist_nicer/SRC/CLUIFrames/groupmenu.cpp create mode 100644 plugins/Clist_nicer/SRC/CLUIFrames/movetogroup.cpp create mode 100644 plugins/Clist_nicer/SRC/Coolsb/coolsb_internal.h create mode 100644 plugins/Clist_nicer/SRC/Coolsb/coolsblib.cpp create mode 100644 plugins/Clist_nicer/SRC/Coolsb/coolsblib.h create mode 100644 plugins/Clist_nicer/SRC/Coolsb/coolscroll.cpp create mode 100644 plugins/Clist_nicer/SRC/Coolsb/coolscroll.h create mode 100644 plugins/Clist_nicer/SRC/Coolsb/userdefs.h create mode 100644 plugins/Clist_nicer/SRC/Include/alphablend.h create mode 100644 plugins/Clist_nicer/SRC/Include/clc.h create mode 100644 plugins/Clist_nicer/SRC/Include/clist.h create mode 100644 plugins/Clist_nicer/SRC/Include/commonheaders.h create mode 100644 plugins/Clist_nicer/SRC/Include/config.h create mode 100644 plugins/Clist_nicer/SRC/Include/extBackg.h create mode 100644 plugins/Clist_nicer/SRC/Include/m_cln_skinedit.h create mode 100644 plugins/Clist_nicer/SRC/Include/resource.h create mode 100644 plugins/Clist_nicer/SRC/Include/rowheight_funcs.h create mode 100644 plugins/Clist_nicer/SRC/Include/vsstyle.h create mode 100644 plugins/Clist_nicer/SRC/Include/vssym32.h delete mode 100644 plugins/Clist_nicer/clist_nicer-translation.txt delete mode 100644 plugins/Clist_nicer/coolsb/coolsb_internal.h delete mode 100644 plugins/Clist_nicer/coolsb/coolsblib.cpp delete mode 100644 plugins/Clist_nicer/coolsb/coolsblib.h delete mode 100644 plugins/Clist_nicer/coolsb/coolscroll.cpp delete mode 100644 plugins/Clist_nicer/coolsb/coolscroll.h delete mode 100644 plugins/Clist_nicer/coolsb/userdefs.h create mode 100644 plugins/Clist_nicer/docs/clist_nicer-translation.txt create mode 100644 plugins/Clist_nicer/res/resource.rc create mode 100644 plugins/Clist_nicer/res/version.rc delete mode 100644 plugins/Clist_nicer/resource.rc delete mode 100644 plugins/Clist_nicer/skineditor/CHANGELOG delete mode 100644 plugins/Clist_nicer/skineditor/README delete mode 100644 plugins/Clist_nicer/skineditor/commonheaders.h create mode 100644 plugins/Clist_nicer/skineditor/docs/CHANGELOG create mode 100644 plugins/Clist_nicer/skineditor/docs/README delete mode 100644 plugins/Clist_nicer/skineditor/main.cpp create mode 100644 plugins/Clist_nicer/skineditor/res/skinedit.rc delete mode 100644 plugins/Clist_nicer/skineditor/skinedit.rc delete mode 100644 plugins/Clist_nicer/skineditor/skineditres.h create mode 100644 plugins/Clist_nicer/skineditor/src/commonheaders.h create mode 100644 plugins/Clist_nicer/skineditor/src/main.cpp create mode 100644 plugins/Clist_nicer/skineditor/src/skineditres.h delete mode 100644 plugins/Clist_nicer/version.rc delete mode 100644 plugins/CmdLine/CmdLine.cpp delete mode 100644 plugins/CmdLine/CmdLine.rc delete mode 100644 plugins/CmdLine/MimCmd/MimCmd.cpp delete mode 100644 plugins/CmdLine/MimCmd/commands.cpp delete mode 100644 plugins/CmdLine/MimCmd/commands.h delete mode 100644 plugins/CmdLine/MimCmd/common.h create mode 100644 plugins/CmdLine/MimCmd/res/version.rc delete mode 100644 plugins/CmdLine/MimCmd/resource.h create mode 100644 plugins/CmdLine/MimCmd/src/MimCmd.cpp create mode 100644 plugins/CmdLine/MimCmd/src/commands.cpp create mode 100644 plugins/CmdLine/MimCmd/src/commands.h create mode 100644 plugins/CmdLine/MimCmd/src/common.h create mode 100644 plugins/CmdLine/MimCmd/src/resource.h delete mode 100644 plugins/CmdLine/MimCmd/version.rc delete mode 100644 plugins/CmdLine/commonheaders.h delete mode 100644 plugins/CmdLine/hooked_events.cpp delete mode 100644 plugins/CmdLine/hooked_events.h delete mode 100644 plugins/CmdLine/mimcmd_data.cpp delete mode 100644 plugins/CmdLine/mimcmd_data.h delete mode 100644 plugins/CmdLine/mimcmd_handlers.cpp delete mode 100644 plugins/CmdLine/mimcmd_handlers.h delete mode 100644 plugins/CmdLine/mimcmd_ipc.cpp delete mode 100644 plugins/CmdLine/mimcmd_ipc.h create mode 100644 plugins/CmdLine/res/version.rc delete mode 100644 plugins/CmdLine/resource.h delete mode 100644 plugins/CmdLine/services.cpp delete mode 100644 plugins/CmdLine/services.h create mode 100644 plugins/CmdLine/src/CmdLine.cpp create mode 100644 plugins/CmdLine/src/commonheaders.h create mode 100644 plugins/CmdLine/src/hooked_events.cpp create mode 100644 plugins/CmdLine/src/hooked_events.h create mode 100644 plugins/CmdLine/src/mimcmd_data.cpp create mode 100644 plugins/CmdLine/src/mimcmd_data.h create mode 100644 plugins/CmdLine/src/mimcmd_handlers.cpp create mode 100644 plugins/CmdLine/src/mimcmd_handlers.h create mode 100644 plugins/CmdLine/src/mimcmd_ipc.cpp create mode 100644 plugins/CmdLine/src/mimcmd_ipc.h create mode 100644 plugins/CmdLine/src/resource.h create mode 100644 plugins/CmdLine/src/services.cpp create mode 100644 plugins/CmdLine/src/services.h create mode 100644 plugins/CmdLine/src/utils.cpp create mode 100644 plugins/CmdLine/src/utils.h create mode 100644 plugins/CmdLine/src/version.h delete mode 100644 plugins/CmdLine/utils.cpp delete mode 100644 plugins/CmdLine/utils.h delete mode 100644 plugins/CmdLine/version.h delete mode 100644 plugins/CmdLine/version.rc delete mode 100644 plugins/Console/Console.cpp delete mode 100644 plugins/Console/Console_history.txt delete mode 100644 plugins/Console/Console_readme.txt delete mode 100644 plugins/Console/commonheaders.cpp delete mode 100644 plugins/Console/commonheaders.h delete mode 100644 plugins/Console/console-translation.txt create mode 100644 plugins/Console/docs/Console_history.txt create mode 100644 plugins/Console/docs/Console_readme.txt create mode 100644 plugins/Console/docs/console-translation.txt create mode 100644 plugins/Console/docs/gpl.txt delete mode 100644 plugins/Console/gpl.txt delete mode 100644 plugins/Console/init.cpp create mode 100644 plugins/Console/res/resource.rc create mode 100644 plugins/Console/res/version.rc delete mode 100644 plugins/Console/resource.h delete mode 100644 plugins/Console/resource.rc create mode 100644 plugins/Console/src/Console.cpp create mode 100644 plugins/Console/src/commonheaders.cpp create mode 100644 plugins/Console/src/commonheaders.h create mode 100644 plugins/Console/src/init.cpp create mode 100644 plugins/Console/src/resource.h create mode 100644 plugins/Console/src/version.h delete mode 100644 plugins/Console/version.h delete mode 100644 plugins/Console/version.rc (limited to 'plugins') diff --git a/plugins/Clist_mw/BkgrCfg.cpp b/plugins/Clist_mw/BkgrCfg.cpp deleted file mode 100644 index 8753b852d6..0000000000 --- a/plugins/Clist_mw/BkgrCfg.cpp +++ /dev/null @@ -1,318 +0,0 @@ - -#include "commonheaders.h" - -#define DEFAULT_BKCOLOUR GetSysColor(COLOR_3DFACE) -#define DEFAULT_USEBITMAP 0 -#define DEFAULT_BKBMPUSE CLB_STRETCH -#define DEFAULT_SELBKCOLOUR GetSysColor(COLOR_HIGHLIGHT) - - -extern HINSTANCE g_hInst; - -char **bkgrList = NULL; -int bkgrCount = 0; -HANDLE hEventBkgrChanged; - -#define M_BKGR_UPDATE (WM_USER+10) -#define M_BKGR_SETSTATE (WM_USER+11) -#define M_BKGR_GETSTATE (WM_USER+12) - -#define M_BKGR_BACKCOLOR 0x01 -#define M_BKGR_SELECTCOLOR 0x02 -#define M_BKGR_ALLOWBITMAPS 0x04 -#define M_BKGR_STRETCH 0x08 -#define M_BKGR_TILE 0x10 - -#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0])) -static const int bitmapRelatedControls[] = { - IDC_FILENAME,IDC_BROWSE,IDC_STRETCHH,IDC_STRETCHV,IDC_TILEH,IDC_TILEV, - IDC_SCROLL,IDC_PROPORTIONAL,IDC_TILEVROWH -}; -struct BkgrItem -{ - BYTE changed; - BYTE useBitmap; - COLORREF bkColor, selColor; - char filename[MAX_PATH]; - WORD flags; -}; -struct BkgrData -{ - struct BkgrItem *item; - int indx; - int count; -}; -static INT_PTR CALLBACK DlgProcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - struct BkgrData *dat = (struct BkgrData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - switch (msg) - { - case WM_INITDIALOG: - { - int indx; - HWND hList = GetDlgItem(hwndDlg, IDC_BKGRLIST); - TranslateDialogDefault(hwndDlg); - - dat = (struct BkgrData*)mir_alloc(sizeof(struct BkgrData)); - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); - dat->count = bkgrCount; - dat->item = (struct BkgrItem*)mir_alloc(sizeof(struct BkgrItem)*dat->count); - dat->indx = CB_ERR; - for (indx = 0; indx < dat->count; indx++) - { - char *module = bkgrList[indx] + strlen(bkgrList[indx]) + 1; - int jndx; - - dat->item[indx].changed = FALSE; - dat->item[indx].useBitmap = DBGetContactSettingByte(NULL,module, "UseBitmap", DEFAULT_USEBITMAP); - dat->item[indx].bkColor = DBGetContactSettingDword(NULL,module, "BkColour", DEFAULT_BKCOLOUR); - dat->item[indx].selColor = DBGetContactSettingDword(NULL,module, "SelBkColour", DEFAULT_SELBKCOLOUR); - { - DBVARIANT dbv; - if (!DBGetContactSettingString(NULL,module,"BkBitmap",&dbv)) - { - int retval = CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)dbv.pszVal, (LPARAM)dat->item[indx].filename); - if (!retval || retval == CALLSERVICE_NOTFOUND) - lstrcpynA(dat->item[indx].filename, dbv.pszVal, MAX_PATH); - mir_free(dbv.pszVal); - } - else - *dat->item[indx].filename = 0; - } - dat->item[indx].flags = DBGetContactSettingWord(NULL,module,"BkBmpUse", DEFAULT_BKBMPUSE); - jndx = SendMessageA(hList, CB_ADDSTRING, 0, (LPARAM)Translate(bkgrList[indx])); - SendMessage(hList, CB_SETITEMDATA, jndx, indx); - } - SendMessage(hList, CB_SETCURSEL, 0, 0); - PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_BKGRLIST, CBN_SELCHANGE), 0); - { - HRESULT (STDAPICALLTYPE *MySHAutoComplete)(HWND,DWORD); - MySHAutoComplete = (HRESULT (STDAPICALLTYPE*)(HWND,DWORD))GetProcAddress(GetModuleHandleA("shlwapi"),"SHAutoComplete"); - if (MySHAutoComplete) MySHAutoComplete(GetDlgItem(hwndDlg,IDC_FILENAME),1); - } - return TRUE; - } - case WM_DESTROY: - if (dat) - { - if (dat->item) mir_free(dat->item); - mir_free(dat); - } - - return TRUE; - - case M_BKGR_GETSTATE: - { - int indx = wParam; - if (indx == CB_ERR || indx >= dat->count) break; - indx = SendDlgItemMessage(hwndDlg, IDC_BKGRLIST, CB_GETITEMDATA, indx, 0); - - dat->item[indx].useBitmap = IsDlgButtonChecked(hwndDlg,IDC_BITMAP); - dat->item[indx].bkColor = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR,0,0); - dat->item[indx].selColor = SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_GETCOLOUR,0,0); - GetDlgItemTextA(hwndDlg, IDC_FILENAME, dat->item[indx].filename, sizeof(dat->item[indx].filename)); - { - WORD flags = 0; - if (IsDlgButtonChecked(hwndDlg,IDC_STRETCHH)) flags |= CLB_STRETCHH; - if (IsDlgButtonChecked(hwndDlg,IDC_STRETCHV)) flags |= CLB_STRETCHV; - if (IsDlgButtonChecked(hwndDlg,IDC_TILEH)) flags |= CLBF_TILEH; - if (IsDlgButtonChecked(hwndDlg,IDC_TILEV)) flags |= CLBF_TILEV; - if (IsDlgButtonChecked(hwndDlg,IDC_SCROLL)) flags |= CLBF_SCROLL; - if (IsDlgButtonChecked(hwndDlg,IDC_PROPORTIONAL)) flags |= CLBF_PROPORTIONAL; - if (IsDlgButtonChecked(hwndDlg,IDC_TILEVROWH)) flags |= CLBF_TILEVTOROWHEIGHT; - dat->item[indx].flags = flags; - } - break; - } - case M_BKGR_SETSTATE: - { - int indx = wParam; - int flags = dat->item[indx].flags; - if (indx == CB_ERR || indx >= dat->count) break; - indx = SendDlgItemMessage(hwndDlg, IDC_BKGRLIST, CB_GETITEMDATA, indx, 0); - - CheckDlgButton(hwndDlg, IDC_BITMAP, dat->item[indx].useBitmap?BST_CHECKED:BST_UNCHECKED); - - SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETDEFAULTCOLOUR, 0, DEFAULT_BKCOLOUR); - SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETCOLOUR, 0, dat->item[indx].bkColor); - SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_SETDEFAULTCOLOUR, 0, DEFAULT_SELBKCOLOUR); - SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_SETCOLOUR, 0, dat->item[indx].selColor); - SetDlgItemTextA(hwndDlg, IDC_FILENAME, dat->item[indx].filename); - - CheckDlgButton(hwndDlg,IDC_STRETCHH, flags&CLB_STRETCHH?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_STRETCHV,flags&CLB_STRETCHV?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_TILEH,flags&CLBF_TILEH?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_TILEV,flags&CLBF_TILEV?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_SCROLL,flags&CLBF_SCROLL?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_PROPORTIONAL,flags&CLBF_PROPORTIONAL?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_TILEVROWH,flags&CLBF_TILEVTOROWHEIGHT?BST_CHECKED:BST_UNCHECKED); - - SendMessage(hwndDlg, M_BKGR_UPDATE, 0,0); - break; - } - case M_BKGR_UPDATE: - { - int isChecked = IsDlgButtonChecked(hwndDlg,IDC_BITMAP); - int indx; - for (indx = 0; indx < ARRAY_SIZE(bitmapRelatedControls); indx++) - EnableWindow(GetDlgItem(hwndDlg, bitmapRelatedControls[indx]),isChecked); - break; - } - case WM_COMMAND: - if (LOWORD(wParam) == IDC_BROWSE) { - char str[MAX_PATH]; - OPENFILENAMEA ofn = {0}; - char filter[512]; - - GetDlgItemTextA(hwndDlg,IDC_FILENAME, str, sizeof(str)); - ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; - ofn.hwndOwner = hwndDlg; - ofn.hInstance = NULL; - CallService(MS_UTILS_GETBITMAPFILTERSTRINGS, sizeof(filter), (LPARAM)filter); - ofn.lpstrFilter = filter; - ofn.lpstrFile = str; - ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - ofn.nMaxFile = sizeof(str); - ofn.nMaxFileTitle = MAX_PATH; - ofn.lpstrDefExt = "bmp"; - if (!GetOpenFileNameA(&ofn)) break; - SetDlgItemTextA(hwndDlg, IDC_FILENAME, str); - } - else if (LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) != EN_CHANGE) - break; - - if (LOWORD(wParam) == IDC_BITMAP) - SendMessage(hwndDlg, M_BKGR_UPDATE, 0,0); - if (LOWORD(wParam) == IDC_FILENAME && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) - return 0; - if (LOWORD(wParam) == IDC_BKGRLIST) { - if (HIWORD(wParam) == CBN_SELCHANGE) { - SendMessage(hwndDlg, M_BKGR_GETSTATE, dat->indx, 0); - SendMessage(hwndDlg, M_BKGR_SETSTATE, dat->indx = SendDlgItemMessage(hwndDlg, IDC_BKGRLIST, CB_GETCURSEL, 0,0), 0); - } - return 0; - } - { - int indx = SendDlgItemMessage(hwndDlg, IDC_BKGRLIST, CB_GETCURSEL, 0,0); - if (indx != CB_ERR && indx < dat->count) { - indx = SendDlgItemMessage(hwndDlg, IDC_BKGRLIST, CB_GETITEMDATA, indx, 0); - dat->item[indx].changed = TRUE; - - } - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0,0); - } - break; - case WM_NOTIFY: - switch(((LPNMHDR)lParam)->idFrom) - { - case 0: - switch (((LPNMHDR)lParam)->code) - { - case PSN_APPLY: - { - int indx; - SendMessage(hwndDlg, M_BKGR_GETSTATE, SendDlgItemMessage(hwndDlg, IDC_BKGRLIST, CB_GETCURSEL, 0,0), 0); - for (indx = 0; indx < dat->count; indx++) - if (dat->item[indx].changed) - { - char *module = bkgrList[indx] + strlen(bkgrList[indx]) + 1; - DBWriteContactSettingByte(NULL, module, "UseBitmap", (BYTE)dat->item[indx].useBitmap); - { - COLORREF col; - - if ((col = dat->item[indx].bkColor) == DEFAULT_BKCOLOUR) - DBDeleteContactSetting(NULL, module, "BkColour"); - else - DBWriteContactSettingDword(NULL, module, "BkColour", col); - - if ((col = dat->item[indx].selColor) == DEFAULT_SELBKCOLOUR) - DBDeleteContactSetting(NULL, module, "SelBkColour"); - else - DBWriteContactSettingDword(NULL, module, "SelBkColour", col); - } - { - char str[MAX_PATH]; - int retval = CallService(MS_UTILS_PATHTOABSOLUTE, - (WPARAM)dat->item[indx].filename, - (LPARAM)str); - if (!retval || retval == CALLSERVICE_NOTFOUND) - DBWriteContactSettingString(NULL, module, "BkBitmap", dat->item[indx].filename); - else - DBWriteContactSettingString(NULL, module, "BkBitmap", str); - } - DBWriteContactSettingWord(NULL, module, "BkBmpUse", dat->item[indx].flags); - dat->item[indx].changed = FALSE; - NotifyEventHooks(hEventBkgrChanged, (WPARAM)module, 0); - } - return TRUE; - } - } - break; - } - break; - } - return FALSE; -} - -static INT_PTR BkgrCfg_Register(WPARAM wParam,LPARAM lParam) -{ - char *szSetting = (char *)wParam; - char *value, *tok; - size_t len = strlen(szSetting) + 1; - - value = (char *)mir_alloc(len + 4); // add room for flags (DWORD) - memcpy(value, szSetting, len); - tok = strchr(value, '/'); - if (tok == NULL) { - mir_free(value); - return 1; - } - *tok = 0; - *(DWORD*)(value + len) = lParam; - - bkgrList = (char **)mir_realloc(bkgrList, sizeof(char*)*(bkgrCount+1)); - bkgrList[bkgrCount] = value; - bkgrCount++; - - return 0; -} - -int OnOptionsInit(WPARAM wParam,LPARAM lParam) -{ - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); - odp.hInstance = g_hInst; - odp.pszGroup = LPGEN("Customize"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLCBKG2); - odp.pszTitle = LPGEN("Backgrounds"); - odp.pfnDlgProc = DlgProcBkgOpts; - odp.flags = ODPF_BOLDGROUPS; - Options_AddPage(wParam, &odp); - - return 0; -} - -int BGModuleLoad() -{ - HookEvent(ME_OPT_INITIALISE, OnOptionsInit); - - CreateServiceFunction(MS_BACKGROUNDCONFIG_REGISTER, BkgrCfg_Register); - - hEventBkgrChanged = CreateHookableEvent(ME_BACKGROUNDCONFIG_CHANGED); - return 0; -} - -int BGModuleUnload(void) -{ - if (bkgrList != NULL) - { - int indx; - for (indx = 0; indx < bkgrCount; indx++) - if (bkgrList[indx] != NULL) - mir_free(bkgrList[indx]); - mir_free(bkgrList); - } - DestroyHookableEvent(hEventBkgrChanged); - - return 0; -} diff --git a/plugins/Clist_mw/BkgrCfg.h b/plugins/Clist_mw/BkgrCfg.h deleted file mode 100644 index a47b53a603..0000000000 --- a/plugins/Clist_mw/BkgrCfg.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// 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 "BkgrCfg/Register" - -// -// Notification about changed background -// wParam = ModuleName -// lParam = 0 -#define ME_BACKGROUNDCONFIG_CHANGED "BkgrCfg/Changed" - -#define CLBF_TILEVTOROWHEIGHT 0x0100 diff --git a/plugins/Clist_mw/CLUIFrames/cluiframes.cpp b/plugins/Clist_mw/CLUIFrames/cluiframes.cpp deleted file mode 100644 index 26a8a0cb63..0000000000 --- a/plugins/Clist_mw/CLUIFrames/cluiframes.cpp +++ /dev/null @@ -1,3013 +0,0 @@ -/* -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 "../commonheaders.h" - -extern HINSTANCE g_hInst; - -//we use dynamic frame list, -//but who wants so huge number of frames ?? -#define MAX_FRAMES 16 - -#define UNCOLLAPSED_FRAME_SIZE 0 -#define DEFAULT_TITLEBAR_HEIGHT 20 - -//legacy menu support -#define frame_menu_lock 1 -#define frame_menu_visible 2 -#define frame_menu_showtitlebar 3 -#define frame_menu_floating 4 -extern int ModifyMenuItemProxy(WPARAM wParam,LPARAM lParam); -static int UpdateTBToolTip(int framepos); -INT_PTR CLUIFrameSetFloat(WPARAM wParam,LPARAM lParam); -int CLUIFrameResizeFloatingFrame(int framepos); -extern int ProcessCommandProxy(WPARAM wParam,LPARAM lParam); -extern int InitFramesMenus(void); -int GapBetweenTitlebar; - -LOGFONTA TitleBarLogFont = {0}; - -boolean FramesSysNotStarted = TRUE; - -HANDLE hService[20], hHook[4]; - -typedef struct -{ - int order; - int realpos; -} - SortData; - -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);} - //if (sd1->order == sd2->order){return 0;} - return 0; -} - - -//============ -#define CLUIFRAMESSETALIGN "CLUIFramesSetAlign" - -#define CLUIFRAMESSETALIGNALTOP "CLUIFramesSetAlignalTop" -#define CLUIFRAMESSETALIGNALCLIENT "CLUIFramesSetAlignalClient" -#define CLUIFRAMESSETALIGNALBOTTOM "CLUIFramesSetAlignalBottom" - -#define CLUIFRAMESMOVEUPDOWN "CLUIFramesMoveUpDown" -typedef struct tagMenuHandles -{ - HANDLE MainMenuItem; - HANDLE MIVisible,MITitle,MITBVisible,MILock,MIColl,MIFloating,MIAlignRoot; - HANDLE MIAlignTop,MIAlignClient,MIAlignBottom; - HANDLE MIBorder; -} FrameMenuHandles; - -typedef struct tagFrameTitleBar{ - HWND hwnd; - HWND TitleBarbutt; - HWND hwndTip; - - LPTSTR tbname; - LPTSTR tooltip; - HMENU hmenu; - HICON hicon; - - BOOLEAN ShowTitleBar; - BOOLEAN ShowTitleBarTip; - COLORREF BackColour; - int oldstyles; - POINT oldpos; - RECT wndSize; -} FrameTitleBar; - -typedef struct _DockOpt -{ - HWND hwndLeft; - HWND hwndRight; -} -DockOpt; - -typedef struct { - int id; - HWND hWnd ; - RECT wndSize; - LPTSTR name; - int align; - int height; - int dwFlags; - BOOLEAN Locked; - BOOLEAN visible; - BOOLEAN needhide; - BOOLEAN collapsed; - int prevvisframe; - int HeightWhenCollapsed; - FrameTitleBar TitleBar; - FrameMenuHandles MenuHandles; - int oldstyles; - BOOLEAN floating; - HWND ContainerWnd; - POINT FloatingPos; - POINT FloatingSize; - BOOLEAN minmaxenabled; - BOOLEAN UseBorder; - int order; - DockOpt dockOpt; -} wndFrame; - -//static wndFrame Frames[MAX_FRAMES]; -static wndFrame *Frames = NULL; - -static int nFramescount = 0; -static int alclientFrame = -1;//for fast access to frame with alclient properties -static int NextFrameId = 100; - -HFONT TitleBarFont; -static int TitleBarH = DEFAULT_TITLEBAR_HEIGHT; -static boolean resizing = FALSE; - -// menus -static HANDLE contMIVisible,contMITitle,contMITBVisible,contMILock,contMIColl,contMIFloating; -static HANDLE contMIAlignRoot; -static HANDLE contMIAlignTop,contMIAlignClient,contMIAlignBottom; -static HANDLE contMIBorder; -static HGENMENU MainMIRoot = (HGENMENU)-1; - -// others -static int ContactListHeight; -static int LastStoreTick = 0; - -static int lbypos = -1; -static int oldframeheight = -1; -static int curdragbar = -1; -static CRITICAL_SECTION csFrameHook; - -static BOOLEAN CLUIFramesFitInSize(void); -static int RemoveItemFromList(int pos,wndFrame **lpFrames,int *FrameItemCount); -HWND hWndExplorerToolBar; -static int GapBetweenFrames = 1; - -static int RemoveItemFromList(int pos,wndFrame **lpFrames,int *FrameItemCount) -{ - memcpy(&((*lpFrames)[pos]),&((*lpFrames)[pos+1]),sizeof(wndFrame)*(*FrameItemCount-pos-1)); - (*FrameItemCount)--; - (*lpFrames) = (wndFrame*)realloc((*lpFrames),sizeof(wndFrame)*(*FrameItemCount)); - return 0; -} - -static int id2pos(int id) -{ - if (FramesSysNotStarted) - return -1; - - for (int i = 0;idockOpt.hwndLeft == NULL && pThumbLeft->dockOpt.hwndRight == NULL ) { - pThumbRight->dockOpt.hwndLeft = pThumbLeft->ContainerWnd; - pThumbLeft->dockOpt.hwndRight = pThumbRight->ContainerWnd; - } -} - -static void UndockThumbs( wndFrame *pThumb1, wndFrame *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; -} - -BOOLEAN bMoveTogether; - -static void PositionThumb( wndFrame *pThumb, short nX, short nY ) -{ - wndFrame *pCurThumb = &Frames[0]; - wndFrame *pDockThumb = pThumb; - wndFrame fakeMainWindow; - wndFrame fakeTaskBarWindow; - RECT rc; - RECT rcThumb; - RECT rcOld; - SIZE sizeScreen; - 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; - - 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, TRUE ); - - if ( bDockedLeft ) - DockThumbs( pCurThumb, pThumb, FALSE ); - } - - // 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 = nFramescount){ - pCurThumb = &fakeMainWindow;continue; - } - - pCurThumb = &Frames[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 ); - - // OK, move all docked thumbs - if ( bMoveTogether ) { - pDockThumb = FindFrameByWnd( pDockThumb->dockOpt.hwndRight ); - PositionThumb( pDockThumb, (short)( nNewX + nWidth ), (short)nNewY ); - } -} - -////////// - -void GetBorderSize(HWND hwnd,RECT *rect) -{ - RECT wr,cr; - POINT pt1,pt2; - - 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; -} - -//append string -char __inline *AS(char *str,const char *setting,char *addstr) -{ - if (str != NULL) { - strcpy(str,setting); - strcat(str,addstr); - } - return str; -} - -int DBLoadFrameSettingsAtPos(int pos,int Frameid) -{ - char sadd[15]; - char buf[255]; - - _itoa(pos,sadd,10); - - //boolean - Frames[Frameid].collapsed = DBGetContactSettingByte(0,CLUIFrameModule,AS(buf,"Collapse",sadd),Frames[Frameid].collapsed); - - Frames[Frameid].Locked = DBGetContactSettingByte(0,CLUIFrameModule,AS(buf,"Locked",sadd),Frames[Frameid].Locked); - Frames[Frameid].visible = DBGetContactSettingByte(0,CLUIFrameModule,AS(buf,"Visible",sadd),Frames[Frameid].visible); - Frames[Frameid].TitleBar.ShowTitleBar = DBGetContactSettingByte(0,CLUIFrameModule,AS(buf,"TBVisile",sadd),Frames[Frameid].TitleBar.ShowTitleBar); - - Frames[Frameid].height = DBGetContactSettingWord(0,CLUIFrameModule,AS(buf,"Height",sadd),Frames[Frameid].height); - Frames[Frameid].HeightWhenCollapsed = DBGetContactSettingWord(0,CLUIFrameModule,AS(buf,"HeightCollapsed",sadd),0); - Frames[Frameid].align = DBGetContactSettingWord(0,CLUIFrameModule,AS(buf,"Align",sadd),Frames[Frameid].align); - - Frames[Frameid].FloatingPos.x = DBGetContactSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatX",sadd),100,0,1024); - Frames[Frameid].FloatingPos.y = DBGetContactSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatY",sadd),100,0,1024); - Frames[Frameid].FloatingSize.x = DBGetContactSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatW",sadd),100,0,1024); - Frames[Frameid].FloatingSize.y = DBGetContactSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatH",sadd),100,0,1024); - - Frames[Frameid].floating = DBGetContactSettingByte(0,CLUIFrameModule,AS(buf,"Floating",sadd),0); - Frames[Frameid].order = DBGetContactSettingWord(0,CLUIFrameModule,AS(buf,"Order",sadd),0); - - Frames[Frameid].UseBorder = DBGetContactSettingByte(0,CLUIFrameModule,AS(buf,"UseBorder",sadd),Frames[Frameid].UseBorder); - - return 0; -} - -int DBStoreFrameSettingsAtPos(int pos,int Frameid) -{ - char sadd[16]; - char buf[255]; - - _itoa(pos,sadd,10); - - DBWriteContactSettingTString(0,CLUIFrameModule,AS(buf,"Name",sadd),Frames[Frameid].name); - //boolean - DBWriteContactSettingByte(0,CLUIFrameModule,AS(buf,"Collapse",sadd),(BYTE)btoint(Frames[Frameid].collapsed)); - DBWriteContactSettingByte(0,CLUIFrameModule,AS(buf,"Locked",sadd),(BYTE)btoint(Frames[Frameid].Locked)); - DBWriteContactSettingByte(0,CLUIFrameModule,AS(buf,"Visible",sadd),(BYTE)btoint(Frames[Frameid].visible)); - DBWriteContactSettingByte(0,CLUIFrameModule,AS(buf,"TBVisile",sadd),(BYTE)btoint(Frames[Frameid].TitleBar.ShowTitleBar)); - - DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"Height",sadd),(WORD)Frames[Frameid].height); - DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"HeightCollapsed",sadd),(WORD)Frames[Frameid].HeightWhenCollapsed); - DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"Align",sadd),(WORD)Frames[Frameid].align); - //FloatingPos - DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"FloatX",sadd),(WORD)Frames[Frameid].FloatingPos.x); - DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"FloatY",sadd),(WORD)Frames[Frameid].FloatingPos.y); - DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"FloatW",sadd),(WORD)Frames[Frameid].FloatingSize.x); - DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"FloatH",sadd),(WORD)Frames[Frameid].FloatingSize.y); - - DBWriteContactSettingByte(0,CLUIFrameModule,AS(buf,"Floating",sadd),(BYTE)btoint(Frames[Frameid].floating)); - DBWriteContactSettingByte(0,CLUIFrameModule,AS(buf,"UseBorder",sadd),(BYTE)btoint(Frames[Frameid].UseBorder)); - DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"Order",sadd),(WORD)Frames[Frameid].order); - //DBWriteContactSettingString(0,CLUIFrameModule,AS(buf,"TBName",sadd),Frames[Frameid].TitleBar.tbname); - return 0; -} - -int LocateStorePosition(int Frameid,int maxstored) -{ - int i; - LPTSTR frmname; - char settingname[255]; - if (Frames[Frameid].name == NULL) return -1; - - for (i = 0;i= nFramescount) - return -1; - - int maxstored = DBGetContactSettingWord(0,CLUIFrameModule,"StoredFrames",-1); - if (maxstored == -1) - return 0; - - int storpos = LocateStorePosition(Frameid,maxstored); - if (storpos == -1) - return 0; - - DBLoadFrameSettingsAtPos(storpos,Frameid); - return 0; -} - -int CLUIFramesStoreFrameSettings(int Frameid) -{ - if (Frameid < 0 || Frameid >= nFramescount) - return -1; - - int maxstored = DBGetContactSettingWord(0,CLUIFrameModule,"StoredFrames",-1); - if (maxstored == -1) maxstored = 0; - - int storpos = LocateStorePosition(Frameid,maxstored); - if (storpos == -1) {storpos = maxstored; maxstored++;} - - DBStoreFrameSettingsAtPos(storpos,Frameid); - DBWriteContactSettingWord(0,CLUIFrameModule,"StoredFrames",(WORD)maxstored); - //ulockfrm(); - return 0; -} - -int CLUIFramesStoreAllFrames() -{ - lockfrm(); - for (int i = 0;i= 0 && pos < nFramescount) { - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.flags = CMIM_NAME|CMIF_CHILDPOPUP|CMIF_TCHAR; - mi.ptszName = Frames[pos].TitleBar.tbname ? Frames[pos].TitleBar.tbname : Frames[pos].name; - ModifyMItem((WPARAM)contMITitle,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; - if (Frames[pos].visible) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIVisible,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; - if (Frames[pos].Locked) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMILock,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; - if (Frames[pos].TitleBar.ShowTitleBar) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMITBVisible,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; - if (Frames[pos].floating) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIFloating,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; - if ((Frames[pos].UseBorder)) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIBorder,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; - if (Frames[pos].align&alTop) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIAlignTop,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; - if (Frames[pos].align&alClient) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIAlignClient,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; - if (Frames[pos].align&alBottom) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIAlignBottom,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; - if (Frames[pos].collapsed) mi.flags |= CMIF_CHECKED; - if ((!Frames[pos].visible)||(Frames[pos].Locked)||(pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED; - ModifyMItem((WPARAM)contMIColl,(LPARAM)&mi); - } - ulockfrm(); - return 0; -} - -INT_PTR CLUIFramesModifyMainMenuItems(WPARAM wParam,LPARAM lParam) -{ - lockfrm(); - - int pos = id2pos(wParam); - if (pos >= 0 && pos < nFramescount) { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); - mi.flags = CMIM_NAME|CMIF_CHILDPOPUP|CMIF_TCHAR; - mi.ptszName = Frames[pos].TitleBar.tbname ? Frames[pos].TitleBar.tbname : Frames[pos].name; - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MITitle,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; - if (Frames[pos].visible) mi.flags |= CMIF_CHECKED; - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MIVisible,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; - if (Frames[pos].Locked) mi.flags |= CMIF_CHECKED; - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MILock,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; - if (Frames[pos].TitleBar.ShowTitleBar) mi.flags |= CMIF_CHECKED; - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MITBVisible,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; - if (Frames[pos].floating) mi.flags |= CMIF_CHECKED; - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MIFloating,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; - if ((Frames[pos].UseBorder)) mi.flags |= CMIF_CHECKED; - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MIBorder,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP|((Frames[pos].align&alClient)?CMIF_GRAYED:0); - if (Frames[pos].align&alTop) mi.flags |= CMIF_CHECKED; - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MIAlignTop,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; - if (Frames[pos].align&alClient) mi.flags |= CMIF_CHECKED; - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MIAlignClient,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP|((Frames[pos].align&alClient)?CMIF_GRAYED:0); - if (Frames[pos].align&alBottom) mi.flags |= CMIF_CHECKED; - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MIAlignBottom,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; - if (Frames[pos].collapsed) mi.flags |= CMIF_CHECKED; - if ((!Frames[pos].visible)||Frames[pos].Locked||(pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED; - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MIColl,(LPARAM)&mi); - } - ulockfrm(); - return 0; -} - -//hiword(wParam) = frameid,loword(wParam) = flag -INT_PTR CLUIFramesGetFrameOptions(WPARAM wParam,LPARAM lParam) -{ - if (FramesSysNotStarted) return 0; - - lockfrm(); - int pos = id2pos(HIWORD(wParam)); - if (pos < 0 || pos >= nFramescount) { - ulockfrm(); - return -1; - } - - INT_PTR retval; - - switch(LOWORD(wParam)) { - case FO_FLAGS: - retval = 0; - if (Frames[pos].visible) retval |= F_VISIBLE; - if (!Frames[pos].collapsed) retval |= F_UNCOLLAPSED; - if (Frames[pos].Locked) retval |= F_LOCKED; - if (Frames[pos].TitleBar.ShowTitleBar) retval |= F_SHOWTB; - if (Frames[pos].TitleBar.ShowTitleBarTip) retval |= F_SHOWTBTIP; - if (!(GetWindowLongPtr(Frames[pos].hWnd,GWL_STYLE)&WS_BORDER)) retval |= F_NOBORDER; - break; - - case FO_NAME: - retval = (INT_PTR)Frames[pos].name; - break; - - case FO_TBNAME: - retval = (INT_PTR)Frames[pos].TitleBar.tbname; - break; - - case FO_TBTIPNAME: - retval = (INT_PTR)Frames[pos].TitleBar.tooltip; - break; - - case FO_TBSTYLE: - retval = GetWindowLongPtr(Frames[pos].TitleBar.hwnd,GWL_STYLE); - break; - - case FO_TBEXSTYLE: - retval = GetWindowLongPtr(Frames[pos].TitleBar.hwnd,GWL_EXSTYLE); - break; - - case FO_ICON: - retval = (INT_PTR)Frames[pos].TitleBar.hicon; - break; - - case FO_HEIGHT: - retval = (INT_PTR)Frames[pos].height; - break; - - case FO_ALIGN: - retval = (INT_PTR)Frames[pos].align; - break; - case FO_FLOATING: - retval = (INT_PTR)Frames[pos].floating; - break; - default: - retval = -1; - break; - } - ulockfrm(); - return retval; -} - -//hiword(wParam) = frameid,loword(wParam) = flag -INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam,LPARAM lParam) -{ - lockfrm(); - int pos = id2pos(HIWORD(wParam)); - if (pos<0||pos>=nFramescount) { - ulockfrm(); - return -1; - } - - INT_PTR retval; // value to be returned - - switch(LOWORD(wParam) & ~FO_UNICODETEXT) { - case FO_FLAGS:{ - int flag = lParam; - int style; - - Frames[pos].dwFlags = flag; - Frames[pos].visible = FALSE; - if (flag&F_VISIBLE) Frames[pos].visible = TRUE; - - Frames[pos].collapsed = TRUE; - if (flag&F_UNCOLLAPSED) Frames[pos].collapsed = FALSE; - - Frames[pos].Locked = FALSE; - if (flag&F_LOCKED) Frames[pos].Locked = TRUE; - - Frames[pos].UseBorder = TRUE; - if (flag&F_NOBORDER) Frames[pos].UseBorder = FALSE; - - Frames[pos].TitleBar.ShowTitleBar = FALSE; - if (flag&F_SHOWTB) Frames[pos].TitleBar.ShowTitleBar = TRUE; - - Frames[pos].TitleBar.ShowTitleBarTip = FALSE; - if (flag&F_SHOWTBTIP) Frames[pos].TitleBar.ShowTitleBarTip = TRUE; - - SendMessage(Frames[pos].TitleBar.hwndTip,TTM_ACTIVATE,(WPARAM)Frames[pos].TitleBar.ShowTitleBarTip,0); - - style = (int)GetWindowLongPtr(Frames[pos].hWnd,GWL_STYLE); - style |= WS_BORDER; - if (flag&F_NOBORDER) {style &= (~WS_BORDER);} - SetWindowLongPtr(Frames[pos].hWnd,GWL_STYLE,(LONG)style); - ulockfrm(); - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,(LPARAM)0); - return 0; - } - - case FO_NAME: - if (lParam == (LPARAM)NULL) {ulockfrm(); return -1;} - mir_free(Frames[pos].name); - Frames[pos].name = mir_tstrdup((LPTSTR)lParam); - ulockfrm(); - return 0; - - case FO_TBNAME: - if (lParam == (LPARAM)NULL) {ulockfrm(); return(-1);} - mir_free(Frames[pos].TitleBar.tbname); - Frames[pos].TitleBar.tbname = mir_tstrdup((LPTSTR)lParam); - ulockfrm(); - if (Frames[pos].floating&&(Frames[pos].TitleBar.tbname != NULL)){SetWindowText(Frames[pos].ContainerWnd,Frames[pos].TitleBar.tbname);} - return 0; - - case FO_TBTIPNAME: - if (lParam == (LPARAM)NULL) {ulockfrm(); return(-1);} - mir_free(Frames[pos].TitleBar.tooltip); - Frames[pos].TitleBar.tooltip = mir_tstrdup((LPTSTR)lParam); - UpdateTBToolTip(pos); - ulockfrm(); - return 0; - - case FO_TBSTYLE: - SetWindowLongPtr(Frames[pos].TitleBar.hwnd,GWL_STYLE,lParam); - ulockfrm(); - return 0; - - case FO_TBEXSTYLE: - SetWindowLongPtr(Frames[pos].TitleBar.hwnd,GWL_EXSTYLE,lParam); - ulockfrm(); - return 0; - - case FO_ICON: - Frames[pos].TitleBar.hicon = (HICON)lParam; - ulockfrm(); - return 0; - - case FO_HEIGHT: - if (lParam<0) {ulockfrm(); return -1;} - retval = Frames[pos].height; - Frames[pos].height = lParam; - if (!CLUIFramesFitInSize()) Frames[pos].height = retval; - retval = Frames[pos].height; - ulockfrm(); - - return retval; - - case FO_FLOATING: - if (lParam<0) {ulockfrm(); return -1;} - - { - int id = Frames[pos].id; - Frames[pos].floating = !(lParam); - ulockfrm(); - - CLUIFrameSetFloat(id,1);//lparam = 1 use stored width and height - return wParam; - } - - case FO_ALIGN: - if ( !(lParam&alTop || lParam&alBottom || lParam&alClient)) { - OutputDebugStringA("Wrong align option \r\n"); - return (-1); - } - - if ((lParam&alClient)&&(CLUIFramesGetalClientFrame()>=0)) { //only one alClient frame possible - alclientFrame = -1;//recalc it - ulockfrm(); - return -1; - } - Frames[pos].align = lParam; - - ulockfrm(); - return 0; - } - ulockfrm(); - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,(LPARAM)0); - return -1; -} - -//wparam = lparam = 0 -static INT_PTR CLUIFramesShowAll(WPARAM wParam,LPARAM lParam) -{ - for (int i = 0;ihwndContactList,(LPARAM)0); - return 0; -} - -//wparam = lparam = 0 -INT_PTR CLUIFramesShowAllTitleBars(WPARAM wParam,LPARAM lParam) -{ - for (int i = 0;ihwndContactList,(LPARAM)0); - return 0; -} - -//wparam = lparam = 0 -INT_PTR CLUIFramesHideAllTitleBars(WPARAM wParam,LPARAM lParam) -{ - for (int i = 0;ihwndContactList,(LPARAM)0); - return 0; -} - -//wparam = frameid -INT_PTR CLUIFramesShowHideFrame(WPARAM wParam,LPARAM lParam) -{ - lockfrm(); - int pos = id2pos(wParam); - if ( pos >= 0 && (int)pos < nFramescount) - Frames[pos].visible = !Frames[pos].visible; - if (Frames[pos].floating) - CLUIFrameResizeFloatingFrame(pos); - ulockfrm(); - - if (!Frames[pos].floating) - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,(LPARAM)0); - return 0; -} - -//wparam = frameid -INT_PTR CLUIFramesShowHideFrameTitleBar(WPARAM wParam,LPARAM lParam) -{ - lockfrm(); - int pos = id2pos(wParam); - if ( pos >= 0 && (int)pos < nFramescount) - Frames[pos].TitleBar.ShowTitleBar = !Frames[pos].TitleBar.ShowTitleBar; - - ulockfrm(); - - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,(LPARAM)0); - return 0; -} - -//wparam = frameid -//lparam = -1 up ,1 down -INT_PTR CLUIFramesMoveUpDown(WPARAM wParam,LPARAM lParam) -{ - int pos,i,curpos,curalign,v,tmpval; - - lockfrm(); - pos = id2pos(wParam); - if (pos>=0&&(int)pos= v-1) - break; - - tmpval = Frames[sd[i+1].realpos].order; - Frames[sd[i+1].realpos].order = Frames[pos].order; - Frames[pos].order = tmpval; - break; - } - if (lParam == +1) { - if (i < 1) - break; - - tmpval = Frames[sd[i-1].realpos].order; - Frames[sd[i-1].realpos].order = Frames[pos].order; - Frames[pos].order = tmpval; - break; - } - } - } - - if (sd != NULL) - free(sd); - CLUIFramesStoreFrameSettings(pos); - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0); - } - ulockfrm(); - return 0; -} - -//wparam = frameid -//lparam = alignment -INT_PTR CLUIFramesSetAlign(WPARAM wParam,LPARAM lParam) -{ - CLUIFramesSetFrameOptions(MAKEWPARAM(FO_ALIGN,wParam),lParam); - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0); - return 0; -} - -INT_PTR CLUIFramesSetAlignalTop(WPARAM wParam,LPARAM lParam) -{ - return CLUIFramesSetAlign(wParam,alTop); -} - -INT_PTR CLUIFramesSetAlignalBottom(WPARAM wParam,LPARAM lParam) -{ - return CLUIFramesSetAlign(wParam,alBottom); -} - -INT_PTR CLUIFramesSetAlignalClient(WPARAM wParam,LPARAM lParam) -{ - return CLUIFramesSetAlign(wParam,alClient); -} - -//wparam = frameid -INT_PTR CLUIFramesLockUnlockFrame(WPARAM wParam,LPARAM lParam) -{ - lockfrm(); - int pos = id2pos(wParam); - if (pos >= 0 && (int)pos < nFramescount) { - Frames[pos].Locked = !Frames[pos].Locked; - CLUIFramesStoreFrameSettings(pos); - } - ulockfrm(); - return 0; -} - -//wparam = frameid -INT_PTR CLUIFramesSetUnSetBorder(WPARAM wParam,LPARAM lParam) -{ - int oldflags; - - lockfrm(); - int FrameId = id2pos(wParam); - if (FrameId == -1) { - ulockfrm(); - return -1; - } - - boolean flt = oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,wParam),0); - if (oldflags & F_NOBORDER) - oldflags &= (~F_NOBORDER); - else - oldflags |= F_NOBORDER; - - HWND hw = Frames[FrameId].hWnd; - RECT rc; - GetWindowRect(hw, &rc); - - ulockfrm(); - CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,wParam),oldflags); - - SetWindowPos(hw,0,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_DRAWFRAME); - return 0; -} - -//wparam = frameid -INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam,LPARAM lParam) -{ - int FrameId; - - lockfrm(); - FrameId = id2pos(wParam); - if (FrameId >= 0 && FrameId < nFramescount) { - int oldHeight; - - // do not collapse/uncollapse client/locked/invisible frames - if (Frames[FrameId].align == alClient&&!(Frames[FrameId].Locked||(!Frames[FrameId].visible)||Frames[FrameId].floating)) { - RECT rc; - if (CallService(MS_CLIST_DOCKINGISDOCKED,0,0)) { - ulockfrm(); - return 0; - } - if (DBGetContactSettingByte(NULL,"CLUI","AutoSize",0)) { - ulockfrm(); - return 0; - } - - GetWindowRect(pcli->hwndContactList, &rc); - - if (Frames[FrameId].collapsed == TRUE) { - rc.bottom -= rc.top; - rc.bottom -= Frames[FrameId].height; - Frames[FrameId].HeightWhenCollapsed = Frames[FrameId].height; - Frames[FrameId].collapsed = FALSE; - } - else { - rc.bottom -= rc.top; - rc.bottom += Frames[FrameId].HeightWhenCollapsed; - Frames[FrameId].collapsed = TRUE; - } - - SetWindowPos(pcli->hwndContactList,NULL,0,0,rc.right-rc.left,rc.bottom,SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOMOVE); - - CLUIFramesStoreAllFrames(); - ulockfrm(); - return 0; - } - - if (Frames[FrameId].Locked||(!Frames[FrameId].visible)) - return 0; - - oldHeight = Frames[FrameId].height; - - // if collapsed, uncollapse - if (Frames[FrameId].collapsed == TRUE) { - Frames[FrameId].HeightWhenCollapsed = Frames[FrameId].height; - Frames[FrameId].height = UNCOLLAPSED_FRAME_SIZE; - Frames[FrameId].collapsed = FALSE; - } - // if uncollapsed, collapse - else { - Frames[FrameId].height = Frames[FrameId].HeightWhenCollapsed; - Frames[FrameId].collapsed = TRUE; - } - - if (!Frames[FrameId].floating) { - if (!CLUIFramesFitInSize()) { - //cant collapse,we can resize only for height2*UNCOLLAPSED_FRAME_SIZE) { - oldHeight = Frames[alfrm].height-UNCOLLAPSED_FRAME_SIZE; - Frames[FrameId].collapsed = TRUE; - } - } - else { - int i,sumheight = 0; - for (i = 0; i < nFramescount; i++) { - if ((Frames[i].align != alClient)&&(!Frames[i].floating)&&(Frames[i].visible)&&(!Frames[i].needhide)) { - sumheight += (Frames[i].height)+(TitleBarH*btoint(Frames[i].TitleBar.ShowTitleBar))+2; - return FALSE; - } - - if (sumheight>ContactListHeight-0-2) - Frames[FrameId].height = (ContactListHeight-0-2)-sumheight; - } - } - - Frames[FrameId].height = oldHeight; - - if (Frames[FrameId].collapsed == FALSE) { - if (Frames[FrameId].floating) - SetWindowPos(Frames[FrameId].ContainerWnd,HWND_TOP,0,0,Frames[FrameId].wndSize.right-Frames[FrameId].wndSize.left+6,Frames[FrameId].height+DEFAULT_TITLEBAR_HEIGHT+4,SWP_SHOWWINDOW|SWP_NOMOVE); - - ulockfrm(); - return -1; - } - } - } - - ulockfrm(); - - if (!Frames[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(Frames[FrameId].ContainerWnd,&contwnd); - contwnd.top = contwnd.bottom-contwnd.top;//height - contwnd.left = contwnd.right-contwnd.left;//width - - contwnd.top -= (oldHeight-Frames[FrameId].height);//newheight - SetWindowPos(Frames[FrameId].ContainerWnd,HWND_TOP,0,0,contwnd.left,contwnd.top,SWP_SHOWWINDOW|SWP_NOMOVE); - } - CLUIFramesStoreAllFrames(); - return 0; - } - else return -1; - - ulockfrm(); - return 0; -} - -static int CLUIFramesLoadMainMenu() -{ - CLISTMENUITEM mi; - int i,separator; - - if ( !(ServiceExists(MS_CLIST_REMOVEMAINMENUITEM))) { - //hmm new menu system not used..so display only two items and warning message - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); - // create "show all frames" menu - mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA)); - mi.flags = CMIF_GRAYED; - mi.position = 10000000; - mi.pszPopupName = LPGEN("Frames"); - mi.pszName = LPGEN("New Menu System not Found..."); - mi.pszService = ""; - Menu_AddMainMenuItem(&mi); - - // create "show all frames" menu - mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA)); - mi.flags = 0; - mi.position = 10100000; - mi.pszPopupName = LPGEN("Frames"); - mi.pszName = LPGEN("Show All Frames"); - mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMES; - Menu_AddMainMenuItem(&mi); - - mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_HELP)); - mi.position = 10100001; - mi.pszPopupName = LPGEN("Frames"); - mi.flags = CMIF_CHILDPOPUP; - mi.pszName = LPGEN("Show All Titlebars"); - mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMESTB; - Menu_AddMainMenuItem(&mi); - return 0; - } - - if (MainMIRoot != (HGENMENU)-1) { - CallService(MS_CLIST_REMOVEMAINMENUITEM,(WPARAM)MainMIRoot,0); - MainMIRoot = (HGENMENU)-1; - } - - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); - - // create root menu - mi.hIcon = LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_CLIENTMIRANDA)); - mi.flags = CMIF_ROOTPOPUP; - mi.position = 3000090000; - mi.pszPopupName = (char*)-1; - mi.pszName = LPGEN("Frames"); - mi.pszService = 0; - MainMIRoot = Menu_AddMainMenuItem(&mi); - - // create frames menu - separator = 3000200000; - for (i = 0;ihwndContactList == 0) return -1; - if (FramesSysNotStarted) return -1; - if (clfrm->cbSize != sizeof(CLISTFrame)) return -1; - if (!(TitleBarFont)) TitleBarFont = CLUILoadTitleBarFont(); - - lockfrm(); - if (nFramescount>=MAX_FRAMES) { ulockfrm(); return -1;} - Frames = (wndFrame*)realloc(Frames,sizeof(wndFrame)*(nFramescount+1)); - - memset(&Frames[nFramescount],0,sizeof(wndFrame)); - Frames[nFramescount].id = NextFrameId++; - Frames[nFramescount].align = clfrm->align; - Frames[nFramescount].hWnd = clfrm->hWnd; - Frames[nFramescount].height = clfrm->height; - Frames[nFramescount].TitleBar.hicon = clfrm->hIcon; - Frames[nFramescount].TitleBar.BackColour; - Frames[nFramescount].floating = FALSE; - - //override tbbtip - //clfrm->Flags != F_SHOWTBTIP; - // - if (DBGetContactSettingByte(0,CLUIFrameModule,"RemoveAllBorders",0) == 1) - clfrm->Flags |= F_NOBORDER; - - Frames[nFramescount].dwFlags = clfrm->Flags; - - if (clfrm->name == NULL||((clfrm->Flags&F_UNICODE) ? lstrlenW(clfrm->wname) : lstrlenA(clfrm->name)) == 0) { - Frames[nFramescount].name = (LPTSTR)malloc(255 * sizeof(TCHAR)); - GetClassName(Frames[nFramescount].hWnd,Frames[nFramescount].name,255); - } - else Frames[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) ? lstrlenW(clfrm->TBwname) : lstrlenA(clfrm->TBname)) == 0) - Frames[nFramescount].TitleBar.tbname = mir_tstrdup(Frames[nFramescount].name); - else - Frames[nFramescount].TitleBar.tbname = (clfrm->Flags&F_UNICODE) ? mir_u2t(clfrm->TBwname) : mir_a2t(clfrm->TBname); - Frames[nFramescount].needhide = FALSE; - Frames[nFramescount].TitleBar.ShowTitleBar = (clfrm->Flags&F_SHOWTB?TRUE:FALSE); - Frames[nFramescount].TitleBar.ShowTitleBarTip = (clfrm->Flags&F_SHOWTBTIP?TRUE:FALSE); - - Frames[nFramescount].collapsed = clfrm->Flags & F_UNCOLLAPSED ? FALSE:TRUE; - Frames[nFramescount].Locked = clfrm->Flags & F_LOCKED ? TRUE : FALSE; - Frames[nFramescount].visible = clfrm->Flags & F_VISIBLE ? TRUE : FALSE; - - Frames[nFramescount].UseBorder = (clfrm->Flags&F_NOBORDER)?FALSE:TRUE; - - // create frame - Frames[nFramescount].TitleBar.hwnd = CreateWindow(CLUIFrameTitleBarClassName,Frames[nFramescount].name, - (DBGetContactSettingByte(0,CLUIFrameModule,"RemoveAllTitleBarBorders",0)?0:WS_BORDER) |WS_CHILD|WS_CLIPCHILDREN| - (Frames[nFramescount].TitleBar.ShowTitleBar?WS_VISIBLE:0)| WS_CLIPCHILDREN, - 0,0,0,0,pcli->hwndContactList,NULL,g_hInst,NULL); - SetWindowLongPtr(Frames[nFramescount].TitleBar.hwnd,GWLP_USERDATA,Frames[nFramescount].id); - - Frames[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(Frames[nFramescount].TitleBar.hwndTip, HWND_TOPMOST,0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - - TOOLINFO ti = { 0 }; - ti.cbSize = sizeof(ti); - ti.lpszText = _T(""); - ti.hinst = g_hInst; - ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS ; - ti.uId = (UINT_PTR)Frames[nFramescount].TitleBar.hwnd; - SendMessage(Frames[nFramescount].TitleBar.hwndTip,TTM_ADDTOOL,(WPARAM)0,(LPARAM)&ti); - - SendMessage(Frames[nFramescount].TitleBar.hwndTip,TTM_ACTIVATE,(WPARAM)Frames[nFramescount].TitleBar.ShowTitleBarTip,0); - - Frames[nFramescount].oldstyles = GetWindowLongPtr(Frames[nFramescount].hWnd,GWL_STYLE); - Frames[nFramescount].TitleBar.oldstyles = GetWindowLongPtr(Frames[nFramescount].TitleBar.hwnd,GWL_STYLE); - //Frames[nFramescount].FloatingPos.x = - - retval = Frames[nFramescount].id; - Frames[nFramescount].order = nFramescount+1; - nFramescount++; - - CLUIFramesLoadFrameSettings(id2pos(retval)); - style = GetWindowLongPtr(Frames[nFramescount-1].hWnd,GWL_STYLE); - style &= (~WS_BORDER); - style |= ((Frames[nFramescount-1].UseBorder)?WS_BORDER:0); - SetWindowLongPtr(Frames[nFramescount-1].hWnd,GWL_STYLE,style); - - if (Frames[nFramescount-1].order == 0){Frames[nFramescount-1].order = nFramescount;} - ulockfrm(); - - alclientFrame = -1;//recalc it - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0); - - if (Frames[nFramescount-1].floating) { - Frames[nFramescount-1].floating = FALSE; - CLUIFrameSetFloat(retval,1);//lparam = 1 use stored width and height - } - - return retval; -} - -static INT_PTR CLUIFramesRemoveFrame(WPARAM wParam,LPARAM lParam) -{ - if (FramesSysNotStarted) - return -1; - - lockfrm(); - int pos = id2pos(wParam); - - if (pos<0||pos>nFramescount){ulockfrm();return(-1);} - - mir_free(Frames[pos].name); - mir_free(Frames[pos].TitleBar.tbname); - mir_free(Frames[pos].TitleBar.tooltip); - - DestroyWindow(Frames[pos].hWnd); - Frames[pos].hWnd = (HWND)-1; - DestroyWindow(Frames[pos].TitleBar.hwnd); - Frames[pos].TitleBar.hwnd = (HWND)-1; - DestroyWindow(Frames[pos].ContainerWnd); - Frames[pos].ContainerWnd = (HWND)-1; - DestroyMenu(Frames[pos].TitleBar.hmenu); - - RemoveItemFromList(pos,&Frames,&nFramescount); - - ulockfrm(); - InvalidateRect(pcli->hwndContactList,NULL,TRUE); - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0); - InvalidateRect(pcli->hwndContactList,NULL,TRUE); - - return 0; -} - - -int CLUIFramesForceUpdateTB(const wndFrame *Frame) -{ - if (Frame->TitleBar.hwnd != 0) - RedrawWindow(Frame->TitleBar.hwnd,NULL,NULL,RDW_ALLCHILDREN|RDW_UPDATENOW|RDW_ERASE|RDW_INVALIDATE|RDW_FRAME); - return 0; -} - -int CLUIFramesForceUpdateFrame(const wndFrame *Frame) -{ - if (Frame->hWnd != 0) { - RedrawWindow(Frame->hWnd,NULL,NULL,RDW_UPDATENOW|RDW_FRAME|RDW_ERASE|RDW_INVALIDATE); - UpdateWindow(Frame->hWnd); - } - if (Frame->floating) { - if (Frame->ContainerWnd != 0) - RedrawWindow(Frame->ContainerWnd,NULL,NULL,RDW_UPDATENOW|RDW_ALLCHILDREN|RDW_ERASE|RDW_INVALIDATE|RDW_FRAME); - } - return 0; -} - -int CLUIFrameMoveResize(const wndFrame *Frame) -{ - //int b; - // we need to show or hide the frame? - if (Frame->visible&&(!Frame->needhide)) { - ShowWindow(Frame->hWnd,SW_SHOW); - ShowWindow(Frame->TitleBar.hwnd,Frame->TitleBar.ShowTitleBar == TRUE?SW_SHOW:SW_HIDE); - } - else { - ShowWindow(Frame->hWnd,SW_HIDE); - ShowWindow(Frame->TitleBar.hwnd,SW_HIDE); - return 0; - } - - // 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_NOREDRAW); - - // set titlebar position - if (Frame->TitleBar.ShowTitleBar) - SetWindowPos(Frame->TitleBar.hwnd,NULL,Frame->wndSize.left,Frame->wndSize.top-TitleBarH-GapBetweenTitlebar, - Frame->wndSize.right-Frame->wndSize.left, - TitleBarH,SWP_NOZORDER|SWP_NOREDRAW ); - - return 0; -} - -BOOLEAN CLUIFramesFitInSize(void) -{ - int sumheight = 0; - int tbh = 0; // title bar height - - int clientfrm = CLUIFramesGetalClientFrame(); - if (clientfrm != -1) - tbh = TitleBarH*btoint(Frames[clientfrm].TitleBar.ShowTitleBar); - - for (int i = 0;iContactListHeight-tbh-2) - return FALSE; - } - } - return TRUE; -} - -int CLUIFramesGetMinHeight() -{ - int i,tbh,clientfrm,sumheight = 0; - RECT border; - int allbord = 0; - if (pcli->hwndContactList == NULL) return 0; - lockfrm(); - - // search for alClient frame and get the titlebar's height - tbh = 0; - clientfrm = CLUIFramesGetalClientFrame(); - if (clientfrm != -1) - tbh = TitleBarH*btoint(Frames[clientfrm].TitleBar.ShowTitleBar); - - for (i = 0; i < nFramescount; i++) { - if ((Frames[i].align != alClient)&&(Frames[i].visible)&&(!Frames[i].needhide)&&(!Frames[i].floating)) { - RECT wsize; - - GetWindowRect(Frames[i].hWnd,&wsize); - sumheight += (wsize.bottom-wsize.top)+(TitleBarH*btoint(Frames[i].TitleBar.ShowTitleBar))+3; - } - } - ulockfrm(); - GetBorderSize(pcli->hwndContactList,&border); - return (sumheight+border.top+border.bottom+allbord+tbh+3); -} - -int CLUIFramesResize(const RECT newsize) -{ - int sumheight = 9999999,newheight; - int prevframe,prevframebottomline; - int tbh,curfrmtbh; - int drawitems; - int clientfrm; - int i,j; - int sepw = GapBetweenFrames; - SortData *sdarray; - - GapBetweenTitlebar = (int)DBGetContactSettingDword(NULL,"CLUIFrames","GapBetweenTitleBar",1); - GapBetweenFrames = DBGetContactSettingDword(NULL,"CLUIFrames","GapBetweenFrames",1); - TitleBarH = DBGetContactSettingDword(NULL,"CLUIFrames","TitleBarH",DEFAULT_TITLEBAR_HEIGHT); - - sepw = GapBetweenFrames; - if (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 = (TitleBarH+GapBetweenTitlebar)*btoint(Frames[clientfrm].TitleBar.ShowTitleBar); - - for (i = 0; i < nFramescount; i++) { - if (!Frames[i].floating) { - Frames[i].needhide = FALSE; - Frames[i].wndSize.left = 0; - Frames[i].wndSize.right = newsize.right-0; - } - } - - //sorting stuff - sdarray = (SortData*)malloc(sizeof(SortData)*nFramescount); - if (sdarray == NULL){return(-1);} - for (i = 0;i(newheight-tbh)&&drawitems>0) { - sumheight = 0; - drawitems = 0; - for (i = 0;inewheight-tbh) { - sumheight -= (Frames[i].height)+curfrmtbh+sepw; - Frames[i].needhide = TRUE; - drawitems--; - break; - } - } - } - } - - prevframe = -1; - prevframebottomline = 0; - for (j = 0;jnewheight){ - //prevframebottomline -= Frames[i].height+(curfrmtbh+1); - //Frames[i].needhide = TRUE; - } - } - } - - if (sumheightnewheight) { - //prevframebottomline -= Frames[i].height+(tbh+1); - //Frames[i].needhide = TRUE; - } - break; - } - } - } - - //newheight - prevframebottomline = newheight+sepw; - //prevframe = -1; - for (j = nFramescount-1;j>=0;j--) { - //move all alBottom frames - i = sdarray[j].realpos; - if ((Frames[i].visible)&&(!Frames[i].floating)&&(!Frames[i].needhide)&&(Frames[i].align == alBottom)) { - curfrmtbh = (TitleBarH+GapBetweenTitlebar)*btoint(Frames[i].TitleBar.ShowTitleBar); - - Frames[i].wndSize.bottom = prevframebottomline-sepw; - Frames[i].wndSize.top = Frames[i].wndSize.bottom-Frames[i].height-(Frames[i].UseBorder?2:0); - Frames[i].prevvisframe = prevframe; - prevframe = i; - prevframebottomline = Frames[i].wndSize.top/*-1*/-curfrmtbh; - if (prevframebottomline>newheight) { - - } - } - } - - if (sdarray != NULL) { - free(sdarray); - sdarray = NULL; - } - - for (i = 0;ihwndContactList,(LPARAM)0); return 0;} - if (lParam&FU_FMPOS) CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,1); - lockfrm(); - wParam = id2pos(wParam); - if (wParam<0||(int)wParam>=nFramescount) { ulockfrm(); return -1;} - if (lParam&FU_TBREDRAW) CLUIFramesForceUpdateTB(&Frames[wParam]); - if (lParam&FU_FMREDRAW) CLUIFramesForceUpdateFrame(&Frames[wParam]); - //if () {} - ulockfrm(); - - return 0; -} - -int CLUIFramesOnClistResize(WPARAM wParam,LPARAM lParam) -{ - RECT nRect,rcStatus; - int tick,i; - - if (FramesSysNotStarted) return -1; - lockfrm(); - - GetClientRect(pcli->hwndContactList,&nRect); - - 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; - - tick = GetTickCount(); - - CLUIFramesResize(nRect); - - for (i = 0; i < nFramescount; i++) { - CLUIFramesForceUpdateFrame(&Frames[i]); - CLUIFramesForceUpdateTB(&Frames[i]); - } - - //resizing = FALSE; - ulockfrm(); - tick = GetTickCount()-tick; - - if (pcli->hwndContactList != 0) InvalidateRect(pcli->hwndContactList,NULL,TRUE); - if (pcli->hwndContactList != 0) UpdateWindow(pcli->hwndContactList); - - Sleep(0); - - //dont save to database too many times - if (GetTickCount() - LastStoreTick > 1000) { - CLUIFramesStoreAllFrames(); - LastStoreTick = GetTickCount(); - } - return 0; -} - -static HBITMAP hBmpBackground; -static int backgroundBmpUse; -static COLORREF bkColour; -static COLORREF SelBkColour; -boolean AlignCOLLIconToLeft; //will hide frame icon - -int OnFrameTitleBarBackgroundChange(WPARAM wParam,LPARAM lParam) -{ - DBVARIANT dbv; - - AlignCOLLIconToLeft = DBGetContactSettingByte(NULL,"FrameTitleBar","AlignCOLLIconToLeft",0); - - bkColour = DBGetContactSettingDword(NULL,"FrameTitleBar","BkColour",CLCDEFAULT_BKCOLOUR); - //SelBkColour = DBGetContactSettingDword(NULL,"FrameTitleBar","SelBkColour",0); - - if (hBmpBackground) {DeleteObject(hBmpBackground); hBmpBackground = NULL;} - if (DBGetContactSettingByte(NULL,"FrameTitleBar","UseBitmap",CLCDEFAULT_USEBITMAP)) { - if (!DBGetContactSetting(NULL,"FrameTitleBar","BkBitmap",&dbv)) { - hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal); - mir_free(dbv.pszVal); - } - } - backgroundBmpUse = DBGetContactSettingWord(NULL,"FrameTitleBar","BkBmpUse",CLCDEFAULT_BKBMPUSE); - - CLUIFramesOnClistResize(0,0); - return 0; -} - -void DrawBackGroundTTB(HWND hwnd,HDC mhdc) -{ - HDC hdcMem,hdc; - RECT clRect,*rcPaint; - - int yScroll = 0; - int y; - PAINTSTRUCT paintst = {0}; - HBITMAP hBmpOsb,hOldBmp; - DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE); - int grey = 0; - HFONT oFont; - HBRUSH hBrushAlternateGrey = NULL; - - HFONT hFont; - - //InvalidateRect(hwnd,0,FALSE); - - 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; - y = -yScroll; - hdcMem = CreateCompatibleDC(hdc); - hBmpOsb = CreateBitmap(clRect.right,clRect.bottom,1,GetDeviceCaps(hdc,BITSPIXEL),NULL); - hOldBmp = (HBITMAP)SelectObject(hdcMem,hBmpOsb); - oFont = (HFONT)SelectObject(hdcMem,hFont); - SetBkMode(hdcMem,TRANSPARENT); - { - HBRUSH hBrush = CreateSolidBrush(bkColour); - HBRUSH hoBrush = (HBRUSH)SelectObject(hdcMem,hBrush); - FillRect(hdcMem,rcPaint,hBrush); - SelectObject(hdcMem,hoBrush); - DeleteObject(hBrush); - if (hBmpBackground) { - BITMAP bmp; - HDC hdcBmp; - int x,y; - int maxx,maxy; - int destw,desth; - - GetObject(hBmpBackground,sizeof(bmp),&bmp); - hdcBmp = CreateCompatibleDC(hdcMem); - SelectObject(hdcBmp,hBmpBackground); - y = backgroundBmpUse&CLBF_SCROLL?-yScroll:0; - maxx = backgroundBmpUse&CLBF_TILEH?clRect.right:1; - maxy = backgroundBmpUse&CLBF_TILEV?maxy = rcPaint->bottom:y+1; - switch(backgroundBmpUse&CLBM_TYPE) { - case CLB_STRETCH: - if (backgroundBmpUse&CLBF_PROPORTIONAL) { - if (clRect.right*bmp.bmHeighttop-desth) continue; - for (x = 0;xleft,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); -} - -static int DrawTitleBar(HDC dc,RECT rect,int Frameid) -{ - HDC paintDC = dc; - - HDC hdcMem = CreateCompatibleDC(paintDC); - HBITMAP hBmpOsb = CreateBitmap(rect.right,rect.bottom,1,GetDeviceCaps(paintDC,BITSPIXEL),NULL); - HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem,hBmpOsb); - - HFONT hoTTBFont = (HFONT)SelectObject(hdcMem,TitleBarFont); - SetBkMode(hdcMem,TRANSPARENT); - - HBRUSH hBack = GetSysColorBrush(COLOR_3DFACE); - HBRUSH hoBrush = (HBRUSH)SelectObject(hdcMem,hBack); - - lockfrm(); - - int pos = id2pos(Frameid); - if (pos >= 0 && pos < nFramescount) { - GetClientRect(Frames[pos].TitleBar.hwnd,&Frames[pos].TitleBar.wndSize); - - //set font charset - HFONT hf = (HFONT)GetStockObject(DEFAULT_GUI_FONT); - if (TitleBarLogFont.lfHeight != 0) - hf = CreateFontIndirectA(&TitleBarLogFont); - - HFONT oFont = (HFONT)SelectObject(hdcMem,hf); - - DrawBackGroundTTB(Frames[pos].TitleBar.hwnd,hdcMem); - //hFront = CreateSolidPe (SelBkColour); - //SelectObject(hdcMem,hFront); - SelBkColour = DBGetContactSettingDword(NULL,"CLUIFrames","FramesTitleBarFontCol",0); - if (SelBkColour) SetTextColor(hdcMem,SelBkColour); - - if (!AlignCOLLIconToLeft) { - - if (Frames[pos].TitleBar.hicon != NULL) { - //(TitleBarH>>1)-(GetSystemMetrics(SM_CXSMICON)>>1) - DrawIconEx(hdcMem,2,((TitleBarH>>1)-(GetSystemMetrics(SM_CYSMICON)>>1)),Frames[pos].TitleBar.hicon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL); - TextOut(hdcMem,GetSystemMetrics(SM_CYSMICON)+4,0,Frames[pos].TitleBar.tbname,lstrlen(Frames[pos].TitleBar.tbname)); - } - else - TextOut(hdcMem,2,0,Frames[pos].TitleBar.tbname,lstrlen(Frames[pos].TitleBar.tbname)); - } - else - TextOut(hdcMem,GetSystemMetrics(SM_CXSMICON)+2,0,Frames[pos].TitleBar.tbname,lstrlen(Frames[pos].TitleBar.tbname)); - - if (!AlignCOLLIconToLeft) - DrawIconEx(hdcMem,Frames[pos].TitleBar.wndSize.right-GetSystemMetrics(SM_CXSMICON)-2,((TitleBarH>>1)-(GetSystemMetrics(SM_CXSMICON)>>1)),Frames[pos].collapsed?LoadSkinnedIcon(SKINICON_OTHER_GROUPOPEN):LoadSkinnedIcon(SKINICON_OTHER_GROUPSHUT),GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL); - else - DrawIconEx(hdcMem,0,((TitleBarH>>1)-(GetSystemMetrics(SM_CXSMICON)>>1)),Frames[pos].collapsed?LoadSkinnedIcon(SKINICON_OTHER_GROUPOPEN):LoadSkinnedIcon(SKINICON_OTHER_GROUPSHUT),GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL); - - DeleteObject(hf); - SelectObject(hdcMem,oFont); - } - ulockfrm(); - - BitBlt(paintDC,rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,hdcMem,rect.left,rect.top,SRCCOPY); - - SelectObject(hdcMem,hoBmp); - SelectObject(hdcMem,hoBrush); - SelectObject(hdcMem,hoTTBFont); - DeleteDC(hdcMem); - DeleteObject(hBack); - DeleteObject(hBmpOsb); - return 0; -} - -//for old multiwindow -#define MPCF_CONTEXTFRAMEMENU 3 -POINT ptOld; -short nLeft = 0; -short nTop = 0; - -LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - RECT rect; - int Frameid,Framemod,direction; - int xpos,ypos; - - Frameid = (GetWindowLongPtr(hwnd,GWLP_USERDATA)); - memset(&rect,0,sizeof(rect)); - - switch(msg) { - case WM_CREATE: - SendMessage(hwnd,WM_SETFONT,(WPARAM)TitleBarFont,0); - return FALSE; - - case WM_MEASUREITEM: - return CallService(MS_CLIST_MENUMEASUREITEM,wParam,lParam); - - case WM_DRAWITEM: - return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam); - - case WM_ENABLE: - if (hwnd != 0) InvalidateRect(hwnd,NULL,FALSE); - return 0; - - case WM_COMMAND: - if ( ServiceExists(MO_CREATENEWMENUOBJECT)) { - if (ProcessCommandProxy(MAKEWPARAM(LOWORD(wParam),0),(LPARAM)Frameid)) break; - } - else if ( CallService(MS_CLIST_MENUPROCESSCOMMAND,MAKEWPARAM(LOWORD(wParam),MPCF_CONTEXTFRAMEMENU),(LPARAM)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: - Frames[framepos].Locked = !Frames[framepos].Locked; - break; - case frame_menu_visible: - Frames[framepos].visible = !Frames[framepos].visible; - break; - case frame_menu_showtitlebar: - Frames[framepos].TitleBar.ShowTitleBar = !Frames[framepos].TitleBar.ShowTitleBar; - break; - case frame_menu_floating: - CLUIFrameSetFloat(Frameid,0); - break; - } - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,(LPARAM)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); - lockfrm(); - if (framepos == -1){ulockfrm();break;} - hmenu = CreatePopupMenu(); - - AppendMenu(hmenu,MF_STRING|MF_DISABLED|MF_GRAYED,15,Frames[framepos].name); - AppendMenu(hmenu,MF_SEPARATOR,16,_T("")); - - if (Frames[framepos].Locked) - {AppendMenu(hmenu,MF_STRING|MF_CHECKED,frame_menu_lock,TranslateT("Lock Frame"));} - else{AppendMenu(hmenu,MF_STRING,frame_menu_lock,TranslateT("Lock Frame"));} - - if (Frames[framepos].visible) - {AppendMenu(hmenu,MF_STRING|MF_CHECKED,frame_menu_visible,TranslateT("Visible"));} - else{AppendMenu(hmenu,MF_STRING,frame_menu_visible,TranslateT("Visible"));} - - if (Frames[framepos].TitleBar.ShowTitleBar) - {AppendMenu(hmenu,MF_STRING|MF_CHECKED,frame_menu_showtitlebar,TranslateT("Show TitleBar"));} - else{AppendMenu(hmenu,MF_STRING,frame_menu_showtitlebar,TranslateT("Show TitleBar"));} - - if (Frames[framepos].floating) - {AppendMenu(hmenu,MF_STRING|MF_CHECKED,frame_menu_floating,TranslateT("Floating"));} - else{AppendMenu(hmenu,MF_STRING,frame_menu_floating,TranslateT("Floating"));} - - ulockfrm(); - } - - TrackPopupMenu(hmenu,TPM_LEFTALIGN,pt.x,pt.y,0,hwnd,0); - DestroyMenu(hmenu); - } - break; - - case WM_LBUTTONDBLCLK: - Framemod = -1; - lbypos = -1;oldframeheight = -1;ReleaseCapture(); - CallService(MS_CLIST_FRAMES_UCOLLFRAME,Frameid,0); - lbypos = -1;oldframeheight = -1;ReleaseCapture(); - break; - - case WM_LBUTTONUP: - if (GetCapture() != hwnd) - break; - curdragbar = -1;lbypos = -1;oldframeheight = -1;ReleaseCapture(); - break; - - case WM_LBUTTONDOWN: - { - int framepos = id2pos(Frameid); - if (framepos == -1) - break; - - lockfrm(); - if (Frames[framepos].floating) - { - POINT pt; - GetCursorPos(&pt); - Frames[framepos].TitleBar.oldpos = pt; - } - - if (( !(wParam & MK_CONTROL)) && Frames[framepos].Locked && (!(Frames[framepos].floating))) { - if (DBGetContactSettingByte(NULL,"CLUI","ClientAreaDrag",0)) { - POINT pt; - //pt = nm->pt; - GetCursorPos(&pt); - return SendMessage(GetParent(hwnd), WM_SYSCOMMAND, SC_MOVE|HTCAPTION,MAKELPARAM(pt.x,pt.y)); - } - } - - if (Frames[framepos].floating) { - RECT rc; - GetCursorPos(&ptOld); - //ClientToScreen(hwnd,&ptOld); - GetWindowRect( hwnd, &rc ); - - nLeft = (short)rc.left; - nTop = (short)rc.top; - } - ulockfrm(); - SetCapture(hwnd); - } - break; - - case WM_MOUSEMOVE: - { - POINT pt,pt2; - RECT wndr; - int pos; - - char TBcapt[255]; - - lockfrm(); - pos = id2pos(Frameid); - - if (pos != -1) { - int oldflags; - wsprintfA(TBcapt,"%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d", - Frames[pos].name,Frames[pos].height,Frames[pos].visible,Frames[pos].floating, - Frames[pos].FloatingPos.x,Frames[pos].FloatingPos.y, - Frames[pos].FloatingSize.x,Frames[pos].FloatingSize.y, - Frames[pos].order); - - oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,Frames[pos].id),(LPARAM)0); - if ( !(oldflags & F_SHOWTBTIP)) - oldflags |= F_SHOWTBTIP; - } - - ulockfrm(); - - if (wParam & MK_LBUTTON) { - RECT rcMiranda; - RECT rcwnd,rcOverlap; - POINT newpt,ofspt,curpt,newpos; - //if (GetCapture() != hwnd){break;} - //curdragbar = -1;lbypos = -1;oldframeheight = -1;ReleaseCapture(); - lockfrm(); - pos = id2pos(Frameid); - if (Frames[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 = Frames[pos].id; - ulockfrm(); - - ofspt.x = 0;ofspt.y = 0; - ClientToScreen(Frames[pos].TitleBar.hwnd,&ofspt); - ofspt.x = curpt.x-ofspt.x;ofspt.y = curpt.y-ofspt.y; - - CLUIFrameSetFloat(id,0); - newpt.x = 0;newpt.y = 0; - ClientToScreen(Frames[pos].TitleBar.hwnd,&newpt); - SetCursorPos(newpt.x+ofspt.x,newpt.y+ofspt.y); - GetCursorPos(&curpt); - lockfrm(); - Frames[pos].TitleBar.oldpos = curpt; - ulockfrm(); - return 0; - } - } - else { - int id = Frames[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 ); - - if (!IntersectRect( &rcOverlap, &rcwnd, &rcMiranda )) { - ulockfrm(); - GetCursorPos(&curpt); - GetWindowRect( Frames[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(Frames[pos].TitleBar.hwnd,&rcwnd); - ofspt.x = curpt.x-ofspt.x;ofspt.y = curpt.y-ofspt.y; - - Frames[pos].FloatingPos.x = newpos.x; - Frames[pos].FloatingPos.y = newpos.y; - CLUIFrameSetFloat(id,0); - //SetWindowPos(Frames[pos].ContainerWnd,0,newpos.x,newpos.y,0,0,SWP_NOSIZE); - - lockfrm(); - newpt.x = 0;newpt.y = 0; - ClientToScreen(Frames[pos].TitleBar.hwnd,&newpt); - - GetWindowRect( Frames[pos].hWnd, &rcwnd ); - SetCursorPos(newpt.x+(rcwnd.right-rcwnd.left)/2,newpt.y+(rcwnd.bottom-rcwnd.top)/2); - GetCursorPos(&curpt); - - Frames[pos].TitleBar.oldpos = curpt; - ulockfrm(); - - return 0; - } - } - ulockfrm(); - } - - if (wParam & MK_LBUTTON) { - int newh = -1,prevold; - - if (GetCapture() != hwnd){break;} - - lockfrm(); - pos = id2pos(Frameid); - - if (Frames[pos].floating) { - GetCursorPos(&pt); - if ((Frames[pos].TitleBar.oldpos.x != pt.x)||(Frames[pos].TitleBar.oldpos.y != pt.y)) { - - pt2 = pt; - ScreenToClient(hwnd,&pt2); - GetWindowRect(Frames[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( &Frames[pos], nLeft, nTop ); - else - SetWindowPos( Frames[pos].ContainerWnd, - HWND_TOPMOST, - nLeft, - nTop, - 0, - 0, - SWP_NOSIZE | SWP_NOZORDER ); - - ptOld = ptNew; - - pt.x = nLeft; - pt.y = nTop; - Frames[pos].TitleBar.oldpos = pt; - } - - ulockfrm(); - return 0; - } - - if (Frames[pos].prevvisframe != -1) { - GetCursorPos(&pt); - - if ((Frames[pos].TitleBar.oldpos.x == pt.x)&&(Frames[pos].TitleBar.oldpos.y == pt.y)) { - ulockfrm(); - break; - } - - ypos = rect.top+pt.y;xpos = rect.left+pt.x; - Framemod = -1; - - if (Frames[pos].align == alBottom) { - direction = -1; - Framemod = pos; - } - else { - direction = 1; - Framemod = Frames[pos].prevvisframe; - } - if (Frames[Framemod].Locked) {ulockfrm();break;} - if (curdragbar != -1&&curdragbar != pos) {ulockfrm();break;} - - if (lbypos == -1) { - curdragbar = pos; - lbypos = ypos; - oldframeheight = Frames[Framemod].height; - SetCapture(hwnd); - {ulockfrm();break;} - } - - newh = oldframeheight+direction*(ypos-lbypos); - if (newh > 0) { - prevold = Frames[Framemod].height; - Frames[Framemod].height = newh; - if (!CLUIFramesFitInSize()) { - Frames[Framemod].height = prevold; - ulockfrm(); - return TRUE; - } - Frames[Framemod].height = newh; - if (newh > 3) - Frames[Framemod].collapsed = TRUE; - } - Frames[pos].TitleBar.oldpos = pt; - } - ulockfrm(); - if (newh > 0) - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - break; - } - curdragbar = -1;lbypos = -1;oldframeheight = -1;ReleaseCapture(); - } - break; - - case WM_PRINTCLIENT: - if (lParam & PRF_CLIENT) { - GetClientRect(hwnd,&rect); - DrawTitleBar((HDC)wParam,rect,Frameid); - } - - case WM_PAINT: - { - HDC paintDC; - PAINTSTRUCT paintStruct; - - //GetClientRect(hwnd,&rect); - paintDC = BeginPaint(hwnd, &paintStruct); - rect = paintStruct.rcPaint; - DrawTitleBar(paintDC,rect,Frameid); - EndPaint(hwnd, &paintStruct); - } - return 0; - - default: - return DefWindowProc(hwnd, msg, wParam, lParam); - } - return TRUE; -} - -int CLUIFrameResizeFloatingFrame(int framepos) -{ - int width,height; - RECT rect; - - if (!Frames[framepos].floating){return 0;} - if (Frames[framepos].ContainerWnd == 0){return 0;} - GetClientRect(Frames[framepos].ContainerWnd,&rect); - - width = rect.right-rect.left; - height = rect.bottom-rect.top; - - Frames[framepos].visible?ShowWindow(Frames[framepos].ContainerWnd,SW_SHOW):ShowWindow(Frames[framepos].ContainerWnd,SW_HIDE); - - if (Frames[framepos].TitleBar.ShowTitleBar) { - ShowWindow(Frames[framepos].TitleBar.hwnd,SW_SHOW); - Frames[framepos].height = height-DEFAULT_TITLEBAR_HEIGHT; - - SetWindowPos(Frames[framepos].TitleBar.hwnd,HWND_TOP,0,0,width,DEFAULT_TITLEBAR_HEIGHT,SWP_SHOWWINDOW|SWP_DRAWFRAME); - SetWindowPos(Frames[framepos].hWnd,HWND_TOP,0,DEFAULT_TITLEBAR_HEIGHT,width,height-DEFAULT_TITLEBAR_HEIGHT,SWP_SHOWWINDOW); - } - else { - Frames[framepos].height = height; - ShowWindow(Frames[framepos].TitleBar.hwnd,SW_HIDE); - SetWindowPos(Frames[framepos].hWnd,HWND_TOP,0,0,width,height,SWP_SHOWWINDOW); - } - - if (Frames[framepos].ContainerWnd != 0) - UpdateWindow(Frames[framepos].ContainerWnd); - - GetWindowRect(Frames[framepos].hWnd,&Frames[framepos].wndSize); - return 0; -} - -static int CLUIFrameOnMainMenuBuild(WPARAM wParam,LPARAM lParam) -{ - CLUIFramesLoadMainMenu(); - return 0; -} - -LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - RECT rect = { 0 }; - int Frameid = (GetWindowLongPtr(hwnd,GWLP_USERDATA)); - - switch(msg) { - case WM_CREATE: - { - lockfrm(); - int framepos = id2pos(Frameid); - ulockfrm(); - } - return 0; - - case WM_GETMINMAXINFO: - { - int framepos; - MINMAXINFO minmax; - - lockfrm(); - framepos = id2pos(Frameid); - if (framepos<0||framepos>=nFramescount){ulockfrm();break;} - if (!Frames[framepos].minmaxenabled){ulockfrm();break;} - if (Frames[framepos].ContainerWnd == 0){ulockfrm();break;} - - if (Frames[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; - } - - memset(&minmax,0,sizeof(minmax)); - if (SendMessage(Frames[framepos].hWnd,WM_GETMINMAXINFO,(WPARAM)0,(LPARAM)&minmax) == 0) { - RECT border; - int tbh = TitleBarH*btoint(Frames[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 { - ulockfrm(); - return(DefWindowProc(hwnd, msg, wParam, lParam)); - } - - ulockfrm(); - } - - case WM_MOVE: - { - lockfrm(); - int framepos = id2pos(Frameid); - - if (framepos<0||framepos>=nFramescount){ulockfrm();break;} - if (Frames[framepos].ContainerWnd == 0){ulockfrm();return 0;} - - RECT rect; - GetWindowRect(Frames[framepos].ContainerWnd,&rect); - Frames[framepos].FloatingPos.x = rect.left; - Frames[framepos].FloatingPos.y = rect.top; - Frames[framepos].FloatingSize.x = rect.right-rect.left; - Frames[framepos].FloatingSize.y = rect.bottom-rect.top; - - CLUIFramesStoreFrameSettings(framepos); - ulockfrm(); - } - return 0; - - case WM_SIZE: - { - lockfrm(); - int framepos = id2pos(Frameid); - - if (framepos<0||framepos>=nFramescount){ulockfrm();break;} - if (Frames[framepos].ContainerWnd == 0){ulockfrm();return 0;} - CLUIFrameResizeFloatingFrame(framepos); - - RECT rect; - GetWindowRect(Frames[framepos].ContainerWnd,&rect); - Frames[framepos].FloatingPos.x = rect.left; - Frames[framepos].FloatingPos.y = rect.top; - Frames[framepos].FloatingSize.x = rect.right-rect.left; - Frames[framepos].FloatingSize.y = rect.bottom-rect.top; - - CLUIFramesStoreFrameSettings(framepos); - ulockfrm(); - } - return 0; - - 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(CreateWindowA("FramesContainer","aaaa",WS_POPUP|WS_THICKFRAME,x,y,width,height,parent,0,g_hInst,0)); -} - -INT_PTR CLUIFrameSetFloat(WPARAM wParam,LPARAM lParam) -{ - HWND hwndtmp, hwndtooltiptmp; - wndFrame *frame; - int pos; - - lockfrm(); - - pos = id2pos(wParam); - if (pos < 0 || pos > nFramescount) { - ulockfrm(); - return 0; - } - - frame = &Frames[pos]; - - //parent = GetParent(Frames[wParam].hWnd); - if (frame->floating) { - SetParent(frame->hWnd,pcli->hwndContactList); - SetParent(frame->TitleBar.hwnd,pcli->hwndContactList); - frame->floating = FALSE; - DestroyWindow(frame->ContainerWnd); - frame->ContainerWnd = NULL; - } - else { - RECT recttb,rectw,border; - int temp; - int neww,newh; - BOOLEAN locked; - - frame->oldstyles = GetWindowLongPtr(frame->hWnd,GWL_STYLE); - frame->TitleBar.oldstyles = GetWindowLongPtr(frame->TitleBar.hwnd,GWL_STYLE); - locked = frame->Locked; - frame->Locked = FALSE; - frame->minmaxenabled = FALSE; - - GetWindowRect(frame->hWnd,&rectw); - GetWindowRect(frame->TitleBar.hwnd,&recttb); - if (!frame->TitleBar.ShowTitleBar) - recttb.top = recttb.bottom = recttb.left = recttb.right = 0; - - frame->ContainerWnd = CreateContainerWindow(pcli->hwndContactList,frame->FloatingPos.x,frame->FloatingPos.y,10,10); - - SetParent(frame->hWnd,frame->ContainerWnd); - SetParent(frame->TitleBar.hwnd,frame->ContainerWnd); - - GetBorderSize(frame->ContainerWnd,&border); - - SetWindowLongPtr(frame->ContainerWnd, GWLP_USERDATA, frame->id); - if ((lParam == 1)) { - if ((frame->FloatingPos.x != 0)&&(frame->FloatingPos.y != 0)) { - if (frame->FloatingPos.x<20){frame->FloatingPos.x = 40;} - if (frame->FloatingPos.y<20){frame->FloatingPos.y = 40;} - - SetWindowPos(frame->ContainerWnd,HWND_TOPMOST,frame->FloatingPos.x,frame->FloatingPos.y,frame->FloatingSize.x,frame->FloatingSize.y,SWP_HIDEWINDOW); - } - else SetWindowPos(frame->ContainerWnd,HWND_TOPMOST,120,120,140,140,SWP_HIDEWINDOW); - } - else { - 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 (frame->FloatingPos.x<20){frame->FloatingPos.x = 40;} - if (frame->FloatingPos.y<20){frame->FloatingPos.y = 40;} - - SetWindowPos(frame->ContainerWnd,HWND_TOPMOST,frame->FloatingPos.x,frame->FloatingPos.y,neww,newh,SWP_HIDEWINDOW); - } - - SetWindowText(frame->ContainerWnd,frame->TitleBar.tbname); - - temp = GetWindowLongPtr(frame->ContainerWnd,GWL_EXSTYLE); - temp |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST ; - SetWindowLongPtr(frame->ContainerWnd,GWL_EXSTYLE,temp); - - frame->floating = TRUE; - frame->Locked = locked; - } - - CLUIFramesStoreFrameSettings(pos); - frame->minmaxenabled = TRUE; - hwndtooltiptmp = frame->TitleBar.hwndTip; - - hwndtmp = frame->ContainerWnd; - ulockfrm(); - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - SendMessage(hwndtmp,WM_SIZE,0,0); - - SetWindowPos(hwndtooltiptmp, HWND_TOPMOST,0, 0, 0, 0,SWP_NOMOVE | SWP_NOSIZE ); - return 0; -} - -static int CLUIFrameOnFontChange(WPARAM wParam,LPARAM lParam) -{ - FontID fid = {0}; - fid.cbSize = sizeof(fid); - memset(&TitleBarLogFont,0,sizeof(TitleBarLogFont)); - - strcpy(fid.group,LPGEN("Frames")); - strcpy(fid.name,LPGEN("TitleBarFont")); - strcpy(fid.dbSettingsGroup,"CLUIFrames"); - strcpy(fid.prefix,"FramesTitleBarFont"); - - CallService(MS_FONT_GET,(WPARAM)&fid,(LPARAM)&TitleBarLogFont); - CLUIFramesOnClistResize(0,0); - return 0; -} - -static void CLUIRegisterFonts() -{ - FontID fid = {0}; - fid.cbSize = sizeof(fid); - strcpy(fid.group, LPGEN("Frames")); - strcpy(fid.name, LPGEN("TitleBarFont")); - strcpy(fid.dbSettingsGroup, "CLUIFrames"); - strcpy(fid.prefix, "FramesTitleBarFont"); - FontRegister(&fid); - - CLUIFrameOnFontChange(0,0); - - HookEvent(ME_FONT_RELOAD,CLUIFrameOnFontChange); -} - -static int CLUIFrameOnModulesLoad(WPARAM wParam,LPARAM lParam) -{ - CLUIFramesLoadMainMenu(); - CLUIFramesCreateMenuForFrame(-1,-1,000010000,Menu_AddContextFrameMenuItem); - CLUIRegisterFonts(); - return 0; -} - -static int CLUIFrameOnModulesUnload(WPARAM wParam,LPARAM lParam) -{ - CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMIVisible, 0 ); - CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMITitle, 0 ); - CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMITBVisible, 0 ); - CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMILock, 0 ); - CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMIColl, 0 ); - CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMIFloating, 0 ); - CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMIAlignRoot, 0 ); - CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMIAlignTop, 0 ); - CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMIAlignClient, 0 ); - CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMIAlignBottom, 0 ); - CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMIBorder, 0 ); - return 0; -} - -static INT_PTR CLUIGetCapsService(WPARAM wParam,LPARAM lParam) -{ - switch (wParam) { - case CLUICAPS_FLAGS1: - return CLUIF_HIDEEMPTYGROUPS | CLUIF_DISABLEGROUPS | CLUIF_HASONTOPOPTION | CLUIF_HASAUTOHIDEOPTION; - case CLUICAPS_FLAGS2: - return MAKELONG(EXTRACOLUMNCOUNT,1); - } - return 0; -} - -int LoadCLUIFramesModule(void) -{ - WNDCLASS wndclass; - wndclass.style = CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW ; - wndclass.lpfnWndProc = CLUIFrameTitleBarProc; - wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = 0; - wndclass.hInstance = g_hInst; - wndclass.hIcon = NULL; - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); - wndclass.hbrBackground = NULL; - wndclass.lpszMenuName = NULL; - wndclass.lpszClassName = CLUIFrameTitleBarClassName; - RegisterClass(&wndclass); - - //container helper - WNDCLASS cntclass; - cntclass.style = CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW|( IsWinVerXPPlus() ? CS_DROPSHADOW : 0); - cntclass.lpfnWndProc = CLUIFrameContainerWndProc; - cntclass.cbClsExtra = 0; - cntclass.cbWndExtra = 0; - cntclass.hInstance = g_hInst; - cntclass.hIcon = NULL; - cntclass.hCursor = LoadCursor(NULL, IDC_ARROW); - cntclass.hbrBackground = NULL; - cntclass.lpszMenuName = NULL; - cntclass.lpszClassName = _T("FramesContainer"); - RegisterClass(&cntclass); - //end container helper - - GapBetweenFrames = DBGetContactSettingDword(NULL,"CLUIFrames","GapBetweenFrames",1); - - nFramescount = 0; - InitializeCriticalSection(&csFrameHook); - InitFramesMenus(); - - hHook[0] = HookEvent(ME_SYSTEM_MODULESLOADED,CLUIFrameOnModulesLoad); - hHook[1] = HookEvent(ME_CLIST_PREBUILDFRAMEMENU,CLUIFramesModifyContextMenuForFrame); - hHook[2] = HookEvent(ME_CLIST_PREBUILDMAINMENU,CLUIFrameOnMainMenuBuild); - - hService[0] = CreateServiceFunction(MS_CLIST_FRAMES_ADDFRAME,CLUIFramesAddFrame); - hService[1] = CreateServiceFunction(MS_CLIST_FRAMES_REMOVEFRAME,CLUIFramesRemoveFrame); - - hService[2] = CreateServiceFunction(MS_CLIST_FRAMES_SETFRAMEOPTIONS,CLUIFramesSetFrameOptions); - hService[3] = CreateServiceFunction(MS_CLIST_FRAMES_GETFRAMEOPTIONS,CLUIFramesGetFrameOptions); - hService[4] = CreateServiceFunction(MS_CLIST_FRAMES_UPDATEFRAME,CLUIFramesUpdateFrame); - - hService[5] = CreateServiceFunction(MS_CLIST_FRAMES_SHFRAMETITLEBAR,CLUIFramesShowHideFrameTitleBar); - hService[6] = CreateServiceFunction(MS_CLIST_FRAMES_SHOWALLFRAMESTB,CLUIFramesShowAllTitleBars); - hService[7] = CreateServiceFunction(MS_CLIST_FRAMES_HIDEALLFRAMESTB,CLUIFramesHideAllTitleBars); - hService[8] = CreateServiceFunction(MS_CLIST_FRAMES_SHFRAME,CLUIFramesShowHideFrame); - hService[9] = CreateServiceFunction(MS_CLIST_FRAMES_SHOWALLFRAMES,CLUIFramesShowAll); - - hService[10] = CreateServiceFunction(MS_CLIST_FRAMES_ULFRAME,CLUIFramesLockUnlockFrame); - hService[11] = CreateServiceFunction(MS_CLIST_FRAMES_UCOLLFRAME,CLUIFramesCollapseUnCollapseFrame); - hService[12] = CreateServiceFunction(MS_CLIST_FRAMES_SETUNBORDER,CLUIFramesSetUnSetBorder); - - hService[13] = CreateServiceFunction(MS_CLUI_GETCAPS,CLUIGetCapsService); - - hService[14] = CreateServiceFunction(CLUIFRAMESSETALIGN,CLUIFramesSetAlign); - hService[15] = CreateServiceFunction(CLUIFRAMESMOVEUPDOWN,CLUIFramesMoveUpDown); - - hService[16] = CreateServiceFunction(CLUIFRAMESSETALIGNALTOP,CLUIFramesSetAlignalTop); - hService[17] = CreateServiceFunction(CLUIFRAMESSETALIGNALCLIENT,CLUIFramesSetAlignalClient); - hService[18] = CreateServiceFunction(CLUIFRAMESSETALIGNALBOTTOM,CLUIFramesSetAlignalBottom); - - hService[19] = CreateServiceFunction("Set_Floating",CLUIFrameSetFloat); - hWndExplorerToolBar = FindWindowExA(0,0,"Shell_TrayWnd",NULL); - OnFrameTitleBarBackgroundChange(0,0); - FramesSysNotStarted = FALSE; - hHook[3] = HookEvent(ME_SYSTEM_PRESHUTDOWN, CLUIFrameOnModulesUnload); - return 0; -} - -int UnLoadCLUIFramesModule(void) -{ - int i; - FramesSysNotStarted = TRUE; - - for (i = 0; ihwndContactList,0); - CLUIFramesStoreAllFrames(); - lockfrm(); - for (i = 0;i=EXTRACOLUMNCOUNT){return(-1);}; - if (to<0||to>=EXTRACOLUMNCOUNT){return(-1);}; - if (to EXTRACOLUMNCOUNT) - return -1; - else - return extra-1; - } - else - { - int cnt = EnabledColumnCount; - int extracnt = EXTRACOLUMNCOUNT-1; - int ord = ExtraOrder[extra-1]; - if (!visar[ord]) return -1; - return (colsum(0,ord)-1); - } -}; - -int ColumnNumToExtra(int column) -{ - int i; - - if (HasExtraIconsService()) - return column+1; - - for (i = 0; ihwndContactTree == 0){return(-1);}; - if (wParam == 0||lParam == 0){return(-1);}; - piec = (pIconExtraColumn)lParam; - - if (piec->cbSize != sizeof(IconExtraColumn)){return(-1);}; - icol = ExtraToColumnNum(piec->ColumnType); - if (icol == -1){return(-1);}; - hItem = (HANDLE)SendMessage(pcli->hwndContactTree,CLM_FINDCONTACT,(WPARAM)wParam,0); - if (hItem == 0){return(-1);}; - - SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(icol,piec->hImage)); - return 0; -}; - -//wparam = hIcon -//return hImage on success,-1 on failure -INT_PTR AddIconToExtraImageList(WPARAM wParam,LPARAM lParam) -{ - if (hExtraImageList == 0||wParam == 0){return(-1);}; - return((int)ImageList_AddIcon(hExtraImageList,(HICON)wParam)); -} - -void SetNewExtraColumnCount() -{ - int newcount; - - GetVisColumns(); - newcount = colsum(0,EXTRACOLUMNCOUNT-1); - DBWriteContactSettingByte(NULL,CLUIFrameModule,"EnabledColumnCount",(BYTE)newcount); - EnabledColumnCount = newcount; - SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS,EnabledColumnCount,0); -} - -int OnIconLibIconChanged(WPARAM wParam,LPARAM lParam) -{ - HICON hicon; - hicon = LoadIconFromExternalFile("clisticons.dll",0,TRUE,FALSE,"Email","Contact List","Email Icon",-IDI_EMAIL); - ExtraImageIconsIndex[0] = ImageList_ReplaceIcon(hExtraImageList,ExtraImageIconsIndex[0],hicon ); - - hicon = LoadIconFromExternalFile("clisticons.dll",1,TRUE,FALSE,"Sms","Contact List","Sms Icon",-IDI_SMS); - ExtraImageIconsIndex[1] = ImageList_ReplaceIcon(hExtraImageList,ExtraImageIconsIndex[1],hicon ); - - hicon = LoadIconFromExternalFile("clisticons.dll",4,TRUE,FALSE,"Web","Contact List","Web Icon",-IDI_GLOBUS); - ExtraImageIconsIndex[2] = ImageList_ReplaceIcon(hExtraImageList,ExtraImageIconsIndex[2],hicon ); - - pcli->pfnClcBroadcast( INTM_INVALIDATE,0,0); - return 0; -} - -void ReloadExtraIcons() -{ - int count,i; - PROTOACCOUNT **accs; - HICON hicon; - - SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNSSPACE,DBGetContactSettingByte(NULL,"CLUI","ExtraColumnSpace",18),0); - SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGELIST,0,(LPARAM)NULL); - if (hExtraImageList){ImageList_Destroy(hExtraImageList);}; - hExtraImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,1,256); - - if (!HasExtraIconsService()) - { - //loading icons - hicon = LoadIconFromExternalFile("clisticons.dll",0,TRUE,TRUE,"Email","Contact List","Email Icon",-IDI_EMAIL); - if (!hicon) hicon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_EMAIL)); - ExtraImageIconsIndex[0] = ImageList_AddIcon(hExtraImageList,hicon ); - - - hicon = LoadIconFromExternalFile("clisticons.dll",1,TRUE,TRUE,"Sms","Contact List","Sms Icon",-IDI_SMS); - if (!hicon) hicon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_SMS)); - ExtraImageIconsIndex[1] = ImageList_AddIcon(hExtraImageList,hicon ); - - hicon = LoadIconFromExternalFile("clisticons.dll",4,TRUE,TRUE,"Web","Contact List","Web Icon",-IDI_GLOBUS); - if (!hicon) hicon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_GLOBUS)); - ExtraImageIconsIndex[2] = ImageList_AddIcon(hExtraImageList,hicon ); - - //calc only needed protocols - ProtoEnumAccounts( &count, &accs ); - for ( i = 0; i < count; i++ ) - if ( IsAccountEnabled( accs[i] ) && CallProtoService( accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0 )) - ImageList_AddIcon( hExtraImageList, LoadSkinnedProtoIcon( accs[i]->szModuleName, ID_STATUS_ONLINE )); - } - - SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGELIST,0,(LPARAM)hExtraImageList); - - //SetAllExtraIcons(hImgList); - SetNewExtraColumnCount(); - NotifyEventHooks(hExtraImageListRebuilding,0,0); - ImageCreated = TRUE; -} - -void ClearExtraIcons(); - -void ReAssignExtraIcons() -{ - ClearExtraIcons(); - SetNewExtraColumnCount(); - SetAllExtraIcons(pcli->hwndContactTree,0); - SendMessage(pcli->hwndContactTree,CLM_AUTOREBUILD,0,0); -} - -void ClearExtraIcons() -{ - int i; - HANDLE hContact,hItem; - - //EnabledColumnCount = DBGetContactSettingByte(NULL,CLUIFrameModule,"EnabledColumnCount",5); - //SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS,EnabledColumnCount,0); - SetNewExtraColumnCount(); - - hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); - do { - - hItem = (HANDLE)SendMessage(pcli->hwndContactTree,CLM_FINDCONTACT,(WPARAM)hContact,0); - if (hItem == 0){continue;}; - for (i = 0;ihwndContactTree,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(i,0xFF)); - }; - - } while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0)); -}; - -void SetAllExtraIcons(HWND hwndList,HANDLE hContact) -{ - HANDLE hItem; - boolean hcontgiven = FALSE; - char *szProto; - char *ImgIndex[64]; - int maxpr,count,i; - PROTOACCOUNT **accs; - pdisplayNameCacheEntry pdnce; - int em,pr,sms,a1,a2,w1,c1; - int tick = 0; - BOOL hasExtraIconsService; - hcontgiven = (hContact != 0); - - if (pcli->hwndContactTree == 0){return;}; - tick = GetTickCount(); - if (ImageCreated == FALSE) ReloadExtraIcons(); - - SetNewExtraColumnCount(); - - hasExtraIconsService = HasExtraIconsService(); - if (!hasExtraIconsService) { - em = ExtraToColumnNum(EXTRA_ICON_EMAIL); - pr = ExtraToColumnNum(EXTRA_ICON_PROTO); - sms = ExtraToColumnNum(EXTRA_ICON_SMS); - a1 = ExtraToColumnNum(EXTRA_ICON_ADV1); - a2 = ExtraToColumnNum(EXTRA_ICON_ADV2); - w1 = ExtraToColumnNum(EXTRA_ICON_WEB); - c1 = ExtraToColumnNum(EXTRA_ICON_CLIENT); - - memset(ImgIndex,0,sizeof(ImgIndex)); - ProtoEnumAccounts( &count, &accs ); - - maxpr = 0; - //calc only needed protocols - for ( i = 0; i < count; i++ ) { - if ( !IsAccountEnabled( accs[i] ) || CallProtoService( accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0 ) == 0 ) - continue; - ImgIndex[maxpr] = accs[i]->szModuleName; - maxpr++; - } - } - - if ( hContact == NULL ) - hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); - - do { - szProto = NULL; - hItem = hContact; - if (hItem == 0){continue;}; - pdnce = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hItem); - if (pdnce == NULL) {continue;}; - - // szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); - szProto = pdnce->szProto; - - if (!hasExtraIconsService) - { - if (ExtraToColumnNum(EXTRA_ICON_WEB) != -1) - { - boolean showweb = FALSE; - - if (szProto != NULL) - { - char *homepage; - homepage = DBGetStringA(pdnce->hContact,"UserInfo", "Homepage"); - if (!homepage) - homepage = DBGetStringA(pdnce->hContact,pdnce->szProto, "Homepage"); - if (homepage != NULL) - { - showweb = TRUE; - mir_free(homepage); - } - } - - SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraToColumnNum(EXTRA_ICON_WEB),(showweb)?2:0xFF)); - } - - if (ExtraToColumnNum(EXTRA_ICON_EMAIL) != -1) - { - DBVARIANT dbv = {0}; - boolean showemail = TRUE; - - if (szProto == NULL || DBGetContactSettingString(hContact, szProto, "e-mail",&dbv)) - { - DBFreeVariant(&dbv); - if (DBGetContactSettingString(hContact, "UserInfo", "Mye-mail0", &dbv)) - showemail = FALSE; - } - DBFreeVariant(&dbv); - - SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraToColumnNum(EXTRA_ICON_EMAIL),(showemail)?0:0xFF)); - } - - if (ExtraToColumnNum(EXTRA_ICON_SMS) != -1) - { - DBVARIANT dbv = {0}; - boolean showsms = TRUE; - - if (szProto == NULL || DBGetContactSettingString(hContact, szProto, "Cellular",&dbv)) { - DBFreeVariant(&dbv); - if (DBGetContactSettingString(hContact, "UserInfo", "MyPhone0", &dbv)) - showsms = FALSE; - } - SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraToColumnNum(EXTRA_ICON_SMS),(showsms)?1:0xFF)); - DBFreeVariant(&dbv); - } - - if (ExtraToColumnNum(EXTRA_ICON_PROTO) != -1) - { - for (i = 0;iszServiceName); - FreeAndNil((void**)&cmep); - } - return 0; -} - -static INT_PTR AddContextFrameMenuItem(WPARAM wParam,LPARAM lParam) -{ - TMO_MenuItem tmi; - CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; - if ( !pcli->pfnConvertMenu(mi, &tmi)) - return 0; - - if ((mi->flags & CMIF_ROOTPOPUP) || (mi->flags & CMIF_CHILDPOPUP)) - tmi.root = mi->hParentMenu; - - lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)mir_alloc(sizeof(FrameMenuExecParam)); - if (fmep == NULL) - return 0; - - fmep->szServiceName = mir_strdup(mi->pszService); - fmep->Frameid = mi->popupPosition; - fmep->param1 = (INT_PTR)mi->pszContactOwner; - tmi.ownerdata = fmep; - - return CallService(MO_ADDNEWMENUITEM, (WPARAM)hFrameMenuObject, (LPARAM)&tmi); -} - -static INT_PTR RemoveContextFrameMenuItem(WPARAM wParam,LPARAM lParam) -{ - /* this do by free service - lpFrameMenuExecParam fmep; - fmep = (lpFrameMenuExecParam)CallService(MO_MENUITEMGETOWNERDATA,wParam,lParam); - if (fmep != NULL){ - if (fmep->szServiceName != NULL){ - mir_free(fmep->szServiceName); - fmep->szServiceName = NULL; - } - mir_free(fmep); - } - */ - CallService(MO_REMOVEMENUITEM,wParam,0); - return 0; -} - -//called with: -//wparam - ownerdata -//lparam - lparam from winproc -INT_PTR FrameMenuExecService(WPARAM wParam,LPARAM lParam) -{ - lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)wParam; - if (fmep == NULL){return(-1);} - CallService(fmep->szServiceName,lParam,fmep->param1); - - return 0; -} - -//true - ok,false ignore -INT_PTR FrameMenuCheckService(WPARAM wParam,LPARAM lParam) -{ - PCheckProcParam pcpp = (PCheckProcParam)wParam; - if (pcpp == NULL) - return FALSE; - - TMO_MenuItem mi; - if (CallService(MO_GETMENUITEM,(WPARAM)pcpp->MenuItemHandle,(LPARAM)&mi) == 0) { - lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)mi.ownerdata; - if (fmep != NULL) { - //pcpp->wParam - frameid - if (((WPARAM)fmep->Frameid == pcpp->wParam)||fmep->Frameid == -1) return(TRUE); - } - } - return FALSE; -} - -static INT_PTR ContextFrameMenuNotify(WPARAM wParam,LPARAM lParam) -{ - NotifyEventHooks(hPreBuildFrameMenuEvent,wParam,lParam); - return 0; -} - -static INT_PTR BuildContextFrameMenu(WPARAM wParam,LPARAM lParam) -{ - CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; - HMENU hMenu; - ListParam param = { 0 }; - param.MenuObjectHandle = hFrameMenuObject; - param.wParam = wParam; - param.lParam = lParam; - - hMenu = CreatePopupMenu(); - //NotifyEventHooks(hPreBuildFrameMenuEvent,wParam,-1); - ContextFrameMenuNotify(wParam,-1); - CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m); - return (INT_PTR)hMenu; -} - -// == == == == == == == == == == == == == Frames end -boolean InternalGenMenuModule = FALSE; - -int MeasureItemProxy(WPARAM wParam,LPARAM lParam) -{ - int val; - if (InternalGenMenuModule) - { - val = CallService(MS_INT_MENUMEASUREITEM,wParam,lParam); - if (val) return(val); - } - return CallService(MS_CLIST_MENUMEASUREITEM,wParam,lParam); -} - -int DrawItemProxy(WPARAM wParam,LPARAM lParam) -{ - if (InternalGenMenuModule) - { - int val; - val = CallService(MS_INT_MENUDRAWITEM,wParam,lParam); - if (val) return(val); - } - return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam); -} - -int ProcessCommandProxy(WPARAM wParam,LPARAM lParam) -{ - if (InternalGenMenuModule) - { - int val; - val = CallService(MS_INT_MENUPROCESSCOMMAND,wParam,lParam); - if (val) return(val); - } - - return CallService(MS_CLIST_MENUPROCESSCOMMAND,wParam,lParam); - -} - -int ModifyMenuItemProxy(WPARAM wParam,LPARAM lParam) -{ - if (InternalGenMenuModule) - { - int val; - val = CallService(MS_INT_MODIFYMENUITEM,wParam,lParam); - if (val) return(val); - } - - return CallService(MS_CLIST_MODIFYMENUITEM,wParam,lParam); -} - -int InitFramesMenus(void) -{ - TMenuParam tmp; - - if (!ServiceExists(MO_REMOVEMENUOBJECT)) - { - - InitCustomMenus(); - InternalGenMenuModule = TRUE; - } - - if (ServiceExists(MO_REMOVEMENUOBJECT)) - { - CreateServiceFunction("FrameMenuExecService",FrameMenuExecService); - CreateServiceFunction("FrameMenuCheckService",FrameMenuCheckService); - CreateServiceFunction("FrameMenuFreeService",FreeOwnerDataFrameMenu); - - - CreateServiceFunction(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM,RemoveContextFrameMenuItem); - CreateServiceFunction("CList/AddContextFrameMenuItem",AddContextFrameMenuItem); - CreateServiceFunction(MS_CLIST_MENUBUILDFRAMECONTEXT,BuildContextFrameMenu); - CreateServiceFunction(MS_CLIST_FRAMEMENUNOTIFY,ContextFrameMenuNotify); - hPreBuildFrameMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDFRAMEMENU); - - //frame menu object - memset(&tmp,0,sizeof(tmp)); - tmp.cbSize = sizeof(tmp); - tmp.CheckService = "FrameMenuCheckService"; - tmp.ExecService = "FrameMenuExecService"; - tmp.name = "FrameMenu"; - hFrameMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT,0,(LPARAM)&tmp); - { - OptParam op; - op.Handle = hFrameMenuObject; - op.Setting = OPT_MENUOBJECT_SET_FREE_SERVICE; - op.Value = (INT_PTR)"FrameMenuFreeService"; - CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); - } - } - return 0; -} diff --git a/plugins/Clist_mw/CLUIFrames/statusbar.cpp b/plugins/Clist_mw/CLUIFrames/statusbar.cpp deleted file mode 100644 index 319f4f8f63..0000000000 --- a/plugins/Clist_mw/CLUIFrames/statusbar.cpp +++ /dev/null @@ -1,599 +0,0 @@ -#include "../commonheaders.h" - -extern HINSTANCE g_hInst; -HANDLE hStatusBarShowToolTipEvent,hStatusBarHideToolTipEvent; -boolean canloadstatusbar = FALSE; -HWND helperhwnd = 0; -HANDLE hFrameHelperStatusBar; - -void CluiProtocolStatusChanged(int parStatus, const char* szProto); - -INT_PTR GetConnectingIconService (WPARAM wParam,LPARAM lParam); - -int RecreateStatusBar(HWND); -int UseOwnerDrawStatusBar; - -#define TM_STATUSBAR 23435234 -#define TM_STATUSBARHIDE 23435235 -boolean tooltipshoing; -WNDPROC OldWindowProc = NULL; - - -POINT lastpnt; -RECT OldRc = {0}; -static HBITMAP hBmpBackground; -static int backgroundBmpUse; -static COLORREF bkColour; -extern BYTE showOpts; -int extraspace; - -int OnStatusBarBackgroundChange() -{ - { - DBVARIANT dbv; - showOpts = DBGetContactSettingByte(NULL,"CLUI","SBarShow",1); - bkColour = DBGetContactSettingDword(NULL,"StatusBar","BkColour",CLCDEFAULT_BKCOLOUR); - if (hBmpBackground) {DeleteObject(hBmpBackground); hBmpBackground = NULL;} - if (DBGetContactSettingByte(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)) { - if (!DBGetContactSettingString(NULL,"StatusBar","BkBitmap",&dbv)) { - hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal); - mir_free(dbv.pszVal); - } - } - backgroundBmpUse = DBGetContactSettingWord(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE); - extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0); - } - - RecreateStatusBar(pcli->hwndContactList); - if (pcli->hwndStatus) InvalidateRect(pcli->hwndStatus,NULL,TRUE); - return 0; -} - - -void DrawDataForStatusBar(LPDRAWITEMSTRUCT dis) -{ - //LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; - ProtocolData *PD = (ProtocolData *)dis->itemData; - char *szProto = (char*)dis->itemData; - int status,x; - SIZE textSize; - boolean NeedDestroy = FALSE; - HICON hIcon; - HRGN hrgn; - - - if (PD == NULL){return;} - if (dis->hDC == NULL) {return;} - - //clip it - - hrgn = CreateRectRgn(dis->rcItem.left, dis->rcItem.top, - dis->rcItem.right, dis->rcItem.bottom); - - SelectClipRgn(dis->hDC, hrgn); - - szProto = PD->RealName; -#ifdef _DEBUG - { - //char buf[512]; - //sprintf(buf,"proto: %s draw at pos: %d\r\n",szProto,dis->rcItem.left); - //OutputDebugStringA(buf); - } -#endif - - status = CallProtoService(szProto,PS_GETSTATUS,0,0); - SetBkMode(dis->hDC,TRANSPARENT); - x = dis->rcItem.left+extraspace; - - if (showOpts&1) - { - if ((DBGetContactSettingByte(NULL,"CLUI","UseConnectingIcon",1) == 1) && status < ID_STATUS_OFFLINE) - { - hIcon = (HICON)GetConnectingIconService((WPARAM)szProto,0); - - if (hIcon) - { - NeedDestroy = TRUE; - }else - { - hIcon = LoadSkinnedProtoIcon(szProto,status); - } - - }else - { - hIcon = LoadSkinnedProtoIcon(szProto,status); - } - DrawIconEx(dis->hDC,x,(dis->rcItem.top+dis->rcItem.bottom-GetSystemMetrics(SM_CYSMICON))>>1,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL); - if (NeedDestroy) DestroyIcon(hIcon); - x += GetSystemMetrics(SM_CXSMICON)+2; - } - else x += 2; - if (showOpts&2) { - TCHAR szName[64]; - - PROTOACCOUNT* pa = ProtoGetAccount(szProto); - mir_sntprintf(szName, SIZEOF(szName), _T("%s%s"), pa->tszAccountName, showOpts&4 ? _T(" ") : _T("")); - GetTextExtentPoint32(dis->hDC, szName, (int)_tcslen(szName), &textSize); - - TextOut(dis->hDC,x,(dis->rcItem.top+dis->rcItem.bottom-textSize.cy)>>1,szName,lstrlen(szName)); - x += textSize.cx; - } - if (showOpts&4) { - TCHAR *szStatus = pcli->pfnGetStatusModeDescription(status, 0); - if (!szStatus) - szStatus = _T(""); - GetTextExtentPoint32(dis->hDC,szStatus,lstrlen(szStatus),&textSize); - TextOut(dis->hDC,x,(dis->rcItem.top+dis->rcItem.bottom-textSize.cy)>>1,szStatus,lstrlen(szStatus)); - } - SelectClipRgn(dis->hDC, NULL); - DeleteObject(hrgn); -} - -void DrawBackGround(HWND hwnd,HDC mhdc) -{ - HDC hdcMem,hdc; - RECT clRect,*rcPaint; - - int yScroll = 0; - int y; - PAINTSTRUCT paintst = {0}; - HBITMAP hBmpOsb,holdbmp; - DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE); - int grey = 0; - HFONT oFont; - HBRUSH hBrushAlternateGrey = NULL; - - HFONT hFont; - - //InvalidateRect(hwnd,0,FALSE); - - 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; - y = -yScroll; - hdcMem = CreateCompatibleDC(hdc); - hBmpOsb = CreateBitmap(clRect.right,clRect.bottom,1,GetDeviceCaps(hdc,BITSPIXEL),NULL); - holdbmp = (HBITMAP)SelectObject(hdcMem,hBmpOsb); - oFont = (HFONT)SelectObject(hdcMem,hFont); - SetBkMode(hdcMem,TRANSPARENT); - { HBRUSH hBrush,hoBrush; - - hBrush = CreateSolidBrush(bkColour); - hoBrush = (HBRUSH)SelectObject(hdcMem,hBrush); - FillRect(hdcMem,rcPaint,hBrush); - SelectObject(hdcMem,hoBrush); - DeleteObject(hBrush); - if (hBmpBackground) { - BITMAP bmp; - int x,y; - int maxx,maxy; - int destw,desth; - - GetObject(hBmpBackground,sizeof(bmp),&bmp); - HDC hdcBmp = CreateCompatibleDC(hdcMem); - HDC holdbackbmp = (HDC)SelectObject(hdcBmp,hBmpBackground); - y = backgroundBmpUse&CLBF_SCROLL?-yScroll:0; - maxx = backgroundBmpUse&CLBF_TILEH?clRect.right:1; - maxy = backgroundBmpUse&CLBF_TILEV?maxy = rcPaint->bottom:y+1; - switch(backgroundBmpUse&CLBM_TYPE) { - case CLB_STRETCH: - if (backgroundBmpUse&CLBF_PROPORTIONAL) { - if (clRect.right*bmp.bmHeighttop-desth) continue; - for (x = 0;xhwndStatus,SB_GETTEXT,(WPARAM)nPanel,(LPARAM)0); - if (PD == NULL){ - continue; - } - SendMessage(hwnd,SB_GETRECT,(WPARAM)nPanel,(LPARAM)&rc); - //rc.left += startoffset; - //if (rc.left>=rc.right) rc.left = rc.right-1; - rc.top = 0; - rc.left = nPanel*sectwidth+startoffset; - rc.right = rc.left+sectwidth-1; - ds.rcItem = rc; - ds.itemData = (ULONG_PTR)PD; - ds.itemID = nPanel; - - DrawDataForStatusBar(&ds); - } } - - 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); -} - -LRESULT CALLBACK StatusBarOwnerDrawProc( HWND hwnd, - UINT uMsg, - WPARAM wParam, - LPARAM lParam -) -{ -if (UseOwnerDrawStatusBar) -{ - switch(uMsg) - { - case WM_ERASEBKGND: - { - - //DrawBackGround(hwnd); - return 0; - } - case WM_PRINT: - { - DrawBackGround(hwnd,(HDC)wParam); - return 0; - } - case WM_PAINT: - { - DrawBackGround(hwnd,0); - return 0; - } - } - -} -return (CallWindowProc(OldWindowProc,hwnd,uMsg,wParam,lParam) - ); -} - -LRESULT CALLBACK StatusHelperProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch(msg) - { - case WM_CREATE: - { - { - tooltipshoing = FALSE; - //HWND label; - //label = CreateWindow("static","Top window",WS_VISIBLE|WS_CHILD ,2,2,120,60,hwnd,NULL,g_hInst,0); - //SendMessage(label,WM_SETFONT,(WPARAM)TitleBarFont,0); - } - return(FALSE); - - } - case WM_GETMINMAXINFO:{ - RECT rct; - if (pcli->hwndStatus == 0){break;} - GetWindowRect(pcli->hwndStatus,&rct); - memset((LPMINMAXINFO)lParam,0,sizeof(MINMAXINFO)); - ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 5; - ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = rct.bottom-rct.top; - ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = 1600; - ((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = rct.bottom-rct.top; - return 0; - } - - case WM_NCHITTEST: - { - - } - case WM_SHOWWINDOW: - { - { - int res; - if (hFrameHelperStatusBar) - { - res = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS,hFrameHelperStatusBar),0); - DBWriteContactSettingByte(0,"CLUI","ShowSBar",(BYTE)((res&F_VISIBLE)?1:0)); - } - } - - - if (tooltipshoing){ - NotifyEventHooks(hStatusBarHideToolTipEvent,0,0); - tooltipshoing = FALSE; - } - return 0; - // - } - case WM_TIMER: - { - if (wParam == TM_STATUSBARHIDE) - { - KillTimer(hwnd,TM_STATUSBARHIDE); - - if (tooltipshoing){ - NotifyEventHooks(hStatusBarHideToolTipEvent,0,0); - tooltipshoing = FALSE; - } - - - } - - if (wParam == TM_STATUSBAR) - { - POINT pt; - KillTimer(hwnd,TM_STATUSBAR); - - GetCursorPos(&pt); - if (pt.x == lastpnt.x&&pt.y == lastpnt.y) - { - { - int i,nParts; - ProtocolData *PD; - RECT rc; - ScreenToClient(pcli->hwndStatus,&pt); - nParts = SendMessage(pcli->hwndStatus,SB_GETPARTS,0,0); - for (i = 0;ihwndStatus,SB_GETRECT,i,(LPARAM)&rc); - if (PtInRect(&rc,pt)) { - PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,i,(LPARAM)0); - if (PD == NULL){return 0;} - - NotifyEventHooks(hStatusBarShowToolTipEvent,(WPARAM)PD->RealName,0); - SetTimer(hwnd,TM_STATUSBARHIDE,DBGetContactSettingWord(NULL,"CLUIFrames","HideToolTipTime",5000),0); - tooltipshoing = TRUE; - - break; - } - } - - - - } - - - - } - - } - - return 0; - } - - case WM_SETCURSOR: - { - - { - POINT pt; - GetCursorPos(&pt); - if (pt.x == lastpnt.x&&pt.y == lastpnt.y) - { - return 0; - } - lastpnt = pt; - if (tooltipshoing){ - KillTimer(hwnd,TM_STATUSBARHIDE); - NotifyEventHooks(hStatusBarHideToolTipEvent,0,0); - tooltipshoing = FALSE; - } - KillTimer(hwnd,TM_STATUSBAR); - SetTimer(hwnd,TM_STATUSBAR,DBGetContactSettingWord(NULL,"CLC","InfoTipHoverTime",750),0); - return 0; - } - - } - case WM_NOTIFY: - { - if (lParam == 0){return 0;} - if (((LPNMHDR)lParam)->hwndFrom == pcli->hwndStatus) - { - - if (((LPNMHDR)lParam)->code == WM_NCHITTEST) - { - LPNMMOUSE lpnmmouse = (LPNMMOUSE) lParam; - } ; - } - } - - case WM_CONTEXTMENU: - KillTimer(hwnd,TM_STATUSBARHIDE); - - if (tooltipshoing) - NotifyEventHooks(hStatusBarHideToolTipEvent,0,0); - - tooltipshoing = FALSE; - - case WM_MEASUREITEM: - case WM_DRAWITEM: - //parent do all work for us - return(SendMessage(pcli->hwndContactList,msg,wParam,lParam)); - - case WM_MOVE: - PostMessage(pcli->hwndStatus,WM_MOVE,wParam,lParam); - - case WM_SIZE: - { - RECT rc; - int b; - if (pcli->hwndStatus != 0) { - GetClientRect(hwnd,&rc); - - b = LOWORD(lParam); - if (b != 0&&(rc.right-rc.left) != (OldRc.right-OldRc.left)) { - OldRc = rc; - if (canloadstatusbar) - if (DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",0)||DBGetContactSettingByte(NULL,"CLUI","EqualSections",1)) - CluiProtocolStatusChanged(0,0); - } - if (msg == WM_SIZE) PostMessage(pcli->hwndStatus,WM_SIZE,wParam,lParam); - if (pcli->hwndStatus != 0) InvalidateRect(pcli->hwndStatus,NULL,TRUE); - return 0; - } - } - - default: - return DefWindowProc(hwnd, msg, wParam, lParam); - - } - return DefWindowProc(hwnd, msg, wParam, lParam); -} - -HWND CreateStatusHelper(HWND parent) -{ - WNDCLASS wndclass = {0}; - TCHAR pluginname[] = _T("Statushelper"); - - if (GetClassInfo(g_hInst,pluginname,&wndclass) == 0 ) { - wndclass.style = 0; - wndclass.lpfnWndProc = StatusHelperProc; - wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = 0; - wndclass.hInstance = g_hInst; - wndclass.hIcon = NULL; - wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); - wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE+1); - wndclass.lpszMenuName = NULL; - wndclass.lpszClassName = pluginname; - RegisterClass(&wndclass); - } - - return(CreateWindow(pluginname,pluginname, - /*WS_THICKFRAME|*/WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN, - 0,0,0,0,parent,NULL,g_hInst,NULL)); -} - -HANDLE CreateStatusBarFrame() -{ - CLISTFrame Frame; - int h; - RECT rc; - - memset(&Frame,0,sizeof(Frame)); - Frame.cbSize = sizeof(CLISTFrame); - Frame.hWnd = helperhwnd; - Frame.align = alBottom; - Frame.hIcon = LoadSkinnedIcon (SKINICON_OTHER_MIRANDA); - Frame.Flags = (DBGetContactSettingByte(NULL,"CLUI","ShowSBar",1)?F_VISIBLE:0)|F_LOCKED|F_NOBORDER|F_TCHAR; - GetWindowRect(helperhwnd,&rc); - h = rc.bottom-rc.top; - Frame.height = (h == 0)?20:h; - - - Frame.tname = _T("Status"); - Frame.TBtname = TranslateT("Status Bar"); - hFrameHelperStatusBar = (HANDLE)CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&Frame,(LPARAM)0); - - - return hFrameHelperStatusBar; -} - -int RecreateStatusBar(HWND parent) -{ - if (pcli->hwndStatus) { - FreeProtocolData(); - DestroyWindow(pcli->hwndStatus); - } - pcli->hwndStatus = 0; - if (hFrameHelperStatusBar) CallService(MS_CLIST_FRAMES_REMOVEFRAME,(WPARAM)hFrameHelperStatusBar,0); - - helperhwnd = CreateStatusHelper(parent); - UseOwnerDrawStatusBar = DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",0); - - //create the status wnd - pcli->hwndStatus = CreateStatusWindow( - ( DBGetContactSettingByte(0,"CLUI","SBarUseSizeGrip",TRUE) && (!UseOwnerDrawStatusBar)?SBARS_SIZEGRIP:0)| - WS_CHILD | (DBGetContactSettingByte(NULL,"CLUI","ShowSBar",1)?WS_VISIBLE:0), _T(""), helperhwnd, 0); - - OldWindowProc = (WNDPROC)GetWindowLongPtr(pcli->hwndStatus,GWLP_WNDPROC); - SetWindowLongPtr(pcli->hwndStatus,GWLP_WNDPROC,(LONG_PTR)&StatusBarOwnerDrawProc); - CreateStatusBarFrame(); - { - SetWindowPos(helperhwnd,NULL,1,1,1,1,SWP_NOZORDER); - CluiProtocolStatusChanged(0,0); - CallService(MS_CLIST_FRAMES_UPDATEFRAME,-1,0); - } - - return 0; -} - -HWND CreateStatusBarhWnd(HWND parent) -{ - RecreateStatusBar(parent); - OnStatusBarBackgroundChange(); - - hStatusBarShowToolTipEvent = CreateHookableEvent(ME_CLIST_FRAMES_SB_SHOW_TOOLTIP); - hStatusBarHideToolTipEvent = CreateHookableEvent(ME_CLIST_FRAMES_SB_HIDE_TOOLTIP); - return pcli->hwndStatus; -} diff --git a/plugins/Clist_mw/clc.cpp b/plugins/Clist_mw/clc.cpp deleted file mode 100644 index 40eddc02eb..0000000000 --- a/plugins/Clist_mw/clc.cpp +++ /dev/null @@ -1,294 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 "commonheaders.h" - -int DefaultImageListColorDepth = ILC_COLOR32; - -HIMAGELIST himlCListClc; - -static HANDLE hSettingChanged1; - -int BgStatusBarChange(WPARAM wParam,LPARAM lParam); - -int BgClcChange(WPARAM wParam,LPARAM lParam); -int OnFrameTitleBarBackgroundChange(WPARAM wParam,LPARAM lParam); - -void InitDisplayNameCache(SortedList *list); -void FreeDisplayNameCache(SortedList *list); -void LoadExtraImageFunc( void ); - -void LoadExtraImageFunc( void ); -void UnloadCLUIModule( void ); - -extern int sortByStatus; -struct ClcContact * hitcontact = NULL; - -extern LRESULT ( CALLBACK *saveContactListControlWndProc )(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); - -static int stopStatusUpdater = 0; -void StatusUpdaterThread(void*) -{ - int i,curdelay,lastcheck = 0; - HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); - - SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_LOWEST); - - while (!stopStatusUpdater) { - curdelay = DBGetContactSettingByte(hContact,"CList","StatusMsgAutoDelay",15000); - if (curdelay<5000) curdelay = 5000; - - if ((int)(GetTickCount()-lastcheck)>curdelay) - { - lastcheck = GetTickCount(); - if (DBGetContactSettingByte(hContact,"CList","StatusMsgAuto",0)) { - for (i = 0; i<5; i++) { - if (hContact != NULL) { - pdisplayNameCacheEntry pdnce = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry((HANDLE)hContact); - if (pdnce && !pdnce->protoNotExists && pdnce->szProto) - CallContactService(hContact, PSS_GETAWAYMSG, 0, 0); - - hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); - } - if (hContact == NULL) { - hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); - if (hContact == NULL) - break; - } - Sleep(500); - } - } - } - //Sleep(DBGetContactSettingByte(hContact,"CList","StatusMsgAutoDelay",100)); - Sleep(200); - } -} - -HMENU BuildGroupPopupMenu( struct ClcGroup* group ) -{ - return (HMENU)CallService(MS_CLIST_MENUBUILDSUBGROUP,(WPARAM)group,0); -} - -void SortClcByTimer (HWND hwnd) -{ - KillTimer(hwnd,TIMERID_DELAYEDRESORTCLC); - SetTimer(hwnd,TIMERID_DELAYEDRESORTCLC,DBGetContactSettingByte(NULL,"CLUI","DELAYEDTIMER",200),NULL); -} - -static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) -{ - DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - - if ((HANDLE)wParam != NULL && !strcmp(cws->szModule,"MetaContacts") && !strcmp(cws->szSetting,"Handle")) - pcli->pfnClcBroadcast( INTM_NAMEORDERCHANGED, 0, 0 ); - - if ((HANDLE)wParam != NULL&&!strcmp(cws->szModule,"CList")) { - if ( !strcmp( cws->szSetting, "noOffline" )) - pcli->pfnClcBroadcast( INTM_NAMEORDERCHANGED, wParam, lParam ); - else if (!strcmp(cws->szSetting,"StatusMsg")) - pcli->pfnClcBroadcast( INTM_STATUSMSGCHANGED, wParam, lParam ); - } - return 0; -} - -static int ClcModulesLoaded(WPARAM wParam,LPARAM lParam) -{ - CallService(MS_BACKGROUNDCONFIG_REGISTER,(WPARAM)"StatusBar Background/StatusBar",0); - CallService(MS_BACKGROUNDCONFIG_REGISTER,(WPARAM)"List Background/CLC",0); - CallService(MS_BACKGROUNDCONFIG_REGISTER,(WPARAM)"Frames TitleBar BackGround/FrameTitleBar",0); - HookEvent(ME_BACKGROUNDCONFIG_CHANGED,BgClcChange); - HookEvent(ME_BACKGROUNDCONFIG_CHANGED,BgStatusBarChange); - HookEvent(ME_BACKGROUNDCONFIG_CHANGED,OnFrameTitleBarBackgroundChange); - return 0; -} - -static int ClcShutdown(WPARAM wParam, LPARAM lParam) -{ - UnhookEvent(hSettingChanged1); - UnloadCLUIModule(); - return 0; -} - -LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - struct ClcData *dat = (struct ClcData*)GetWindowLongPtr(hwnd,0); - if ( msg >= CLM_FIRST && msg < CLM_LAST ) - return pcli->pfnProcessExternalMessages(hwnd,dat,msg,wParam,lParam); - - switch (msg) { - case WM_CREATE: - dat = (struct ClcData*)mir_calloc( sizeof(struct ClcData)); - SetWindowLongPtr(hwnd,0,(LPARAM)dat); - InitDisplayNameCache(&dat->lCLCContactsCache); - break; - - case INTM_ICONCHANGED: - { struct ClcContact *contact = NULL; - struct ClcGroup *group = NULL; - int recalcScrollBar = 0,shouldShow; - HANDLE hSelItem = NULL; - struct ClcContact *selcontact = NULL; - pdisplayNameCacheEntry cacheEntry = GetContactFullCacheEntry((HANDLE)wParam); - - WORD status; - int needsResort = 0; - - char *szProto = cacheEntry->szProto; - if (szProto == NULL) - status = ID_STATUS_OFFLINE; - else - status = cacheEntry->status; - - shouldShow = (GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_SHOWHIDDEN || !cacheEntry->bIsHidden) && (!pcli->pfnIsHiddenMode(dat,status)||cacheEntry->noHiddenOffline || CallService(MS_CLIST_GETCONTACTICON,wParam,0) != LOWORD(lParam)); //this means an offline msg is flashing, so the contact should be shown - if (!FindItem(hwnd,dat,(HANDLE)wParam,&contact,&group,NULL)) { - if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { - if (dat->selection>=0 && GetRowByIndex(dat,dat->selection,&selcontact,NULL) != -1) - hSelItem = pcli->pfnContactToHItem(selcontact); - AddContactToTree(hwnd,dat,(HANDLE)wParam,0,0); - needsResort = 1; - recalcScrollBar = 1; - FindItem(hwnd,dat,(HANDLE)wParam,&contact,NULL,NULL); - if (contact) { - contact->iImage = (WORD)lParam; - pcli->pfnNotifyNewContact(hwnd,(HANDLE)wParam); - dat->needsResort = 1; - } - } - } - else { - //item in list already - DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE); - if (contact->iImage == (WORD)lParam) break; - if (sortByStatus) dat->needsResort = 1; - - if (!shouldShow && !(style&CLS_NOHIDEOFFLINE) && (style&CLS_HIDEOFFLINE || group->hideOffline)) { - if (dat->selection>=0 && GetRowByIndex(dat,dat->selection,&selcontact,NULL) != -1) - hSelItem = pcli->pfnContactToHItem(selcontact); - RemoveItemFromGroup(hwnd,group,contact,0); - recalcScrollBar = 1; - dat->needsResort = 1; - } - else { - int oldflags; - contact->iImage = (WORD)lParam; - oldflags = contact->flags; - if (!pcli->pfnIsHiddenMode(dat,status)||cacheEntry->noHiddenOffline) contact->flags |= CONTACTF_ONLINE; - else contact->flags &= ~CONTACTF_ONLINE; - if (oldflags != contact->flags) - dat->needsResort = 1; - } } - if (hSelItem) { - struct ClcGroup *selgroup; - if (FindItem(hwnd,dat,hSelItem,&selcontact,&selgroup,NULL)) - dat->selection = GetRowsPriorTo(&dat->list,selgroup,List_IndexOf((SortedList*)&selgroup->cl, selcontact)); - else - dat->selection = -1; - } - - SortClcByTimer(hwnd); - if (recalcScrollBar) RecalcScrollBar(hwnd,dat); - goto LBL_Exit; - } - case INTM_STATUSMSGCHANGED: - { struct ClcContact *contact = NULL; - struct ClcGroup *group = NULL; - DBVARIANT dbv; - - if (!(dat->style&CLS_SHOWSTATUSMESSAGES)) break; - if (FindItem(hwnd,dat,(HANDLE)wParam,&contact,&group,NULL) && contact != NULL) { - contact->flags &= ~CONTACTF_STATUSMSG; - if (!DBGetContactSettingTString((HANDLE)wParam, "CList", "StatusMsg", &dbv)) { - int j; - if (dbv.ptszVal == NULL||_tcslen(dbv.ptszVal) == 0) break; - lstrcpyn(contact->szStatusMsg, dbv.ptszVal, SIZEOF(contact->szStatusMsg)); - for (j = (int)_tcslen(contact->szStatusMsg)-1;j>=0;j--) { - if (contact->szStatusMsg[j] == '\r' || contact->szStatusMsg[j] == '\n' || contact->szStatusMsg[j] == '\t') { - contact->szStatusMsg[j] = ' '; - } - } - DBFreeVariant(&dbv); - if (_tcslen(contact->szStatusMsg)>0) { - contact->flags |= CONTACTF_STATUSMSG; - dat->needsResort = TRUE; - } - } - } - - InvalidateRect(hwnd,NULL,TRUE); - - SortClcByTimer(hwnd); - RecalcScrollBar(hwnd,dat); - goto LBL_Exit; - } - case WM_TIMER: - if (wParam == TIMERID_DELAYEDREPAINT) { - KillTimer(hwnd,TIMERID_DELAYEDREPAINT); - InvalidateRect(hwnd,NULL,FALSE); - break; - } - - if ( wParam == TIMERID_SUBEXPAND) { - KillTimer(hwnd,TIMERID_SUBEXPAND); - if (hitcontact) { - if (hitcontact->SubExpanded) hitcontact->SubExpanded = 0; else hitcontact->SubExpanded = 1; - DBWriteContactSettingByte(hitcontact->hContact,"CList","Expanded",hitcontact->SubExpanded); - } - hitcontact = NULL; - dat->needsResort = 1; - SortCLC(hwnd,dat,1); - RecalcScrollBar(hwnd,dat); - break; - } - break; - - case WM_DESTROY: - FreeDisplayNameCache(&dat->lCLCContactsCache); - stopStatusUpdater = 1; - break; - } - { - LRESULT res = saveContactListControlWndProc(hwnd, msg, wParam, lParam); - switch (msg) { - case WM_CREATE: - mir_forkthread(StatusUpdaterThread,0); - break; - } - return res; - } - -LBL_Exit: - return DefWindowProc(hwnd, msg, wParam, lParam); -} - -int LoadCLCModule(void) -{ - LoadCLUIFramesModule(); - LoadExtraImageFunc(); - - himlCListClc = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST,0,0); - - HookEvent(ME_SYSTEM_MODULESLOADED,ClcModulesLoaded); - hSettingChanged1 = HookEvent(ME_DB_CONTACT_SETTINGCHANGED,ClcSettingChanged); - HookEvent(ME_OPT_INITIALISE,ClcOptInit); - HookEvent(ME_SYSTEM_SHUTDOWN,ClcShutdown); - return 0; -} diff --git a/plugins/Clist_mw/clc.h b/plugins/Clist_mw/clc.h deleted file mode 100644 index 29b7086d20..0000000000 --- a/plugins/Clist_mw/clc.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 _CLC_H_ -#define _CLC_H_ - -#define CLB_TOPLEFT 0 -#define CLB_STRETCHV 1 -#define CLB_STRETCHH 2 //and tile vertically -#define CLB_STRETCH 3 - -#define CLBM_TYPE 0x00FF - -#define CLBF_TILEH 0x1000 -#define CLBF_TILEV 0x2000 -#define CLBF_PROPORTIONAL 0x4000 -#define CLBF_SCROLL 0x8000 -#define CLBF_TILEVTOROWHEIGHT 0x0100 - -#define FONTID_CONTACTS 0 -#define FONTID_INVIS 1 -#define FONTID_OFFLINE 2 -#define FONTID_NOTONLIST 3 -#define FONTID_GROUPS 4 -#define FONTID_GROUPCOUNTS 5 -#define FONTID_DIVIDERS 6 -#define FONTID_OFFINVIS 7 -#define FONTID_STATUSMSG 8 -#define FONTID_GROUPSCLOSED 9 -#define FONTID_CONTACTSHOVER 10 - -#define TIMERID_DELAYEDREPAINT 16 -#define TIMERID_SUBEXPAND 21 - -#define CONTACTF_STATUSMSG 64 - -#define INTM_STATUSMSGCHANGED (WM_USER+26) - -#define CLS_SHOWSTATUSMESSAGES 0x800 - -#define CLS_EX_MULTICOLUMNALIGNLEFT 0x00001000 - -#define MAXSTATUSMSGLEN 256 - -struct ClcContact : public ClcContactBase -{ - ClcContact *subcontacts; - BYTE SubAllocated; - BYTE SubExpanded; - BYTE isSubcontact; - TCHAR szStatusMsg[MAXSTATUSMSGLEN]; -}; - -struct ClcData : public ClcDataBase -{ - DWORD style; - SortedList lCLCContactsCache; - BYTE doubleClickExpand; - int MetaIgnoreEmptyExtra; -}; - -//clcidents.c -int GetRowsPriorTo(struct ClcGroup *group,struct ClcGroup *subgroup,int contactIndex); -int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **contact,struct ClcGroup **subgroup,int *isVisible); -int GetRowByIndex(struct ClcData *dat,int testindex,struct ClcContact **contact,struct ClcGroup **subgroup); -void ClearRowByIndexCache(); - -//clcitems.c -struct ClcGroup *AddGroup(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flags,int groupId,int calcTotalMembers); -void FreeGroup(struct ClcGroup *group); -int AddInfoItemToGroup(struct ClcGroup *group,int flags,const TCHAR *pszText); -void FreeContact(struct ClcContact *p); -void RebuildEntireList(HWND hwnd,struct ClcData *dat); -struct ClcGroup *RemoveItemFromGroup(HWND hwnd,struct ClcGroup *group,struct ClcContact *contact,int updateTotalCount); -void DeleteItemFromTree(HWND hwnd,HANDLE hItem); -void AddContactToTree(HWND hwnd,struct ClcData *dat,HANDLE hContact,int updateTotalCount,int checkHideOffline); -void SortCLC(HWND hwnd,struct ClcData *dat,int useInsertionSort); -int GetGroupContentsCount(struct ClcGroup *group,int visibleOnly); -int GetNewSelection(struct ClcGroup *group,int selection, int direction); -void SaveStateAndRebuildList(HWND hwnd,struct ClcData *dat); - -//clcmsgs.c -LRESULT ProcessExternalMessages(HWND hwnd,struct ClcData *dat,UINT msg,WPARAM wParam,LPARAM lParam); - -//clcutils.c -void RecalcScrollBar(HWND hwnd,struct ClcData *dat); -void BeginRenameSelection(HWND hwnd,struct ClcData *dat); -int HitTest(HWND hwnd,struct ClcData *dat,int testx,int testy,struct ClcContact **contact,struct ClcGroup **group,DWORD *flags); -void ScrollTo(HWND hwnd,struct ClcData *dat,int desty,int noSmooth); -void LoadClcOptions(HWND hwnd,struct ClcData *dat); - -//clcpaint.c -void PaintClc(HWND hwnd,struct ClcData *dat,HDC hdc,RECT *rcPaint); - -//clcopts.c -int ClcOptInit(WPARAM wParam,LPARAM lParam); - -//clcfiledrop.c -void InitFileDropping(void); -void FreeFileDropping(void); -void RegisterFileDropping(HWND hwnd); -void UnregisterFileDropping(HWND hwnd); - -//cluiservices.c -void FreeProtocolData( void ); - -int GetContactCachedStatus(HANDLE hContact); -char *GetContactCachedProtocol(HANDLE hContact); - -#define CLUI_SetDrawerService "CLUI/SETDRAWERSERVICE" -typedef struct { - int cbSize; - char *PluginName; - char *Comments; - char *GetDrawFuncsServiceName; - -} DrawerServiceStruct,*pDrawerServiceStruct ; - -#define CLUI_EXT_FUNC_PAINTCLC 1 - -typedef struct { - int cbSize; - void (*PaintClc)(HWND,struct ClcData *,HDC,RECT *,int ,ClcProtoStatus *,HIMAGELIST); -} ExternDrawer,*pExternDrawer ; - -extern ExternDrawer SED; - -#define CLM_SETEXTRACOLUMNSSPACE (CLM_FIRST+73) //wParam = extra space between icons - -void FreeAndNil( void** p ); - -#endif /* _CLC_H_ */ diff --git a/plugins/Clist_mw/clcfonts.cpp b/plugins/Clist_mw/clcfonts.cpp deleted file mode 100644 index 1ad20dc2b0..0000000000 --- a/plugins/Clist_mw/clcfonts.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2010 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 "commonheaders.h" - - -static const TCHAR *szClistFontIdDescr[FONTID_MAX+1] = -{ - LPGENT( "Standard contacts"), - LPGENT( "Online contacts to whom you have a different visibility"), - LPGENT( "Offline contacts"), - LPGENT( "Contacts which are 'not on list'"), - LPGENT( "Groups"), - LPGENT( "Group member counts"), - LPGENT( "Dividers"), - LPGENT( "Offline contacts to whom you have a different visibility"), - LPGENT( "Status messages"), - LPGENT( "Group Closed"), - LPGENT( "Hover Contacts") -}; - -static int fontListOrder[FONTID_MAX + 1] = -{ - FONTID_CONTACTS, - FONTID_INVIS, - FONTID_OFFLINE, - FONTID_NOTONLIST, - FONTID_GROUPS, - FONTID_GROUPCOUNTS, - FONTID_DIVIDERS, - FONTID_OFFINVIS, - FONTID_STATUSMSG, - FONTID_GROUPSCLOSED, - FONTID_CONTACTSHOVER -}; - -#define CLCDEFAULT_BKCOLOUR GetSysColor(COLOR_3DFACE) -#define CLCDEFAULT_SELTEXTCOLOUR GetSysColor(COLOR_HIGHLIGHTTEXT) - -static int FS_FontsChanged(WPARAM wParam, LPARAM lParam) -{ - pcli->pfnClcOptionsChanged(); - return 0; -} - -void RegisterCListFonts() -{ - FontIDT fontid = {0}; - ColourIDT colourid = {0}; - char idstr[10]; - int i; - - fontid.cbSize = sizeof(FontIDT); - fontid.flags = FIDF_ALLOWREREGISTER | FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS; - - for (i = 0; i <= FONTID_MAX; i++) { - switch (fontListOrder[i]) { - case FONTID_GROUPS: - case FONTID_GROUPCOUNTS: - fontid.flags &= ~FIDF_CLASSMASK; - fontid.flags |= FIDF_CLASSHEADER; - break; - - case FONTID_DIVIDERS: - fontid.flags &= ~FIDF_CLASSMASK; - fontid.flags |= FIDF_CLASSSMALL; - break; - - default: - fontid.flags &= ~FIDF_CLASSMASK; - fontid.flags |= FIDF_CLASSGENERAL; - break; - } - - if (fontListOrder[i] != 0 || i == 0) { - strncpy(fontid.dbSettingsGroup, "CLC", sizeof(fontid.dbSettingsGroup)); - _tcsncpy(fontid.group, _T("Contact List"), SIZEOF(fontid.group)); - _tcsncpy(fontid.name, szClistFontIdDescr[fontListOrder[i]], SIZEOF(fontid.name)); - sprintf(idstr, "Font%d", fontListOrder[i]); - strncpy(fontid.prefix, idstr, SIZEOF(fontid.prefix)); - fontid.order = fontListOrder[i]; - FontRegisterT(&fontid); - } - } - - // and colours - colourid.cbSize = sizeof(ColourIDT); - colourid.order = 0; - strncpy(colourid.dbSettingsGroup, "CLC", sizeof(colourid.dbSettingsGroup)); - - strncpy(colourid.setting, "BkColour", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name)); - _tcsncpy(colourid.group, LPGENT("Contact List"), SIZEOF(colourid.group)); - colourid.defcolour = CLCDEFAULT_BKCOLOUR; - ColourRegisterT(&colourid); - - strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Selected Text"), SIZEOF(colourid.name)); - colourid.order = 1; - colourid.defcolour = CLCDEFAULT_SELTEXTCOLOUR; - ColourRegisterT(&colourid); - - strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Hottrack Text"), SIZEOF(colourid.name)); - colourid.order = 1; - colourid.defcolour = CLCDEFAULT_HOTTEXTCOLOUR; - ColourRegisterT(&colourid); - - strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Quicksearch Text"), SIZEOF(colourid.name)); - colourid.order = 1; - colourid.defcolour = CLCDEFAULT_QUICKSEARCHCOLOUR; - ColourRegisterT(&colourid); - - HookEvent(ME_FONT_RELOAD, FS_FontsChanged); -} diff --git a/plugins/Clist_mw/clcidents.cpp b/plugins/Clist_mw/clcidents.cpp deleted file mode 100644 index 58517fa8c0..0000000000 --- a/plugins/Clist_mw/clcidents.cpp +++ /dev/null @@ -1,303 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 "commonheaders.h" -#include "m_clc.h" -#include "clc.h" - -/* the CLC uses 3 different ways to identify elements in its list, this file -contains routines to convert between them. - -1) struct ClcContact/struct ClcGroup pair. Only ever used within the duration -of a single operation, but used at some point in nearly everything -2) index integer. The 0-based number of the item from the top. Only visible -items are counted (ie not closed groups). Used for saving selection and drag -highlight -3) hItem handle. Either the hContact or (hGroup|HCONTACT_ISGROUP). Used -exclusively externally - -1->2: GetRowsPriorTo() -1->3: ContactToHItem() -3->1: FindItem() -2->1: GetRowByIndex() -*/ - -int GetRowsPriorTo(struct ClcGroup *group,struct ClcGroup *subgroup,int contactIndex) -{ - int count = 0; - - group->scanIndex = 0; - for (;;) { - if (group->scanIndex == group->cl.count) { - group = group->parent; - if (group == NULL) - break; - group->scanIndex++; - continue; - } - - if (group == subgroup && contactIndex == group->scanIndex) - return count; - - count++; - if ((group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) && (group->cl.items[group->scanIndex]->flags & CONTACTF_STATUSMSG)) - count++; - - if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { - if (group->cl.items[group->scanIndex]->group == subgroup && contactIndex == -1) - return count-1; - if (group->cl.items[group->scanIndex]->group->expanded) { - group = group->cl.items[group->scanIndex]->group; - group->scanIndex = 0; - continue; - } - } - - if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) - count += group->cl.items[group->scanIndex]->SubAllocated*group->cl.items[group->scanIndex]->SubExpanded; - - group->scanIndex++; - } - return -1; -} - -pdisplayNameCacheEntry GetCLCFullCacheEntry(struct ClcData *dat,HANDLE hContact) -{ - if (hContact == 0) - return NULL; - - displayNameCacheEntry dnce; - dnce.hContact = hContact; - displayNameCacheEntry *pdnce = (displayNameCacheEntry*)List_Find(&dat->lCLCContactsCache,&dnce); - if (pdnce == NULL) { - pdnce = (displayNameCacheEntry*)mir_calloc(sizeof(displayNameCacheEntry)); - pdnce->hContact = hContact; - - int idx; - List_GetIndex(&dat->lCLCContactsCache,pdnce,&idx); - List_Insert(&dat->lCLCContactsCache,pdnce,idx); - - displayNameCacheEntry *pdnce2 = (displayNameCacheEntry*)List_Find(&dat->lCLCContactsCache,&dnce);//for check - if (pdnce2->hContact != pdnce->hContact) - return NULL; - - if (pdnce2 != pdnce) - return NULL; - } - - return (pdnce); -} - -void ClearClcContactCache(struct ClcData *dat,HANDLE hContact) -{ - pdisplayNameCacheEntry cacheEntry; - - if (hContact == INVALID_HANDLE_VALUE) { - int i,tick; - tick = GetTickCount(); - - for (i = 0;i<(dat->lCLCContactsCache.realCount);i++) { - pdisplayNameCacheEntry pdnce = (pdisplayNameCacheEntry)dat->lCLCContactsCache.items[i]; - pdnce->ClcContact = NULL; - } - tick = GetTickCount()-tick; - { - char buf[256]; - sprintf (buf,"Clear full cache %d ms\r\n",tick); - OutputDebugStringA(buf); - } - } - if ( !IsHContactGroup(hContact) && !IsHContactInfo(hContact)) { - cacheEntry = GetCLCFullCacheEntry(dat,hContact); - if (cacheEntry != NULL) - cacheEntry->ClcContact = NULL; - } -} - -void SetClcContactCacheItem(struct ClcData *dat,HANDLE hContact,void *contact) -{ - pdisplayNameCacheEntry cacheEntry; - if ( !IsHContactGroup(hContact) && !IsHContactInfo(hContact)) { - cacheEntry = GetCLCFullCacheEntry(dat,hContact); - if (cacheEntry != NULL) - cacheEntry->ClcContact = contact; - } -} - -int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **contact,struct ClcGroup **subgroup,int *isVisible) -{ - int index = 0, i; - int nowVisible = 1; - struct ClcGroup *group = &dat->list; - - group->scanIndex = 0; - - if (isVisible == NULL && hItem != NULL && subgroup == NULL && !IsHContactGroup(hItem) && !IsHContactInfo(hItem)) { - //try use cache - pdisplayNameCacheEntry cacheEntry; - cacheEntry = GetCLCFullCacheEntry(dat,hItem); - if (cacheEntry != NULL) { - if (cacheEntry->ClcContact == NULL) { - int *isv = {0}; - void *z = {0}; - int ret; - ret = FindItem(hwnd,dat,hItem,(struct ClcContact ** )&z,(struct ClcGroup** )&isv,NULL); - if (ret = 0) {return 0;} - cacheEntry->ClcContact = (void *)z; - } - - if (cacheEntry->ClcContact != NULL) { - if (contact != NULL) - *contact = (struct ClcContact *)cacheEntry->ClcContact; - - return 1; - } - } - } - - group = &dat->list; - - for (;;) { - if (group->scanIndex == group->cl.count) { - struct ClcGroup *tgroup; - group = group->parent; - if (group == NULL) - break; - - nowVisible = 1; - for (tgroup = group;tgroup;tgroup = tgroup->parent) - if (!group->expanded) { - nowVisible = 0; - break; - } - - group->scanIndex++; - continue; - } - if (nowVisible) index++; - if ((IsHContactGroup(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ((UINT_PTR)hItem&~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) || - (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->hContact == hItem) || - (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == (HANDLE)((UINT_PTR)hItem&~HCONTACT_ISINFO))) { - if (isVisible) { - if (!nowVisible) *isVisible = 0; - else { - if ((index+1)*dat->rowHeightyScroll) *isVisible = 0; - else { - RECT clRect; - GetClientRect(hwnd,&clRect); - if (index*dat->rowHeight>=dat->yScroll+clRect.bottom) *isVisible = 0; - else *isVisible = 1; - } } } - - if (contact) *contact = group->cl.items[group->scanIndex]; - if (subgroup) *subgroup = group; - return 1; - } - - if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && - group->cl.items[group->scanIndex]->SubAllocated>0) - for (i = 1; i<=group->cl.items[group->scanIndex]->SubAllocated; i++) - if (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->subcontacts[i-1].hContact == hItem) { - if (contact) *contact = &group->cl.items[group->scanIndex]->subcontacts[i-1]; - if (subgroup) *subgroup = group; - return 1; - } - - if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { - struct ClcGroup* save = group; - group = group->cl.items[group->scanIndex]->group; - group->scanIndex = 0; - nowVisible &= group->expanded; - continue; - } - group->scanIndex++; - } - return 0; -} -#define CacheArrSize 255 -struct ClcGroup *CacheIndex[CacheArrSize] = {NULL}; -boolean CacheIndexClear = TRUE; -void ClearRowByIndexCache() -{ - if (!CacheIndexClear) { - memset(CacheIndex,0,sizeof(CacheIndex)); - CacheIndexClear = TRUE; - } -} - -int GetRowByIndex(struct ClcData *dat,int testindex,struct ClcContact **contact,struct ClcGroup **subgroup) -{ - int index = 0,i; - struct ClcGroup *group = &dat->list; - - if (testindex < 0) return -1; - - group->scanIndex = 0; - for (;;) { - if (group->scanIndex == group->cl.count) { - group = group->parent; - if (group == NULL) break; - group->scanIndex++; - continue; - } - if ((index>0) && (indexcl.items[group->scanIndex]; - if (subgroup) *subgroup = group; - return index; - } - - if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) - if (group->cl.items[group->scanIndex]->SubAllocated) - if (group->cl.items[group->scanIndex]->SubExpanded) { - for (i = 0;icl.items[group->scanIndex]->SubAllocated;i++) { - if ((index>0) && (indexcl.items[group->scanIndex]->subcontacts[i]; - if (subgroup) *subgroup = group; - return index; - } - } - } - - index++; - if ((group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) && (group->cl.items[group->scanIndex]->flags & CONTACTF_STATUSMSG)) - index++; - - if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && group->cl.items[group->scanIndex]->group->expanded) { - group = group->cl.items[group->scanIndex]->group; - group->scanIndex = 0; - continue; - } - group->scanIndex++; - } - return -1; -} diff --git a/plugins/Clist_mw/clcitems.cpp b/plugins/Clist_mw/clcitems.cpp deleted file mode 100644 index 788cc8f3fd..0000000000 --- a/plugins/Clist_mw/clcitems.cpp +++ /dev/null @@ -1,693 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 "commonheaders.h" -#include "m_clc.h" -#include "clc.h" -#include "clist.h" -#include "m_metacontacts.h" - - -extern int ( *saveAddItemToGroup )( struct ClcGroup *group, int iAboveItem ); -extern int ( *saveAddInfoItemToGroup )(struct ClcGroup *group,int flags,const TCHAR *pszText); -extern struct ClcGroup* ( *saveAddGroup )(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flags,int groupId,int calcTotalMembers); -extern void (*saveFreeContact)(struct ClcContact *p); -extern void (*saveFreeGroup)(struct ClcGroup *p); - -//routines for managing adding/removal of items in the list, including sorting - -extern void ClearClcContactCache(struct ClcData *dat,HANDLE hContact); - -void AddSubcontacts(struct ClcContact * cont) -{ - int subcount,i,j; - HANDLE hsub; - pdisplayNameCacheEntry cacheEntry; - cacheEntry = GetContactFullCacheEntry(cont->hContact); - OutputDebugStringA("Proceed AddSubcontacts\r\n"); - subcount = (int)CallService(MS_MC_GETNUMCONTACTS,(WPARAM)cont->hContact,0); - cont->SubExpanded = DBGetContactSettingByte(cont->hContact,"CList","Expanded",0); - cont->isSubcontact = 0; - cont->subcontacts = (struct ClcContact *) mir_realloc(cont->subcontacts, sizeof(struct ClcContact)*subcount); - cont->SubAllocated = subcount; - i = 0; - for (j = 0; jhContact,j); - cacheEntry = GetContactFullCacheEntry(hsub); - if (!(DBGetContactSettingByte(NULL,"CLC","MetaHideOfflineSub",1) && DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT))|| - cacheEntry->status != ID_STATUS_OFFLINE ) - { - cont->subcontacts[i].hContact = cacheEntry->hContact; - cont->subcontacts[i].iImage = CallService(MS_CLIST_GETCONTACTICON,(WPARAM)cacheEntry->hContact,0); - memset(cont->subcontacts[i].iExtraImage,0xFF,SIZEOF(cont->subcontacts[i].iExtraImage)); - cont->subcontacts[i].proto = cacheEntry->szProto; - lstrcpyn(cont->subcontacts[i].szText,cacheEntry->tszName,SIZEOF(cont->subcontacts[i].szText)); - cont->subcontacts[i].type = CLCIT_CONTACT; - //cont->flags = 0;//CONTACTF_ONLINE; - cont->subcontacts[i].isSubcontact = 1; - i++; - } - } - cont->SubAllocated = i; - if (!i) mir_free(cont->subcontacts); -} - -void FreeContact(struct ClcContact *p) -{ - if ( p->SubAllocated && !p->isSubcontact) - mir_free(p->subcontacts); - - saveFreeContact( p ); -} - -int AddItemToGroup(struct ClcGroup *group,int iAboveItem) -{ - iAboveItem = saveAddItemToGroup( group, iAboveItem ); - ClearRowByIndexCache(); - return iAboveItem; -} - -struct ClcGroup *AddGroup(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flags,int groupId,int calcTotalMembers) -{ - struct ClcGroup* result; - - ClearRowByIndexCache(); - dat->needsResort = 1; - result = saveAddGroup( hwnd, dat, szName, flags, groupId, calcTotalMembers); - ClearRowByIndexCache(); - return result; -} - -void FreeGroup(struct ClcGroup *group) -{ - saveFreeGroup( group ); - ClearRowByIndexCache(); -} - -int AddInfoItemToGroup(struct ClcGroup *group,int flags,const TCHAR *pszText) -{ - int i = saveAddInfoItemToGroup( group, flags, pszText ); - ClearRowByIndexCache(); - return i; -} - -static struct ClcContact * AddContactToGroup(struct ClcData *dat,struct ClcGroup *group,pdisplayNameCacheEntry cacheEntry) -{ - char *szProto; - WORD apparentMode; - DWORD idleMode; - HANDLE hContact; - DBVARIANT dbv; - int i; - char AdvancedService[255] = {0}; - int img = -1; - int basicIcon = 0; - - if (cacheEntry == NULL || group == NULL || dat == NULL) - return NULL; - - hContact = cacheEntry->hContact; - - dat->needsResort = 1; - for (i = group->cl.count-1;i>=0;i--) - if (group->cl.items[i]->type != CLCIT_INFO || !(group->cl.items[i]->flags&CLCIIF_BELOWCONTACTS)) break; - i = AddItemToGroup(group,i+1); - group->cl.items[i]->type = CLCIT_CONTACT; - group->cl.items[i]->SubAllocated = 0; - group->cl.items[i]->isSubcontact = 0; - group->cl.items[i]->subcontacts = NULL; - - _snprintf(AdvancedService,sizeof(AdvancedService),"%s%s",cacheEntry->szProto,"/GetAdvancedStatusIcon"); - - if (ServiceExists(AdvancedService)) - img = CallService(AdvancedService,(WPARAM)hContact, (LPARAM)0); - - if (img == -1 || !(LOWORD(img))) - img = CallService(MS_CLIST_GETCONTACTICON,(WPARAM)hContact,0); - - group->cl.items[i]->iImage = img; - - cacheEntry = GetContactFullCacheEntry(hContact); - group->cl.items[i]->hContact = hContact; - - //cacheEntry->ClcContact = &(group->cl.items[i]); - //SetClcContactCacheItem(dat,hContact,&(group->cl.items[i])); - - szProto = cacheEntry->szProto; - if (szProto != NULL&&!pcli->pfnIsHiddenMode(dat,cacheEntry->status)) - group->cl.items[i]->flags |= CONTACTF_ONLINE; - apparentMode = szProto != NULL?cacheEntry->ApparentMode:0; - if (apparentMode == ID_STATUS_OFFLINE) group->cl.items[i]->flags |= CONTACTF_INVISTO; - else if (apparentMode == ID_STATUS_ONLINE) group->cl.items[i]->flags |= CONTACTF_VISTO; - else if (apparentMode) group->cl.items[i]->flags |= CONTACTF_VISTO|CONTACTF_INVISTO; - if (cacheEntry->NotOnList) group->cl.items[i]->flags |= CONTACTF_NOTONLIST; - idleMode = szProto != NULL?cacheEntry->IdleTS:0; - if (idleMode) group->cl.items[i]->flags |= CONTACTF_IDLE; - - lstrcpyn(group->cl.items[i]->szText,cacheEntry->tszName, SIZEOF(group->cl.items[i]->szText)); - group->cl.items[i]->proto = szProto; - - if (dat->style & CLS_SHOWSTATUSMESSAGES) { - if (!DBGetContactSettingTString(hContact, "CList", "StatusMsg", &dbv)) { - int j; - lstrcpyn(group->cl.items[i]->szStatusMsg, dbv.ptszVal, SIZEOF(group->cl.items[i]->szStatusMsg)); - for (j = (int)_tcslen(group->cl.items[i]->szStatusMsg)-1;j>=0;j--) { - if (group->cl.items[i]->szStatusMsg[j] == '\r' || group->cl.items[i]->szStatusMsg[j] == '\n' || group->cl.items[i]->szStatusMsg[j] == '\t') { - group->cl.items[i]->szStatusMsg[j] = ' '; - } - } - DBFreeVariant(&dbv); - if (_tcslen(group->cl.items[i]->szStatusMsg)>0) { - group->cl.items[i]->flags |= CONTACTF_STATUSMSG; - } - } - } - - ClearRowByIndexCache(); - return group->cl.items[i]; -} - -void AddContactToTree(HWND hwnd,struct ClcData *dat,HANDLE hContact,int updateTotalCount,int checkHideOffline) -{ - if (FindItem(hwnd,dat,hContact,NULL,NULL,NULL) == 1) - return; - - pdisplayNameCacheEntry cacheEntry = GetContactFullCacheEntry(hContact); - if (cacheEntry == NULL) - return; - - char *szProto = cacheEntry->szProto; - - dat->needsResort = 1; - ClearRowByIndexCache(); - ClearClcContactCache(dat,hContact); - - WORD status; - DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE); - if (style & CLS_NOHIDEOFFLINE) checkHideOffline = 0; - if (checkHideOffline) { - if (szProto == NULL) status = ID_STATUS_OFFLINE; - else status = cacheEntry->status; - } - - ClcGroup *group; - if (lstrlen(cacheEntry->tszGroup) == 0) - group = &dat->list; - else { - group = AddGroup(hwnd,dat,cacheEntry->tszGroup,(DWORD)-1,0,0); - if (group == NULL) { - DWORD groupFlags; - int i; - if ( !(style & CLS_HIDEEMPTYGROUPS)) - return; - - if (checkHideOffline && pcli->pfnIsHiddenMode(dat,status)) { - for (i = 1;;i++) { - TCHAR *szGroupName = pcli->pfnGetGroupName(i, &groupFlags); - if (szGroupName == NULL) - return; //never happens - if ( !lstrcmp(szGroupName,cacheEntry->tszGroup)) - break; - } - if (groupFlags & GROUPF_HIDEOFFLINE) - return; - } - for (i = 1;; i++) { - TCHAR *szGroupName = pcli->pfnGetGroupName(i, &groupFlags); - if (szGroupName == NULL) - return; //never happens - if (!lstrcmp(szGroupName,cacheEntry->tszGroup)) - break; - size_t len = lstrlen(szGroupName); - if (!_tcsncmp(szGroupName,cacheEntry->tszGroup,len) && cacheEntry->tszGroup[len] == '\\') - AddGroup(hwnd,dat,szGroupName,groupFlags,i,1); - } - group = AddGroup(hwnd,dat,cacheEntry->tszGroup,groupFlags,i,1); - } - } - - if (checkHideOffline) { - if (pcli->pfnIsHiddenMode(dat,status) && (style&CLS_HIDEOFFLINE || group->hideOffline)) { - if (updateTotalCount) group->totalMembers++; - return; - } - } - ClcContact *cont = AddContactToGroup(dat,group,cacheEntry); - if (cont && cont->proto) { - cont->SubAllocated = 0; - if (strcmp(cont->proto,"MetaContacts") == 0) - AddSubcontacts(cont); - } - if (updateTotalCount) - group->totalMembers++; - ClearRowByIndexCache(); -} - -extern struct ClcGroup* ( *saveRemoveItemFromGroup )(HWND hwnd,struct ClcGroup *group,struct ClcContact *contact,int updateTotalCount); - -struct ClcGroup *RemoveItemFromGroup(HWND hwnd,struct ClcGroup *group,struct ClcContact *contact,int updateTotalCount) -{ - ClearRowByIndexCache(); - if (contact->type == CLCIT_CONTACT) { - struct ClcData* dat = (struct ClcData*)GetWindowLongPtr(hwnd,0); - ClearClcContactCache(dat,contact->hContact); - } - - group = saveRemoveItemFromGroup(hwnd, group, contact, updateTotalCount); - - ClearRowByIndexCache(); - return group; -} - -void DeleteItemFromTree(HWND hwnd,HANDLE hItem) -{ - struct ClcContact *contact; - struct ClcGroup *group; - struct ClcData *dat = (struct ClcData*)GetWindowLongPtr(hwnd,0); - - ClearRowByIndexCache(); - dat->needsResort = 1; - - if (!FindItem(hwnd,dat,hItem,&contact,&group,NULL)) { - DBVARIANT dbv; - int i,nameOffset; - if (!IsHContactContact(hItem)) return; - ClearClcContactCache(dat,hItem); - - if (DBGetContactSettingTString(hItem,"CList","Group",&dbv)) return; - - //decrease member counts of all parent groups too - group = &dat->list; - nameOffset = 0; - for (i = 0;;i++) { - if (group->scanIndex == group->cl.count) - break; - - if (group->cl.items[i]->type == CLCIT_GROUP) { - int len = lstrlen(group->cl.items[i]->szText); - if (!_tcsncmp(group->cl.items[i]->szText,dbv.ptszVal+nameOffset,len) && (dbv.ptszVal[nameOffset+len] == '\\' || dbv.pszVal[nameOffset+len] == '\0')) { - group->totalMembers--; - if (dbv.pszVal[nameOffset+len] == '\0') - break; - } - } - } - mir_free(dbv.pszVal); - } - else RemoveItemFromGroup(hwnd,group,contact,1); - - ClearRowByIndexCache(); -} - - - -void RebuildEntireList(HWND hwnd,struct ClcData *dat) -{ -// char *szProto; - DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE); - HANDLE hContact; - struct ClcContact * cont; - struct ClcGroup *group; - //DBVARIANT dbv; - int tick = GetTickCount(); - - ClearRowByIndexCache(); - ClearClcContactCache(dat,INVALID_HANDLE_VALUE); - - dat->list.expanded = 1; - dat->list.hideOffline = DBGetContactSettingByte(NULL,"CLC","HideOfflineRoot",0); - memset( &dat->list.cl, 0, sizeof( dat->list.cl )); - dat->list.cl.increment = 30; - dat->needsResort = 1; - dat->selection = -1; - { - int i; - TCHAR *szGroupName; - DWORD groupFlags; - - for (i = 1;;i++) { - szGroupName = pcli->pfnGetGroupName(i,&groupFlags); - if (szGroupName == NULL) - break; - - AddGroup(hwnd,dat,szGroupName,groupFlags,i,0); - } - } - - hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); - while(hContact) { - - pdisplayNameCacheEntry cacheEntry; - cont = NULL; - cacheEntry = GetContactFullCacheEntry(hContact); - //cacheEntry->ClcContact = NULL; - ClearClcContactCache(dat,hContact); - if (cacheEntry == NULL) - MessageBoxA(0,"Fail To Get CacheEntry for hContact","!!!!!!!!",0); - - if (style&CLS_SHOWHIDDEN || !cacheEntry->bIsHidden) { - if (lstrlen(cacheEntry->tszGroup) == 0) - group = &dat->list; - else { - group = AddGroup(hwnd,dat,cacheEntry->tszGroup,(DWORD)-1,0,0); - //mir_free(dbv.pszVal); - } - - if (group != NULL) { - group->totalMembers++; - if (!(style&CLS_NOHIDEOFFLINE) && (style&CLS_HIDEOFFLINE || group->hideOffline)) { - //szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); - if (cacheEntry->szProto == NULL) { - if (!pcli->pfnIsHiddenMode(dat,ID_STATUS_OFFLINE)||cacheEntry->noHiddenOffline) - cont = AddContactToGroup(dat,group,cacheEntry); - } - else - if (!pcli->pfnIsHiddenMode(dat,cacheEntry->status)||cacheEntry->noHiddenOffline) - cont = AddContactToGroup(dat,group,cacheEntry); - } - else cont = AddContactToGroup(dat,group,cacheEntry); - } - } - if (cont && cont->proto) { - cont->SubAllocated = 0; - if (strcmp(cont->proto,"MetaContacts") == 0) - AddSubcontacts(cont); - } - hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0); - } - - if (style&CLS_HIDEEMPTYGROUPS) { - group = &dat->list; - group->scanIndex = 0; - for (;;) { - if (group->scanIndex == group->cl.count) { - group = group->parent; - if (group == NULL) - break; - } - else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { - if (group->cl.items[group->scanIndex]->group->cl.count == 0) { - group = RemoveItemFromGroup(hwnd,group,group->cl.items[group->scanIndex],0); - } - else { - group = group->cl.items[group->scanIndex]->group; - group->scanIndex = 0; - } - continue; - } - group->scanIndex++; - } - } - - SortCLC(hwnd,dat,0); - tick = GetTickCount()-tick; - { - char buf[255]; - //sprintf(buf,"%s %s took %i ms",__FILE__,__LINE__,tick); - sprintf(buf,"RebuildEntireList %d \r\n",tick); - - OutputDebugStringA(buf); - DBWriteContactSettingDword((HANDLE)0,"CLUI","PF:Last RebuildEntireList Time:",tick); - } -} - - -int GetNewSelection(struct ClcGroup *group, int selection, int direction) -{ - int lastcount = 0, count = 0;//group->cl.count; - struct ClcGroup *topgroup = group; - if (selection<0) { - return 0; - } - group->scanIndex = 0; - for (;;) { - if (group->scanIndex == group->cl.count) { - group = group->parent; - if (group == NULL) - break; - - group->scanIndex++; - continue; - } - if (count>=selection) return count; - lastcount = count; - count++; - if ((group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) && (group->cl.items[group->scanIndex]->flags & CONTACTF_STATUSMSG)) { - count++; - } - if (!direction) { - if (count>selection) return lastcount; - } - if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (group->cl.items[group->scanIndex]->group->expanded)) { - group = group->cl.items[group->scanIndex]->group; - group->scanIndex = 0; - continue; - } - group->scanIndex++; - } - return lastcount; - } - -int GetGroupContentsCount(struct ClcGroup *group,int visibleOnly) -{ - int count = 0;//group->cl.count; - struct ClcGroup *topgroup = group; - - group->scanIndex = 0; - for (;;) { - if (group->scanIndex == group->cl.count) { - if (group == topgroup) break; - group = group->parent; - group->scanIndex++; - continue; - } - - count++; - if ((group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) && (group->cl.items[group->scanIndex]->flags & CONTACTF_STATUSMSG)) - count++; - - if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (!visibleOnly || group->cl.items[group->scanIndex]->group->expanded)) { - group = group->cl.items[group->scanIndex]->group; - group->scanIndex = 0; - continue; - } - group->scanIndex++; - } - return count; -} - -extern void ( *saveSortCLC )(HWND hwnd,struct ClcData *dat,int useInsertionSort); - -void SortCLC(HWND hwnd,struct ClcData *dat,int useInsertionSort) -{ -#ifdef _DEBUG - DWORD tick = GetTickCount(); -#endif - int oldSort = dat->needsResort; - saveSortCLC(hwnd, dat, useInsertionSort); - if ( oldSort ) - ClearRowByIndexCache(); - -#ifdef _DEBUG - { - char buf[255]; - //sprintf(buf,"%s %s took %i ms",__FILE__,__LINE__,tick); - tick = GetTickCount()-tick; - if (tick > 5) { - sprintf(buf,"SortCLC %d \r\n",tick); - OutputDebugStringA(buf); - DBWriteContactSettingDword((HANDLE)0,"CLUI","PF:Last SortCLC Time:",tick); - } - } -#endif -} - -struct SavedContactState_t -{ - HANDLE hContact; - BYTE iExtraImage[MAXEXTRACOLUMNS]; - int checked; -}; - -struct SavedGroupState_t -{ - int groupId, expanded; -}; - -struct SavedInfoState_t -{ - int parentId; - struct ClcContact contact; -}; - -void SaveStateAndRebuildList(HWND hwnd,struct ClcData *dat) -{ - NMCLISTCONTROL nm; - int i,j; - struct SavedGroupState_t *savedGroup = NULL; - int savedGroupCount = 0,savedGroupAlloced = 0; - struct SavedContactState_t *savedContact = NULL; - int savedContactCount = 0,savedContactAlloced = 0; - struct SavedInfoState_t *savedInfo = NULL; - int savedInfoCount = 0,savedInfoAlloced = 0; - struct ClcGroup *group; - struct ClcContact *contact; - - int tick = GetTickCount(); - int allocstep = 1024; - pcli->pfnHideInfoTip(hwnd,dat); - KillTimer(hwnd,TIMERID_INFOTIP); - KillTimer(hwnd,TIMERID_RENAME); - pcli->pfnEndRename(hwnd,dat,1); - - group = &dat->list; - group->scanIndex = 0; - for (;;) { - if (group->scanIndex == group->cl.count) { - group = group->parent; - if (group == NULL) - break; - } - else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { - group = group->cl.items[group->scanIndex]->group; - group->scanIndex = 0; - if (++savedGroupCount>savedGroupAlloced) { - savedGroupAlloced += allocstep; - savedGroup = (struct SavedGroupState_t*)mir_realloc(savedGroup,sizeof(struct SavedGroupState_t)*savedGroupAlloced); - } - savedGroup[savedGroupCount-1].groupId = group->groupId; - savedGroup[savedGroupCount-1].expanded = group->expanded; - continue; - } - else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) { - if (++savedContactCount>savedContactAlloced) { - savedContactAlloced += allocstep; - savedContact = (struct SavedContactState_t*)mir_realloc(savedContact,sizeof(struct SavedContactState_t)*savedContactAlloced); - } - savedContact[savedContactCount-1].hContact = group->cl.items[group->scanIndex]->hContact; - CopyMemory(savedContact[savedContactCount-1].iExtraImage, group->cl.items[group->scanIndex]->iExtraImage, MAXEXTRACOLUMNS); - savedContact[savedContactCount-1].checked = group->cl.items[group->scanIndex]->flags & CONTACTF_CHECKED; - if (group->cl.items[group->scanIndex]->SubAllocated>0) - { - int l; - for (l = 0; lcl.items[group->scanIndex]->SubAllocated; l++) - { - if (++savedContactCount>savedContactAlloced) { - savedContactAlloced += allocstep; - savedContact = (struct SavedContactState_t*)mir_realloc(savedContact,sizeof(struct SavedContactState_t)*savedContactAlloced); - } - savedContact[savedContactCount-1].hContact = group->cl.items[group->scanIndex]->subcontacts[l].hContact; - CopyMemory(savedContact[savedContactCount-1].iExtraImage ,group->cl.items[group->scanIndex]->subcontacts[l].iExtraImage,MAXEXTRACOLUMNS); - savedContact[savedContactCount-1].checked = group->cl.items[group->scanIndex]->subcontacts[l].flags&CONTACTF_CHECKED; - } - } - } - else if (group->cl.items[group->scanIndex]->type == CLCIT_INFO) { - if (++savedInfoCount>savedInfoAlloced) { - savedInfoAlloced += allocstep; - savedInfo = (struct SavedInfoState_t*)mir_realloc(savedInfo,sizeof(struct SavedInfoState_t)*savedInfoAlloced); - } - if (group->parent == NULL) - savedInfo[savedInfoCount-1].parentId = -1; - else - savedInfo[savedInfoCount-1].parentId = group->groupId; - savedInfo[savedInfoCount-1].contact = *group->cl.items[group->scanIndex]; - } - group->scanIndex++; - } - - pcli->pfnFreeGroup(&dat->list); - RebuildEntireList(hwnd,dat); - - group = &dat->list; - group->scanIndex = 0; - for (;;) { - if (group->scanIndex == group->cl.count) { - group = group->parent; - if (group == NULL) - break; - } - else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { - group = group->cl.items[group->scanIndex]->group; - group->scanIndex = 0; - for (i = 0;igroupId) { - group->expanded = savedGroup[i].expanded; - break; - } - continue; - } - else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) { - for (i = 0;icl.items[group->scanIndex]->hContact) { - CopyMemory(group->cl.items[group->scanIndex]->iExtraImage,savedContact[i].iExtraImage,MAXEXTRACOLUMNS); - if (savedContact[i].checked) group->cl.items[group->scanIndex]->flags |= CONTACTF_CHECKED; - break; - } - if (group->cl.items[group->scanIndex]->SubAllocated>0) - { - int l; - for (l = 0; lcl.items[group->scanIndex]->SubAllocated; l++) - for (i = 0;icl.items[group->scanIndex]->subcontacts[l].hContact) { - CopyMemory(group->cl.items[group->scanIndex]->subcontacts[l].iExtraImage,savedContact[i].iExtraImage,MAXEXTRACOLUMNS); - if (savedContact[i].checked) group->cl.items[group->scanIndex]->subcontacts[l].flags |= CONTACTF_CHECKED; - break; - } - } - } - group->scanIndex++; - } - if (savedGroup) mir_free(savedGroup); - if (savedContact) mir_free(savedContact); - for (i = 0;ilist; - else { - if (!FindItem(hwnd,dat,(HANDLE)(savedInfo[i].parentId|HCONTACT_ISGROUP),&contact,NULL,NULL)) continue; - group = contact->group; - } - j = AddInfoItemToGroup(group,savedInfo[i].contact.flags,_T("")); - *group->cl.items[j] = savedInfo[i].contact; - } - if (savedInfo) mir_free(savedInfo); - pcli->pfnRecalculateGroupCheckboxes(hwnd,dat); - - RecalcScrollBar(hwnd,dat); - nm.hdr.code = CLN_LISTREBUILT; - nm.hdr.hwndFrom = hwnd; - nm.hdr.idFrom = GetDlgCtrlID(hwnd); - - - //srand(GetTickCount()); - - tick = GetTickCount()-tick; - { - char buf[255]; - //sprintf(buf,"%s %s took %i ms",__FILE__,__LINE__,tick); - sprintf(buf,"SaveStateAndRebuildList %d \r\n",tick); - - OutputDebugStringA(buf); - } - ClearRowByIndexCache(); - SendMessage(GetParent(hwnd),WM_NOTIFY,0,(LPARAM)&nm); -} diff --git a/plugins/Clist_mw/clcopts.cpp b/plugins/Clist_mw/clcopts.cpp deleted file mode 100644 index 43634f6fad..0000000000 --- a/plugins/Clist_mw/clcopts.cpp +++ /dev/null @@ -1,561 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 "commonheaders.h" -#include "m_clc.h" -#include "clc.h" - -#define DBFONTF_BOLD 1 -#define DBFONTF_ITALIC 2 -#define DBFONTF_UNDERLINE 4 - -static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -static INT_PTR CALLBACK DlgProcClcMetaOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - -static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -int OnStatusBarBackgroundChange(); - -int BgClcChange(WPARAM wParam,LPARAM lParam) -{ - pcli->pfnClcOptionsChanged(); - return 0; -} - -int BgStatusBarChange(WPARAM wParam,LPARAM lParam) -{ - pcli->pfnClcOptionsChanged(); - OnStatusBarBackgroundChange(); - return 0; -} - -int ClcOptInit(WPARAM wParam,LPARAM lParam) -{ - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); - odp.hInstance = g_hInst; - odp.pszGroup = LPGEN("Contact List"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLC); - odp.pszTitle = LPGEN("List"); - odp.pfnDlgProc = DlgProcClcMainOpts; - odp.flags = ODPF_BOLDGROUPS|ODPF_EXPERTONLY; - Options_AddPage(wParam, &odp); - - if (!ServiceExists(MS_BACKGROUNDCONFIG_REGISTER)) { - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLCBKG); - odp.pszTitle = LPGEN("List Background"); - odp.pfnDlgProc = DlgProcClcBkgOpts; - odp.flags = ODPF_BOLDGROUPS; - Options_AddPage(wParam, &odp); - } - - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_META_CLC); - odp.pszTitle = LPGEN("List MetaContacts"); - odp.pfnDlgProc = DlgProcClcMetaOpts; - Options_AddPage(wParam, &odp); - - if (!ServiceExists(MS_BACKGROUNDCONFIG_REGISTER)) { - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLCBKG); - odp.pszTitle = LPGEN("StatusBar Background"); - odp.pfnDlgProc = DlgProcStatusBarBkgOpts; - odp.flags = ODPF_BOLDGROUPS; - Options_AddPage(wParam, &odp); - } - - return 0; -} - -struct CheckBoxToStyleEx_t { - int id; - DWORD flag; - int not; -} static const checkBoxToStyleEx[] = { - {IDC_DISABLEDRAGDROP,CLS_EX_DISABLEDRAGDROP,0}, - {IDC_NOTEDITLABELS,CLS_EX_EDITLABELS,1}, - {IDC_SHOWSELALWAYS,CLS_EX_SHOWSELALWAYS,0}, - {IDC_TRACKSELECT,CLS_EX_TRACKSELECT,0}, - {IDC_SHOWGROUPCOUNTS,CLS_EX_SHOWGROUPCOUNTS,0}, - {IDC_HIDECOUNTSWHENEMPTY,CLS_EX_HIDECOUNTSWHENEMPTY,0}, - {IDC_DIVIDERONOFF,CLS_EX_DIVIDERONOFF,0}, - {IDC_NOTNOTRANSLUCENTSEL,CLS_EX_NOTRANSLUCENTSEL,1}, - {IDC_LINEWITHGROUPS,CLS_EX_LINEWITHGROUPS,0}, - {IDC_QUICKSEARCHVISONLY,CLS_EX_QUICKSEARCHVISONLY,0}, - {IDC_SORTGROUPSALPHA,CLS_EX_SORTGROUPSALPHA,0}, - {IDC_NOTNOSMOOTHSCROLLING,CLS_EX_NOSMOOTHSCROLLING,1}}; - -struct CheckBoxValues_t { - DWORD style; - TCHAR *szDescr; -}; -static const struct CheckBoxValues_t greyoutValues[] = -{ - {GREYF_UNFOCUS, _T("Not focused") }, - {MODEF_OFFLINE, _T("Offline") }, - {PF2_ONLINE, _T("Online") }, - {PF2_SHORTAWAY, _T("Away") }, - {PF2_LONGAWAY, _T("NA") }, - {PF2_LIGHTDND, _T("Occupied") }, - {PF2_HEAVYDND, _T("DND") }, - {PF2_FREECHAT, _T("Free for chat") }, - {PF2_INVISIBLE, _T("Invisible") }, - {PF2_OUTTOLUNCH, _T("Out to lunch") }, - {PF2_ONTHEPHONE, _T("On the phone") } -}; - -static const struct CheckBoxValues_t offlineValues[] = -{ - {MODEF_OFFLINE, _T("Offline") }, - {PF2_ONLINE, _T("Online") }, - {PF2_SHORTAWAY, _T("Away") }, - {PF2_LONGAWAY, _T("NA") }, - {PF2_LIGHTDND, _T("Occupied") }, - {PF2_HEAVYDND, _T("DND") }, - {PF2_FREECHAT, _T("Free for chat") }, - {PF2_INVISIBLE, _T("Invisible") }, - {PF2_OUTTOLUNCH, _T("Out to lunch") }, - {PF2_ONTHEPHONE, _T("On the phone") } -}; - -static void FillCheckBoxTree(HWND hwndTree,const struct CheckBoxValues_t *values,int nValues,DWORD style) -{ - TVINSERTSTRUCT tvis; - int i; - - tvis.hParent = NULL; - tvis.hInsertAfter = TVI_LAST; - tvis.item.mask = TVIF_PARAM|TVIF_TEXT|TVIF_STATE; - for (i = 0;i>12 == 2)) flags |= tvi.lParam; - tvi.hItem = TreeView_GetNextSibling(hwndTree,tvi.hItem); - } - return flags; -} - -static INT_PTR CALLBACK DlgProcClcMetaOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - LPNMHDR t; - t = ((LPNMHDR)lParam); - switch (msg) - { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - - CheckDlgButton(hwndDlg, IDC_META, DBGetContactSettingByte(NULL,"CLC","Meta",0) ? BST_CHECKED : BST_UNCHECKED); /// by FYR - CheckDlgButton(hwndDlg, IDC_METADBLCLK, DBGetContactSettingByte(NULL,"CLC","MetaDoubleClick",0) ? BST_CHECKED : BST_UNCHECKED); /// by FYR - CheckDlgButton(hwndDlg, IDC_METASUBEXTRA, DBGetContactSettingByte(NULL,"CLC","MetaHideExtra",0) ? BST_CHECKED : BST_UNCHECKED); /// by FYR - CheckDlgButton(hwndDlg, IDC_METASUBEXTRA_IGN, DBGetContactSettingByte(NULL,"CLC","MetaIgnoreEmptyExtra",1) ? BST_CHECKED : BST_UNCHECKED); /// by FYR - CheckDlgButton(hwndDlg, IDC_METASUB_HIDEOFFLINE, DBGetContactSettingByte(NULL,"CLC","MetaHideOfflineSub",1) ? BST_CHECKED : BST_UNCHECKED); /// by FYR - return TRUE; - case WM_COMMAND: - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - return TRUE; - case WM_NOTIFY: - - switch(t->idFrom) - { - case 0: - switch (t->code) - { - case PSN_APPLY: - DBWriteContactSettingByte(NULL,"CLC","Meta",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_META)); // by FYR - DBWriteContactSettingByte(NULL,"CLC","MetaDoubleClick",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METADBLCLK)); // by FYR - DBWriteContactSettingByte(NULL,"CLC","MetaHideExtra",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUBEXTRA)); // by FYR - DBWriteContactSettingByte(NULL,"CLC","MetaIgnoreEmptyExtra",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUBEXTRA_IGN)); // by FYR - DBWriteContactSettingByte(NULL,"CLC","MetaHideOfflineSub",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUB_HIDEOFFLINE)); // by FYR - pcli->pfnClcOptionsChanged(); - return TRUE; - } - break; - } - break; - } - return FALSE; -} - -static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES); - SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES); - { - DWORD exStyle = DBGetContactSettingDword(NULL,"CLC","ExStyle",pcli->pfnGetDefaultExStyle()); - for (int i = 0;i < SIZEOF(checkBoxToStyleEx); i++) - CheckDlgButton(hwndDlg,checkBoxToStyleEx[i].id,(exStyle&checkBoxToStyleEx[i].flag)^(checkBoxToStyleEx[i].flag*checkBoxToStyleEx[i].not)?BST_CHECKED:BST_UNCHECKED); - - UDACCEL accel[2] = {{0,10},{2,50}}; - SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_SETRANGE,0,MAKELONG(999,0)); - SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_SETACCEL,SIZEOF(accel), (LPARAM)&accel ); - SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"CLC","ScrollTime",CLCDEFAULT_SCROLLTIME),0)); - } - CheckDlgButton(hwndDlg,IDC_IDLE,DBGetContactSettingByte(NULL,"CLC","ShowIdle",CLCDEFAULT_SHOWIDLE)?BST_CHECKED:BST_UNCHECKED); - - SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_SETRANGE,0,MAKELONG(64,0)); - SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingByte(NULL,"CLC","LeftMargin",CLCDEFAULT_LEFTMARGIN),0)); - SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_SETRANGE,0,MAKELONG(50,0)); - SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingByte(NULL,"CLC","GroupIndent",CLCDEFAULT_GROUPINDENT),0)); - CheckDlgButton(hwndDlg,IDC_GREYOUT,DBGetContactSettingDword(NULL,"CLC","GreyoutFlags",CLCDEFAULT_GREYOUTFLAGS)?BST_CHECKED:BST_UNCHECKED); - - - EnableWindow(GetDlgItem(hwndDlg,IDC_SMOOTHTIME),IsDlgButtonChecked(hwndDlg,IDC_NOTNOSMOOTHSCROLLING)); - EnableWindow(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),IsDlgButtonChecked(hwndDlg,IDC_GREYOUT)); - FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),greyoutValues,SIZEOF(greyoutValues),DBGetContactSettingDword(NULL,"CLC","FullGreyoutFlags",CLCDEFAULT_FULLGREYOUTFLAGS)); - FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS),offlineValues,SIZEOF(offlineValues),DBGetContactSettingDword(NULL,"CLC","OfflineModes",CLCDEFAULT_OFFLINEMODES)); - CheckDlgButton(hwndDlg,IDC_NOSCROLLBAR,DBGetContactSettingByte(NULL,"CLC","NoVScrollBar",0)?BST_CHECKED:BST_UNCHECKED); - return TRUE; - - case WM_VSCROLL: - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - - case WM_COMMAND: - if (LOWORD(wParam) == IDC_NOTNOSMOOTHSCROLLING) - EnableWindow(GetDlgItem(hwndDlg,IDC_SMOOTHTIME),IsDlgButtonChecked(hwndDlg,IDC_NOTNOSMOOTHSCROLLING)); - if (LOWORD(wParam) == IDC_GREYOUT) - EnableWindow(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),IsDlgButtonChecked(hwndDlg,IDC_GREYOUT)); - if ((LOWORD(wParam) == IDC_LEFTMARGIN || LOWORD(wParam) == IDC_SMOOTHTIME || LOWORD(wParam) == IDC_GROUPINDENT) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) - return 0; - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - - case WM_NOTIFY: - switch(((LPNMHDR)lParam)->idFrom) { - case IDC_GREYOUTOPTS: - case IDC_HIDEOFFLINEOPTS: - if (((LPNMHDR)lParam)->code == NM_CLICK) { - TVHITTESTINFO hti; - hti.pt.x = (short)LOWORD(GetMessagePos()); - hti.pt.y = (short)HIWORD(GetMessagePos()); - ScreenToClient(((LPNMHDR)lParam)->hwndFrom,&hti.pt); - if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom,&hti)) - if (hti.flags&TVHT_ONITEMSTATEICON) { - TVITEM tvi; - tvi.mask = TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE; - tvi.hItem = hti.hItem; - TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom,&tvi); - tvi.iImage = tvi.iSelectedImage = (tvi.iImage == 1) ? 2 : 1; - TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom,&tvi); - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - } - break; - case 0: - if (((LPNMHDR)lParam)->code == PSN_APPLY) { - int i; - DWORD exStyle = 0; - for (i = 0;i < SIZEOF(checkBoxToStyleEx);i++) - if ((IsDlgButtonChecked(hwndDlg,checkBoxToStyleEx[i].id) == 0) == checkBoxToStyleEx[i].not) - exStyle |= checkBoxToStyleEx[i].flag; - DBWriteContactSettingDword(NULL,"CLC","ExStyle",exStyle); - - DWORD fullGreyoutFlags = MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS)); - DBWriteContactSettingDword(NULL,"CLC","FullGreyoutFlags",fullGreyoutFlags); - if (IsDlgButtonChecked(hwndDlg,IDC_GREYOUT)) - DBWriteContactSettingDword(NULL,"CLC","GreyoutFlags",fullGreyoutFlags); - else - DBWriteContactSettingDword(NULL,"CLC","GreyoutFlags",0); - - DBWriteContactSettingByte(NULL,"CLC","ShowIdle",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_IDLE)?1:0)); - DBWriteContactSettingDword(NULL,"CLC","OfflineModes",MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS))); - DBWriteContactSettingByte(NULL,"CLC","LeftMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_GETPOS,0,0)); - DBWriteContactSettingWord(NULL,"CLC","ScrollTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_GETPOS,0,0)); - DBWriteContactSettingByte(NULL,"CLC","GroupIndent",(BYTE)SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_GETPOS,0,0)); - DBWriteContactSettingByte(NULL,"CLC","NoVScrollBar",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_NOSCROLLBAR)?1:0)); - - pcli->pfnClcOptionsChanged(); - return TRUE; - } - } - break; - - case WM_DESTROY: - ImageList_Destroy(TreeView_GetImageList(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),TVSIL_NORMAL)); - break; - } - return FALSE; -} - -static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg,IDC_BITMAP,DBGetContactSettingByte(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)?BST_CHECKED:BST_UNCHECKED); - SendMessage(hwndDlg,WM_USER+10,0,0); - SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETDEFAULTCOLOUR,0,CLCDEFAULT_BKCOLOUR); - SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"StatusBar","BkColour",CLCDEFAULT_BKCOLOUR)); - SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETDEFAULTCOLOUR,0,CLCDEFAULT_SELBKCOLOUR); - SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"StatusBar","SelBkColour",CLCDEFAULT_SELBKCOLOUR)); - { - DBVARIANT dbv; - if (!DBGetContactSettingString(NULL,"StatusBar","BkBitmap",&dbv)) { - SetDlgItemTextA(hwndDlg,IDC_FILENAME,dbv.pszVal); - if (ServiceExists(MS_UTILS_PATHTOABSOLUTE)) { - char szPath[MAX_PATH]; - - if (CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)dbv.pszVal, (LPARAM)szPath)) - SetDlgItemTextA(hwndDlg,IDC_FILENAME,szPath); - } - else - mir_free(dbv.pszVal); - } - - WORD bmpUse = DBGetContactSettingWord(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE); - CheckDlgButton(hwndDlg,IDC_STRETCHH,bmpUse&CLB_STRETCHH?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_STRETCHV,bmpUse&CLB_STRETCHV?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_TILEH,bmpUse&CLBF_TILEH?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_TILEV,bmpUse&CLBF_TILEV?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_SCROLL,bmpUse&CLBF_SCROLL?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_PROPORTIONAL,bmpUse&CLBF_PROPORTIONAL?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_TILEVROWH,bmpUse&CLBF_TILEVTOROWHEIGHT?BST_CHECKED:BST_UNCHECKED); - - HRESULT (STDAPICALLTYPE *MySHAutoComplete)(HWND,DWORD); - MySHAutoComplete = (HRESULT (STDAPICALLTYPE*)(HWND,DWORD))GetProcAddress(GetModuleHandleA("shlwapi"),"SHAutoComplete"); - if (MySHAutoComplete) - MySHAutoComplete(GetDlgItem(hwndDlg,IDC_FILENAME),1); - } - return TRUE; - - case WM_USER+10: - EnableWindow(GetDlgItem(hwndDlg,IDC_FILENAME),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - EnableWindow(GetDlgItem(hwndDlg,IDC_BROWSE),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - EnableWindow(GetDlgItem(hwndDlg,IDC_STRETCHH),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - EnableWindow(GetDlgItem(hwndDlg,IDC_STRETCHV),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - EnableWindow(GetDlgItem(hwndDlg,IDC_TILEH),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - EnableWindow(GetDlgItem(hwndDlg,IDC_TILEV),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - EnableWindow(GetDlgItem(hwndDlg,IDC_SCROLL),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - EnableWindow(GetDlgItem(hwndDlg,IDC_PROPORTIONAL),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - EnableWindow(GetDlgItem(hwndDlg,IDC_TILEVROWH),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - break; - - case WM_COMMAND: - if (LOWORD(wParam) == IDC_BROWSE) { - char str[MAX_PATH]; - OPENFILENAMEA ofn = {0}; - char filter[512]; - - GetDlgItemTextA(hwndDlg,IDC_FILENAME,str,SIZEOF(str)); - ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; - ofn.hwndOwner = hwndDlg; - ofn.hInstance = NULL; - CallService(MS_UTILS_GETBITMAPFILTERSTRINGS,SIZEOF(filter),(LPARAM)filter); - ofn.lpstrFilter = filter; - ofn.lpstrFile = str; - ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - ofn.nMaxFile = SIZEOF(str); - ofn.nMaxFileTitle = MAX_PATH; - ofn.lpstrDefExt = "bmp"; - if (!GetOpenFileNameA(&ofn)) break; - SetDlgItemTextA(hwndDlg,IDC_FILENAME,str); - } - else if (LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) != EN_CHANGE) break; - if (LOWORD(wParam) == IDC_BITMAP) SendMessage(hwndDlg,WM_USER+10,0,0); - if (LOWORD(wParam) == IDC_FILENAME && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - - case WM_NOTIFY: - switch(((LPNMHDR)lParam)->idFrom) { - case 0: - switch (((LPNMHDR)lParam)->code) { - case PSN_APPLY: - DBWriteContactSettingByte(NULL,"StatusBar","UseBitmap",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - { - COLORREF col; - col = SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_GETCOLOUR,0,0); - if (col == CLCDEFAULT_BKCOLOUR) DBDeleteContactSetting(NULL,"StatusBar","BkColour"); - else DBWriteContactSettingDword(NULL,"StatusBar","BkColour",col); - col = SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_GETCOLOUR,0,0); - if (col == CLCDEFAULT_SELBKCOLOUR) DBDeleteContactSetting(NULL,"StatusBar","SelBkColour"); - else DBWriteContactSettingDword(NULL,"StatusBar","SelBkColour",col); - - char str[MAX_PATH],strrel[MAX_PATH]; - GetDlgItemTextA(hwndDlg,IDC_FILENAME,str,SIZEOF(str)); - if (ServiceExists(MS_UTILS_PATHTORELATIVE)) { - if (CallService(MS_UTILS_PATHTORELATIVE, (WPARAM)str, (LPARAM)strrel)) - DBWriteContactSettingString(NULL,"StatusBar","BkBitmap",strrel); - else DBWriteContactSettingString(NULL,"StatusBar","BkBitmap",str); - } - else DBWriteContactSettingString(NULL,"StatusBar","BkBitmap",str); - - WORD flags = 0; - if (IsDlgButtonChecked(hwndDlg,IDC_STRETCHH)) flags |= CLB_STRETCHH; - if (IsDlgButtonChecked(hwndDlg,IDC_STRETCHV)) flags |= CLB_STRETCHV; - if (IsDlgButtonChecked(hwndDlg,IDC_TILEH)) flags |= CLBF_TILEH; - if (IsDlgButtonChecked(hwndDlg,IDC_TILEV)) flags |= CLBF_TILEV; - if (IsDlgButtonChecked(hwndDlg,IDC_SCROLL)) flags |= CLBF_SCROLL; - if (IsDlgButtonChecked(hwndDlg,IDC_PROPORTIONAL)) flags |= CLBF_PROPORTIONAL; - if (IsDlgButtonChecked(hwndDlg,IDC_TILEVROWH)) flags |= CLBF_TILEVTOROWHEIGHT; - - DBWriteContactSettingWord(NULL,"StatusBar","BkBmpUse",flags); - } - - pcli->pfnClcOptionsChanged(); - OnStatusBarBackgroundChange(); - return TRUE; - } - break; - } - break; - } - return FALSE; -} - -static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg,IDC_BITMAP,DBGetContactSettingByte(NULL,"CLC","UseBitmap",CLCDEFAULT_USEBITMAP)?BST_CHECKED:BST_UNCHECKED); - SendMessage(hwndDlg,WM_USER+10,0,0); - SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETDEFAULTCOLOUR,0,CLCDEFAULT_BKCOLOUR); - SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"CLC","BkColour",CLCDEFAULT_BKCOLOUR)); - SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETDEFAULTCOLOUR,0,CLCDEFAULT_SELBKCOLOUR); - SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"CLC","SelBkColour",CLCDEFAULT_SELBKCOLOUR)); - { DBVARIANT dbv; - if (!DBGetContactSettingString(NULL,"CLC","BkBitmap",&dbv)) { - SetDlgItemTextA(hwndDlg,IDC_FILENAME,dbv.pszVal); - if (ServiceExists(MS_UTILS_PATHTOABSOLUTE)) { - char szPath[MAX_PATH]; - - if (CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)dbv.pszVal, (LPARAM)szPath)) - SetDlgItemTextA(hwndDlg,IDC_FILENAME,szPath); - } - else mir_free(dbv.pszVal); - } - } - - { WORD bmpUse = DBGetContactSettingWord(NULL,"CLC","BkBmpUse",CLCDEFAULT_BKBMPUSE); - CheckDlgButton(hwndDlg,IDC_STRETCHH,bmpUse&CLB_STRETCHH?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_STRETCHV,bmpUse&CLB_STRETCHV?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_TILEH,bmpUse&CLBF_TILEH?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_TILEV,bmpUse&CLBF_TILEV?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_SCROLL,bmpUse&CLBF_SCROLL?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_PROPORTIONAL,bmpUse&CLBF_PROPORTIONAL?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_TILEVROWH,bmpUse&CLBF_TILEVTOROWHEIGHT?BST_CHECKED:BST_UNCHECKED); - - } - { HRESULT (STDAPICALLTYPE *MySHAutoComplete)(HWND,DWORD); - MySHAutoComplete = (HRESULT (STDAPICALLTYPE*)(HWND,DWORD))GetProcAddress(GetModuleHandleA("shlwapi"),"SHAutoComplete"); - if (MySHAutoComplete) MySHAutoComplete(GetDlgItem(hwndDlg,IDC_FILENAME),1); - } - return TRUE; - case WM_USER+10: - EnableWindow(GetDlgItem(hwndDlg,IDC_FILENAME),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - EnableWindow(GetDlgItem(hwndDlg,IDC_BROWSE),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - EnableWindow(GetDlgItem(hwndDlg,IDC_STRETCHH),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - EnableWindow(GetDlgItem(hwndDlg,IDC_STRETCHV),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - EnableWindow(GetDlgItem(hwndDlg,IDC_TILEH),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - EnableWindow(GetDlgItem(hwndDlg,IDC_TILEV),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - EnableWindow(GetDlgItem(hwndDlg,IDC_SCROLL),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - EnableWindow(GetDlgItem(hwndDlg,IDC_PROPORTIONAL),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - EnableWindow(GetDlgItem(hwndDlg,IDC_TILEVROWH),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - break; - case WM_COMMAND: - if (LOWORD(wParam) == IDC_BROWSE) { - char str[MAX_PATH]; - OPENFILENAMEA ofn = {0}; - char filter[512]; - - GetDlgItemTextA(hwndDlg,IDC_FILENAME,str,SIZEOF(str)); - ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; - ofn.hwndOwner = hwndDlg; - ofn.hInstance = NULL; - CallService(MS_UTILS_GETBITMAPFILTERSTRINGS,SIZEOF(filter),(LPARAM)filter); - ofn.lpstrFilter = filter; - ofn.lpstrFile = str; - ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - ofn.nMaxFile = SIZEOF(str); - ofn.nMaxFileTitle = MAX_PATH; - ofn.lpstrDefExt = "bmp"; - if (!GetOpenFileNameA(&ofn)) break; - SetDlgItemTextA(hwndDlg,IDC_FILENAME,str); - } - else if (LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) != EN_CHANGE) break; - if (LOWORD(wParam) == IDC_BITMAP) SendMessage(hwndDlg,WM_USER+10,0,0); - if (LOWORD(wParam) == IDC_FILENAME && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - case WM_NOTIFY: - switch(((LPNMHDR)lParam)->idFrom) { - case 0: - switch (((LPNMHDR)lParam)->code) { - case PSN_APPLY: - DBWriteContactSettingByte(NULL,"CLC","UseBitmap",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); - { COLORREF col; - col = SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_GETCOLOUR,0,0); - if (col == CLCDEFAULT_BKCOLOUR) DBDeleteContactSetting(NULL,"CLC","BkColour"); - else DBWriteContactSettingDword(NULL,"CLC","BkColour",col); - col = SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_GETCOLOUR,0,0); - if (col == CLCDEFAULT_SELBKCOLOUR) DBDeleteContactSetting(NULL,"CLC","SelBkColour"); - else DBWriteContactSettingDword(NULL,"CLC","SelBkColour",col); - } - { - char str[MAX_PATH],strrel[MAX_PATH]; - GetDlgItemTextA(hwndDlg,IDC_FILENAME,str,SIZEOF(str)); - if (ServiceExists(MS_UTILS_PATHTORELATIVE)) { - if (CallService(MS_UTILS_PATHTORELATIVE, (WPARAM)str, (LPARAM)strrel)) - DBWriteContactSettingString(NULL,"CLC","BkBitmap",strrel); - else DBWriteContactSettingString(NULL,"CLC","BkBitmap",str); - } - else DBWriteContactSettingString(NULL,"CLC","BkBitmap",str); - } - { WORD flags = 0; - if (IsDlgButtonChecked(hwndDlg,IDC_STRETCHH)) flags |= CLB_STRETCHH; - if (IsDlgButtonChecked(hwndDlg,IDC_STRETCHV)) flags |= CLB_STRETCHV; - if (IsDlgButtonChecked(hwndDlg,IDC_TILEH)) flags |= CLBF_TILEH; - if (IsDlgButtonChecked(hwndDlg,IDC_TILEV)) flags |= CLBF_TILEV; - if (IsDlgButtonChecked(hwndDlg,IDC_SCROLL)) flags |= CLBF_SCROLL; - if (IsDlgButtonChecked(hwndDlg,IDC_PROPORTIONAL)) flags |= CLBF_PROPORTIONAL; - if (IsDlgButtonChecked(hwndDlg,IDC_TILEVROWH)) flags |= CLBF_TILEVTOROWHEIGHT; - - DBWriteContactSettingWord(NULL,"CLC","BkBmpUse",flags); - } - - pcli->pfnClcOptionsChanged(); - return TRUE; - } - break; - } - break; - } - return FALSE; -} - diff --git a/plugins/Clist_mw/clcpaint.cpp b/plugins/Clist_mw/clcpaint.cpp deleted file mode 100644 index b4fc20850f..0000000000 --- a/plugins/Clist_mw/clcpaint.cpp +++ /dev/null @@ -1,688 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 "commonheaders.h" -#include "m_clc.h" -#include "clc.h" - -extern HIMAGELIST himlCListClc; -static BYTE divide3[765] = {255}; -int MetaIgnoreEmptyExtra; -ExternDrawer SED; - -static void ChangeToFont(HDC hdc,struct ClcData *dat,int id,int *fontHeight) -{ - SelectObject(hdc,dat->fontInfo[id].hFont); - SetTextColor(hdc,dat->fontInfo[id].colour); - if (fontHeight) *fontHeight = dat->fontInfo[id].fontHeight; -} - -static void __inline SetHotTrackColour(HDC hdc,struct ClcData *dat) -{ - if (dat->gammaCorrection) { - COLORREF oldCol,newCol; - int oldLum,newLum; - - oldCol = GetTextColor(hdc); - oldLum = (GetRValue(oldCol)*30+GetGValue(oldCol)*59+GetBValue(oldCol)*11)/100; - newLum = (GetRValue(dat->hotTextColour)*30+GetGValue(dat->hotTextColour)*59+GetBValue(dat->hotTextColour)*11)/100; - if (newLum == 0) { - SetTextColor(hdc,dat->hotTextColour); - return; - } - if (newLum>=oldLum+20) { - oldLum += 20; - newCol = RGB(GetRValue(dat->hotTextColour)*oldLum/newLum,GetGValue(dat->hotTextColour)*oldLum/newLum,GetBValue(dat->hotTextColour)*oldLum/newLum); - } - else if (newLum<=oldLum) { - int r,g,b; - r = GetRValue(dat->hotTextColour)*oldLum/newLum; - g = GetGValue(dat->hotTextColour)*oldLum/newLum; - b = GetBValue(dat->hotTextColour)*oldLum/newLum; - if (r>255) { - g += (r-255)*3/7; - b += (r-255)*3/7; - r = 255; - } - if (g>255) { - r += (g-255)*59/41; - if (r>255) r = 255; - b += (g-255)*59/41; - g = 255; - } - if (b>255) { - r += (b-255)*11/89; - if (r>255) r = 255; - g += (b-255)*11/89; - if (g>255) g = 255; - b = 255; - } - newCol = RGB(r,g,b); - } - else newCol = dat->hotTextColour; - SetTextColor(hdc,newCol); - } - else - SetTextColor(hdc,dat->hotTextColour); -} - -static int GetStatusOnlineness(int status) -{ - switch(status) { - case ID_STATUS_FREECHAT: return 110; - case ID_STATUS_ONLINE: return 100; - case ID_STATUS_OCCUPIED: return 60; - case ID_STATUS_ONTHEPHONE: return 50; - case ID_STATUS_DND: return 40; - case ID_STATUS_AWAY: return 30; - case ID_STATUS_OUTTOLUNCH: return 20; - case ID_STATUS_NA: return 10; - case ID_STATUS_INVISIBLE: return 5; - } - return 0; -} - -static int GetGeneralisedStatus(void) -{ - int i,status,thisStatus,statusOnlineness,thisOnlineness; - - status = ID_STATUS_OFFLINE; - statusOnlineness = 0; - - for (i = 0;ihClcProtoCount;i++) { - thisStatus = pcli->clcProto[i].dwStatus; - if (thisStatus == ID_STATUS_INVISIBLE) - return ID_STATUS_INVISIBLE; - - thisOnlineness = GetStatusOnlineness(thisStatus); - if (thisOnlineness > statusOnlineness) { - status = thisStatus; - statusOnlineness = thisOnlineness; - } - } - return status; -} - -static int GetRealStatus(struct ClcContact * contact, int status) -{ - int i; - char *szProto = contact->proto; - if (!szProto) return status; - for (i = 0;ihClcProtoCount;i++) { - if (!lstrcmpA(pcli->clcProto[i].szProto,szProto)) { - return pcli->clcProto[i].dwStatus; - } - } - return status; -} - -static HMODULE themeAPIHandle = NULL; // handle to uxtheme.dll -static HANDLE (WINAPI *MyOpenThemeData)(HWND,LPCWSTR); -static HRESULT (WINAPI *MyCloseThemeData)(HANDLE); -static HRESULT (WINAPI *MyDrawThemeBackground)(HANDLE,HDC,int,int,const RECT *,const RECT *); - -#define MGPROC(x) GetProcAddress(themeAPIHandle,x) -void InternalPaintClc(HWND hwnd,struct ClcData *dat,HDC hdc,RECT *rcPaint) -{ - HDC hdcMem; - HBITMAP oldbmp; - HBITMAP oldbm; - HFONT oldfont; - RECT clRect; - int y,indent,index,fontHeight, subindex, subident; - struct ClcContact *Drawing; - struct ClcGroup *group; - HBITMAP hBmpOsb; - DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE); - int status = GetGeneralisedStatus(); - int grey = 0,groupCountsFontTopShift; - HBRUSH hBrushAlternateGrey = NULL; - POINT pt; - RECT testrc; - - // yes I know about GetSysColorBrush() - COLORREF tmpbkcolour = style&CLS_CONTACTLIST ? ( /*dat->useWindowsColours ? GetSysColor(COLOR_3DFACE) :*/ dat->bkColour ) : dat->bkColour; - - if (dat->greyoutFlags & pcli->pfnClcStatusToPf2(status) || style&WS_DISABLED) grey = 1; - else if (GetFocus() != hwnd && dat->greyoutFlags&GREYF_UNFOCUS) grey = 1; - GetClientRect(hwnd,&clRect); - - if (rcPaint == NULL) rcPaint = &clRect; - //rcPaint = &clRect; - - if (IsRectEmpty(rcPaint)) return; - GetCursorPos(&pt); - ScreenToClient(hwnd,&pt); - - - y = -dat->yScroll; - hdcMem = CreateCompatibleDC(hdc); - hBmpOsb = CreateBitmap(clRect.right,clRect.bottom,1,GetDeviceCaps(hdc,BITSPIXEL),NULL); - oldbmp = (HBITMAP)SelectObject(hdcMem,hBmpOsb); - { - oldfont = (HFONT)SelectObject(hdcMem,dat->fontInfo[FONTID_GROUPS].hFont); - - TEXTMETRIC tm; - GetTextMetrics(hdcMem,&tm); - groupCountsFontTopShift = tm.tmAscent; - SelectObject(hdcMem,dat->fontInfo[FONTID_GROUPCOUNTS].hFont); - GetTextMetrics(hdcMem,&tm); - groupCountsFontTopShift -= tm.tmAscent; - SelectObject(hdcMem,oldfont); - } - - if (style&CLS_GREYALTERNATE) - hBrushAlternateGrey = CreateSolidBrush(GetNearestColor(hdcMem,RGB(GetRValue(tmpbkcolour)-10,GetGValue(tmpbkcolour)-10,GetBValue(tmpbkcolour)-10))); - - ChangeToFont(hdcMem,dat,FONTID_CONTACTS,&fontHeight); - SetBkMode(hdcMem,TRANSPARENT); - - HBRUSH hBrush,hoBrush; - - hBrush = CreateSolidBrush(tmpbkcolour); - hoBrush = (HBRUSH)SelectObject(hdcMem,hBrush); - FillRect(hdcMem,rcPaint,hBrush); - SelectObject(hdcMem,hoBrush); - DeleteObject(hBrush); - if (dat->hBmpBackground) { - BITMAP bmp; - HDC hdcBmp; - int x,y; - int maxx,maxy; - int destw,desth; - - // XXX: Halftone isnt supported on 9x, however the scretch problems dont happen on 98. - SetStretchBltMode(hdcMem, HALFTONE); - - GetObject(dat->hBmpBackground,sizeof(bmp),&bmp); - hdcBmp = CreateCompatibleDC(hdcMem); - oldbm = (HBITMAP)SelectObject(hdcBmp,dat->hBmpBackground); - y = dat->backgroundBmpUse&CLBF_SCROLL?-dat->yScroll:0; - maxx = dat->backgroundBmpUse&CLBF_TILEH?clRect.right:1; - maxy = dat->backgroundBmpUse&CLBF_TILEV?maxy = rcPaint->bottom:y+1; - switch(dat->backgroundBmpUse&CLBM_TYPE) { - case CLB_STRETCH: - if (dat->backgroundBmpUse&CLBF_PROPORTIONAL) { - if (clRect.right*bmp.bmHeightbackgroundBmpUse&CLBF_PROPORTIONAL) { - destw = clRect.right; - desth = destw*bmp.bmHeight/bmp.bmWidth; - } - else { - destw = clRect.right; - desth = bmp.bmHeight; - if (dat->backgroundBmpUse&CLBF_TILEVTOROWHEIGHT) - desth = dat->rowHeight; - } - break; - - case CLB_STRETCHV: - if (dat->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; - if (dat->backgroundBmpUse&CLBF_TILEVTOROWHEIGHT) - desth = dat->rowHeight; - break; - } - - for (;ytop-desth) continue; - for (x = 0;xlist; - group->scanIndex = 0; - indent = 0; - subindex = -1; - for (index = 0;ybottom;) { - if (subindex == -1) - if (group->scanIndex == group->cl.count) { - group = group->parent; - indent--; - if (group == NULL) break; - group->scanIndex++; - continue; - } - - if (y>rcPaint->top-dat->rowHeight ) { - int iImage = -1; - int selected; - int hottrack; - SIZE textSize,countsSize,spaceSize; - int width,checkboxWidth; - char *szCounts; - - if (subindex == -1) { - Drawing = group->cl.items[group->scanIndex]; - subident = 0; - } - else { - Drawing = &(group->cl.items[group->scanIndex]->subcontacts[subindex]); - subident = dat->rowHeight/2; - } - //alternating grey - - selected = index == dat->selection && (dat->showSelAlways || dat->exStyle&CLS_EX_SHOWSELALWAYS || GetFocus() == hwnd) && Drawing->type != CLCIT_DIVIDER; - hottrack = dat->exStyle&CLS_EX_TRACKSELECT && Drawing->type != CLCIT_DIVIDER && dat->iHotTrack == index; - - if (style&CLS_GREYALTERNATE && index&1) { - RECT rc; - rc.top = y; rc.bottom = rc.top+dat->rowHeight; - rc.left = 0; rc.right = clRect.right; - FillRect(hdcMem,&rc,hBrushAlternateGrey); - } - - //setup - if (Drawing->type == CLCIT_GROUP) { - if (Drawing->group->expanded) - ChangeToFont(hdcMem,dat,FONTID_GROUPS,&fontHeight); - else - ChangeToFont(hdcMem,dat,FONTID_GROUPSCLOSED,&fontHeight); - } - else if (Drawing->type == CLCIT_INFO) { - if (Drawing->flags&CLCIIF_GROUPFONT) ChangeToFont(hdcMem,dat,FONTID_GROUPS,&fontHeight); - else ChangeToFont(hdcMem,dat,FONTID_CONTACTS,&fontHeight); - } - else if (Drawing->type == CLCIT_DIVIDER) - ChangeToFont(hdcMem,dat,FONTID_DIVIDERS,&fontHeight); - else if (Drawing->type == CLCIT_CONTACT && (Drawing->flags&CONTACTF_NOTONLIST) && (!Drawing->isSubcontact)) - ChangeToFont(hdcMem,dat,FONTID_NOTONLIST,&fontHeight); - else if ( Drawing->type == CLCIT_CONTACT && - ( - (Drawing->flags&CONTACTF_INVISTO && (!Drawing->isSubcontact) && GetRealStatus(group->cl.items[group->scanIndex], status) != ID_STATUS_INVISIBLE ) - || - (Drawing->flags&CONTACTF_VISTO && (!Drawing->isSubcontact) && GetRealStatus(group->cl.items[group->scanIndex], status) == ID_STATUS_INVISIBLE) - ) - ) - { - // the contact is in the always visible list and the proto is invisible - // the contact is in the always invisible and the proto is in any other mode - ChangeToFont(hdcMem,dat, Drawing->flags&CONTACTF_ONLINE ? FONTID_INVIS:FONTID_OFFINVIS ,&fontHeight); - } - else if (Drawing->type == CLCIT_CONTACT && (!(Drawing->flags&CONTACTF_ONLINE) && (!Drawing->isSubcontact))) - ChangeToFont(hdcMem,dat,FONTID_OFFLINE,&fontHeight); - else - ChangeToFont(hdcMem,dat,FONTID_CONTACTS,&fontHeight); - GetTextExtentPoint32(hdcMem,Drawing->szText,lstrlen(Drawing->szText),&textSize); - width = textSize.cx; - if (Drawing->type == CLCIT_GROUP) { - szCounts = pcli->pfnGetGroupCountsText(dat,group->cl.items[group->scanIndex]); - if (szCounts[0]) { - GetTextExtentPoint32A(hdcMem," ",1,&spaceSize); - ChangeToFont(hdcMem,dat,FONTID_GROUPCOUNTS,&fontHeight); - GetTextExtentPoint32A(hdcMem,szCounts,lstrlenA(szCounts),&countsSize); - width += spaceSize.cx+countsSize.cx; - } - } - - if ((style&CLS_CHECKBOXES && Drawing->type == CLCIT_CONTACT) || - (style&CLS_GROUPCHECKBOXES && Drawing->type == CLCIT_GROUP) || - (Drawing->type == CLCIT_INFO && Drawing->flags&CLCIIF_CHECKBOX)) - checkboxWidth = dat->checkboxSize+2; - else checkboxWidth = 0; - - //background - if (selected) { - // default value - paint on text - int x=dat->leftMargin+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace-2+subident; - ImageList_DrawEx(dat->himlHighlight,0,hdcMem,x,y,min(width+5,clRect.right-x),dat->rowHeight,CLR_NONE,CLR_NONE,dat->exStyle&CLS_EX_NOTRANSLUCENTSEL?ILD_NORMAL:ILD_BLEND25); - SetTextColor(hdcMem,dat->selTextColour); - } - else if (hottrack) - SetHotTrackColour(hdcMem,dat); - - //checkboxes - if (checkboxWidth && (subindex == -1 ||1)) { - RECT rc; - HANDLE hTheme = NULL; - - // THEME - if (IsWinVerXPPlus()) { - if (!themeAPIHandle) { - themeAPIHandle = GetModuleHandleA("uxtheme"); - if (themeAPIHandle) { - MyOpenThemeData = (HANDLE (WINAPI *)(HWND,LPCWSTR))MGPROC("OpenThemeData"); - MyCloseThemeData = (HRESULT (WINAPI *)(HANDLE))MGPROC("CloseThemeData"); - MyDrawThemeBackground = (HRESULT (WINAPI *)(HANDLE,HDC,int,int,const RECT *,const RECT *))MGPROC("DrawThemeBackground"); - } - } - // Make sure all of these methods are valid (i would hope either all or none work) - if (MyOpenThemeData - &&MyCloseThemeData - &&MyDrawThemeBackground) { - hTheme = MyOpenThemeData(hwnd,L"BUTTON"); - } - } - rc.left = dat->leftMargin+indent*dat->groupIndent+subident; - rc.right = rc.left+dat->checkboxSize; - rc.top = y+((dat->rowHeight-dat->checkboxSize)>>1); - rc.bottom = rc.top+dat->checkboxSize; - if (hTheme) { - MyDrawThemeBackground(hTheme, hdcMem, BP_CHECKBOX, Drawing->flags&CONTACTF_CHECKED?(hottrack?CBS_CHECKEDHOT:CBS_CHECKEDNORMAL):(hottrack?CBS_UNCHECKEDHOT:CBS_UNCHECKEDNORMAL), &rc, &rc); - } - else DrawFrameControl(hdcMem,&rc,DFC_BUTTON,DFCS_BUTTONCHECK|DFCS_FLAT|(Drawing->flags&CONTACTF_CHECKED?DFCS_CHECKED:0)|(hottrack?DFCS_HOT:0)); - if (hTheme&&MyCloseThemeData) { - MyCloseThemeData(hTheme); - hTheme = NULL; - } - } - - //icon - if (Drawing->type == CLCIT_GROUP) - iImage = Drawing->group->expanded?IMAGE_GROUPOPEN:IMAGE_GROUPSHUT; - else if (Drawing->type == CLCIT_CONTACT) - iImage = Drawing->iImage; - if (iImage != -1) { - /*COLORREF colourFg = dat->selBkColour; - int mode = ILD_NORMAL; - if (selected) mode = ILD_SELECTED; - else if (hottrack) {mode = ILD_FOCUS; colourFg = dat->hotTextColour;} - else if (Drawing->type == CLCIT_CONTACT && Drawing->flags&CONTACTF_NOTONLIST) {colourFg = dat->fontInfo[FONTID_NOTONLIST].colour; mode = ILD_BLEND50;} - ImageList_DrawEx(himlCListClc,iImage,hdcMem,dat->leftMargin+indent*dat->groupIndent+checkboxWidth,y+((dat->rowHeight-16)>>1),0,0,CLR_NONE,colourFg,mode); - */ - COLORREF colourFg = dat->selBkColour; - int mode = ILD_NORMAL; - if (hottrack) {colourFg = dat->hotTextColour;} - else if (Drawing->type == CLCIT_CONTACT && Drawing->flags&CONTACTF_NOTONLIST && (!Drawing->isSubcontact)) {colourFg = dat->fontInfo[FONTID_NOTONLIST].colour; mode = ILD_BLEND50;} - if (Drawing->type == CLCIT_CONTACT && dat->showIdle && (Drawing->flags&CONTACTF_IDLE)&& (!Drawing->isSubcontact) && GetRealStatus(group->cl.items[group->scanIndex],ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) - mode = ILD_SELECTED; - ImageList_DrawEx(himlCListClc,iImage,hdcMem,dat->leftMargin+subident+indent*dat->groupIndent+checkboxWidth,y+((dat->rowHeight-16)>>1),0,0,CLR_NONE,colourFg,mode); - } - - //text - if (Drawing->type == CLCIT_DIVIDER) { - RECT rc; - rc.top = y+(dat->rowHeight>>1); rc.bottom = rc.top+2; - rc.left = dat->leftMargin+indent*dat->groupIndent; - rc.right = rc.left+((clRect.right-rc.left-textSize.cx)>>1)-3; - DrawEdge(hdcMem,&rc,BDR_SUNKENOUTER,BF_RECT); - TextOut(hdcMem,rc.right+3,y+((dat->rowHeight-fontHeight)>>1),Drawing->szText,lstrlen(Drawing->szText)); - rc.left = rc.right+6+textSize.cx; - rc.right = clRect.right; - DrawEdge(hdcMem,&rc,BDR_SUNKENOUTER,BF_RECT); - } - else if (Drawing->type == CLCIT_GROUP) { - RECT rc; - if (szCounts[0]) { - struct ClcGroup *clcg; - - clcg = (struct ClcGroup *)Drawing; - - fontHeight = dat->fontInfo[FONTID_GROUPS].fontHeight; - - rc.left = dat->leftMargin+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace; - rc.right = min(clRect.right-countsSize.cx,rc.left+textSize.cx+spaceSize.cx); - rc.top = y+((dat->rowHeight-fontHeight)>>1); - rc.bottom = rc.top+textSize.cy; - if (rc.rightgroup->expanded) - { - ChangeToFont(hdcMem,dat,FONTID_GROUPS,&fontHeight); - } - else - { - ChangeToFont(hdcMem,dat,FONTID_GROUPSCLOSED,&fontHeight); - } - - if (selected) - SetTextColor(hdcMem,dat->selTextColour); - else if (hottrack) - SetHotTrackColour(hdcMem,dat); - rc.right--; - ExtTextOut(hdcMem,rc.left,rc.top,ETO_CLIPPED,&rc,Drawing->szText,lstrlen(Drawing->szText),NULL); - } - else TextOut(hdcMem,dat->leftMargin+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace,y+((dat->rowHeight-fontHeight)>>1),Drawing->szText,lstrlen(Drawing->szText)); - if (dat->exStyle&CLS_EX_LINEWITHGROUPS) { - //calc if extra icons present - int enabledextraicons = 0; - for (iImage = 0;iImageextraColumnsCount;iImage++) { - if (Drawing->iExtraImage[iImage] == 0xFF) continue; - enabledextraicons++; - } - rc.top = y+(dat->rowHeight>>1); rc.bottom = rc.top+2; - rc.left = dat->leftMargin+subident+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace+width+3; - rc.right = clRect.right-1-dat->extraColumnSpacing*enabledextraicons; - if (rc.right-rc.left>1) DrawEdge(hdcMem,&rc,BDR_SUNKENOUTER,BF_RECT); - } - } - else { - RECT rc; - rc.left = dat->leftMargin+subident+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace; - rc.top = y+((dat->rowHeight-fontHeight)>>1); - rc.bottom = rc.top+dat->rowHeight; - rc.right = clRect.right; - if (Drawing->type = CLCIT_CONTACT) - if (hottrack) - ChangeToFont(hdcMem,dat,FONTID_CONTACTSHOVER,&fontHeight); - - DrawText(hdcMem,Drawing->szText,lstrlen(Drawing->szText),&rc,DT_END_ELLIPSIS); - - } - - if (selected) { - if (Drawing->type != CLCIT_DIVIDER) { - SetTextColor(hdcMem,dat->quickSearchColour); - TextOut(hdcMem,dat->leftMargin+subident+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace,y+((dat->rowHeight-fontHeight)>>1),Drawing->szText,lstrlen(dat->szQuickSearch)); - } - } - - if (dat->style&CLS_SHOWSTATUSMESSAGES) - { - // status message - if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->flags & CONTACTF_STATUSMSG) { - TCHAR * szText = group->cl.items[group->scanIndex]->szStatusMsg; - RECT rc; - rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace; - rc.top = y+dat->rowHeight+((dat->rowHeight-fontHeight)>>1); - rc.right = (clRect.right - clRect.left); - rc.bottom = rc.top+dat->rowHeight; - ChangeToFont(hdcMem,dat,FONTID_STATUSMSG,&fontHeight); - //ExtTextOut(hdcMem,rc.left,rc.top,ETO_CLIPPED,&rc,szText,lstrlen(szText),NULL); - DrawText(hdcMem, szText, lstrlen(szText), &rc, DT_SINGLELINE | DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS); - } - } - - if (!Drawing->isSubcontact || (DBGetContactSettingByte(NULL,"CLC","MetaHideExtra",0) == 0)) { - - //extra icons - if ( !(style & CLS_EX_MULTICOLUMNALIGNLEFT)) { - int c = dat->extraColumnsCount; - for (iImage = dat->extraColumnsCount-1;iImage>=0;iImage--) { - COLORREF colourFg = dat->selBkColour; - int mode = ILD_NORMAL; - - if (Drawing->iExtraImage[iImage] == 0xFF) continue; - if (selected) mode = ILD_SELECTED; - else if (hottrack) {mode = ILD_FOCUS; colourFg = dat->hotTextColour;} - else if (Drawing->type == CLCIT_CONTACT && Drawing->flags&CONTACTF_NOTONLIST) {colourFg = dat->fontInfo[FONTID_NOTONLIST].colour; mode = ILD_BLEND50;} - { - - } - if (dat->MetaIgnoreEmptyExtra) c--; else c = iImage; - - testrc.left = clRect.right-dat->extraColumnSpacing*(dat->extraColumnsCount-c); - testrc.top = (y+((dat->rowHeight-16)>>1)); - testrc.right = testrc.left+16; - testrc.bottom = testrc.top+16; - if (!PtInRect(&testrc,pt)) - mode = ILD_NORMAL; - - ImageList_DrawEx(dat->himlExtraColumns,Drawing->iExtraImage[iImage],hdcMem,clRect.right-dat->extraColumnSpacing*(dat->extraColumnsCount-c),y+((dat->rowHeight-16)>>1),0,0,CLR_NONE,colourFg,mode); - } - } - else { - int ic = 0; - for (iImage = 0;iImageextraColumnsCount;iImage++) { - COLORREF colourFg = dat->selBkColour; - int mode = ILD_NORMAL; - int x; - - if (Drawing->iExtraImage[iImage] == 0xFF) - continue; - - if (hottrack) { - mode = ILD_FOCUS; - colourFg = dat->hotTextColour; - } - else if (Drawing->type == CLCIT_CONTACT && (Drawing->flags & CONTACTF_NOTONLIST)) { - colourFg = dat->fontInfo[FONTID_NOTONLIST].colour; - mode = ILD_BLEND50; - } - - x = (dat->leftMargin+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace-2+width); - x += 16; - x = x+dat->extraColumnSpacing*(ic); - if (iImage == dat->extraColumnsCount-1) {x = clRect.right-18;} - ImageList_DrawEx(dat->himlExtraColumns,Drawing->iExtraImage[iImage],hdcMem, - x, - y+((dat->rowHeight-16)>>1),0,0,CLR_NONE,colourFg,mode); - - ic++; - } - } - } - } - index++; - y += dat->rowHeight; - - if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->flags & CONTACTF_STATUSMSG) { - y += dat->rowHeight; - index++; - } - - //increment by subcontacts - if (group->cl.items[group->scanIndex]->subcontacts != NULL && group->cl.items[group->scanIndex]->type != CLCIT_GROUP) - if (group->cl.items[group->scanIndex]->SubExpanded) - if (subindexcl.items[group->scanIndex]->SubAllocated-1) - subindex++; - else subindex = -1; - - if (subindex == -1) { - if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && group->cl.items[group->scanIndex]->group->expanded) { - group = group->cl.items[group->scanIndex]->group; - indent++; - group->scanIndex = 0; - subindex = -1; - continue; - } - group->scanIndex++; - } - } - if (dat->iInsertionMark != -1) { //insertion mark - HBRUSH hBrush,hoBrush; - POINT pts[8]; - HRGN hRgn; - - pts[0].x = dat->leftMargin; pts[0].y = dat->iInsertionMark*dat->rowHeight-dat->yScroll-4; - pts[1].x = pts[0].x+2; pts[1].y = pts[0].y+3; - pts[2].x = clRect.right-4; pts[2].y = pts[1].y; - pts[3].x = clRect.right-1; pts[3].y = pts[0].y-1; - pts[4].x = pts[3].x; pts[4].y = pts[0].y+7; - pts[5].x = pts[2].x+1; pts[5].y = pts[1].y+2; - pts[6].x = pts[1].x; pts[6].y = pts[5].y; - pts[7].x = pts[0].x; pts[7].y = pts[4].y; - hRgn = CreatePolygonRgn(pts,SIZEOF(pts),ALTERNATE); - hBrush = CreateSolidBrush(dat->fontInfo[FONTID_CONTACTS].colour); - hoBrush = (HBRUSH)SelectObject(hdcMem,hBrush); - FillRgn(hdcMem,hRgn,hBrush); - SelectObject(hdcMem,hoBrush); - DeleteObject(hBrush); - } - if (!grey) - BitBlt(hdc,rcPaint->left,rcPaint->top,rcPaint->right-rcPaint->left,rcPaint->bottom-rcPaint->top,hdcMem,rcPaint->left,rcPaint->top,SRCCOPY); - //DeleteDC(hdcMem); - if (hBrushAlternateGrey) DeleteObject(hBrushAlternateGrey); - if (grey) { - PBYTE bits; - BITMAPINFOHEADER bmih = {0}; - int i; - int greyRed,greyGreen,greyBlue; - COLORREF greyColour; - bmih.biBitCount = 32; - bmih.biSize = sizeof(bmih); - bmih.biCompression = BI_RGB; - bmih.biHeight = -clRect.bottom; - bmih.biPlanes = 1; - bmih.biWidth = clRect.right; - bits = (PBYTE)mir_alloc(4*bmih.biWidth*-bmih.biHeight); - GetDIBits(hdc,hBmpOsb,0,clRect.bottom,bits,(BITMAPINFO*)&bmih,DIB_RGB_COLORS); - greyColour = GetSysColor(COLOR_3DFACE); - greyRed = GetRValue(greyColour)*2; - greyGreen = GetGValue(greyColour)*2; - greyBlue = GetBValue(greyColour)*2; - if (divide3[0] == 255) { - for (i = 0; i < SIZEOF(divide3); i++) divide3[i] = (i+1)/3; - } - for (i = 4*clRect.right*clRect.bottom-4;i>=0;i -= 4) { - bits[i] = divide3[bits[i]+greyBlue]; - bits[i+1] = divide3[bits[i+1]+greyGreen]; - bits[i+2] = divide3[bits[i+2]+greyRed]; - } - SetDIBitsToDevice(hdc,0,0,clRect.right,clRect.bottom,0,0,0,clRect.bottom,bits,(BITMAPINFO*)&bmih,DIB_RGB_COLORS); - mir_free(bits); - } - SelectObject(hdcMem,oldfont); - SelectObject(hdcMem,oldbmp); - DeleteObject(hBmpOsb); - DeleteDC(hdcMem); -} - -void PaintClc(HWND hwnd,struct ClcData *dat,HDC hdc,RECT *rcPaint) -{ - if (SED.cbSize == sizeof(SED)&&SED.PaintClc != NULL) { - SED.PaintClc(hwnd,dat,hdc,rcPaint,pcli->hClcProtoCount,pcli->clcProto,himlCListClc); - return; - } - InternalPaintClc(hwnd,dat,hdc,rcPaint); -} diff --git a/plugins/Clist_mw/clcutils.cpp b/plugins/Clist_mw/clcutils.cpp deleted file mode 100644 index e9253b4082..0000000000 --- a/plugins/Clist_mw/clcutils.cpp +++ /dev/null @@ -1,289 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 "commonheaders.h" -#include "m_clc.h" -#include "clc.h" - -//loads of stuff that didn't really fit anywhere else - -int HitTest(HWND hwnd,struct ClcData *dat,int testx,int testy,struct ClcContact **contact,struct ClcGroup **group,DWORD *flags) -{ - struct ClcContact *hitcontact; - struct ClcGroup *hitgroup; - int hit,indent,width,i,cxSmIcon; - int checkboxWidth, subident,ic = 0; - SIZE textSize; - HDC hdc; - HFONT oldfont; - RECT clRect; - DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE); - - if (flags) *flags = 0; - GetClientRect(hwnd,&clRect); - if (testx<0 || testy<0 || testy>=clRect.bottom || testx>=clRect.right) { - if (flags) { - if (testx<0) *flags |= CLCHT_TOLEFT; - else if (testx>=clRect.right) *flags |= CLCHT_TORIGHT; - if (testy<0) *flags |= CLCHT_ABOVE; - else if (testy>=clRect.bottom) *flags |= CLCHT_BELOW; - } - return -1; - } - if (testxleftMargin) { - if (flags) *flags |= CLCHT_INLEFTMARGIN|CLCHT_NOWHERE; - return -1; - } - hit = GetRowByIndex(dat ,(testy+dat->yScroll)/dat->rowHeight,&hitcontact,&hitgroup); - if (hit == -1) { - if (flags) *flags |= CLCHT_NOWHERE|CLCHT_BELOWITEMS; - return -1; - } - if (contact) *contact = hitcontact; - if (group) *group = hitgroup; - ///////// - if (hitcontact->type == CLCIT_CONTACT && hitcontact->isSubcontact) - subident = dat->rowHeight/2; - else - subident = 0; - - for (indent = 0;hitgroup->parent;indent++,hitgroup = hitgroup->parent); - if (testxleftMargin+indent*dat->groupIndent+subident) { - if (flags) *flags |= CLCHT_ONITEMINDENT; - return hit; - } - checkboxWidth = 0; - if (style&CLS_CHECKBOXES && hitcontact->type == CLCIT_CONTACT) checkboxWidth = dat->checkboxSize+2; - if (style&CLS_GROUPCHECKBOXES && hitcontact->type == CLCIT_GROUP) checkboxWidth = dat->checkboxSize+2; - if (hitcontact->type == CLCIT_INFO && hitcontact->flags&CLCIIF_CHECKBOX) checkboxWidth = dat->checkboxSize+2; - if (testxleftMargin+indent*dat->groupIndent+checkboxWidth+subident) { - if (flags) *flags |= CLCHT_ONITEMCHECK; - return hit; - } - if (testxleftMargin+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace+subident) { - if (flags) *flags |= CLCHT_ONITEMICON; - return hit; - } - - hdc = GetDC(hwnd); - GetTextExtentPoint32(hdc,hitcontact->szText,lstrlen(hitcontact->szText),&textSize); - width = textSize.cx; - - cxSmIcon = GetSystemMetrics(SM_CXSMICON); - - for (i = 0;iextraColumnsCount;i++) { - int x; - if (hitcontact->iExtraImage[i] == 0xFF) continue; - - if ((style&CLS_EX_MULTICOLUMNALIGNLEFT)) - { - x = (dat->leftMargin+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace-2+width); - x += 16; - x = x+dat->extraColumnSpacing*(ic); - if (i == dat->extraColumnsCount-1) {x = clRect.right-18;} - }else - { - int ir; - if (dat->MetaIgnoreEmptyExtra) - { - int j; - ir = 0; - for (j = i;jextraColumnsCount;j++) - if (hitcontact->iExtraImage[j] != 0xFF) - ir++; - }else - ir = dat->extraColumnsCount-i; - - x = clRect.right-dat->extraColumnSpacing*ir; - } - ic++; - - if (testx>=x && - testxtype == CLCIT_GROUP) - oldfont = (HFONT)SelectObject(hdc,dat->fontInfo[FONTID_GROUPS].hFont); - else - oldfont = (HFONT)SelectObject(hdc,dat->fontInfo[FONTID_CONTACTS].hFont); - - GetTextExtentPoint32(hdc,hitcontact->szText,lstrlen(hitcontact->szText),&textSize); - width = textSize.cx; - if (hitcontact->type == CLCIT_GROUP) { - char *szCounts = pcli->pfnGetGroupCountsText(dat,hitcontact); - if (szCounts[0]) { - GetTextExtentPoint32A(hdc," ",1,&textSize); - width += textSize.cx; - SelectObject(hdc,dat->fontInfo[FONTID_GROUPCOUNTS].hFont); - GetTextExtentPoint32A(hdc,szCounts,lstrlenA(szCounts),&textSize); - width += textSize.cx; - } - } - SelectObject(hdc,oldfont); - ReleaseDC(hwnd,hdc); - if (testxleftMargin+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace+width+4+subident) { - if (flags) *flags |= CLCHT_ONITEMLABEL; - return hit; - } - if (flags) *flags |= CLCHT_NOWHERE; - return -1; -} - -void ScrollTo(HWND hwnd,struct ClcData *dat,int desty,int noSmooth) -{ - DWORD startTick,nowTick; - int oldy = dat->yScroll; - RECT clRect,rcInvalidate; - int maxy,previousy; - - if (dat->iHotTrack != -1 && dat->yScroll != desty) { - pcli->pfnInvalidateItem(hwnd,dat,dat->iHotTrack); - dat->iHotTrack = -1; - ReleaseCapture(); - } - GetClientRect(hwnd,&clRect); - rcInvalidate = clRect; - maxy = dat->rowHeight*GetGroupContentsCount(&dat->list,2)-clRect.bottom; - if (desty>maxy) desty = maxy; - if (desty<0) desty = 0; - if (abs(desty-dat->yScroll)<4) noSmooth = 1; - if (!noSmooth && dat->exStyle&CLS_EX_NOSMOOTHSCROLLING) noSmooth = 1; - previousy = dat->yScroll; - if (!noSmooth) { - startTick = GetTickCount(); - for (;;) { - nowTick = GetTickCount(); - if (nowTick>=startTick+dat->scrollTime) break; - dat->yScroll = oldy+(desty-oldy)*(int)(nowTick-startTick)/dat->scrollTime; - if (dat->backgroundBmpUse&CLBF_SCROLL || dat->hBmpBackground == NULL) - ScrollWindowEx(hwnd,0,previousy-dat->yScroll,NULL,NULL,NULL,NULL,SW_INVALIDATE); - else - InvalidateRect(hwnd,NULL,FALSE); - previousy = dat->yScroll; - SetScrollPos(hwnd,SB_VERT,dat->yScroll,TRUE); - UpdateWindow(hwnd); - } - } - dat->yScroll = desty; - if (dat->backgroundBmpUse&CLBF_SCROLL || dat->hBmpBackground == NULL) - ScrollWindowEx(hwnd,0,previousy-dat->yScroll,NULL,NULL,NULL,NULL,SW_INVALIDATE); - else - InvalidateRect(hwnd,NULL,FALSE); - SetScrollPos(hwnd,SB_VERT,dat->yScroll,TRUE); -} - -void RecalcScrollBar(HWND hwnd,struct ClcData *dat) -{ - SCROLLINFO si = {0}; - RECT clRect; - NMCLISTCONTROL nm; - boolean sbar = FALSE; - - GetClientRect(hwnd,&clRect); - - si.cbSize = sizeof(si); - si.fMask = SIF_ALL; - si.nMin = 0; - si.nMax = dat->rowHeight*GetGroupContentsCount(&dat->list,2)-1; - si.nPage = clRect.bottom; - si.nPos = dat->yScroll; - - nm.hdr.code = CLN_LISTSIZECHANGE; - nm.hdr.hwndFrom = hwnd; - nm.hdr.idFrom = GetDlgCtrlID(hwnd); - nm.pt.y = si.nMax; - SendMessage(GetParent(hwnd),WM_NOTIFY,0,(LPARAM)&nm); - - GetClientRect(hwnd,&clRect); - si.cbSize = sizeof(si); - si.fMask = SIF_ALL; - si.nMin = 0; - si.nMax = dat->rowHeight*GetGroupContentsCount(&dat->list,2)-1; - si.nPage = clRect.bottom; - si.nPos = dat->yScroll; - - sbar = (dat->noVScrollbar == 1||(int)si.nPage>si.nMax); - - ShowScrollBar(hwnd,SB_VERT,sbar? FALSE : TRUE); - if (!sbar) { - if ( GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_CONTACTLIST ) { - if ( dat->noVScrollbar == 0 ) SetScrollInfo(hwnd,SB_VERT,&si,TRUE); - else SetScrollInfo(hwnd,SB_VERT,&si,FALSE); - } - else SetScrollInfo(hwnd,SB_VERT,&si,TRUE); - } - ScrollTo(hwnd,dat,dat->yScroll,1); -} - -void CalcEipPosition( struct ClcData *dat, struct ClcContact *contact, struct ClcGroup *group, POINT *result) -{ - int indent; - for (indent = 0; group->parent; indent++, group = group->parent); - result->x = indent * dat->groupIndent + dat->iconXSpace - 2; - result->y = dat->selection * dat->rowHeight - dat->yScroll; - - if (contact->type == CLCIT_CONTACT && contact->isSubcontact) - result->x += dat->rowHeight/2; -} - -void GetDefaultFontSetting(int i,LOGFONT *lf,COLORREF *colour) -{ - SystemParametersInfo(SPI_GETICONTITLELOGFONT,sizeof(LOGFONT),lf,FALSE); - *colour = GetSysColor(COLOR_WINDOWTEXT); - switch(i) { - case FONTID_GROUPS: - lf->lfWeight = FW_BOLD; - break; - case FONTID_GROUPCOUNTS: - lf->lfHeight = (int)(lf->lfHeight*.75); - *colour = GetSysColor(COLOR_3DSHADOW); - break; - case FONTID_OFFINVIS: - case FONTID_INVIS: - lf->lfItalic = !lf->lfItalic; - break; - case FONTID_DIVIDERS: - lf->lfHeight = (int)(lf->lfHeight*.75); - break; - case FONTID_NOTONLIST: - *colour = GetSysColor(COLOR_3DSHADOW); - break; -} } - -extern void ( *saveLoadClcOptions )(HWND hwnd,struct ClcData *dat); - -void LoadClcOptions(HWND hwnd,struct ClcData *dat) -{ - int i; - - dat->style = GetWindowLongPtr(hwnd,GWL_STYLE); - dat->MetaIgnoreEmptyExtra = DBGetContactSettingByte(NULL,"CLC","MetaIgnoreEmptyExtra",1); - saveLoadClcOptions( hwnd, dat ); - - for (i = 0; i <= FONTID_MAX; i++) - if (dat->fontInfo[i].fontHeight > dat->rowHeight) - dat->rowHeight = dat->fontInfo[i].fontHeight; -} diff --git a/plugins/Clist_mw/clist.h b/plugins/Clist_mw/clist.h deleted file mode 100644 index 20c8a7ce80..0000000000 --- a/plugins/Clist_mw/clist.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 _CLIST_H_ -#define _CLIST_H_ - -void LoadContactTree(void); -int ExtIconFromStatusMode(HANDLE hContact, const char *szProto,int status); -HTREEITEM GetTreeItemByHContact(HANDLE hContact); -void TrayIconUpdateWithImageList(int iImage,const char *szNewTip,char *szPreferredProto); -void SortContacts(void); -void ChangeContactIcon(HANDLE hContact,int iIcon,int add); -int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status); - -struct displayNameCacheEntry : public ClcCacheEntryBase -{ - int noHiddenOffline; - - char *szProto; - boolean protoNotExists; - int status; - - int i; - int ApparentMode; - int NotOnList; - int IdleTS; - void *ClcContact; - BYTE IsExpanded; - boolean isUnknown; -}; - -typedef displayNameCacheEntry *pdisplayNameCacheEntry; - -pdisplayNameCacheEntry GetContactFullCacheEntry(HANDLE hContact); - -#endif \ No newline at end of file diff --git a/plugins/Clist_mw/clist_mw-translation.txt b/plugins/Clist_mw/clist_mw-translation.txt deleted file mode 100644 index 769c437319..0000000000 --- a/plugins/Clist_mw/clist_mw-translation.txt +++ /dev/null @@ -1,230 +0,0 @@ -; Common strings that belong to many files -;[&About] -;[&Delete Group] -;[&Find/Add Contacts...] -;[&Hide Offline Users] -;[&Hide Offline Users in here] -;[&Hide/Show] -;[&Main Menu] -;[&New Group] -;[&Options...] -;[&Rename Group] -;[&Status] -;[Contact List] -;[Disable &Groups] -;[E&xit] -;[Groups] -;[Hide &Empty Groups] -;[Hide &Offline Users out here] -;[Status Bar] -;[Window] - -; ../../plugins/Clist_mw/BkgrCfg.cpp -;[Backgrounds] -;[Customize] - -; ../../plugins/Clist_mw/CLUIFrames/cluiframes.cpp -;[&Align] -;[&Border] -;[&Bottom] -;[&Client] -;[&Collapsed] -;[&Down] -;[&Floating Mode] -;[&FrameTitle] -;[&Locked] -;[&Position] -;[&Show TitleBar] -;[&Top] -;[&Up] -;[&Visible] -;[Floating] -;[Frames] -;[Hide All Titlebars] -;[Lock Frame] -;[New Menu System not Found...] -;[Show All Frames] -;[Show All Titlebars] -;[Show TitleBar] -;[TitleBarFont] -;[Visible] - -; ../../plugins/Clist_mw/clcfonts.cpp -;[Background] -;[Contacts which are 'not on list'] -;[Dividers] -;[Group Closed] -;[Group member counts] -;[Hottrack Text] -;[Hover Contacts] -;[Offline contacts] -;[Offline contacts to whom you have a different visibility] -;[Online contacts to whom you have a different visibility] -;[Quicksearch Text] -;[Selected Text] -;[Standard contacts] -;[Status messages] - -; ../../plugins/Clist_mw/clcopts.cpp -;[List] -;[List Background] -;[List MetaContacts] -;[StatusBar Background] - -; ../../plugins/Clist_mw/clistopts.cpp -;[Global] - -; ../../plugins/Clist_mw/clistsettings.cpp -;[(Unknown Contact)] -;[_NoProtocol_] - -; ../../plugins/Clist_mw/clui.cpp -;[My Contacts] - -; ../../plugins/Clist_mw/groupmenu.cpp -;[&New SubGroup] - -; ../../plugins/Clist_mw/keyboard.cpp -;[Close Miranda] -;[Restore last status] - -; ../../plugins/Clist_mw/resource.rc -;[!!! Note: all client icons are made by Angeli-ka, and I have her permission to use them in clist_mw plugin.] -;[% of screen] -;[&Away\tCtrl+2] -;[&DND\tCtrl+5] -;[&Free for chat\tCtrl+6] -;[&Invisible\tCtrl+7] -;[&NA\tCtrl+3] -;[&New Subgroup] -;[&Offline\tCtrl+0] -;['Hide Offline' means to hide:] -;[Active opacity:] -;[Advanced #1] -;[Advanced #2] -;[Always on top] -;[Always show status in tooltip] -;[Are you sure you want to delete %s?] -;[Ask before deleting contacts] -;[Automatically resize window to height of list] -;[Avoid doubleclick expand] -;[Background colour:] -;[Cellular] -;[Contact List Background] -;[Contact List Extra Icons] -;[Contact List Sorting] -;[Cycle icons every] -;[Default] -;[Delete Contact] -;[Dim idle contacts] -;[Disable drag and drop of items] -;[Disable groups] -;[Disable icon blinking] -;[Disable rename of items by clicking twice] -;[Dont move offline user to bottom] -;[Draw a line alongside group names] -;[E-mail] -;[Easy move] -;[Enable drop shadow (restart required)] -;[Fade contact list in/out] -;[Gamma correction] -;[Grey out entire list when:] -;[Group] -;[Hide Miranda] -;[Hide all 'Extra icons' for subcontacts] -;[Hide contact list after it has been idle for] -;[Hide empty groups] -;[Hide from list only, in order to keep their history and ignore/visibility settings] -;[Hide group counts when there are none online] -;[Hide offline subcontacts.] -;[Hide offline users] -;[Hide vertical scrollbar] -;[Homepage] -;[Hot track items as mouse passes over] -;[If window is partially covered, bring to front instead of hiding] -;[Ignore Empty Extra icons places (arrange to right).] -;[Inactive opacity:] -;[Indent groups by:] -;[InsertSeparator] -;[Items] -;[Left margin:] -;[Make sections equal width] -;[Make selection highlight translucent] -;[MenuItems] -;[MenuObjects] -;[MetaContacts supporting] -;[Minimize to tray] -;[Name:] -;[No] -;[Nowhere] -;[Occ&upied\tCtrl+4] -;[On the &Phone\tCtrl+8] -;[On&line\tCtrl+1] -;[Only when statuses differ] -;[Out to &Lunch\tCtrl+9] -;[Pin to desktop] -;[Protocol Type] -;[Quicksearch in open groups only] -;[Right click opens Miranda menu] -;[Right click opens status menu] -;[Row height:] -;[Rows] -;[Scroll list smoothly] -;[Scroll with text] -;[Selection colour:] -;[Service:] -;[Set] -;[Settings] -;[Show] -;[Show bevel effect on panels] -;[Show counts of number of contacts in a group] -;[Show divider between online and offline contacts] -;[Show icons] -;[Show menu bar] -;[Show multiple icons] -;[Show protocol names] -;[Show selection even when list is not focused] -;[Show size grip] -;[Show status bar] -;[Show status text] -;[Show title bar] -;[Single click interface] -;[Size upwards] -;[Slider2] -;[Sort contacts by name] -;[Sort contacts by protocol] -;[Sort contacts by status] -;[Sort groups alphabetically] -;[Spin1] -;[Spin5] -;[Stretch proportionally] -;[Stretch to height] -;[Stretch to width] -;[System tray icon] -;[System tray icon when using multiple protocols] -;[This will erase all history and settings for this contact!] -;[Tile horizontally] -;[Tile vertically] -;[Tile vertically according to Row Height] -;[Time:] -;[Title bar text:] -;[Tool style main window] -;[Translucency options (Windows 2000/XP only)] -;[Transparent contact list] -;[Tray] -;[Tree2] -;[Use 'Meta' protocol icons for Metacontacts] -;[Use New Drawer for StatusBar] -;[Use Options->Ignore (expert mode) to unhide contacts.] -;[Use background bitmap] -;[Use connecting Icon] -;[Visual] -;[Warning!\r\nThis MenuObject not support user defined options.] -;[Yes] -;[icon when statuses differ] -;[maximum] -;[milliseconds] -;[ms, delay between icon blinking] -;[pixels] -;[seconds] -;[seconds, when statuses differ] diff --git a/plugins/Clist_mw/clist_mw_10.vcxproj b/plugins/Clist_mw/clist_mw_10.vcxproj index eccc444cc3..702317ff2a 100644 --- a/plugins/Clist_mw/clist_mw_10.vcxproj +++ b/plugins/Clist_mw/clist_mw_10.vcxproj @@ -82,7 +82,6 @@ commonheaders.h Level3 EditAndContinue - 4996;%(DisableSpecificWarnings) _DEBUG;%(PreprocessorDefinitions) @@ -111,7 +110,6 @@ Use commonheaders.h Level3 - 4996;%(DisableSpecificWarnings) _DEBUG;%(PreprocessorDefinitions) @@ -124,7 +122,6 @@ 0x6590000 false $(IntDir)$(TargetName).lib - MachineX64 Windows $(SolutionDir)\lib @@ -143,7 +140,6 @@ Use commonheaders.h Level3 - 4996;%(DisableSpecificWarnings) NDEBUG;%(PreprocessorDefinitions) @@ -176,7 +172,6 @@ Use commonheaders.h Level3 - 4996;%(DisableSpecificWarnings) NDEBUG;%(PreprocessorDefinitions) @@ -196,75 +191,51 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + Create - - - - - + + + + + ..\commonheaders.h - + ..\commonheaders.h - + ..\commonheaders.h - + ..\commonheaders.h - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/plugins/Clist_mw/clist_mw_10.vcxproj.filters b/plugins/Clist_mw/clist_mw_10.vcxproj.filters index 4573d41161..a8574cbca8 100644 --- a/plugins/Clist_mw/clist_mw_10.vcxproj.filters +++ b/plugins/Clist_mw/clist_mw_10.vcxproj.filters @@ -18,169 +18,101 @@ - + 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 - + Header Files - + Header Files - + Header Files - + Header Files - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - - + Resource Files diff --git a/plugins/Clist_mw/clistmenus.cpp b/plugins/Clist_mw/clistmenus.cpp deleted file mode 100644 index db84dca927..0000000000 --- a/plugins/Clist_mw/clistmenus.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2006 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 "commonheaders.h" -#pragma hdrstop - -static HMENU hMainMenu, hMainStatusMenu; - -void DestroyTrayMenu(HMENU hMenu) -{ - int i, cnt; - - cnt = GetMenuItemCount(hMenu); - for (i = 0; ihwndContactList); - - return 0; -} - -int InitCustomMenus(void) -{ - CreateServiceFunction("CloseAction",CloseAction); - hMainStatusMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); - hMainMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0); - - return 0; -} - -void UninitCustomMenus(void) -{ -} diff --git a/plugins/Clist_mw/clistmod.cpp b/plugins/Clist_mw/clistmod.cpp deleted file mode 100644 index 5f769427f8..0000000000 --- a/plugins/Clist_mw/clistmod.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 "commonheaders.h" - -extern int DefaultImageListColorDepth; - -int InitCustomMenus(void); -void UninitCustomMenus(void); -int ContactSettingChanged(WPARAM wParam,LPARAM lParam); -int CListOptInit(WPARAM wParam,LPARAM lParam); -INT_PTR ContactChangeGroup(WPARAM wParam,LPARAM lParam); -INT_PTR HotkeysProcessMessage(WPARAM wParam,LPARAM lParam) { return pcli->pfnHotkeysProcessMessage(wParam, lParam); } -void InitTrayMenus(void); - -HIMAGELIST hCListImages; - -HANDLE hContactIconChangedEvent; -extern BYTE nameOrder[]; - -static HANDLE hSettingChanged, hProtoAckHook; - -/////////// End by FYR //////// -int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact) -{ - int result = -1; - if (hContact && szProto) { - char * szActProto = (char*)szProto; - char AdvancedService[255] = {0}; - int nActStatus = nStatus; - HANDLE hActContact = hContact; - if (!DBGetContactSettingByte(NULL,"CLC","Meta",0) && !strcmp(szActProto,"MetaContacts")) { - // substitute params by mostonline contact datas - HANDLE hMostOnlineContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hActContact,0); - if (hMostOnlineContact && hMostOnlineContact != (HANDLE)CALLSERVICE_NOTFOUND) { - pdisplayNameCacheEntry cacheEntry; - cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hMostOnlineContact); - if (cacheEntry && cacheEntry->szProto) { - szActProto = cacheEntry->szProto; - nActStatus = cacheEntry->status; - hActContact = hMostOnlineContact; - } - } - } - _snprintf(AdvancedService,sizeof(AdvancedService),"%s%s",szActProto,"/GetAdvancedStatusIcon"); - - if (ServiceExists(AdvancedService)) - result = CallService(AdvancedService,(WPARAM)hActContact, (LPARAM)0); - - if (result == -1 || !(LOWORD(result))) - // result == -1 means no Advanced icon. LOWORD(result) == 0 happens when Advanced icon returned by ICQ (i.e. no transpot) - result = saveIconFromStatusMode(szActProto,nActStatus,NULL); - } - else result = saveIconFromStatusMode(szProto,nStatus,NULL); - return result; -} - - -////////// By FYR///////////// -int ExtIconFromStatusMode(HANDLE hContact, const char *szProto,int status) -{ -/* if ( DBGetContactSettingByte( NULL, "CLC", "Meta", 0 ) == 1 ) - return pcli->pfnIconFromStatusMode(szProto,status,hContact); - - if ( szProto != NULL ) { - if (strcmp(szProto,"MetaContacts") == 0 ) { - hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(UINT)hContact,0); - if ( hContact != 0 ) { - szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(UINT)hContact,0); - status = DBGetContactSettingWord(hContact,szProto,"Status",ID_STATUS_OFFLINE); - } - } - }*/ - - return pcli->pfnIconFromStatusMode(szProto,status,hContact); -} - -/////////// End by FYR //////// - -static int ProtocolAck(WPARAM wParam,LPARAM lParam) -{ - ACKDATA *ack = (ACKDATA*)lParam; - if (ack->type == ACKTYPE_AWAYMSG && ack->lParam) { - DBVARIANT dbv; - if (!DBGetContactSettingTString(ack->hContact, "CList", "StatusMsg", &dbv)) { - if ( !_tcscmp(dbv.ptszVal, (TCHAR *)ack->lParam)) { - DBFreeVariant(&dbv); - return 0; - } - DBFreeVariant(&dbv); - } - if ( DBGetContactSettingByte(NULL,"CList","ShowStatusMsg",0) || DBGetContactSettingByte(ack->hContact,"CList","StatusMsgAuto",0)) - DBWriteContactSettingTString(ack->hContact, "CList", "StatusMsg", (TCHAR *)ack->lParam); - } - - return 0; -} - -static INT_PTR GetStatusMode(WPARAM wParam, LPARAM lParam) -{ - return pcli->currentDesiredStatusMode; -} - -static int ContactListShutdownProc(WPARAM wParam,LPARAM lParam) -{ - UnhookEvent(hProtoAckHook); - UninitCustomMenus(); - return 0; -} - -int LoadContactListModule(void) -{ - HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); - while (hContact != NULL) { - DBWriteContactSettingString(hContact, "CList", "StatusMsg", ""); - hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); - } - - hCListImages = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0); - DefaultImageListColorDepth = DBGetContactSettingDword(NULL,"CList","DefaultImageListColorDepth",ILC_COLOR32); - - hProtoAckHook = (HANDLE) HookEvent(ME_PROTO_ACK, ProtocolAck); - HookEvent(ME_OPT_INITIALISE,CListOptInit); - HookEvent(ME_SYSTEM_SHUTDOWN,ContactListShutdownProc); - hSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED,ContactSettingChanged); - hContactIconChangedEvent = CreateHookableEvent(ME_CLIST_CONTACTICONCHANGED); - CreateServiceFunction(MS_CLIST_CONTACTCHANGEGROUP,ContactChangeGroup); - CreateServiceFunction(MS_CLIST_HOTKEYSPROCESSMESSAGE,HotkeysProcessMessage); - CreateServiceFunction(MS_CLIST_GETSTATUSMODE, GetStatusMode); - - InitCustomMenus(); - InitTrayMenus(); - return 0; -} diff --git a/plugins/Clist_mw/clistopts.cpp b/plugins/Clist_mw/clistopts.cpp deleted file mode 100644 index b845c5a0a0..0000000000 --- a/plugins/Clist_mw/clistopts.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 "commonheaders.h" -#include "m_clui.h" -#include "clist.h" -#include "m_clc.h" - -int HotKeysRegister(HWND hwnd); -void HotKeysUnregister(HWND hwnd); -void LoadContactTree(void); -void SortContacts(void); - -static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - -static UINT expertOnlyControls[] = {IDC_ALWAYSSTATUS}; -int CListOptInit(WPARAM wParam,LPARAM lParam) -{ - OPTIONSDIALOGPAGE odp; - - ZeroMemory(&odp,sizeof(odp)); - odp.cbSize = sizeof(odp); - odp.position = -1000000000; - odp.hInstance = g_hInst; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLIST); - odp.pszTitle = LPGEN("Contact List"); - odp.pfnDlgProc = DlgProcGenOpts; - odp.flags = ODPF_BOLDGROUPS; - odp.nIDBottomSimpleControl = IDC_STCLISTGROUP; - odp.expertOnlyControls = expertOnlyControls; - odp.nExpertOnlyControls = sizeof(expertOnlyControls)/sizeof(expertOnlyControls[0]); - Options_AddPage(wParam, &odp); - return 0; -} - -static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - case WM_USER+1: - { - HANDLE hContact = (HANDLE)wParam; - DBCONTACTWRITESETTING * ws = (DBCONTACTWRITESETTING *)lParam; - if ( hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL - && lstrcmpiA(ws->szModule,"CList") == 0 && lstrcmpiA(ws->szSetting,"UseGroups") == 0 - && IsWindowVisible(hwndDlg)) { - CheckDlgButton(hwndDlg,IDC_DISABLEGROUPS,ws->value.bVal == 0); - } - break; - } - case WM_DESTROY: - { - UnhookEvent( (HANDLE)GetWindowLongPtr(hwndDlg,GWLP_USERDATA)); - break; - } - - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED,hwndDlg,WM_USER+1)); - - CheckDlgButton(hwndDlg,IDC_GAMMACORRECT,DBGetContactSettingByte(NULL,"CLC","GammaCorrect",CLCDEFAULT_GAMMACORRECT)?BST_CHECKED:BST_UNCHECKED); - - SendDlgItemMessage(hwndDlg,IDC_ROWHEIGHTSPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_ROWHEIGHT),0); - SendDlgItemMessage(hwndDlg,IDC_ROWHEIGHTSPIN,UDM_SETRANGE,0,MAKELONG(255,0)); - SendDlgItemMessage(hwndDlg,IDC_ROWHEIGHTSPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingByte(NULL,"CLC","RowHeight",CLCDEFAULT_ROWHEIGHT),0)); - - CheckDlgButton(hwndDlg, IDC_ONTOP, DBGetContactSettingByte(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, DBGetContactSettingByte(NULL,"CList","HideEmptyGroups",SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, DBGetContactSettingByte(NULL,"CList","UseGroups",SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED); - CheckDlgButton(hwndDlg, IDC_SORTBYNAME, - !DBGetContactSettingByte(NULL,"CList","SortByStatus",SETTING_SORTBYSTATUS_DEFAULT) && - !DBGetContactSettingByte(NULL,"CList","SortByProto",SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hwndDlg, IDC_SORTBYSTATUS, DBGetContactSettingByte(NULL,"CList","SortByStatus",SETTING_SORTBYSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_NOOFFLINEMOVE, DBGetContactSettingByte(NULL,"CList","NoOfflineBottom",SETTING_NOOFFLINEBOTTOM_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hwndDlg, IDC_SORTBYPROTO, DBGetContactSettingByte(NULL,"CList","SortByProto",SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, DBGetContactSettingByte(NULL,"CList","ConfirmDelete",SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AUTOHIDE, DBGetContactSettingByte(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIME),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); - EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); - { DWORD caps = CallService(MS_CLUI_GETCAPS,CLUICAPS_FLAGS1,0); - if (!(caps&CLUIF_HIDEEMPTYGROUPS)) ShowWindow(GetDlgItem(hwndDlg,IDC_HIDEEMPTYGROUPS),SW_HIDE); - if (!(caps&CLUIF_DISABLEGROUPS)) ShowWindow(GetDlgItem(hwndDlg,IDC_DISABLEGROUPS),SW_HIDE); - if (caps&CLUIF_HASONTOPOPTION) ShowWindow(GetDlgItem(hwndDlg,IDC_ONTOP),SW_HIDE); - if (caps&CLUIF_HASAUTOHIDEOPTION) { - ShowWindow(GetDlgItem(hwndDlg,IDC_AUTOHIDE),SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg,IDC_HIDETIME),SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN),SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg,IDC_STAUTOHIDESECS),SW_HIDE); - } - } - SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETRANGE,0,MAKELONG(900,1)); - SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),0)); - CheckDlgButton(hwndDlg, IDC_ONECLK, DBGetContactSettingByte(NULL,"CList","Tray1Click",SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, DBGetContactSettingByte(NULL,"CList","AlwaysStatus",SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI, !DBGetContactSettingByte(NULL,"CList","AlwaysMulti",SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_DONTCYCLE, DBGetContactSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_CYCLE, DBGetContactSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_MULTITRAY, DBGetContactSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, DBGetContactSettingByte(NULL,"CList","DisableTrayFlash",0) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ICONBLINK, DBGetContactSettingByte(NULL,"CList","NoIconBlink",0) == 1 ? BST_CHECKED : BST_UNCHECKED ); - - if (IsDlgButtonChecked(hwndDlg,IDC_DONTCYCLE)) { - EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIMESPIN),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIME),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_ALWAYSMULTI),FALSE); - } - if (IsDlgButtonChecked(hwndDlg,IDC_CYCLE)) { - EnableWindow(GetDlgItem(hwndDlg,IDC_PRIMARYSTATUS),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_ALWAYSMULTI),FALSE); - } - if (IsDlgButtonChecked(hwndDlg,IDC_MULTITRAY)) { - EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIMESPIN),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIME),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_PRIMARYSTATUS),FALSE); - } - SendDlgItemMessage(hwndDlg,IDC_CYCLETIMESPIN,UDM_SETRANGE,0,MAKELONG(120,1)); - SendDlgItemMessage(hwndDlg,IDC_CYCLETIMESPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"CList","CycleTime",SETTING_CYCLETIME_DEFAULT),0)); - { int i,count,item; - PROTOACCOUNT **accs; - DBVARIANT dbv = {DBVT_DELETED}; - DBGetContactSettingString(NULL,"CList","PrimaryStatus",&dbv); - ProtoEnumAccounts( &count, &accs ); - item = SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_ADDSTRING,0,(LPARAM)TranslateT("Global")); - SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_SETITEMDATA,item,(LPARAM)0); - for ( i = 0; i < count; i++ ) { - if ( !IsAccountEnabled( accs[i] ) || CallProtoService( accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0 ) == 0 ) - continue; - - item = SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_ADDSTRING,0,(LPARAM)accs[i]->tszAccountName); - SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_SETITEMDATA,item,(LPARAM)accs[i] ); - if ( dbv.type == DBVT_ASCIIZ && !lstrcmpA( dbv.pszVal, accs[i]->szModuleName )) - SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_SETCURSEL,item,0); - } - } - if (-1 == (int)SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_GETCURSEL,0,0)) - SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_SETCURSEL,0,0); - SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_BLINKTIME),0); // set buddy - SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_SETRANGE,0,MAKELONG(0x3FFF,250)); - SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"CList","IconFlashTime",550),0)); - return TRUE; - case WM_VSCROLL: - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_AUTOHIDE: - EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIME),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); - EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); - break; - case IDC_DONTCYCLE: - case IDC_CYCLE: - case IDC_MULTITRAY: - EnableWindow(GetDlgItem(hwndDlg,IDC_PRIMARYSTATUS),IsDlgButtonChecked(hwndDlg,IDC_DONTCYCLE)); - EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIME),IsDlgButtonChecked(hwndDlg,IDC_CYCLE)); - EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIMESPIN),IsDlgButtonChecked(hwndDlg,IDC_CYCLE)); - EnableWindow(GetDlgItem(hwndDlg,IDC_ALWAYSMULTI),IsDlgButtonChecked(hwndDlg,IDC_MULTITRAY)); - break; - case IDC_ROWHEIGHT: - if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0; - break; - } - if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_CYCLETIME) && HIWORD(wParam) != EN_CHANGE) break; - if (LOWORD(wParam) == IDC_PRIMARYSTATUS && HIWORD(wParam) != CBN_SELCHANGE) break; - if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_CYCLETIME) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; - if (LOWORD(wParam) == IDC_BLINKTIME && HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0; // dont make apply enabled during buddy set crap - - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - case WM_NOTIFY: - switch (((LPNMHDR)lParam)->idFrom) { - case 0: - switch (((LPNMHDR)lParam)->code) - { - case PSN_APPLY: - DBWriteContactSettingByte(NULL,"CList","HideOffline",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDEOFFLINE)); - { DWORD caps = CallService(MS_CLUI_GETCAPS,CLUICAPS_FLAGS1,0); - if (caps&CLUIF_HIDEEMPTYGROUPS) DBWriteContactSettingByte(NULL,"CList","HideEmptyGroups",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDEEMPTYGROUPS)); - if (caps&CLUIF_DISABLEGROUPS) DBWriteContactSettingByte(NULL,"CList","UseGroups",(BYTE)!IsDlgButtonChecked(hwndDlg,IDC_DISABLEGROUPS)); - if (!(caps&CLUIF_HASONTOPOPTION)) { - DBWriteContactSettingByte(NULL,"CList","OnTop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONTOP)); - SetWindowPos(pcli->hwndContactList,IsDlgButtonChecked(hwndDlg,IDC_ONTOP)?HWND_TOPMOST:HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - } - if (!(caps&CLUIF_HASAUTOHIDEOPTION)) { - DBWriteContactSettingByte(NULL,"CList","AutoHide",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); - DBWriteContactSettingWord(NULL,"CList","HideTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_GETPOS,0,0)); - } - } - DBWriteContactSettingByte(NULL,"CList","SortByStatus",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SORTBYSTATUS)); - DBWriteContactSettingByte(NULL,"CList","SortByProto",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SORTBYPROTO)); - DBWriteContactSettingByte(NULL,"CList","NoOfflineBottom",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_NOOFFLINEMOVE)); - DBWriteContactSettingByte(NULL,"CLC","RowHeight",(BYTE)SendDlgItemMessage(hwndDlg,IDC_ROWHEIGHTSPIN,UDM_GETPOS,0,0)); - DBWriteContactSettingByte(NULL,"CLC","GammaCorrect",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_GAMMACORRECT)); - - DBWriteContactSettingByte(NULL,"CList","ConfirmDelete",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CONFIRMDELETE)); - DBWriteContactSettingByte(NULL,"CList","Tray1Click",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONECLK)); - DBWriteContactSettingByte(NULL,"CList","AlwaysStatus",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ALWAYSSTATUS)); - DBWriteContactSettingByte(NULL,"CList","AlwaysMulti",(BYTE)!IsDlgButtonChecked(hwndDlg,IDC_ALWAYSMULTI)); - DBWriteContactSettingByte(NULL,"CList","TrayIcon",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_DONTCYCLE)?SETTING_TRAYICON_SINGLE:(IsDlgButtonChecked(hwndDlg,IDC_CYCLE)?SETTING_TRAYICON_CYCLE:SETTING_TRAYICON_MULTI))); - DBWriteContactSettingWord(NULL,"CList","CycleTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_CYCLETIMESPIN,UDM_GETPOS,0,0)); - DBWriteContactSettingWord(NULL,"CList","IconFlashTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_GETPOS,0,0)); - DBWriteContactSettingByte(NULL,"CList","DisableTrayFlash",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DISABLEBLINK)); - DBWriteContactSettingByte(NULL,"CList","NoIconBlink", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_ICONBLINK)); - { - int cursel = SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_GETCURSEL,0,0); - PROTOACCOUNT* pa = (PROTOACCOUNT*)SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_GETITEMDATA,cursel,0); - if ( pa == NULL ) - DBDeleteContactSetting(NULL, "CList","PrimaryStatus"); - else - DBWriteContactSettingString(NULL,"CList","PrimaryStatus", pa->szModuleName); - } - pcli->pfnTrayIconIconsChanged(); - LoadContactTree(); /* this won't do job properly since it only really works when changes happen */ - SendMessage(pcli->hwndContactTree,CLM_AUTOREBUILD,0,0); /* force reshuffle */ - return TRUE; - } - break; - } - break; - } - return FALSE; -} diff --git a/plugins/Clist_mw/clistsettings.cpp b/plugins/Clist_mw/clistsettings.cpp deleted file mode 100644 index f18a4452f2..0000000000 --- a/plugins/Clist_mw/clistsettings.cpp +++ /dev/null @@ -1,374 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 "commonheaders.h" -#include "m_clui.h" -#include "m_clc.h" -#include "clist.h" - -TCHAR *GetNameForContact(HANDLE hContact,int flag,boolean *isUnknown); -char *GetProtoForContact(HANDLE hContact); -int GetStatusForContact(HANDLE hContact,char *szProto); -TCHAR *UnknownConctactTranslatedName; -extern boolean OnModulesLoadedCalled; -void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,pdisplayNameCacheEntry pdnce,int SettingType); - -static int handleCompare( displayNameCacheEntry* c1, displayNameCacheEntry* c2 ) -{ - return (char*)c1->hContact - (char*)c2->hContact; -} - -void InitDisplayNameCache(SortedList *list) -{ - int i, idx; - HANDLE hContact; - - memset(list,0,sizeof(SortedList)); - list->sortFunc = (FSortFunc)handleCompare; - list->increment = CallService(MS_DB_CONTACT_GETCOUNT,0,0)+1; - - hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); - i = 0; - while (hContact != 0) - { - displayNameCacheEntry *pdnce = (pdisplayNameCacheEntry)mir_calloc(sizeof(displayNameCacheEntry)); - pdnce->hContact = hContact; - InvalidateDisplayNameCacheEntryByPDNE(hContact,pdnce,0); - List_GetIndex(list,pdnce,&idx); - List_Insert(list,pdnce,idx); - hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0); - i++; -} } - -void FreeDisplayNameCacheItem(ClcCacheEntryBase *_p) -{ - pdisplayNameCacheEntry p = (pdisplayNameCacheEntry)_p; - if ( p->tszName) { mir_free(p->tszName); p->tszName = NULL; } - if ( p->szProto) { mir_free(p->szProto); p->szProto = NULL; } - if ( p->tszGroup) { mir_free(p->tszGroup); p->tszGroup = NULL; } -} - -void FreeDisplayNameCache(SortedList *list) -{ - int i; - - for ( i = 0; i < list->realCount; i++) { - FreeDisplayNameCacheItem((ClcCacheEntryBase*)list->items[i] ); - mir_free(list->items[i]); - } - - List_Destroy(list); -} - -void CheckPDNCE(ClcCacheEntryBase *_pdnce) -{ - pdisplayNameCacheEntry pdnce = (pdisplayNameCacheEntry)_pdnce; - if (pdnce == NULL) - return; - - if (pdnce->szProto == NULL && pdnce->protoNotExists == FALSE) { - pdnce->szProto = GetProtoForContact(pdnce->hContact); - if (pdnce->szProto == NULL) - pdnce->protoNotExists = FALSE; - else { - if (CallService(MS_PROTO_ISPROTOCOLLOADED,0,(LPARAM)pdnce->szProto) == 0) - pdnce->protoNotExists = TRUE; - else { - if ( pdnce->szProto && pdnce->tszName ) { - mir_free(pdnce->tszName); - pdnce->tszName = NULL; - } } } } - - if (pdnce->tszName == NULL) - { - if (pdnce->protoNotExists) - pdnce->tszName = mir_tstrdup(TranslateT("_NoProtocol_")); - else { - if (OnModulesLoadedCalled) - pdnce->tszName = GetNameForContact(pdnce->hContact,0,&pdnce->isUnknown); - else - pdnce->tszName = GetNameForContact(pdnce->hContact,0,NULL); - } - } - else { - if (pdnce->isUnknown&&pdnce->szProto&&pdnce->protoNotExists == TRUE&&OnModulesLoadedCalled) { - pdnce->protoNotExists = FALSE; - mir_free(pdnce->tszName); - pdnce->tszName = GetNameForContact(pdnce->hContact,0,&pdnce->isUnknown); - } } - - if (pdnce->status == 0) - pdnce->status = GetStatusForContact(pdnce->hContact,pdnce->szProto); - - if (pdnce->tszGroup == NULL) - { - DBVARIANT dbv; - - if (!DBGetContactSettingTString(pdnce->hContact,"CList","Group",&dbv)) - { - pdnce->tszGroup = mir_tstrdup(dbv.ptszVal); - mir_free(dbv.pszVal); - } - else pdnce->tszGroup = mir_tstrdup( _T("")); - } - - if (pdnce->bIsHidden == -1) - pdnce->bIsHidden = DBGetContactSettingByte(pdnce->hContact,"CList","bIsHidden",0); - - if (pdnce->noHiddenOffline == -1) - pdnce->noHiddenOffline = DBGetContactSettingByte(pdnce->hContact,"CList","noOffline",0); - - if ( pdnce->IdleTS == -1 ) - pdnce->IdleTS = DBGetContactSettingDword(pdnce->hContact,pdnce->szProto,"IdleTS",0); - - if (pdnce->ApparentMode == -1) - pdnce->ApparentMode = DBGetContactSettingWord(pdnce->hContact,pdnce->szProto,"ApparentMode",0); - - if (pdnce->NotOnList == -1) - pdnce->NotOnList = DBGetContactSettingByte(pdnce->hContact,"CList","NotOnList",0); - - if (pdnce->IsExpanded == -1) - pdnce->IsExpanded = DBGetContactSettingByte(pdnce->hContact,"CList","Expanded",0); -} - -void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,pdisplayNameCacheEntry pdnce,int SettingType) -{ - if ( hContact == NULL || pdnce == NULL ) - return; - - if ( SettingType == -1 || SettingType == DBVT_DELETED ) - { - mir_free(pdnce->tszName); - pdnce->tszName = NULL; - mir_free(pdnce->tszGroup); - pdnce->tszGroup = NULL; - - pdnce->bIsHidden = -1; - pdnce->protoNotExists = FALSE; - mir_free(pdnce->szProto); - pdnce->szProto = NULL; - pdnce->status = 0; - pdnce->IdleTS = -1; - pdnce->ApparentMode = -1; - pdnce->NotOnList = -1; - pdnce->isUnknown = FALSE; - pdnce->noHiddenOffline = -1; - pdnce->IsExpanded = -1; - return; - } - - if (SettingType >= DBVT_WCHAR) - { - mir_free(pdnce->tszName); - pdnce->tszName = NULL; - mir_free(pdnce->tszGroup); - pdnce->tszGroup = NULL; - mir_free(pdnce->szProto); - pdnce->szProto = NULL; - return; - } - - // in other cases clear all binary cache - pdnce->bIsHidden = -1; - pdnce->protoNotExists = FALSE; - pdnce->status = 0; - pdnce->IdleTS = -1; - pdnce->ApparentMode = -1; - pdnce->NotOnList = -1; - pdnce->isUnknown = FALSE; - pdnce->noHiddenOffline = -1; - pdnce->IsExpanded = -1; -} - -char *GetContactCachedProtocol(HANDLE hContact) -{ - pdisplayNameCacheEntry cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact); - if (cacheEntry&&cacheEntry->szProto) - return cacheEntry->szProto; - - return NULL; -} - -char *GetProtoForContact(HANDLE hContact) -{ - DBVARIANT dbv; - DBCONTACTGETSETTING dbcgs; - char name[32]; - - dbv.type = DBVT_ASCIIZ; - dbv.pszVal = name; - dbv.cchVal = SIZEOF(name); - dbcgs.pValue = &dbv; - dbcgs.szModule = "Protocol"; - dbcgs.szSetting = "p"; - if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC,(WPARAM)hContact,(LPARAM)&dbcgs)) return NULL; - return mir_strdup(dbcgs.pValue->pszVal); -} - -int GetStatusForContact(HANDLE hContact,char *szProto) -{ - int status = ID_STATUS_OFFLINE; - if (szProto) - status = DBGetContactSettingWord((HANDLE)hContact,szProto,"Status",ID_STATUS_OFFLINE); - - return (status); -} - -TCHAR* GetNameForContact(HANDLE hContact,int flag,boolean *isUnknown) -{ - TCHAR* result = pcli->pfnGetContactDisplayName(hContact, flag | GCDNF_NOCACHE); - - if (isUnknown) { - if (UnknownConctactTranslatedName == NULL) - UnknownConctactTranslatedName = TranslateT("(Unknown Contact)"); - - *isUnknown = lstrcmp(result ,UnknownConctactTranslatedName) == 0; - } - - return result; -} - -pdisplayNameCacheEntry GetContactFullCacheEntry(HANDLE hContact) -{ - pdisplayNameCacheEntry cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact); - if (cacheEntry != NULL) - return(cacheEntry); - - return NULL; -} - -int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status) -{ - pdisplayNameCacheEntry cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact); - if (cacheEntry != NULL) - { - if (Proto != NULL) *Proto = cacheEntry->szProto; - if (Name != NULL) *Name = cacheEntry->tszName; - if (Status != NULL) *Status = cacheEntry->status; - } - return 0; -} - -int GetContactCachedStatus(HANDLE hContact) -{ - pdisplayNameCacheEntry cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact); - if (cacheEntry&&cacheEntry->status != 0) return cacheEntry->status; - return 0; -} - -int ContactSettingChanged(WPARAM wParam,LPARAM lParam) -{ - DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - pdisplayNameCacheEntry pdnce; - - // Early exit - if ((HANDLE)wParam == NULL) - return 0; - - __try - { - pdnce = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry((HANDLE)wParam); - if (pdnce == NULL) - { - OutputDebugStringA("!!! Very bad pdnce not found."); - return 0; - } - - if (pdnce && pdnce->protoNotExists == FALSE && pdnce->szProto) - { - if (!strcmp(cws->szModule,pdnce->szProto)) - { - InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); - - if (cws->value.type == DBVT_WORD&&!strcmp(cws->szSetting, "Status")) { - if (!(pdnce->bIsHidden == 1)) { - - if (DBGetContactSettingByte((HANDLE)NULL,"CList","ShowStatusMsg",0)||DBGetContactSettingByte((HANDLE)wParam,"CList","StatusMsgAuto",0)) - DBWriteContactSettingString((HANDLE)wParam, "CList", "StatusMsg", ""); - - if (DBGetContactSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) { - // User's state is changing, and we are hideOffline-ing - - if (cws->value.wVal == ID_STATUS_OFFLINE) { - ChangeContactIcon((HANDLE)wParam, ExtIconFromStatusMode((HANDLE)wParam,cws->szModule, cws->value.wVal), 0); //by FYR - return 0; - } - ChangeContactIcon((HANDLE)wParam, ExtIconFromStatusMode((HANDLE)wParam,cws->szModule, cws->value.wVal), 0); //by FYR - } - else - { - ChangeContactIcon((HANDLE)wParam, ExtIconFromStatusMode((HANDLE)wParam,cws->szModule, cws->value.wVal), 0); //by FYR - } - } - } - else if (!strcmp(cws->szModule,"MetaContacts")) - { - PostMessage(pcli->hwndContactTree,CLM_AUTOREBUILD,0,0); - return 0; - } - else return 0; - - SortContacts(); - } } - - if (!strcmp(cws->szModule,"CList")) { - /* - sprintf(buf,"CHANGE: module:CList setting:%s %s\r\n",cws->szSetting,cws->value.pszVal); - OutputDebugStringA(buf); - */ - - //name is null or (setting is myhandle) - if (pdnce->tszName == NULL||(!strcmp(cws->szSetting,"MyHandle"))) - InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); - - if ((!strcmp(cws->szSetting,"Group"))) - InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); - - if (!strcmp(cws->szSetting,"bIsHidden")) { - InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); - if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0) { - char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0); - ChangeContactIcon((HANDLE)wParam,ExtIconFromStatusMode((HANDLE)wParam,szProto,szProto == NULL?ID_STATUS_OFFLINE:DBGetContactSettingWord((HANDLE)wParam,szProto,"Status",ID_STATUS_OFFLINE)),1); //by FYR - } } - - if (!strcmp(cws->szSetting,"noOffline")) - InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); - } - - if (!strcmp(cws->szModule,"Protocol")) { - if (!strcmp(cws->szSetting,"p")) { - char *szProto; - - OutputDebugStringA("CHANGE: proto\r\n"); - InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); - if (cws->value.type == DBVT_DELETED) szProto = NULL; - else szProto = cws->value.pszVal; - ChangeContactIcon((HANDLE)wParam,ExtIconFromStatusMode((HANDLE)wParam,szProto,szProto == NULL?ID_STATUS_OFFLINE:DBGetContactSettingWord((HANDLE)wParam,szProto,"Status",ID_STATUS_OFFLINE)),0); //by FYR - } - } - } - __except (exceptFunction(GetExceptionInformation())) - { - } - - return 0; -} diff --git a/plugins/Clist_mw/clisttray.cpp b/plugins/Clist_mw/clisttray.cpp deleted file mode 100644 index d0e6e3ae93..0000000000 --- a/plugins/Clist_mw/clisttray.cpp +++ /dev/null @@ -1,281 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 "commonheaders.h" -#include "m_clui.h" - -#define TIM_CALLBACK (WM_USER+1857) -#define TIM_CREATE (WM_USER+1858) - -extern INT_PTR ( *saveTrayIconProcessMessage )(WPARAM wParam,LPARAM lParam); -void DestroyTrayMenu(HMENU hMenu); - -INT_PTR TrayIconProcessMessage(WPARAM wParam,LPARAM lParam) -{ - MSG *msg = (MSG*)wParam; - switch(msg->message) { - case WM_DRAWITEM: - return CallService(MS_CLIST_MENUDRAWITEM,msg->wParam,msg->lParam); - break; - case WM_MEASUREITEM: - return CallService(MS_CLIST_MENUMEASUREITEM,msg->wParam,msg->lParam); - break; - case TIM_CALLBACK: - if (msg->lParam == WM_RBUTTONUP) - { - POINT pt; - HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDTRAY,(WPARAM)0,(LPARAM)0); - - SetForegroundWindow(msg->hwnd); - SetFocus(msg->hwnd); - GetCursorPos(&pt); - TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN, pt.x, pt.y, 0, msg->hwnd, NULL); - DestroyTrayMenu(hMenu); - } - else break; - - *((LRESULT*)lParam) = 0; - return TRUE; - } - - return saveTrayIconProcessMessage( wParam, lParam ); -} - -//////////////////////////////TRAY MENU///////////////////////// -HANDLE hTrayMenuObject; - -HANDLE hTrayMainMenuItemProxy; -HANDLE hHideShowMainMenuItem; -HANDLE hTrayStatusMenuItemProxy; -HANDLE hPreBuildTrayMenuEvent; - -//traymenu exec param(ownerdata) -typedef struct{ -char *szServiceName; -INT_PTR Param1; -}TrayMenuExecParam,*lpTrayMenuExecParam; - -/* -wparam = handle to the menu item returned by MS_CLIST_ADDCONTACTMENUITEM -return 0 on success. -*/ -static INT_PTR RemoveTrayMenuItem(WPARAM wParam,LPARAM lParam) -{ - CallService(MO_REMOVEMENUITEM,wParam,0); - return 0; -} - -static INT_PTR BuildTrayMenu(WPARAM wParam,LPARAM lParam) -{ - int tick; - HMENU hMenu; - ListParam param = { 0 }; - param.MenuObjectHandle = hTrayMenuObject; - - //hMenu = hMainMenu; - hMenu = CreatePopupMenu(); - //hMenu = wParam; - tick = GetTickCount(); - - NotifyEventHooks(hPreBuildTrayMenuEvent,0,0); - - CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m); - //DrawMenuBar((HWND)CallService("CLUI/GetHwnd",0,0)); - tick = GetTickCount()-tick; - return (INT_PTR)hMenu; -} - -static INT_PTR AddTrayMenuItem(WPARAM wParam,LPARAM lParam) -{ - TMO_MenuItem tmi; - CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; - if ( !pcli->pfnConvertMenu(mi, &tmi)) - return NULL; - - lpTrayMenuExecParam mmep = (lpTrayMenuExecParam)mir_alloc(sizeof(TrayMenuExecParam)); - if (mmep == NULL) - return 0; - - mmep->szServiceName = mir_strdup(mi->pszService); - mmep->Param1 = mi->popupPosition; - tmi.ownerdata = mmep; - - OptParam op; - op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hTrayMenuObject,(LPARAM)&tmi); - op.Setting = OPT_MENUITEMSETUNIQNAME; - op.Value = (INT_PTR)mi->pszService; - CallService(MO_SETOPTIONSMENUITEM,(WPARAM)0,(LPARAM)&op); - return (INT_PTR)op.Handle; -} - -INT_PTR TrayMenuCheckService(WPARAM wParam,LPARAM lParam) -{ - return 0; -} - -INT_PTR TrayMenuonAddService(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 (hTrayMainMenuItemProxy == (HANDLE)lParam) { - mii->fMask |= MIIM_SUBMENU; - mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0); - } - - if (hTrayStatusMenuItemProxy == (HANDLE)lParam) { - mii->fMask |= MIIM_SUBMENU; - mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); - } - - return(TRUE); -} - - -//called with: -//wparam - ownerdata -//lparam - lparam from winproc -INT_PTR TrayMenuExecService(WPARAM wParam,LPARAM lParam) { - if (wParam != 0) - { - lpTrayMenuExecParam mmep = (lpTrayMenuExecParam)wParam; - if (!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); - } - return(1); -} - -INT_PTR FreeOwnerDataTrayMenu (WPARAM wParam,LPARAM lParam) -{ - - lpTrayMenuExecParam mmep; - mmep = (lpTrayMenuExecParam)lParam; - if (mmep != NULL){ - FreeAndNil((void**)&mmep->szServiceName); - FreeAndNil((void**)&mmep); - } - - return 0; -} - -void InitTrayMenus(void) -{ - TMenuParam tmp; - OptParam op; - - //Tray menu - memset(&tmp,0,sizeof(tmp)); - tmp.cbSize = sizeof(tmp); - tmp.CheckService = NULL; - tmp.ExecService = "CLISTMENUSTRAY/ExecService"; - tmp.name = "TrayMenu"; - hTrayMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp); - - CreateServiceFunction("CLISTMENUSTRAY/ExecService",TrayMenuExecService); - CreateServiceFunction("CLISTMENUSTRAY/FreeOwnerDataTrayMenu",FreeOwnerDataTrayMenu); - CreateServiceFunction("CLISTMENUSTRAY/TrayMenuonAddService",TrayMenuonAddService); - - CreateServiceFunction("CList/AddTrayMenuItem",AddTrayMenuItem); - CreateServiceFunction(MS_CLIST_REMOVETRAYMENUITEM,RemoveTrayMenuItem); - CreateServiceFunction(MS_CLIST_MENUBUILDTRAY,BuildTrayMenu); - hPreBuildTrayMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDTRAYMENU); - - op.Handle = hTrayMenuObject; - op.Setting = OPT_USERDEFINEDITEMS; - op.Value = TRUE; - CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); - - op.Handle = hTrayMenuObject; - op.Setting = OPT_MENUOBJECT_SET_FREE_SERVICE; - op.Value = (INT_PTR)"CLISTMENUSTRAY/FreeOwnerDataTrayMenu"; - CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); - - op.Handle = hTrayMenuObject; - op.Setting = OPT_MENUOBJECT_SET_ONADD_SERVICE; - op.Value = (INT_PTR)"CLISTMENUSTRAY/TrayMenuonAddService"; - CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); - - { - //add exit command to menu - CLISTMENUITEM mi; - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 900000; - mi.pszService = "CloseAction"; - mi.pszName = LPGEN("E&xit"); - AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 100000; - mi.pszService = MS_CLIST_SHOWHIDE; - mi.pszName = LPGEN("&Hide/Show"); - hHideShowMainMenuItem = (HANDLE)AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 200000; - mi.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_FINDUSER)); - mi.pszService = "FindAdd/FindAddCommand"; - mi.pszName = LPGEN("&Find/Add Contacts..."); - AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 300000; - mi.pszService = ""; - mi.pszName = LPGEN("&Main Menu"); - hTrayMainMenuItemProxy = (HANDLE)AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 300100; - mi.pszService = ""; - mi.pszName = LPGEN("&Status"); - hTrayStatusMenuItemProxy = (HANDLE)AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 400000; - mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_OPTIONS)); - mi.pszService = "Options/OptionsCommand"; - mi.pszName = LPGEN("&Options..."); - AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 500000; - mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_CLIENTMIRANDA)); - mi.pszService = "Help/AboutCommand"; - mi.pszName = LPGEN("&About"); - AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); -} } diff --git a/plugins/Clist_mw/clui.cpp b/plugins/Clist_mw/clui.cpp deleted file mode 100644 index bddf0478e0..0000000000 --- a/plugins/Clist_mw/clui.cpp +++ /dev/null @@ -1,922 +0,0 @@ -/* - - Miranda IM: the free IM client for Microsoft* Windows* - - Copyright 2000-2003 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 "commonheaders.h" - -#define TM_AUTOALPHA 1 -#define TM_STATUSBARUPDATE 200 -#define MENU_MIRANDAMENU 0xFFFF1234 - -extern int DefaultImageListColorDepth; - -static HMODULE hUserDll; -HMENU hMenuMain; -static HANDLE hContactDraggingEvent,hContactDroppedEvent,hContactDragStopEvent; -UINT hMsgGetProfile = 0; - -extern boolean canloadstatusbar; -boolean OnModulesLoadedCalled = FALSE; - -HANDLE hSettingChangedHook = 0; - -static int transparentFocus = 1; -static byte oldhideoffline; -static int lastreqh = 0,requr = 0,disableautoupd = 1; -HANDLE hFrameContactTree; -BYTE showOpts;//for statusbar - -typedef struct{ -int IconsCount; -int CycleStartTick; -char *szProto; -int n; -int TimerCreated; -} ProtoTicks,*pProtoTicks; - -ProtoTicks CycleStartTick[64];//max 64 protocols - -int CycleTimeInterval = 2000; -int CycleIconCount = 8; -int DefaultStep = 100; - -BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); -BOOL (WINAPI *MyAnimateWindow)(HWND hWnd,DWORD dwTime,DWORD dwFlags); - -int CluiOptInit(WPARAM wParam,LPARAM lParam); -int SortList(WPARAM wParam,LPARAM lParam); - -void CluiProtocolStatusChanged(int parStatus, const char* szProto); - -extern void SetAllExtraIcons(HWND hwndList,HANDLE hContact); -extern void ReloadExtraIcons(); -extern void LoadExtraImageFunc(); -extern HWND CreateStatusBarhWnd(HWND parent); -extern HANDLE CreateStatusBarFrame(); -extern int CLUIFramesUpdateFrame(WPARAM wParam,LPARAM lParam); -extern int ExtraToColumnNum(int extra); -extern int ColumnNumToExtra(int column); -extern void DrawDataForStatusBar(LPDRAWITEMSTRUCT dis); -extern void InitGroupMenus(); -extern int UseOwnerDrawStatusBar; -extern HANDLE hExtraImageClick; - -HICON GetConnectingIconForProto(char *szProto,int b); -HICON GetConnectingIconForProto_DLL(char *szProto,int b); - -void RegisterProtoIconsForAllProtoIconLib(); - -#define M_CREATECLC (WM_USER+1) -#define M_SETALLEXTRAICONS (WM_USER+2) - -static int CluiModulesLoaded(WPARAM wParam,LPARAM lParam) -{ - MENUITEMINFO mii; - ZeroMemory(&mii,sizeof(mii)); - mii.cbSize = MENUITEMINFO_V4_SIZE; - mii.fMask = MIIM_SUBMENU; - mii.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0); - SetMenuItemInfo(hMenuMain,0,TRUE,&mii); - mii.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); - SetMenuItemInfo(hMenuMain,1,TRUE,&mii); - - canloadstatusbar = TRUE; - SendMessage(pcli->hwndContactList,WM_SIZE,0,0); - CluiProtocolStatusChanged(0,0); - Sleep(0); - PostMessage(pcli->hwndContactList,M_CREATECLC,0,0); - - OnModulesLoadedCalled = TRUE; - pcli->pfnInvalidateDisplayNameCacheEntry(INVALID_HANDLE_VALUE); - InitGroupMenus(); - RegisterProtoIconsForAllProtoIconLib(); - return 0; -} - -pProtoTicks GetProtoTicksByProto(char * szProto) -{ - int i; - - for (i = 0;i<64;i++) - { - if (CycleStartTick[i].szProto == NULL) break; - if (strcmp(CycleStartTick[i].szProto,szProto)) continue; - return(&CycleStartTick[i]); - } - for (i = 0;i<64;i++) - { - if (CycleStartTick[i].szProto == NULL) - { - CycleStartTick[i].szProto = mir_strdup(szProto); - CycleStartTick[i].CycleStartTick = 0; - CycleStartTick[i].n = i; - return(&CycleStartTick[i]); - } - } - return NULL; -} - -int GetConnectingIconForProtoCount(char *szProto) -{ - char file[MAX_PATH],fileFull[MAX_PATH],szFullPath[MAX_PATH]; - char szPath[MAX_PATH]; - char *str; - int ret; - - GetModuleFileNameA(GetModuleHandle(NULL), szPath, MAX_PATH); - str = strrchr(szPath,'\\'); - if (str != NULL) *str = 0; - _snprintf(szFullPath, SIZEOF(szFullPath), "%s\\Icons\\proto_conn_%s.dll", szPath, szProto); - - lstrcpynA(file,szFullPath,SIZEOF(file)); - CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)file, (LPARAM)fileFull); - ret = ExtractIconExA(fileFull,-1,NULL,NULL,1); - if (ret == 0&&!strcmp(szProto,"ICQ")) ret = 8; - return ret; -} - -static HICON ExtractIconFromPath(const char *path) -{ - char *comma; - char file[MAX_PATH],fileFull[MAX_PATH]; - int n; - HICON hIcon; - { -// char buf[512]; -// sprintf(buf,"LoadIcon %s\r\n",path); -// OutputDebugStringA(buf); - } - lstrcpynA(file,path,SIZEOF(file)); - comma = strrchr(file,','); - if (comma == NULL) n = 0; - else {n = atoi(comma+1); *comma = 0;} - CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)file, (LPARAM)fileFull); - -#ifdef _DEBUG - { -// char buf[512]; -// sprintf(buf,"LoadIconFull %d %s\r\n",n,fileFull); -// OutputDebugStringA(buf); - } -#endif - - hIcon = NULL; - ExtractIconExA(fileFull,n,NULL,&hIcon,1); - return hIcon; -} - -HICON LoadIconFromExternalFile(char *filename,int i,boolean UseLibrary,boolean registerit,char *IconName,char *SectName,char *Description,int internalidx,HICON DefIcon) -{ - char szPath[MAX_PATH],szMyPath[MAX_PATH], szFullPath[MAX_PATH],*str; - HICON hIcon = NULL; - SKINICONDESC sid = {0}; - - memset(szMyPath,0,SIZEOF(szMyPath)); - memset(szFullPath,0,SIZEOF(szFullPath)); - - if (filename != NULL) - { - GetModuleFileNameA(GetModuleHandle(NULL), szPath, MAX_PATH); - GetModuleFileNameA(g_hInst, szMyPath, MAX_PATH); - str = strrchr(szPath,'\\'); - if (str != NULL) *str = 0; - _snprintf(szFullPath, SIZEOF(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i); - } - - if (!UseLibrary) { - hIcon = ExtractIconFromPath(szFullPath); - if (hIcon) return hIcon; - } - else { - if (registerit && IconName != NULL && SectName != NULL) { - sid.cbSize = sizeof(sid); - sid.pszSection = SectName; - sid.pszName = IconName; - sid.pszDescription = Description; - if (strlen(szMyPath) != 0) - sid.pszDefaultFile = szMyPath; - - sid.iDefaultIndex = internalidx; - sid.hDefaultIcon = DefIcon; - - Skin_AddIcon(&sid); - - char buf[256]; - sprintf(buf,"Registring Icon %s/%s hDefaultIcon: %p\r\n",SectName,IconName,DefIcon); - OutputDebugStringA(buf); - } - return ((HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)IconName)); - } - - return (HICON)0; -} - -void RegisterProtoIcons (char *protoname) -{ - if (ServiceExists(MS_SKIN2_GETICON)&&DBGetContactSettingByte(NULL,"CList","UseProtoIconFromIcoLib",1)) - { - int i; - char buf[256]; - char buf2[256]; - for (i = 0;i<8;i++) - { - sprintf(buf,"%s #%d",protoname,i); - sprintf(buf2,"Contact List/Connection Icons %s",protoname); - - LoadIconFromExternalFile(NULL,i,TRUE,TRUE,buf,buf2,buf,0,GetConnectingIconForProto_DLL(protoname,i)); - } - } -} - -void RegisterProtoIconsForAllProtoIconLib() -{ - int protoCount,i; - PROTOACCOUNT **accs; - - ProtoEnumAccounts( &protoCount, &accs ); - for ( i = 0; i < protoCount; i++ ) - if ( IsAccountEnabled( accs[i] ) && CallProtoService( accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0 )) - RegisterProtoIcons( accs[i]->szModuleName ); -} - -HICON GetConnectingIconForProto_DLL(char *szProto,int b) -{ - char szFullPath[MAX_PATH]; - HICON hIcon = NULL; - - b = b-1; - _snprintf(szFullPath, SIZEOF(szFullPath), "proto_conn_%s.dll",szProto); - // hIcon = ExtractIconFromPath(szFullPath); - // if (hIcon) return hIcon; - - hIcon = LoadIconFromExternalFile(szFullPath,b+1,FALSE,FALSE,NULL,NULL,NULL,0,0); - if (hIcon) return hIcon; - -#ifdef _DEBUG - { - char buf [256]; - sprintf(buf,"IconNotFound %s %d\r\n",szProto,b); - // OutputDebugStringA(buf); - } -#endif - - if (!strcmp(szProto,"ICQ")) - { - -#ifdef _DEBUG - char buf [256]; - sprintf(buf,"Icon %d %d\r\n",GetTickCount(),b); - //OutputDebugStringA(buf); -#endif - return(LoadIconA(g_hInst,(LPCSTR)(IDI_ICQC1+b))); - } - - return(hIcon); -} - -HICON GetConnectingIconForProto(char *szProto,int b) -{ - if (ServiceExists(MS_SKIN2_GETICON)&&DBGetContactSettingByte(NULL,"CList","UseProtoIconFromIcoLib",1)) { - HICON hIcon = 0; - char buf[256]; - sprintf(buf,"%s #%d",szProto,b); - - hIcon = LoadIconFromExternalFile(NULL,b,TRUE,FALSE,buf,"Contact List/Connection Icons",buf,0,NULL); - if (hIcon == NULL) return (GetConnectingIconForProto_DLL(szProto,b)); - return (CopyIcon(hIcon)); - } - - return GetConnectingIconForProto_DLL(szProto, b); -} - -//wParam == szProto -INT_PTR GetConnectingIconService(WPARAM wParam,LPARAM lParam) -{ - int b; - ProtoTicks *pt = NULL; - HICON hIcon = NULL; - - char *szProto = (char *)wParam; - if (!szProto) return 0; - - pt = GetProtoTicksByProto(szProto); - - if (pt != NULL) { - if (pt->CycleStartTick != 0&&pt->IconsCount != 0) { - b = ((GetTickCount()-pt->CycleStartTick)/(DefaultStep))%pt->IconsCount; - hIcon = GetConnectingIconForProto(szProto,b); - } - } - - return (INT_PTR)hIcon; -} - -int CreateTimerForConnectingIcon(WPARAM wParam,LPARAM lParam) -{ - int status = (int)wParam; - char *szProto = (char *)lParam; - if (!szProto) return 0; - if (!status) return 0; - - if (( DBGetContactSettingByte(NULL,"CLUI","UseConnectingIcon",1) == 1) && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES) { - ProtoTicks *pt = NULL; - int cnt; - - pt = GetProtoTicksByProto(szProto); - if (pt != NULL) { - if (pt->CycleStartTick == 0) { - KillTimer(pcli->hwndContactList,TM_STATUSBARUPDATE+pt->n); - cnt = GetConnectingIconForProtoCount(szProto); - if (ServiceExists(MS_SKIN2_GETICON)&&DBGetContactSettingByte(NULL,"Clist","UseProtoIconFromIcoLib",1)) - cnt = 8; - - if (cnt != 0) { - DefaultStep = DBGetContactSettingWord(NULL,"CLUI","DefaultStepConnectingIcon",100); - pt->IconsCount = cnt; - SetTimer(pcli->hwndContactList,TM_STATUSBARUPDATE+pt->n,(int)(DefaultStep)/1,0); - pt->TimerCreated = 1; - pt->CycleStartTick = GetTickCount(); - } - } - } - } - return 0; -} - -// Restore protocols to the last global status. -// Used to reconnect on restore after standby. - -int OnSettingChanging(WPARAM wParam,LPARAM lParam) -{ - DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *)lParam; - if (wParam == 0) { - if ((dbcws->value.type == DBVT_BYTE)&&!strcmp(dbcws->szModule,"CLUI")) { - if (!strcmp(dbcws->szSetting,"SBarShow")) { - showOpts = dbcws->value.bVal; - return 0; - } - } - } - else { - if (dbcws == NULL) - return 0; - - if ( !ServiceExists("ExtraIcon/Register")) { - if (dbcws->value.type == DBVT_ASCIIZ&&!strcmp(dbcws->szSetting,"e-mail")) { - SetAllExtraIcons(pcli->hwndContactTree,(HANDLE)wParam); - return 0; - } - if (dbcws->value.type == DBVT_ASCIIZ&&!strcmp(dbcws->szSetting,"Cellular")) { - SetAllExtraIcons(pcli->hwndContactTree,(HANDLE)wParam); - return 0; - } - - if (dbcws->value.type == DBVT_ASCIIZ&&strstr(dbcws->szModule,"ICQ")) { - if ( !strcmp(dbcws->szSetting, "MirVer")) { - SetAllExtraIcons(pcli->hwndContactTree,(HANDLE)wParam); - return 0; - } - } - - if (dbcws->value.type == DBVT_ASCIIZ&&!strcmp(dbcws->szModule,"UserInfo")) { - if ( !strcmp(dbcws->szSetting, "MyPhone0")) { - SetAllExtraIcons(pcli->hwndContactTree,(HANDLE)wParam); - return 0; - } - if (!strcmp(dbcws->szSetting, "Mye-mail0")) { - SetAllExtraIcons(pcli->hwndContactTree,(HANDLE)wParam); - return 0; - } - } - } - } - return 0; -} - -HWND PreCreateCLC(HWND parent) -{ - pcli->hwndContactTree = CreateWindow(CLISTCONTROL_CLASS,_T(""), - WS_CHILD|WS_CLIPCHILDREN|CLS_CONTACTLIST - |(DBGetContactSettingByte(NULL,"CList","UseGroups",SETTING_USEGROUPS_DEFAULT)?CLS_USEGROUPS:0) - |CLS_HIDEOFFLINE - //|(DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CLS_HIDEOFFLINE:0) - |(DBGetContactSettingByte(NULL,"CList","HideEmptyGroups",SETTING_HIDEEMPTYGROUPS_DEFAULT)?CLS_HIDEEMPTYGROUPS:0) - |(DBGetContactSettingByte(NULL,"CList","ShowStatusMessages",1)?CLS_SHOWSTATUSMESSAGES:0) - |CLS_MULTICOLUMN - //|DBGetContactSettingByte(NULL,"CLUI","ExtraIconsAlignToLeft",1)?CLS_EX_MULTICOLUMNALIGNLEFT:0 - ,0,0,0,0,parent,NULL,g_hInst,NULL); - - return pcli->hwndContactTree; -} - -int CreateCLC(HWND parent) -{ - Sleep(0); - { - // create contact list frame - CLISTFrame Frame; - memset(&Frame,0,sizeof(Frame)); - Frame.cbSize = sizeof(CLISTFrame); - Frame.hWnd = pcli->hwndContactTree; - Frame.align = alClient; - Frame.hIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); - //LoadIcon(hInst,MAKEINTRESOURCE(IDI_MIRANDA)); - Frame.Flags = F_VISIBLE|F_SHOWTB|F_SHOWTBTIP|F_TCHAR; - Frame.tname = _T("My Contacts"); - Frame.TBtname = TranslateT("My Contacts"); - hFrameContactTree = (HWND)CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&Frame,(LPARAM)0); - //free(Frame.name); - CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_TBTIPNAME,hFrameContactTree),(LPARAM)TranslateT("My Contacts")); - } - - ReloadExtraIcons(); - { - lastreqh = 0; - { - CallService(MS_CLIST_SETHIDEOFFLINE,(WPARAM)oldhideoffline,0); - } - - { int state = DBGetContactSettingByte(NULL,"CList","State",SETTING_STATE_NORMAL); - if (state == SETTING_STATE_NORMAL) ShowWindow(pcli->hwndContactList, SW_SHOW); - else if (state == SETTING_STATE_MINIMIZED) ShowWindow(pcli->hwndContactList, SW_SHOWMINIMIZED); - } - - lastreqh = 0; - disableautoupd = 0; - - } - hSettingChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED,OnSettingChanging); - return 0; -} - -int GetStatsuBarProtoRect(HWND hwnd,char *szProto,RECT *rc) -{ - int nParts,nPanel; - ProtocolData *PD; - int startoffset = DBGetContactSettingDword(NULL,"StatusBar","FirstIconOffset",0); - - if (!UseOwnerDrawStatusBar) startoffset = 0; - - nParts = SendMessage(hwnd,SB_GETPARTS,0,0); - FillMemory(rc,sizeof(RECT),0); - - for (nPanel = 0;nPanelhwndStatus,SB_GETTEXT,(WPARAM)nPanel,(LPARAM)0); - if ( PD == NULL ) - return 0; - - if (!strcmp(szProto,PD->RealName)) - { - SendMessage(hwnd,SB_GETRECT,(WPARAM)nPanel,(LPARAM)rc); - rc->left += startoffset; - rc->right += startoffset; - return 0; - } - } - return 0; -} - -extern LRESULT ( CALLBACK *saveContactListWndProc )(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); - -LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - /* - This registers a window message with RegisterWindowMessage() and then waits for such a message, - if it gets it, it tries to open a file mapping object and then maps it to this process space, - it expects 256 bytes of data (incl. NULL) it will then write back the profile it is using the DB to fill in the answer. - - The caller is expected to create this mapping object and tell us the ID we need to open ours. - */ - - if (msg == hMsgGetProfile && wParam != 0) { /* got IPC message */ - HANDLE hMap; - char szName[MAX_PATH]; - int rc = 0; - _snprintf(szName,SIZEOF(szName),"Miranda::%u", wParam); // caller will tell us the ID of the map - hMap = OpenFileMappingA(FILE_MAP_ALL_ACCESS,FALSE,szName); - if (hMap != NULL) { - void *hView = NULL; - hView = MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, MAX_PATH); - if (hView) { - char szFilePath[MAX_PATH], szProfile[MAX_PATH]; - CallService(MS_DB_GETPROFILEPATH,MAX_PATH,(LPARAM)&szFilePath); - CallService(MS_DB_GETPROFILENAME,MAX_PATH,(LPARAM)&szProfile); - _snprintf((char*)hView, MAX_PATH, "%s\\%s", szFilePath, szProfile); - UnmapViewOfFile(hView); - rc = 1; - } - CloseHandle(hMap); - } - return rc; - } - - switch (msg) { - case WM_CREATE: - TranslateMenu(GetMenu(hwnd)); - DrawMenuBar(hwnd); - showOpts = DBGetContactSettingByte(NULL,"CLUI","SBarShow",1); - - //create the status wnd - //pcli->hwndStatus == CreateStatusWindow(WS_CHILD | (DBGetContactSettingByte(NULL,"CLUI","ShowSBar",1)?WS_VISIBLE:0), "", hwnd, 0); - CluiProtocolStatusChanged(0,0); - - hMsgGetProfile = RegisterWindowMessageA( "Miranda::GetProfile" ); // don't localise - - if ( DBGetContactSettingByte( NULL, "CList", "Transparent", 0 )) { - SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); - if ( MySetLayeredWindowAttributes ) - MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); - } - transparentFocus = 1; - return FALSE; - - case M_SETALLEXTRAICONS: - return TRUE; - - case M_CREATECLC: - CreateCLC(hwnd); - return TRUE; - - case WM_SIZE: - { - RECT rc; - if ( wParam != SIZE_MINIMIZED ) { - if ( pcli->hwndContactList != NULL ) - CLUIFramesOnClistResize((WPARAM)hwnd,(LPARAM)0); - - GetWindowRect(hwnd, &rc); - if (!CallService(MS_CLIST_DOCKINGISDOCKED,0,0)) { - //if docked, dont remember pos (except for width) - DBWriteContactSettingDword(NULL,"CList","Height",(DWORD)(rc.bottom - rc.top)); - DBWriteContactSettingDword(NULL,"CList","x",(DWORD)rc.left); - DBWriteContactSettingDword(NULL,"CList","y",(DWORD)rc.top); - } - DBWriteContactSettingDword(NULL,"CList","Width",(DWORD)(rc.right - rc.left)); - } - if ( wParam == SIZE_MINIMIZED ) { - if ( DBGetContactSettingByte(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT )) { - ShowWindow(hwnd, SW_HIDE); - DBWriteContactSettingByte(NULL,"CList","State",SETTING_STATE_HIDDEN); - } - else DBWriteContactSettingByte(NULL,"CList","State",SETTING_STATE_MINIMIZED); - } - return 0; - } - - case WM_SETFOCUS: - { - boolean isfloating; - if ( hFrameContactTree ) { - isfloating = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS,MAKEWPARAM(FO_FLOATING,hFrameContactTree),0); - if ( isfloating == FALSE) - SetFocus(pcli->hwndContactTree); - } - return 0; - } - case WM_TIMER: - if ((int)wParam>=TM_STATUSBARUPDATE&&(int)wParam<=TM_STATUSBARUPDATE+64) { - int status,i; - - ProtoTicks *pt = NULL; - for (i = 0;i<64;i++) { - pt = &CycleStartTick[i]; - if (pt->szProto != NULL&&pt->TimerCreated == 1) { - status = CallProtoService(pt->szProto,PS_GETSTATUS,0,0); - if (!(status>=ID_STATUS_CONNECTING&&status<=ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES)) - { - pt->CycleStartTick = 0; - KillTimer(hwnd,TM_STATUSBARUPDATE+pt->n); - pt->TimerCreated = 0; - } } } - - pt = &CycleStartTick[wParam-TM_STATUSBARUPDATE]; - { - RECT rc; - GetStatsuBarProtoRect(pcli->hwndStatus,pt->szProto,&rc); - rc.right = rc.left+GetSystemMetrics(SM_CXSMICON)+1; - rc.top = 0; - - if (IsWindowVisible(pcli->hwndStatus)) InvalidateRect(pcli->hwndStatus,&rc,TRUE); - pcli->pfnTrayIconUpdateBase(pt->szProto); - } - //SendMessage(pcli->hwndStatus,WM_PAINT,0,0); - UpdateWindow(pcli->hwndStatus); - return TRUE; - } - break; - - case WM_DRAWITEM: - { - LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; - if ( dis->hwndItem == pcli->hwndStatus ) { - DrawDataForStatusBar(dis); - return 0; - } - if ( dis->CtlType != ODT_MENU ) - return 0; - break; - } - case WM_KEYDOWN: - CallService(MS_CLIST_MENUPROCESSHOTKEY,wParam,MPCF_MAINMENU|MPCF_CONTACTMENU); - if (wParam == VK_F5) - SendMessage(pcli->hwndContactTree,CLM_AUTOREBUILD,0,0); - return TRUE; - - case WM_GETMINMAXINFO: - DefWindowProc(hwnd,msg,wParam,lParam); - ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 18; - if (requr == 0){((LPMINMAXINFO)lParam)->ptMinTrackSize.y = CLUIFramesGetMinHeight();} - return 0; - - //MSG FROM CHILD CONTROL - case WM_NOTIFY: - if (((LPNMHDR)lParam)->hwndFrom == pcli->hwndContactTree) { - switch (((LPNMHDR)lParam)->code) { - case CLN_NEWCONTACT: - { - NMCLISTCONTROL *nm = (NMCLISTCONTROL *)lParam; - if (nm != NULL) SetAllExtraIcons(pcli->hwndContactTree,nm->hItem ); - return TRUE; - } - case CLN_LISTREBUILT: - SetAllExtraIcons(pcli->hwndContactTree,0); - return(FALSE); - - case CLN_LISTSIZECHANGE: - { - NMCLISTCONTROL *nmc = (NMCLISTCONTROL*)lParam; - RECT rcWindow,rcTree,rcWorkArea; - int maxHeight,newHeight; - int winstyle; - - if ( !disableautoupd && DBGetContactSettingByte( NULL, "CLUI", "AutoSize", 0 )) { - if ( !CallService(MS_CLIST_DOCKINGISDOCKED,0,0) && hFrameContactTree != 0 ) { - maxHeight = DBGetContactSettingByte(NULL,"CLUI","MaxSizeHeight",75); - GetWindowRect(hwnd,&rcWindow); - GetWindowRect(pcli->hwndContactTree,&rcTree); - winstyle = GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE); - - SystemParametersInfo(SPI_GETWORKAREA,0,&rcWorkArea,FALSE); - lastreqh = nmc->pt.y; - newHeight = max(nmc->pt.y,3)+1+((winstyle&WS_BORDER)?2:0)+(rcWindow.bottom-rcWindow.top)-(rcTree.bottom-rcTree.top); - if (newHeight != rcWindow.bottom - rcWindow.top ) { - if (newHeight>(rcWorkArea.bottom-rcWorkArea.top)*maxHeight/100) - newHeight = (rcWorkArea.bottom-rcWorkArea.top)*maxHeight/100; - if (DBGetContactSettingByte(NULL,"CLUI","AutoSizeUpward",0)) { - rcWindow.top = rcWindow.bottom-newHeight; - if (rcWindow.toprcWorkArea.bottom) rcWindow.bottom = rcWorkArea.bottom; - } - - if (requr == 0) { - requr = 1; - SetWindowPos(hwnd,0,rcWindow.left,rcWindow.top,rcWindow.right-rcWindow.left,rcWindow.bottom-rcWindow.top,SWP_NOZORDER|SWP_NOACTIVATE); - GetWindowRect(hwnd,&rcWindow); - requr = 0; - } } } } - return TRUE; - } - case NM_CLICK: - { - NMCLISTCONTROL *nm = (NMCLISTCONTROL*)lParam; - DWORD hitFlags; - HANDLE hItem = (HANDLE)SendMessage(pcli->hwndContactTree,CLM_HITTEST,(WPARAM)&hitFlags,MAKELPARAM(nm->pt.x,nm->pt.y)); - - if (hitFlags&CLCHT_ONITEMEXTRA) { - if (!IsHContactGroup(hItem)&&!IsHContactInfo(hItem)) - { - int extra; - pdisplayNameCacheEntry pdnce; - - pdnce = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(nm->hItem); - if (pdnce == NULL) return 0; - - extra = ColumnNumToExtra(nm->iColumn); - NotifyEventHooks(hExtraImageClick, (WPARAM)nm->hItem, extra); - - if (!ServiceExists("ExtraIcon/Register")) - { - int v,e,w; - v = ExtraToColumnNum(EXTRA_ICON_PROTO); - e = ExtraToColumnNum(EXTRA_ICON_EMAIL); - w = ExtraToColumnNum(EXTRA_ICON_ADV1); - - if (nm->iColumn == v) - CallService(MS_USERINFO_SHOWDIALOG,(WPARAM)nm->hItem,0); - - if (nm->iColumn == e) { - //CallService(MS_USERINFO_SHOWDIALOG,(WPARAM)nm->hItem,0); - char *email,buf[4096]; - email = DBGetStringA(nm->hItem,"UserInfo", "Mye-mail0"); - if (email) { - sprintf(buf,"mailto:%s",email); - ShellExecuteA(hwnd,"open",buf,NULL,NULL,SW_SHOW); - } - } - if (nm->iColumn == w) { - char *homepage; - homepage = DBGetStringA(pdnce->hContact,pdnce->szProto, "Homepage"); - if (homepage != NULL) - ShellExecuteA(hwnd,"open",homepage,NULL,NULL,SW_SHOW); - } } } } - - if (hItem) break; - if ((hitFlags&(CLCHT_NOWHERE|CLCHT_INLEFTMARGIN|CLCHT_BELOWITEMS)) == 0) break; - if (DBGetContactSettingByte(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)) { - POINT pt; - pt = nm->pt; - ClientToScreen(pcli->hwndContactTree,&pt); - return SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE|HTCAPTION,MAKELPARAM(pt.x,pt.y)); - } - return TRUE; - } - } - } - else if (((LPNMHDR)lParam)->hwndFrom == pcli->hwndStatus) { - if (((LPNMHDR)lParam)->code == NM_CLICK ) { - int nParts = 0, nPanel = 0; - NMMOUSE *nm = (NMMOUSE*)lParam; - HMENU hMenu; - RECT rc; - POINT pt; - int totcount; - ProtocolData *PD; - int menuid; - int startoffset = DBGetContactSettingDword(NULL,"StatusBar","FirstIconOffset",0); - int extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0); - boolean UseOwnerDrawStatusBar = DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",0); - - hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); - nParts = SendMessage(pcli->hwndStatus,SB_GETPARTS,0,0); - - if (nm->dwItemSpec == 0xFFFFFFFE) { - nPanel = nParts-1; - SendMessage(pcli->hwndStatus,SB_GETRECT,nPanel,(LPARAM)&rc); - if (nm->pt.x < rc.left) return FALSE; - } - else { - if (!((startoffset) != 0&&UseOwnerDrawStatusBar)) - { - nPanel = nm->dwItemSpec; - SendMessage(pcli->hwndStatus,SB_GETRECT,nPanel,(LPARAM)&rc); - } - else { - RECT clrc; - int sectwidth; - - memset(&rc,0,sizeof(RECT)); - GetClientRect(pcli->hwndStatus,&clrc); - clrc.right -= clrc.left; - clrc.right -= startoffset; - sectwidth = clrc.right/nParts; - - for (nPanel = 0;nPanelhwndStatus,SB_GETTEXT,(WPARAM)nPanel,(LPARAM)0); - if (PD == NULL) - continue; - - rc.top = 0; - rc.bottom = clrc.bottom; - rc.left = nPanel*sectwidth+startoffset; - rc.right = rc.left+sectwidth-1; - - if (PtInRect(&rc,nm->pt)) - break; - } } } - - totcount = DBGetContactSettingDword(0,"Protocols","ProtoCount",0); - PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,(WPARAM)nPanel,(LPARAM)0); - if (PD == NULL){return 0;} - menuid = nPanel; - - if (menuid<0){break;} - hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); - { - int i; - unsigned int cpnl = 0; - int mcnt = GetMenuItemCount(hMenu); - for (i = 0; iprotopos: %d,PD->RealName %s\r\n",nPanel,PD->protopos,PD->RealName); - OutputDebugStringA(buf); - } - - if (hMenu != NULL) { - GetCursorPos(&pt); - TrackPopupMenu(hMenu,TPM_BOTTOMALIGN|TPM_LEFTALIGN,pt.x,pt.y,0,hwnd,NULL); - } } - return TRUE; - } - break; - - case WM_DESTROY: - { - //saving state - int state = DBGetContactSettingByte(NULL,"CList","State",SETTING_STATE_NORMAL); - - FreeProtocolData(); - if ( hSettingChangedHook != 0 ) - UnhookEvent(hSettingChangedHook); - - if ( state == SETTING_STATE_NORMAL ) - ShowWindow(hwnd,SW_HIDE); - - CallService(MS_CLIST_FRAMES_REMOVEFRAME,(WPARAM)hFrameContactTree,(LPARAM)0); - DestroyWindow(pcli->hwndContactTree); - pcli->hwndContactList = NULL; - - UnLoadCLUIFramesModule(); - DBWriteContactSettingByte(NULL,"CList","State",(BYTE)state); - PostQuitMessage(0); - } - break; - } - - return saveContactListWndProc( hwnd, msg, wParam, lParam ); -} - -int LoadCLUIModule(void) -{ - DBVARIANT dbv; - TCHAR titleText[256]; - int laster; - canloadstatusbar = FALSE; - hFrameContactTree = 0; - - hUserDll = LoadLibraryA("user32.dll"); - if (hUserDll) { - MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll, "SetLayeredWindowAttributes"); - MyAnimateWindow = (BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(hUserDll,"AnimateWindow"); - } - - HookEvent(ME_SYSTEM_MODULESLOADED,CluiModulesLoaded); - HookEvent(ME_OPT_INITIALISE,CluiOptInit); - hContactDraggingEvent = CreateHookableEvent(ME_CLUI_CONTACTDRAGGING); - hContactDroppedEvent = CreateHookableEvent(ME_CLUI_CONTACTDROPPED); - hContactDragStopEvent = CreateHookableEvent(ME_CLUI_CONTACTDRAGSTOP); - - CreateServiceFunction("CLUI/GetConnectingIconForProtocol",GetConnectingIconService); - - if (DBGetContactSettingTString(NULL,"CList","TitleText",&dbv)) - lstrcpyn(titleText,_T(MIRANDANAME),SIZEOF(titleText)); - else { - lstrcpyn(titleText,dbv.ptszVal,SIZEOF(titleText)); - DBFreeVariant(&dbv); - } - - oldhideoffline = DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT); - - laster = GetLastError(); - PreCreateCLC(pcli->hwndContactList); - - // create status bar frame - CreateStatusBarhWnd(pcli->hwndContactList); - - { //int state = DBGetContactSettingByte(NULL,"CList","State",SETTING_STATE_NORMAL); - hMenuMain = GetMenu(pcli->hwndContactList); - if (!DBGetContactSettingByte(NULL,"CLUI","ShowMainMenu",SETTING_SHOWMAINMENU_DEFAULT)) SetMenu(pcli->hwndContactList,NULL); - SetWindowPos(pcli->hwndContactList, DBGetContactSettingByte(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); - } - - lastreqh = 0; - return 0; -} - -void UnloadCLUIModule() -{ - int i; - - for ( i = 0; i < SIZEOF(CycleStartTick); i++ ) - if ( CycleStartTick[i].szProto != NULL ) - mir_free(CycleStartTick[i].szProto); -} \ No newline at end of file diff --git a/plugins/Clist_mw/cluiopts.cpp b/plugins/Clist_mw/cluiopts.cpp deleted file mode 100644 index 8fd1c1651e..0000000000 --- a/plugins/Clist_mw/cluiopts.cpp +++ /dev/null @@ -1,435 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 "commonheaders.h" - -extern HMENU hMenuMain; -extern BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); -static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -extern HANDLE hFrameHelperStatusBar; -extern int UseOwnerDrawStatusBar; - -void ReAssignExtraIcons(); -void CluiProtocolStatusChanged(int parStatus, const char* szProto); -int OnStatusBarBackgroundChange(); - -static UINT expertOnlyControls[] = {IDC_BRINGTOFRONT, IDC_AUTOSIZE,IDC_STATIC21,IDC_MAXSIZEHEIGHT,IDC_MAXSIZESPIN,IDC_STATIC22,IDC_AUTOSIZEUPWARD,IDC_SHOWMAINMENU,IDC_SHOWCAPTION,IDC_CLIENTDRAG}; -int CluiOptInit(WPARAM wParam,LPARAM lParam) -{ - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); - odp.hInstance = g_hInst; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLUI); - odp.pszTitle = LPGEN("Window"); - odp.pszGroup = LPGEN("Contact List"); - odp.pfnDlgProc = DlgProcCluiOpts; - odp.flags = ODPF_BOLDGROUPS; - odp.nIDBottomSimpleControl = IDC_STWINDOWGROUP; - odp.expertOnlyControls = expertOnlyControls; - odp.nExpertOnlyControls = SIZEOF(expertOnlyControls); - Options_AddPage(wParam, &odp); - - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SBAR); - odp.pszTitle = LPGEN("Status Bar"); - odp.pfnDlgProc = DlgProcSBarOpts; - odp.flags = ODPF_BOLDGROUPS | ODPF_EXPERTONLY; - odp.nIDBottomSimpleControl = 0; - odp.nExpertOnlyControls = 0; - odp.expertOnlyControls = NULL; - Options_AddPage(wParam, &odp); - return 0; -} - -static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT, DBGetContactSettingByte(NULL,"CList","BringToFront",SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ONTOP, DBGetContactSettingByte(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_TOOLWND, DBGetContactSettingByte(NULL,"CList","ToolWindow",SETTING_TOOLWINDOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_MIN2TRAY, DBGetContactSettingByte(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - if (IsDlgButtonChecked(hwndDlg,IDC_TOOLWND)) EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),FALSE); - CheckDlgButton(hwndDlg, IDC_SHOWCAPTION, DBGetContactSettingByte(NULL,"CLUI","ShowCaption",SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU, DBGetContactSettingByte(NULL,"CLUI","ShowMainMenu",SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_CLIENTDRAG, DBGetContactSettingByte(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - if (!IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) { - EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_TOOLWND),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_TITLETEXT),FALSE); - } - CheckDlgButton(hwndDlg, IDC_FADEINOUT, DBGetContactSettingByte(NULL,"CLUI","FadeInOut",0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AUTOSIZE, DBGetContactSettingByte(NULL,"CLUI","AutoSize",0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_DROPSHADOW, DBGetContactSettingByte(NULL,"CList","WindowShadow",0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ONDESKTOP, DBGetContactSettingByte(NULL,"CList","OnDesktop", 0) ? BST_CHECKED : BST_UNCHECKED); - SendDlgItemMessage(hwndDlg,IDC_MAXSIZESPIN,UDM_SETRANGE,0,MAKELONG(100,0)); - SendDlgItemMessage(hwndDlg,IDC_MAXSIZESPIN,UDM_SETPOS,0,DBGetContactSettingByte(NULL,"CLUI","MaxSizeHeight",75)); - CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, DBGetContactSettingByte(NULL,"CLUI","AutoSizeUpward",0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AUTOHIDE, DBGetContactSettingByte(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETRANGE,0,MAKELONG(900,1)); - SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),0)); - EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIME),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); - EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); - EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC01),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); - if (!IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)) { - EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC21),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC22),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_MAXSIZEHEIGHT),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_MAXSIZESPIN),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_AUTOSIZEUPWARD),FALSE); - } - - { DBVARIANT dbv; - char *s; - char szUin[20]; - - if (DBGetContactSettingString(NULL,"CList","TitleText",&dbv) == 0&&(dbv.pszVal)) - { - s = mir_strdup(dbv.pszVal); - mir_free(dbv.pszVal); - } - else - { - s = mir_strdup(MIRANDANAME); - } - - if (s) - { - SetDlgItemTextA(hwndDlg,IDC_TITLETEXT,s); - mir_free(s); - } - - SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)MIRANDANAME); - wsprintfA(szUin,"%u",DBGetContactSettingDword(NULL,"ICQ","UIN",0)); - SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)szUin); - - if (!DBGetContactSettingString(NULL,"ICQ","Nick",&dbv)) { - SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)dbv.pszVal); - mir_free(dbv.pszVal); - dbv.pszVal = NULL; - } - if (!DBGetContactSettingString(NULL,"ICQ","FirstName",&dbv)) { - SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)dbv.pszVal); - mir_free(dbv.pszVal); - dbv.pszVal = NULL; - } - if (!DBGetContactSettingString(NULL,"ICQ","e-mail",&dbv)) { - SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)dbv.pszVal); - mir_free(dbv.pszVal); - dbv.pszVal = NULL; - } - } - if (!IsWinVer2000Plus()) { - EnableWindow(GetDlgItem(hwndDlg,IDC_FADEINOUT),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENT),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_DROPSHADOW),FALSE); - } - else CheckDlgButton(hwndDlg,IDC_TRANSPARENT,DBGetContactSettingByte(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)?BST_CHECKED:BST_UNCHECKED); - if (!IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)) { - EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC11),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC12),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSACTIVE),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSINACTIVE),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_ACTIVEPERC),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_INACTIVEPERC),FALSE); - } - SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_SETRANGE,FALSE,MAKELONG(1,255)); - SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_SETRANGE,FALSE,MAKELONG(1,255)); - SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_SETPOS,TRUE,DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT)); - SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_SETPOS,TRUE,DBGetContactSettingByte(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT)); - SendMessage(hwndDlg,WM_HSCROLL,0x12345678,0); - - // EXTRA Icons - if (ServiceExists("ExtraIcon/Register")) - { - ShowWindow(GetDlgItem(hwndDlg,IDC_EXTRA_FRAME), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg,IDC_EXTRA_PROTO), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg,IDC_EXTRA_WEB), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg,IDC_EXTRA_EMAIL), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg,IDC_EXTRA_CELLULAR), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg,IDC_EXTRA_ADV1), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg,IDC_EXTRA_ADV2), SW_HIDE); - } - else - { - CheckDlgButton(hwndDlg, IDC_EXTRA_PROTO, DBGetContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_PROTO",1) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_EXTRA_WEB, DBGetContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_WEB",1) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_EXTRA_EMAIL, DBGetContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_EMAIL",1) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_EXTRA_CELLULAR, DBGetContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_SMS",1) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_EXTRA_ADV1, DBGetContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_ADV1",1) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_EXTRA_ADV2, DBGetContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_ADV2",1) ? BST_CHECKED : BST_UNCHECKED); - } - - return TRUE; - - case WM_COMMAND: - if (LOWORD(wParam) == IDC_AUTOHIDE) { - EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIME),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); - EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); - EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC01),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); - } - else if (LOWORD(wParam) == IDC_TRANSPARENT) { - EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC11),IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)); - EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC12),IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)); - EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSACTIVE),IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)); - EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSINACTIVE),IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)); - EnableWindow(GetDlgItem(hwndDlg,IDC_ACTIVEPERC),IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)); - EnableWindow(GetDlgItem(hwndDlg,IDC_INACTIVEPERC),IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)); - } - else if (LOWORD(wParam) == IDC_AUTOSIZE) { - EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC21),IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)); - EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC22),IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)); - EnableWindow(GetDlgItem(hwndDlg,IDC_MAXSIZEHEIGHT),IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)); - EnableWindow(GetDlgItem(hwndDlg,IDC_MAXSIZESPIN),IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)); - EnableWindow(GetDlgItem(hwndDlg,IDC_AUTOSIZEUPWARD),IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)); - } - else if (LOWORD(wParam) == IDC_TOOLWND) { - EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),!IsDlgButtonChecked(hwndDlg,IDC_TOOLWND)); - } - else if (LOWORD(wParam) == IDC_SHOWCAPTION) { - EnableWindow(GetDlgItem(hwndDlg,IDC_TOOLWND),IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)); - EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),!IsDlgButtonChecked(hwndDlg,IDC_TOOLWND) && IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)); - EnableWindow(GetDlgItem(hwndDlg,IDC_TITLETEXT),IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)); - } - - if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_TITLETEXT || LOWORD(wParam) == IDC_MAXSIZEHEIGHT) && - (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) - return 0; - - // Enable apply button - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - - case WM_HSCROLL: - { char str[10]; - wsprintfA(str,"%d%%",100*SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_GETPOS,0,0)/255); - SetDlgItemTextA(hwndDlg,IDC_INACTIVEPERC,str); - wsprintfA(str,"%d%%",100*SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_GETPOS,0,0)/255); - SetDlgItemTextA(hwndDlg,IDC_ACTIVEPERC,str); - } - if (wParam != 0x12345678) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - case WM_NOTIFY: - switch (((LPNMHDR)lParam)->code) - { - case PSN_APPLY: - DBWriteContactSettingByte(NULL,"CList","OnTop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONTOP)); - SetWindowPos(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg,IDC_ONTOP)?HWND_TOPMOST:HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - - DBWriteContactSettingByte(NULL,"CList","ToolWindow",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_TOOLWND)); - DBWriteContactSettingByte(NULL,"CList","BringToFront",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BRINGTOFRONT)); - if (IsDlgButtonChecked(hwndDlg,IDC_TOOLWND)) { - // Window must be hidden to dynamically remove the taskbar button. - // See http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_programming/taskbar.asp - WINDOWPLACEMENT p; - p.length = sizeof(p); - GetWindowPlacement(pcli->hwndContactList,&p); - ShowWindow(pcli->hwndContactList,SW_HIDE); - SetWindowLongPtr(pcli->hwndContactList,GWL_EXSTYLE,GetWindowLongPtr(pcli->hwndContactList,GWL_EXSTYLE)|WS_EX_TOOLWINDOW|WS_EX_WINDOWEDGE); - SetWindowPlacement(pcli->hwndContactList,&p); - } - else - SetWindowLongPtr(pcli->hwndContactList,GWL_EXSTYLE,GetWindowLongPtr(pcli->hwndContactList,GWL_EXSTYLE)&~WS_EX_TOOLWINDOW); - - if (IsDlgButtonChecked(hwndDlg,IDC_ONDESKTOP)) { - HWND hProgMan = FindWindowA("Progman",NULL); - if (IsWindow(hProgMan)) SetParent(pcli->hwndContactList,hProgMan); - } else { - SetParent(pcli->hwndContactList,NULL); - } - - DBWriteContactSettingByte(NULL,"CLUI","ShowCaption",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)); - DBWriteContactSettingByte(NULL,"CLUI","ShowMainMenu",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWMAINMENU)); - DBWriteContactSettingByte(NULL,"CLUI","ClientAreaDrag",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CLIENTDRAG)); - - if (IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) - SetWindowLongPtr(pcli->hwndContactList,GWL_STYLE,GetWindowLongPtr(pcli->hwndContactList,GWL_STYLE)|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX); - else - SetWindowLongPtr(pcli->hwndContactList,GWL_STYLE,GetWindowLongPtr(pcli->hwndContactList,GWL_STYLE)&~(WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX)); - - if (!IsDlgButtonChecked(hwndDlg,IDC_SHOWMAINMENU)) SetMenu(pcli->hwndContactList,NULL); - else SetMenu(pcli->hwndContactList,hMenuMain); - - SetWindowPos(pcli->hwndContactList,0,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED); - RedrawWindow(pcli->hwndContactList,NULL,NULL,RDW_FRAME|RDW_INVALIDATE); - - DBWriteContactSettingByte(NULL,"CList","Min2Tray",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_MIN2TRAY)); - if (IsIconic(pcli->hwndContactList) && !IsDlgButtonChecked(hwndDlg,IDC_TOOLWND)) - ShowWindow(pcli->hwndContactList,IsDlgButtonChecked(hwndDlg,IDC_MIN2TRAY)?SW_HIDE:SW_SHOW); - - { TCHAR title[256]; - GetDlgItemText(hwndDlg,IDC_TITLETEXT,title,SIZEOF(title)); - DBWriteContactSettingTString(NULL,"CList","TitleText",title); - SetWindowText(pcli->hwndContactList,title); - } - DBWriteContactSettingByte(NULL,"CLUI","FadeInOut",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_FADEINOUT)); - DBWriteContactSettingByte(NULL,"CLUI","AutoSize",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)); - DBWriteContactSettingByte(NULL,"CLUI","MaxSizeHeight",(BYTE)GetDlgItemInt(hwndDlg,IDC_MAXSIZEHEIGHT,NULL,FALSE)); - DBWriteContactSettingByte(NULL,"CLUI","AutoSizeUpward",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZEUPWARD)); - DBWriteContactSettingByte(NULL,"CList","AutoHide",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); - DBWriteContactSettingWord(NULL,"CList","HideTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_GETPOS,0,0)); - - DBWriteContactSettingByte(NULL,"CList","Transparent",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)); - DBWriteContactSettingByte(NULL,"CList","Alpha",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_GETPOS,0,0)); - DBWriteContactSettingByte(NULL,"CList","AutoAlpha",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_GETPOS,0,0)); - DBWriteContactSettingByte(NULL,"CList","WindowShadow",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DROPSHADOW)); - DBWriteContactSettingByte(NULL,"CList","OnDesktop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONDESKTOP)); - if (IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)) { - SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); - if (MySetLayeredWindowAttributes) MySetLayeredWindowAttributes(pcli->hwndContactList, RGB(0,0,0), (BYTE)DBGetContactSettingByte(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA); - } - else { - SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED); - } - SendMessage(pcli->hwndContactTree,WM_SIZE,0,0); //forces it to send a cln_listsizechanged - - if (!ServiceExists("ExtraIcon/Register")) - { - DBWriteContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_PROTO",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EXTRA_PROTO)); - DBWriteContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_WEB",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EXTRA_WEB)); - DBWriteContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_EMAIL",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EXTRA_EMAIL)); - DBWriteContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_SMS",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EXTRA_CELLULAR)); - DBWriteContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_ADV1",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EXTRA_ADV1)); - DBWriteContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_ADV2",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EXTRA_ADV2)); - //SetAllExtraIcons() - ReAssignExtraIcons(); - } - - return TRUE; - } - break; - } - return FALSE; -} - -static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_SHOWSBAR, DBGetContactSettingByte(NULL,"CLUI","ShowSBar",1) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_USECONNECTINGICON, DBGetContactSettingByte(NULL,"CLUI","UseConnectingIcon",1) ? BST_CHECKED : BST_UNCHECKED); - { BYTE showOpts = DBGetContactSettingByte(NULL,"CLUI","SBarShow",1); - CheckDlgButton(hwndDlg, IDC_SHOWICON, showOpts&1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOWPROTO, showOpts&2 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOWSTATUS, showOpts&4 ? BST_CHECKED : BST_UNCHECKED); - } - CheckDlgButton(hwndDlg, IDC_RIGHTSTATUS, DBGetContactSettingByte(NULL,"CLUI","SBarRightClk",0) ? BST_UNCHECKED : BST_CHECKED); - CheckDlgButton(hwndDlg, IDC_RIGHTMIRANDA, !IsDlgButtonChecked(hwndDlg,IDC_RIGHTSTATUS) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, DBGetContactSettingByte(NULL,"CLUI","EqualSections",0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SBPANELBEVEL, DBGetContactSettingByte(NULL,"CLUI","SBarBevel",1) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOWSIZEGRIP, DBGetContactSettingByte(NULL,"CLUI","SBarUseSizeGrip",1) ? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hwndDlg, IDC_USEOWNERDRAW, DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",1) ? BST_CHECKED : BST_UNCHECKED); - - SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"CLUI","SBarBKColor",CLR_DEFAULT)); - - if (!IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)) { - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWICON),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWPROTO),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWSTATUS),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_RIGHTSTATUS),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_RIGHTMIRANDA),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_EQUALSECTIONS),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_SBPANELBEVEL),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWSIZEGRIP),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_USECONNECTINGICON),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_USEOWNERDRAW),FALSE); - - } - return TRUE; - case WM_COMMAND: - if (LOWORD(wParam) == IDC_SHOWSBAR) { - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWICON),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWPROTO),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWSTATUS),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); - EnableWindow(GetDlgItem(hwndDlg,IDC_RIGHTSTATUS),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); - EnableWindow(GetDlgItem(hwndDlg,IDC_RIGHTMIRANDA),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); - EnableWindow(GetDlgItem(hwndDlg,IDC_EQUALSECTIONS),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); - EnableWindow(GetDlgItem(hwndDlg,IDC_SBPANELBEVEL),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWSIZEGRIP),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); - EnableWindow(GetDlgItem(hwndDlg,IDC_USECONNECTINGICON),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); - EnableWindow(GetDlgItem(hwndDlg,IDC_USEOWNERDRAW),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); - - } - if (LOWORD(wParam) == IDC_DEFBKCOLOR) - { - SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,CLR_DEFAULT); - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - case WM_NOTIFY: - switch (((LPNMHDR)lParam)->code) - { - case PSN_APPLY: - { - int frameopt; - - COLORREF col; - col = SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_GETCOLOUR,0,0); - DBWriteContactSettingDword(NULL,"CLUI","SBarBKColor",col); - - - - DBWriteContactSettingByte(NULL,"CLUI","ShowSBar",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); - DBWriteContactSettingByte(NULL,"CLUI","SBarShow",(BYTE)((IsDlgButtonChecked(hwndDlg,IDC_SHOWICON)?1:0)|(IsDlgButtonChecked(hwndDlg,IDC_SHOWPROTO)?2:0)|(IsDlgButtonChecked(hwndDlg,IDC_SHOWSTATUS)?4:0))); - DBWriteContactSettingByte(NULL,"CLUI","SBarRightClk",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_RIGHTMIRANDA)); - DBWriteContactSettingByte(NULL,"CLUI","EqualSections",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EQUALSECTIONS)); - DBWriteContactSettingByte(NULL,"CLUI","SBarBevel",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SBPANELBEVEL)); - DBWriteContactSettingByte(NULL,"CLUI","SBarUseSizeGrip",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWSIZEGRIP)); - - DBWriteContactSettingByte(NULL,"CLUI","UseConnectingIcon",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USECONNECTINGICON)); - DBWriteContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USEOWNERDRAW)); - UseOwnerDrawStatusBar = DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",0); -/* - if (IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)) ShowWindow(pcli->hwndStatus,SW_SHOW); - else ShowWindow(pcli->hwndStatus,SW_HIDE); -*/ - - frameopt = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,hFrameHelperStatusBar),0); - - frameopt = frameopt & (~F_VISIBLE); - - if (IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)) { - ShowWindow(pcli->hwndStatus,SW_SHOW); - frameopt |= F_VISIBLE; - } - else ShowWindow(pcli->hwndStatus,SW_HIDE); - - CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,hFrameHelperStatusBar),frameopt); - - SendMessage(pcli->hwndContactList,WM_SIZE,0,0); - - OnStatusBarBackgroundChange(); - CluiProtocolStatusChanged(0,0); - return TRUE; - } - } - break; - } - return FALSE; -} diff --git a/plugins/Clist_mw/cluiservices.cpp b/plugins/Clist_mw/cluiservices.cpp deleted file mode 100644 index f75fbc9dac..0000000000 --- a/plugins/Clist_mw/cluiservices.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 "commonheaders.h" -#include "m_clc.h" -#include "m_clui.h" - -extern int CreateTimerForConnectingIcon(WPARAM,LPARAM); - -void FreeProtocolData( void ) -{ - //free protocol data - int nPanel; - int nParts = SendMessage(pcli->hwndStatus,SB_GETPARTS,0,0); - for (nPanel = 0;nPanelhwndStatus,SB_GETTEXT,(WPARAM)nPanel,(LPARAM)0); - if (PD != NULL && !IsBadCodePtr(( FARPROC )PD)) { - SendMessage(pcli->hwndStatus,SB_SETTEXT,(WPARAM)nPanel|SBT_OWNERDRAW,(LPARAM)0); - if (PD->RealName) mir_free(PD->RealName); - if (PD) mir_free(PD); -} } } - -void CluiProtocolStatusChanged(int parStatus, const char* szProto) -{ - int protoCount,i; - PROTOACCOUNT **accs; - int *partWidths,partCount; - int borders[3]; - int flags; - int FirstIconOffset; - - if ( pcli->hwndStatus == 0 ) - return; - - FirstIconOffset = DBGetContactSettingDword(NULL,"CLUI","FirstIconOffset",0); - - ProtoEnumAccounts( &protoCount, &accs ); - if ( protoCount == 0 ) - return; - - OutputDebugStringA("CluiProtocolStatusChanged"); - OutputDebugStringA("\r\n"); - FreeProtocolData(); - - SendMessage(pcli->hwndStatus,SB_GETBORDERS,0,(LPARAM)&borders); - - SendMessage(pcli->hwndStatus,SB_SETBKCOLOR,0,DBGetContactSettingDword(0,"CLUI","SBarBKColor",CLR_DEFAULT)); - partWidths = (int*)alloca((protoCount+1)*sizeof(int)); - //partWidths[0] = FirstIconOffset; - if (DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",0)||DBGetContactSettingByte(NULL,"CLUI","EqualSections",1)) - { - RECT rc; - int toshow, part; - - SendMessage(pcli->hwndStatus,WM_SIZE,0,0); - GetClientRect(pcli->hwndStatus,&rc); - rc.right -= borders[0]*2; - toshow = 0; - for (i = 0;ipfnGetProtocolVisibility( accs[i]->szModuleName )) - continue; - - toshow++; - } - - if (toshow>0) - { - for (part = 0,i = 0;ipfnGetProtocolVisibility( accs[i]->szModuleName )) - continue; - - partWidths[part] = ((part+1)*(rc.right/toshow))-(borders[2]>>1); - //partWidths[part] = 40*part+40; - part++; - } - //partCount = part; - } - partCount = toshow; - - } - else { - HDC hdc; - SIZE textSize; - BYTE showOpts = DBGetContactSettingByte(NULL,"CLUI","SBarShow",5); - DWORD extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0); - DWORD startoffset = DBGetContactSettingDword(NULL,"StatusBar","FirstIconOffset",0); - int x; - - hdc = GetDC(pcli->hwndStatus); - - for (partCount = 0,i = 0;ipfnGetAccountIndexByPos(i); - if (ind < 0) - continue; - - if (!pcli->pfnGetProtocolVisibility(accs[ind]->szModuleName)) - continue; - - x = 2; - if (showOpts & 1) x += GetSystemMetrics(SM_CXSMICON); - if (showOpts & 2) { - TCHAR szName[64]; - mir_sntprintf(szName, SIZEOF(szName), _T("%s%s"), accs[ind]->tszAccountName, showOpts&4 ? _T(" ") : _T("")); - GetTextExtentPoint32(hdc, szName, (int)_tcslen(szName), &textSize); - x += textSize.cx; - } - if (showOpts & 4) { - int status = CallProtoService(accs[ind]->szModuleName, PS_GETSTATUS, 0, 0); - TCHAR *szStatus = pcli->pfnGetStatusModeDescription(status, 0); - if (!szStatus) - szStatus = _T(""); - GetTextExtentPoint32(hdc, szStatus, (int)_tcslen(szStatus), &textSize); - x += textSize.cx; - } - if (showOpts&6) x += 2; - partWidths[partCount] = (partCount?partWidths[partCount-1]:startoffset)+x+extraspace; - partCount++; - } - ReleaseDC(pcli->hwndStatus,hdc); - } - if (partCount == 0) { - SendMessage(pcli->hwndStatus,SB_SIMPLE,TRUE,0); - return; - } - SendMessage(pcli->hwndStatus,SB_SIMPLE,FALSE,0); - - partWidths[partCount-1] = -1; - - SendMessage(pcli->hwndStatus,SB_SETMINHEIGHT,GetSystemMetrics(SM_CYSMICON)+2,0); - SendMessage(pcli->hwndStatus,SB_SETPARTS,partCount,(LPARAM)partWidths); - - flags = SBT_OWNERDRAW; - if ( !DBGetContactSettingByte(NULL, "CLUI", "SBarBevel", 1)) - flags |= SBT_NOBORDERS; - - for (partCount = 0, i = 0; ipfnGetAccountIndexByPos(i); - if (ind < 0) continue; - - if (!pcli->pfnGetProtocolVisibility(accs[ind]->szModuleName)) - continue; - - ProtocolData *PD = (ProtocolData*)mir_alloc(sizeof(ProtocolData)); - PD->RealName = mir_strdup(accs[ind]->szModuleName); - PD->protopos = accs[ind]->iOrder; - - SendMessage(pcli->hwndStatus, SB_SETTEXT, partCount++ | flags, (LPARAM)PD); - } - - CreateTimerForConnectingIcon(parStatus, (LPARAM)szProto); - InvalidateRect(pcli->hwndStatus, NULL, FALSE); - return; -} diff --git a/plugins/Clist_mw/commonheaders.cpp b/plugins/Clist_mw/commonheaders.cpp deleted file mode 100644 index df68c5385c..0000000000 --- a/plugins/Clist_mw/commonheaders.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "commonheaders.h" - -#define SAFE_PTR(a) a?(IsBadReadPtr(a,1)?a = NULL:a):a - -int __cdecl MyStrCmp (const char *a, const char *b) -{ - SAFE_PTR(a); - SAFE_PTR(b); - if ( !(a && b)) return a != b; - return (strcmp(a,b)); -} - -DWORD exceptFunction(LPEXCEPTION_POINTERS EP) -{ - //printf("1 "); // printed first - char buf[4096]; - - - sprintf(buf,"\r\nExceptCode: %x\r\nExceptFlags: %x\r\nExceptAddress: %p\r\n", - EP->ExceptionRecord->ExceptionCode, - EP->ExceptionRecord->ExceptionFlags, - EP->ExceptionRecord->ExceptionAddress - ); - OutputDebugStringA(buf); - MessageBoxA(0,buf,"clist_mw Exception",0); - - - return EXCEPTION_EXECUTE_HANDLER; -} diff --git a/plugins/Clist_mw/commonheaders.h b/plugins/Clist_mw/commonheaders.h deleted file mode 100644 index bee4da96c1..0000000000 --- a/plugins/Clist_mw/commonheaders.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2004 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 _COMMON_HEADERS_H_ -#define _COMMON_HEADERS_H_ 1 - -#define MIRANDA_VER 0x0A00 - -#define _WIN32_WINNT 0x0501 -#define _WIN32_IE 0x0501 - -#include "m_stdhdr.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "m_genmenu.h" -#include "m_clui.h" - -#include "clc.h" -#include "clist.h" -#include "m_icolib.h" -#include -#include "CLUIFrames/cluiframes.h" -#include "m_cluiframes.h" -#include "m_metacontacts.h" -#include "BkgrCfg.h" -#include -#include -#include "m_fontservice.h" - -// shared vars -extern HINSTANCE g_hInst; - -/* most free()'s are invalid when the code is executed from a dll, so this changes - all the bad free()'s to good ones, however it's still incorrect code. The reasons for not - changing them include: - - * DBFreeVariant has a CallService() lookup - * free() is executed in some large loops to do with clist creation of group data - * easy search and replace - -*/ - -#ifndef CS_DROPSHADOW -#define CS_DROPSHADOW 0x00020000 -#endif - -extern BOOL __cdecl strstri(const char *a, const char *b); -extern BOOL __cdecl boolstrcmpi(const char *a, const char *b); -extern int __cdecl MyStrCmp (const char *a, const char *b); -extern int __cdecl MyStrLen (const char *a); -extern int __cdecl MyStrCmpi(const char *a, const char *b); -extern int __cdecl MyStrCmpiT(const TCHAR *a, const TCHAR *b); - -extern DWORD exceptFunction(LPEXCEPTION_POINTERS EP); - -extern int ( *saveIconFromStatusMode )( const char *szProto,int nStatus, HANDLE hContact); - -//from bkg options - -// 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 "BkgrCfg/Register" - -// -// Notification about changed background -// wParam = ModuleName -// lParam = 0 -#define ME_BACKGROUNDCONFIG_CHANGED "BkgrCfg/Changed" - - - -#define EXTRACOLUMNCOUNT 9 - - -#endif diff --git a/plugins/Clist_mw/contact.cpp b/plugins/Clist_mw/contact.cpp deleted file mode 100644 index d8cf0f37d4..0000000000 --- a/plugins/Clist_mw/contact.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 "commonheaders.h" -#include "m_clui.h" -#include "clist.h" - -extern HANDLE hContactIconChangedEvent; -extern int GetContactCachedStatus(HANDLE hContact); -extern char *GetContactCachedProtocol(HANDLE hContact); - -int sortByStatus; -static int sortByProto; -static int sortNoOfflineBottom; -struct { - int status,order; -} statusModeOrder[] = { - {ID_STATUS_OFFLINE,500}, - {ID_STATUS_ONLINE,0}, - {ID_STATUS_AWAY,200}, - {ID_STATUS_DND,400}, - {ID_STATUS_NA,450}, - {ID_STATUS_OCCUPIED,100}, - {ID_STATUS_FREECHAT,50}, - {ID_STATUS_INVISIBLE,20}, - {ID_STATUS_ONTHEPHONE,150}, - {ID_STATUS_OUTTOLUNCH,425}}; - -static int GetContactStatus(HANDLE hContact) -{ - /* - - char *szProto; - - szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); - if (szProto == NULL) return ID_STATUS_OFFLINE; - return DBGetContactSettingWord(hContact,szProto,"Status",ID_STATUS_OFFLINE); - */ - return (GetContactCachedStatus(hContact)); -} - -void ChangeContactIcon(HANDLE hContact,int iIcon,int add) -{ - //clui MS_CLUI_CONTACTADDED MS_CLUI_CONTACTSETICON this methods is null - //CallService(add?MS_CLUI_CONTACTADDED:MS_CLUI_CONTACTSETICON,(WPARAM)hContact,iIcon); - NotifyEventHooks(hContactIconChangedEvent,(WPARAM)hContact,iIcon); -} - -static int GetStatusModeOrdering(int statusMode) -{ - int i; - for (i = 0; i< SIZEOF(statusModeOrder); i++) - if (statusModeOrder[i].status == statusMode) return statusModeOrder[i].order; - return 1000; -} - -void LoadContactTree(void) -{ - HANDLE hContact; - int i,hideOffline,status,tick; - pdisplayNameCacheEntry cacheEntry; - - - - tick = GetTickCount(); - CallService(MS_CLUI_LISTBEGINREBUILD,0,0); - for (i = 1;;i++) { - if ((char*)CallService(MS_CLIST_GROUPGETNAME2,i,(LPARAM)(int*)NULL) == NULL) break; - CallService(MS_CLUI_GROUPADDED,i,0); - } - - hideOffline = DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT); - hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); - - while(hContact != NULL) { - cacheEntry = GetContactFullCacheEntry(hContact); - if (cacheEntry == NULL) - { - MessageBoxA(0,"Fail To Get CacheEntry for hContact","!!!!!",0); - break; - } - status = cacheEntry->status; - if ((!hideOffline || status != ID_STATUS_OFFLINE) && !cacheEntry->bIsHidden) - ChangeContactIcon(hContact,ExtIconFromStatusMode(hContact,(char*)cacheEntry->szProto,status),1); - hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0); - } - sortByStatus = DBGetContactSettingByte(NULL,"CList","SortByStatus",SETTING_SORTBYSTATUS_DEFAULT); - sortByProto = DBGetContactSettingByte(NULL,"CList","SortByProto",SETTING_SORTBYPROTO_DEFAULT); - sortNoOfflineBottom = DBGetContactSettingByte(NULL,"CList","NoOfflineBottom",SETTING_NOOFFLINEBOTTOM_DEFAULT); - - CallService(MS_CLUI_SORTLIST,0,0); - CallService(MS_CLUI_LISTENDREBUILD,0,0); - - tick = GetTickCount()-tick; - { - char buf[255]; - //sprintf(buf,"%s %s took %i ms",__FILE__,__LINE__,tick); - sprintf(buf,"LoadContactTree %d \r\n",tick); - - OutputDebugStringA(buf); - } -} - -#define SAFESTRING(a) a?a:"" - -int CompareContacts( const struct ClcContact *contact1, const struct ClcContact *contact2 ) -{ - HANDLE a = contact1->hContact, b = contact2->hContact; - TCHAR *namea,*nameb; - int statusa,statusb; - char *szProto1,*szProto2; - int rc; - - GetContactInfosForSort(a,&szProto1,&namea,&statusa); - GetContactInfosForSort(b,&szProto2,&nameb,&statusb); - - if (sortByProto) { - - /* deal with statuses, online contacts have to go above offline */ - if (sortNoOfflineBottom == 0) - if ((statusa == ID_STATUS_OFFLINE) != (statusb == ID_STATUS_OFFLINE)) { - return 2*(statusa == ID_STATUS_OFFLINE)-1; - } - /* both are online, now check protocols */ - rc = strcmp(SAFESTRING(szProto1),SAFESTRING(szProto2)); /* strcmp() doesn't like NULL so feed in "" as needed */ - if (rc != 0 && (szProto1 != NULL && szProto2 != NULL)) return rc; - /* protocols are the same, order by display name */ - } - - if (sortByStatus) { - int ordera,orderb; - ordera = GetStatusModeOrdering(statusa); - orderb = GetStatusModeOrdering(statusb); - if (ordera != orderb) return ordera-orderb; - } - else { - //one is offline: offline goes below online - if (sortNoOfflineBottom == 0) - { - if ((statusa == ID_STATUS_OFFLINE) != (statusb == ID_STATUS_OFFLINE)) { - return 2*(statusa == ID_STATUS_OFFLINE)-1; - } - } - } - - //otherwise just compare names - return _tcsicmp(namea,nameb); -} - -#undef SAFESTRING - -static UINT_PTR resortTimerId = 0; -static VOID CALLBACK SortContactsTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD dwTime) -{ - KillTimer(NULL,resortTimerId); - resortTimerId = 0; - CallService(MS_CLUI_SORTLIST,0,0); -} - -void SortContacts(void) -{ - //avoid doing lots of resorts in quick succession - sortByStatus = DBGetContactSettingByte(NULL,"CList","SortByStatus",SETTING_SORTBYSTATUS_DEFAULT); - sortByProto = DBGetContactSettingByte(NULL,"CList","SortByProto",SETTING_SORTBYPROTO_DEFAULT); - if (resortTimerId) KillTimer(NULL,resortTimerId); - resortTimerId = SetTimer(NULL,0,50,SortContactsTimer); -} - -INT_PTR ContactChangeGroup(WPARAM wParam,LPARAM lParam) -{ - CallService(MS_CLUI_CONTACTDELETED,wParam,0); - if ((HANDLE)lParam == NULL) - DBDeleteContactSetting((HANDLE)wParam,"CList","Group"); - else - DBWriteContactSettingString((HANDLE)wParam,"CList","Group",(char*)CallService(MS_CLIST_GROUPGETNAME2,lParam,(LPARAM)(int*)NULL)); - CallService(MS_CLUI_CONTACTADDED,wParam,ExtIconFromStatusMode((HANDLE)wParam,(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0),GetContactStatus((HANDLE)wParam))); - return 0; -} diff --git a/plugins/Clist_mw/docs/clist_mw-translation.txt b/plugins/Clist_mw/docs/clist_mw-translation.txt new file mode 100644 index 0000000000..769c437319 --- /dev/null +++ b/plugins/Clist_mw/docs/clist_mw-translation.txt @@ -0,0 +1,230 @@ +; Common strings that belong to many files +;[&About] +;[&Delete Group] +;[&Find/Add Contacts...] +;[&Hide Offline Users] +;[&Hide Offline Users in here] +;[&Hide/Show] +;[&Main Menu] +;[&New Group] +;[&Options...] +;[&Rename Group] +;[&Status] +;[Contact List] +;[Disable &Groups] +;[E&xit] +;[Groups] +;[Hide &Empty Groups] +;[Hide &Offline Users out here] +;[Status Bar] +;[Window] + +; ../../plugins/Clist_mw/BkgrCfg.cpp +;[Backgrounds] +;[Customize] + +; ../../plugins/Clist_mw/CLUIFrames/cluiframes.cpp +;[&Align] +;[&Border] +;[&Bottom] +;[&Client] +;[&Collapsed] +;[&Down] +;[&Floating Mode] +;[&FrameTitle] +;[&Locked] +;[&Position] +;[&Show TitleBar] +;[&Top] +;[&Up] +;[&Visible] +;[Floating] +;[Frames] +;[Hide All Titlebars] +;[Lock Frame] +;[New Menu System not Found...] +;[Show All Frames] +;[Show All Titlebars] +;[Show TitleBar] +;[TitleBarFont] +;[Visible] + +; ../../plugins/Clist_mw/clcfonts.cpp +;[Background] +;[Contacts which are 'not on list'] +;[Dividers] +;[Group Closed] +;[Group member counts] +;[Hottrack Text] +;[Hover Contacts] +;[Offline contacts] +;[Offline contacts to whom you have a different visibility] +;[Online contacts to whom you have a different visibility] +;[Quicksearch Text] +;[Selected Text] +;[Standard contacts] +;[Status messages] + +; ../../plugins/Clist_mw/clcopts.cpp +;[List] +;[List Background] +;[List MetaContacts] +;[StatusBar Background] + +; ../../plugins/Clist_mw/clistopts.cpp +;[Global] + +; ../../plugins/Clist_mw/clistsettings.cpp +;[(Unknown Contact)] +;[_NoProtocol_] + +; ../../plugins/Clist_mw/clui.cpp +;[My Contacts] + +; ../../plugins/Clist_mw/groupmenu.cpp +;[&New SubGroup] + +; ../../plugins/Clist_mw/keyboard.cpp +;[Close Miranda] +;[Restore last status] + +; ../../plugins/Clist_mw/resource.rc +;[!!! Note: all client icons are made by Angeli-ka, and I have her permission to use them in clist_mw plugin.] +;[% of screen] +;[&Away\tCtrl+2] +;[&DND\tCtrl+5] +;[&Free for chat\tCtrl+6] +;[&Invisible\tCtrl+7] +;[&NA\tCtrl+3] +;[&New Subgroup] +;[&Offline\tCtrl+0] +;['Hide Offline' means to hide:] +;[Active opacity:] +;[Advanced #1] +;[Advanced #2] +;[Always on top] +;[Always show status in tooltip] +;[Are you sure you want to delete %s?] +;[Ask before deleting contacts] +;[Automatically resize window to height of list] +;[Avoid doubleclick expand] +;[Background colour:] +;[Cellular] +;[Contact List Background] +;[Contact List Extra Icons] +;[Contact List Sorting] +;[Cycle icons every] +;[Default] +;[Delete Contact] +;[Dim idle contacts] +;[Disable drag and drop of items] +;[Disable groups] +;[Disable icon blinking] +;[Disable rename of items by clicking twice] +;[Dont move offline user to bottom] +;[Draw a line alongside group names] +;[E-mail] +;[Easy move] +;[Enable drop shadow (restart required)] +;[Fade contact list in/out] +;[Gamma correction] +;[Grey out entire list when:] +;[Group] +;[Hide Miranda] +;[Hide all 'Extra icons' for subcontacts] +;[Hide contact list after it has been idle for] +;[Hide empty groups] +;[Hide from list only, in order to keep their history and ignore/visibility settings] +;[Hide group counts when there are none online] +;[Hide offline subcontacts.] +;[Hide offline users] +;[Hide vertical scrollbar] +;[Homepage] +;[Hot track items as mouse passes over] +;[If window is partially covered, bring to front instead of hiding] +;[Ignore Empty Extra icons places (arrange to right).] +;[Inactive opacity:] +;[Indent groups by:] +;[InsertSeparator] +;[Items] +;[Left margin:] +;[Make sections equal width] +;[Make selection highlight translucent] +;[MenuItems] +;[MenuObjects] +;[MetaContacts supporting] +;[Minimize to tray] +;[Name:] +;[No] +;[Nowhere] +;[Occ&upied\tCtrl+4] +;[On the &Phone\tCtrl+8] +;[On&line\tCtrl+1] +;[Only when statuses differ] +;[Out to &Lunch\tCtrl+9] +;[Pin to desktop] +;[Protocol Type] +;[Quicksearch in open groups only] +;[Right click opens Miranda menu] +;[Right click opens status menu] +;[Row height:] +;[Rows] +;[Scroll list smoothly] +;[Scroll with text] +;[Selection colour:] +;[Service:] +;[Set] +;[Settings] +;[Show] +;[Show bevel effect on panels] +;[Show counts of number of contacts in a group] +;[Show divider between online and offline contacts] +;[Show icons] +;[Show menu bar] +;[Show multiple icons] +;[Show protocol names] +;[Show selection even when list is not focused] +;[Show size grip] +;[Show status bar] +;[Show status text] +;[Show title bar] +;[Single click interface] +;[Size upwards] +;[Slider2] +;[Sort contacts by name] +;[Sort contacts by protocol] +;[Sort contacts by status] +;[Sort groups alphabetically] +;[Spin1] +;[Spin5] +;[Stretch proportionally] +;[Stretch to height] +;[Stretch to width] +;[System tray icon] +;[System tray icon when using multiple protocols] +;[This will erase all history and settings for this contact!] +;[Tile horizontally] +;[Tile vertically] +;[Tile vertically according to Row Height] +;[Time:] +;[Title bar text:] +;[Tool style main window] +;[Translucency options (Windows 2000/XP only)] +;[Transparent contact list] +;[Tray] +;[Tree2] +;[Use 'Meta' protocol icons for Metacontacts] +;[Use New Drawer for StatusBar] +;[Use Options->Ignore (expert mode) to unhide contacts.] +;[Use background bitmap] +;[Use connecting Icon] +;[Visual] +;[Warning!\r\nThis MenuObject not support user defined options.] +;[Yes] +;[icon when statuses differ] +;[maximum] +;[milliseconds] +;[ms, delay between icon blinking] +;[pixels] +;[seconds] +;[seconds, when statuses differ] diff --git a/plugins/Clist_mw/groupmenu.cpp b/plugins/Clist_mw/groupmenu.cpp deleted file mode 100644 index 496f98e78c..0000000000 --- a/plugins/Clist_mw/groupmenu.cpp +++ /dev/null @@ -1,651 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 "commonheaders.h" -#include "m_clui.h" -#include "clist.h" -#include "clc.h" - -//////////////////////////////Group MENU///////////////////////// - -extern HANDLE hHideShowMainMenuItem; -HANDLE hGroupMenuObject; - -HANDLE hGroupMainMenuItemProxy; -HANDLE hGroupStatusMenuItemProxy; -HANDLE hPreBuildGroupMenuEvent; - -HANDLE hHideOfflineUsersMenuItem; -HANDLE hHideOfflineUsersOutHereMenuItem; -HANDLE hHideEmptyGroupsMenuItem; -HANDLE hDisableGroupsMenuItem; -HANDLE hNewGroupMenuItem; -HANDLE hNewSubGroupMenuItem; - -int NewGroupIconidx; - -extern HIMAGELIST hCListImages; -HICON LoadIconFromExternalFile(char *filename,int i,boolean UseLibrary,boolean registerit,char *IconName,char *SectName,char *Description,int internalidx,HICON DefIcon); - -void InitSubGroupMenus(void); - -//Groupmenu exec param(ownerdata) -typedef struct{ -char *szServiceName; -int Param1,Param2; -}GroupMenuExecParam,*lpGroupMenuExecParam; - -/* -wparam = handle to the menu item returned by MS_CLIST_ADDCONTACTMENUITEM -return 0 on success. -*/ -static INT_PTR RemoveGroupMenuItem(WPARAM wParam,LPARAM lParam) -{ - CallService(MO_REMOVEMENUITEM,wParam,0); - return 0; -} - - -static INT_PTR BuildGroupMenu(WPARAM wParam,LPARAM lParam) -{ - int tick; - HMENU hMenu; - ListParam param = { 0 }; - param.MenuObjectHandle = hGroupMenuObject; - - //hMenu = hMainMenu; - hMenu = CreatePopupMenu(); - //hMenu = wParam; - tick = GetTickCount(); - - NotifyEventHooks(hPreBuildGroupMenuEvent,0,0); - - CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m); - //DrawMenuBar((HWND)CallService("CLUI/GetHwnd",0,0)); - tick = GetTickCount()-tick; - return (INT_PTR)hMenu; -} - -static INT_PTR AddGroupMenuItem(WPARAM wParam,LPARAM lParam) -{ - TMO_MenuItem tmi; - CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; - if ( !pcli->pfnConvertMenu(mi, &tmi)) - return 0; - - lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)mir_calloc(sizeof(GroupMenuExecParam)); - if (mmep == NULL) - return 0; - - //we need just one parametr. - mmep->szServiceName = mir_strdup(mi->pszService); - mmep->Param1 = mi->popupPosition; - lpGroupMenuParam gmp = (lpGroupMenuParam)wParam; - if (gmp != NULL) { - mmep->Param1 = gmp->wParam; - mmep->Param2 = gmp->lParam; - } - tmi.ownerdata = mmep; - - char buf[1024]; - sprintf(buf,"%s/%s",mi->pszService,mi->pszName); - - OptParam op; - op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hGroupMenuObject,(LPARAM)&tmi); - op.Setting = OPT_MENUITEMSETUNIQNAME; - op.Value = (INT_PTR)buf; - CallService(MO_SETOPTIONSMENUITEM,(WPARAM)0,(LPARAM)&op); - return (INT_PTR)op.Handle; - -// mainItemCount++; -// return MENU_CUSTOMITEMMAIN|(mainMenuItem[mainItemCount-1].id); -} - -INT_PTR GroupMenuCheckService(WPARAM wParam,LPARAM lParam) { -//not used - return 0; -} - -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 = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0); - } - - if (hGroupStatusMenuItemProxy == (HANDLE)lParam) { - mii->fMask |= MIIM_SUBMENU; - mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); - } - - 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 (!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 wParam,LPARAM lParam) -{ - - lpGroupMenuExecParam mmep; - mmep = (lpGroupMenuExecParam)lParam; - if (mmep != NULL){ - FreeAndNil((void**)&mmep->szServiceName); - FreeAndNil((void**)&mmep); - } - -return 0; -} - -INT_PTR HideGroupsHelper(WPARAM wParam,LPARAM lParam) -{ - int newVal = !(GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_HIDEEMPTYGROUPS); - DBWriteContactSettingByte(NULL,"CList","HideEmptyGroups",(BYTE)newVal); - SendMessage(pcli->hwndContactTree,CLM_SETHIDEEMPTYGROUPS,newVal,0); - return 0; -} - -INT_PTR UseGroupsHelper(WPARAM wParam,LPARAM lParam) -{ - int newVal = !(GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_USEGROUPS); - DBWriteContactSettingByte(NULL,"CList","UseGroups",(BYTE)newVal); - SendMessage(pcli->hwndContactTree,CLM_SETUSEGROUPS,newVal,0); - return 0; -} - -INT_PTR HideOfflineRootHelper(WPARAM wParam,LPARAM lParam) -{ -SendMessage( - pcli->hwndContactTree, - CLM_SETHIDEOFFLINEROOT, - !SendMessage(pcli->hwndContactTree,CLM_GETHIDEOFFLINEROOT,0,0), - 0); - return 0; -} - -static int OnBuildGroupMenu(WPARAM wParam,LPARAM lParam) -{ - CLISTMENUITEM mi; - - - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.flags = CMIM_FLAGS | (DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CMIF_CHECKED:0); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersMenuItem, (LPARAM)&mi); - - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.flags = CMIM_FLAGS | (SendMessage(pcli->hwndContactTree,CLM_GETHIDEOFFLINEROOT,0,0)?CMIF_CHECKED:0); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersOutHereMenuItem, (LPARAM)&mi); - - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_HIDEEMPTYGROUPS?CMIF_CHECKED:0); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideEmptyGroupsMenuItem, (LPARAM)&mi); - - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_USEGROUPS?0:CMIF_CHECKED); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hDisableGroupsMenuItem, (LPARAM)&mi); - - return 0; -} - -int static OnIconLibIconChanged(WPARAM wParam,LPARAM lParam) -{ - HICON hicon; - CLISTMENUITEM clmi = {0}; - - hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,FALSE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP,0); - NewGroupIconidx = ImageList_ReplaceIcon(hCListImages,NewGroupIconidx,hicon); - - clmi.cbSize = sizeof(clmi); - clmi.flags = CMIM_ICON; - clmi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0); - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewSubGroupMenuItem,(LPARAM)&clmi); - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewGroupMenuItem,(LPARAM)&clmi); - return 0; -} - -void InitGroupMenus(void) -{ - TMenuParam tmp; - OptParam op; - HICON hicon; - hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,TRUE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP2,0); - NewGroupIconidx = ImageList_AddIcon(hCListImages,hicon ); - - 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("CList/AddGroupMenuItem",AddGroupMenuItem); - CreateServiceFunction(MS_CLIST_REMOVEGROUPMENUITEM,RemoveGroupMenuItem); - CreateServiceFunction(MS_CLIST_MENUBUILDGROUP,BuildGroupMenu); - hPreBuildGroupMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDGROUPMENU); - HookEvent(ME_CLIST_PREBUILDGROUPMENU,OnBuildGroupMenu); - - InitSubGroupMenus(); - - //Group menu - memset(&tmp,0,sizeof(tmp)); - tmp.cbSize = sizeof(tmp); - tmp.CheckService = NULL; - tmp.ExecService = "CLISTMENUSGroup/ExecService"; - tmp.name = "Group Menu"; - hGroupMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp); - - - op.Handle = hGroupMenuObject; - op.Setting = OPT_USERDEFINEDITEMS; - op.Value = TRUE; - CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); - - op.Handle = hGroupMenuObject; - op.Setting = OPT_MENUOBJECT_SET_FREE_SERVICE; - op.Value = (INT_PTR)"CLISTMENUSGroup/FreeOwnerDataGroupMenu"; - CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); - - op.Handle = hGroupMenuObject; - op.Setting = OPT_MENUOBJECT_SET_ONADD_SERVICE; - op.Value = (INT_PTR)"CLISTMENUSGroup/GroupMenuonAddService"; - CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); - - { - //add exit command to menu - CLISTMENUITEM mi; - GroupMenuParam gmp; - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 1900000; - mi.pszService = "CloseAction"; - mi.pszName = LPGEN("E&xit"); - AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 500; - mi.pszService = MS_CLIST_SHOWHIDE; - mi.pszName = LPGEN("&Hide/Show"); - hHideShowMainMenuItem = (HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 200000; - mi.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_FINDUSER)); - mi.pszService = "FindAdd/FindAddCommand"; - mi.pszName = LPGEN("&Find/Add Contacts..."); - AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 300000; - mi.pszService = ""; - mi.pszName = LPGEN("&Main Menu"); - hGroupMainMenuItemProxy = (HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 300100; - mi.pszService = ""; - mi.pszName = LPGEN("&Status"); - hGroupStatusMenuItemProxy = (HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 400000; - mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_OPTIONS)); - mi.pszService = "Options/OptionsCommand"; - mi.pszName = LPGEN("&Options..."); - - AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 500000; - mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_CLIENTMIRANDA)); - mi.pszService = "Help/AboutCommand"; - mi.pszName = LPGEN("&About"); - - //AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 100000; - mi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0); - mi.pszService = MS_CLIST_GROUPCREATE; - mi.pszName = LPGEN("&New Group"); - hNewGroupMenuItem = (HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 100001; - mi.hIcon = NULL; - mi.pszService = MS_CLIST_SETHIDEOFFLINE; - mi.pszName = LPGEN("&Hide Offline Users"); - gmp.lParam = 0;gmp.wParam = -1; - hHideOfflineUsersMenuItem = (HANDLE)AddGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 100002; - mi.hIcon = NULL; - mi.pszService = "CLISTMENUSGroup/HideOfflineRootHelper"; - mi.pszName = LPGEN("Hide &Offline Users out here"); - hHideOfflineUsersOutHereMenuItem = (HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 100003; - mi.hIcon = NULL; - mi.pszService = "CLISTMENUSGroup/HideGroupsHelper"; - mi.pszName = LPGEN("Hide &Empty Groups"); - hHideEmptyGroupsMenuItem = (HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 100004; - mi.hIcon = NULL; - mi.pszService = "CLISTMENUSGroup/UseGroupsHelper"; - mi.pszName = LPGEN("Disable &Groups"); - hDisableGroupsMenuItem = (HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - - HookEvent(ME_SKIN2_ICONSCHANGED,OnIconLibIconChanged); - - //MS_CLIST_GROUPCREATE - - } -} - -//////////////////////////////END Group MENU///////////////////////// - - - - -//////////////////////////////SubGroup MENU///////////////////////// -HANDLE hSubGroupMenuObject; - -HANDLE hSubGroupMainMenuItemProxy; -HANDLE hSubGroupStatusMenuItemProxy; -HANDLE hPreBuildSubGroupMenuEvent; -HANDLE hHideOfflineUsersHereMenuItem; - -//SubGroupmenu exec param(ownerdata) -typedef struct{ -char *szServiceName; -int Param1,Param2; -}SubGroupMenuExecParam,*lpSubGroupMenuExecParam; - -/* -wparam = handle to the menu item returned by MS_CLIST_ADDCONTACTMENUITEM -return 0 on success. -*/ -static INT_PTR RemoveSubGroupMenuItem(WPARAM wParam,LPARAM lParam) -{ - CallService(MO_REMOVEMENUITEM,wParam,0); - return 0; -} - -static int OnBuildSubGroupMenu(WPARAM wParam,LPARAM lParam) -{ - CLISTMENUITEM mi; - struct ClcGroup *group = (struct ClcGroup *)wParam; - if (wParam == 0) return 0; - - //contact->group - - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.flags = CMIM_FLAGS | (group->hideOffline?CMIF_CHECKED:0); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersHereMenuItem, (LPARAM)&mi); - - return 0; -} -static INT_PTR BuildSubGroupMenu(WPARAM wParam,LPARAM lParam) -{ - int tick; - HMENU hMenu; - ListParam param = { 0 }; - param.MenuObjectHandle = hSubGroupMenuObject; - param.wParam = wParam; - - //hMenu = hMainMenu; - hMenu = CreatePopupMenu(); - //hMenu = wParam; - tick = GetTickCount(); - - NotifyEventHooks(hPreBuildSubGroupMenuEvent,wParam,0); - - CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m); - //DrawMenuBar((HWND)CallService("CLUI/GetHwnd",0,0)); - tick = GetTickCount()-tick; - return (INT_PTR)hMenu; -} - -static INT_PTR AddSubGroupMenuItem(WPARAM wParam,LPARAM lParam) -{ - TMO_MenuItem tmi; - CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; - if ( !pcli->pfnConvertMenu(mi, &tmi)) - return 0; - - lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)mir_calloc(sizeof(SubGroupMenuExecParam)); - if ( mmep == NULL) - return 0; - - //we need just one parametr. - mmep->szServiceName = mir_strdup(mi->pszService); - mmep->Param1 = mi->popupPosition; - lpGroupMenuParam gmp = (lpGroupMenuParam)wParam; - if ( gmp != NULL ) { - mmep->Param1 = gmp->wParam; - mmep->Param2 = gmp->lParam; - } - tmi.ownerdata = mmep; - - char buf[1024]; - sprintf(buf,"%s/%s",mi->pszService,mi->pszName); - - OptParam op; - op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hSubGroupMenuObject,(LPARAM)&tmi); - op.Setting = OPT_MENUITEMSETUNIQNAME; - op.Value = (INT_PTR)buf; - CallService(MO_SETOPTIONSMENUITEM,(WPARAM)0,(LPARAM)&op); - return (INT_PTR)op.Handle; -} - -INT_PTR SubGroupMenuCheckService(WPARAM wParam,LPARAM lParam) -{ - return 0; -} - -INT_PTR SubGroupMenuonAddService(WPARAM wParam,LPARAM 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 (!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 FreeOwnerDataSubGroupMenu (WPARAM wParam,LPARAM lParam) -{ - lpSubGroupMenuExecParam mmep; - mmep = (lpSubGroupMenuExecParam)lParam; - if (mmep != NULL) { - FreeAndNil((void**)&mmep->szServiceName); - FreeAndNil((void**)&mmep); - } - - return 0; -} - -//wparam menu handle to pass to clc.c -INT_PTR GroupMenuExecProxy(WPARAM wParam,LPARAM lParam) -{ - SendMessage(pcli->hwndContactTree,WM_COMMAND,wParam,0); - return 0; -} - -void InitSubGroupMenus(void) -{ - TMenuParam tmp; - OptParam op; - - CreateServiceFunction("CLISTMENUSSubGroup/ExecService",SubGroupMenuExecService); - CreateServiceFunction("CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu",FreeOwnerDataSubGroupMenu); - CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuonAddService",SubGroupMenuonAddService); - CreateServiceFunction("CLISTMENUSSubGroup/GroupMenuExecProxy",GroupMenuExecProxy); - - CreateServiceFunction("CList/AddSubGroupMenuItem",AddSubGroupMenuItem); - CreateServiceFunction(MS_CLIST_REMOVESUBGROUPMENUITEM,RemoveSubGroupMenuItem); - CreateServiceFunction(MS_CLIST_MENUBUILDSUBGROUP,BuildSubGroupMenu); - hPreBuildSubGroupMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDSUBGROUPMENU); - HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU,OnBuildSubGroupMenu); - - //SubGroup menu - memset(&tmp,0,sizeof(tmp)); - tmp.cbSize = sizeof(tmp); - tmp.CheckService = NULL; - tmp.ExecService = "CLISTMENUSSubGroup/ExecService"; - tmp.name = "SubGroupMenu"; - hSubGroupMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp); - - - op.Handle = hSubGroupMenuObject; - op.Setting = OPT_USERDEFINEDITEMS; - op.Value = TRUE; - CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); - - op.Handle = hSubGroupMenuObject; - op.Setting = OPT_MENUOBJECT_SET_FREE_SERVICE; - op.Value = (INT_PTR)"CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu"; - CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); - - op.Handle = hSubGroupMenuObject; - op.Setting = OPT_MENUOBJECT_SET_ONADD_SERVICE; - op.Value = (INT_PTR)"CLISTMENUSSubGroup/SubGroupMenuonAddService"; - CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); - - { - //add exit command to menu - CLISTMENUITEM mi; - GroupMenuParam gmp; - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 1000; - mi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0); - mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; - mi.pszName = LPGEN("&New SubGroup"); - gmp.lParam = 0;gmp.wParam = POPUP_NEWSUBGROUP; - hNewSubGroupMenuItem = (HANDLE)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 1001; - mi.hIcon = NULL; - mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; - mi.pszName = LPGEN("&Hide Offline Users in here"); - gmp.lParam = 0;gmp.wParam = POPUP_GROUPHIDEOFFLINE; - hHideOfflineUsersHereMenuItem = (HANDLE)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 900001; - mi.flags = CMIF_ICONFROMICOLIB; - mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_RENAME); //LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_RENAME)); - mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; - mi.pszName = LPGEN("&Rename Group"); - gmp.lParam = 0;gmp.wParam = POPUP_RENAMEGROUP; - AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = 900002; - mi.flags = CMIF_ICONFROMICOLIB; - mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_DELETE); //LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_DELETE)); - mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; - mi.pszName = LPGEN("&Delete Group"); - gmp.lParam = 0;gmp.wParam = POPUP_DELETEGROUP; - AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); - - //MS_CLIST_SubGroupCREATE - - } -} - -//////////////////////////////END SubGroup MENU///////////////////////// diff --git a/plugins/Clist_mw/init.cpp b/plugins/Clist_mw/init.cpp deleted file mode 100644 index 2bec98ea31..0000000000 --- a/plugins/Clist_mw/init.cpp +++ /dev/null @@ -1,240 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2004 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 "commonheaders.h" - -HINSTANCE g_hInst = 0; -CLIST_INTERFACE* pcli = NULL; -int hLangpack; - -static HANDLE hCListShutdown = 0; - -HMENU BuildGroupPopupMenu( struct ClcGroup* group ); - -void CalcEipPosition( struct ClcData *dat, struct ClcContact *contact, struct ClcGroup *group, POINT *result); -void CheckPDNCE(ClcCacheEntryBase*); -void CluiProtocolStatusChanged( int, const char* ); -int CompareContacts( const struct ClcContact *contact1, const struct ClcContact *contact2 ); -void FreeDisplayNameCacheItem(ClcCacheEntryBase*); -void GetDefaultFontSetting(int i,LOGFONT *lf,COLORREF *colour); -void RebuildEntireList(HWND hwnd,struct ClcData *dat); -void RecalcScrollBar(HWND hwnd,struct ClcData *dat); - -struct ClcGroup* ( *saveAddGroup )(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flags,int groupId,int calcTotalMembers); -struct ClcGroup* ( *saveRemoveItemFromGroup )(HWND hwnd,struct ClcGroup *group,struct ClcContact *contact,int updateTotalCount); - -void (*saveFreeContact)(struct ClcContact *p); -void (*saveFreeGroup)(struct ClcGroup *p); - -LRESULT ( CALLBACK *saveContactListControlWndProc )( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); -LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); - -LRESULT ( CALLBACK *saveContactListWndProc )(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); - -void ( *saveLoadClcOptions )(HWND hwnd,struct ClcData *dat); - -int ( *saveAddItemToGroup )( struct ClcGroup *group, int iAboveItem ); -int AddItemToGroup(struct ClcGroup *group, int iAboveItem); - -int ( *saveAddInfoItemToGroup)(struct ClcGroup *group,int flags,const TCHAR *pszText); -int AddInfoItemToGroup(struct ClcGroup *group,int flags,const TCHAR *pszText); - -void ( *saveSortCLC )(HWND hwnd,struct ClcData *dat,int useInsertionSort); -void SortCLC(HWND hwnd,struct ClcData *dat,int useInsertionSort); - -INT_PTR ( *saveTrayIconProcessMessage )(WPARAM wParam,LPARAM lParam); -INT_PTR TrayIconProcessMessage(WPARAM wParam,LPARAM lParam); - -int (*saveIconFromStatusMode)(const char *szProto,int nStatus, HANDLE hContact); -int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact); - -//from clcfonts -void RegisterCListFonts( void ); -//from bgrcfg -extern int BGModuleLoad(); -extern int BGModuleUnload(); - -PLUGININFOEX pluginInfo = { - sizeof(PLUGININFOEX), - "MultiWindow Contact List", - PLUGIN_MAKE_VERSION(0,9,0,0), - "Display contacts, event notifications, protocol status with MW modifications", - "", - "bethoven@mailgate.ru" , - "Copyright 2000-2010 Miranda-IM project ["__DATE__" "__TIME__"]", - "http://www.miranda-im.org", - UNICODE_AWARE, - //{2A417AB9-16F2-472d-9AE3-415103C78A64} - {0x2a417ab9, 0x16f2, 0x472d, { 0x9a, 0xe3, 0x41, 0x51, 0x3, 0xc7, 0x8a, 0x64 }} -}; - -BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD dwReason, LPVOID reserved) -{ - g_hInst = hInstDLL; - DisableThreadLibraryCalls(g_hInst); - return TRUE; -} - -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) -{ - return &pluginInfo; -} - -static const MUUID interfaces[] = {MIID_CLIST, MIID_LAST}; -extern "C" __declspec(dllexport) const MUUID * MirandaPluginInterfaces(void) -{ - return interfaces; -} - -int LoadContactListModule(void); -int LoadCLCModule(void); -int LoadCLUIModule(); -int InitSkinHotKeys(); - -static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) -{ - if ( LoadCLUIModule()) - return 1; - - InitSkinHotKeys(); - RegisterCListFonts(); - return 0; -} - -INT_PTR SetDrawer(WPARAM wParam,LPARAM lParam) -{ - pDrawerServiceStruct DSS = (pDrawerServiceStruct)wParam; - if (DSS->cbSize != sizeof(*DSS)) return -1; - if (DSS->PluginName == NULL) return -1; - if (DSS->PluginName == NULL) return -1; - if (!ServiceExists(DSS->GetDrawFuncsServiceName)) return -1; - - - SED.cbSize = sizeof(SED); - SED.PaintClc = (void (__cdecl *)(HWND,struct ClcData *,HDC,RECT *,int ,ClcProtoStatus *,HIMAGELIST))CallService(DSS->GetDrawFuncsServiceName,CLUI_EXT_FUNC_PAINTCLC,0); - if (!SED.PaintClc) return -1; - return 0; -} - -static struct ClcContact* fnCreateClcContact( void ) -{ - return (struct ClcContact*)mir_calloc( sizeof( struct ClcContact )); -} - -static ClcCacheEntryBase* fnCreateCacheItem( HANDLE hContact ) -{ - pdisplayNameCacheEntry p = (pdisplayNameCacheEntry)mir_calloc( sizeof( displayNameCacheEntry )); - if ( p ) - p->hContact = hContact; - return (ClcCacheEntryBase*)p; -} - -extern "C" int __declspec(dllexport) CListInitialise() -{ - int rc = 0; - - // get the internal malloc/free() - __try { - - OutputDebugStringA("CListInitialise ClistMW\r\n"); - mir_getLP( &pluginInfo ); - - pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInst); - if ( (INT_PTR)pcli == CALLSERVICE_NOTFOUND ) { -LBL_Error: - MessageBoxA( NULL, "This version of plugin requires Miranda IM 0.8.0.9 or later", "Fatal error", MB_OK ); - return 1; - } - if ( pcli->version < 6 ) - goto LBL_Error; - - pcli->pfnBuildGroupPopupMenu = BuildGroupPopupMenu; - pcli->pfnCalcEipPosition = CalcEipPosition; - pcli->pfnCheckCacheItem = CheckPDNCE; - pcli->pfnCluiProtocolStatusChanged = CluiProtocolStatusChanged; - pcli->pfnCompareContacts = CompareContacts; - pcli->pfnCreateClcContact = fnCreateClcContact; - pcli->pfnCreateCacheItem = fnCreateCacheItem; - pcli->pfnFindItem = FindItem; - pcli->pfnFreeCacheItem = FreeDisplayNameCacheItem; - pcli->pfnGetDefaultFontSetting = GetDefaultFontSetting; - pcli->pfnGetRowsPriorTo = GetRowsPriorTo; - pcli->pfnGetRowByIndex = GetRowByIndex; - pcli->pfnHitTest = HitTest; - pcli->pfnPaintClc = PaintClc; - pcli->pfnRebuildEntireList = RebuildEntireList; - pcli->pfnRecalcScrollBar = RecalcScrollBar; - pcli->pfnScrollTo = ScrollTo; - - saveIconFromStatusMode = pcli->pfnIconFromStatusMode; - pcli->pfnIconFromStatusMode = cli_IconFromStatusMode; - - saveAddGroup = pcli->pfnAddGroup; pcli->pfnAddGroup = AddGroup; - saveAddInfoItemToGroup = pcli->pfnAddInfoItemToGroup; pcli->pfnAddInfoItemToGroup = AddInfoItemToGroup; - saveAddItemToGroup = pcli->pfnAddItemToGroup; pcli->pfnAddItemToGroup = AddItemToGroup; - saveRemoveItemFromGroup = pcli->pfnRemoveItemFromGroup; pcli->pfnRemoveItemFromGroup = RemoveItemFromGroup; - saveFreeContact = pcli->pfnFreeContact; pcli->pfnFreeContact = FreeContact; - saveFreeGroup = pcli->pfnFreeGroup; pcli->pfnFreeGroup = FreeGroup; - saveContactListControlWndProc = pcli->pfnContactListControlWndProc; pcli->pfnContactListControlWndProc = ContactListControlWndProc; - saveTrayIconProcessMessage = pcli->pfnTrayIconProcessMessage; pcli->pfnTrayIconProcessMessage = TrayIconProcessMessage; - saveContactListWndProc = pcli->pfnContactListWndProc; pcli->pfnContactListWndProc = ContactListWndProc; - saveLoadClcOptions = pcli->pfnLoadClcOptions; pcli->pfnLoadClcOptions = LoadClcOptions; - saveSortCLC = pcli->pfnSortCLC; pcli->pfnSortCLC = SortCLC; - - memset(&SED,0,sizeof(SED)); - CreateServiceFunction(CLUI_SetDrawerService,SetDrawer); - - rc = LoadContactListModule(); - if (rc == 0) rc = LoadCLCModule(); - - HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); - BGModuleLoad(); - - OutputDebugStringA("CListInitialise ClistMW...Done\r\n"); - } - __except (exceptFunction(GetExceptionInformation())) - { - return 0; - } - - return rc; -} - -// never called by a newer plugin loader. -extern "C" int __declspec(dllexport) Load(void) -{ - OutputDebugStringA("Load ClistMW\r\n"); - MessageBoxA(0,"You Running Old Miranda, use >30-10-2004 version!","MultiWindow Clist",0); - CListInitialise(); - return 1; -} - -extern "C" int __declspec(dllexport) Unload(void) -{ - OutputDebugStringA("Unloading ClistMW\r\n"); - if (IsWindow(pcli->hwndContactList)) DestroyWindow(pcli->hwndContactList); - BGModuleUnload(); - pcli->hwndContactList = 0; - return 0; -} diff --git a/plugins/Clist_mw/keyboard.cpp b/plugins/Clist_mw/keyboard.cpp deleted file mode 100644 index d099fab37c..0000000000 --- a/plugins/Clist_mw/keyboard.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 "commonheaders.h" -#include - -INT_PTR hkCloseMiranda(WPARAM wParam,LPARAM lParam) -{ - CallService("CloseAction", 0, 0); - return 0; -} - -INT_PTR hkRestoreStatus(WPARAM wParam,LPARAM lParam) -{ - int nStatus = DBGetContactSettingWord(NULL, "CList", "Status", ID_STATUS_OFFLINE); - CallService(MS_CLIST_SETSTATUSMODE, nStatus, 0); - - return 0; -} - -int InitSkinHotKeys(void) -{ - CreateServiceFunction("CLIST/HK/CloseMiranda",hkCloseMiranda); - CreateServiceFunction("CLIST/HK/RestoreStatus",hkRestoreStatus); - - HOTKEYDESC shk = {0}; - shk.cbSize = sizeof(shk); - - shk.pszDescription = LPGEN("Close Miranda"); - shk.pszName = "CloseMiranda"; - shk.pszSection = "Main"; - shk.pszService = "CLIST/HK/CloseMiranda"; - Hotkey_Register(&shk); - - shk.pszDescription = LPGEN("Restore last status"); - shk.pszName = "RestoreLastStatus"; - shk.pszSection = "Status"; - shk.pszService = "CLIST/HK/RestoreStatus"; - Hotkey_Register(&shk); - - return 0; -} - -void UninitSkinHotKeys(void) -{ -} diff --git a/plugins/Clist_mw/res/blank1.ico b/plugins/Clist_mw/res/blank1.ico deleted file mode 100644 index 7845f62fed..0000000000 Binary files a/plugins/Clist_mw/res/blank1.ico and /dev/null differ diff --git a/plugins/Clist_mw/res/resource.rc b/plugins/Clist_mw/res/resource.rc new file mode 100644 index 0000000000..b561ceb4cc --- /dev/null +++ b/plugins/Clist_mw/res/resource.rc @@ -0,0 +1,781 @@ +// Microsoft Visual C++ generated resource script. +// +#include "..\src\resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include +#include "statusmodes.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Russian resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) +#ifdef _WIN32 +LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT +#pragma code_page(1251) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_SMS ICON "sms.ico" +IDI_ICQC1 ICON "1.ico" +IDI_ICQC2 ICON "2.ico" +IDI_ICQC3 ICON "3.ico" +IDI_ICQC4 ICON "4.ico" +IDI_ICQC5 ICON "5.ico" +IDI_ICQC6 ICON "6.ico" +IDI_ICQC7 ICON "7.ico" +IDI_ICQC8 ICON "8.ico" +IDI_EMAIL ICON "sendmail.ico" +IDI_NEWGROUP2 ICON "addgoupp.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_OPT_CLCBKG2 DIALOGEX 0, 0, 234, 164 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Settings",IDC_STATIC,4,19,226,141 + LTEXT "Background colour:",IDC_BC_STATIC,12,35,72,8,NOT + WS_GROUP + CONTROL "",IDC_BKGCOLOUR,"ColourPicker",WS_TABSTOP,84,34,32,10 + LTEXT "Selection colour:",IDC_SC_STATIC,12,51,72,8 + CONTROL "",IDC_SELCOLOUR,"ColourPicker",WS_TABSTOP,84,50,32,10 + CONTROL "Use background bitmap",IDC_BITMAP,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,12,68,161,10 + EDITTEXT IDC_FILENAME,22,82,184,12,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_BROWSE,208,82,15,11 + CONTROL "Stretch to width",IDC_STRETCHH,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,22,99,98,10 + CONTROL "Stretch to height",IDC_STRETCHV,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,121,99,101,10 + CONTROL "Tile horizontally",IDC_TILEH,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,22,112,98,10 + CONTROL "Tile vertically",IDC_TILEV,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,22,125,98,10 + CONTROL "Scroll with text",IDC_SCROLL,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,121,125,100,10 + CONTROL "Stretch proportionally",IDC_PROPORTIONAL,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,121,112,101,10 + CONTROL "Tile vertically according to Row Height",IDC_TILEVROWH, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,140,205,10 + COMBOBOX IDC_BKGRLIST,4,5,226,155,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_OPT_CLCBKG2, DIALOG + BEGIN + BOTTOMMARGIN, 149 + END +END +#endif // APSTUDIO_INVOKED + +#endif // Russian resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_GLOBUS ICON "globus.ico" +IDI_RENAME ICON "rename.ico" +IDI_DELETE ICON "delete.ico" +IDI_NOTICK ICON "notick.ico" +IDI_TICK ICON "notick1.ico" +IDI_BLANK ICON "blank.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_OPT_GENMENU DIALOGEX 0, 0, 306, 241 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + CONTROL "Tree1",IDC_MENUITEMS,"SysTreeView32",TVS_SHOWSELALWAYS | + WS_DISABLED | WS_BORDER | WS_TABSTOP,155,15,134,200 + CONTROL "Tree2",IDC_MENUOBJECTS,"SysTreeView32", + TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,10,15,119,80 + LTEXT "Warning!\r\nThis MenuObject not support user defined options.", + IDC_NOTSUPPORTWARNING,10,110,130,31,NOT WS_VISIBLE + GROUPBOX "MenuObjects",IDC_STATIC,5,5,133,95 + GROUPBOX "MenuItems",IDC_STATIC,148,5,147,215 + PUSHBUTTON "InsertSeparator",IDC_INSERTSEPARATOR,90,146,54,14, + WS_DISABLED + LTEXT "Service:",IDC_STATIC,0,166,27,8 + EDITTEXT IDC_GENMENU_SERVICE,29,164,115,14,ES_AUTOHSCROLL | + WS_DISABLED + LTEXT "Name:",IDC_STATIC,0,183,28,8 + EDITTEXT IDC_GENMENU_CUSTOMNAME,29,180,116,14,ES_AUTOHSCROLL | + WS_DISABLED + PUSHBUTTON "Set",IDC_GENMENU_SET,128,196,17,14,WS_DISABLED + PUSHBUTTON "Default",IDC_GENMENU_DEFAULT,77,196,43,14,WS_DISABLED +END + +IDD_DELETECONTACT DIALOGEX 0, 0, 284, 90 +STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | + DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_CONTROLPARENT +CAPTION "Delete Contact" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "No",IDNO,162,38,65,14 + PUSHBUTTON "Yes",IDYES,54,38,65,14 + CONTROL "Hide from list only, in order to keep their history and ignore/visibility settings", + IDC_HIDE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | + WS_TABSTOP,7,65,270,9 + LTEXT "Use Options->Ignore (expert mode) to unhide contacts.", + IDC_STATIC,20,78,257,8 + CONTROL "Are you sure you want to delete %s?",IDC_TOPLINE,"Static", + SS_SIMPLE | SS_NOPREFIX | WS_GROUP,7,7,270,8 + LTEXT "This will erase all history and settings for this contact!", + IDC_STATIC,7,18,239,14 +END + +IDD_OPT_CLIST DIALOGEX 0, 0, 314, 232 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + CONTROL "Hide offline users",IDC_HIDEOFFLINE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,10,17,124,10 + CONTROL "Hide empty groups",IDC_HIDEEMPTYGROUPS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,10,33,124,10 + CONTROL "Disable groups",IDC_DISABLEGROUPS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,10,50,124,10 + CONTROL "Ask before deleting contacts",IDC_CONFIRMDELETE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,10,67,124,10 + CONTROL "Always on top",IDC_ONTOP,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,10,84,124,10 + CONTROL "Hide contact list after it has been idle for", + IDC_AUTOHIDE,"Button",BS_AUTOCHECKBOX | BS_TOP | + BS_MULTILINE | WS_TABSTOP,10,100,124,22 + EDITTEXT IDC_HIDETIME,54,109,30,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_HIDETIMESPIN,"msctls_updown32", + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | + UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,75,108,10, + 14 + LTEXT "seconds",IDC_STAUTOHIDESECS,87,111,47,8 + CONTROL "Sort contacts by name",IDC_SORTBYNAME,"Button", + BS_AUTORADIOBUTTON | WS_GROUP,153,14,87,10 + CONTROL "Sort contacts by status",IDC_SORTBYSTATUS,"Button", + BS_AUTORADIOBUTTON,153,38,89,10 + CONTROL "Sort contacts by protocol",IDC_SORTBYPROTO,"Button", + BS_AUTORADIOBUTTON,153,51,151,10 + CONTROL "Single click interface",IDC_ONECLK,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,151,82,150,10 + CONTROL "Always show status in tooltip",IDC_ALWAYSSTATUS,"Button", + BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,151, + 95,151,11 + CONTROL "Disable icon blinking",IDC_DISABLEBLINK,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,151,108,86,9 + EDITTEXT IDC_BLINKTIME,153,122,35,12,ES_NUMBER + LTEXT "ms, delay between icon blinking",IDC_STATIC,203,124,102, + 8 + CONTROL "Show",IDC_DONTCYCLE,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,10,155,97,10 + COMBOBOX IDC_PRIMARYSTATUS,107,153,78,70,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "icon when statuses differ",IDC_STATIC,189,155,116,8,NOT + WS_GROUP + CONTROL "Cycle icons every",IDC_CYCLE,"Button", + BS_AUTORADIOBUTTON,10,170,97,10 + EDITTEXT IDC_CYCLETIME,107,170,30,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_CYCLETIMESPIN,"msctls_updown32", + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | + UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,137,168, + 11,14 + LTEXT "seconds, when statuses differ",IDC_STATIC,154,172,151,8, + NOT WS_GROUP + CONTROL "Show multiple icons",IDC_MULTITRAY,"Button", + BS_AUTORADIOBUTTON,9,184,98,10 + CONTROL "Only when statuses differ",IDC_ALWAYSMULTI,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,107,184,198,10 + GROUPBOX "Contact List",IDC_STCLISTGROUP,2,2,135,139 + GROUPBOX "System tray icon",IDC_STATIC,143,71,169,70 + GROUPBOX "System tray icon when using multiple protocols", + IDC_STATIC,2,142,310,57 + GROUPBOX "Contact List Sorting",IDC_STATIC,143,2,169,69,WS_GROUP + CONTROL "Spin5",IDC_BLINKSPIN,"msctls_updown32",UDS_SETBUDDYINT | + UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | + UDS_HOTTRACK,177,109,11,12 + CONTROL "Dont move offline user to bottom",IDC_NOOFFLINEMOVE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,26,131,10 + CONTROL "Pin to desktop",IDC_ONDESKTOP,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,10,120,125,15 + CONTROL "Disable icon blinking",IDC_ICONBLINK,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,10,84,97,10 + + GROUPBOX "Rows",IDC_STATIC,2,199,174,31 + LTEXT "Row height:",IDC_STATIC,10,213,65,8 + EDITTEXT IDC_ROWHEIGHT,77,211,31,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_ROWHEIGHTSPIN,"msctls_updown32", + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | + UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,97,210,10,14 + LTEXT "pixels",IDC_STATIC,112,213,62,8 + + CONTROL "Gamma correction",IDC_GAMMACORRECT,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,180,211,95,10 +END + +IDD_OPT_CLUI DIALOGEX 0, 0, 314, 232 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Window",IDC_STWINDOWGROUP,4,4,305,121 + CONTROL "Always on top",IDC_ONTOP,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,13,18,128,10 + CONTROL "Tool style main window",IDC_TOOLWND,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,32,128,10 + CONTROL "Minimize to tray",IDC_MIN2TRAY,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,13,46,128,10 + CONTROL "Hide contact list after it has been idle for", + IDC_AUTOHIDE,"Button",BS_AUTOCHECKBOX | BS_TOP | + BS_MULTILINE | WS_TABSTOP,141,18,162,10 + EDITTEXT IDC_HIDETIME,151,33,30,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_HIDETIMESPIN,"msctls_updown32", + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | + UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,172,32,10, + 14 + LTEXT "seconds",IDC_STATIC01,186,35,56,8 + CONTROL "Automatically resize window to height of list", + IDC_AUTOSIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,141, + 55,162,10 + LTEXT "maximum",IDC_STATIC21,151,71,45,8 + EDITTEXT IDC_MAXSIZEHEIGHT,197,69,31,12,ES_RIGHT | ES_AUTOHSCROLL | + ES_NUMBER + CONTROL "Spin1",IDC_MAXSIZESPIN,"msctls_updown32", + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | + UDS_ARROWKEYS | UDS_HOTTRACK,218,68,10,14 + LTEXT "% of screen",IDC_STATIC22,230,71,69,8 + CONTROL "Size upwards",IDC_AUTOSIZEUPWARD,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,151,86,147,10 + LTEXT "Title bar text:",IDC_STATIC,12,106,51,8 + GROUPBOX "Translucency options (Windows 2000/XP only)",IDC_STATIC, + 4,130,191,80 + CONTROL "Fade contact list in/out",IDC_FADEINOUT,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,140,163,10 + CONTROL "Transparent contact list",IDC_TRANSPARENT,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,152,151,9 + LTEXT "Inactive opacity:",IDC_STATIC11,23,165,67,8 + CONTROL "Slider2",IDC_TRANSINACTIVE,"msctls_trackbar32",TBS_TOP | + TBS_NOTICKS | WS_TABSTOP,95,164,70,11 + LTEXT "Active opacity:",IDC_STATIC12,23,181,67,8 + CONTROL "Slider2",IDC_TRANSACTIVE,"msctls_trackbar32",TBS_TOP | + TBS_NOTICKS | WS_TABSTOP,95,179,70,11 + LTEXT "000%",IDC_INACTIVEPERC,165,164,25,8,SS_NOPREFIX + LTEXT "000%",IDC_ACTIVEPERC,165,184,25,8,SS_NOPREFIX + CONTROL "Show menu bar",IDC_SHOWMAINMENU,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,60,128,10 + CONTROL "Easy move",IDC_CLIENTDRAG,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,13,74,128,10 + CONTROL "Show title bar",IDC_SHOWCAPTION,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,88,128,10 + CONTROL "If window is partially covered, bring to front instead of hiding", + IDC_BRINGTOFRONT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | + WS_TABSTOP,141,102,162,16 + EDITTEXT IDC_TITLETEXT,63,104,72,12,ES_AUTOHSCROLL + CONTROL "Enable drop shadow (restart required)",IDC_DROPSHADOW, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,194,138,10 + GROUPBOX "Contact List Extra Icons",IDC_EXTRA_FRAME,200,130,110, + 91 + CONTROL "Protocol Type",IDC_EXTRA_PROTO,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,210,143,70,10 + CONTROL "E-mail",IDC_EXTRA_EMAIL,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,210,166,75,10 + CONTROL "Cellular",IDC_EXTRA_CELLULAR,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,210,178,92,10 + CONTROL "Advanced #2",IDC_EXTRA_ADV2,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,210,191,92,10 + CONTROL "Advanced #1",IDC_EXTRA_ADV1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,210,204,92,10 + LTEXT "!!! Note: all client icons are made by Angeli-ka, and I have her permission to use them in clist_mw plugin.", + IDC_STATIC,5,210,190,20 + CONTROL "Homepage",IDC_EXTRA_WEB,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,210,154,75,10 +END + +IDD_OPT_CLC DIALOGEX 0, 0, 314, 251 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Items",IDC_STATIC,2,2,310,114 + CONTROL "Show divider between online and offline contacts", + IDC_DIVIDERONOFF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 11,13,179,10 + CONTROL "Hot track items as mouse passes over",IDC_TRACKSELECT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,28,179,10 + CONTROL "Disable drag and drop of items",IDC_DISABLEDRAGDROP, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,43,179,10 + CONTROL "Disable rename of items by clicking twice", + IDC_NOTEDITLABELS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 11,58,179,10 + CONTROL "Show selection even when list is not focused", + IDC_SHOWSELALWAYS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 11,73,179,10 + CONTROL "Make selection highlight translucent", + IDC_NOTNOTRANSLUCENTSEL,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,11,88,179,10 + LTEXT "'Hide Offline' means to hide:",IDC_STATIC,191,10,112,8 + CONTROL "Tree1",IDC_HIDEOFFLINEOPTS,"SysTreeView32", + TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | WS_BORDER | + WS_TABSTOP | 0x4000,191,20,112,80 + GROUPBOX "Groups",IDC_STATIC,2,120,148,121 + CONTROL "Draw a line alongside group names",IDC_LINEWITHGROUPS, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11, + 129,131,16 + CONTROL "Show counts of number of contacts in a group", + IDC_SHOWGROUPCOUNTS,"Button",BS_AUTOCHECKBOX | + BS_MULTILINE | WS_TABSTOP,11,147,131,16 + CONTROL "Hide group counts when there are none online", + IDC_HIDECOUNTSWHENEMPTY,"Button",BS_AUTOCHECKBOX | + BS_MULTILINE | WS_TABSTOP,11,165,131,16 + CONTROL "Sort groups alphabetically",IDC_SORTGROUPSALPHA,"Button", + BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,183,131, + 16 + CONTROL "Quicksearch in open groups only",IDC_QUICKSEARCHVISONLY, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11, + 201,131,16 + LTEXT "Indent groups by:",IDC_STATIC,11,221,67,8 + EDITTEXT IDC_GROUPINDENT,78,219,31,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_GROUPINDENTSPIN,"msctls_updown32", + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | + UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,95,215,10, + 14 + LTEXT "pixels",IDC_STATIC,112,221,36,8 + GROUPBOX "Visual",IDC_STATIC,156,120,156,121 + CONTROL "Scroll list smoothly",IDC_NOTNOSMOOTHSCROLLING,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,164,130,139,10 + LTEXT "Time:",IDC_STATIC11,174,144,42,8 + EDITTEXT IDC_SMOOTHTIME,216,142,31,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_SMOOTHTIMESPIN,"msctls_updown32", + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | + UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,237,137, + 10,14 + LTEXT "milliseconds",IDC_STATIC12,250,140,56,8,SS_CENTERIMAGE + LTEXT "Left margin:",IDC_STATIC,165,180,52,8 + EDITTEXT IDC_LEFTMARGIN,215,180,31,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_LEFTMARGINSPIN,"msctls_updown32", + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | + UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,240,180, + 10,14 + LTEXT "pixels",IDC_STATIC,250,180,54,8 + CONTROL "Grey out entire list when:",IDC_GREYOUT,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,165,195,139,10 + CONTROL "Tree1",IDC_GREYOUTOPTS,"SysTreeView32", + TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | WS_BORDER | + WS_TABSTOP | 0x4000,165,205,139,30 + CONTROL "Dim idle contacts",IDC_IDLE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,11,102,153,10 + CONTROL "Hide vertical scrollbar",IDC_NOSCROLLBAR,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,165,160,140,10 +END + +IDD_OPT_CLCBKG DIALOGEX 0, 0, 235, 151 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Contact List Background",IDC_STATIC,4,4,227,141 + LTEXT "Background colour:",IDC_STATIC,12,20,72,8,NOT WS_GROUP + CONTROL "",IDC_BKGCOLOUR,"ColourPicker",WS_TABSTOP,84,19,32,10 + LTEXT "Selection colour:",IDC_STATIC,12,36,72,8 + CONTROL "",IDC_SELCOLOUR,"ColourPicker",WS_TABSTOP,84,35,32,10 + CONTROL "Use background bitmap",IDC_BITMAP,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,12,53,161,10 + EDITTEXT IDC_FILENAME,22,67,184,12,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_BROWSE,208,67,15,11 + CONTROL "Stretch to width",IDC_STRETCHH,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,22,84,100,10 + CONTROL "Stretch to height",IDC_STRETCHV,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,121,84,101,10 + CONTROL "Tile horizontally",IDC_TILEH,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,22,97,93,10 + CONTROL "Tile vertically",IDC_TILEV,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,22,110,85,10 + CONTROL "Scroll with text",IDC_SCROLL,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,121,110,100,10 + CONTROL "Stretch proportionally",IDC_PROPORTIONAL,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,121,97,101,10 + CONTROL "Tile vertically according to Row Height",IDC_TILEVROWH, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,125,205,10 +END + +IDD_OPT_META_CLC DIALOGEX 0, 0, 259, 97 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + CONTROL "Use 'Meta' protocol icons for Metacontacts",IDC_META, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,13,233,10 + CONTROL "Avoid doubleclick expand",IDC_METADBLCLK,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,11,29,233,10 + CONTROL "Hide all 'Extra icons' for subcontacts", + IDC_METASUBEXTRA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 11,45,233,10 + GROUPBOX "MetaContacts supporting",-1,2,2,252,90 + CONTROL "Ignore Empty Extra icons places (arrange to right).", + IDC_METASUBEXTRA_IGN,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,11,75,233,10 + CONTROL "Hide offline subcontacts.",IDC_METASUB_HIDEOFFLINE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,60,233,10 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_DELETECONTACT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 277 + TOPMARGIN, 7 + BOTTOMMARGIN, 85 + END + + IDD_OPT_CLIST, DIALOG + BEGIN + LEFTMARGIN, 2 + RIGHTMARGIN, 312 + VERTGUIDE, 10 + VERTGUIDE, 107 + TOPMARGIN, 2 + BOTTOMMARGIN, 204 + HORZGUIDE, 182 + HORZGUIDE, 196 + END + + IDD_OPT_CLUI, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 309 + VERTGUIDE, 13 + VERTGUIDE, 23 + VERTGUIDE, 112 + VERTGUIDE, 141 + VERTGUIDE, 151 + VERTGUIDE, 175 + VERTGUIDE, 242 + VERTGUIDE, 246 + TOPMARGIN, 4 + BOTTOMMARGIN, 228 + HORZGUIDE, 18 + HORZGUIDE, 39 + HORZGUIDE, 75 + HORZGUIDE, 180 + HORZGUIDE, 196 + END + + IDD_OPT_CLC, DIALOG + BEGIN + LEFTMARGIN, 2 + RIGHTMARGIN, 312 + VERTGUIDE, 11 + VERTGUIDE, 164 + VERTGUIDE, 216 + TOPMARGIN, 2 + BOTTOMMARGIN, 249 + HORZGUIDE, 145 + HORZGUIDE, 163 + HORZGUIDE, 222 + END + + IDD_OPT_CLCBKG, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 231 + VERTGUIDE, 12 + VERTGUIDE, 22 + VERTGUIDE, 122 + TOPMARGIN, 4 + BOTTOMMARGIN, 147 + HORZGUIDE, 24 + HORZGUIDE, 40 + HORZGUIDE, 73 + HORZGUIDE, 89 + HORZGUIDE, 102 + HORZGUIDE, 115 + END + + IDD_OPT_META_CLC, DIALOG + BEGIN + LEFTMARGIN, 2 + RIGHTMARGIN, 257 + VERTGUIDE, 11 + VERTGUIDE, 244 + TOPMARGIN, 2 + BOTTOMMARGIN, 92 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "..\src\resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include \r\n" + "#include \r\n" + "#include ""statusmodes.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Cursor +// + +IDC_HYPERLINKHAND CURSOR "hyperlin.cur" +IDC_DROP CURSOR "dragcopy.cur" +IDC_DROPUSER CURSOR "dropuser.cur" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_CLISTMENU MENU +BEGIN + POPUP "&¤" + BEGIN + MENUITEM SEPARATOR + MENUITEM "E&xit", ID_ICQ_EXIT + END + POPUP "&Status" + BEGIN + MENUITEM "&Offline\tCtrl+0", ID_STATUS_OFFLINE, CHECKED + MENUITEM "On&line\tCtrl+1", ID_STATUS_ONLINE + MENUITEM "&Away\tCtrl+2", ID_STATUS_AWAY + MENUITEM "&NA\tCtrl+3", ID_STATUS_NA + MENUITEM "Occ&upied\tCtrl+4", ID_STATUS_OCCUPIED + MENUITEM "&DND\tCtrl+5", ID_STATUS_DND + MENUITEM "&Free for chat\tCtrl+6", ID_STATUS_FREECHAT + MENUITEM "&Invisible\tCtrl+7", ID_STATUS_INVISIBLE + MENUITEM "On the &Phone\tCtrl+8", ID_STATUS_ONTHEPHONE + MENUITEM "Out to &Lunch\tCtrl+9", ID_STATUS_OUTTOLUNCH + END +END + +IDR_CONTEXT MENU +BEGIN + POPUP "Tray" + BEGIN + MENUITEM "&Hide/Show", ID_TRAY_HIDE + MENUITEM SEPARATOR + MENUITEM "E&xit", ID_TRAY_EXIT + END + POPUP "Nowhere" + BEGIN + MENUITEM "&New Group", POPUP_NEWGROUP + MENUITEM SEPARATOR + MENUITEM "&Hide Offline Users", POPUP_HIDEOFFLINE + MENUITEM "Hide &Offline Users out here", POPUP_HIDEOFFLINEROOT + MENUITEM "Hide &Empty Groups", POPUP_HIDEEMPTYGROUPS + MENUITEM "Disable &Groups", POPUP_DISABLEGROUPS + MENUITEM SEPARATOR + MENUITEM "Hide Miranda", POPUP_HIDEMIRANDA + END + POPUP "Group" + BEGIN + MENUITEM "&New Subgroup", POPUP_NEWSUBGROUP + MENUITEM "&Hide Offline Users in here", POPUP_GROUPHIDEOFFLINE + MENUITEM SEPARATOR + MENUITEM "&Rename Group", POPUP_RENAMEGROUP + MENUITEM "&Delete Group", POPUP_DELETEGROUP + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,3,4,0 + PRODUCTVERSION 0,3,4,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "Comments", "Licensed under the terms of the GNU General Public License" + VALUE "CompanyName", " " + VALUE "FileDescription", "Miranda IM Contact List" + VALUE "FileVersion", "0.3.4 alpha" + VALUE "InternalName", "mwclist" + VALUE "LegalCopyright", "Copyright © 2000-2006 Richard Hughes, Roland Rabien, Tristan Van de Vreede, Martin Oberg, Robert Rainwater, Sam Kothari and Lyon Lim" + VALUE "OriginalFilename", "mwclist.dll" + VALUE "ProductName", "Miranda IM Contact List" + VALUE "ProductVersion", "0.3.4 alpha" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (Canada) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_OPT_SBAR DIALOGEX 0, 0, 178, 211 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Status Bar",IDC_STATIC,4,4,170,201 + CONTROL "Show status bar",IDC_SHOWSBAR,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,12,17,152,10 + CONTROL "Show icons",IDC_SHOWICON,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,20,35,142,10 + CONTROL "Show protocol names",IDC_SHOWPROTO,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,20,47,142,10 + CONTROL "Show status text",IDC_SHOWSTATUS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,20,59,142,10 + CONTROL "Right click opens status menu",IDC_RIGHTSTATUS,"Button", + BS_AUTORADIOBUTTON,20,111,142,10 + CONTROL "Right click opens Miranda menu",IDC_RIGHTMIRANDA,"Button", + BS_AUTORADIOBUTTON,20,122,142,10 + CONTROL "Make sections equal width",IDC_EQUALSECTIONS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,20,141,142,10 + CONTROL "",IDC_BKGCOLOUR,"ColourPicker",WS_TABSTOP,100,175,32,10 + LTEXT "Background colour:",IDC_STATIC,20,175,72,8,NOT WS_GROUP + PUSHBUTTON "-",IDC_DEFBKCOLOR,135,175,6,10 + CONTROL "Show size grip",IDC_SHOWSIZEGRIP,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,20,72,142,10 + CONTROL "Show bevel effect on panels",IDC_SBPANELBEVEL,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,20,86,107,10 + CONTROL "Use connecting Icon",IDC_USECONNECTINGICON,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,20,97,82,10 + CONTROL "Use New Drawer for StatusBar",IDC_USEOWNERDRAW,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,20,160,142,10 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_OPT_SBAR, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 174 + VERTGUIDE, 12 + VERTGUIDE, 22 + VERTGUIDE, 164 + TOPMARGIN, 4 + BOTTOMMARGIN, 207 + HORZGUIDE, 33 + HORZGUIDE, 73 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (Canada) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/plugins/Clist_mw/resource.h b/plugins/Clist_mw/resource.h deleted file mode 100644 index 06c9b4c9df..0000000000 --- a/plugins/Clist_mw/resource.h +++ /dev/null @@ -1,649 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by resource.rc -// -#define IDC_AUTHICON 1 -#define IDC_NOTOALL 3 -#define IDC_APPLY 3 -#define MIM_V1 10 -#define IDI_GLOBUS 11 -#define MIM_V2 20 -#define MIM_V3 30 -#define MIM_V4 30 -#define IDD_ABOUT 103 -#define IDI_SMS 103 -#define IDI_ONLINE 104 -#define IDI_OFFLINE 105 -#define IDD_GNUPL 110 -#define IDD_ADDED 115 -#define IDD_URLSEND 119 -#define IDD_URLRECV 120 -#define IDD_AUTHREQ 121 -#define IDD_DETAILS 125 -#define IDD_OPT_CLIST 126 -#define IDD_HISTORY 127 -#define IDI_AWAY 128 -#define IDI_FREE4CHAT 129 -#define IDI_INVISIBLE 130 -#define IDI_NA 131 -#define IDD_OPT_SOUND 134 -#define IDD_OPT_HOTKEYS 134 -#define IDI_SENDURL 135 -#define IDI_RECVMSG 136 -#define IDI_SENDMSG 137 -#define IDI_URL 138 -#define IDI_DND 158 -#define IDI_OCCUPIED 159 -#define IDI_USERDETAILS 160 -#define IDI_FINDUSER 161 -#define IDI_HELP 162 -#define IDI_OPTIONS 163 -#define IDI_MIRANDAWEBSITE 172 -#define IDI_RENAME 173 -#define IDI_HISTORY 174 -#define IDI_DELETE 175 -#define IDR_CONTEXT 180 -#define IDC_DROP 183 -#define IDD_OPT_HOTKEY 184 -#define IDD_HISTORY_FIND 192 -#define IDI_SENDEMAIL 193 -#define IDD_FILERECV 194 -#define IDD_PROFILEMANAGER 197 -#define IDD_NEWPROFILE 198 -#define IDR_CLISTMENU 199 -#define IDI_BLANK 200 -#define IDD_FINDADD 201 -#define IDI_USERONLINE 201 -#define IDD_OPT_AUTOAWAY 202 -#define IDI_GROUPSHUT 202 -#define IDD_OPTIONS 203 -#define IDI_GROUPOPEN 203 -#define IDD_PLUGINCONFLICT 204 -#define IDD_FILESEND 205 -#define IDI_NOTICK 205 -#define IDD_OPT_PLUGINS 206 -#define IDI_TICK 206 -#define IDD_OPT_ICONS 207 -#define IDI_FILE 207 -#define IDI_TIMESTAMP 208 -#define IDI_CHANGEFONT 209 -#define IDI_ADDCONTACT 210 -#define IDI_SMALLDOT 211 -#define IDI_FILLEDBLOB 212 -#define IDD_READAWAYMSG 213 -#define IDI_EMPTYBLOB 213 -#define IDD_OPT_IGNORE 214 -#define IDC_HYPERLINKHAND 214 -#define IDD_OPT_VISIBILITY 215 -#define IDC_DROPUSER 215 -#define IDD_SETAWAYMSG 216 -#define IDI_DETAILSLOGO 216 -#define IDD_OPT_AWAYMSG 217 -#define IDD_OPT_CLUI 218 -#define IDD_INFO_SUMMARY 220 -#define IDD_INFO_CONTACT 221 -#define IDD_INFO_BACKGROUND 222 -#define IDD_INFO_NOTES 223 -#define IDD_ADDEMAIL 226 -#define IDD_ICONINDEX 227 -#define IDD_OPT_CLC 228 -#define IDD_OPT_CLCBKG 230 -#define IDD_INFO_LOCATION 231 -#define IDD_INFO_WORK 232 -#define IDD_ADDPHONE 233 -#define IDD_OPT_SBAR 234 -#define IDD_INSTALLINI 235 -#define IDD_WARNINICHANGE 236 -#define IDD_INIIMPORTDONE 237 -#define IDB_SORTCOLUP 239 -#define IDB_SORTCOLDOWN 240 -#define IDD_OPT_NETLIB 246 -#define IDD_NETLIBLOGOPTS 247 -#define IDD_FILETRANSFERINFO 249 -#define IDD_OPT_FILETRANSFER 250 -#define IDD_FILEEXISTS 251 -#define IDD_DELETECONTACT 254 -#define IDD_DENYREASON 256 -#define IDD_ADDCONTACT 257 -#define IDD_OPT_CONTACT 261 -#define IDD_OPT_PROTOCOLORDER 262 -#define IDI_MULTISEND 263 -#define IDI_DOWNARROW 264 -#define IDD_CREDITS 265 -#define IDD_OPT_IDLE 268 -#define IDI_ICQC1 269 -#define IDI_ICQC2 270 -#define IDI_ICQC3 271 -#define IDI_ICQC4 272 -#define IDI_ICQC5 273 -#define IDI_ICQC6 274 -#define IDI_ICQC7 275 -#define IDI_ICQC8 276 -#define IDI_EMAIL 277 -#define IDD_OPT_META_CLC 279 -#define IDI_NEWGROUP 282 -#define IDI_NEWGROUP2 282 -#define IDI_CLIENTTRILLIAN 298 -#define IDI_CLIENTMIRANDA 299 -#define IDI_CLIENTRQ 300 -#define IDI_CLIENTGAIM 301 -#define IDI_CLIENTIM2 302 -#define IDI_CLIENTKOPETE 303 -#define IDI_CLIENTLICQ 304 -#define IDI_CLIENTQIP 305 -#define IDI_CLIENTSIM 306 -#define IDI_MIRANDA2 307 -#define IDD_OPT_CLCBKG2 308 -#define IDI_CLIENTICQL5 315 -#define IDI_CLIENTAGILE 318 -#define IDI_CLIENTGNOMEICU 319 -#define IDI_ICON1 320 -#define IDI_CLIENTMOBICQ 320 -#define IDI_CLIENTSPAMBOT 321 -#define IDI_CLIENTICQMAC 322 -#define IDI_CLIENTIMPLUS 323 -#define IDI_CLIENTYSM 324 -#define IDI_CLIENTYAMIGO 325 -#define IDI_CLIENTWEBICQ 326 -#define IDI_CLIENTVICQ 327 -#define IDI_CLIENTSTRICQ 328 -#define IDI_CLIENTSTICQ 329 -#define IDI_CLIENTNICQ2 330 -#define IDI_CLIENTPSI 331 -#define IDI_CLIENTMOB2ICQ 333 -#define IDI_CLIENTMICQ 334 -#define IDI_CLIENTLIBICQ2000 335 -#define IDI_CLIENTCENTERICQ 336 -#define IDI_CLIENTALICQ 337 -#define IDI_CLIENTICQ2000 339 -#define IDI_CLIENTICQ2001 340 -#define IDI_CLIENTICQ2003 341 -#define IDI_CLIENTICQLITE 342 -#define IDI_CLIENTICQLITE4 343 -#define IDI_CLIENTICQLITE5 344 -#define IDI_CLIENTICQGOF 345 -#define IDI_CLIENTICQGOJ 346 -#define IDC_RESETPROTOCOLDATA 1000 -#define IDC_SAVE 1001 -#define IDC_DEFBKCOLOR 1001 -#define IDI_ONTHEPHONE 1002 -#define IDC_MESSAGE 1002 -#define IDI_OUTTOLUNCH 1003 -#define IDC_AUTOCLOSE 1004 -#define IDC_FROM 1005 -#define IDC_AUTOMIN 1005 -#define IDC_DATE 1006 -#define IDC_DUMPRECV 1006 -#define IDC_MSG 1008 -#define IDC_PROXYDNS 1008 -#define IDC_NAME 1009 -#define IDC_PROXYTYPE 1009 -#define IDC_STATIC23 1010 -#define IDC_NAMEVAL 1010 -#define IDC_SPECIFYPORTS 1013 -#define IDC_ST_ENTERMSG 1013 -#define IDC_ST_ENTERURL 1014 -#define IDC_SPECIFYPORTSO 1014 -#define IDC_TEXT 1019 -#define IDC_SHOWNAMES 1024 -#define IDC_ABOUT 1032 -#define IDC_MYNOTES 1033 -#define IDC_URLS 1037 -#define IDC_REPLY 1039 -#define IDC_URL 1041 -#define IDC_REASON 1046 -#define IDC_EMAIL 1048 -#define IDC_NAMENICK 1049 -#define IDC_NAMEFIRST 1050 -#define IDC_NAMELAST 1051 -#define IDC_NICK 1053 -#define IDC_GENDER 1060 -#define IDC_CITY 1061 -#define IDC_STATE 1062 -#define IDC_COUNTRY 1063 -#define IDC_AGE 1064 -#define IDC_ZIP 1064 -#define IDC_PHONE 1065 -#define IDC_STREET 1065 -#define IDC_COMPANY 1066 -#define IDC_LANGUAGE1 1066 -#define IDC_TIMEZONE 1067 -#define IDC_DEPARTMENT 1067 -#define IDC_LOCALTIME 1068 -#define IDC_DETAILS 1069 -#define IDC_POSITION 1069 -#define IDC_LANGUAGE2 1069 -#define IDC_ADD 1070 -#define IDC_LANGUAGE3 1070 -#define IDC_MOREOPTIONS 1071 -#define IDC_USERMENU 1071 -#define IDC_MIN2TRAY 1073 -#define IDC_ONTOP 1074 -#define IDC_SHOWMAINMENU 1075 -#define IDC_CLIENTDRAG 1076 -#define IDC_EDIT 1078 -#define IDC_LIST 1079 -#define IDC_HISTORY 1080 -#define IDC_USESOUND 1085 -#define IDC_TOOLWND 1097 -#define IDC_ONECLK 1098 -#define IDC_SHOWCAPTION 1098 -#define IDC_HIDEOFFLINE 1099 -#define IDC_SHOWHIDE 1100 -#define IDC_HIDEEMPTYGROUPS 1100 -#define IDC_SORTBYSTATUS 1101 -#define IDC_FADEINOUT 1101 -#define IDC_READMSG 1102 -#define IDC_AUTOSIZE 1102 -#define IDC_DISABLEGROUPS 1102 -#define IDC_AUTOSIZEUPWARD 1103 -#define IDC_ALWAYSSTATUS 1103 -#define IDC_NETSEARCH 1104 -#define IDC_CONFIRMDELETE 1104 -#define IDC_EXTRA_PROTO 1104 -#define IDC_SORTBYPROTO 1105 -#define IDC_SHOWOPTIONS 1105 -#define IDC_EXTRA_EMAIL 1105 -#define IDC_SEARCHURL 1106 -#define IDC_EXTRA_CELLULAR 1106 -#define IDC_EXTRA_ADV2 1107 -#define IDC_BUILDTIME 1108 -#define IDC_EXTRA_ADV1 1108 -#define IDC_EXTRA_WEB 1109 -#define IDC_NUMBER 1113 -#define IDC_UIN 1123 -#define IDC_TRANSPARENT 1124 -#define IDC_TRANSINACTIVE 1126 -#define IDC_TRANSACTIVE 1128 -#define IDC_FINDWHAT 1131 -#define IDC_FIND 1132 -#define IDC_FILE 1133 -#define IDC_PROFILELIST 1134 -#define IDC_NEWPROFILE 1135 -#define IDC_NEWPROFILENAME 1136 -#define IDC_TABS 1141 -#define IDC_RESULTS 1142 -#define IDC_STATUS 1144 -#define IDC_SCREENSAVE 1145 -#define IDC_TIMED 1146 -#define IDC_AWAYTIME 1147 -#define IDC_USEPROXY 1148 -#define IDC_SETNA 1148 -#define IDC_PROXYAUTH 1149 -#define IDC_NATIME 1149 -#define IDC_PROXYHOST 1150 -#define IDC_PROXYPORT 1151 -#define IDC_PROXYUSER 1152 -#define IDC_PROXYPASS 1153 -#define IDC_STATIC11 1154 -#define IDC_STATIC12 1155 -#define IDC_STATIC21 1156 -#define IDC_STATIC22 1157 -#define IDC_STATIC31 1158 -#define IDC_STATIC32 1159 -#define IDC_PROXYAUTHNTLM 1160 -#define IDC_HKSHOWHIDE 1162 -#define IDC_HKREADMSG 1163 -#define IDC_SOUNDLIST 1163 -#define IDC_HKSEARCH 1164 -#define IDC_CHANGE 1164 -#define IDC_PREVIEW 1165 -#define IDC_HKSHOWOPTIONS 1165 -#define IDC_PLUGINLIST 1167 -#define IDC_FEATURENAME 1168 -#define IDC_CHOOSE 1169 -#define IDC_TO 1170 -#define IDC_ABOUTGROUP 1175 -#define IDC_DESCRIPTION 1176 -#define IDC_AUTHOR 1177 -#define IDC_COPYRIGHT 1178 -#define IDC_VERSION 1179 -#define IDC_HOMEPAGE 1181 -#define IDC_RESTARTREQD 1182 -#define IDC_ICONSET 1183 -#define IDC_BROWSE 1184 -#define IDC_RUNATSTARTBROWSE 1185 -#define IDC_PAGETREE 1186 -#define IDC_RUNNOW 1186 -#define IDC_INACTIVEPERC 1187 -#define IDC_ACTIVEPERC 1188 -#define IDC_SEARCHNEWWND 1188 -#define IDC_RETRIEVING 1193 -#define IDC_TITLETEXT 1196 -#define IDC_GETMORE 1200 -#define IDC_VISIBLEICON 1204 -#define IDC_INVISIBLEICON 1205 -#define IDC_FILEICON 1206 -#define IDC_ONLINEICON 1207 -#define IDC_FILENAMES 1208 -#define IDC_ALLICON 1208 -#define IDC_DONTREPLY 1209 -#define IDC_NONEICON 1209 -#define IDC_USEPREVIOUS 1210 -#define IDC_NODIALOG 1211 -#define IDC_USESPECIFIC 1212 -#define IDC_FILEDIR 1213 -#define IDC_ALLFILESPROGRESS 1217 -#define IDC_CURRENTSPEED 1219 -#define IDC_STAWAYTYPE 1220 -#define IDC_WHITERECT 1221 -#define IDC_ALLSPEED 1221 -#define IDC_CURRENTFILEPROGRESS 1222 -#define IDC_CURRENTFILEGROUP 1223 -#define IDC_FIRSTNAME 1224 -#define IDC_LASTNAME 1225 -#define IDC_CURRENTTRANSFERRED 1225 -#define IDC_DOBDAY 1226 -#define IDC_DOBMONTH 1227 -#define IDC_WEBPAGE 1228 -#define IDC_DOBYEAR 1228 -#define IDC_UPDATING 1231 -#define IDC_NAMEORDER 1234 -#define IDC_AUTOHIDE 1235 -#define IDC_HIDETIME 1236 -#define IDC_RECONNECTREQD 1239 -#define IDC_IMPORT 1241 -#define IDC_TOMAIN 1243 -#define IDC_TOPROTO 1244 -#define IDC_PROTOLIST 1245 -#define IDC_TODEFICON 1246 -#define IDC_IMPORTMULTI 1247 -#define IDC_MAXSIZEHEIGHT 1254 -#define IDC_MAXSIZESPIN 1255 -#define IDC_FONTID 1256 -#define IDC_SAMETYPE 1257 -#define IDC_SAMESTYLE 1258 -#define IDC_SAMECOLOUR 1259 -#define IDC_SAMEAS 1260 -#define IDC_TYPEFACE 1261 -#define IDC_BOLD 1262 -#define IDC_ITALIC 1263 -#define IDC_COLOUR 1264 -#define IDC_UNDERLINE 1265 -#define IDC_HOTCOLOUR 1267 -#define IDC_SAMESIZE 1268 -#define IDC_BKGCOLOUR 1269 -#define IDC_FILENAME 1271 -#define IDC_SCROLL 1277 -#define IDC_PROPORTIONAL 1278 -#define IDC_SELCOLOUR 1281 -#define IDC_QUICKCOLOUR 1282 -#define IDC_SMOOTHTIME 1283 -#define IDC_SMOOTHTIMESPIN 1284 -#define IDC_GREYOUT 1285 -#define IDC_ROWHEIGHT 1285 -#define IDC_ROWHEIGHTSPIN 1286 -#define IDC_GREYOUTOPTS 1288 -#define IDC_GROUPINDENT 1289 -#define IDC_GROUPINDENTSPIN 1290 -#define IDC_LEFTMARGIN 1291 -#define IDC_SAMPLE 1292 -#define IDC_LEFTMARGINSPIN 1292 -#define IDC_FONTSIZE 1293 -#define IDC_STRETCHH 1298 -#define IDC_STRETCHV 1299 -#define IDC_TILEH 1300 -#define IDC_SCRIPT 1300 -#define IDC_TILEV 1301 -#define IDC_GAMMACORRECT 1302 -#define IDC_TILEVROWH 1302 -#define IDC_INTERESTS 1305 -#define IDC_EMAILS 1306 -#define IDC_PAST 1307 -#define IDC_HIDEOFFLINEOPTS 1308 -#define IDC_PHONES 1308 -#define IDC_SMS 1310 -#define IDC_AREA 1312 -#define IDC_UPDATE 1313 -#define IDC_DONTCYCLE 1315 -#define IDC_PRIMARYSTATUS 1316 -#define IDC_CYCLE 1317 -#define IDC_CYCLETIME 1318 -#define IDC_CYCLETIMESPIN 1319 -#define IDC_HIDETIMESPIN 1320 -#define IDC_MULTITRAY 1321 -#define IDC_ALWAYSMULTI 1322 -#define IDC_SHOWICON 1323 -#define IDC_SHOWPROTO 1324 -#define IDC_SHOWSTATUS 1325 -#define IDC_EQUALSECTIONS 1326 -#define IDC_SHOWSIZEGRIP 1327 -#define IDC_USEOWNERDRAW 1328 -#define IDC_SHOWSBAR 1329 -#define IDC_RIGHTMIRANDA 1330 -#define IDC_RIGHTSTATUS 1331 -#define IDC_ININAME 1333 -#define IDC_VIEWINI 1334 -#define IDC_SECURITYINFO 1335 -#define IDC_SETTINGNAME 1336 -#define IDC_NEWVALUE 1337 -#define IDC_WARNNOMORE 1338 -#define IDC_DELETE 1339 -#define IDC_RECYCLE 1340 -#define IDC_NEWNAME 1341 -#define IDC_MOVE 1342 -#define IDC_LEAVE 1343 -#define IDC_EXPERT 1346 -#define IDC_SORTBYNAME 1347 -#define IDC_STAUTOHIDESECS 1349 -#define IDC_STCLISTGROUP 1350 -#define IDC_DISABLEDRAGDROP 1351 -#define IDC_NOTEDITLABELS 1352 -#define IDC_SHOWSELALWAYS 1353 -#define IDC_TRACKSELECT 1354 -#define IDC_SHOWGROUPCOUNTS 1355 -#define IDC_HIDECOUNTSWHENEMPTY 1356 -#define IDC_DIVIDERONOFF 1357 -#define IDC_NOTNOTRANSLUCENTSEL 1358 -#define IDC_LINEWITHGROUPS 1359 -#define IDC_QUICKSEARCHVISONLY 1360 -#define IDC_SORTGROUPSALPHA 1361 -#define IDC_NOTNOSMOOTHSCROLLING 1362 -#define IDC_BITMAP 1363 -#define IDC_STWINDOWGROUP 1364 -#define IDC_STATIC01 1365 -#define IDC_CATEGORYLIST 1366 -#define IDC_LOADICONS 1369 -#define IDC_STICONSGROUP 1371 -#define IDC_MSGICON 1375 -#define IDC_URLICON 1376 -#define IDC_STNOPAGE 1377 -#define IDC_STCHECKMARKS 1380 -#define IDC_STSAMETEXT 1382 -#define IDC_STASTEXT 1383 -#define IDC_STSIZETEXT 1384 -#define IDC_STCOLOURTEXT 1385 -#define IDC_STHORZBAR 1386 -#define IDC_MIRANDA 1388 -#define IDC_STATUSBAR 1389 -#define IDC_PROTOIDGROUP 1392 -#define IDC_BYPROTOID 1393 -#define IDC_PROTOID 1394 -#define IDC_EMAILGROUP 1395 -#define IDC_BYEMAIL 1396 -#define IDC_STNAMENICK 1397 -#define IDC_NAMEGROUP 1398 -#define IDC_BYNAME 1399 -#define IDC_STNAMEFIRST 1400 -#define IDC_STNAMELAST 1401 -#define IDC_ADVANCEDGROUP 1402 -#define IDC_BYADVANCED 1403 -#define IDC_ADVANCED 1404 -#define IDC_STSIMPLERIGHT 1440 -#define IDC_NETLIBUSERS 1443 -#define IDC_STOFTENPORT 1445 -#define IDC_STATIC51 1446 -#define IDC_STATIC52 1447 -#define IDC_STATIC43 1448 -#define IDC_LOGOPTIONS 1449 -#define IDC_PORTSRANGE 1450 -#define IDC_TOCONSOLE 1451 -#define IDC_STATIC53 1451 -#define IDC_SHOWCONSOLEATSTART 1452 -#define IDC_PORTSRANGEO 1452 -#define IDC_STATIC54 1453 -#define IDC_SHOWCONSOLE 1454 -#define IDC_TOOUTPUTDEBUGSTRING 1455 -#define IDC_TOFILE 1456 -#define IDC_CLEARCONSOLE 1457 -#define IDC_RUNATSTART 1458 -#define IDC_DUMPSENT 1464 -#define IDC_DUMPPROXY 1466 -#define IDC_TEXTDUMPS 1467 -#define IDC_AUTODETECTTEXT 1468 -#define IDC_TIMEFORMAT 1469 -#define IDC_FILENAMEBROWSE 1470 -#define IDC_SHOWTHISDLGATSTART 1471 -#define IDC_FILEDIRBROWSE 1475 -#define IDC_ALLFILESGROUP 1476 -#define IDC_SCANCMDLINEBROWSE 1476 -#define IDC_ALLTRANSFERRED 1477 -#define IDC_OPENFOLDER 1478 -#define IDC_OPENFILE 1479 -#define IDC_TOTALSIZE 1480 -#define IDC_APPENDNICKTODIR 1483 -#define IDC_AUTOACCEPT 1484 -#define IDC_SCANCMDLINE 1485 -#define IDC_WARNBEFOREOPENING 1488 -#define IDC_SCANDURINGDL 1489 -#define IDC_SCANAFTERDL 1490 -#define IDC_NOSCANNER 1491 -#define IDC_ST_CMDLINE 1492 -#define IDC_ST_CMDLINEHELP 1493 -#define IDC_PROPERTIES 1496 -#define IDC_RESUME 1497 -#define IDC_EXISTINGICON 1499 -#define IDC_RESUMEALL 1500 -#define IDC_OVERWRITE 1501 -#define IDC_OVERWRITEALL 1502 -#define IDC_SKIP 1503 -#define IDC_EXISTINGSIZE 1506 -#define IDC_EXISTINGDATE 1507 -#define IDC_EXISTINGTYPE 1508 -#define IDC_NEWICON 1509 -#define IDC_NEWSIZE 1510 -#define IDC_NEWDATE 1511 -#define IDC_NEWTYPE 1512 -#define IDC_SAVEAS 1513 -#define IDC_ASK 1516 -#define IDC_RENAME 1519 -#define IDC_VIRUSSCANNERGROUP 1520 -#define IDC_HIDE 1534 -#define IDC_TOPLINE 1535 -#define IDC_GPLBTN 1536 -#define IDC_MAIL 1536 -#define IDC_MYHANDLE 1540 -#define IDC_GROUP 1541 -#define IDC_ADDED 1542 -#define IDC_AUTH 1543 -#define IDC_PLUGINSTATIC1 1559 -#define IDC_DELETEHISTORY 1560 -#define IDC_HOTKEYURLSTR 1567 -#define IDC_SETNASTR 1568 -#define IDC_AAUTHOR 1569 -#define IDC_AHOMEPAGE 1570 -#define IDC_AVERSION 1571 -#define IDC_ACOPYRIGHT 1572 -#define IDC_ADESCRIPTION 1573 -#define IDC_PLUGINENABLE 1574 -#define IDC_AUTHREQ 1577 -#define IDC_AUTHGB 1578 -#define IDC_BRINGTOFRONT 1579 -#define IDC_PROTOCOL 1580 -#define IDC_CONTRIBLINK 1586 -#define IDC_HOMELINK 1587 -#define IDC_SUPPORTLINK 1588 -#define IDC_DEVS 1589 -#define IDC_GPL 1590 -#define IDC_LOGO 1591 -#define IDC_PROTOCOLORDER 1591 -#define IDC_PROTOCOLORDERWARNING 1592 -#define IDC_CREDITSTEXT 1595 -#define IDC_WSLOCK 1599 -#define IDC_BLINKTIME 1607 -#define IDC_BLINKSPIN 1608 -#define IDC_DISABLEBLINK 1609 -#define IDC_IDLE 1610 -#define IDC_SBPANELBEVEL 1611 -#define IDC_META 1611 -#define IDC_DROPSHADOW 1612 -#define IDC_METADBLCLK 1612 -#define IDC_NOSCROLLBAR 1613 -#define IDC_METASUBEXTRA 1614 -#define IDC_METASUBEXTRA_IGN 1615 -#define IDC_METASUB_HIDEOFFLINE 1616 -#define IDC_BUTTON1 1633 -#define IDC_IDLECHECK 1636 -#define IDC_IDLEONWINDOWS 1637 -#define IDC_IDLEONMIRANDA 1638 -#define IDC_IDLEUSEGLI 1639 -#define IDC_SCREENSAVER 1642 -#define IDC_LOCKED 1643 -#define IDC_IDLESHORT 1644 -#define IDC_IDLELONG 1645 -#define IDC_IDLE1STTIME 1646 -#define IDC_IDLE2NDTIME 1647 -#define IDC_IDLEPRIVATE 1649 -#define IDC_AASTATUS 1650 -#define IDC_AASHORTIDLE 1651 -#define IDC_AALONGSTATUS 1652 -#define IDC_AALONGIDLE 1656 -#define IDC_NOOFFLINEMOVE 1657 -#define IDC_HOTKEYTREE 1657 -#define IDC_LOCATION 1659 -#define IDC_SGROUP 1660 -#define IDC_SLOC 1661 -#define IDC_ONDESKTOP 1662 -#define IDC_SETHOTKEY 1759 -#define IDC_HKTITLE 1760 -#define IDC_CHECK1 1761 -#define IDC_USECONNECTINGICON 1761 -#define IDC_BKGRLIST 1762 -#define IDC_EXTRA_FRAME 1762 -#define IDC_BC_STATIC 1763 -#define IDC_SC_STATIC 1764 -#define IDD_OPT_GENMENU 11267 -#define IDC_MENUITEMS 11710 -#define IDC_MENUOBJECTS 11711 -#define IDC_NOTSUPPORTWARNING 11712 -#define IDC_INSERTSEPARATOR 11715 -#define IDC_GENMENU_SERVICE 11716 -#define IDC_GENMENU_CUSTOMNAME 11717 -#define IDC_GENMENU_SET 11718 -#define IDC_GENMENU_SET2 11719 -#define IDC_GENMENU_DEFAULT 11719 -#define IDC_ICONBLINK 11720 -#define IDI_SEARCHALL 32548 -#define ID_ICQ_EXIT 40001 -#define IDM_COPY 40001 -#define ID_RESET 40002 -#define POPUP_HIDEEMPTYGROUPS 40003 -#define POPUP_NEWSUBGROUP 40004 -#define POPUP_HIDEOFFLINE 40005 -#define POPUP_GROUPHIDEOFFLINE 40006 -#define POPUP_HIDEOFFLINEROOT 40007 -#define POPUP_DISABLEGROUPS 40008 -#define IDC_SENDMESSAGE 40009 -#define IDM_COPYALL 40011 -#define IDM_SELECTALL 40012 -#define IDM_CLEAR 40013 -#define IDM_OPENNEW 40014 -#define IDM_OPENEXISTING 40015 -#define IDM_COPYLINK 40016 -#define POPUP_HIDEMIRANDA 40017 -#define ID_TRAY_HIDE 40038 -#define ID_TRAY_EXIT 40040 -#define POPUP_NEWGROUP 40050 -#define POPUP_RENAMEGROUP 40052 -#define POPUP_DELETEGROUP 40053 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 347 -#define _APS_NEXT_COMMAND_VALUE 40018 -#define _APS_NEXT_CONTROL_VALUE 1763 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/plugins/Clist_mw/resource.rc b/plugins/Clist_mw/resource.rc deleted file mode 100644 index cb5632154a..0000000000 --- a/plugins/Clist_mw/resource.rc +++ /dev/null @@ -1,781 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include -#include "statusmodes.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Russian resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) -#ifdef _WIN32 -LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -#pragma code_page(1251) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_SMS ICON "res/sms.ico" -IDI_ICQC1 ICON "res/1.ico" -IDI_ICQC2 ICON "res/2.ico" -IDI_ICQC3 ICON "res/3.ico" -IDI_ICQC4 ICON "res/4.ico" -IDI_ICQC5 ICON "res/5.ico" -IDI_ICQC6 ICON "res/6.ico" -IDI_ICQC7 ICON "res/7.ico" -IDI_ICQC8 ICON "res/8.ico" -IDI_EMAIL ICON "res/sendmail.ico" -IDI_NEWGROUP2 ICON "res/addgoupp.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_OPT_CLCBKG2 DIALOGEX 0, 0, 234, 164 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Settings",IDC_STATIC,4,19,226,141 - LTEXT "Background colour:",IDC_BC_STATIC,12,35,72,8,NOT - WS_GROUP - CONTROL "",IDC_BKGCOLOUR,"ColourPicker",WS_TABSTOP,84,34,32,10 - LTEXT "Selection colour:",IDC_SC_STATIC,12,51,72,8 - CONTROL "",IDC_SELCOLOUR,"ColourPicker",WS_TABSTOP,84,50,32,10 - CONTROL "Use background bitmap",IDC_BITMAP,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,12,68,161,10 - EDITTEXT IDC_FILENAME,22,82,184,12,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_BROWSE,208,82,15,11 - CONTROL "Stretch to width",IDC_STRETCHH,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,22,99,98,10 - CONTROL "Stretch to height",IDC_STRETCHV,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,121,99,101,10 - CONTROL "Tile horizontally",IDC_TILEH,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,22,112,98,10 - CONTROL "Tile vertically",IDC_TILEV,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,22,125,98,10 - CONTROL "Scroll with text",IDC_SCROLL,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,121,125,100,10 - CONTROL "Stretch proportionally",IDC_PROPORTIONAL,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,121,112,101,10 - CONTROL "Tile vertically according to Row Height",IDC_TILEVROWH, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,140,205,10 - COMBOBOX IDC_BKGRLIST,4,5,226,155,CBS_DROPDOWNLIST | CBS_SORT | - WS_VSCROLL | WS_TABSTOP -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_OPT_CLCBKG2, DIALOG - BEGIN - BOTTOMMARGIN, 149 - END -END -#endif // APSTUDIO_INVOKED - -#endif // Russian resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_GLOBUS ICON "res/globus.ico" -IDI_RENAME ICON "res/rename.ico" -IDI_DELETE ICON "res/delete.ico" -IDI_NOTICK ICON "res/notick.ico" -IDI_TICK ICON "res/notick1.ico" -IDI_BLANK ICON "res/blank.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_OPT_GENMENU DIALOGEX 0, 0, 306, 241 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - CONTROL "Tree1",IDC_MENUITEMS,"SysTreeView32",TVS_SHOWSELALWAYS | - WS_DISABLED | WS_BORDER | WS_TABSTOP,155,15,134,200 - CONTROL "Tree2",IDC_MENUOBJECTS,"SysTreeView32", - TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,10,15,119,80 - LTEXT "Warning!\r\nThis MenuObject not support user defined options.", - IDC_NOTSUPPORTWARNING,10,110,130,31,NOT WS_VISIBLE - GROUPBOX "MenuObjects",IDC_STATIC,5,5,133,95 - GROUPBOX "MenuItems",IDC_STATIC,148,5,147,215 - PUSHBUTTON "InsertSeparator",IDC_INSERTSEPARATOR,90,146,54,14, - WS_DISABLED - LTEXT "Service:",IDC_STATIC,0,166,27,8 - EDITTEXT IDC_GENMENU_SERVICE,29,164,115,14,ES_AUTOHSCROLL | - WS_DISABLED - LTEXT "Name:",IDC_STATIC,0,183,28,8 - EDITTEXT IDC_GENMENU_CUSTOMNAME,29,180,116,14,ES_AUTOHSCROLL | - WS_DISABLED - PUSHBUTTON "Set",IDC_GENMENU_SET,128,196,17,14,WS_DISABLED - PUSHBUTTON "Default",IDC_GENMENU_DEFAULT,77,196,43,14,WS_DISABLED -END - -IDD_DELETECONTACT DIALOGEX 0, 0, 284, 90 -STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | - DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_CONTROLPARENT -CAPTION "Delete Contact" -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - DEFPUSHBUTTON "No",IDNO,162,38,65,14 - PUSHBUTTON "Yes",IDYES,54,38,65,14 - CONTROL "Hide from list only, in order to keep their history and ignore/visibility settings", - IDC_HIDE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | - WS_TABSTOP,7,65,270,9 - LTEXT "Use Options->Ignore (expert mode) to unhide contacts.", - IDC_STATIC,20,78,257,8 - CONTROL "Are you sure you want to delete %s?",IDC_TOPLINE,"Static", - SS_SIMPLE | SS_NOPREFIX | WS_GROUP,7,7,270,8 - LTEXT "This will erase all history and settings for this contact!", - IDC_STATIC,7,18,239,14 -END - -IDD_OPT_CLIST DIALOGEX 0, 0, 314, 232 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - CONTROL "Hide offline users",IDC_HIDEOFFLINE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,10,17,124,10 - CONTROL "Hide empty groups",IDC_HIDEEMPTYGROUPS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,10,33,124,10 - CONTROL "Disable groups",IDC_DISABLEGROUPS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,10,50,124,10 - CONTROL "Ask before deleting contacts",IDC_CONFIRMDELETE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,10,67,124,10 - CONTROL "Always on top",IDC_ONTOP,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,10,84,124,10 - CONTROL "Hide contact list after it has been idle for", - IDC_AUTOHIDE,"Button",BS_AUTOCHECKBOX | BS_TOP | - BS_MULTILINE | WS_TABSTOP,10,100,124,22 - EDITTEXT IDC_HIDETIME,54,109,30,12,ES_RIGHT | ES_NUMBER - CONTROL "Spin1",IDC_HIDETIMESPIN,"msctls_updown32", - UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | - UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,75,108,10, - 14 - LTEXT "seconds",IDC_STAUTOHIDESECS,87,111,47,8 - CONTROL "Sort contacts by name",IDC_SORTBYNAME,"Button", - BS_AUTORADIOBUTTON | WS_GROUP,153,14,87,10 - CONTROL "Sort contacts by status",IDC_SORTBYSTATUS,"Button", - BS_AUTORADIOBUTTON,153,38,89,10 - CONTROL "Sort contacts by protocol",IDC_SORTBYPROTO,"Button", - BS_AUTORADIOBUTTON,153,51,151,10 - CONTROL "Single click interface",IDC_ONECLK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,151,82,150,10 - CONTROL "Always show status in tooltip",IDC_ALWAYSSTATUS,"Button", - BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,151, - 95,151,11 - CONTROL "Disable icon blinking",IDC_DISABLEBLINK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,151,108,86,9 - EDITTEXT IDC_BLINKTIME,153,122,35,12,ES_NUMBER - LTEXT "ms, delay between icon blinking",IDC_STATIC,203,124,102, - 8 - CONTROL "Show",IDC_DONTCYCLE,"Button",BS_AUTORADIOBUTTON | - WS_GROUP,10,155,97,10 - COMBOBOX IDC_PRIMARYSTATUS,107,153,78,70,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - LTEXT "icon when statuses differ",IDC_STATIC,189,155,116,8,NOT - WS_GROUP - CONTROL "Cycle icons every",IDC_CYCLE,"Button", - BS_AUTORADIOBUTTON,10,170,97,10 - EDITTEXT IDC_CYCLETIME,107,170,30,12,ES_RIGHT | ES_NUMBER - CONTROL "Spin1",IDC_CYCLETIMESPIN,"msctls_updown32", - UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | - UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,137,168, - 11,14 - LTEXT "seconds, when statuses differ",IDC_STATIC,154,172,151,8, - NOT WS_GROUP - CONTROL "Show multiple icons",IDC_MULTITRAY,"Button", - BS_AUTORADIOBUTTON,9,184,98,10 - CONTROL "Only when statuses differ",IDC_ALWAYSMULTI,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,107,184,198,10 - GROUPBOX "Contact List",IDC_STCLISTGROUP,2,2,135,139 - GROUPBOX "System tray icon",IDC_STATIC,143,71,169,70 - GROUPBOX "System tray icon when using multiple protocols", - IDC_STATIC,2,142,310,57 - GROUPBOX "Contact List Sorting",IDC_STATIC,143,2,169,69,WS_GROUP - CONTROL "Spin5",IDC_BLINKSPIN,"msctls_updown32",UDS_SETBUDDYINT | - UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | - UDS_HOTTRACK,177,109,11,12 - CONTROL "Dont move offline user to bottom",IDC_NOOFFLINEMOVE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,26,131,10 - CONTROL "Pin to desktop",IDC_ONDESKTOP,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,10,120,125,15 - CONTROL "Disable icon blinking",IDC_ICONBLINK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,10,84,97,10 - - GROUPBOX "Rows",IDC_STATIC,2,199,174,31 - LTEXT "Row height:",IDC_STATIC,10,213,65,8 - EDITTEXT IDC_ROWHEIGHT,77,211,31,12,ES_RIGHT | ES_NUMBER - CONTROL "Spin1",IDC_ROWHEIGHTSPIN,"msctls_updown32", - UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | - UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,97,210,10,14 - LTEXT "pixels",IDC_STATIC,112,213,62,8 - - CONTROL "Gamma correction",IDC_GAMMACORRECT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,180,211,95,10 -END - -IDD_OPT_CLUI DIALOGEX 0, 0, 314, 232 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Window",IDC_STWINDOWGROUP,4,4,305,121 - CONTROL "Always on top",IDC_ONTOP,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,13,18,128,10 - CONTROL "Tool style main window",IDC_TOOLWND,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,32,128,10 - CONTROL "Minimize to tray",IDC_MIN2TRAY,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,13,46,128,10 - CONTROL "Hide contact list after it has been idle for", - IDC_AUTOHIDE,"Button",BS_AUTOCHECKBOX | BS_TOP | - BS_MULTILINE | WS_TABSTOP,141,18,162,10 - EDITTEXT IDC_HIDETIME,151,33,30,12,ES_RIGHT | ES_NUMBER - CONTROL "Spin1",IDC_HIDETIMESPIN,"msctls_updown32", - UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | - UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,172,32,10, - 14 - LTEXT "seconds",IDC_STATIC01,186,35,56,8 - CONTROL "Automatically resize window to height of list", - IDC_AUTOSIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,141, - 55,162,10 - LTEXT "maximum",IDC_STATIC21,151,71,45,8 - EDITTEXT IDC_MAXSIZEHEIGHT,197,69,31,12,ES_RIGHT | ES_AUTOHSCROLL | - ES_NUMBER - CONTROL "Spin1",IDC_MAXSIZESPIN,"msctls_updown32", - UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | - UDS_ARROWKEYS | UDS_HOTTRACK,218,68,10,14 - LTEXT "% of screen",IDC_STATIC22,230,71,69,8 - CONTROL "Size upwards",IDC_AUTOSIZEUPWARD,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,151,86,147,10 - LTEXT "Title bar text:",IDC_STATIC,12,106,51,8 - GROUPBOX "Translucency options (Windows 2000/XP only)",IDC_STATIC, - 4,130,191,80 - CONTROL "Fade contact list in/out",IDC_FADEINOUT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,140,163,10 - CONTROL "Transparent contact list",IDC_TRANSPARENT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,152,151,9 - LTEXT "Inactive opacity:",IDC_STATIC11,23,165,67,8 - CONTROL "Slider2",IDC_TRANSINACTIVE,"msctls_trackbar32",TBS_TOP | - TBS_NOTICKS | WS_TABSTOP,95,164,70,11 - LTEXT "Active opacity:",IDC_STATIC12,23,181,67,8 - CONTROL "Slider2",IDC_TRANSACTIVE,"msctls_trackbar32",TBS_TOP | - TBS_NOTICKS | WS_TABSTOP,95,179,70,11 - LTEXT "000%",IDC_INACTIVEPERC,165,164,25,8,SS_NOPREFIX - LTEXT "000%",IDC_ACTIVEPERC,165,184,25,8,SS_NOPREFIX - CONTROL "Show menu bar",IDC_SHOWMAINMENU,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,60,128,10 - CONTROL "Easy move",IDC_CLIENTDRAG,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,13,74,128,10 - CONTROL "Show title bar",IDC_SHOWCAPTION,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,88,128,10 - CONTROL "If window is partially covered, bring to front instead of hiding", - IDC_BRINGTOFRONT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | - WS_TABSTOP,141,102,162,16 - EDITTEXT IDC_TITLETEXT,63,104,72,12,ES_AUTOHSCROLL - CONTROL "Enable drop shadow (restart required)",IDC_DROPSHADOW, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,194,138,10 - GROUPBOX "Contact List Extra Icons",IDC_EXTRA_FRAME,200,130,110, - 91 - CONTROL "Protocol Type",IDC_EXTRA_PROTO,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,210,143,70,10 - CONTROL "E-mail",IDC_EXTRA_EMAIL,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,210,166,75,10 - CONTROL "Cellular",IDC_EXTRA_CELLULAR,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,210,178,92,10 - CONTROL "Advanced #2",IDC_EXTRA_ADV2,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,210,191,92,10 - CONTROL "Advanced #1",IDC_EXTRA_ADV1,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,210,204,92,10 - LTEXT "!!! Note: all client icons are made by Angeli-ka, and I have her permission to use them in clist_mw plugin.", - IDC_STATIC,5,210,190,20 - CONTROL "Homepage",IDC_EXTRA_WEB,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,210,154,75,10 -END - -IDD_OPT_CLC DIALOGEX 0, 0, 314, 251 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Items",IDC_STATIC,2,2,310,114 - CONTROL "Show divider between online and offline contacts", - IDC_DIVIDERONOFF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 11,13,179,10 - CONTROL "Hot track items as mouse passes over",IDC_TRACKSELECT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,28,179,10 - CONTROL "Disable drag and drop of items",IDC_DISABLEDRAGDROP, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,43,179,10 - CONTROL "Disable rename of items by clicking twice", - IDC_NOTEDITLABELS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 11,58,179,10 - CONTROL "Show selection even when list is not focused", - IDC_SHOWSELALWAYS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 11,73,179,10 - CONTROL "Make selection highlight translucent", - IDC_NOTNOTRANSLUCENTSEL,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,11,88,179,10 - LTEXT "'Hide Offline' means to hide:",IDC_STATIC,191,10,112,8 - CONTROL "Tree1",IDC_HIDEOFFLINEOPTS,"SysTreeView32", - TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | WS_BORDER | - WS_TABSTOP | 0x4000,191,20,112,80 - GROUPBOX "Groups",IDC_STATIC,2,120,148,121 - CONTROL "Draw a line alongside group names",IDC_LINEWITHGROUPS, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11, - 129,131,16 - CONTROL "Show counts of number of contacts in a group", - IDC_SHOWGROUPCOUNTS,"Button",BS_AUTOCHECKBOX | - BS_MULTILINE | WS_TABSTOP,11,147,131,16 - CONTROL "Hide group counts when there are none online", - IDC_HIDECOUNTSWHENEMPTY,"Button",BS_AUTOCHECKBOX | - BS_MULTILINE | WS_TABSTOP,11,165,131,16 - CONTROL "Sort groups alphabetically",IDC_SORTGROUPSALPHA,"Button", - BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,183,131, - 16 - CONTROL "Quicksearch in open groups only",IDC_QUICKSEARCHVISONLY, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11, - 201,131,16 - LTEXT "Indent groups by:",IDC_STATIC,11,221,67,8 - EDITTEXT IDC_GROUPINDENT,78,219,31,12,ES_RIGHT | ES_NUMBER - CONTROL "Spin1",IDC_GROUPINDENTSPIN,"msctls_updown32", - UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | - UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,95,215,10, - 14 - LTEXT "pixels",IDC_STATIC,112,221,36,8 - GROUPBOX "Visual",IDC_STATIC,156,120,156,121 - CONTROL "Scroll list smoothly",IDC_NOTNOSMOOTHSCROLLING,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,164,130,139,10 - LTEXT "Time:",IDC_STATIC11,174,144,42,8 - EDITTEXT IDC_SMOOTHTIME,216,142,31,12,ES_RIGHT | ES_NUMBER - CONTROL "Spin1",IDC_SMOOTHTIMESPIN,"msctls_updown32", - UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | - UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,237,137, - 10,14 - LTEXT "milliseconds",IDC_STATIC12,250,140,56,8,SS_CENTERIMAGE - LTEXT "Left margin:",IDC_STATIC,165,180,52,8 - EDITTEXT IDC_LEFTMARGIN,215,180,31,12,ES_RIGHT | ES_NUMBER - CONTROL "Spin1",IDC_LEFTMARGINSPIN,"msctls_updown32", - UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | - UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,240,180, - 10,14 - LTEXT "pixels",IDC_STATIC,250,180,54,8 - CONTROL "Grey out entire list when:",IDC_GREYOUT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,165,195,139,10 - CONTROL "Tree1",IDC_GREYOUTOPTS,"SysTreeView32", - TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | WS_BORDER | - WS_TABSTOP | 0x4000,165,205,139,30 - CONTROL "Dim idle contacts",IDC_IDLE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,11,102,153,10 - CONTROL "Hide vertical scrollbar",IDC_NOSCROLLBAR,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,165,160,140,10 -END - -IDD_OPT_CLCBKG DIALOGEX 0, 0, 235, 151 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Contact List Background",IDC_STATIC,4,4,227,141 - LTEXT "Background colour:",IDC_STATIC,12,20,72,8,NOT WS_GROUP - CONTROL "",IDC_BKGCOLOUR,"ColourPicker",WS_TABSTOP,84,19,32,10 - LTEXT "Selection colour:",IDC_STATIC,12,36,72,8 - CONTROL "",IDC_SELCOLOUR,"ColourPicker",WS_TABSTOP,84,35,32,10 - CONTROL "Use background bitmap",IDC_BITMAP,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,12,53,161,10 - EDITTEXT IDC_FILENAME,22,67,184,12,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_BROWSE,208,67,15,11 - CONTROL "Stretch to width",IDC_STRETCHH,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,22,84,100,10 - CONTROL "Stretch to height",IDC_STRETCHV,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,121,84,101,10 - CONTROL "Tile horizontally",IDC_TILEH,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,22,97,93,10 - CONTROL "Tile vertically",IDC_TILEV,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,22,110,85,10 - CONTROL "Scroll with text",IDC_SCROLL,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,121,110,100,10 - CONTROL "Stretch proportionally",IDC_PROPORTIONAL,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,121,97,101,10 - CONTROL "Tile vertically according to Row Height",IDC_TILEVROWH, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,125,205,10 -END - -IDD_OPT_META_CLC DIALOGEX 0, 0, 259, 97 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - CONTROL "Use 'Meta' protocol icons for Metacontacts",IDC_META, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,13,233,10 - CONTROL "Avoid doubleclick expand",IDC_METADBLCLK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,11,29,233,10 - CONTROL "Hide all 'Extra icons' for subcontacts", - IDC_METASUBEXTRA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 11,45,233,10 - GROUPBOX "MetaContacts supporting",-1,2,2,252,90 - CONTROL "Ignore Empty Extra icons places (arrange to right).", - IDC_METASUBEXTRA_IGN,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,11,75,233,10 - CONTROL "Hide offline subcontacts.",IDC_METASUB_HIDEOFFLINE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,60,233,10 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_DELETECONTACT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 277 - TOPMARGIN, 7 - BOTTOMMARGIN, 85 - END - - IDD_OPT_CLIST, DIALOG - BEGIN - LEFTMARGIN, 2 - RIGHTMARGIN, 312 - VERTGUIDE, 10 - VERTGUIDE, 107 - TOPMARGIN, 2 - BOTTOMMARGIN, 204 - HORZGUIDE, 182 - HORZGUIDE, 196 - END - - IDD_OPT_CLUI, DIALOG - BEGIN - LEFTMARGIN, 4 - RIGHTMARGIN, 309 - VERTGUIDE, 13 - VERTGUIDE, 23 - VERTGUIDE, 112 - VERTGUIDE, 141 - VERTGUIDE, 151 - VERTGUIDE, 175 - VERTGUIDE, 242 - VERTGUIDE, 246 - TOPMARGIN, 4 - BOTTOMMARGIN, 228 - HORZGUIDE, 18 - HORZGUIDE, 39 - HORZGUIDE, 75 - HORZGUIDE, 180 - HORZGUIDE, 196 - END - - IDD_OPT_CLC, DIALOG - BEGIN - LEFTMARGIN, 2 - RIGHTMARGIN, 312 - VERTGUIDE, 11 - VERTGUIDE, 164 - VERTGUIDE, 216 - TOPMARGIN, 2 - BOTTOMMARGIN, 249 - HORZGUIDE, 145 - HORZGUIDE, 163 - HORZGUIDE, 222 - END - - IDD_OPT_CLCBKG, DIALOG - BEGIN - LEFTMARGIN, 4 - RIGHTMARGIN, 231 - VERTGUIDE, 12 - VERTGUIDE, 22 - VERTGUIDE, 122 - TOPMARGIN, 4 - BOTTOMMARGIN, 147 - HORZGUIDE, 24 - HORZGUIDE, 40 - HORZGUIDE, 73 - HORZGUIDE, 89 - HORZGUIDE, 102 - HORZGUIDE, 115 - END - - IDD_OPT_META_CLC, DIALOG - BEGIN - LEFTMARGIN, 2 - RIGHTMARGIN, 257 - VERTGUIDE, 11 - VERTGUIDE, 244 - TOPMARGIN, 2 - BOTTOMMARGIN, 92 - END -END -#endif // APSTUDIO_INVOKED - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include \r\n" - "#include \r\n" - "#include ""statusmodes.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Cursor -// - -IDC_HYPERLINKHAND CURSOR "res/hyperlin.cur" -IDC_DROP CURSOR "res/dragcopy.cur" -IDC_DROPUSER CURSOR "res/dropuser.cur" - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_CLISTMENU MENU -BEGIN - POPUP "&¤" - BEGIN - MENUITEM SEPARATOR - MENUITEM "E&xit", ID_ICQ_EXIT - END - POPUP "&Status" - BEGIN - MENUITEM "&Offline\tCtrl+0", ID_STATUS_OFFLINE, CHECKED - MENUITEM "On&line\tCtrl+1", ID_STATUS_ONLINE - MENUITEM "&Away\tCtrl+2", ID_STATUS_AWAY - MENUITEM "&NA\tCtrl+3", ID_STATUS_NA - MENUITEM "Occ&upied\tCtrl+4", ID_STATUS_OCCUPIED - MENUITEM "&DND\tCtrl+5", ID_STATUS_DND - MENUITEM "&Free for chat\tCtrl+6", ID_STATUS_FREECHAT - MENUITEM "&Invisible\tCtrl+7", ID_STATUS_INVISIBLE - MENUITEM "On the &Phone\tCtrl+8", ID_STATUS_ONTHEPHONE - MENUITEM "Out to &Lunch\tCtrl+9", ID_STATUS_OUTTOLUNCH - END -END - -IDR_CONTEXT MENU -BEGIN - POPUP "Tray" - BEGIN - MENUITEM "&Hide/Show", ID_TRAY_HIDE - MENUITEM SEPARATOR - MENUITEM "E&xit", ID_TRAY_EXIT - END - POPUP "Nowhere" - BEGIN - MENUITEM "&New Group", POPUP_NEWGROUP - MENUITEM SEPARATOR - MENUITEM "&Hide Offline Users", POPUP_HIDEOFFLINE - MENUITEM "Hide &Offline Users out here", POPUP_HIDEOFFLINEROOT - MENUITEM "Hide &Empty Groups", POPUP_HIDEEMPTYGROUPS - MENUITEM "Disable &Groups", POPUP_DISABLEGROUPS - MENUITEM SEPARATOR - MENUITEM "Hide Miranda", POPUP_HIDEMIRANDA - END - POPUP "Group" - BEGIN - MENUITEM "&New Subgroup", POPUP_NEWSUBGROUP - MENUITEM "&Hide Offline Users in here", POPUP_GROUPHIDEOFFLINE - MENUITEM SEPARATOR - MENUITEM "&Rename Group", POPUP_RENAMEGROUP - MENUITEM "&Delete Group", POPUP_DELETEGROUP - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,3,4,0 - PRODUCTVERSION 0,3,4,0 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "000004b0" - BEGIN - VALUE "Comments", "Licensed under the terms of the GNU General Public License" - VALUE "CompanyName", " " - VALUE "FileDescription", "Miranda IM Contact List" - VALUE "FileVersion", "0.3.4 alpha" - VALUE "InternalName", "mwclist" - VALUE "LegalCopyright", "Copyright © 2000-2006 Richard Hughes, Roland Rabien, Tristan Van de Vreede, Martin Oberg, Robert Rainwater, Sam Kothari and Lyon Lim" - VALUE "OriginalFilename", "mwclist.dll" - VALUE "ProductName", "Miranda IM Contact List" - VALUE "ProductVersion", "0.3.4 alpha" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (Canada) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_OPT_SBAR DIALOGEX 0, 0, 178, 211 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Status Bar",IDC_STATIC,4,4,170,201 - CONTROL "Show status bar",IDC_SHOWSBAR,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,12,17,152,10 - CONTROL "Show icons",IDC_SHOWICON,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,20,35,142,10 - CONTROL "Show protocol names",IDC_SHOWPROTO,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,20,47,142,10 - CONTROL "Show status text",IDC_SHOWSTATUS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,20,59,142,10 - CONTROL "Right click opens status menu",IDC_RIGHTSTATUS,"Button", - BS_AUTORADIOBUTTON,20,111,142,10 - CONTROL "Right click opens Miranda menu",IDC_RIGHTMIRANDA,"Button", - BS_AUTORADIOBUTTON,20,122,142,10 - CONTROL "Make sections equal width",IDC_EQUALSECTIONS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,20,141,142,10 - CONTROL "",IDC_BKGCOLOUR,"ColourPicker",WS_TABSTOP,100,175,32,10 - LTEXT "Background colour:",IDC_STATIC,20,175,72,8,NOT WS_GROUP - PUSHBUTTON "-",IDC_DEFBKCOLOR,135,175,6,10 - CONTROL "Show size grip",IDC_SHOWSIZEGRIP,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,20,72,142,10 - CONTROL "Show bevel effect on panels",IDC_SBPANELBEVEL,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,20,86,107,10 - CONTROL "Use connecting Icon",IDC_USECONNECTINGICON,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,20,97,82,10 - CONTROL "Use New Drawer for StatusBar",IDC_USEOWNERDRAW,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,20,160,142,10 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_OPT_SBAR, DIALOG - BEGIN - LEFTMARGIN, 4 - RIGHTMARGIN, 174 - VERTGUIDE, 12 - VERTGUIDE, 22 - VERTGUIDE, 164 - TOPMARGIN, 4 - BOTTOMMARGIN, 207 - HORZGUIDE, 33 - HORZGUIDE, 73 - END -END -#endif // APSTUDIO_INVOKED - -#endif // English (Canada) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/plugins/Clist_mw/src/BkgrCfg.cpp b/plugins/Clist_mw/src/BkgrCfg.cpp new file mode 100644 index 0000000000..8753b852d6 --- /dev/null +++ b/plugins/Clist_mw/src/BkgrCfg.cpp @@ -0,0 +1,318 @@ + +#include "commonheaders.h" + +#define DEFAULT_BKCOLOUR GetSysColor(COLOR_3DFACE) +#define DEFAULT_USEBITMAP 0 +#define DEFAULT_BKBMPUSE CLB_STRETCH +#define DEFAULT_SELBKCOLOUR GetSysColor(COLOR_HIGHLIGHT) + + +extern HINSTANCE g_hInst; + +char **bkgrList = NULL; +int bkgrCount = 0; +HANDLE hEventBkgrChanged; + +#define M_BKGR_UPDATE (WM_USER+10) +#define M_BKGR_SETSTATE (WM_USER+11) +#define M_BKGR_GETSTATE (WM_USER+12) + +#define M_BKGR_BACKCOLOR 0x01 +#define M_BKGR_SELECTCOLOR 0x02 +#define M_BKGR_ALLOWBITMAPS 0x04 +#define M_BKGR_STRETCH 0x08 +#define M_BKGR_TILE 0x10 + +#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0])) +static const int bitmapRelatedControls[] = { + IDC_FILENAME,IDC_BROWSE,IDC_STRETCHH,IDC_STRETCHV,IDC_TILEH,IDC_TILEV, + IDC_SCROLL,IDC_PROPORTIONAL,IDC_TILEVROWH +}; +struct BkgrItem +{ + BYTE changed; + BYTE useBitmap; + COLORREF bkColor, selColor; + char filename[MAX_PATH]; + WORD flags; +}; +struct BkgrData +{ + struct BkgrItem *item; + int indx; + int count; +}; +static INT_PTR CALLBACK DlgProcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + struct BkgrData *dat = (struct BkgrData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + switch (msg) + { + case WM_INITDIALOG: + { + int indx; + HWND hList = GetDlgItem(hwndDlg, IDC_BKGRLIST); + TranslateDialogDefault(hwndDlg); + + dat = (struct BkgrData*)mir_alloc(sizeof(struct BkgrData)); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); + dat->count = bkgrCount; + dat->item = (struct BkgrItem*)mir_alloc(sizeof(struct BkgrItem)*dat->count); + dat->indx = CB_ERR; + for (indx = 0; indx < dat->count; indx++) + { + char *module = bkgrList[indx] + strlen(bkgrList[indx]) + 1; + int jndx; + + dat->item[indx].changed = FALSE; + dat->item[indx].useBitmap = DBGetContactSettingByte(NULL,module, "UseBitmap", DEFAULT_USEBITMAP); + dat->item[indx].bkColor = DBGetContactSettingDword(NULL,module, "BkColour", DEFAULT_BKCOLOUR); + dat->item[indx].selColor = DBGetContactSettingDword(NULL,module, "SelBkColour", DEFAULT_SELBKCOLOUR); + { + DBVARIANT dbv; + if (!DBGetContactSettingString(NULL,module,"BkBitmap",&dbv)) + { + int retval = CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)dbv.pszVal, (LPARAM)dat->item[indx].filename); + if (!retval || retval == CALLSERVICE_NOTFOUND) + lstrcpynA(dat->item[indx].filename, dbv.pszVal, MAX_PATH); + mir_free(dbv.pszVal); + } + else + *dat->item[indx].filename = 0; + } + dat->item[indx].flags = DBGetContactSettingWord(NULL,module,"BkBmpUse", DEFAULT_BKBMPUSE); + jndx = SendMessageA(hList, CB_ADDSTRING, 0, (LPARAM)Translate(bkgrList[indx])); + SendMessage(hList, CB_SETITEMDATA, jndx, indx); + } + SendMessage(hList, CB_SETCURSEL, 0, 0); + PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_BKGRLIST, CBN_SELCHANGE), 0); + { + HRESULT (STDAPICALLTYPE *MySHAutoComplete)(HWND,DWORD); + MySHAutoComplete = (HRESULT (STDAPICALLTYPE*)(HWND,DWORD))GetProcAddress(GetModuleHandleA("shlwapi"),"SHAutoComplete"); + if (MySHAutoComplete) MySHAutoComplete(GetDlgItem(hwndDlg,IDC_FILENAME),1); + } + return TRUE; + } + case WM_DESTROY: + if (dat) + { + if (dat->item) mir_free(dat->item); + mir_free(dat); + } + + return TRUE; + + case M_BKGR_GETSTATE: + { + int indx = wParam; + if (indx == CB_ERR || indx >= dat->count) break; + indx = SendDlgItemMessage(hwndDlg, IDC_BKGRLIST, CB_GETITEMDATA, indx, 0); + + dat->item[indx].useBitmap = IsDlgButtonChecked(hwndDlg,IDC_BITMAP); + dat->item[indx].bkColor = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR,0,0); + dat->item[indx].selColor = SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_GETCOLOUR,0,0); + GetDlgItemTextA(hwndDlg, IDC_FILENAME, dat->item[indx].filename, sizeof(dat->item[indx].filename)); + { + WORD flags = 0; + if (IsDlgButtonChecked(hwndDlg,IDC_STRETCHH)) flags |= CLB_STRETCHH; + if (IsDlgButtonChecked(hwndDlg,IDC_STRETCHV)) flags |= CLB_STRETCHV; + if (IsDlgButtonChecked(hwndDlg,IDC_TILEH)) flags |= CLBF_TILEH; + if (IsDlgButtonChecked(hwndDlg,IDC_TILEV)) flags |= CLBF_TILEV; + if (IsDlgButtonChecked(hwndDlg,IDC_SCROLL)) flags |= CLBF_SCROLL; + if (IsDlgButtonChecked(hwndDlg,IDC_PROPORTIONAL)) flags |= CLBF_PROPORTIONAL; + if (IsDlgButtonChecked(hwndDlg,IDC_TILEVROWH)) flags |= CLBF_TILEVTOROWHEIGHT; + dat->item[indx].flags = flags; + } + break; + } + case M_BKGR_SETSTATE: + { + int indx = wParam; + int flags = dat->item[indx].flags; + if (indx == CB_ERR || indx >= dat->count) break; + indx = SendDlgItemMessage(hwndDlg, IDC_BKGRLIST, CB_GETITEMDATA, indx, 0); + + CheckDlgButton(hwndDlg, IDC_BITMAP, dat->item[indx].useBitmap?BST_CHECKED:BST_UNCHECKED); + + SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETDEFAULTCOLOUR, 0, DEFAULT_BKCOLOUR); + SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETCOLOUR, 0, dat->item[indx].bkColor); + SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_SETDEFAULTCOLOUR, 0, DEFAULT_SELBKCOLOUR); + SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_SETCOLOUR, 0, dat->item[indx].selColor); + SetDlgItemTextA(hwndDlg, IDC_FILENAME, dat->item[indx].filename); + + CheckDlgButton(hwndDlg,IDC_STRETCHH, flags&CLB_STRETCHH?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_STRETCHV,flags&CLB_STRETCHV?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_TILEH,flags&CLBF_TILEH?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_TILEV,flags&CLBF_TILEV?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_SCROLL,flags&CLBF_SCROLL?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_PROPORTIONAL,flags&CLBF_PROPORTIONAL?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_TILEVROWH,flags&CLBF_TILEVTOROWHEIGHT?BST_CHECKED:BST_UNCHECKED); + + SendMessage(hwndDlg, M_BKGR_UPDATE, 0,0); + break; + } + case M_BKGR_UPDATE: + { + int isChecked = IsDlgButtonChecked(hwndDlg,IDC_BITMAP); + int indx; + for (indx = 0; indx < ARRAY_SIZE(bitmapRelatedControls); indx++) + EnableWindow(GetDlgItem(hwndDlg, bitmapRelatedControls[indx]),isChecked); + break; + } + case WM_COMMAND: + if (LOWORD(wParam) == IDC_BROWSE) { + char str[MAX_PATH]; + OPENFILENAMEA ofn = {0}; + char filter[512]; + + GetDlgItemTextA(hwndDlg,IDC_FILENAME, str, sizeof(str)); + ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; + ofn.hwndOwner = hwndDlg; + ofn.hInstance = NULL; + CallService(MS_UTILS_GETBITMAPFILTERSTRINGS, sizeof(filter), (LPARAM)filter); + ofn.lpstrFilter = filter; + ofn.lpstrFile = str; + ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + ofn.nMaxFile = sizeof(str); + ofn.nMaxFileTitle = MAX_PATH; + ofn.lpstrDefExt = "bmp"; + if (!GetOpenFileNameA(&ofn)) break; + SetDlgItemTextA(hwndDlg, IDC_FILENAME, str); + } + else if (LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) != EN_CHANGE) + break; + + if (LOWORD(wParam) == IDC_BITMAP) + SendMessage(hwndDlg, M_BKGR_UPDATE, 0,0); + if (LOWORD(wParam) == IDC_FILENAME && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) + return 0; + if (LOWORD(wParam) == IDC_BKGRLIST) { + if (HIWORD(wParam) == CBN_SELCHANGE) { + SendMessage(hwndDlg, M_BKGR_GETSTATE, dat->indx, 0); + SendMessage(hwndDlg, M_BKGR_SETSTATE, dat->indx = SendDlgItemMessage(hwndDlg, IDC_BKGRLIST, CB_GETCURSEL, 0,0), 0); + } + return 0; + } + { + int indx = SendDlgItemMessage(hwndDlg, IDC_BKGRLIST, CB_GETCURSEL, 0,0); + if (indx != CB_ERR && indx < dat->count) { + indx = SendDlgItemMessage(hwndDlg, IDC_BKGRLIST, CB_GETITEMDATA, indx, 0); + dat->item[indx].changed = TRUE; + + } + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0,0); + } + break; + case WM_NOTIFY: + switch(((LPNMHDR)lParam)->idFrom) + { + case 0: + switch (((LPNMHDR)lParam)->code) + { + case PSN_APPLY: + { + int indx; + SendMessage(hwndDlg, M_BKGR_GETSTATE, SendDlgItemMessage(hwndDlg, IDC_BKGRLIST, CB_GETCURSEL, 0,0), 0); + for (indx = 0; indx < dat->count; indx++) + if (dat->item[indx].changed) + { + char *module = bkgrList[indx] + strlen(bkgrList[indx]) + 1; + DBWriteContactSettingByte(NULL, module, "UseBitmap", (BYTE)dat->item[indx].useBitmap); + { + COLORREF col; + + if ((col = dat->item[indx].bkColor) == DEFAULT_BKCOLOUR) + DBDeleteContactSetting(NULL, module, "BkColour"); + else + DBWriteContactSettingDword(NULL, module, "BkColour", col); + + if ((col = dat->item[indx].selColor) == DEFAULT_SELBKCOLOUR) + DBDeleteContactSetting(NULL, module, "SelBkColour"); + else + DBWriteContactSettingDword(NULL, module, "SelBkColour", col); + } + { + char str[MAX_PATH]; + int retval = CallService(MS_UTILS_PATHTOABSOLUTE, + (WPARAM)dat->item[indx].filename, + (LPARAM)str); + if (!retval || retval == CALLSERVICE_NOTFOUND) + DBWriteContactSettingString(NULL, module, "BkBitmap", dat->item[indx].filename); + else + DBWriteContactSettingString(NULL, module, "BkBitmap", str); + } + DBWriteContactSettingWord(NULL, module, "BkBmpUse", dat->item[indx].flags); + dat->item[indx].changed = FALSE; + NotifyEventHooks(hEventBkgrChanged, (WPARAM)module, 0); + } + return TRUE; + } + } + break; + } + break; + } + return FALSE; +} + +static INT_PTR BkgrCfg_Register(WPARAM wParam,LPARAM lParam) +{ + char *szSetting = (char *)wParam; + char *value, *tok; + size_t len = strlen(szSetting) + 1; + + value = (char *)mir_alloc(len + 4); // add room for flags (DWORD) + memcpy(value, szSetting, len); + tok = strchr(value, '/'); + if (tok == NULL) { + mir_free(value); + return 1; + } + *tok = 0; + *(DWORD*)(value + len) = lParam; + + bkgrList = (char **)mir_realloc(bkgrList, sizeof(char*)*(bkgrCount+1)); + bkgrList[bkgrCount] = value; + bkgrCount++; + + return 0; +} + +int OnOptionsInit(WPARAM wParam,LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp = { 0 }; + odp.cbSize = sizeof(odp); + odp.hInstance = g_hInst; + odp.pszGroup = LPGEN("Customize"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLCBKG2); + odp.pszTitle = LPGEN("Backgrounds"); + odp.pfnDlgProc = DlgProcBkgOpts; + odp.flags = ODPF_BOLDGROUPS; + Options_AddPage(wParam, &odp); + + return 0; +} + +int BGModuleLoad() +{ + HookEvent(ME_OPT_INITIALISE, OnOptionsInit); + + CreateServiceFunction(MS_BACKGROUNDCONFIG_REGISTER, BkgrCfg_Register); + + hEventBkgrChanged = CreateHookableEvent(ME_BACKGROUNDCONFIG_CHANGED); + return 0; +} + +int BGModuleUnload(void) +{ + if (bkgrList != NULL) + { + int indx; + for (indx = 0; indx < bkgrCount; indx++) + if (bkgrList[indx] != NULL) + mir_free(bkgrList[indx]); + mir_free(bkgrList); + } + DestroyHookableEvent(hEventBkgrChanged); + + return 0; +} diff --git a/plugins/Clist_mw/src/BkgrCfg.h b/plugins/Clist_mw/src/BkgrCfg.h new file mode 100644 index 0000000000..a47b53a603 --- /dev/null +++ b/plugins/Clist_mw/src/BkgrCfg.h @@ -0,0 +1,18 @@ +// +// 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 "BkgrCfg/Register" + +// +// Notification about changed background +// wParam = ModuleName +// lParam = 0 +#define ME_BACKGROUNDCONFIG_CHANGED "BkgrCfg/Changed" + +#define CLBF_TILEVTOROWHEIGHT 0x0100 diff --git a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp new file mode 100644 index 0000000000..26a8a0cb63 --- /dev/null +++ b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp @@ -0,0 +1,3013 @@ +/* +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 "../commonheaders.h" + +extern HINSTANCE g_hInst; + +//we use dynamic frame list, +//but who wants so huge number of frames ?? +#define MAX_FRAMES 16 + +#define UNCOLLAPSED_FRAME_SIZE 0 +#define DEFAULT_TITLEBAR_HEIGHT 20 + +//legacy menu support +#define frame_menu_lock 1 +#define frame_menu_visible 2 +#define frame_menu_showtitlebar 3 +#define frame_menu_floating 4 +extern int ModifyMenuItemProxy(WPARAM wParam,LPARAM lParam); +static int UpdateTBToolTip(int framepos); +INT_PTR CLUIFrameSetFloat(WPARAM wParam,LPARAM lParam); +int CLUIFrameResizeFloatingFrame(int framepos); +extern int ProcessCommandProxy(WPARAM wParam,LPARAM lParam); +extern int InitFramesMenus(void); +int GapBetweenTitlebar; + +LOGFONTA TitleBarLogFont = {0}; + +boolean FramesSysNotStarted = TRUE; + +HANDLE hService[20], hHook[4]; + +typedef struct +{ + int order; + int realpos; +} + SortData; + +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);} + //if (sd1->order == sd2->order){return 0;} + return 0; +} + + +//============ +#define CLUIFRAMESSETALIGN "CLUIFramesSetAlign" + +#define CLUIFRAMESSETALIGNALTOP "CLUIFramesSetAlignalTop" +#define CLUIFRAMESSETALIGNALCLIENT "CLUIFramesSetAlignalClient" +#define CLUIFRAMESSETALIGNALBOTTOM "CLUIFramesSetAlignalBottom" + +#define CLUIFRAMESMOVEUPDOWN "CLUIFramesMoveUpDown" +typedef struct tagMenuHandles +{ + HANDLE MainMenuItem; + HANDLE MIVisible,MITitle,MITBVisible,MILock,MIColl,MIFloating,MIAlignRoot; + HANDLE MIAlignTop,MIAlignClient,MIAlignBottom; + HANDLE MIBorder; +} FrameMenuHandles; + +typedef struct tagFrameTitleBar{ + HWND hwnd; + HWND TitleBarbutt; + HWND hwndTip; + + LPTSTR tbname; + LPTSTR tooltip; + HMENU hmenu; + HICON hicon; + + BOOLEAN ShowTitleBar; + BOOLEAN ShowTitleBarTip; + COLORREF BackColour; + int oldstyles; + POINT oldpos; + RECT wndSize; +} FrameTitleBar; + +typedef struct _DockOpt +{ + HWND hwndLeft; + HWND hwndRight; +} +DockOpt; + +typedef struct { + int id; + HWND hWnd ; + RECT wndSize; + LPTSTR name; + int align; + int height; + int dwFlags; + BOOLEAN Locked; + BOOLEAN visible; + BOOLEAN needhide; + BOOLEAN collapsed; + int prevvisframe; + int HeightWhenCollapsed; + FrameTitleBar TitleBar; + FrameMenuHandles MenuHandles; + int oldstyles; + BOOLEAN floating; + HWND ContainerWnd; + POINT FloatingPos; + POINT FloatingSize; + BOOLEAN minmaxenabled; + BOOLEAN UseBorder; + int order; + DockOpt dockOpt; +} wndFrame; + +//static wndFrame Frames[MAX_FRAMES]; +static wndFrame *Frames = NULL; + +static int nFramescount = 0; +static int alclientFrame = -1;//for fast access to frame with alclient properties +static int NextFrameId = 100; + +HFONT TitleBarFont; +static int TitleBarH = DEFAULT_TITLEBAR_HEIGHT; +static boolean resizing = FALSE; + +// menus +static HANDLE contMIVisible,contMITitle,contMITBVisible,contMILock,contMIColl,contMIFloating; +static HANDLE contMIAlignRoot; +static HANDLE contMIAlignTop,contMIAlignClient,contMIAlignBottom; +static HANDLE contMIBorder; +static HGENMENU MainMIRoot = (HGENMENU)-1; + +// others +static int ContactListHeight; +static int LastStoreTick = 0; + +static int lbypos = -1; +static int oldframeheight = -1; +static int curdragbar = -1; +static CRITICAL_SECTION csFrameHook; + +static BOOLEAN CLUIFramesFitInSize(void); +static int RemoveItemFromList(int pos,wndFrame **lpFrames,int *FrameItemCount); +HWND hWndExplorerToolBar; +static int GapBetweenFrames = 1; + +static int RemoveItemFromList(int pos,wndFrame **lpFrames,int *FrameItemCount) +{ + memcpy(&((*lpFrames)[pos]),&((*lpFrames)[pos+1]),sizeof(wndFrame)*(*FrameItemCount-pos-1)); + (*FrameItemCount)--; + (*lpFrames) = (wndFrame*)realloc((*lpFrames),sizeof(wndFrame)*(*FrameItemCount)); + return 0; +} + +static int id2pos(int id) +{ + if (FramesSysNotStarted) + return -1; + + for (int i = 0;idockOpt.hwndLeft == NULL && pThumbLeft->dockOpt.hwndRight == NULL ) { + pThumbRight->dockOpt.hwndLeft = pThumbLeft->ContainerWnd; + pThumbLeft->dockOpt.hwndRight = pThumbRight->ContainerWnd; + } +} + +static void UndockThumbs( wndFrame *pThumb1, wndFrame *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; +} + +BOOLEAN bMoveTogether; + +static void PositionThumb( wndFrame *pThumb, short nX, short nY ) +{ + wndFrame *pCurThumb = &Frames[0]; + wndFrame *pDockThumb = pThumb; + wndFrame fakeMainWindow; + wndFrame fakeTaskBarWindow; + RECT rc; + RECT rcThumb; + RECT rcOld; + SIZE sizeScreen; + 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; + + 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, TRUE ); + + if ( bDockedLeft ) + DockThumbs( pCurThumb, pThumb, FALSE ); + } + + // 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 = nFramescount){ + pCurThumb = &fakeMainWindow;continue; + } + + pCurThumb = &Frames[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 ); + + // OK, move all docked thumbs + if ( bMoveTogether ) { + pDockThumb = FindFrameByWnd( pDockThumb->dockOpt.hwndRight ); + PositionThumb( pDockThumb, (short)( nNewX + nWidth ), (short)nNewY ); + } +} + +////////// + +void GetBorderSize(HWND hwnd,RECT *rect) +{ + RECT wr,cr; + POINT pt1,pt2; + + 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; +} + +//append string +char __inline *AS(char *str,const char *setting,char *addstr) +{ + if (str != NULL) { + strcpy(str,setting); + strcat(str,addstr); + } + return str; +} + +int DBLoadFrameSettingsAtPos(int pos,int Frameid) +{ + char sadd[15]; + char buf[255]; + + _itoa(pos,sadd,10); + + //boolean + Frames[Frameid].collapsed = DBGetContactSettingByte(0,CLUIFrameModule,AS(buf,"Collapse",sadd),Frames[Frameid].collapsed); + + Frames[Frameid].Locked = DBGetContactSettingByte(0,CLUIFrameModule,AS(buf,"Locked",sadd),Frames[Frameid].Locked); + Frames[Frameid].visible = DBGetContactSettingByte(0,CLUIFrameModule,AS(buf,"Visible",sadd),Frames[Frameid].visible); + Frames[Frameid].TitleBar.ShowTitleBar = DBGetContactSettingByte(0,CLUIFrameModule,AS(buf,"TBVisile",sadd),Frames[Frameid].TitleBar.ShowTitleBar); + + Frames[Frameid].height = DBGetContactSettingWord(0,CLUIFrameModule,AS(buf,"Height",sadd),Frames[Frameid].height); + Frames[Frameid].HeightWhenCollapsed = DBGetContactSettingWord(0,CLUIFrameModule,AS(buf,"HeightCollapsed",sadd),0); + Frames[Frameid].align = DBGetContactSettingWord(0,CLUIFrameModule,AS(buf,"Align",sadd),Frames[Frameid].align); + + Frames[Frameid].FloatingPos.x = DBGetContactSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatX",sadd),100,0,1024); + Frames[Frameid].FloatingPos.y = DBGetContactSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatY",sadd),100,0,1024); + Frames[Frameid].FloatingSize.x = DBGetContactSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatW",sadd),100,0,1024); + Frames[Frameid].FloatingSize.y = DBGetContactSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatH",sadd),100,0,1024); + + Frames[Frameid].floating = DBGetContactSettingByte(0,CLUIFrameModule,AS(buf,"Floating",sadd),0); + Frames[Frameid].order = DBGetContactSettingWord(0,CLUIFrameModule,AS(buf,"Order",sadd),0); + + Frames[Frameid].UseBorder = DBGetContactSettingByte(0,CLUIFrameModule,AS(buf,"UseBorder",sadd),Frames[Frameid].UseBorder); + + return 0; +} + +int DBStoreFrameSettingsAtPos(int pos,int Frameid) +{ + char sadd[16]; + char buf[255]; + + _itoa(pos,sadd,10); + + DBWriteContactSettingTString(0,CLUIFrameModule,AS(buf,"Name",sadd),Frames[Frameid].name); + //boolean + DBWriteContactSettingByte(0,CLUIFrameModule,AS(buf,"Collapse",sadd),(BYTE)btoint(Frames[Frameid].collapsed)); + DBWriteContactSettingByte(0,CLUIFrameModule,AS(buf,"Locked",sadd),(BYTE)btoint(Frames[Frameid].Locked)); + DBWriteContactSettingByte(0,CLUIFrameModule,AS(buf,"Visible",sadd),(BYTE)btoint(Frames[Frameid].visible)); + DBWriteContactSettingByte(0,CLUIFrameModule,AS(buf,"TBVisile",sadd),(BYTE)btoint(Frames[Frameid].TitleBar.ShowTitleBar)); + + DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"Height",sadd),(WORD)Frames[Frameid].height); + DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"HeightCollapsed",sadd),(WORD)Frames[Frameid].HeightWhenCollapsed); + DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"Align",sadd),(WORD)Frames[Frameid].align); + //FloatingPos + DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"FloatX",sadd),(WORD)Frames[Frameid].FloatingPos.x); + DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"FloatY",sadd),(WORD)Frames[Frameid].FloatingPos.y); + DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"FloatW",sadd),(WORD)Frames[Frameid].FloatingSize.x); + DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"FloatH",sadd),(WORD)Frames[Frameid].FloatingSize.y); + + DBWriteContactSettingByte(0,CLUIFrameModule,AS(buf,"Floating",sadd),(BYTE)btoint(Frames[Frameid].floating)); + DBWriteContactSettingByte(0,CLUIFrameModule,AS(buf,"UseBorder",sadd),(BYTE)btoint(Frames[Frameid].UseBorder)); + DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"Order",sadd),(WORD)Frames[Frameid].order); + //DBWriteContactSettingString(0,CLUIFrameModule,AS(buf,"TBName",sadd),Frames[Frameid].TitleBar.tbname); + return 0; +} + +int LocateStorePosition(int Frameid,int maxstored) +{ + int i; + LPTSTR frmname; + char settingname[255]; + if (Frames[Frameid].name == NULL) return -1; + + for (i = 0;i= nFramescount) + return -1; + + int maxstored = DBGetContactSettingWord(0,CLUIFrameModule,"StoredFrames",-1); + if (maxstored == -1) + return 0; + + int storpos = LocateStorePosition(Frameid,maxstored); + if (storpos == -1) + return 0; + + DBLoadFrameSettingsAtPos(storpos,Frameid); + return 0; +} + +int CLUIFramesStoreFrameSettings(int Frameid) +{ + if (Frameid < 0 || Frameid >= nFramescount) + return -1; + + int maxstored = DBGetContactSettingWord(0,CLUIFrameModule,"StoredFrames",-1); + if (maxstored == -1) maxstored = 0; + + int storpos = LocateStorePosition(Frameid,maxstored); + if (storpos == -1) {storpos = maxstored; maxstored++;} + + DBStoreFrameSettingsAtPos(storpos,Frameid); + DBWriteContactSettingWord(0,CLUIFrameModule,"StoredFrames",(WORD)maxstored); + //ulockfrm(); + return 0; +} + +int CLUIFramesStoreAllFrames() +{ + lockfrm(); + for (int i = 0;i= 0 && pos < nFramescount) { + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.flags = CMIM_NAME|CMIF_CHILDPOPUP|CMIF_TCHAR; + mi.ptszName = Frames[pos].TitleBar.tbname ? Frames[pos].TitleBar.tbname : Frames[pos].name; + ModifyMItem((WPARAM)contMITitle,(LPARAM)&mi); + + mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; + if (Frames[pos].visible) mi.flags |= CMIF_CHECKED; + ModifyMItem((WPARAM)contMIVisible,(LPARAM)&mi); + + mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; + if (Frames[pos].Locked) mi.flags |= CMIF_CHECKED; + ModifyMItem((WPARAM)contMILock,(LPARAM)&mi); + + mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; + if (Frames[pos].TitleBar.ShowTitleBar) mi.flags |= CMIF_CHECKED; + ModifyMItem((WPARAM)contMITBVisible,(LPARAM)&mi); + + mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; + if (Frames[pos].floating) mi.flags |= CMIF_CHECKED; + ModifyMItem((WPARAM)contMIFloating,(LPARAM)&mi); + + mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; + if ((Frames[pos].UseBorder)) mi.flags |= CMIF_CHECKED; + ModifyMItem((WPARAM)contMIBorder,(LPARAM)&mi); + + mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; + if (Frames[pos].align&alTop) mi.flags |= CMIF_CHECKED; + ModifyMItem((WPARAM)contMIAlignTop,(LPARAM)&mi); + + mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; + if (Frames[pos].align&alClient) mi.flags |= CMIF_CHECKED; + ModifyMItem((WPARAM)contMIAlignClient,(LPARAM)&mi); + + mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; + if (Frames[pos].align&alBottom) mi.flags |= CMIF_CHECKED; + ModifyMItem((WPARAM)contMIAlignBottom,(LPARAM)&mi); + + mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; + if (Frames[pos].collapsed) mi.flags |= CMIF_CHECKED; + if ((!Frames[pos].visible)||(Frames[pos].Locked)||(pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED; + ModifyMItem((WPARAM)contMIColl,(LPARAM)&mi); + } + ulockfrm(); + return 0; +} + +INT_PTR CLUIFramesModifyMainMenuItems(WPARAM wParam,LPARAM lParam) +{ + lockfrm(); + + int pos = id2pos(wParam); + if (pos >= 0 && pos < nFramescount) { + CLISTMENUITEM mi = { 0 }; + mi.cbSize = sizeof(mi); + mi.flags = CMIM_NAME|CMIF_CHILDPOPUP|CMIF_TCHAR; + mi.ptszName = Frames[pos].TitleBar.tbname ? Frames[pos].TitleBar.tbname : Frames[pos].name; + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MITitle,(LPARAM)&mi); + + mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; + if (Frames[pos].visible) mi.flags |= CMIF_CHECKED; + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MIVisible,(LPARAM)&mi); + + mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; + if (Frames[pos].Locked) mi.flags |= CMIF_CHECKED; + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MILock,(LPARAM)&mi); + + mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; + if (Frames[pos].TitleBar.ShowTitleBar) mi.flags |= CMIF_CHECKED; + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MITBVisible,(LPARAM)&mi); + + mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; + if (Frames[pos].floating) mi.flags |= CMIF_CHECKED; + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MIFloating,(LPARAM)&mi); + + mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; + if ((Frames[pos].UseBorder)) mi.flags |= CMIF_CHECKED; + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MIBorder,(LPARAM)&mi); + + mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP|((Frames[pos].align&alClient)?CMIF_GRAYED:0); + if (Frames[pos].align&alTop) mi.flags |= CMIF_CHECKED; + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MIAlignTop,(LPARAM)&mi); + + mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; + if (Frames[pos].align&alClient) mi.flags |= CMIF_CHECKED; + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MIAlignClient,(LPARAM)&mi); + + mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP|((Frames[pos].align&alClient)?CMIF_GRAYED:0); + if (Frames[pos].align&alBottom) mi.flags |= CMIF_CHECKED; + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MIAlignBottom,(LPARAM)&mi); + + mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; + if (Frames[pos].collapsed) mi.flags |= CMIF_CHECKED; + if ((!Frames[pos].visible)||Frames[pos].Locked||(pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED; + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MIColl,(LPARAM)&mi); + } + ulockfrm(); + return 0; +} + +//hiword(wParam) = frameid,loword(wParam) = flag +INT_PTR CLUIFramesGetFrameOptions(WPARAM wParam,LPARAM lParam) +{ + if (FramesSysNotStarted) return 0; + + lockfrm(); + int pos = id2pos(HIWORD(wParam)); + if (pos < 0 || pos >= nFramescount) { + ulockfrm(); + return -1; + } + + INT_PTR retval; + + switch(LOWORD(wParam)) { + case FO_FLAGS: + retval = 0; + if (Frames[pos].visible) retval |= F_VISIBLE; + if (!Frames[pos].collapsed) retval |= F_UNCOLLAPSED; + if (Frames[pos].Locked) retval |= F_LOCKED; + if (Frames[pos].TitleBar.ShowTitleBar) retval |= F_SHOWTB; + if (Frames[pos].TitleBar.ShowTitleBarTip) retval |= F_SHOWTBTIP; + if (!(GetWindowLongPtr(Frames[pos].hWnd,GWL_STYLE)&WS_BORDER)) retval |= F_NOBORDER; + break; + + case FO_NAME: + retval = (INT_PTR)Frames[pos].name; + break; + + case FO_TBNAME: + retval = (INT_PTR)Frames[pos].TitleBar.tbname; + break; + + case FO_TBTIPNAME: + retval = (INT_PTR)Frames[pos].TitleBar.tooltip; + break; + + case FO_TBSTYLE: + retval = GetWindowLongPtr(Frames[pos].TitleBar.hwnd,GWL_STYLE); + break; + + case FO_TBEXSTYLE: + retval = GetWindowLongPtr(Frames[pos].TitleBar.hwnd,GWL_EXSTYLE); + break; + + case FO_ICON: + retval = (INT_PTR)Frames[pos].TitleBar.hicon; + break; + + case FO_HEIGHT: + retval = (INT_PTR)Frames[pos].height; + break; + + case FO_ALIGN: + retval = (INT_PTR)Frames[pos].align; + break; + case FO_FLOATING: + retval = (INT_PTR)Frames[pos].floating; + break; + default: + retval = -1; + break; + } + ulockfrm(); + return retval; +} + +//hiword(wParam) = frameid,loword(wParam) = flag +INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam,LPARAM lParam) +{ + lockfrm(); + int pos = id2pos(HIWORD(wParam)); + if (pos<0||pos>=nFramescount) { + ulockfrm(); + return -1; + } + + INT_PTR retval; // value to be returned + + switch(LOWORD(wParam) & ~FO_UNICODETEXT) { + case FO_FLAGS:{ + int flag = lParam; + int style; + + Frames[pos].dwFlags = flag; + Frames[pos].visible = FALSE; + if (flag&F_VISIBLE) Frames[pos].visible = TRUE; + + Frames[pos].collapsed = TRUE; + if (flag&F_UNCOLLAPSED) Frames[pos].collapsed = FALSE; + + Frames[pos].Locked = FALSE; + if (flag&F_LOCKED) Frames[pos].Locked = TRUE; + + Frames[pos].UseBorder = TRUE; + if (flag&F_NOBORDER) Frames[pos].UseBorder = FALSE; + + Frames[pos].TitleBar.ShowTitleBar = FALSE; + if (flag&F_SHOWTB) Frames[pos].TitleBar.ShowTitleBar = TRUE; + + Frames[pos].TitleBar.ShowTitleBarTip = FALSE; + if (flag&F_SHOWTBTIP) Frames[pos].TitleBar.ShowTitleBarTip = TRUE; + + SendMessage(Frames[pos].TitleBar.hwndTip,TTM_ACTIVATE,(WPARAM)Frames[pos].TitleBar.ShowTitleBarTip,0); + + style = (int)GetWindowLongPtr(Frames[pos].hWnd,GWL_STYLE); + style |= WS_BORDER; + if (flag&F_NOBORDER) {style &= (~WS_BORDER);} + SetWindowLongPtr(Frames[pos].hWnd,GWL_STYLE,(LONG)style); + ulockfrm(); + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,(LPARAM)0); + return 0; + } + + case FO_NAME: + if (lParam == (LPARAM)NULL) {ulockfrm(); return -1;} + mir_free(Frames[pos].name); + Frames[pos].name = mir_tstrdup((LPTSTR)lParam); + ulockfrm(); + return 0; + + case FO_TBNAME: + if (lParam == (LPARAM)NULL) {ulockfrm(); return(-1);} + mir_free(Frames[pos].TitleBar.tbname); + Frames[pos].TitleBar.tbname = mir_tstrdup((LPTSTR)lParam); + ulockfrm(); + if (Frames[pos].floating&&(Frames[pos].TitleBar.tbname != NULL)){SetWindowText(Frames[pos].ContainerWnd,Frames[pos].TitleBar.tbname);} + return 0; + + case FO_TBTIPNAME: + if (lParam == (LPARAM)NULL) {ulockfrm(); return(-1);} + mir_free(Frames[pos].TitleBar.tooltip); + Frames[pos].TitleBar.tooltip = mir_tstrdup((LPTSTR)lParam); + UpdateTBToolTip(pos); + ulockfrm(); + return 0; + + case FO_TBSTYLE: + SetWindowLongPtr(Frames[pos].TitleBar.hwnd,GWL_STYLE,lParam); + ulockfrm(); + return 0; + + case FO_TBEXSTYLE: + SetWindowLongPtr(Frames[pos].TitleBar.hwnd,GWL_EXSTYLE,lParam); + ulockfrm(); + return 0; + + case FO_ICON: + Frames[pos].TitleBar.hicon = (HICON)lParam; + ulockfrm(); + return 0; + + case FO_HEIGHT: + if (lParam<0) {ulockfrm(); return -1;} + retval = Frames[pos].height; + Frames[pos].height = lParam; + if (!CLUIFramesFitInSize()) Frames[pos].height = retval; + retval = Frames[pos].height; + ulockfrm(); + + return retval; + + case FO_FLOATING: + if (lParam<0) {ulockfrm(); return -1;} + + { + int id = Frames[pos].id; + Frames[pos].floating = !(lParam); + ulockfrm(); + + CLUIFrameSetFloat(id,1);//lparam = 1 use stored width and height + return wParam; + } + + case FO_ALIGN: + if ( !(lParam&alTop || lParam&alBottom || lParam&alClient)) { + OutputDebugStringA("Wrong align option \r\n"); + return (-1); + } + + if ((lParam&alClient)&&(CLUIFramesGetalClientFrame()>=0)) { //only one alClient frame possible + alclientFrame = -1;//recalc it + ulockfrm(); + return -1; + } + Frames[pos].align = lParam; + + ulockfrm(); + return 0; + } + ulockfrm(); + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,(LPARAM)0); + return -1; +} + +//wparam = lparam = 0 +static INT_PTR CLUIFramesShowAll(WPARAM wParam,LPARAM lParam) +{ + for (int i = 0;ihwndContactList,(LPARAM)0); + return 0; +} + +//wparam = lparam = 0 +INT_PTR CLUIFramesShowAllTitleBars(WPARAM wParam,LPARAM lParam) +{ + for (int i = 0;ihwndContactList,(LPARAM)0); + return 0; +} + +//wparam = lparam = 0 +INT_PTR CLUIFramesHideAllTitleBars(WPARAM wParam,LPARAM lParam) +{ + for (int i = 0;ihwndContactList,(LPARAM)0); + return 0; +} + +//wparam = frameid +INT_PTR CLUIFramesShowHideFrame(WPARAM wParam,LPARAM lParam) +{ + lockfrm(); + int pos = id2pos(wParam); + if ( pos >= 0 && (int)pos < nFramescount) + Frames[pos].visible = !Frames[pos].visible; + if (Frames[pos].floating) + CLUIFrameResizeFloatingFrame(pos); + ulockfrm(); + + if (!Frames[pos].floating) + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,(LPARAM)0); + return 0; +} + +//wparam = frameid +INT_PTR CLUIFramesShowHideFrameTitleBar(WPARAM wParam,LPARAM lParam) +{ + lockfrm(); + int pos = id2pos(wParam); + if ( pos >= 0 && (int)pos < nFramescount) + Frames[pos].TitleBar.ShowTitleBar = !Frames[pos].TitleBar.ShowTitleBar; + + ulockfrm(); + + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,(LPARAM)0); + return 0; +} + +//wparam = frameid +//lparam = -1 up ,1 down +INT_PTR CLUIFramesMoveUpDown(WPARAM wParam,LPARAM lParam) +{ + int pos,i,curpos,curalign,v,tmpval; + + lockfrm(); + pos = id2pos(wParam); + if (pos>=0&&(int)pos= v-1) + break; + + tmpval = Frames[sd[i+1].realpos].order; + Frames[sd[i+1].realpos].order = Frames[pos].order; + Frames[pos].order = tmpval; + break; + } + if (lParam == +1) { + if (i < 1) + break; + + tmpval = Frames[sd[i-1].realpos].order; + Frames[sd[i-1].realpos].order = Frames[pos].order; + Frames[pos].order = tmpval; + break; + } + } + } + + if (sd != NULL) + free(sd); + CLUIFramesStoreFrameSettings(pos); + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0); + } + ulockfrm(); + return 0; +} + +//wparam = frameid +//lparam = alignment +INT_PTR CLUIFramesSetAlign(WPARAM wParam,LPARAM lParam) +{ + CLUIFramesSetFrameOptions(MAKEWPARAM(FO_ALIGN,wParam),lParam); + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0); + return 0; +} + +INT_PTR CLUIFramesSetAlignalTop(WPARAM wParam,LPARAM lParam) +{ + return CLUIFramesSetAlign(wParam,alTop); +} + +INT_PTR CLUIFramesSetAlignalBottom(WPARAM wParam,LPARAM lParam) +{ + return CLUIFramesSetAlign(wParam,alBottom); +} + +INT_PTR CLUIFramesSetAlignalClient(WPARAM wParam,LPARAM lParam) +{ + return CLUIFramesSetAlign(wParam,alClient); +} + +//wparam = frameid +INT_PTR CLUIFramesLockUnlockFrame(WPARAM wParam,LPARAM lParam) +{ + lockfrm(); + int pos = id2pos(wParam); + if (pos >= 0 && (int)pos < nFramescount) { + Frames[pos].Locked = !Frames[pos].Locked; + CLUIFramesStoreFrameSettings(pos); + } + ulockfrm(); + return 0; +} + +//wparam = frameid +INT_PTR CLUIFramesSetUnSetBorder(WPARAM wParam,LPARAM lParam) +{ + int oldflags; + + lockfrm(); + int FrameId = id2pos(wParam); + if (FrameId == -1) { + ulockfrm(); + return -1; + } + + boolean flt = oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,wParam),0); + if (oldflags & F_NOBORDER) + oldflags &= (~F_NOBORDER); + else + oldflags |= F_NOBORDER; + + HWND hw = Frames[FrameId].hWnd; + RECT rc; + GetWindowRect(hw, &rc); + + ulockfrm(); + CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,wParam),oldflags); + + SetWindowPos(hw,0,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_DRAWFRAME); + return 0; +} + +//wparam = frameid +INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam,LPARAM lParam) +{ + int FrameId; + + lockfrm(); + FrameId = id2pos(wParam); + if (FrameId >= 0 && FrameId < nFramescount) { + int oldHeight; + + // do not collapse/uncollapse client/locked/invisible frames + if (Frames[FrameId].align == alClient&&!(Frames[FrameId].Locked||(!Frames[FrameId].visible)||Frames[FrameId].floating)) { + RECT rc; + if (CallService(MS_CLIST_DOCKINGISDOCKED,0,0)) { + ulockfrm(); + return 0; + } + if (DBGetContactSettingByte(NULL,"CLUI","AutoSize",0)) { + ulockfrm(); + return 0; + } + + GetWindowRect(pcli->hwndContactList, &rc); + + if (Frames[FrameId].collapsed == TRUE) { + rc.bottom -= rc.top; + rc.bottom -= Frames[FrameId].height; + Frames[FrameId].HeightWhenCollapsed = Frames[FrameId].height; + Frames[FrameId].collapsed = FALSE; + } + else { + rc.bottom -= rc.top; + rc.bottom += Frames[FrameId].HeightWhenCollapsed; + Frames[FrameId].collapsed = TRUE; + } + + SetWindowPos(pcli->hwndContactList,NULL,0,0,rc.right-rc.left,rc.bottom,SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOMOVE); + + CLUIFramesStoreAllFrames(); + ulockfrm(); + return 0; + } + + if (Frames[FrameId].Locked||(!Frames[FrameId].visible)) + return 0; + + oldHeight = Frames[FrameId].height; + + // if collapsed, uncollapse + if (Frames[FrameId].collapsed == TRUE) { + Frames[FrameId].HeightWhenCollapsed = Frames[FrameId].height; + Frames[FrameId].height = UNCOLLAPSED_FRAME_SIZE; + Frames[FrameId].collapsed = FALSE; + } + // if uncollapsed, collapse + else { + Frames[FrameId].height = Frames[FrameId].HeightWhenCollapsed; + Frames[FrameId].collapsed = TRUE; + } + + if (!Frames[FrameId].floating) { + if (!CLUIFramesFitInSize()) { + //cant collapse,we can resize only for height2*UNCOLLAPSED_FRAME_SIZE) { + oldHeight = Frames[alfrm].height-UNCOLLAPSED_FRAME_SIZE; + Frames[FrameId].collapsed = TRUE; + } + } + else { + int i,sumheight = 0; + for (i = 0; i < nFramescount; i++) { + if ((Frames[i].align != alClient)&&(!Frames[i].floating)&&(Frames[i].visible)&&(!Frames[i].needhide)) { + sumheight += (Frames[i].height)+(TitleBarH*btoint(Frames[i].TitleBar.ShowTitleBar))+2; + return FALSE; + } + + if (sumheight>ContactListHeight-0-2) + Frames[FrameId].height = (ContactListHeight-0-2)-sumheight; + } + } + + Frames[FrameId].height = oldHeight; + + if (Frames[FrameId].collapsed == FALSE) { + if (Frames[FrameId].floating) + SetWindowPos(Frames[FrameId].ContainerWnd,HWND_TOP,0,0,Frames[FrameId].wndSize.right-Frames[FrameId].wndSize.left+6,Frames[FrameId].height+DEFAULT_TITLEBAR_HEIGHT+4,SWP_SHOWWINDOW|SWP_NOMOVE); + + ulockfrm(); + return -1; + } + } + } + + ulockfrm(); + + if (!Frames[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(Frames[FrameId].ContainerWnd,&contwnd); + contwnd.top = contwnd.bottom-contwnd.top;//height + contwnd.left = contwnd.right-contwnd.left;//width + + contwnd.top -= (oldHeight-Frames[FrameId].height);//newheight + SetWindowPos(Frames[FrameId].ContainerWnd,HWND_TOP,0,0,contwnd.left,contwnd.top,SWP_SHOWWINDOW|SWP_NOMOVE); + } + CLUIFramesStoreAllFrames(); + return 0; + } + else return -1; + + ulockfrm(); + return 0; +} + +static int CLUIFramesLoadMainMenu() +{ + CLISTMENUITEM mi; + int i,separator; + + if ( !(ServiceExists(MS_CLIST_REMOVEMAINMENUITEM))) { + //hmm new menu system not used..so display only two items and warning message + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize = sizeof(mi); + // create "show all frames" menu + mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA)); + mi.flags = CMIF_GRAYED; + mi.position = 10000000; + mi.pszPopupName = LPGEN("Frames"); + mi.pszName = LPGEN("New Menu System not Found..."); + mi.pszService = ""; + Menu_AddMainMenuItem(&mi); + + // create "show all frames" menu + mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA)); + mi.flags = 0; + mi.position = 10100000; + mi.pszPopupName = LPGEN("Frames"); + mi.pszName = LPGEN("Show All Frames"); + mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMES; + Menu_AddMainMenuItem(&mi); + + mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_HELP)); + mi.position = 10100001; + mi.pszPopupName = LPGEN("Frames"); + mi.flags = CMIF_CHILDPOPUP; + mi.pszName = LPGEN("Show All Titlebars"); + mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMESTB; + Menu_AddMainMenuItem(&mi); + return 0; + } + + if (MainMIRoot != (HGENMENU)-1) { + CallService(MS_CLIST_REMOVEMAINMENUITEM,(WPARAM)MainMIRoot,0); + MainMIRoot = (HGENMENU)-1; + } + + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize = sizeof(mi); + + // create root menu + mi.hIcon = LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_CLIENTMIRANDA)); + mi.flags = CMIF_ROOTPOPUP; + mi.position = 3000090000; + mi.pszPopupName = (char*)-1; + mi.pszName = LPGEN("Frames"); + mi.pszService = 0; + MainMIRoot = Menu_AddMainMenuItem(&mi); + + // create frames menu + separator = 3000200000; + for (i = 0;ihwndContactList == 0) return -1; + if (FramesSysNotStarted) return -1; + if (clfrm->cbSize != sizeof(CLISTFrame)) return -1; + if (!(TitleBarFont)) TitleBarFont = CLUILoadTitleBarFont(); + + lockfrm(); + if (nFramescount>=MAX_FRAMES) { ulockfrm(); return -1;} + Frames = (wndFrame*)realloc(Frames,sizeof(wndFrame)*(nFramescount+1)); + + memset(&Frames[nFramescount],0,sizeof(wndFrame)); + Frames[nFramescount].id = NextFrameId++; + Frames[nFramescount].align = clfrm->align; + Frames[nFramescount].hWnd = clfrm->hWnd; + Frames[nFramescount].height = clfrm->height; + Frames[nFramescount].TitleBar.hicon = clfrm->hIcon; + Frames[nFramescount].TitleBar.BackColour; + Frames[nFramescount].floating = FALSE; + + //override tbbtip + //clfrm->Flags != F_SHOWTBTIP; + // + if (DBGetContactSettingByte(0,CLUIFrameModule,"RemoveAllBorders",0) == 1) + clfrm->Flags |= F_NOBORDER; + + Frames[nFramescount].dwFlags = clfrm->Flags; + + if (clfrm->name == NULL||((clfrm->Flags&F_UNICODE) ? lstrlenW(clfrm->wname) : lstrlenA(clfrm->name)) == 0) { + Frames[nFramescount].name = (LPTSTR)malloc(255 * sizeof(TCHAR)); + GetClassName(Frames[nFramescount].hWnd,Frames[nFramescount].name,255); + } + else Frames[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) ? lstrlenW(clfrm->TBwname) : lstrlenA(clfrm->TBname)) == 0) + Frames[nFramescount].TitleBar.tbname = mir_tstrdup(Frames[nFramescount].name); + else + Frames[nFramescount].TitleBar.tbname = (clfrm->Flags&F_UNICODE) ? mir_u2t(clfrm->TBwname) : mir_a2t(clfrm->TBname); + Frames[nFramescount].needhide = FALSE; + Frames[nFramescount].TitleBar.ShowTitleBar = (clfrm->Flags&F_SHOWTB?TRUE:FALSE); + Frames[nFramescount].TitleBar.ShowTitleBarTip = (clfrm->Flags&F_SHOWTBTIP?TRUE:FALSE); + + Frames[nFramescount].collapsed = clfrm->Flags & F_UNCOLLAPSED ? FALSE:TRUE; + Frames[nFramescount].Locked = clfrm->Flags & F_LOCKED ? TRUE : FALSE; + Frames[nFramescount].visible = clfrm->Flags & F_VISIBLE ? TRUE : FALSE; + + Frames[nFramescount].UseBorder = (clfrm->Flags&F_NOBORDER)?FALSE:TRUE; + + // create frame + Frames[nFramescount].TitleBar.hwnd = CreateWindow(CLUIFrameTitleBarClassName,Frames[nFramescount].name, + (DBGetContactSettingByte(0,CLUIFrameModule,"RemoveAllTitleBarBorders",0)?0:WS_BORDER) |WS_CHILD|WS_CLIPCHILDREN| + (Frames[nFramescount].TitleBar.ShowTitleBar?WS_VISIBLE:0)| WS_CLIPCHILDREN, + 0,0,0,0,pcli->hwndContactList,NULL,g_hInst,NULL); + SetWindowLongPtr(Frames[nFramescount].TitleBar.hwnd,GWLP_USERDATA,Frames[nFramescount].id); + + Frames[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(Frames[nFramescount].TitleBar.hwndTip, HWND_TOPMOST,0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + + TOOLINFO ti = { 0 }; + ti.cbSize = sizeof(ti); + ti.lpszText = _T(""); + ti.hinst = g_hInst; + ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS ; + ti.uId = (UINT_PTR)Frames[nFramescount].TitleBar.hwnd; + SendMessage(Frames[nFramescount].TitleBar.hwndTip,TTM_ADDTOOL,(WPARAM)0,(LPARAM)&ti); + + SendMessage(Frames[nFramescount].TitleBar.hwndTip,TTM_ACTIVATE,(WPARAM)Frames[nFramescount].TitleBar.ShowTitleBarTip,0); + + Frames[nFramescount].oldstyles = GetWindowLongPtr(Frames[nFramescount].hWnd,GWL_STYLE); + Frames[nFramescount].TitleBar.oldstyles = GetWindowLongPtr(Frames[nFramescount].TitleBar.hwnd,GWL_STYLE); + //Frames[nFramescount].FloatingPos.x = + + retval = Frames[nFramescount].id; + Frames[nFramescount].order = nFramescount+1; + nFramescount++; + + CLUIFramesLoadFrameSettings(id2pos(retval)); + style = GetWindowLongPtr(Frames[nFramescount-1].hWnd,GWL_STYLE); + style &= (~WS_BORDER); + style |= ((Frames[nFramescount-1].UseBorder)?WS_BORDER:0); + SetWindowLongPtr(Frames[nFramescount-1].hWnd,GWL_STYLE,style); + + if (Frames[nFramescount-1].order == 0){Frames[nFramescount-1].order = nFramescount;} + ulockfrm(); + + alclientFrame = -1;//recalc it + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0); + + if (Frames[nFramescount-1].floating) { + Frames[nFramescount-1].floating = FALSE; + CLUIFrameSetFloat(retval,1);//lparam = 1 use stored width and height + } + + return retval; +} + +static INT_PTR CLUIFramesRemoveFrame(WPARAM wParam,LPARAM lParam) +{ + if (FramesSysNotStarted) + return -1; + + lockfrm(); + int pos = id2pos(wParam); + + if (pos<0||pos>nFramescount){ulockfrm();return(-1);} + + mir_free(Frames[pos].name); + mir_free(Frames[pos].TitleBar.tbname); + mir_free(Frames[pos].TitleBar.tooltip); + + DestroyWindow(Frames[pos].hWnd); + Frames[pos].hWnd = (HWND)-1; + DestroyWindow(Frames[pos].TitleBar.hwnd); + Frames[pos].TitleBar.hwnd = (HWND)-1; + DestroyWindow(Frames[pos].ContainerWnd); + Frames[pos].ContainerWnd = (HWND)-1; + DestroyMenu(Frames[pos].TitleBar.hmenu); + + RemoveItemFromList(pos,&Frames,&nFramescount); + + ulockfrm(); + InvalidateRect(pcli->hwndContactList,NULL,TRUE); + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0); + InvalidateRect(pcli->hwndContactList,NULL,TRUE); + + return 0; +} + + +int CLUIFramesForceUpdateTB(const wndFrame *Frame) +{ + if (Frame->TitleBar.hwnd != 0) + RedrawWindow(Frame->TitleBar.hwnd,NULL,NULL,RDW_ALLCHILDREN|RDW_UPDATENOW|RDW_ERASE|RDW_INVALIDATE|RDW_FRAME); + return 0; +} + +int CLUIFramesForceUpdateFrame(const wndFrame *Frame) +{ + if (Frame->hWnd != 0) { + RedrawWindow(Frame->hWnd,NULL,NULL,RDW_UPDATENOW|RDW_FRAME|RDW_ERASE|RDW_INVALIDATE); + UpdateWindow(Frame->hWnd); + } + if (Frame->floating) { + if (Frame->ContainerWnd != 0) + RedrawWindow(Frame->ContainerWnd,NULL,NULL,RDW_UPDATENOW|RDW_ALLCHILDREN|RDW_ERASE|RDW_INVALIDATE|RDW_FRAME); + } + return 0; +} + +int CLUIFrameMoveResize(const wndFrame *Frame) +{ + //int b; + // we need to show or hide the frame? + if (Frame->visible&&(!Frame->needhide)) { + ShowWindow(Frame->hWnd,SW_SHOW); + ShowWindow(Frame->TitleBar.hwnd,Frame->TitleBar.ShowTitleBar == TRUE?SW_SHOW:SW_HIDE); + } + else { + ShowWindow(Frame->hWnd,SW_HIDE); + ShowWindow(Frame->TitleBar.hwnd,SW_HIDE); + return 0; + } + + // 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_NOREDRAW); + + // set titlebar position + if (Frame->TitleBar.ShowTitleBar) + SetWindowPos(Frame->TitleBar.hwnd,NULL,Frame->wndSize.left,Frame->wndSize.top-TitleBarH-GapBetweenTitlebar, + Frame->wndSize.right-Frame->wndSize.left, + TitleBarH,SWP_NOZORDER|SWP_NOREDRAW ); + + return 0; +} + +BOOLEAN CLUIFramesFitInSize(void) +{ + int sumheight = 0; + int tbh = 0; // title bar height + + int clientfrm = CLUIFramesGetalClientFrame(); + if (clientfrm != -1) + tbh = TitleBarH*btoint(Frames[clientfrm].TitleBar.ShowTitleBar); + + for (int i = 0;iContactListHeight-tbh-2) + return FALSE; + } + } + return TRUE; +} + +int CLUIFramesGetMinHeight() +{ + int i,tbh,clientfrm,sumheight = 0; + RECT border; + int allbord = 0; + if (pcli->hwndContactList == NULL) return 0; + lockfrm(); + + // search for alClient frame and get the titlebar's height + tbh = 0; + clientfrm = CLUIFramesGetalClientFrame(); + if (clientfrm != -1) + tbh = TitleBarH*btoint(Frames[clientfrm].TitleBar.ShowTitleBar); + + for (i = 0; i < nFramescount; i++) { + if ((Frames[i].align != alClient)&&(Frames[i].visible)&&(!Frames[i].needhide)&&(!Frames[i].floating)) { + RECT wsize; + + GetWindowRect(Frames[i].hWnd,&wsize); + sumheight += (wsize.bottom-wsize.top)+(TitleBarH*btoint(Frames[i].TitleBar.ShowTitleBar))+3; + } + } + ulockfrm(); + GetBorderSize(pcli->hwndContactList,&border); + return (sumheight+border.top+border.bottom+allbord+tbh+3); +} + +int CLUIFramesResize(const RECT newsize) +{ + int sumheight = 9999999,newheight; + int prevframe,prevframebottomline; + int tbh,curfrmtbh; + int drawitems; + int clientfrm; + int i,j; + int sepw = GapBetweenFrames; + SortData *sdarray; + + GapBetweenTitlebar = (int)DBGetContactSettingDword(NULL,"CLUIFrames","GapBetweenTitleBar",1); + GapBetweenFrames = DBGetContactSettingDword(NULL,"CLUIFrames","GapBetweenFrames",1); + TitleBarH = DBGetContactSettingDword(NULL,"CLUIFrames","TitleBarH",DEFAULT_TITLEBAR_HEIGHT); + + sepw = GapBetweenFrames; + if (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 = (TitleBarH+GapBetweenTitlebar)*btoint(Frames[clientfrm].TitleBar.ShowTitleBar); + + for (i = 0; i < nFramescount; i++) { + if (!Frames[i].floating) { + Frames[i].needhide = FALSE; + Frames[i].wndSize.left = 0; + Frames[i].wndSize.right = newsize.right-0; + } + } + + //sorting stuff + sdarray = (SortData*)malloc(sizeof(SortData)*nFramescount); + if (sdarray == NULL){return(-1);} + for (i = 0;i(newheight-tbh)&&drawitems>0) { + sumheight = 0; + drawitems = 0; + for (i = 0;inewheight-tbh) { + sumheight -= (Frames[i].height)+curfrmtbh+sepw; + Frames[i].needhide = TRUE; + drawitems--; + break; + } + } + } + } + + prevframe = -1; + prevframebottomline = 0; + for (j = 0;jnewheight){ + //prevframebottomline -= Frames[i].height+(curfrmtbh+1); + //Frames[i].needhide = TRUE; + } + } + } + + if (sumheightnewheight) { + //prevframebottomline -= Frames[i].height+(tbh+1); + //Frames[i].needhide = TRUE; + } + break; + } + } + } + + //newheight + prevframebottomline = newheight+sepw; + //prevframe = -1; + for (j = nFramescount-1;j>=0;j--) { + //move all alBottom frames + i = sdarray[j].realpos; + if ((Frames[i].visible)&&(!Frames[i].floating)&&(!Frames[i].needhide)&&(Frames[i].align == alBottom)) { + curfrmtbh = (TitleBarH+GapBetweenTitlebar)*btoint(Frames[i].TitleBar.ShowTitleBar); + + Frames[i].wndSize.bottom = prevframebottomline-sepw; + Frames[i].wndSize.top = Frames[i].wndSize.bottom-Frames[i].height-(Frames[i].UseBorder?2:0); + Frames[i].prevvisframe = prevframe; + prevframe = i; + prevframebottomline = Frames[i].wndSize.top/*-1*/-curfrmtbh; + if (prevframebottomline>newheight) { + + } + } + } + + if (sdarray != NULL) { + free(sdarray); + sdarray = NULL; + } + + for (i = 0;ihwndContactList,(LPARAM)0); return 0;} + if (lParam&FU_FMPOS) CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,1); + lockfrm(); + wParam = id2pos(wParam); + if (wParam<0||(int)wParam>=nFramescount) { ulockfrm(); return -1;} + if (lParam&FU_TBREDRAW) CLUIFramesForceUpdateTB(&Frames[wParam]); + if (lParam&FU_FMREDRAW) CLUIFramesForceUpdateFrame(&Frames[wParam]); + //if () {} + ulockfrm(); + + return 0; +} + +int CLUIFramesOnClistResize(WPARAM wParam,LPARAM lParam) +{ + RECT nRect,rcStatus; + int tick,i; + + if (FramesSysNotStarted) return -1; + lockfrm(); + + GetClientRect(pcli->hwndContactList,&nRect); + + 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; + + tick = GetTickCount(); + + CLUIFramesResize(nRect); + + for (i = 0; i < nFramescount; i++) { + CLUIFramesForceUpdateFrame(&Frames[i]); + CLUIFramesForceUpdateTB(&Frames[i]); + } + + //resizing = FALSE; + ulockfrm(); + tick = GetTickCount()-tick; + + if (pcli->hwndContactList != 0) InvalidateRect(pcli->hwndContactList,NULL,TRUE); + if (pcli->hwndContactList != 0) UpdateWindow(pcli->hwndContactList); + + Sleep(0); + + //dont save to database too many times + if (GetTickCount() - LastStoreTick > 1000) { + CLUIFramesStoreAllFrames(); + LastStoreTick = GetTickCount(); + } + return 0; +} + +static HBITMAP hBmpBackground; +static int backgroundBmpUse; +static COLORREF bkColour; +static COLORREF SelBkColour; +boolean AlignCOLLIconToLeft; //will hide frame icon + +int OnFrameTitleBarBackgroundChange(WPARAM wParam,LPARAM lParam) +{ + DBVARIANT dbv; + + AlignCOLLIconToLeft = DBGetContactSettingByte(NULL,"FrameTitleBar","AlignCOLLIconToLeft",0); + + bkColour = DBGetContactSettingDword(NULL,"FrameTitleBar","BkColour",CLCDEFAULT_BKCOLOUR); + //SelBkColour = DBGetContactSettingDword(NULL,"FrameTitleBar","SelBkColour",0); + + if (hBmpBackground) {DeleteObject(hBmpBackground); hBmpBackground = NULL;} + if (DBGetContactSettingByte(NULL,"FrameTitleBar","UseBitmap",CLCDEFAULT_USEBITMAP)) { + if (!DBGetContactSetting(NULL,"FrameTitleBar","BkBitmap",&dbv)) { + hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal); + mir_free(dbv.pszVal); + } + } + backgroundBmpUse = DBGetContactSettingWord(NULL,"FrameTitleBar","BkBmpUse",CLCDEFAULT_BKBMPUSE); + + CLUIFramesOnClistResize(0,0); + return 0; +} + +void DrawBackGroundTTB(HWND hwnd,HDC mhdc) +{ + HDC hdcMem,hdc; + RECT clRect,*rcPaint; + + int yScroll = 0; + int y; + PAINTSTRUCT paintst = {0}; + HBITMAP hBmpOsb,hOldBmp; + DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE); + int grey = 0; + HFONT oFont; + HBRUSH hBrushAlternateGrey = NULL; + + HFONT hFont; + + //InvalidateRect(hwnd,0,FALSE); + + 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; + y = -yScroll; + hdcMem = CreateCompatibleDC(hdc); + hBmpOsb = CreateBitmap(clRect.right,clRect.bottom,1,GetDeviceCaps(hdc,BITSPIXEL),NULL); + hOldBmp = (HBITMAP)SelectObject(hdcMem,hBmpOsb); + oFont = (HFONT)SelectObject(hdcMem,hFont); + SetBkMode(hdcMem,TRANSPARENT); + { + HBRUSH hBrush = CreateSolidBrush(bkColour); + HBRUSH hoBrush = (HBRUSH)SelectObject(hdcMem,hBrush); + FillRect(hdcMem,rcPaint,hBrush); + SelectObject(hdcMem,hoBrush); + DeleteObject(hBrush); + if (hBmpBackground) { + BITMAP bmp; + HDC hdcBmp; + int x,y; + int maxx,maxy; + int destw,desth; + + GetObject(hBmpBackground,sizeof(bmp),&bmp); + hdcBmp = CreateCompatibleDC(hdcMem); + SelectObject(hdcBmp,hBmpBackground); + y = backgroundBmpUse&CLBF_SCROLL?-yScroll:0; + maxx = backgroundBmpUse&CLBF_TILEH?clRect.right:1; + maxy = backgroundBmpUse&CLBF_TILEV?maxy = rcPaint->bottom:y+1; + switch(backgroundBmpUse&CLBM_TYPE) { + case CLB_STRETCH: + if (backgroundBmpUse&CLBF_PROPORTIONAL) { + if (clRect.right*bmp.bmHeighttop-desth) continue; + for (x = 0;xleft,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); +} + +static int DrawTitleBar(HDC dc,RECT rect,int Frameid) +{ + HDC paintDC = dc; + + HDC hdcMem = CreateCompatibleDC(paintDC); + HBITMAP hBmpOsb = CreateBitmap(rect.right,rect.bottom,1,GetDeviceCaps(paintDC,BITSPIXEL),NULL); + HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem,hBmpOsb); + + HFONT hoTTBFont = (HFONT)SelectObject(hdcMem,TitleBarFont); + SetBkMode(hdcMem,TRANSPARENT); + + HBRUSH hBack = GetSysColorBrush(COLOR_3DFACE); + HBRUSH hoBrush = (HBRUSH)SelectObject(hdcMem,hBack); + + lockfrm(); + + int pos = id2pos(Frameid); + if (pos >= 0 && pos < nFramescount) { + GetClientRect(Frames[pos].TitleBar.hwnd,&Frames[pos].TitleBar.wndSize); + + //set font charset + HFONT hf = (HFONT)GetStockObject(DEFAULT_GUI_FONT); + if (TitleBarLogFont.lfHeight != 0) + hf = CreateFontIndirectA(&TitleBarLogFont); + + HFONT oFont = (HFONT)SelectObject(hdcMem,hf); + + DrawBackGroundTTB(Frames[pos].TitleBar.hwnd,hdcMem); + //hFront = CreateSolidPe (SelBkColour); + //SelectObject(hdcMem,hFront); + SelBkColour = DBGetContactSettingDword(NULL,"CLUIFrames","FramesTitleBarFontCol",0); + if (SelBkColour) SetTextColor(hdcMem,SelBkColour); + + if (!AlignCOLLIconToLeft) { + + if (Frames[pos].TitleBar.hicon != NULL) { + //(TitleBarH>>1)-(GetSystemMetrics(SM_CXSMICON)>>1) + DrawIconEx(hdcMem,2,((TitleBarH>>1)-(GetSystemMetrics(SM_CYSMICON)>>1)),Frames[pos].TitleBar.hicon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL); + TextOut(hdcMem,GetSystemMetrics(SM_CYSMICON)+4,0,Frames[pos].TitleBar.tbname,lstrlen(Frames[pos].TitleBar.tbname)); + } + else + TextOut(hdcMem,2,0,Frames[pos].TitleBar.tbname,lstrlen(Frames[pos].TitleBar.tbname)); + } + else + TextOut(hdcMem,GetSystemMetrics(SM_CXSMICON)+2,0,Frames[pos].TitleBar.tbname,lstrlen(Frames[pos].TitleBar.tbname)); + + if (!AlignCOLLIconToLeft) + DrawIconEx(hdcMem,Frames[pos].TitleBar.wndSize.right-GetSystemMetrics(SM_CXSMICON)-2,((TitleBarH>>1)-(GetSystemMetrics(SM_CXSMICON)>>1)),Frames[pos].collapsed?LoadSkinnedIcon(SKINICON_OTHER_GROUPOPEN):LoadSkinnedIcon(SKINICON_OTHER_GROUPSHUT),GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL); + else + DrawIconEx(hdcMem,0,((TitleBarH>>1)-(GetSystemMetrics(SM_CXSMICON)>>1)),Frames[pos].collapsed?LoadSkinnedIcon(SKINICON_OTHER_GROUPOPEN):LoadSkinnedIcon(SKINICON_OTHER_GROUPSHUT),GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL); + + DeleteObject(hf); + SelectObject(hdcMem,oFont); + } + ulockfrm(); + + BitBlt(paintDC,rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,hdcMem,rect.left,rect.top,SRCCOPY); + + SelectObject(hdcMem,hoBmp); + SelectObject(hdcMem,hoBrush); + SelectObject(hdcMem,hoTTBFont); + DeleteDC(hdcMem); + DeleteObject(hBack); + DeleteObject(hBmpOsb); + return 0; +} + +//for old multiwindow +#define MPCF_CONTEXTFRAMEMENU 3 +POINT ptOld; +short nLeft = 0; +short nTop = 0; + +LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + RECT rect; + int Frameid,Framemod,direction; + int xpos,ypos; + + Frameid = (GetWindowLongPtr(hwnd,GWLP_USERDATA)); + memset(&rect,0,sizeof(rect)); + + switch(msg) { + case WM_CREATE: + SendMessage(hwnd,WM_SETFONT,(WPARAM)TitleBarFont,0); + return FALSE; + + case WM_MEASUREITEM: + return CallService(MS_CLIST_MENUMEASUREITEM,wParam,lParam); + + case WM_DRAWITEM: + return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam); + + case WM_ENABLE: + if (hwnd != 0) InvalidateRect(hwnd,NULL,FALSE); + return 0; + + case WM_COMMAND: + if ( ServiceExists(MO_CREATENEWMENUOBJECT)) { + if (ProcessCommandProxy(MAKEWPARAM(LOWORD(wParam),0),(LPARAM)Frameid)) break; + } + else if ( CallService(MS_CLIST_MENUPROCESSCOMMAND,MAKEWPARAM(LOWORD(wParam),MPCF_CONTEXTFRAMEMENU),(LPARAM)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: + Frames[framepos].Locked = !Frames[framepos].Locked; + break; + case frame_menu_visible: + Frames[framepos].visible = !Frames[framepos].visible; + break; + case frame_menu_showtitlebar: + Frames[framepos].TitleBar.ShowTitleBar = !Frames[framepos].TitleBar.ShowTitleBar; + break; + case frame_menu_floating: + CLUIFrameSetFloat(Frameid,0); + break; + } + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,(LPARAM)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); + lockfrm(); + if (framepos == -1){ulockfrm();break;} + hmenu = CreatePopupMenu(); + + AppendMenu(hmenu,MF_STRING|MF_DISABLED|MF_GRAYED,15,Frames[framepos].name); + AppendMenu(hmenu,MF_SEPARATOR,16,_T("")); + + if (Frames[framepos].Locked) + {AppendMenu(hmenu,MF_STRING|MF_CHECKED,frame_menu_lock,TranslateT("Lock Frame"));} + else{AppendMenu(hmenu,MF_STRING,frame_menu_lock,TranslateT("Lock Frame"));} + + if (Frames[framepos].visible) + {AppendMenu(hmenu,MF_STRING|MF_CHECKED,frame_menu_visible,TranslateT("Visible"));} + else{AppendMenu(hmenu,MF_STRING,frame_menu_visible,TranslateT("Visible"));} + + if (Frames[framepos].TitleBar.ShowTitleBar) + {AppendMenu(hmenu,MF_STRING|MF_CHECKED,frame_menu_showtitlebar,TranslateT("Show TitleBar"));} + else{AppendMenu(hmenu,MF_STRING,frame_menu_showtitlebar,TranslateT("Show TitleBar"));} + + if (Frames[framepos].floating) + {AppendMenu(hmenu,MF_STRING|MF_CHECKED,frame_menu_floating,TranslateT("Floating"));} + else{AppendMenu(hmenu,MF_STRING,frame_menu_floating,TranslateT("Floating"));} + + ulockfrm(); + } + + TrackPopupMenu(hmenu,TPM_LEFTALIGN,pt.x,pt.y,0,hwnd,0); + DestroyMenu(hmenu); + } + break; + + case WM_LBUTTONDBLCLK: + Framemod = -1; + lbypos = -1;oldframeheight = -1;ReleaseCapture(); + CallService(MS_CLIST_FRAMES_UCOLLFRAME,Frameid,0); + lbypos = -1;oldframeheight = -1;ReleaseCapture(); + break; + + case WM_LBUTTONUP: + if (GetCapture() != hwnd) + break; + curdragbar = -1;lbypos = -1;oldframeheight = -1;ReleaseCapture(); + break; + + case WM_LBUTTONDOWN: + { + int framepos = id2pos(Frameid); + if (framepos == -1) + break; + + lockfrm(); + if (Frames[framepos].floating) + { + POINT pt; + GetCursorPos(&pt); + Frames[framepos].TitleBar.oldpos = pt; + } + + if (( !(wParam & MK_CONTROL)) && Frames[framepos].Locked && (!(Frames[framepos].floating))) { + if (DBGetContactSettingByte(NULL,"CLUI","ClientAreaDrag",0)) { + POINT pt; + //pt = nm->pt; + GetCursorPos(&pt); + return SendMessage(GetParent(hwnd), WM_SYSCOMMAND, SC_MOVE|HTCAPTION,MAKELPARAM(pt.x,pt.y)); + } + } + + if (Frames[framepos].floating) { + RECT rc; + GetCursorPos(&ptOld); + //ClientToScreen(hwnd,&ptOld); + GetWindowRect( hwnd, &rc ); + + nLeft = (short)rc.left; + nTop = (short)rc.top; + } + ulockfrm(); + SetCapture(hwnd); + } + break; + + case WM_MOUSEMOVE: + { + POINT pt,pt2; + RECT wndr; + int pos; + + char TBcapt[255]; + + lockfrm(); + pos = id2pos(Frameid); + + if (pos != -1) { + int oldflags; + wsprintfA(TBcapt,"%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d", + Frames[pos].name,Frames[pos].height,Frames[pos].visible,Frames[pos].floating, + Frames[pos].FloatingPos.x,Frames[pos].FloatingPos.y, + Frames[pos].FloatingSize.x,Frames[pos].FloatingSize.y, + Frames[pos].order); + + oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,Frames[pos].id),(LPARAM)0); + if ( !(oldflags & F_SHOWTBTIP)) + oldflags |= F_SHOWTBTIP; + } + + ulockfrm(); + + if (wParam & MK_LBUTTON) { + RECT rcMiranda; + RECT rcwnd,rcOverlap; + POINT newpt,ofspt,curpt,newpos; + //if (GetCapture() != hwnd){break;} + //curdragbar = -1;lbypos = -1;oldframeheight = -1;ReleaseCapture(); + lockfrm(); + pos = id2pos(Frameid); + if (Frames[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 = Frames[pos].id; + ulockfrm(); + + ofspt.x = 0;ofspt.y = 0; + ClientToScreen(Frames[pos].TitleBar.hwnd,&ofspt); + ofspt.x = curpt.x-ofspt.x;ofspt.y = curpt.y-ofspt.y; + + CLUIFrameSetFloat(id,0); + newpt.x = 0;newpt.y = 0; + ClientToScreen(Frames[pos].TitleBar.hwnd,&newpt); + SetCursorPos(newpt.x+ofspt.x,newpt.y+ofspt.y); + GetCursorPos(&curpt); + lockfrm(); + Frames[pos].TitleBar.oldpos = curpt; + ulockfrm(); + return 0; + } + } + else { + int id = Frames[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 ); + + if (!IntersectRect( &rcOverlap, &rcwnd, &rcMiranda )) { + ulockfrm(); + GetCursorPos(&curpt); + GetWindowRect( Frames[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(Frames[pos].TitleBar.hwnd,&rcwnd); + ofspt.x = curpt.x-ofspt.x;ofspt.y = curpt.y-ofspt.y; + + Frames[pos].FloatingPos.x = newpos.x; + Frames[pos].FloatingPos.y = newpos.y; + CLUIFrameSetFloat(id,0); + //SetWindowPos(Frames[pos].ContainerWnd,0,newpos.x,newpos.y,0,0,SWP_NOSIZE); + + lockfrm(); + newpt.x = 0;newpt.y = 0; + ClientToScreen(Frames[pos].TitleBar.hwnd,&newpt); + + GetWindowRect( Frames[pos].hWnd, &rcwnd ); + SetCursorPos(newpt.x+(rcwnd.right-rcwnd.left)/2,newpt.y+(rcwnd.bottom-rcwnd.top)/2); + GetCursorPos(&curpt); + + Frames[pos].TitleBar.oldpos = curpt; + ulockfrm(); + + return 0; + } + } + ulockfrm(); + } + + if (wParam & MK_LBUTTON) { + int newh = -1,prevold; + + if (GetCapture() != hwnd){break;} + + lockfrm(); + pos = id2pos(Frameid); + + if (Frames[pos].floating) { + GetCursorPos(&pt); + if ((Frames[pos].TitleBar.oldpos.x != pt.x)||(Frames[pos].TitleBar.oldpos.y != pt.y)) { + + pt2 = pt; + ScreenToClient(hwnd,&pt2); + GetWindowRect(Frames[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( &Frames[pos], nLeft, nTop ); + else + SetWindowPos( Frames[pos].ContainerWnd, + HWND_TOPMOST, + nLeft, + nTop, + 0, + 0, + SWP_NOSIZE | SWP_NOZORDER ); + + ptOld = ptNew; + + pt.x = nLeft; + pt.y = nTop; + Frames[pos].TitleBar.oldpos = pt; + } + + ulockfrm(); + return 0; + } + + if (Frames[pos].prevvisframe != -1) { + GetCursorPos(&pt); + + if ((Frames[pos].TitleBar.oldpos.x == pt.x)&&(Frames[pos].TitleBar.oldpos.y == pt.y)) { + ulockfrm(); + break; + } + + ypos = rect.top+pt.y;xpos = rect.left+pt.x; + Framemod = -1; + + if (Frames[pos].align == alBottom) { + direction = -1; + Framemod = pos; + } + else { + direction = 1; + Framemod = Frames[pos].prevvisframe; + } + if (Frames[Framemod].Locked) {ulockfrm();break;} + if (curdragbar != -1&&curdragbar != pos) {ulockfrm();break;} + + if (lbypos == -1) { + curdragbar = pos; + lbypos = ypos; + oldframeheight = Frames[Framemod].height; + SetCapture(hwnd); + {ulockfrm();break;} + } + + newh = oldframeheight+direction*(ypos-lbypos); + if (newh > 0) { + prevold = Frames[Framemod].height; + Frames[Framemod].height = newh; + if (!CLUIFramesFitInSize()) { + Frames[Framemod].height = prevold; + ulockfrm(); + return TRUE; + } + Frames[Framemod].height = newh; + if (newh > 3) + Frames[Framemod].collapsed = TRUE; + } + Frames[pos].TitleBar.oldpos = pt; + } + ulockfrm(); + if (newh > 0) + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + break; + } + curdragbar = -1;lbypos = -1;oldframeheight = -1;ReleaseCapture(); + } + break; + + case WM_PRINTCLIENT: + if (lParam & PRF_CLIENT) { + GetClientRect(hwnd,&rect); + DrawTitleBar((HDC)wParam,rect,Frameid); + } + + case WM_PAINT: + { + HDC paintDC; + PAINTSTRUCT paintStruct; + + //GetClientRect(hwnd,&rect); + paintDC = BeginPaint(hwnd, &paintStruct); + rect = paintStruct.rcPaint; + DrawTitleBar(paintDC,rect,Frameid); + EndPaint(hwnd, &paintStruct); + } + return 0; + + default: + return DefWindowProc(hwnd, msg, wParam, lParam); + } + return TRUE; +} + +int CLUIFrameResizeFloatingFrame(int framepos) +{ + int width,height; + RECT rect; + + if (!Frames[framepos].floating){return 0;} + if (Frames[framepos].ContainerWnd == 0){return 0;} + GetClientRect(Frames[framepos].ContainerWnd,&rect); + + width = rect.right-rect.left; + height = rect.bottom-rect.top; + + Frames[framepos].visible?ShowWindow(Frames[framepos].ContainerWnd,SW_SHOW):ShowWindow(Frames[framepos].ContainerWnd,SW_HIDE); + + if (Frames[framepos].TitleBar.ShowTitleBar) { + ShowWindow(Frames[framepos].TitleBar.hwnd,SW_SHOW); + Frames[framepos].height = height-DEFAULT_TITLEBAR_HEIGHT; + + SetWindowPos(Frames[framepos].TitleBar.hwnd,HWND_TOP,0,0,width,DEFAULT_TITLEBAR_HEIGHT,SWP_SHOWWINDOW|SWP_DRAWFRAME); + SetWindowPos(Frames[framepos].hWnd,HWND_TOP,0,DEFAULT_TITLEBAR_HEIGHT,width,height-DEFAULT_TITLEBAR_HEIGHT,SWP_SHOWWINDOW); + } + else { + Frames[framepos].height = height; + ShowWindow(Frames[framepos].TitleBar.hwnd,SW_HIDE); + SetWindowPos(Frames[framepos].hWnd,HWND_TOP,0,0,width,height,SWP_SHOWWINDOW); + } + + if (Frames[framepos].ContainerWnd != 0) + UpdateWindow(Frames[framepos].ContainerWnd); + + GetWindowRect(Frames[framepos].hWnd,&Frames[framepos].wndSize); + return 0; +} + +static int CLUIFrameOnMainMenuBuild(WPARAM wParam,LPARAM lParam) +{ + CLUIFramesLoadMainMenu(); + return 0; +} + +LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + RECT rect = { 0 }; + int Frameid = (GetWindowLongPtr(hwnd,GWLP_USERDATA)); + + switch(msg) { + case WM_CREATE: + { + lockfrm(); + int framepos = id2pos(Frameid); + ulockfrm(); + } + return 0; + + case WM_GETMINMAXINFO: + { + int framepos; + MINMAXINFO minmax; + + lockfrm(); + framepos = id2pos(Frameid); + if (framepos<0||framepos>=nFramescount){ulockfrm();break;} + if (!Frames[framepos].minmaxenabled){ulockfrm();break;} + if (Frames[framepos].ContainerWnd == 0){ulockfrm();break;} + + if (Frames[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; + } + + memset(&minmax,0,sizeof(minmax)); + if (SendMessage(Frames[framepos].hWnd,WM_GETMINMAXINFO,(WPARAM)0,(LPARAM)&minmax) == 0) { + RECT border; + int tbh = TitleBarH*btoint(Frames[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 { + ulockfrm(); + return(DefWindowProc(hwnd, msg, wParam, lParam)); + } + + ulockfrm(); + } + + case WM_MOVE: + { + lockfrm(); + int framepos = id2pos(Frameid); + + if (framepos<0||framepos>=nFramescount){ulockfrm();break;} + if (Frames[framepos].ContainerWnd == 0){ulockfrm();return 0;} + + RECT rect; + GetWindowRect(Frames[framepos].ContainerWnd,&rect); + Frames[framepos].FloatingPos.x = rect.left; + Frames[framepos].FloatingPos.y = rect.top; + Frames[framepos].FloatingSize.x = rect.right-rect.left; + Frames[framepos].FloatingSize.y = rect.bottom-rect.top; + + CLUIFramesStoreFrameSettings(framepos); + ulockfrm(); + } + return 0; + + case WM_SIZE: + { + lockfrm(); + int framepos = id2pos(Frameid); + + if (framepos<0||framepos>=nFramescount){ulockfrm();break;} + if (Frames[framepos].ContainerWnd == 0){ulockfrm();return 0;} + CLUIFrameResizeFloatingFrame(framepos); + + RECT rect; + GetWindowRect(Frames[framepos].ContainerWnd,&rect); + Frames[framepos].FloatingPos.x = rect.left; + Frames[framepos].FloatingPos.y = rect.top; + Frames[framepos].FloatingSize.x = rect.right-rect.left; + Frames[framepos].FloatingSize.y = rect.bottom-rect.top; + + CLUIFramesStoreFrameSettings(framepos); + ulockfrm(); + } + return 0; + + 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(CreateWindowA("FramesContainer","aaaa",WS_POPUP|WS_THICKFRAME,x,y,width,height,parent,0,g_hInst,0)); +} + +INT_PTR CLUIFrameSetFloat(WPARAM wParam,LPARAM lParam) +{ + HWND hwndtmp, hwndtooltiptmp; + wndFrame *frame; + int pos; + + lockfrm(); + + pos = id2pos(wParam); + if (pos < 0 || pos > nFramescount) { + ulockfrm(); + return 0; + } + + frame = &Frames[pos]; + + //parent = GetParent(Frames[wParam].hWnd); + if (frame->floating) { + SetParent(frame->hWnd,pcli->hwndContactList); + SetParent(frame->TitleBar.hwnd,pcli->hwndContactList); + frame->floating = FALSE; + DestroyWindow(frame->ContainerWnd); + frame->ContainerWnd = NULL; + } + else { + RECT recttb,rectw,border; + int temp; + int neww,newh; + BOOLEAN locked; + + frame->oldstyles = GetWindowLongPtr(frame->hWnd,GWL_STYLE); + frame->TitleBar.oldstyles = GetWindowLongPtr(frame->TitleBar.hwnd,GWL_STYLE); + locked = frame->Locked; + frame->Locked = FALSE; + frame->minmaxenabled = FALSE; + + GetWindowRect(frame->hWnd,&rectw); + GetWindowRect(frame->TitleBar.hwnd,&recttb); + if (!frame->TitleBar.ShowTitleBar) + recttb.top = recttb.bottom = recttb.left = recttb.right = 0; + + frame->ContainerWnd = CreateContainerWindow(pcli->hwndContactList,frame->FloatingPos.x,frame->FloatingPos.y,10,10); + + SetParent(frame->hWnd,frame->ContainerWnd); + SetParent(frame->TitleBar.hwnd,frame->ContainerWnd); + + GetBorderSize(frame->ContainerWnd,&border); + + SetWindowLongPtr(frame->ContainerWnd, GWLP_USERDATA, frame->id); + if ((lParam == 1)) { + if ((frame->FloatingPos.x != 0)&&(frame->FloatingPos.y != 0)) { + if (frame->FloatingPos.x<20){frame->FloatingPos.x = 40;} + if (frame->FloatingPos.y<20){frame->FloatingPos.y = 40;} + + SetWindowPos(frame->ContainerWnd,HWND_TOPMOST,frame->FloatingPos.x,frame->FloatingPos.y,frame->FloatingSize.x,frame->FloatingSize.y,SWP_HIDEWINDOW); + } + else SetWindowPos(frame->ContainerWnd,HWND_TOPMOST,120,120,140,140,SWP_HIDEWINDOW); + } + else { + 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 (frame->FloatingPos.x<20){frame->FloatingPos.x = 40;} + if (frame->FloatingPos.y<20){frame->FloatingPos.y = 40;} + + SetWindowPos(frame->ContainerWnd,HWND_TOPMOST,frame->FloatingPos.x,frame->FloatingPos.y,neww,newh,SWP_HIDEWINDOW); + } + + SetWindowText(frame->ContainerWnd,frame->TitleBar.tbname); + + temp = GetWindowLongPtr(frame->ContainerWnd,GWL_EXSTYLE); + temp |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST ; + SetWindowLongPtr(frame->ContainerWnd,GWL_EXSTYLE,temp); + + frame->floating = TRUE; + frame->Locked = locked; + } + + CLUIFramesStoreFrameSettings(pos); + frame->minmaxenabled = TRUE; + hwndtooltiptmp = frame->TitleBar.hwndTip; + + hwndtmp = frame->ContainerWnd; + ulockfrm(); + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + SendMessage(hwndtmp,WM_SIZE,0,0); + + SetWindowPos(hwndtooltiptmp, HWND_TOPMOST,0, 0, 0, 0,SWP_NOMOVE | SWP_NOSIZE ); + return 0; +} + +static int CLUIFrameOnFontChange(WPARAM wParam,LPARAM lParam) +{ + FontID fid = {0}; + fid.cbSize = sizeof(fid); + memset(&TitleBarLogFont,0,sizeof(TitleBarLogFont)); + + strcpy(fid.group,LPGEN("Frames")); + strcpy(fid.name,LPGEN("TitleBarFont")); + strcpy(fid.dbSettingsGroup,"CLUIFrames"); + strcpy(fid.prefix,"FramesTitleBarFont"); + + CallService(MS_FONT_GET,(WPARAM)&fid,(LPARAM)&TitleBarLogFont); + CLUIFramesOnClistResize(0,0); + return 0; +} + +static void CLUIRegisterFonts() +{ + FontID fid = {0}; + fid.cbSize = sizeof(fid); + strcpy(fid.group, LPGEN("Frames")); + strcpy(fid.name, LPGEN("TitleBarFont")); + strcpy(fid.dbSettingsGroup, "CLUIFrames"); + strcpy(fid.prefix, "FramesTitleBarFont"); + FontRegister(&fid); + + CLUIFrameOnFontChange(0,0); + + HookEvent(ME_FONT_RELOAD,CLUIFrameOnFontChange); +} + +static int CLUIFrameOnModulesLoad(WPARAM wParam,LPARAM lParam) +{ + CLUIFramesLoadMainMenu(); + CLUIFramesCreateMenuForFrame(-1,-1,000010000,Menu_AddContextFrameMenuItem); + CLUIRegisterFonts(); + return 0; +} + +static int CLUIFrameOnModulesUnload(WPARAM wParam,LPARAM lParam) +{ + CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMIVisible, 0 ); + CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMITitle, 0 ); + CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMITBVisible, 0 ); + CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMILock, 0 ); + CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMIColl, 0 ); + CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMIFloating, 0 ); + CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMIAlignRoot, 0 ); + CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMIAlignTop, 0 ); + CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMIAlignClient, 0 ); + CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMIAlignBottom, 0 ); + CallService( MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, ( LPARAM )contMIBorder, 0 ); + return 0; +} + +static INT_PTR CLUIGetCapsService(WPARAM wParam,LPARAM lParam) +{ + switch (wParam) { + case CLUICAPS_FLAGS1: + return CLUIF_HIDEEMPTYGROUPS | CLUIF_DISABLEGROUPS | CLUIF_HASONTOPOPTION | CLUIF_HASAUTOHIDEOPTION; + case CLUICAPS_FLAGS2: + return MAKELONG(EXTRACOLUMNCOUNT,1); + } + return 0; +} + +int LoadCLUIFramesModule(void) +{ + WNDCLASS wndclass; + wndclass.style = CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW ; + wndclass.lpfnWndProc = CLUIFrameTitleBarProc; + wndclass.cbClsExtra = 0; + wndclass.cbWndExtra = 0; + wndclass.hInstance = g_hInst; + wndclass.hIcon = NULL; + wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hbrBackground = NULL; + wndclass.lpszMenuName = NULL; + wndclass.lpszClassName = CLUIFrameTitleBarClassName; + RegisterClass(&wndclass); + + //container helper + WNDCLASS cntclass; + cntclass.style = CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW|( IsWinVerXPPlus() ? CS_DROPSHADOW : 0); + cntclass.lpfnWndProc = CLUIFrameContainerWndProc; + cntclass.cbClsExtra = 0; + cntclass.cbWndExtra = 0; + cntclass.hInstance = g_hInst; + cntclass.hIcon = NULL; + cntclass.hCursor = LoadCursor(NULL, IDC_ARROW); + cntclass.hbrBackground = NULL; + cntclass.lpszMenuName = NULL; + cntclass.lpszClassName = _T("FramesContainer"); + RegisterClass(&cntclass); + //end container helper + + GapBetweenFrames = DBGetContactSettingDword(NULL,"CLUIFrames","GapBetweenFrames",1); + + nFramescount = 0; + InitializeCriticalSection(&csFrameHook); + InitFramesMenus(); + + hHook[0] = HookEvent(ME_SYSTEM_MODULESLOADED,CLUIFrameOnModulesLoad); + hHook[1] = HookEvent(ME_CLIST_PREBUILDFRAMEMENU,CLUIFramesModifyContextMenuForFrame); + hHook[2] = HookEvent(ME_CLIST_PREBUILDMAINMENU,CLUIFrameOnMainMenuBuild); + + hService[0] = CreateServiceFunction(MS_CLIST_FRAMES_ADDFRAME,CLUIFramesAddFrame); + hService[1] = CreateServiceFunction(MS_CLIST_FRAMES_REMOVEFRAME,CLUIFramesRemoveFrame); + + hService[2] = CreateServiceFunction(MS_CLIST_FRAMES_SETFRAMEOPTIONS,CLUIFramesSetFrameOptions); + hService[3] = CreateServiceFunction(MS_CLIST_FRAMES_GETFRAMEOPTIONS,CLUIFramesGetFrameOptions); + hService[4] = CreateServiceFunction(MS_CLIST_FRAMES_UPDATEFRAME,CLUIFramesUpdateFrame); + + hService[5] = CreateServiceFunction(MS_CLIST_FRAMES_SHFRAMETITLEBAR,CLUIFramesShowHideFrameTitleBar); + hService[6] = CreateServiceFunction(MS_CLIST_FRAMES_SHOWALLFRAMESTB,CLUIFramesShowAllTitleBars); + hService[7] = CreateServiceFunction(MS_CLIST_FRAMES_HIDEALLFRAMESTB,CLUIFramesHideAllTitleBars); + hService[8] = CreateServiceFunction(MS_CLIST_FRAMES_SHFRAME,CLUIFramesShowHideFrame); + hService[9] = CreateServiceFunction(MS_CLIST_FRAMES_SHOWALLFRAMES,CLUIFramesShowAll); + + hService[10] = CreateServiceFunction(MS_CLIST_FRAMES_ULFRAME,CLUIFramesLockUnlockFrame); + hService[11] = CreateServiceFunction(MS_CLIST_FRAMES_UCOLLFRAME,CLUIFramesCollapseUnCollapseFrame); + hService[12] = CreateServiceFunction(MS_CLIST_FRAMES_SETUNBORDER,CLUIFramesSetUnSetBorder); + + hService[13] = CreateServiceFunction(MS_CLUI_GETCAPS,CLUIGetCapsService); + + hService[14] = CreateServiceFunction(CLUIFRAMESSETALIGN,CLUIFramesSetAlign); + hService[15] = CreateServiceFunction(CLUIFRAMESMOVEUPDOWN,CLUIFramesMoveUpDown); + + hService[16] = CreateServiceFunction(CLUIFRAMESSETALIGNALTOP,CLUIFramesSetAlignalTop); + hService[17] = CreateServiceFunction(CLUIFRAMESSETALIGNALCLIENT,CLUIFramesSetAlignalClient); + hService[18] = CreateServiceFunction(CLUIFRAMESSETALIGNALBOTTOM,CLUIFramesSetAlignalBottom); + + hService[19] = CreateServiceFunction("Set_Floating",CLUIFrameSetFloat); + hWndExplorerToolBar = FindWindowExA(0,0,"Shell_TrayWnd",NULL); + OnFrameTitleBarBackgroundChange(0,0); + FramesSysNotStarted = FALSE; + hHook[3] = HookEvent(ME_SYSTEM_PRESHUTDOWN, CLUIFrameOnModulesUnload); + return 0; +} + +int UnLoadCLUIFramesModule(void) +{ + int i; + FramesSysNotStarted = TRUE; + + for (i = 0; ihwndContactList,0); + CLUIFramesStoreAllFrames(); + lockfrm(); + for (i = 0;i=EXTRACOLUMNCOUNT){return(-1);}; + if (to<0||to>=EXTRACOLUMNCOUNT){return(-1);}; + if (to EXTRACOLUMNCOUNT) + return -1; + else + return extra-1; + } + else + { + int cnt = EnabledColumnCount; + int extracnt = EXTRACOLUMNCOUNT-1; + int ord = ExtraOrder[extra-1]; + if (!visar[ord]) return -1; + return (colsum(0,ord)-1); + } +}; + +int ColumnNumToExtra(int column) +{ + int i; + + if (HasExtraIconsService()) + return column+1; + + for (i = 0; ihwndContactTree == 0){return(-1);}; + if (wParam == 0||lParam == 0){return(-1);}; + piec = (pIconExtraColumn)lParam; + + if (piec->cbSize != sizeof(IconExtraColumn)){return(-1);}; + icol = ExtraToColumnNum(piec->ColumnType); + if (icol == -1){return(-1);}; + hItem = (HANDLE)SendMessage(pcli->hwndContactTree,CLM_FINDCONTACT,(WPARAM)wParam,0); + if (hItem == 0){return(-1);}; + + SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(icol,piec->hImage)); + return 0; +}; + +//wparam = hIcon +//return hImage on success,-1 on failure +INT_PTR AddIconToExtraImageList(WPARAM wParam,LPARAM lParam) +{ + if (hExtraImageList == 0||wParam == 0){return(-1);}; + return((int)ImageList_AddIcon(hExtraImageList,(HICON)wParam)); +} + +void SetNewExtraColumnCount() +{ + int newcount; + + GetVisColumns(); + newcount = colsum(0,EXTRACOLUMNCOUNT-1); + DBWriteContactSettingByte(NULL,CLUIFrameModule,"EnabledColumnCount",(BYTE)newcount); + EnabledColumnCount = newcount; + SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS,EnabledColumnCount,0); +} + +int OnIconLibIconChanged(WPARAM wParam,LPARAM lParam) +{ + HICON hicon; + hicon = LoadIconFromExternalFile("clisticons.dll",0,TRUE,FALSE,"Email","Contact List","Email Icon",-IDI_EMAIL); + ExtraImageIconsIndex[0] = ImageList_ReplaceIcon(hExtraImageList,ExtraImageIconsIndex[0],hicon ); + + hicon = LoadIconFromExternalFile("clisticons.dll",1,TRUE,FALSE,"Sms","Contact List","Sms Icon",-IDI_SMS); + ExtraImageIconsIndex[1] = ImageList_ReplaceIcon(hExtraImageList,ExtraImageIconsIndex[1],hicon ); + + hicon = LoadIconFromExternalFile("clisticons.dll",4,TRUE,FALSE,"Web","Contact List","Web Icon",-IDI_GLOBUS); + ExtraImageIconsIndex[2] = ImageList_ReplaceIcon(hExtraImageList,ExtraImageIconsIndex[2],hicon ); + + pcli->pfnClcBroadcast( INTM_INVALIDATE,0,0); + return 0; +} + +void ReloadExtraIcons() +{ + int count,i; + PROTOACCOUNT **accs; + HICON hicon; + + SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNSSPACE,DBGetContactSettingByte(NULL,"CLUI","ExtraColumnSpace",18),0); + SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGELIST,0,(LPARAM)NULL); + if (hExtraImageList){ImageList_Destroy(hExtraImageList);}; + hExtraImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,1,256); + + if (!HasExtraIconsService()) + { + //loading icons + hicon = LoadIconFromExternalFile("clisticons.dll",0,TRUE,TRUE,"Email","Contact List","Email Icon",-IDI_EMAIL); + if (!hicon) hicon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_EMAIL)); + ExtraImageIconsIndex[0] = ImageList_AddIcon(hExtraImageList,hicon ); + + + hicon = LoadIconFromExternalFile("clisticons.dll",1,TRUE,TRUE,"Sms","Contact List","Sms Icon",-IDI_SMS); + if (!hicon) hicon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_SMS)); + ExtraImageIconsIndex[1] = ImageList_AddIcon(hExtraImageList,hicon ); + + hicon = LoadIconFromExternalFile("clisticons.dll",4,TRUE,TRUE,"Web","Contact List","Web Icon",-IDI_GLOBUS); + if (!hicon) hicon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_GLOBUS)); + ExtraImageIconsIndex[2] = ImageList_AddIcon(hExtraImageList,hicon ); + + //calc only needed protocols + ProtoEnumAccounts( &count, &accs ); + for ( i = 0; i < count; i++ ) + if ( IsAccountEnabled( accs[i] ) && CallProtoService( accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0 )) + ImageList_AddIcon( hExtraImageList, LoadSkinnedProtoIcon( accs[i]->szModuleName, ID_STATUS_ONLINE )); + } + + SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGELIST,0,(LPARAM)hExtraImageList); + + //SetAllExtraIcons(hImgList); + SetNewExtraColumnCount(); + NotifyEventHooks(hExtraImageListRebuilding,0,0); + ImageCreated = TRUE; +} + +void ClearExtraIcons(); + +void ReAssignExtraIcons() +{ + ClearExtraIcons(); + SetNewExtraColumnCount(); + SetAllExtraIcons(pcli->hwndContactTree,0); + SendMessage(pcli->hwndContactTree,CLM_AUTOREBUILD,0,0); +} + +void ClearExtraIcons() +{ + int i; + HANDLE hContact,hItem; + + //EnabledColumnCount = DBGetContactSettingByte(NULL,CLUIFrameModule,"EnabledColumnCount",5); + //SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS,EnabledColumnCount,0); + SetNewExtraColumnCount(); + + hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); + do { + + hItem = (HANDLE)SendMessage(pcli->hwndContactTree,CLM_FINDCONTACT,(WPARAM)hContact,0); + if (hItem == 0){continue;}; + for (i = 0;ihwndContactTree,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(i,0xFF)); + }; + + } while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0)); +}; + +void SetAllExtraIcons(HWND hwndList,HANDLE hContact) +{ + HANDLE hItem; + boolean hcontgiven = FALSE; + char *szProto; + char *ImgIndex[64]; + int maxpr,count,i; + PROTOACCOUNT **accs; + pdisplayNameCacheEntry pdnce; + int em,pr,sms,a1,a2,w1,c1; + int tick = 0; + BOOL hasExtraIconsService; + hcontgiven = (hContact != 0); + + if (pcli->hwndContactTree == 0){return;}; + tick = GetTickCount(); + if (ImageCreated == FALSE) ReloadExtraIcons(); + + SetNewExtraColumnCount(); + + hasExtraIconsService = HasExtraIconsService(); + if (!hasExtraIconsService) { + em = ExtraToColumnNum(EXTRA_ICON_EMAIL); + pr = ExtraToColumnNum(EXTRA_ICON_PROTO); + sms = ExtraToColumnNum(EXTRA_ICON_SMS); + a1 = ExtraToColumnNum(EXTRA_ICON_ADV1); + a2 = ExtraToColumnNum(EXTRA_ICON_ADV2); + w1 = ExtraToColumnNum(EXTRA_ICON_WEB); + c1 = ExtraToColumnNum(EXTRA_ICON_CLIENT); + + memset(ImgIndex,0,sizeof(ImgIndex)); + ProtoEnumAccounts( &count, &accs ); + + maxpr = 0; + //calc only needed protocols + for ( i = 0; i < count; i++ ) { + if ( !IsAccountEnabled( accs[i] ) || CallProtoService( accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0 ) == 0 ) + continue; + ImgIndex[maxpr] = accs[i]->szModuleName; + maxpr++; + } + } + + if ( hContact == NULL ) + hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); + + do { + szProto = NULL; + hItem = hContact; + if (hItem == 0){continue;}; + pdnce = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hItem); + if (pdnce == NULL) {continue;}; + + // szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); + szProto = pdnce->szProto; + + if (!hasExtraIconsService) + { + if (ExtraToColumnNum(EXTRA_ICON_WEB) != -1) + { + boolean showweb = FALSE; + + if (szProto != NULL) + { + char *homepage; + homepage = DBGetStringA(pdnce->hContact,"UserInfo", "Homepage"); + if (!homepage) + homepage = DBGetStringA(pdnce->hContact,pdnce->szProto, "Homepage"); + if (homepage != NULL) + { + showweb = TRUE; + mir_free(homepage); + } + } + + SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraToColumnNum(EXTRA_ICON_WEB),(showweb)?2:0xFF)); + } + + if (ExtraToColumnNum(EXTRA_ICON_EMAIL) != -1) + { + DBVARIANT dbv = {0}; + boolean showemail = TRUE; + + if (szProto == NULL || DBGetContactSettingString(hContact, szProto, "e-mail",&dbv)) + { + DBFreeVariant(&dbv); + if (DBGetContactSettingString(hContact, "UserInfo", "Mye-mail0", &dbv)) + showemail = FALSE; + } + DBFreeVariant(&dbv); + + SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraToColumnNum(EXTRA_ICON_EMAIL),(showemail)?0:0xFF)); + } + + if (ExtraToColumnNum(EXTRA_ICON_SMS) != -1) + { + DBVARIANT dbv = {0}; + boolean showsms = TRUE; + + if (szProto == NULL || DBGetContactSettingString(hContact, szProto, "Cellular",&dbv)) { + DBFreeVariant(&dbv); + if (DBGetContactSettingString(hContact, "UserInfo", "MyPhone0", &dbv)) + showsms = FALSE; + } + SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraToColumnNum(EXTRA_ICON_SMS),(showsms)?1:0xFF)); + DBFreeVariant(&dbv); + } + + if (ExtraToColumnNum(EXTRA_ICON_PROTO) != -1) + { + for (i = 0;iszServiceName); + FreeAndNil((void**)&cmep); + } + return 0; +} + +static INT_PTR AddContextFrameMenuItem(WPARAM wParam,LPARAM lParam) +{ + TMO_MenuItem tmi; + CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; + if ( !pcli->pfnConvertMenu(mi, &tmi)) + return 0; + + if ((mi->flags & CMIF_ROOTPOPUP) || (mi->flags & CMIF_CHILDPOPUP)) + tmi.root = mi->hParentMenu; + + lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)mir_alloc(sizeof(FrameMenuExecParam)); + if (fmep == NULL) + return 0; + + fmep->szServiceName = mir_strdup(mi->pszService); + fmep->Frameid = mi->popupPosition; + fmep->param1 = (INT_PTR)mi->pszContactOwner; + tmi.ownerdata = fmep; + + return CallService(MO_ADDNEWMENUITEM, (WPARAM)hFrameMenuObject, (LPARAM)&tmi); +} + +static INT_PTR RemoveContextFrameMenuItem(WPARAM wParam,LPARAM lParam) +{ + /* this do by free service + lpFrameMenuExecParam fmep; + fmep = (lpFrameMenuExecParam)CallService(MO_MENUITEMGETOWNERDATA,wParam,lParam); + if (fmep != NULL){ + if (fmep->szServiceName != NULL){ + mir_free(fmep->szServiceName); + fmep->szServiceName = NULL; + } + mir_free(fmep); + } + */ + CallService(MO_REMOVEMENUITEM,wParam,0); + return 0; +} + +//called with: +//wparam - ownerdata +//lparam - lparam from winproc +INT_PTR FrameMenuExecService(WPARAM wParam,LPARAM lParam) +{ + lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)wParam; + if (fmep == NULL){return(-1);} + CallService(fmep->szServiceName,lParam,fmep->param1); + + return 0; +} + +//true - ok,false ignore +INT_PTR FrameMenuCheckService(WPARAM wParam,LPARAM lParam) +{ + PCheckProcParam pcpp = (PCheckProcParam)wParam; + if (pcpp == NULL) + return FALSE; + + TMO_MenuItem mi; + if (CallService(MO_GETMENUITEM,(WPARAM)pcpp->MenuItemHandle,(LPARAM)&mi) == 0) { + lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)mi.ownerdata; + if (fmep != NULL) { + //pcpp->wParam - frameid + if (((WPARAM)fmep->Frameid == pcpp->wParam)||fmep->Frameid == -1) return(TRUE); + } + } + return FALSE; +} + +static INT_PTR ContextFrameMenuNotify(WPARAM wParam,LPARAM lParam) +{ + NotifyEventHooks(hPreBuildFrameMenuEvent,wParam,lParam); + return 0; +} + +static INT_PTR BuildContextFrameMenu(WPARAM wParam,LPARAM lParam) +{ + CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; + HMENU hMenu; + ListParam param = { 0 }; + param.MenuObjectHandle = hFrameMenuObject; + param.wParam = wParam; + param.lParam = lParam; + + hMenu = CreatePopupMenu(); + //NotifyEventHooks(hPreBuildFrameMenuEvent,wParam,-1); + ContextFrameMenuNotify(wParam,-1); + CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m); + return (INT_PTR)hMenu; +} + +// == == == == == == == == == == == == == Frames end +boolean InternalGenMenuModule = FALSE; + +int MeasureItemProxy(WPARAM wParam,LPARAM lParam) +{ + int val; + if (InternalGenMenuModule) + { + val = CallService(MS_INT_MENUMEASUREITEM,wParam,lParam); + if (val) return(val); + } + return CallService(MS_CLIST_MENUMEASUREITEM,wParam,lParam); +} + +int DrawItemProxy(WPARAM wParam,LPARAM lParam) +{ + if (InternalGenMenuModule) + { + int val; + val = CallService(MS_INT_MENUDRAWITEM,wParam,lParam); + if (val) return(val); + } + return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam); +} + +int ProcessCommandProxy(WPARAM wParam,LPARAM lParam) +{ + if (InternalGenMenuModule) + { + int val; + val = CallService(MS_INT_MENUPROCESSCOMMAND,wParam,lParam); + if (val) return(val); + } + + return CallService(MS_CLIST_MENUPROCESSCOMMAND,wParam,lParam); + +} + +int ModifyMenuItemProxy(WPARAM wParam,LPARAM lParam) +{ + if (InternalGenMenuModule) + { + int val; + val = CallService(MS_INT_MODIFYMENUITEM,wParam,lParam); + if (val) return(val); + } + + return CallService(MS_CLIST_MODIFYMENUITEM,wParam,lParam); +} + +int InitFramesMenus(void) +{ + TMenuParam tmp; + + if (!ServiceExists(MO_REMOVEMENUOBJECT)) + { + + InitCustomMenus(); + InternalGenMenuModule = TRUE; + } + + if (ServiceExists(MO_REMOVEMENUOBJECT)) + { + CreateServiceFunction("FrameMenuExecService",FrameMenuExecService); + CreateServiceFunction("FrameMenuCheckService",FrameMenuCheckService); + CreateServiceFunction("FrameMenuFreeService",FreeOwnerDataFrameMenu); + + + CreateServiceFunction(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM,RemoveContextFrameMenuItem); + CreateServiceFunction("CList/AddContextFrameMenuItem",AddContextFrameMenuItem); + CreateServiceFunction(MS_CLIST_MENUBUILDFRAMECONTEXT,BuildContextFrameMenu); + CreateServiceFunction(MS_CLIST_FRAMEMENUNOTIFY,ContextFrameMenuNotify); + hPreBuildFrameMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDFRAMEMENU); + + //frame menu object + memset(&tmp,0,sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + tmp.CheckService = "FrameMenuCheckService"; + tmp.ExecService = "FrameMenuExecService"; + tmp.name = "FrameMenu"; + hFrameMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT,0,(LPARAM)&tmp); + { + OptParam op; + op.Handle = hFrameMenuObject; + op.Setting = OPT_MENUOBJECT_SET_FREE_SERVICE; + op.Value = (INT_PTR)"FrameMenuFreeService"; + CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); + } + } + return 0; +} diff --git a/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp b/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp new file mode 100644 index 0000000000..319f4f8f63 --- /dev/null +++ b/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp @@ -0,0 +1,599 @@ +#include "../commonheaders.h" + +extern HINSTANCE g_hInst; +HANDLE hStatusBarShowToolTipEvent,hStatusBarHideToolTipEvent; +boolean canloadstatusbar = FALSE; +HWND helperhwnd = 0; +HANDLE hFrameHelperStatusBar; + +void CluiProtocolStatusChanged(int parStatus, const char* szProto); + +INT_PTR GetConnectingIconService (WPARAM wParam,LPARAM lParam); + +int RecreateStatusBar(HWND); +int UseOwnerDrawStatusBar; + +#define TM_STATUSBAR 23435234 +#define TM_STATUSBARHIDE 23435235 +boolean tooltipshoing; +WNDPROC OldWindowProc = NULL; + + +POINT lastpnt; +RECT OldRc = {0}; +static HBITMAP hBmpBackground; +static int backgroundBmpUse; +static COLORREF bkColour; +extern BYTE showOpts; +int extraspace; + +int OnStatusBarBackgroundChange() +{ + { + DBVARIANT dbv; + showOpts = DBGetContactSettingByte(NULL,"CLUI","SBarShow",1); + bkColour = DBGetContactSettingDword(NULL,"StatusBar","BkColour",CLCDEFAULT_BKCOLOUR); + if (hBmpBackground) {DeleteObject(hBmpBackground); hBmpBackground = NULL;} + if (DBGetContactSettingByte(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)) { + if (!DBGetContactSettingString(NULL,"StatusBar","BkBitmap",&dbv)) { + hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal); + mir_free(dbv.pszVal); + } + } + backgroundBmpUse = DBGetContactSettingWord(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE); + extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0); + } + + RecreateStatusBar(pcli->hwndContactList); + if (pcli->hwndStatus) InvalidateRect(pcli->hwndStatus,NULL,TRUE); + return 0; +} + + +void DrawDataForStatusBar(LPDRAWITEMSTRUCT dis) +{ + //LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; + ProtocolData *PD = (ProtocolData *)dis->itemData; + char *szProto = (char*)dis->itemData; + int status,x; + SIZE textSize; + boolean NeedDestroy = FALSE; + HICON hIcon; + HRGN hrgn; + + + if (PD == NULL){return;} + if (dis->hDC == NULL) {return;} + + //clip it + + hrgn = CreateRectRgn(dis->rcItem.left, dis->rcItem.top, + dis->rcItem.right, dis->rcItem.bottom); + + SelectClipRgn(dis->hDC, hrgn); + + szProto = PD->RealName; +#ifdef _DEBUG + { + //char buf[512]; + //sprintf(buf,"proto: %s draw at pos: %d\r\n",szProto,dis->rcItem.left); + //OutputDebugStringA(buf); + } +#endif + + status = CallProtoService(szProto,PS_GETSTATUS,0,0); + SetBkMode(dis->hDC,TRANSPARENT); + x = dis->rcItem.left+extraspace; + + if (showOpts&1) + { + if ((DBGetContactSettingByte(NULL,"CLUI","UseConnectingIcon",1) == 1) && status < ID_STATUS_OFFLINE) + { + hIcon = (HICON)GetConnectingIconService((WPARAM)szProto,0); + + if (hIcon) + { + NeedDestroy = TRUE; + }else + { + hIcon = LoadSkinnedProtoIcon(szProto,status); + } + + }else + { + hIcon = LoadSkinnedProtoIcon(szProto,status); + } + DrawIconEx(dis->hDC,x,(dis->rcItem.top+dis->rcItem.bottom-GetSystemMetrics(SM_CYSMICON))>>1,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL); + if (NeedDestroy) DestroyIcon(hIcon); + x += GetSystemMetrics(SM_CXSMICON)+2; + } + else x += 2; + if (showOpts&2) { + TCHAR szName[64]; + + PROTOACCOUNT* pa = ProtoGetAccount(szProto); + mir_sntprintf(szName, SIZEOF(szName), _T("%s%s"), pa->tszAccountName, showOpts&4 ? _T(" ") : _T("")); + GetTextExtentPoint32(dis->hDC, szName, (int)_tcslen(szName), &textSize); + + TextOut(dis->hDC,x,(dis->rcItem.top+dis->rcItem.bottom-textSize.cy)>>1,szName,lstrlen(szName)); + x += textSize.cx; + } + if (showOpts&4) { + TCHAR *szStatus = pcli->pfnGetStatusModeDescription(status, 0); + if (!szStatus) + szStatus = _T(""); + GetTextExtentPoint32(dis->hDC,szStatus,lstrlen(szStatus),&textSize); + TextOut(dis->hDC,x,(dis->rcItem.top+dis->rcItem.bottom-textSize.cy)>>1,szStatus,lstrlen(szStatus)); + } + SelectClipRgn(dis->hDC, NULL); + DeleteObject(hrgn); +} + +void DrawBackGround(HWND hwnd,HDC mhdc) +{ + HDC hdcMem,hdc; + RECT clRect,*rcPaint; + + int yScroll = 0; + int y; + PAINTSTRUCT paintst = {0}; + HBITMAP hBmpOsb,holdbmp; + DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE); + int grey = 0; + HFONT oFont; + HBRUSH hBrushAlternateGrey = NULL; + + HFONT hFont; + + //InvalidateRect(hwnd,0,FALSE); + + 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; + y = -yScroll; + hdcMem = CreateCompatibleDC(hdc); + hBmpOsb = CreateBitmap(clRect.right,clRect.bottom,1,GetDeviceCaps(hdc,BITSPIXEL),NULL); + holdbmp = (HBITMAP)SelectObject(hdcMem,hBmpOsb); + oFont = (HFONT)SelectObject(hdcMem,hFont); + SetBkMode(hdcMem,TRANSPARENT); + { HBRUSH hBrush,hoBrush; + + hBrush = CreateSolidBrush(bkColour); + hoBrush = (HBRUSH)SelectObject(hdcMem,hBrush); + FillRect(hdcMem,rcPaint,hBrush); + SelectObject(hdcMem,hoBrush); + DeleteObject(hBrush); + if (hBmpBackground) { + BITMAP bmp; + int x,y; + int maxx,maxy; + int destw,desth; + + GetObject(hBmpBackground,sizeof(bmp),&bmp); + HDC hdcBmp = CreateCompatibleDC(hdcMem); + HDC holdbackbmp = (HDC)SelectObject(hdcBmp,hBmpBackground); + y = backgroundBmpUse&CLBF_SCROLL?-yScroll:0; + maxx = backgroundBmpUse&CLBF_TILEH?clRect.right:1; + maxy = backgroundBmpUse&CLBF_TILEV?maxy = rcPaint->bottom:y+1; + switch(backgroundBmpUse&CLBM_TYPE) { + case CLB_STRETCH: + if (backgroundBmpUse&CLBF_PROPORTIONAL) { + if (clRect.right*bmp.bmHeighttop-desth) continue; + for (x = 0;xhwndStatus,SB_GETTEXT,(WPARAM)nPanel,(LPARAM)0); + if (PD == NULL){ + continue; + } + SendMessage(hwnd,SB_GETRECT,(WPARAM)nPanel,(LPARAM)&rc); + //rc.left += startoffset; + //if (rc.left>=rc.right) rc.left = rc.right-1; + rc.top = 0; + rc.left = nPanel*sectwidth+startoffset; + rc.right = rc.left+sectwidth-1; + ds.rcItem = rc; + ds.itemData = (ULONG_PTR)PD; + ds.itemID = nPanel; + + DrawDataForStatusBar(&ds); + } } + + 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); +} + +LRESULT CALLBACK StatusBarOwnerDrawProc( HWND hwnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam +) +{ +if (UseOwnerDrawStatusBar) +{ + switch(uMsg) + { + case WM_ERASEBKGND: + { + + //DrawBackGround(hwnd); + return 0; + } + case WM_PRINT: + { + DrawBackGround(hwnd,(HDC)wParam); + return 0; + } + case WM_PAINT: + { + DrawBackGround(hwnd,0); + return 0; + } + } + +} +return (CallWindowProc(OldWindowProc,hwnd,uMsg,wParam,lParam) + ); +} + +LRESULT CALLBACK StatusHelperProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_CREATE: + { + { + tooltipshoing = FALSE; + //HWND label; + //label = CreateWindow("static","Top window",WS_VISIBLE|WS_CHILD ,2,2,120,60,hwnd,NULL,g_hInst,0); + //SendMessage(label,WM_SETFONT,(WPARAM)TitleBarFont,0); + } + return(FALSE); + + } + case WM_GETMINMAXINFO:{ + RECT rct; + if (pcli->hwndStatus == 0){break;} + GetWindowRect(pcli->hwndStatus,&rct); + memset((LPMINMAXINFO)lParam,0,sizeof(MINMAXINFO)); + ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 5; + ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = rct.bottom-rct.top; + ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = 1600; + ((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = rct.bottom-rct.top; + return 0; + } + + case WM_NCHITTEST: + { + + } + case WM_SHOWWINDOW: + { + { + int res; + if (hFrameHelperStatusBar) + { + res = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS,hFrameHelperStatusBar),0); + DBWriteContactSettingByte(0,"CLUI","ShowSBar",(BYTE)((res&F_VISIBLE)?1:0)); + } + } + + + if (tooltipshoing){ + NotifyEventHooks(hStatusBarHideToolTipEvent,0,0); + tooltipshoing = FALSE; + } + return 0; + // + } + case WM_TIMER: + { + if (wParam == TM_STATUSBARHIDE) + { + KillTimer(hwnd,TM_STATUSBARHIDE); + + if (tooltipshoing){ + NotifyEventHooks(hStatusBarHideToolTipEvent,0,0); + tooltipshoing = FALSE; + } + + + } + + if (wParam == TM_STATUSBAR) + { + POINT pt; + KillTimer(hwnd,TM_STATUSBAR); + + GetCursorPos(&pt); + if (pt.x == lastpnt.x&&pt.y == lastpnt.y) + { + { + int i,nParts; + ProtocolData *PD; + RECT rc; + ScreenToClient(pcli->hwndStatus,&pt); + nParts = SendMessage(pcli->hwndStatus,SB_GETPARTS,0,0); + for (i = 0;ihwndStatus,SB_GETRECT,i,(LPARAM)&rc); + if (PtInRect(&rc,pt)) { + PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,i,(LPARAM)0); + if (PD == NULL){return 0;} + + NotifyEventHooks(hStatusBarShowToolTipEvent,(WPARAM)PD->RealName,0); + SetTimer(hwnd,TM_STATUSBARHIDE,DBGetContactSettingWord(NULL,"CLUIFrames","HideToolTipTime",5000),0); + tooltipshoing = TRUE; + + break; + } + } + + + + } + + + + } + + } + + return 0; + } + + case WM_SETCURSOR: + { + + { + POINT pt; + GetCursorPos(&pt); + if (pt.x == lastpnt.x&&pt.y == lastpnt.y) + { + return 0; + } + lastpnt = pt; + if (tooltipshoing){ + KillTimer(hwnd,TM_STATUSBARHIDE); + NotifyEventHooks(hStatusBarHideToolTipEvent,0,0); + tooltipshoing = FALSE; + } + KillTimer(hwnd,TM_STATUSBAR); + SetTimer(hwnd,TM_STATUSBAR,DBGetContactSettingWord(NULL,"CLC","InfoTipHoverTime",750),0); + return 0; + } + + } + case WM_NOTIFY: + { + if (lParam == 0){return 0;} + if (((LPNMHDR)lParam)->hwndFrom == pcli->hwndStatus) + { + + if (((LPNMHDR)lParam)->code == WM_NCHITTEST) + { + LPNMMOUSE lpnmmouse = (LPNMMOUSE) lParam; + } ; + } + } + + case WM_CONTEXTMENU: + KillTimer(hwnd,TM_STATUSBARHIDE); + + if (tooltipshoing) + NotifyEventHooks(hStatusBarHideToolTipEvent,0,0); + + tooltipshoing = FALSE; + + case WM_MEASUREITEM: + case WM_DRAWITEM: + //parent do all work for us + return(SendMessage(pcli->hwndContactList,msg,wParam,lParam)); + + case WM_MOVE: + PostMessage(pcli->hwndStatus,WM_MOVE,wParam,lParam); + + case WM_SIZE: + { + RECT rc; + int b; + if (pcli->hwndStatus != 0) { + GetClientRect(hwnd,&rc); + + b = LOWORD(lParam); + if (b != 0&&(rc.right-rc.left) != (OldRc.right-OldRc.left)) { + OldRc = rc; + if (canloadstatusbar) + if (DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",0)||DBGetContactSettingByte(NULL,"CLUI","EqualSections",1)) + CluiProtocolStatusChanged(0,0); + } + if (msg == WM_SIZE) PostMessage(pcli->hwndStatus,WM_SIZE,wParam,lParam); + if (pcli->hwndStatus != 0) InvalidateRect(pcli->hwndStatus,NULL,TRUE); + return 0; + } + } + + default: + return DefWindowProc(hwnd, msg, wParam, lParam); + + } + return DefWindowProc(hwnd, msg, wParam, lParam); +} + +HWND CreateStatusHelper(HWND parent) +{ + WNDCLASS wndclass = {0}; + TCHAR pluginname[] = _T("Statushelper"); + + if (GetClassInfo(g_hInst,pluginname,&wndclass) == 0 ) { + wndclass.style = 0; + wndclass.lpfnWndProc = StatusHelperProc; + wndclass.cbClsExtra = 0; + wndclass.cbWndExtra = 0; + wndclass.hInstance = g_hInst; + wndclass.hIcon = NULL; + wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); + wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE+1); + wndclass.lpszMenuName = NULL; + wndclass.lpszClassName = pluginname; + RegisterClass(&wndclass); + } + + return(CreateWindow(pluginname,pluginname, + /*WS_THICKFRAME|*/WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN, + 0,0,0,0,parent,NULL,g_hInst,NULL)); +} + +HANDLE CreateStatusBarFrame() +{ + CLISTFrame Frame; + int h; + RECT rc; + + memset(&Frame,0,sizeof(Frame)); + Frame.cbSize = sizeof(CLISTFrame); + Frame.hWnd = helperhwnd; + Frame.align = alBottom; + Frame.hIcon = LoadSkinnedIcon (SKINICON_OTHER_MIRANDA); + Frame.Flags = (DBGetContactSettingByte(NULL,"CLUI","ShowSBar",1)?F_VISIBLE:0)|F_LOCKED|F_NOBORDER|F_TCHAR; + GetWindowRect(helperhwnd,&rc); + h = rc.bottom-rc.top; + Frame.height = (h == 0)?20:h; + + + Frame.tname = _T("Status"); + Frame.TBtname = TranslateT("Status Bar"); + hFrameHelperStatusBar = (HANDLE)CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&Frame,(LPARAM)0); + + + return hFrameHelperStatusBar; +} + +int RecreateStatusBar(HWND parent) +{ + if (pcli->hwndStatus) { + FreeProtocolData(); + DestroyWindow(pcli->hwndStatus); + } + pcli->hwndStatus = 0; + if (hFrameHelperStatusBar) CallService(MS_CLIST_FRAMES_REMOVEFRAME,(WPARAM)hFrameHelperStatusBar,0); + + helperhwnd = CreateStatusHelper(parent); + UseOwnerDrawStatusBar = DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",0); + + //create the status wnd + pcli->hwndStatus = CreateStatusWindow( + ( DBGetContactSettingByte(0,"CLUI","SBarUseSizeGrip",TRUE) && (!UseOwnerDrawStatusBar)?SBARS_SIZEGRIP:0)| + WS_CHILD | (DBGetContactSettingByte(NULL,"CLUI","ShowSBar",1)?WS_VISIBLE:0), _T(""), helperhwnd, 0); + + OldWindowProc = (WNDPROC)GetWindowLongPtr(pcli->hwndStatus,GWLP_WNDPROC); + SetWindowLongPtr(pcli->hwndStatus,GWLP_WNDPROC,(LONG_PTR)&StatusBarOwnerDrawProc); + CreateStatusBarFrame(); + { + SetWindowPos(helperhwnd,NULL,1,1,1,1,SWP_NOZORDER); + CluiProtocolStatusChanged(0,0); + CallService(MS_CLIST_FRAMES_UPDATEFRAME,-1,0); + } + + return 0; +} + +HWND CreateStatusBarhWnd(HWND parent) +{ + RecreateStatusBar(parent); + OnStatusBarBackgroundChange(); + + hStatusBarShowToolTipEvent = CreateHookableEvent(ME_CLIST_FRAMES_SB_SHOW_TOOLTIP); + hStatusBarHideToolTipEvent = CreateHookableEvent(ME_CLIST_FRAMES_SB_HIDE_TOOLTIP); + return pcli->hwndStatus; +} diff --git a/plugins/Clist_mw/src/clc.cpp b/plugins/Clist_mw/src/clc.cpp new file mode 100644 index 0000000000..40eddc02eb --- /dev/null +++ b/plugins/Clist_mw/src/clc.cpp @@ -0,0 +1,294 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 "commonheaders.h" + +int DefaultImageListColorDepth = ILC_COLOR32; + +HIMAGELIST himlCListClc; + +static HANDLE hSettingChanged1; + +int BgStatusBarChange(WPARAM wParam,LPARAM lParam); + +int BgClcChange(WPARAM wParam,LPARAM lParam); +int OnFrameTitleBarBackgroundChange(WPARAM wParam,LPARAM lParam); + +void InitDisplayNameCache(SortedList *list); +void FreeDisplayNameCache(SortedList *list); +void LoadExtraImageFunc( void ); + +void LoadExtraImageFunc( void ); +void UnloadCLUIModule( void ); + +extern int sortByStatus; +struct ClcContact * hitcontact = NULL; + +extern LRESULT ( CALLBACK *saveContactListControlWndProc )(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); + +static int stopStatusUpdater = 0; +void StatusUpdaterThread(void*) +{ + int i,curdelay,lastcheck = 0; + HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); + + SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_LOWEST); + + while (!stopStatusUpdater) { + curdelay = DBGetContactSettingByte(hContact,"CList","StatusMsgAutoDelay",15000); + if (curdelay<5000) curdelay = 5000; + + if ((int)(GetTickCount()-lastcheck)>curdelay) + { + lastcheck = GetTickCount(); + if (DBGetContactSettingByte(hContact,"CList","StatusMsgAuto",0)) { + for (i = 0; i<5; i++) { + if (hContact != NULL) { + pdisplayNameCacheEntry pdnce = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry((HANDLE)hContact); + if (pdnce && !pdnce->protoNotExists && pdnce->szProto) + CallContactService(hContact, PSS_GETAWAYMSG, 0, 0); + + hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); + } + if (hContact == NULL) { + hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); + if (hContact == NULL) + break; + } + Sleep(500); + } + } + } + //Sleep(DBGetContactSettingByte(hContact,"CList","StatusMsgAutoDelay",100)); + Sleep(200); + } +} + +HMENU BuildGroupPopupMenu( struct ClcGroup* group ) +{ + return (HMENU)CallService(MS_CLIST_MENUBUILDSUBGROUP,(WPARAM)group,0); +} + +void SortClcByTimer (HWND hwnd) +{ + KillTimer(hwnd,TIMERID_DELAYEDRESORTCLC); + SetTimer(hwnd,TIMERID_DELAYEDRESORTCLC,DBGetContactSettingByte(NULL,"CLUI","DELAYEDTIMER",200),NULL); +} + +static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) +{ + DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; + + if ((HANDLE)wParam != NULL && !strcmp(cws->szModule,"MetaContacts") && !strcmp(cws->szSetting,"Handle")) + pcli->pfnClcBroadcast( INTM_NAMEORDERCHANGED, 0, 0 ); + + if ((HANDLE)wParam != NULL&&!strcmp(cws->szModule,"CList")) { + if ( !strcmp( cws->szSetting, "noOffline" )) + pcli->pfnClcBroadcast( INTM_NAMEORDERCHANGED, wParam, lParam ); + else if (!strcmp(cws->szSetting,"StatusMsg")) + pcli->pfnClcBroadcast( INTM_STATUSMSGCHANGED, wParam, lParam ); + } + return 0; +} + +static int ClcModulesLoaded(WPARAM wParam,LPARAM lParam) +{ + CallService(MS_BACKGROUNDCONFIG_REGISTER,(WPARAM)"StatusBar Background/StatusBar",0); + CallService(MS_BACKGROUNDCONFIG_REGISTER,(WPARAM)"List Background/CLC",0); + CallService(MS_BACKGROUNDCONFIG_REGISTER,(WPARAM)"Frames TitleBar BackGround/FrameTitleBar",0); + HookEvent(ME_BACKGROUNDCONFIG_CHANGED,BgClcChange); + HookEvent(ME_BACKGROUNDCONFIG_CHANGED,BgStatusBarChange); + HookEvent(ME_BACKGROUNDCONFIG_CHANGED,OnFrameTitleBarBackgroundChange); + return 0; +} + +static int ClcShutdown(WPARAM wParam, LPARAM lParam) +{ + UnhookEvent(hSettingChanged1); + UnloadCLUIModule(); + return 0; +} + +LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + struct ClcData *dat = (struct ClcData*)GetWindowLongPtr(hwnd,0); + if ( msg >= CLM_FIRST && msg < CLM_LAST ) + return pcli->pfnProcessExternalMessages(hwnd,dat,msg,wParam,lParam); + + switch (msg) { + case WM_CREATE: + dat = (struct ClcData*)mir_calloc( sizeof(struct ClcData)); + SetWindowLongPtr(hwnd,0,(LPARAM)dat); + InitDisplayNameCache(&dat->lCLCContactsCache); + break; + + case INTM_ICONCHANGED: + { struct ClcContact *contact = NULL; + struct ClcGroup *group = NULL; + int recalcScrollBar = 0,shouldShow; + HANDLE hSelItem = NULL; + struct ClcContact *selcontact = NULL; + pdisplayNameCacheEntry cacheEntry = GetContactFullCacheEntry((HANDLE)wParam); + + WORD status; + int needsResort = 0; + + char *szProto = cacheEntry->szProto; + if (szProto == NULL) + status = ID_STATUS_OFFLINE; + else + status = cacheEntry->status; + + shouldShow = (GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_SHOWHIDDEN || !cacheEntry->bIsHidden) && (!pcli->pfnIsHiddenMode(dat,status)||cacheEntry->noHiddenOffline || CallService(MS_CLIST_GETCONTACTICON,wParam,0) != LOWORD(lParam)); //this means an offline msg is flashing, so the contact should be shown + if (!FindItem(hwnd,dat,(HANDLE)wParam,&contact,&group,NULL)) { + if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { + if (dat->selection>=0 && GetRowByIndex(dat,dat->selection,&selcontact,NULL) != -1) + hSelItem = pcli->pfnContactToHItem(selcontact); + AddContactToTree(hwnd,dat,(HANDLE)wParam,0,0); + needsResort = 1; + recalcScrollBar = 1; + FindItem(hwnd,dat,(HANDLE)wParam,&contact,NULL,NULL); + if (contact) { + contact->iImage = (WORD)lParam; + pcli->pfnNotifyNewContact(hwnd,(HANDLE)wParam); + dat->needsResort = 1; + } + } + } + else { + //item in list already + DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE); + if (contact->iImage == (WORD)lParam) break; + if (sortByStatus) dat->needsResort = 1; + + if (!shouldShow && !(style&CLS_NOHIDEOFFLINE) && (style&CLS_HIDEOFFLINE || group->hideOffline)) { + if (dat->selection>=0 && GetRowByIndex(dat,dat->selection,&selcontact,NULL) != -1) + hSelItem = pcli->pfnContactToHItem(selcontact); + RemoveItemFromGroup(hwnd,group,contact,0); + recalcScrollBar = 1; + dat->needsResort = 1; + } + else { + int oldflags; + contact->iImage = (WORD)lParam; + oldflags = contact->flags; + if (!pcli->pfnIsHiddenMode(dat,status)||cacheEntry->noHiddenOffline) contact->flags |= CONTACTF_ONLINE; + else contact->flags &= ~CONTACTF_ONLINE; + if (oldflags != contact->flags) + dat->needsResort = 1; + } } + if (hSelItem) { + struct ClcGroup *selgroup; + if (FindItem(hwnd,dat,hSelItem,&selcontact,&selgroup,NULL)) + dat->selection = GetRowsPriorTo(&dat->list,selgroup,List_IndexOf((SortedList*)&selgroup->cl, selcontact)); + else + dat->selection = -1; + } + + SortClcByTimer(hwnd); + if (recalcScrollBar) RecalcScrollBar(hwnd,dat); + goto LBL_Exit; + } + case INTM_STATUSMSGCHANGED: + { struct ClcContact *contact = NULL; + struct ClcGroup *group = NULL; + DBVARIANT dbv; + + if (!(dat->style&CLS_SHOWSTATUSMESSAGES)) break; + if (FindItem(hwnd,dat,(HANDLE)wParam,&contact,&group,NULL) && contact != NULL) { + contact->flags &= ~CONTACTF_STATUSMSG; + if (!DBGetContactSettingTString((HANDLE)wParam, "CList", "StatusMsg", &dbv)) { + int j; + if (dbv.ptszVal == NULL||_tcslen(dbv.ptszVal) == 0) break; + lstrcpyn(contact->szStatusMsg, dbv.ptszVal, SIZEOF(contact->szStatusMsg)); + for (j = (int)_tcslen(contact->szStatusMsg)-1;j>=0;j--) { + if (contact->szStatusMsg[j] == '\r' || contact->szStatusMsg[j] == '\n' || contact->szStatusMsg[j] == '\t') { + contact->szStatusMsg[j] = ' '; + } + } + DBFreeVariant(&dbv); + if (_tcslen(contact->szStatusMsg)>0) { + contact->flags |= CONTACTF_STATUSMSG; + dat->needsResort = TRUE; + } + } + } + + InvalidateRect(hwnd,NULL,TRUE); + + SortClcByTimer(hwnd); + RecalcScrollBar(hwnd,dat); + goto LBL_Exit; + } + case WM_TIMER: + if (wParam == TIMERID_DELAYEDREPAINT) { + KillTimer(hwnd,TIMERID_DELAYEDREPAINT); + InvalidateRect(hwnd,NULL,FALSE); + break; + } + + if ( wParam == TIMERID_SUBEXPAND) { + KillTimer(hwnd,TIMERID_SUBEXPAND); + if (hitcontact) { + if (hitcontact->SubExpanded) hitcontact->SubExpanded = 0; else hitcontact->SubExpanded = 1; + DBWriteContactSettingByte(hitcontact->hContact,"CList","Expanded",hitcontact->SubExpanded); + } + hitcontact = NULL; + dat->needsResort = 1; + SortCLC(hwnd,dat,1); + RecalcScrollBar(hwnd,dat); + break; + } + break; + + case WM_DESTROY: + FreeDisplayNameCache(&dat->lCLCContactsCache); + stopStatusUpdater = 1; + break; + } + { + LRESULT res = saveContactListControlWndProc(hwnd, msg, wParam, lParam); + switch (msg) { + case WM_CREATE: + mir_forkthread(StatusUpdaterThread,0); + break; + } + return res; + } + +LBL_Exit: + return DefWindowProc(hwnd, msg, wParam, lParam); +} + +int LoadCLCModule(void) +{ + LoadCLUIFramesModule(); + LoadExtraImageFunc(); + + himlCListClc = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST,0,0); + + HookEvent(ME_SYSTEM_MODULESLOADED,ClcModulesLoaded); + hSettingChanged1 = HookEvent(ME_DB_CONTACT_SETTINGCHANGED,ClcSettingChanged); + HookEvent(ME_OPT_INITIALISE,ClcOptInit); + HookEvent(ME_SYSTEM_SHUTDOWN,ClcShutdown); + return 0; +} diff --git a/plugins/Clist_mw/src/clc.h b/plugins/Clist_mw/src/clc.h new file mode 100644 index 0000000000..29b7086d20 --- /dev/null +++ b/plugins/Clist_mw/src/clc.h @@ -0,0 +1,151 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 _CLC_H_ +#define _CLC_H_ + +#define CLB_TOPLEFT 0 +#define CLB_STRETCHV 1 +#define CLB_STRETCHH 2 //and tile vertically +#define CLB_STRETCH 3 + +#define CLBM_TYPE 0x00FF + +#define CLBF_TILEH 0x1000 +#define CLBF_TILEV 0x2000 +#define CLBF_PROPORTIONAL 0x4000 +#define CLBF_SCROLL 0x8000 +#define CLBF_TILEVTOROWHEIGHT 0x0100 + +#define FONTID_CONTACTS 0 +#define FONTID_INVIS 1 +#define FONTID_OFFLINE 2 +#define FONTID_NOTONLIST 3 +#define FONTID_GROUPS 4 +#define FONTID_GROUPCOUNTS 5 +#define FONTID_DIVIDERS 6 +#define FONTID_OFFINVIS 7 +#define FONTID_STATUSMSG 8 +#define FONTID_GROUPSCLOSED 9 +#define FONTID_CONTACTSHOVER 10 + +#define TIMERID_DELAYEDREPAINT 16 +#define TIMERID_SUBEXPAND 21 + +#define CONTACTF_STATUSMSG 64 + +#define INTM_STATUSMSGCHANGED (WM_USER+26) + +#define CLS_SHOWSTATUSMESSAGES 0x800 + +#define CLS_EX_MULTICOLUMNALIGNLEFT 0x00001000 + +#define MAXSTATUSMSGLEN 256 + +struct ClcContact : public ClcContactBase +{ + ClcContact *subcontacts; + BYTE SubAllocated; + BYTE SubExpanded; + BYTE isSubcontact; + TCHAR szStatusMsg[MAXSTATUSMSGLEN]; +}; + +struct ClcData : public ClcDataBase +{ + DWORD style; + SortedList lCLCContactsCache; + BYTE doubleClickExpand; + int MetaIgnoreEmptyExtra; +}; + +//clcidents.c +int GetRowsPriorTo(struct ClcGroup *group,struct ClcGroup *subgroup,int contactIndex); +int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **contact,struct ClcGroup **subgroup,int *isVisible); +int GetRowByIndex(struct ClcData *dat,int testindex,struct ClcContact **contact,struct ClcGroup **subgroup); +void ClearRowByIndexCache(); + +//clcitems.c +struct ClcGroup *AddGroup(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flags,int groupId,int calcTotalMembers); +void FreeGroup(struct ClcGroup *group); +int AddInfoItemToGroup(struct ClcGroup *group,int flags,const TCHAR *pszText); +void FreeContact(struct ClcContact *p); +void RebuildEntireList(HWND hwnd,struct ClcData *dat); +struct ClcGroup *RemoveItemFromGroup(HWND hwnd,struct ClcGroup *group,struct ClcContact *contact,int updateTotalCount); +void DeleteItemFromTree(HWND hwnd,HANDLE hItem); +void AddContactToTree(HWND hwnd,struct ClcData *dat,HANDLE hContact,int updateTotalCount,int checkHideOffline); +void SortCLC(HWND hwnd,struct ClcData *dat,int useInsertionSort); +int GetGroupContentsCount(struct ClcGroup *group,int visibleOnly); +int GetNewSelection(struct ClcGroup *group,int selection, int direction); +void SaveStateAndRebuildList(HWND hwnd,struct ClcData *dat); + +//clcmsgs.c +LRESULT ProcessExternalMessages(HWND hwnd,struct ClcData *dat,UINT msg,WPARAM wParam,LPARAM lParam); + +//clcutils.c +void RecalcScrollBar(HWND hwnd,struct ClcData *dat); +void BeginRenameSelection(HWND hwnd,struct ClcData *dat); +int HitTest(HWND hwnd,struct ClcData *dat,int testx,int testy,struct ClcContact **contact,struct ClcGroup **group,DWORD *flags); +void ScrollTo(HWND hwnd,struct ClcData *dat,int desty,int noSmooth); +void LoadClcOptions(HWND hwnd,struct ClcData *dat); + +//clcpaint.c +void PaintClc(HWND hwnd,struct ClcData *dat,HDC hdc,RECT *rcPaint); + +//clcopts.c +int ClcOptInit(WPARAM wParam,LPARAM lParam); + +//clcfiledrop.c +void InitFileDropping(void); +void FreeFileDropping(void); +void RegisterFileDropping(HWND hwnd); +void UnregisterFileDropping(HWND hwnd); + +//cluiservices.c +void FreeProtocolData( void ); + +int GetContactCachedStatus(HANDLE hContact); +char *GetContactCachedProtocol(HANDLE hContact); + +#define CLUI_SetDrawerService "CLUI/SETDRAWERSERVICE" +typedef struct { + int cbSize; + char *PluginName; + char *Comments; + char *GetDrawFuncsServiceName; + +} DrawerServiceStruct,*pDrawerServiceStruct ; + +#define CLUI_EXT_FUNC_PAINTCLC 1 + +typedef struct { + int cbSize; + void (*PaintClc)(HWND,struct ClcData *,HDC,RECT *,int ,ClcProtoStatus *,HIMAGELIST); +} ExternDrawer,*pExternDrawer ; + +extern ExternDrawer SED; + +#define CLM_SETEXTRACOLUMNSSPACE (CLM_FIRST+73) //wParam = extra space between icons + +void FreeAndNil( void** p ); + +#endif /* _CLC_H_ */ diff --git a/plugins/Clist_mw/src/clcfonts.cpp b/plugins/Clist_mw/src/clcfonts.cpp new file mode 100644 index 0000000000..1ad20dc2b0 --- /dev/null +++ b/plugins/Clist_mw/src/clcfonts.cpp @@ -0,0 +1,136 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2010 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 "commonheaders.h" + + +static const TCHAR *szClistFontIdDescr[FONTID_MAX+1] = +{ + LPGENT( "Standard contacts"), + LPGENT( "Online contacts to whom you have a different visibility"), + LPGENT( "Offline contacts"), + LPGENT( "Contacts which are 'not on list'"), + LPGENT( "Groups"), + LPGENT( "Group member counts"), + LPGENT( "Dividers"), + LPGENT( "Offline contacts to whom you have a different visibility"), + LPGENT( "Status messages"), + LPGENT( "Group Closed"), + LPGENT( "Hover Contacts") +}; + +static int fontListOrder[FONTID_MAX + 1] = +{ + FONTID_CONTACTS, + FONTID_INVIS, + FONTID_OFFLINE, + FONTID_NOTONLIST, + FONTID_GROUPS, + FONTID_GROUPCOUNTS, + FONTID_DIVIDERS, + FONTID_OFFINVIS, + FONTID_STATUSMSG, + FONTID_GROUPSCLOSED, + FONTID_CONTACTSHOVER +}; + +#define CLCDEFAULT_BKCOLOUR GetSysColor(COLOR_3DFACE) +#define CLCDEFAULT_SELTEXTCOLOUR GetSysColor(COLOR_HIGHLIGHTTEXT) + +static int FS_FontsChanged(WPARAM wParam, LPARAM lParam) +{ + pcli->pfnClcOptionsChanged(); + return 0; +} + +void RegisterCListFonts() +{ + FontIDT fontid = {0}; + ColourIDT colourid = {0}; + char idstr[10]; + int i; + + fontid.cbSize = sizeof(FontIDT); + fontid.flags = FIDF_ALLOWREREGISTER | FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS; + + for (i = 0; i <= FONTID_MAX; i++) { + switch (fontListOrder[i]) { + case FONTID_GROUPS: + case FONTID_GROUPCOUNTS: + fontid.flags &= ~FIDF_CLASSMASK; + fontid.flags |= FIDF_CLASSHEADER; + break; + + case FONTID_DIVIDERS: + fontid.flags &= ~FIDF_CLASSMASK; + fontid.flags |= FIDF_CLASSSMALL; + break; + + default: + fontid.flags &= ~FIDF_CLASSMASK; + fontid.flags |= FIDF_CLASSGENERAL; + break; + } + + if (fontListOrder[i] != 0 || i == 0) { + strncpy(fontid.dbSettingsGroup, "CLC", sizeof(fontid.dbSettingsGroup)); + _tcsncpy(fontid.group, _T("Contact List"), SIZEOF(fontid.group)); + _tcsncpy(fontid.name, szClistFontIdDescr[fontListOrder[i]], SIZEOF(fontid.name)); + sprintf(idstr, "Font%d", fontListOrder[i]); + strncpy(fontid.prefix, idstr, SIZEOF(fontid.prefix)); + fontid.order = fontListOrder[i]; + FontRegisterT(&fontid); + } + } + + // and colours + colourid.cbSize = sizeof(ColourIDT); + colourid.order = 0; + strncpy(colourid.dbSettingsGroup, "CLC", sizeof(colourid.dbSettingsGroup)); + + strncpy(colourid.setting, "BkColour", sizeof(colourid.setting)); + _tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name)); + _tcsncpy(colourid.group, LPGENT("Contact List"), SIZEOF(colourid.group)); + colourid.defcolour = CLCDEFAULT_BKCOLOUR; + ColourRegisterT(&colourid); + + strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting)); + _tcsncpy(colourid.name, LPGENT("Selected Text"), SIZEOF(colourid.name)); + colourid.order = 1; + colourid.defcolour = CLCDEFAULT_SELTEXTCOLOUR; + ColourRegisterT(&colourid); + + strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting)); + _tcsncpy(colourid.name, LPGENT("Hottrack Text"), SIZEOF(colourid.name)); + colourid.order = 1; + colourid.defcolour = CLCDEFAULT_HOTTEXTCOLOUR; + ColourRegisterT(&colourid); + + strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting)); + _tcsncpy(colourid.name, LPGENT("Quicksearch Text"), SIZEOF(colourid.name)); + colourid.order = 1; + colourid.defcolour = CLCDEFAULT_QUICKSEARCHCOLOUR; + ColourRegisterT(&colourid); + + HookEvent(ME_FONT_RELOAD, FS_FontsChanged); +} diff --git a/plugins/Clist_mw/src/clcidents.cpp b/plugins/Clist_mw/src/clcidents.cpp new file mode 100644 index 0000000000..58517fa8c0 --- /dev/null +++ b/plugins/Clist_mw/src/clcidents.cpp @@ -0,0 +1,303 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 "commonheaders.h" +#include "m_clc.h" +#include "clc.h" + +/* the CLC uses 3 different ways to identify elements in its list, this file +contains routines to convert between them. + +1) struct ClcContact/struct ClcGroup pair. Only ever used within the duration +of a single operation, but used at some point in nearly everything +2) index integer. The 0-based number of the item from the top. Only visible +items are counted (ie not closed groups). Used for saving selection and drag +highlight +3) hItem handle. Either the hContact or (hGroup|HCONTACT_ISGROUP). Used +exclusively externally + +1->2: GetRowsPriorTo() +1->3: ContactToHItem() +3->1: FindItem() +2->1: GetRowByIndex() +*/ + +int GetRowsPriorTo(struct ClcGroup *group,struct ClcGroup *subgroup,int contactIndex) +{ + int count = 0; + + group->scanIndex = 0; + for (;;) { + if (group->scanIndex == group->cl.count) { + group = group->parent; + if (group == NULL) + break; + group->scanIndex++; + continue; + } + + if (group == subgroup && contactIndex == group->scanIndex) + return count; + + count++; + if ((group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) && (group->cl.items[group->scanIndex]->flags & CONTACTF_STATUSMSG)) + count++; + + if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { + if (group->cl.items[group->scanIndex]->group == subgroup && contactIndex == -1) + return count-1; + if (group->cl.items[group->scanIndex]->group->expanded) { + group = group->cl.items[group->scanIndex]->group; + group->scanIndex = 0; + continue; + } + } + + if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) + count += group->cl.items[group->scanIndex]->SubAllocated*group->cl.items[group->scanIndex]->SubExpanded; + + group->scanIndex++; + } + return -1; +} + +pdisplayNameCacheEntry GetCLCFullCacheEntry(struct ClcData *dat,HANDLE hContact) +{ + if (hContact == 0) + return NULL; + + displayNameCacheEntry dnce; + dnce.hContact = hContact; + displayNameCacheEntry *pdnce = (displayNameCacheEntry*)List_Find(&dat->lCLCContactsCache,&dnce); + if (pdnce == NULL) { + pdnce = (displayNameCacheEntry*)mir_calloc(sizeof(displayNameCacheEntry)); + pdnce->hContact = hContact; + + int idx; + List_GetIndex(&dat->lCLCContactsCache,pdnce,&idx); + List_Insert(&dat->lCLCContactsCache,pdnce,idx); + + displayNameCacheEntry *pdnce2 = (displayNameCacheEntry*)List_Find(&dat->lCLCContactsCache,&dnce);//for check + if (pdnce2->hContact != pdnce->hContact) + return NULL; + + if (pdnce2 != pdnce) + return NULL; + } + + return (pdnce); +} + +void ClearClcContactCache(struct ClcData *dat,HANDLE hContact) +{ + pdisplayNameCacheEntry cacheEntry; + + if (hContact == INVALID_HANDLE_VALUE) { + int i,tick; + tick = GetTickCount(); + + for (i = 0;i<(dat->lCLCContactsCache.realCount);i++) { + pdisplayNameCacheEntry pdnce = (pdisplayNameCacheEntry)dat->lCLCContactsCache.items[i]; + pdnce->ClcContact = NULL; + } + tick = GetTickCount()-tick; + { + char buf[256]; + sprintf (buf,"Clear full cache %d ms\r\n",tick); + OutputDebugStringA(buf); + } + } + if ( !IsHContactGroup(hContact) && !IsHContactInfo(hContact)) { + cacheEntry = GetCLCFullCacheEntry(dat,hContact); + if (cacheEntry != NULL) + cacheEntry->ClcContact = NULL; + } +} + +void SetClcContactCacheItem(struct ClcData *dat,HANDLE hContact,void *contact) +{ + pdisplayNameCacheEntry cacheEntry; + if ( !IsHContactGroup(hContact) && !IsHContactInfo(hContact)) { + cacheEntry = GetCLCFullCacheEntry(dat,hContact); + if (cacheEntry != NULL) + cacheEntry->ClcContact = contact; + } +} + +int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **contact,struct ClcGroup **subgroup,int *isVisible) +{ + int index = 0, i; + int nowVisible = 1; + struct ClcGroup *group = &dat->list; + + group->scanIndex = 0; + + if (isVisible == NULL && hItem != NULL && subgroup == NULL && !IsHContactGroup(hItem) && !IsHContactInfo(hItem)) { + //try use cache + pdisplayNameCacheEntry cacheEntry; + cacheEntry = GetCLCFullCacheEntry(dat,hItem); + if (cacheEntry != NULL) { + if (cacheEntry->ClcContact == NULL) { + int *isv = {0}; + void *z = {0}; + int ret; + ret = FindItem(hwnd,dat,hItem,(struct ClcContact ** )&z,(struct ClcGroup** )&isv,NULL); + if (ret = 0) {return 0;} + cacheEntry->ClcContact = (void *)z; + } + + if (cacheEntry->ClcContact != NULL) { + if (contact != NULL) + *contact = (struct ClcContact *)cacheEntry->ClcContact; + + return 1; + } + } + } + + group = &dat->list; + + for (;;) { + if (group->scanIndex == group->cl.count) { + struct ClcGroup *tgroup; + group = group->parent; + if (group == NULL) + break; + + nowVisible = 1; + for (tgroup = group;tgroup;tgroup = tgroup->parent) + if (!group->expanded) { + nowVisible = 0; + break; + } + + group->scanIndex++; + continue; + } + if (nowVisible) index++; + if ((IsHContactGroup(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ((UINT_PTR)hItem&~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) || + (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->hContact == hItem) || + (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == (HANDLE)((UINT_PTR)hItem&~HCONTACT_ISINFO))) { + if (isVisible) { + if (!nowVisible) *isVisible = 0; + else { + if ((index+1)*dat->rowHeightyScroll) *isVisible = 0; + else { + RECT clRect; + GetClientRect(hwnd,&clRect); + if (index*dat->rowHeight>=dat->yScroll+clRect.bottom) *isVisible = 0; + else *isVisible = 1; + } } } + + if (contact) *contact = group->cl.items[group->scanIndex]; + if (subgroup) *subgroup = group; + return 1; + } + + if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && + group->cl.items[group->scanIndex]->SubAllocated>0) + for (i = 1; i<=group->cl.items[group->scanIndex]->SubAllocated; i++) + if (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->subcontacts[i-1].hContact == hItem) { + if (contact) *contact = &group->cl.items[group->scanIndex]->subcontacts[i-1]; + if (subgroup) *subgroup = group; + return 1; + } + + if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { + struct ClcGroup* save = group; + group = group->cl.items[group->scanIndex]->group; + group->scanIndex = 0; + nowVisible &= group->expanded; + continue; + } + group->scanIndex++; + } + return 0; +} +#define CacheArrSize 255 +struct ClcGroup *CacheIndex[CacheArrSize] = {NULL}; +boolean CacheIndexClear = TRUE; +void ClearRowByIndexCache() +{ + if (!CacheIndexClear) { + memset(CacheIndex,0,sizeof(CacheIndex)); + CacheIndexClear = TRUE; + } +} + +int GetRowByIndex(struct ClcData *dat,int testindex,struct ClcContact **contact,struct ClcGroup **subgroup) +{ + int index = 0,i; + struct ClcGroup *group = &dat->list; + + if (testindex < 0) return -1; + + group->scanIndex = 0; + for (;;) { + if (group->scanIndex == group->cl.count) { + group = group->parent; + if (group == NULL) break; + group->scanIndex++; + continue; + } + if ((index>0) && (indexcl.items[group->scanIndex]; + if (subgroup) *subgroup = group; + return index; + } + + if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) + if (group->cl.items[group->scanIndex]->SubAllocated) + if (group->cl.items[group->scanIndex]->SubExpanded) { + for (i = 0;icl.items[group->scanIndex]->SubAllocated;i++) { + if ((index>0) && (indexcl.items[group->scanIndex]->subcontacts[i]; + if (subgroup) *subgroup = group; + return index; + } + } + } + + index++; + if ((group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) && (group->cl.items[group->scanIndex]->flags & CONTACTF_STATUSMSG)) + index++; + + if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && group->cl.items[group->scanIndex]->group->expanded) { + group = group->cl.items[group->scanIndex]->group; + group->scanIndex = 0; + continue; + } + group->scanIndex++; + } + return -1; +} diff --git a/plugins/Clist_mw/src/clcitems.cpp b/plugins/Clist_mw/src/clcitems.cpp new file mode 100644 index 0000000000..788cc8f3fd --- /dev/null +++ b/plugins/Clist_mw/src/clcitems.cpp @@ -0,0 +1,693 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 "commonheaders.h" +#include "m_clc.h" +#include "clc.h" +#include "clist.h" +#include "m_metacontacts.h" + + +extern int ( *saveAddItemToGroup )( struct ClcGroup *group, int iAboveItem ); +extern int ( *saveAddInfoItemToGroup )(struct ClcGroup *group,int flags,const TCHAR *pszText); +extern struct ClcGroup* ( *saveAddGroup )(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flags,int groupId,int calcTotalMembers); +extern void (*saveFreeContact)(struct ClcContact *p); +extern void (*saveFreeGroup)(struct ClcGroup *p); + +//routines for managing adding/removal of items in the list, including sorting + +extern void ClearClcContactCache(struct ClcData *dat,HANDLE hContact); + +void AddSubcontacts(struct ClcContact * cont) +{ + int subcount,i,j; + HANDLE hsub; + pdisplayNameCacheEntry cacheEntry; + cacheEntry = GetContactFullCacheEntry(cont->hContact); + OutputDebugStringA("Proceed AddSubcontacts\r\n"); + subcount = (int)CallService(MS_MC_GETNUMCONTACTS,(WPARAM)cont->hContact,0); + cont->SubExpanded = DBGetContactSettingByte(cont->hContact,"CList","Expanded",0); + cont->isSubcontact = 0; + cont->subcontacts = (struct ClcContact *) mir_realloc(cont->subcontacts, sizeof(struct ClcContact)*subcount); + cont->SubAllocated = subcount; + i = 0; + for (j = 0; jhContact,j); + cacheEntry = GetContactFullCacheEntry(hsub); + if (!(DBGetContactSettingByte(NULL,"CLC","MetaHideOfflineSub",1) && DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT))|| + cacheEntry->status != ID_STATUS_OFFLINE ) + { + cont->subcontacts[i].hContact = cacheEntry->hContact; + cont->subcontacts[i].iImage = CallService(MS_CLIST_GETCONTACTICON,(WPARAM)cacheEntry->hContact,0); + memset(cont->subcontacts[i].iExtraImage,0xFF,SIZEOF(cont->subcontacts[i].iExtraImage)); + cont->subcontacts[i].proto = cacheEntry->szProto; + lstrcpyn(cont->subcontacts[i].szText,cacheEntry->tszName,SIZEOF(cont->subcontacts[i].szText)); + cont->subcontacts[i].type = CLCIT_CONTACT; + //cont->flags = 0;//CONTACTF_ONLINE; + cont->subcontacts[i].isSubcontact = 1; + i++; + } + } + cont->SubAllocated = i; + if (!i) mir_free(cont->subcontacts); +} + +void FreeContact(struct ClcContact *p) +{ + if ( p->SubAllocated && !p->isSubcontact) + mir_free(p->subcontacts); + + saveFreeContact( p ); +} + +int AddItemToGroup(struct ClcGroup *group,int iAboveItem) +{ + iAboveItem = saveAddItemToGroup( group, iAboveItem ); + ClearRowByIndexCache(); + return iAboveItem; +} + +struct ClcGroup *AddGroup(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flags,int groupId,int calcTotalMembers) +{ + struct ClcGroup* result; + + ClearRowByIndexCache(); + dat->needsResort = 1; + result = saveAddGroup( hwnd, dat, szName, flags, groupId, calcTotalMembers); + ClearRowByIndexCache(); + return result; +} + +void FreeGroup(struct ClcGroup *group) +{ + saveFreeGroup( group ); + ClearRowByIndexCache(); +} + +int AddInfoItemToGroup(struct ClcGroup *group,int flags,const TCHAR *pszText) +{ + int i = saveAddInfoItemToGroup( group, flags, pszText ); + ClearRowByIndexCache(); + return i; +} + +static struct ClcContact * AddContactToGroup(struct ClcData *dat,struct ClcGroup *group,pdisplayNameCacheEntry cacheEntry) +{ + char *szProto; + WORD apparentMode; + DWORD idleMode; + HANDLE hContact; + DBVARIANT dbv; + int i; + char AdvancedService[255] = {0}; + int img = -1; + int basicIcon = 0; + + if (cacheEntry == NULL || group == NULL || dat == NULL) + return NULL; + + hContact = cacheEntry->hContact; + + dat->needsResort = 1; + for (i = group->cl.count-1;i>=0;i--) + if (group->cl.items[i]->type != CLCIT_INFO || !(group->cl.items[i]->flags&CLCIIF_BELOWCONTACTS)) break; + i = AddItemToGroup(group,i+1); + group->cl.items[i]->type = CLCIT_CONTACT; + group->cl.items[i]->SubAllocated = 0; + group->cl.items[i]->isSubcontact = 0; + group->cl.items[i]->subcontacts = NULL; + + _snprintf(AdvancedService,sizeof(AdvancedService),"%s%s",cacheEntry->szProto,"/GetAdvancedStatusIcon"); + + if (ServiceExists(AdvancedService)) + img = CallService(AdvancedService,(WPARAM)hContact, (LPARAM)0); + + if (img == -1 || !(LOWORD(img))) + img = CallService(MS_CLIST_GETCONTACTICON,(WPARAM)hContact,0); + + group->cl.items[i]->iImage = img; + + cacheEntry = GetContactFullCacheEntry(hContact); + group->cl.items[i]->hContact = hContact; + + //cacheEntry->ClcContact = &(group->cl.items[i]); + //SetClcContactCacheItem(dat,hContact,&(group->cl.items[i])); + + szProto = cacheEntry->szProto; + if (szProto != NULL&&!pcli->pfnIsHiddenMode(dat,cacheEntry->status)) + group->cl.items[i]->flags |= CONTACTF_ONLINE; + apparentMode = szProto != NULL?cacheEntry->ApparentMode:0; + if (apparentMode == ID_STATUS_OFFLINE) group->cl.items[i]->flags |= CONTACTF_INVISTO; + else if (apparentMode == ID_STATUS_ONLINE) group->cl.items[i]->flags |= CONTACTF_VISTO; + else if (apparentMode) group->cl.items[i]->flags |= CONTACTF_VISTO|CONTACTF_INVISTO; + if (cacheEntry->NotOnList) group->cl.items[i]->flags |= CONTACTF_NOTONLIST; + idleMode = szProto != NULL?cacheEntry->IdleTS:0; + if (idleMode) group->cl.items[i]->flags |= CONTACTF_IDLE; + + lstrcpyn(group->cl.items[i]->szText,cacheEntry->tszName, SIZEOF(group->cl.items[i]->szText)); + group->cl.items[i]->proto = szProto; + + if (dat->style & CLS_SHOWSTATUSMESSAGES) { + if (!DBGetContactSettingTString(hContact, "CList", "StatusMsg", &dbv)) { + int j; + lstrcpyn(group->cl.items[i]->szStatusMsg, dbv.ptszVal, SIZEOF(group->cl.items[i]->szStatusMsg)); + for (j = (int)_tcslen(group->cl.items[i]->szStatusMsg)-1;j>=0;j--) { + if (group->cl.items[i]->szStatusMsg[j] == '\r' || group->cl.items[i]->szStatusMsg[j] == '\n' || group->cl.items[i]->szStatusMsg[j] == '\t') { + group->cl.items[i]->szStatusMsg[j] = ' '; + } + } + DBFreeVariant(&dbv); + if (_tcslen(group->cl.items[i]->szStatusMsg)>0) { + group->cl.items[i]->flags |= CONTACTF_STATUSMSG; + } + } + } + + ClearRowByIndexCache(); + return group->cl.items[i]; +} + +void AddContactToTree(HWND hwnd,struct ClcData *dat,HANDLE hContact,int updateTotalCount,int checkHideOffline) +{ + if (FindItem(hwnd,dat,hContact,NULL,NULL,NULL) == 1) + return; + + pdisplayNameCacheEntry cacheEntry = GetContactFullCacheEntry(hContact); + if (cacheEntry == NULL) + return; + + char *szProto = cacheEntry->szProto; + + dat->needsResort = 1; + ClearRowByIndexCache(); + ClearClcContactCache(dat,hContact); + + WORD status; + DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE); + if (style & CLS_NOHIDEOFFLINE) checkHideOffline = 0; + if (checkHideOffline) { + if (szProto == NULL) status = ID_STATUS_OFFLINE; + else status = cacheEntry->status; + } + + ClcGroup *group; + if (lstrlen(cacheEntry->tszGroup) == 0) + group = &dat->list; + else { + group = AddGroup(hwnd,dat,cacheEntry->tszGroup,(DWORD)-1,0,0); + if (group == NULL) { + DWORD groupFlags; + int i; + if ( !(style & CLS_HIDEEMPTYGROUPS)) + return; + + if (checkHideOffline && pcli->pfnIsHiddenMode(dat,status)) { + for (i = 1;;i++) { + TCHAR *szGroupName = pcli->pfnGetGroupName(i, &groupFlags); + if (szGroupName == NULL) + return; //never happens + if ( !lstrcmp(szGroupName,cacheEntry->tszGroup)) + break; + } + if (groupFlags & GROUPF_HIDEOFFLINE) + return; + } + for (i = 1;; i++) { + TCHAR *szGroupName = pcli->pfnGetGroupName(i, &groupFlags); + if (szGroupName == NULL) + return; //never happens + if (!lstrcmp(szGroupName,cacheEntry->tszGroup)) + break; + size_t len = lstrlen(szGroupName); + if (!_tcsncmp(szGroupName,cacheEntry->tszGroup,len) && cacheEntry->tszGroup[len] == '\\') + AddGroup(hwnd,dat,szGroupName,groupFlags,i,1); + } + group = AddGroup(hwnd,dat,cacheEntry->tszGroup,groupFlags,i,1); + } + } + + if (checkHideOffline) { + if (pcli->pfnIsHiddenMode(dat,status) && (style&CLS_HIDEOFFLINE || group->hideOffline)) { + if (updateTotalCount) group->totalMembers++; + return; + } + } + ClcContact *cont = AddContactToGroup(dat,group,cacheEntry); + if (cont && cont->proto) { + cont->SubAllocated = 0; + if (strcmp(cont->proto,"MetaContacts") == 0) + AddSubcontacts(cont); + } + if (updateTotalCount) + group->totalMembers++; + ClearRowByIndexCache(); +} + +extern struct ClcGroup* ( *saveRemoveItemFromGroup )(HWND hwnd,struct ClcGroup *group,struct ClcContact *contact,int updateTotalCount); + +struct ClcGroup *RemoveItemFromGroup(HWND hwnd,struct ClcGroup *group,struct ClcContact *contact,int updateTotalCount) +{ + ClearRowByIndexCache(); + if (contact->type == CLCIT_CONTACT) { + struct ClcData* dat = (struct ClcData*)GetWindowLongPtr(hwnd,0); + ClearClcContactCache(dat,contact->hContact); + } + + group = saveRemoveItemFromGroup(hwnd, group, contact, updateTotalCount); + + ClearRowByIndexCache(); + return group; +} + +void DeleteItemFromTree(HWND hwnd,HANDLE hItem) +{ + struct ClcContact *contact; + struct ClcGroup *group; + struct ClcData *dat = (struct ClcData*)GetWindowLongPtr(hwnd,0); + + ClearRowByIndexCache(); + dat->needsResort = 1; + + if (!FindItem(hwnd,dat,hItem,&contact,&group,NULL)) { + DBVARIANT dbv; + int i,nameOffset; + if (!IsHContactContact(hItem)) return; + ClearClcContactCache(dat,hItem); + + if (DBGetContactSettingTString(hItem,"CList","Group",&dbv)) return; + + //decrease member counts of all parent groups too + group = &dat->list; + nameOffset = 0; + for (i = 0;;i++) { + if (group->scanIndex == group->cl.count) + break; + + if (group->cl.items[i]->type == CLCIT_GROUP) { + int len = lstrlen(group->cl.items[i]->szText); + if (!_tcsncmp(group->cl.items[i]->szText,dbv.ptszVal+nameOffset,len) && (dbv.ptszVal[nameOffset+len] == '\\' || dbv.pszVal[nameOffset+len] == '\0')) { + group->totalMembers--; + if (dbv.pszVal[nameOffset+len] == '\0') + break; + } + } + } + mir_free(dbv.pszVal); + } + else RemoveItemFromGroup(hwnd,group,contact,1); + + ClearRowByIndexCache(); +} + + + +void RebuildEntireList(HWND hwnd,struct ClcData *dat) +{ +// char *szProto; + DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE); + HANDLE hContact; + struct ClcContact * cont; + struct ClcGroup *group; + //DBVARIANT dbv; + int tick = GetTickCount(); + + ClearRowByIndexCache(); + ClearClcContactCache(dat,INVALID_HANDLE_VALUE); + + dat->list.expanded = 1; + dat->list.hideOffline = DBGetContactSettingByte(NULL,"CLC","HideOfflineRoot",0); + memset( &dat->list.cl, 0, sizeof( dat->list.cl )); + dat->list.cl.increment = 30; + dat->needsResort = 1; + dat->selection = -1; + { + int i; + TCHAR *szGroupName; + DWORD groupFlags; + + for (i = 1;;i++) { + szGroupName = pcli->pfnGetGroupName(i,&groupFlags); + if (szGroupName == NULL) + break; + + AddGroup(hwnd,dat,szGroupName,groupFlags,i,0); + } + } + + hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); + while(hContact) { + + pdisplayNameCacheEntry cacheEntry; + cont = NULL; + cacheEntry = GetContactFullCacheEntry(hContact); + //cacheEntry->ClcContact = NULL; + ClearClcContactCache(dat,hContact); + if (cacheEntry == NULL) + MessageBoxA(0,"Fail To Get CacheEntry for hContact","!!!!!!!!",0); + + if (style&CLS_SHOWHIDDEN || !cacheEntry->bIsHidden) { + if (lstrlen(cacheEntry->tszGroup) == 0) + group = &dat->list; + else { + group = AddGroup(hwnd,dat,cacheEntry->tszGroup,(DWORD)-1,0,0); + //mir_free(dbv.pszVal); + } + + if (group != NULL) { + group->totalMembers++; + if (!(style&CLS_NOHIDEOFFLINE) && (style&CLS_HIDEOFFLINE || group->hideOffline)) { + //szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); + if (cacheEntry->szProto == NULL) { + if (!pcli->pfnIsHiddenMode(dat,ID_STATUS_OFFLINE)||cacheEntry->noHiddenOffline) + cont = AddContactToGroup(dat,group,cacheEntry); + } + else + if (!pcli->pfnIsHiddenMode(dat,cacheEntry->status)||cacheEntry->noHiddenOffline) + cont = AddContactToGroup(dat,group,cacheEntry); + } + else cont = AddContactToGroup(dat,group,cacheEntry); + } + } + if (cont && cont->proto) { + cont->SubAllocated = 0; + if (strcmp(cont->proto,"MetaContacts") == 0) + AddSubcontacts(cont); + } + hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0); + } + + if (style&CLS_HIDEEMPTYGROUPS) { + group = &dat->list; + group->scanIndex = 0; + for (;;) { + if (group->scanIndex == group->cl.count) { + group = group->parent; + if (group == NULL) + break; + } + else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { + if (group->cl.items[group->scanIndex]->group->cl.count == 0) { + group = RemoveItemFromGroup(hwnd,group,group->cl.items[group->scanIndex],0); + } + else { + group = group->cl.items[group->scanIndex]->group; + group->scanIndex = 0; + } + continue; + } + group->scanIndex++; + } + } + + SortCLC(hwnd,dat,0); + tick = GetTickCount()-tick; + { + char buf[255]; + //sprintf(buf,"%s %s took %i ms",__FILE__,__LINE__,tick); + sprintf(buf,"RebuildEntireList %d \r\n",tick); + + OutputDebugStringA(buf); + DBWriteContactSettingDword((HANDLE)0,"CLUI","PF:Last RebuildEntireList Time:",tick); + } +} + + +int GetNewSelection(struct ClcGroup *group, int selection, int direction) +{ + int lastcount = 0, count = 0;//group->cl.count; + struct ClcGroup *topgroup = group; + if (selection<0) { + return 0; + } + group->scanIndex = 0; + for (;;) { + if (group->scanIndex == group->cl.count) { + group = group->parent; + if (group == NULL) + break; + + group->scanIndex++; + continue; + } + if (count>=selection) return count; + lastcount = count; + count++; + if ((group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) && (group->cl.items[group->scanIndex]->flags & CONTACTF_STATUSMSG)) { + count++; + } + if (!direction) { + if (count>selection) return lastcount; + } + if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (group->cl.items[group->scanIndex]->group->expanded)) { + group = group->cl.items[group->scanIndex]->group; + group->scanIndex = 0; + continue; + } + group->scanIndex++; + } + return lastcount; + } + +int GetGroupContentsCount(struct ClcGroup *group,int visibleOnly) +{ + int count = 0;//group->cl.count; + struct ClcGroup *topgroup = group; + + group->scanIndex = 0; + for (;;) { + if (group->scanIndex == group->cl.count) { + if (group == topgroup) break; + group = group->parent; + group->scanIndex++; + continue; + } + + count++; + if ((group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) && (group->cl.items[group->scanIndex]->flags & CONTACTF_STATUSMSG)) + count++; + + if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (!visibleOnly || group->cl.items[group->scanIndex]->group->expanded)) { + group = group->cl.items[group->scanIndex]->group; + group->scanIndex = 0; + continue; + } + group->scanIndex++; + } + return count; +} + +extern void ( *saveSortCLC )(HWND hwnd,struct ClcData *dat,int useInsertionSort); + +void SortCLC(HWND hwnd,struct ClcData *dat,int useInsertionSort) +{ +#ifdef _DEBUG + DWORD tick = GetTickCount(); +#endif + int oldSort = dat->needsResort; + saveSortCLC(hwnd, dat, useInsertionSort); + if ( oldSort ) + ClearRowByIndexCache(); + +#ifdef _DEBUG + { + char buf[255]; + //sprintf(buf,"%s %s took %i ms",__FILE__,__LINE__,tick); + tick = GetTickCount()-tick; + if (tick > 5) { + sprintf(buf,"SortCLC %d \r\n",tick); + OutputDebugStringA(buf); + DBWriteContactSettingDword((HANDLE)0,"CLUI","PF:Last SortCLC Time:",tick); + } + } +#endif +} + +struct SavedContactState_t +{ + HANDLE hContact; + BYTE iExtraImage[MAXEXTRACOLUMNS]; + int checked; +}; + +struct SavedGroupState_t +{ + int groupId, expanded; +}; + +struct SavedInfoState_t +{ + int parentId; + struct ClcContact contact; +}; + +void SaveStateAndRebuildList(HWND hwnd,struct ClcData *dat) +{ + NMCLISTCONTROL nm; + int i,j; + struct SavedGroupState_t *savedGroup = NULL; + int savedGroupCount = 0,savedGroupAlloced = 0; + struct SavedContactState_t *savedContact = NULL; + int savedContactCount = 0,savedContactAlloced = 0; + struct SavedInfoState_t *savedInfo = NULL; + int savedInfoCount = 0,savedInfoAlloced = 0; + struct ClcGroup *group; + struct ClcContact *contact; + + int tick = GetTickCount(); + int allocstep = 1024; + pcli->pfnHideInfoTip(hwnd,dat); + KillTimer(hwnd,TIMERID_INFOTIP); + KillTimer(hwnd,TIMERID_RENAME); + pcli->pfnEndRename(hwnd,dat,1); + + group = &dat->list; + group->scanIndex = 0; + for (;;) { + if (group->scanIndex == group->cl.count) { + group = group->parent; + if (group == NULL) + break; + } + else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { + group = group->cl.items[group->scanIndex]->group; + group->scanIndex = 0; + if (++savedGroupCount>savedGroupAlloced) { + savedGroupAlloced += allocstep; + savedGroup = (struct SavedGroupState_t*)mir_realloc(savedGroup,sizeof(struct SavedGroupState_t)*savedGroupAlloced); + } + savedGroup[savedGroupCount-1].groupId = group->groupId; + savedGroup[savedGroupCount-1].expanded = group->expanded; + continue; + } + else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) { + if (++savedContactCount>savedContactAlloced) { + savedContactAlloced += allocstep; + savedContact = (struct SavedContactState_t*)mir_realloc(savedContact,sizeof(struct SavedContactState_t)*savedContactAlloced); + } + savedContact[savedContactCount-1].hContact = group->cl.items[group->scanIndex]->hContact; + CopyMemory(savedContact[savedContactCount-1].iExtraImage, group->cl.items[group->scanIndex]->iExtraImage, MAXEXTRACOLUMNS); + savedContact[savedContactCount-1].checked = group->cl.items[group->scanIndex]->flags & CONTACTF_CHECKED; + if (group->cl.items[group->scanIndex]->SubAllocated>0) + { + int l; + for (l = 0; lcl.items[group->scanIndex]->SubAllocated; l++) + { + if (++savedContactCount>savedContactAlloced) { + savedContactAlloced += allocstep; + savedContact = (struct SavedContactState_t*)mir_realloc(savedContact,sizeof(struct SavedContactState_t)*savedContactAlloced); + } + savedContact[savedContactCount-1].hContact = group->cl.items[group->scanIndex]->subcontacts[l].hContact; + CopyMemory(savedContact[savedContactCount-1].iExtraImage ,group->cl.items[group->scanIndex]->subcontacts[l].iExtraImage,MAXEXTRACOLUMNS); + savedContact[savedContactCount-1].checked = group->cl.items[group->scanIndex]->subcontacts[l].flags&CONTACTF_CHECKED; + } + } + } + else if (group->cl.items[group->scanIndex]->type == CLCIT_INFO) { + if (++savedInfoCount>savedInfoAlloced) { + savedInfoAlloced += allocstep; + savedInfo = (struct SavedInfoState_t*)mir_realloc(savedInfo,sizeof(struct SavedInfoState_t)*savedInfoAlloced); + } + if (group->parent == NULL) + savedInfo[savedInfoCount-1].parentId = -1; + else + savedInfo[savedInfoCount-1].parentId = group->groupId; + savedInfo[savedInfoCount-1].contact = *group->cl.items[group->scanIndex]; + } + group->scanIndex++; + } + + pcli->pfnFreeGroup(&dat->list); + RebuildEntireList(hwnd,dat); + + group = &dat->list; + group->scanIndex = 0; + for (;;) { + if (group->scanIndex == group->cl.count) { + group = group->parent; + if (group == NULL) + break; + } + else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { + group = group->cl.items[group->scanIndex]->group; + group->scanIndex = 0; + for (i = 0;igroupId) { + group->expanded = savedGroup[i].expanded; + break; + } + continue; + } + else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) { + for (i = 0;icl.items[group->scanIndex]->hContact) { + CopyMemory(group->cl.items[group->scanIndex]->iExtraImage,savedContact[i].iExtraImage,MAXEXTRACOLUMNS); + if (savedContact[i].checked) group->cl.items[group->scanIndex]->flags |= CONTACTF_CHECKED; + break; + } + if (group->cl.items[group->scanIndex]->SubAllocated>0) + { + int l; + for (l = 0; lcl.items[group->scanIndex]->SubAllocated; l++) + for (i = 0;icl.items[group->scanIndex]->subcontacts[l].hContact) { + CopyMemory(group->cl.items[group->scanIndex]->subcontacts[l].iExtraImage,savedContact[i].iExtraImage,MAXEXTRACOLUMNS); + if (savedContact[i].checked) group->cl.items[group->scanIndex]->subcontacts[l].flags |= CONTACTF_CHECKED; + break; + } + } + } + group->scanIndex++; + } + if (savedGroup) mir_free(savedGroup); + if (savedContact) mir_free(savedContact); + for (i = 0;ilist; + else { + if (!FindItem(hwnd,dat,(HANDLE)(savedInfo[i].parentId|HCONTACT_ISGROUP),&contact,NULL,NULL)) continue; + group = contact->group; + } + j = AddInfoItemToGroup(group,savedInfo[i].contact.flags,_T("")); + *group->cl.items[j] = savedInfo[i].contact; + } + if (savedInfo) mir_free(savedInfo); + pcli->pfnRecalculateGroupCheckboxes(hwnd,dat); + + RecalcScrollBar(hwnd,dat); + nm.hdr.code = CLN_LISTREBUILT; + nm.hdr.hwndFrom = hwnd; + nm.hdr.idFrom = GetDlgCtrlID(hwnd); + + + //srand(GetTickCount()); + + tick = GetTickCount()-tick; + { + char buf[255]; + //sprintf(buf,"%s %s took %i ms",__FILE__,__LINE__,tick); + sprintf(buf,"SaveStateAndRebuildList %d \r\n",tick); + + OutputDebugStringA(buf); + } + ClearRowByIndexCache(); + SendMessage(GetParent(hwnd),WM_NOTIFY,0,(LPARAM)&nm); +} diff --git a/plugins/Clist_mw/src/clcopts.cpp b/plugins/Clist_mw/src/clcopts.cpp new file mode 100644 index 0000000000..43634f6fad --- /dev/null +++ b/plugins/Clist_mw/src/clcopts.cpp @@ -0,0 +1,561 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 "commonheaders.h" +#include "m_clc.h" +#include "clc.h" + +#define DBFONTF_BOLD 1 +#define DBFONTF_ITALIC 2 +#define DBFONTF_UNDERLINE 4 + +static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +static INT_PTR CALLBACK DlgProcClcMetaOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + +static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +int OnStatusBarBackgroundChange(); + +int BgClcChange(WPARAM wParam,LPARAM lParam) +{ + pcli->pfnClcOptionsChanged(); + return 0; +} + +int BgStatusBarChange(WPARAM wParam,LPARAM lParam) +{ + pcli->pfnClcOptionsChanged(); + OnStatusBarBackgroundChange(); + return 0; +} + +int ClcOptInit(WPARAM wParam,LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp = { 0 }; + odp.cbSize = sizeof(odp); + odp.hInstance = g_hInst; + odp.pszGroup = LPGEN("Contact List"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLC); + odp.pszTitle = LPGEN("List"); + odp.pfnDlgProc = DlgProcClcMainOpts; + odp.flags = ODPF_BOLDGROUPS|ODPF_EXPERTONLY; + Options_AddPage(wParam, &odp); + + if (!ServiceExists(MS_BACKGROUNDCONFIG_REGISTER)) { + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLCBKG); + odp.pszTitle = LPGEN("List Background"); + odp.pfnDlgProc = DlgProcClcBkgOpts; + odp.flags = ODPF_BOLDGROUPS; + Options_AddPage(wParam, &odp); + } + + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_META_CLC); + odp.pszTitle = LPGEN("List MetaContacts"); + odp.pfnDlgProc = DlgProcClcMetaOpts; + Options_AddPage(wParam, &odp); + + if (!ServiceExists(MS_BACKGROUNDCONFIG_REGISTER)) { + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLCBKG); + odp.pszTitle = LPGEN("StatusBar Background"); + odp.pfnDlgProc = DlgProcStatusBarBkgOpts; + odp.flags = ODPF_BOLDGROUPS; + Options_AddPage(wParam, &odp); + } + + return 0; +} + +struct CheckBoxToStyleEx_t { + int id; + DWORD flag; + int not; +} static const checkBoxToStyleEx[] = { + {IDC_DISABLEDRAGDROP,CLS_EX_DISABLEDRAGDROP,0}, + {IDC_NOTEDITLABELS,CLS_EX_EDITLABELS,1}, + {IDC_SHOWSELALWAYS,CLS_EX_SHOWSELALWAYS,0}, + {IDC_TRACKSELECT,CLS_EX_TRACKSELECT,0}, + {IDC_SHOWGROUPCOUNTS,CLS_EX_SHOWGROUPCOUNTS,0}, + {IDC_HIDECOUNTSWHENEMPTY,CLS_EX_HIDECOUNTSWHENEMPTY,0}, + {IDC_DIVIDERONOFF,CLS_EX_DIVIDERONOFF,0}, + {IDC_NOTNOTRANSLUCENTSEL,CLS_EX_NOTRANSLUCENTSEL,1}, + {IDC_LINEWITHGROUPS,CLS_EX_LINEWITHGROUPS,0}, + {IDC_QUICKSEARCHVISONLY,CLS_EX_QUICKSEARCHVISONLY,0}, + {IDC_SORTGROUPSALPHA,CLS_EX_SORTGROUPSALPHA,0}, + {IDC_NOTNOSMOOTHSCROLLING,CLS_EX_NOSMOOTHSCROLLING,1}}; + +struct CheckBoxValues_t { + DWORD style; + TCHAR *szDescr; +}; +static const struct CheckBoxValues_t greyoutValues[] = +{ + {GREYF_UNFOCUS, _T("Not focused") }, + {MODEF_OFFLINE, _T("Offline") }, + {PF2_ONLINE, _T("Online") }, + {PF2_SHORTAWAY, _T("Away") }, + {PF2_LONGAWAY, _T("NA") }, + {PF2_LIGHTDND, _T("Occupied") }, + {PF2_HEAVYDND, _T("DND") }, + {PF2_FREECHAT, _T("Free for chat") }, + {PF2_INVISIBLE, _T("Invisible") }, + {PF2_OUTTOLUNCH, _T("Out to lunch") }, + {PF2_ONTHEPHONE, _T("On the phone") } +}; + +static const struct CheckBoxValues_t offlineValues[] = +{ + {MODEF_OFFLINE, _T("Offline") }, + {PF2_ONLINE, _T("Online") }, + {PF2_SHORTAWAY, _T("Away") }, + {PF2_LONGAWAY, _T("NA") }, + {PF2_LIGHTDND, _T("Occupied") }, + {PF2_HEAVYDND, _T("DND") }, + {PF2_FREECHAT, _T("Free for chat") }, + {PF2_INVISIBLE, _T("Invisible") }, + {PF2_OUTTOLUNCH, _T("Out to lunch") }, + {PF2_ONTHEPHONE, _T("On the phone") } +}; + +static void FillCheckBoxTree(HWND hwndTree,const struct CheckBoxValues_t *values,int nValues,DWORD style) +{ + TVINSERTSTRUCT tvis; + int i; + + tvis.hParent = NULL; + tvis.hInsertAfter = TVI_LAST; + tvis.item.mask = TVIF_PARAM|TVIF_TEXT|TVIF_STATE; + for (i = 0;i>12 == 2)) flags |= tvi.lParam; + tvi.hItem = TreeView_GetNextSibling(hwndTree,tvi.hItem); + } + return flags; +} + +static INT_PTR CALLBACK DlgProcClcMetaOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + LPNMHDR t; + t = ((LPNMHDR)lParam); + switch (msg) + { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + + CheckDlgButton(hwndDlg, IDC_META, DBGetContactSettingByte(NULL,"CLC","Meta",0) ? BST_CHECKED : BST_UNCHECKED); /// by FYR + CheckDlgButton(hwndDlg, IDC_METADBLCLK, DBGetContactSettingByte(NULL,"CLC","MetaDoubleClick",0) ? BST_CHECKED : BST_UNCHECKED); /// by FYR + CheckDlgButton(hwndDlg, IDC_METASUBEXTRA, DBGetContactSettingByte(NULL,"CLC","MetaHideExtra",0) ? BST_CHECKED : BST_UNCHECKED); /// by FYR + CheckDlgButton(hwndDlg, IDC_METASUBEXTRA_IGN, DBGetContactSettingByte(NULL,"CLC","MetaIgnoreEmptyExtra",1) ? BST_CHECKED : BST_UNCHECKED); /// by FYR + CheckDlgButton(hwndDlg, IDC_METASUB_HIDEOFFLINE, DBGetContactSettingByte(NULL,"CLC","MetaHideOfflineSub",1) ? BST_CHECKED : BST_UNCHECKED); /// by FYR + return TRUE; + case WM_COMMAND: + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + return TRUE; + case WM_NOTIFY: + + switch(t->idFrom) + { + case 0: + switch (t->code) + { + case PSN_APPLY: + DBWriteContactSettingByte(NULL,"CLC","Meta",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_META)); // by FYR + DBWriteContactSettingByte(NULL,"CLC","MetaDoubleClick",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METADBLCLK)); // by FYR + DBWriteContactSettingByte(NULL,"CLC","MetaHideExtra",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUBEXTRA)); // by FYR + DBWriteContactSettingByte(NULL,"CLC","MetaIgnoreEmptyExtra",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUBEXTRA_IGN)); // by FYR + DBWriteContactSettingByte(NULL,"CLC","MetaHideOfflineSub",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUB_HIDEOFFLINE)); // by FYR + pcli->pfnClcOptionsChanged(); + return TRUE; + } + break; + } + break; + } + return FALSE; +} + +static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES); + SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES); + { + DWORD exStyle = DBGetContactSettingDword(NULL,"CLC","ExStyle",pcli->pfnGetDefaultExStyle()); + for (int i = 0;i < SIZEOF(checkBoxToStyleEx); i++) + CheckDlgButton(hwndDlg,checkBoxToStyleEx[i].id,(exStyle&checkBoxToStyleEx[i].flag)^(checkBoxToStyleEx[i].flag*checkBoxToStyleEx[i].not)?BST_CHECKED:BST_UNCHECKED); + + UDACCEL accel[2] = {{0,10},{2,50}}; + SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_SETRANGE,0,MAKELONG(999,0)); + SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_SETACCEL,SIZEOF(accel), (LPARAM)&accel ); + SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"CLC","ScrollTime",CLCDEFAULT_SCROLLTIME),0)); + } + CheckDlgButton(hwndDlg,IDC_IDLE,DBGetContactSettingByte(NULL,"CLC","ShowIdle",CLCDEFAULT_SHOWIDLE)?BST_CHECKED:BST_UNCHECKED); + + SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_SETRANGE,0,MAKELONG(64,0)); + SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingByte(NULL,"CLC","LeftMargin",CLCDEFAULT_LEFTMARGIN),0)); + SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_SETRANGE,0,MAKELONG(50,0)); + SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingByte(NULL,"CLC","GroupIndent",CLCDEFAULT_GROUPINDENT),0)); + CheckDlgButton(hwndDlg,IDC_GREYOUT,DBGetContactSettingDword(NULL,"CLC","GreyoutFlags",CLCDEFAULT_GREYOUTFLAGS)?BST_CHECKED:BST_UNCHECKED); + + + EnableWindow(GetDlgItem(hwndDlg,IDC_SMOOTHTIME),IsDlgButtonChecked(hwndDlg,IDC_NOTNOSMOOTHSCROLLING)); + EnableWindow(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),IsDlgButtonChecked(hwndDlg,IDC_GREYOUT)); + FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),greyoutValues,SIZEOF(greyoutValues),DBGetContactSettingDword(NULL,"CLC","FullGreyoutFlags",CLCDEFAULT_FULLGREYOUTFLAGS)); + FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS),offlineValues,SIZEOF(offlineValues),DBGetContactSettingDword(NULL,"CLC","OfflineModes",CLCDEFAULT_OFFLINEMODES)); + CheckDlgButton(hwndDlg,IDC_NOSCROLLBAR,DBGetContactSettingByte(NULL,"CLC","NoVScrollBar",0)?BST_CHECKED:BST_UNCHECKED); + return TRUE; + + case WM_VSCROLL: + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + + case WM_COMMAND: + if (LOWORD(wParam) == IDC_NOTNOSMOOTHSCROLLING) + EnableWindow(GetDlgItem(hwndDlg,IDC_SMOOTHTIME),IsDlgButtonChecked(hwndDlg,IDC_NOTNOSMOOTHSCROLLING)); + if (LOWORD(wParam) == IDC_GREYOUT) + EnableWindow(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),IsDlgButtonChecked(hwndDlg,IDC_GREYOUT)); + if ((LOWORD(wParam) == IDC_LEFTMARGIN || LOWORD(wParam) == IDC_SMOOTHTIME || LOWORD(wParam) == IDC_GROUPINDENT) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) + return 0; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + + case WM_NOTIFY: + switch(((LPNMHDR)lParam)->idFrom) { + case IDC_GREYOUTOPTS: + case IDC_HIDEOFFLINEOPTS: + if (((LPNMHDR)lParam)->code == NM_CLICK) { + TVHITTESTINFO hti; + hti.pt.x = (short)LOWORD(GetMessagePos()); + hti.pt.y = (short)HIWORD(GetMessagePos()); + ScreenToClient(((LPNMHDR)lParam)->hwndFrom,&hti.pt); + if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom,&hti)) + if (hti.flags&TVHT_ONITEMSTATEICON) { + TVITEM tvi; + tvi.mask = TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE; + tvi.hItem = hti.hItem; + TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom,&tvi); + tvi.iImage = tvi.iSelectedImage = (tvi.iImage == 1) ? 2 : 1; + TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom,&tvi); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + } + break; + case 0: + if (((LPNMHDR)lParam)->code == PSN_APPLY) { + int i; + DWORD exStyle = 0; + for (i = 0;i < SIZEOF(checkBoxToStyleEx);i++) + if ((IsDlgButtonChecked(hwndDlg,checkBoxToStyleEx[i].id) == 0) == checkBoxToStyleEx[i].not) + exStyle |= checkBoxToStyleEx[i].flag; + DBWriteContactSettingDword(NULL,"CLC","ExStyle",exStyle); + + DWORD fullGreyoutFlags = MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS)); + DBWriteContactSettingDword(NULL,"CLC","FullGreyoutFlags",fullGreyoutFlags); + if (IsDlgButtonChecked(hwndDlg,IDC_GREYOUT)) + DBWriteContactSettingDword(NULL,"CLC","GreyoutFlags",fullGreyoutFlags); + else + DBWriteContactSettingDword(NULL,"CLC","GreyoutFlags",0); + + DBWriteContactSettingByte(NULL,"CLC","ShowIdle",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_IDLE)?1:0)); + DBWriteContactSettingDword(NULL,"CLC","OfflineModes",MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS))); + DBWriteContactSettingByte(NULL,"CLC","LeftMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_GETPOS,0,0)); + DBWriteContactSettingWord(NULL,"CLC","ScrollTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_GETPOS,0,0)); + DBWriteContactSettingByte(NULL,"CLC","GroupIndent",(BYTE)SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_GETPOS,0,0)); + DBWriteContactSettingByte(NULL,"CLC","NoVScrollBar",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_NOSCROLLBAR)?1:0)); + + pcli->pfnClcOptionsChanged(); + return TRUE; + } + } + break; + + case WM_DESTROY: + ImageList_Destroy(TreeView_GetImageList(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),TVSIL_NORMAL)); + break; + } + return FALSE; +} + +static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + CheckDlgButton(hwndDlg,IDC_BITMAP,DBGetContactSettingByte(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)?BST_CHECKED:BST_UNCHECKED); + SendMessage(hwndDlg,WM_USER+10,0,0); + SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETDEFAULTCOLOUR,0,CLCDEFAULT_BKCOLOUR); + SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"StatusBar","BkColour",CLCDEFAULT_BKCOLOUR)); + SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETDEFAULTCOLOUR,0,CLCDEFAULT_SELBKCOLOUR); + SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"StatusBar","SelBkColour",CLCDEFAULT_SELBKCOLOUR)); + { + DBVARIANT dbv; + if (!DBGetContactSettingString(NULL,"StatusBar","BkBitmap",&dbv)) { + SetDlgItemTextA(hwndDlg,IDC_FILENAME,dbv.pszVal); + if (ServiceExists(MS_UTILS_PATHTOABSOLUTE)) { + char szPath[MAX_PATH]; + + if (CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)dbv.pszVal, (LPARAM)szPath)) + SetDlgItemTextA(hwndDlg,IDC_FILENAME,szPath); + } + else + mir_free(dbv.pszVal); + } + + WORD bmpUse = DBGetContactSettingWord(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE); + CheckDlgButton(hwndDlg,IDC_STRETCHH,bmpUse&CLB_STRETCHH?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_STRETCHV,bmpUse&CLB_STRETCHV?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_TILEH,bmpUse&CLBF_TILEH?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_TILEV,bmpUse&CLBF_TILEV?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_SCROLL,bmpUse&CLBF_SCROLL?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_PROPORTIONAL,bmpUse&CLBF_PROPORTIONAL?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_TILEVROWH,bmpUse&CLBF_TILEVTOROWHEIGHT?BST_CHECKED:BST_UNCHECKED); + + HRESULT (STDAPICALLTYPE *MySHAutoComplete)(HWND,DWORD); + MySHAutoComplete = (HRESULT (STDAPICALLTYPE*)(HWND,DWORD))GetProcAddress(GetModuleHandleA("shlwapi"),"SHAutoComplete"); + if (MySHAutoComplete) + MySHAutoComplete(GetDlgItem(hwndDlg,IDC_FILENAME),1); + } + return TRUE; + + case WM_USER+10: + EnableWindow(GetDlgItem(hwndDlg,IDC_FILENAME),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg,IDC_BROWSE),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg,IDC_STRETCHH),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg,IDC_STRETCHV),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg,IDC_TILEH),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg,IDC_TILEV),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg,IDC_SCROLL),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg,IDC_PROPORTIONAL),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg,IDC_TILEVROWH),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + break; + + case WM_COMMAND: + if (LOWORD(wParam) == IDC_BROWSE) { + char str[MAX_PATH]; + OPENFILENAMEA ofn = {0}; + char filter[512]; + + GetDlgItemTextA(hwndDlg,IDC_FILENAME,str,SIZEOF(str)); + ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; + ofn.hwndOwner = hwndDlg; + ofn.hInstance = NULL; + CallService(MS_UTILS_GETBITMAPFILTERSTRINGS,SIZEOF(filter),(LPARAM)filter); + ofn.lpstrFilter = filter; + ofn.lpstrFile = str; + ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + ofn.nMaxFile = SIZEOF(str); + ofn.nMaxFileTitle = MAX_PATH; + ofn.lpstrDefExt = "bmp"; + if (!GetOpenFileNameA(&ofn)) break; + SetDlgItemTextA(hwndDlg,IDC_FILENAME,str); + } + else if (LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) != EN_CHANGE) break; + if (LOWORD(wParam) == IDC_BITMAP) SendMessage(hwndDlg,WM_USER+10,0,0); + if (LOWORD(wParam) == IDC_FILENAME && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + + case WM_NOTIFY: + switch(((LPNMHDR)lParam)->idFrom) { + case 0: + switch (((LPNMHDR)lParam)->code) { + case PSN_APPLY: + DBWriteContactSettingByte(NULL,"StatusBar","UseBitmap",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + { + COLORREF col; + col = SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_GETCOLOUR,0,0); + if (col == CLCDEFAULT_BKCOLOUR) DBDeleteContactSetting(NULL,"StatusBar","BkColour"); + else DBWriteContactSettingDword(NULL,"StatusBar","BkColour",col); + col = SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_GETCOLOUR,0,0); + if (col == CLCDEFAULT_SELBKCOLOUR) DBDeleteContactSetting(NULL,"StatusBar","SelBkColour"); + else DBWriteContactSettingDword(NULL,"StatusBar","SelBkColour",col); + + char str[MAX_PATH],strrel[MAX_PATH]; + GetDlgItemTextA(hwndDlg,IDC_FILENAME,str,SIZEOF(str)); + if (ServiceExists(MS_UTILS_PATHTORELATIVE)) { + if (CallService(MS_UTILS_PATHTORELATIVE, (WPARAM)str, (LPARAM)strrel)) + DBWriteContactSettingString(NULL,"StatusBar","BkBitmap",strrel); + else DBWriteContactSettingString(NULL,"StatusBar","BkBitmap",str); + } + else DBWriteContactSettingString(NULL,"StatusBar","BkBitmap",str); + + WORD flags = 0; + if (IsDlgButtonChecked(hwndDlg,IDC_STRETCHH)) flags |= CLB_STRETCHH; + if (IsDlgButtonChecked(hwndDlg,IDC_STRETCHV)) flags |= CLB_STRETCHV; + if (IsDlgButtonChecked(hwndDlg,IDC_TILEH)) flags |= CLBF_TILEH; + if (IsDlgButtonChecked(hwndDlg,IDC_TILEV)) flags |= CLBF_TILEV; + if (IsDlgButtonChecked(hwndDlg,IDC_SCROLL)) flags |= CLBF_SCROLL; + if (IsDlgButtonChecked(hwndDlg,IDC_PROPORTIONAL)) flags |= CLBF_PROPORTIONAL; + if (IsDlgButtonChecked(hwndDlg,IDC_TILEVROWH)) flags |= CLBF_TILEVTOROWHEIGHT; + + DBWriteContactSettingWord(NULL,"StatusBar","BkBmpUse",flags); + } + + pcli->pfnClcOptionsChanged(); + OnStatusBarBackgroundChange(); + return TRUE; + } + break; + } + break; + } + return FALSE; +} + +static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + CheckDlgButton(hwndDlg,IDC_BITMAP,DBGetContactSettingByte(NULL,"CLC","UseBitmap",CLCDEFAULT_USEBITMAP)?BST_CHECKED:BST_UNCHECKED); + SendMessage(hwndDlg,WM_USER+10,0,0); + SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETDEFAULTCOLOUR,0,CLCDEFAULT_BKCOLOUR); + SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"CLC","BkColour",CLCDEFAULT_BKCOLOUR)); + SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETDEFAULTCOLOUR,0,CLCDEFAULT_SELBKCOLOUR); + SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"CLC","SelBkColour",CLCDEFAULT_SELBKCOLOUR)); + { DBVARIANT dbv; + if (!DBGetContactSettingString(NULL,"CLC","BkBitmap",&dbv)) { + SetDlgItemTextA(hwndDlg,IDC_FILENAME,dbv.pszVal); + if (ServiceExists(MS_UTILS_PATHTOABSOLUTE)) { + char szPath[MAX_PATH]; + + if (CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)dbv.pszVal, (LPARAM)szPath)) + SetDlgItemTextA(hwndDlg,IDC_FILENAME,szPath); + } + else mir_free(dbv.pszVal); + } + } + + { WORD bmpUse = DBGetContactSettingWord(NULL,"CLC","BkBmpUse",CLCDEFAULT_BKBMPUSE); + CheckDlgButton(hwndDlg,IDC_STRETCHH,bmpUse&CLB_STRETCHH?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_STRETCHV,bmpUse&CLB_STRETCHV?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_TILEH,bmpUse&CLBF_TILEH?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_TILEV,bmpUse&CLBF_TILEV?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_SCROLL,bmpUse&CLBF_SCROLL?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_PROPORTIONAL,bmpUse&CLBF_PROPORTIONAL?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_TILEVROWH,bmpUse&CLBF_TILEVTOROWHEIGHT?BST_CHECKED:BST_UNCHECKED); + + } + { HRESULT (STDAPICALLTYPE *MySHAutoComplete)(HWND,DWORD); + MySHAutoComplete = (HRESULT (STDAPICALLTYPE*)(HWND,DWORD))GetProcAddress(GetModuleHandleA("shlwapi"),"SHAutoComplete"); + if (MySHAutoComplete) MySHAutoComplete(GetDlgItem(hwndDlg,IDC_FILENAME),1); + } + return TRUE; + case WM_USER+10: + EnableWindow(GetDlgItem(hwndDlg,IDC_FILENAME),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg,IDC_BROWSE),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg,IDC_STRETCHH),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg,IDC_STRETCHV),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg,IDC_TILEH),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg,IDC_TILEV),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg,IDC_SCROLL),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg,IDC_PROPORTIONAL),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg,IDC_TILEVROWH),IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + break; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_BROWSE) { + char str[MAX_PATH]; + OPENFILENAMEA ofn = {0}; + char filter[512]; + + GetDlgItemTextA(hwndDlg,IDC_FILENAME,str,SIZEOF(str)); + ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; + ofn.hwndOwner = hwndDlg; + ofn.hInstance = NULL; + CallService(MS_UTILS_GETBITMAPFILTERSTRINGS,SIZEOF(filter),(LPARAM)filter); + ofn.lpstrFilter = filter; + ofn.lpstrFile = str; + ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + ofn.nMaxFile = SIZEOF(str); + ofn.nMaxFileTitle = MAX_PATH; + ofn.lpstrDefExt = "bmp"; + if (!GetOpenFileNameA(&ofn)) break; + SetDlgItemTextA(hwndDlg,IDC_FILENAME,str); + } + else if (LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) != EN_CHANGE) break; + if (LOWORD(wParam) == IDC_BITMAP) SendMessage(hwndDlg,WM_USER+10,0,0); + if (LOWORD(wParam) == IDC_FILENAME && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case WM_NOTIFY: + switch(((LPNMHDR)lParam)->idFrom) { + case 0: + switch (((LPNMHDR)lParam)->code) { + case PSN_APPLY: + DBWriteContactSettingByte(NULL,"CLC","UseBitmap",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + { COLORREF col; + col = SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_GETCOLOUR,0,0); + if (col == CLCDEFAULT_BKCOLOUR) DBDeleteContactSetting(NULL,"CLC","BkColour"); + else DBWriteContactSettingDword(NULL,"CLC","BkColour",col); + col = SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_GETCOLOUR,0,0); + if (col == CLCDEFAULT_SELBKCOLOUR) DBDeleteContactSetting(NULL,"CLC","SelBkColour"); + else DBWriteContactSettingDword(NULL,"CLC","SelBkColour",col); + } + { + char str[MAX_PATH],strrel[MAX_PATH]; + GetDlgItemTextA(hwndDlg,IDC_FILENAME,str,SIZEOF(str)); + if (ServiceExists(MS_UTILS_PATHTORELATIVE)) { + if (CallService(MS_UTILS_PATHTORELATIVE, (WPARAM)str, (LPARAM)strrel)) + DBWriteContactSettingString(NULL,"CLC","BkBitmap",strrel); + else DBWriteContactSettingString(NULL,"CLC","BkBitmap",str); + } + else DBWriteContactSettingString(NULL,"CLC","BkBitmap",str); + } + { WORD flags = 0; + if (IsDlgButtonChecked(hwndDlg,IDC_STRETCHH)) flags |= CLB_STRETCHH; + if (IsDlgButtonChecked(hwndDlg,IDC_STRETCHV)) flags |= CLB_STRETCHV; + if (IsDlgButtonChecked(hwndDlg,IDC_TILEH)) flags |= CLBF_TILEH; + if (IsDlgButtonChecked(hwndDlg,IDC_TILEV)) flags |= CLBF_TILEV; + if (IsDlgButtonChecked(hwndDlg,IDC_SCROLL)) flags |= CLBF_SCROLL; + if (IsDlgButtonChecked(hwndDlg,IDC_PROPORTIONAL)) flags |= CLBF_PROPORTIONAL; + if (IsDlgButtonChecked(hwndDlg,IDC_TILEVROWH)) flags |= CLBF_TILEVTOROWHEIGHT; + + DBWriteContactSettingWord(NULL,"CLC","BkBmpUse",flags); + } + + pcli->pfnClcOptionsChanged(); + return TRUE; + } + break; + } + break; + } + return FALSE; +} + diff --git a/plugins/Clist_mw/src/clcpaint.cpp b/plugins/Clist_mw/src/clcpaint.cpp new file mode 100644 index 0000000000..b4fc20850f --- /dev/null +++ b/plugins/Clist_mw/src/clcpaint.cpp @@ -0,0 +1,688 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 "commonheaders.h" +#include "m_clc.h" +#include "clc.h" + +extern HIMAGELIST himlCListClc; +static BYTE divide3[765] = {255}; +int MetaIgnoreEmptyExtra; +ExternDrawer SED; + +static void ChangeToFont(HDC hdc,struct ClcData *dat,int id,int *fontHeight) +{ + SelectObject(hdc,dat->fontInfo[id].hFont); + SetTextColor(hdc,dat->fontInfo[id].colour); + if (fontHeight) *fontHeight = dat->fontInfo[id].fontHeight; +} + +static void __inline SetHotTrackColour(HDC hdc,struct ClcData *dat) +{ + if (dat->gammaCorrection) { + COLORREF oldCol,newCol; + int oldLum,newLum; + + oldCol = GetTextColor(hdc); + oldLum = (GetRValue(oldCol)*30+GetGValue(oldCol)*59+GetBValue(oldCol)*11)/100; + newLum = (GetRValue(dat->hotTextColour)*30+GetGValue(dat->hotTextColour)*59+GetBValue(dat->hotTextColour)*11)/100; + if (newLum == 0) { + SetTextColor(hdc,dat->hotTextColour); + return; + } + if (newLum>=oldLum+20) { + oldLum += 20; + newCol = RGB(GetRValue(dat->hotTextColour)*oldLum/newLum,GetGValue(dat->hotTextColour)*oldLum/newLum,GetBValue(dat->hotTextColour)*oldLum/newLum); + } + else if (newLum<=oldLum) { + int r,g,b; + r = GetRValue(dat->hotTextColour)*oldLum/newLum; + g = GetGValue(dat->hotTextColour)*oldLum/newLum; + b = GetBValue(dat->hotTextColour)*oldLum/newLum; + if (r>255) { + g += (r-255)*3/7; + b += (r-255)*3/7; + r = 255; + } + if (g>255) { + r += (g-255)*59/41; + if (r>255) r = 255; + b += (g-255)*59/41; + g = 255; + } + if (b>255) { + r += (b-255)*11/89; + if (r>255) r = 255; + g += (b-255)*11/89; + if (g>255) g = 255; + b = 255; + } + newCol = RGB(r,g,b); + } + else newCol = dat->hotTextColour; + SetTextColor(hdc,newCol); + } + else + SetTextColor(hdc,dat->hotTextColour); +} + +static int GetStatusOnlineness(int status) +{ + switch(status) { + case ID_STATUS_FREECHAT: return 110; + case ID_STATUS_ONLINE: return 100; + case ID_STATUS_OCCUPIED: return 60; + case ID_STATUS_ONTHEPHONE: return 50; + case ID_STATUS_DND: return 40; + case ID_STATUS_AWAY: return 30; + case ID_STATUS_OUTTOLUNCH: return 20; + case ID_STATUS_NA: return 10; + case ID_STATUS_INVISIBLE: return 5; + } + return 0; +} + +static int GetGeneralisedStatus(void) +{ + int i,status,thisStatus,statusOnlineness,thisOnlineness; + + status = ID_STATUS_OFFLINE; + statusOnlineness = 0; + + for (i = 0;ihClcProtoCount;i++) { + thisStatus = pcli->clcProto[i].dwStatus; + if (thisStatus == ID_STATUS_INVISIBLE) + return ID_STATUS_INVISIBLE; + + thisOnlineness = GetStatusOnlineness(thisStatus); + if (thisOnlineness > statusOnlineness) { + status = thisStatus; + statusOnlineness = thisOnlineness; + } + } + return status; +} + +static int GetRealStatus(struct ClcContact * contact, int status) +{ + int i; + char *szProto = contact->proto; + if (!szProto) return status; + for (i = 0;ihClcProtoCount;i++) { + if (!lstrcmpA(pcli->clcProto[i].szProto,szProto)) { + return pcli->clcProto[i].dwStatus; + } + } + return status; +} + +static HMODULE themeAPIHandle = NULL; // handle to uxtheme.dll +static HANDLE (WINAPI *MyOpenThemeData)(HWND,LPCWSTR); +static HRESULT (WINAPI *MyCloseThemeData)(HANDLE); +static HRESULT (WINAPI *MyDrawThemeBackground)(HANDLE,HDC,int,int,const RECT *,const RECT *); + +#define MGPROC(x) GetProcAddress(themeAPIHandle,x) +void InternalPaintClc(HWND hwnd,struct ClcData *dat,HDC hdc,RECT *rcPaint) +{ + HDC hdcMem; + HBITMAP oldbmp; + HBITMAP oldbm; + HFONT oldfont; + RECT clRect; + int y,indent,index,fontHeight, subindex, subident; + struct ClcContact *Drawing; + struct ClcGroup *group; + HBITMAP hBmpOsb; + DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE); + int status = GetGeneralisedStatus(); + int grey = 0,groupCountsFontTopShift; + HBRUSH hBrushAlternateGrey = NULL; + POINT pt; + RECT testrc; + + // yes I know about GetSysColorBrush() + COLORREF tmpbkcolour = style&CLS_CONTACTLIST ? ( /*dat->useWindowsColours ? GetSysColor(COLOR_3DFACE) :*/ dat->bkColour ) : dat->bkColour; + + if (dat->greyoutFlags & pcli->pfnClcStatusToPf2(status) || style&WS_DISABLED) grey = 1; + else if (GetFocus() != hwnd && dat->greyoutFlags&GREYF_UNFOCUS) grey = 1; + GetClientRect(hwnd,&clRect); + + if (rcPaint == NULL) rcPaint = &clRect; + //rcPaint = &clRect; + + if (IsRectEmpty(rcPaint)) return; + GetCursorPos(&pt); + ScreenToClient(hwnd,&pt); + + + y = -dat->yScroll; + hdcMem = CreateCompatibleDC(hdc); + hBmpOsb = CreateBitmap(clRect.right,clRect.bottom,1,GetDeviceCaps(hdc,BITSPIXEL),NULL); + oldbmp = (HBITMAP)SelectObject(hdcMem,hBmpOsb); + { + oldfont = (HFONT)SelectObject(hdcMem,dat->fontInfo[FONTID_GROUPS].hFont); + + TEXTMETRIC tm; + GetTextMetrics(hdcMem,&tm); + groupCountsFontTopShift = tm.tmAscent; + SelectObject(hdcMem,dat->fontInfo[FONTID_GROUPCOUNTS].hFont); + GetTextMetrics(hdcMem,&tm); + groupCountsFontTopShift -= tm.tmAscent; + SelectObject(hdcMem,oldfont); + } + + if (style&CLS_GREYALTERNATE) + hBrushAlternateGrey = CreateSolidBrush(GetNearestColor(hdcMem,RGB(GetRValue(tmpbkcolour)-10,GetGValue(tmpbkcolour)-10,GetBValue(tmpbkcolour)-10))); + + ChangeToFont(hdcMem,dat,FONTID_CONTACTS,&fontHeight); + SetBkMode(hdcMem,TRANSPARENT); + + HBRUSH hBrush,hoBrush; + + hBrush = CreateSolidBrush(tmpbkcolour); + hoBrush = (HBRUSH)SelectObject(hdcMem,hBrush); + FillRect(hdcMem,rcPaint,hBrush); + SelectObject(hdcMem,hoBrush); + DeleteObject(hBrush); + if (dat->hBmpBackground) { + BITMAP bmp; + HDC hdcBmp; + int x,y; + int maxx,maxy; + int destw,desth; + + // XXX: Halftone isnt supported on 9x, however the scretch problems dont happen on 98. + SetStretchBltMode(hdcMem, HALFTONE); + + GetObject(dat->hBmpBackground,sizeof(bmp),&bmp); + hdcBmp = CreateCompatibleDC(hdcMem); + oldbm = (HBITMAP)SelectObject(hdcBmp,dat->hBmpBackground); + y = dat->backgroundBmpUse&CLBF_SCROLL?-dat->yScroll:0; + maxx = dat->backgroundBmpUse&CLBF_TILEH?clRect.right:1; + maxy = dat->backgroundBmpUse&CLBF_TILEV?maxy = rcPaint->bottom:y+1; + switch(dat->backgroundBmpUse&CLBM_TYPE) { + case CLB_STRETCH: + if (dat->backgroundBmpUse&CLBF_PROPORTIONAL) { + if (clRect.right*bmp.bmHeightbackgroundBmpUse&CLBF_PROPORTIONAL) { + destw = clRect.right; + desth = destw*bmp.bmHeight/bmp.bmWidth; + } + else { + destw = clRect.right; + desth = bmp.bmHeight; + if (dat->backgroundBmpUse&CLBF_TILEVTOROWHEIGHT) + desth = dat->rowHeight; + } + break; + + case CLB_STRETCHV: + if (dat->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; + if (dat->backgroundBmpUse&CLBF_TILEVTOROWHEIGHT) + desth = dat->rowHeight; + break; + } + + for (;ytop-desth) continue; + for (x = 0;xlist; + group->scanIndex = 0; + indent = 0; + subindex = -1; + for (index = 0;ybottom;) { + if (subindex == -1) + if (group->scanIndex == group->cl.count) { + group = group->parent; + indent--; + if (group == NULL) break; + group->scanIndex++; + continue; + } + + if (y>rcPaint->top-dat->rowHeight ) { + int iImage = -1; + int selected; + int hottrack; + SIZE textSize,countsSize,spaceSize; + int width,checkboxWidth; + char *szCounts; + + if (subindex == -1) { + Drawing = group->cl.items[group->scanIndex]; + subident = 0; + } + else { + Drawing = &(group->cl.items[group->scanIndex]->subcontacts[subindex]); + subident = dat->rowHeight/2; + } + //alternating grey + + selected = index == dat->selection && (dat->showSelAlways || dat->exStyle&CLS_EX_SHOWSELALWAYS || GetFocus() == hwnd) && Drawing->type != CLCIT_DIVIDER; + hottrack = dat->exStyle&CLS_EX_TRACKSELECT && Drawing->type != CLCIT_DIVIDER && dat->iHotTrack == index; + + if (style&CLS_GREYALTERNATE && index&1) { + RECT rc; + rc.top = y; rc.bottom = rc.top+dat->rowHeight; + rc.left = 0; rc.right = clRect.right; + FillRect(hdcMem,&rc,hBrushAlternateGrey); + } + + //setup + if (Drawing->type == CLCIT_GROUP) { + if (Drawing->group->expanded) + ChangeToFont(hdcMem,dat,FONTID_GROUPS,&fontHeight); + else + ChangeToFont(hdcMem,dat,FONTID_GROUPSCLOSED,&fontHeight); + } + else if (Drawing->type == CLCIT_INFO) { + if (Drawing->flags&CLCIIF_GROUPFONT) ChangeToFont(hdcMem,dat,FONTID_GROUPS,&fontHeight); + else ChangeToFont(hdcMem,dat,FONTID_CONTACTS,&fontHeight); + } + else if (Drawing->type == CLCIT_DIVIDER) + ChangeToFont(hdcMem,dat,FONTID_DIVIDERS,&fontHeight); + else if (Drawing->type == CLCIT_CONTACT && (Drawing->flags&CONTACTF_NOTONLIST) && (!Drawing->isSubcontact)) + ChangeToFont(hdcMem,dat,FONTID_NOTONLIST,&fontHeight); + else if ( Drawing->type == CLCIT_CONTACT && + ( + (Drawing->flags&CONTACTF_INVISTO && (!Drawing->isSubcontact) && GetRealStatus(group->cl.items[group->scanIndex], status) != ID_STATUS_INVISIBLE ) + || + (Drawing->flags&CONTACTF_VISTO && (!Drawing->isSubcontact) && GetRealStatus(group->cl.items[group->scanIndex], status) == ID_STATUS_INVISIBLE) + ) + ) + { + // the contact is in the always visible list and the proto is invisible + // the contact is in the always invisible and the proto is in any other mode + ChangeToFont(hdcMem,dat, Drawing->flags&CONTACTF_ONLINE ? FONTID_INVIS:FONTID_OFFINVIS ,&fontHeight); + } + else if (Drawing->type == CLCIT_CONTACT && (!(Drawing->flags&CONTACTF_ONLINE) && (!Drawing->isSubcontact))) + ChangeToFont(hdcMem,dat,FONTID_OFFLINE,&fontHeight); + else + ChangeToFont(hdcMem,dat,FONTID_CONTACTS,&fontHeight); + GetTextExtentPoint32(hdcMem,Drawing->szText,lstrlen(Drawing->szText),&textSize); + width = textSize.cx; + if (Drawing->type == CLCIT_GROUP) { + szCounts = pcli->pfnGetGroupCountsText(dat,group->cl.items[group->scanIndex]); + if (szCounts[0]) { + GetTextExtentPoint32A(hdcMem," ",1,&spaceSize); + ChangeToFont(hdcMem,dat,FONTID_GROUPCOUNTS,&fontHeight); + GetTextExtentPoint32A(hdcMem,szCounts,lstrlenA(szCounts),&countsSize); + width += spaceSize.cx+countsSize.cx; + } + } + + if ((style&CLS_CHECKBOXES && Drawing->type == CLCIT_CONTACT) || + (style&CLS_GROUPCHECKBOXES && Drawing->type == CLCIT_GROUP) || + (Drawing->type == CLCIT_INFO && Drawing->flags&CLCIIF_CHECKBOX)) + checkboxWidth = dat->checkboxSize+2; + else checkboxWidth = 0; + + //background + if (selected) { + // default value - paint on text + int x=dat->leftMargin+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace-2+subident; + ImageList_DrawEx(dat->himlHighlight,0,hdcMem,x,y,min(width+5,clRect.right-x),dat->rowHeight,CLR_NONE,CLR_NONE,dat->exStyle&CLS_EX_NOTRANSLUCENTSEL?ILD_NORMAL:ILD_BLEND25); + SetTextColor(hdcMem,dat->selTextColour); + } + else if (hottrack) + SetHotTrackColour(hdcMem,dat); + + //checkboxes + if (checkboxWidth && (subindex == -1 ||1)) { + RECT rc; + HANDLE hTheme = NULL; + + // THEME + if (IsWinVerXPPlus()) { + if (!themeAPIHandle) { + themeAPIHandle = GetModuleHandleA("uxtheme"); + if (themeAPIHandle) { + MyOpenThemeData = (HANDLE (WINAPI *)(HWND,LPCWSTR))MGPROC("OpenThemeData"); + MyCloseThemeData = (HRESULT (WINAPI *)(HANDLE))MGPROC("CloseThemeData"); + MyDrawThemeBackground = (HRESULT (WINAPI *)(HANDLE,HDC,int,int,const RECT *,const RECT *))MGPROC("DrawThemeBackground"); + } + } + // Make sure all of these methods are valid (i would hope either all or none work) + if (MyOpenThemeData + &&MyCloseThemeData + &&MyDrawThemeBackground) { + hTheme = MyOpenThemeData(hwnd,L"BUTTON"); + } + } + rc.left = dat->leftMargin+indent*dat->groupIndent+subident; + rc.right = rc.left+dat->checkboxSize; + rc.top = y+((dat->rowHeight-dat->checkboxSize)>>1); + rc.bottom = rc.top+dat->checkboxSize; + if (hTheme) { + MyDrawThemeBackground(hTheme, hdcMem, BP_CHECKBOX, Drawing->flags&CONTACTF_CHECKED?(hottrack?CBS_CHECKEDHOT:CBS_CHECKEDNORMAL):(hottrack?CBS_UNCHECKEDHOT:CBS_UNCHECKEDNORMAL), &rc, &rc); + } + else DrawFrameControl(hdcMem,&rc,DFC_BUTTON,DFCS_BUTTONCHECK|DFCS_FLAT|(Drawing->flags&CONTACTF_CHECKED?DFCS_CHECKED:0)|(hottrack?DFCS_HOT:0)); + if (hTheme&&MyCloseThemeData) { + MyCloseThemeData(hTheme); + hTheme = NULL; + } + } + + //icon + if (Drawing->type == CLCIT_GROUP) + iImage = Drawing->group->expanded?IMAGE_GROUPOPEN:IMAGE_GROUPSHUT; + else if (Drawing->type == CLCIT_CONTACT) + iImage = Drawing->iImage; + if (iImage != -1) { + /*COLORREF colourFg = dat->selBkColour; + int mode = ILD_NORMAL; + if (selected) mode = ILD_SELECTED; + else if (hottrack) {mode = ILD_FOCUS; colourFg = dat->hotTextColour;} + else if (Drawing->type == CLCIT_CONTACT && Drawing->flags&CONTACTF_NOTONLIST) {colourFg = dat->fontInfo[FONTID_NOTONLIST].colour; mode = ILD_BLEND50;} + ImageList_DrawEx(himlCListClc,iImage,hdcMem,dat->leftMargin+indent*dat->groupIndent+checkboxWidth,y+((dat->rowHeight-16)>>1),0,0,CLR_NONE,colourFg,mode); + */ + COLORREF colourFg = dat->selBkColour; + int mode = ILD_NORMAL; + if (hottrack) {colourFg = dat->hotTextColour;} + else if (Drawing->type == CLCIT_CONTACT && Drawing->flags&CONTACTF_NOTONLIST && (!Drawing->isSubcontact)) {colourFg = dat->fontInfo[FONTID_NOTONLIST].colour; mode = ILD_BLEND50;} + if (Drawing->type == CLCIT_CONTACT && dat->showIdle && (Drawing->flags&CONTACTF_IDLE)&& (!Drawing->isSubcontact) && GetRealStatus(group->cl.items[group->scanIndex],ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) + mode = ILD_SELECTED; + ImageList_DrawEx(himlCListClc,iImage,hdcMem,dat->leftMargin+subident+indent*dat->groupIndent+checkboxWidth,y+((dat->rowHeight-16)>>1),0,0,CLR_NONE,colourFg,mode); + } + + //text + if (Drawing->type == CLCIT_DIVIDER) { + RECT rc; + rc.top = y+(dat->rowHeight>>1); rc.bottom = rc.top+2; + rc.left = dat->leftMargin+indent*dat->groupIndent; + rc.right = rc.left+((clRect.right-rc.left-textSize.cx)>>1)-3; + DrawEdge(hdcMem,&rc,BDR_SUNKENOUTER,BF_RECT); + TextOut(hdcMem,rc.right+3,y+((dat->rowHeight-fontHeight)>>1),Drawing->szText,lstrlen(Drawing->szText)); + rc.left = rc.right+6+textSize.cx; + rc.right = clRect.right; + DrawEdge(hdcMem,&rc,BDR_SUNKENOUTER,BF_RECT); + } + else if (Drawing->type == CLCIT_GROUP) { + RECT rc; + if (szCounts[0]) { + struct ClcGroup *clcg; + + clcg = (struct ClcGroup *)Drawing; + + fontHeight = dat->fontInfo[FONTID_GROUPS].fontHeight; + + rc.left = dat->leftMargin+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace; + rc.right = min(clRect.right-countsSize.cx,rc.left+textSize.cx+spaceSize.cx); + rc.top = y+((dat->rowHeight-fontHeight)>>1); + rc.bottom = rc.top+textSize.cy; + if (rc.rightgroup->expanded) + { + ChangeToFont(hdcMem,dat,FONTID_GROUPS,&fontHeight); + } + else + { + ChangeToFont(hdcMem,dat,FONTID_GROUPSCLOSED,&fontHeight); + } + + if (selected) + SetTextColor(hdcMem,dat->selTextColour); + else if (hottrack) + SetHotTrackColour(hdcMem,dat); + rc.right--; + ExtTextOut(hdcMem,rc.left,rc.top,ETO_CLIPPED,&rc,Drawing->szText,lstrlen(Drawing->szText),NULL); + } + else TextOut(hdcMem,dat->leftMargin+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace,y+((dat->rowHeight-fontHeight)>>1),Drawing->szText,lstrlen(Drawing->szText)); + if (dat->exStyle&CLS_EX_LINEWITHGROUPS) { + //calc if extra icons present + int enabledextraicons = 0; + for (iImage = 0;iImageextraColumnsCount;iImage++) { + if (Drawing->iExtraImage[iImage] == 0xFF) continue; + enabledextraicons++; + } + rc.top = y+(dat->rowHeight>>1); rc.bottom = rc.top+2; + rc.left = dat->leftMargin+subident+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace+width+3; + rc.right = clRect.right-1-dat->extraColumnSpacing*enabledextraicons; + if (rc.right-rc.left>1) DrawEdge(hdcMem,&rc,BDR_SUNKENOUTER,BF_RECT); + } + } + else { + RECT rc; + rc.left = dat->leftMargin+subident+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace; + rc.top = y+((dat->rowHeight-fontHeight)>>1); + rc.bottom = rc.top+dat->rowHeight; + rc.right = clRect.right; + if (Drawing->type = CLCIT_CONTACT) + if (hottrack) + ChangeToFont(hdcMem,dat,FONTID_CONTACTSHOVER,&fontHeight); + + DrawText(hdcMem,Drawing->szText,lstrlen(Drawing->szText),&rc,DT_END_ELLIPSIS); + + } + + if (selected) { + if (Drawing->type != CLCIT_DIVIDER) { + SetTextColor(hdcMem,dat->quickSearchColour); + TextOut(hdcMem,dat->leftMargin+subident+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace,y+((dat->rowHeight-fontHeight)>>1),Drawing->szText,lstrlen(dat->szQuickSearch)); + } + } + + if (dat->style&CLS_SHOWSTATUSMESSAGES) + { + // status message + if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->flags & CONTACTF_STATUSMSG) { + TCHAR * szText = group->cl.items[group->scanIndex]->szStatusMsg; + RECT rc; + rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace; + rc.top = y+dat->rowHeight+((dat->rowHeight-fontHeight)>>1); + rc.right = (clRect.right - clRect.left); + rc.bottom = rc.top+dat->rowHeight; + ChangeToFont(hdcMem,dat,FONTID_STATUSMSG,&fontHeight); + //ExtTextOut(hdcMem,rc.left,rc.top,ETO_CLIPPED,&rc,szText,lstrlen(szText),NULL); + DrawText(hdcMem, szText, lstrlen(szText), &rc, DT_SINGLELINE | DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS); + } + } + + if (!Drawing->isSubcontact || (DBGetContactSettingByte(NULL,"CLC","MetaHideExtra",0) == 0)) { + + //extra icons + if ( !(style & CLS_EX_MULTICOLUMNALIGNLEFT)) { + int c = dat->extraColumnsCount; + for (iImage = dat->extraColumnsCount-1;iImage>=0;iImage--) { + COLORREF colourFg = dat->selBkColour; + int mode = ILD_NORMAL; + + if (Drawing->iExtraImage[iImage] == 0xFF) continue; + if (selected) mode = ILD_SELECTED; + else if (hottrack) {mode = ILD_FOCUS; colourFg = dat->hotTextColour;} + else if (Drawing->type == CLCIT_CONTACT && Drawing->flags&CONTACTF_NOTONLIST) {colourFg = dat->fontInfo[FONTID_NOTONLIST].colour; mode = ILD_BLEND50;} + { + + } + if (dat->MetaIgnoreEmptyExtra) c--; else c = iImage; + + testrc.left = clRect.right-dat->extraColumnSpacing*(dat->extraColumnsCount-c); + testrc.top = (y+((dat->rowHeight-16)>>1)); + testrc.right = testrc.left+16; + testrc.bottom = testrc.top+16; + if (!PtInRect(&testrc,pt)) + mode = ILD_NORMAL; + + ImageList_DrawEx(dat->himlExtraColumns,Drawing->iExtraImage[iImage],hdcMem,clRect.right-dat->extraColumnSpacing*(dat->extraColumnsCount-c),y+((dat->rowHeight-16)>>1),0,0,CLR_NONE,colourFg,mode); + } + } + else { + int ic = 0; + for (iImage = 0;iImageextraColumnsCount;iImage++) { + COLORREF colourFg = dat->selBkColour; + int mode = ILD_NORMAL; + int x; + + if (Drawing->iExtraImage[iImage] == 0xFF) + continue; + + if (hottrack) { + mode = ILD_FOCUS; + colourFg = dat->hotTextColour; + } + else if (Drawing->type == CLCIT_CONTACT && (Drawing->flags & CONTACTF_NOTONLIST)) { + colourFg = dat->fontInfo[FONTID_NOTONLIST].colour; + mode = ILD_BLEND50; + } + + x = (dat->leftMargin+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace-2+width); + x += 16; + x = x+dat->extraColumnSpacing*(ic); + if (iImage == dat->extraColumnsCount-1) {x = clRect.right-18;} + ImageList_DrawEx(dat->himlExtraColumns,Drawing->iExtraImage[iImage],hdcMem, + x, + y+((dat->rowHeight-16)>>1),0,0,CLR_NONE,colourFg,mode); + + ic++; + } + } + } + } + index++; + y += dat->rowHeight; + + if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->flags & CONTACTF_STATUSMSG) { + y += dat->rowHeight; + index++; + } + + //increment by subcontacts + if (group->cl.items[group->scanIndex]->subcontacts != NULL && group->cl.items[group->scanIndex]->type != CLCIT_GROUP) + if (group->cl.items[group->scanIndex]->SubExpanded) + if (subindexcl.items[group->scanIndex]->SubAllocated-1) + subindex++; + else subindex = -1; + + if (subindex == -1) { + if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && group->cl.items[group->scanIndex]->group->expanded) { + group = group->cl.items[group->scanIndex]->group; + indent++; + group->scanIndex = 0; + subindex = -1; + continue; + } + group->scanIndex++; + } + } + if (dat->iInsertionMark != -1) { //insertion mark + HBRUSH hBrush,hoBrush; + POINT pts[8]; + HRGN hRgn; + + pts[0].x = dat->leftMargin; pts[0].y = dat->iInsertionMark*dat->rowHeight-dat->yScroll-4; + pts[1].x = pts[0].x+2; pts[1].y = pts[0].y+3; + pts[2].x = clRect.right-4; pts[2].y = pts[1].y; + pts[3].x = clRect.right-1; pts[3].y = pts[0].y-1; + pts[4].x = pts[3].x; pts[4].y = pts[0].y+7; + pts[5].x = pts[2].x+1; pts[5].y = pts[1].y+2; + pts[6].x = pts[1].x; pts[6].y = pts[5].y; + pts[7].x = pts[0].x; pts[7].y = pts[4].y; + hRgn = CreatePolygonRgn(pts,SIZEOF(pts),ALTERNATE); + hBrush = CreateSolidBrush(dat->fontInfo[FONTID_CONTACTS].colour); + hoBrush = (HBRUSH)SelectObject(hdcMem,hBrush); + FillRgn(hdcMem,hRgn,hBrush); + SelectObject(hdcMem,hoBrush); + DeleteObject(hBrush); + } + if (!grey) + BitBlt(hdc,rcPaint->left,rcPaint->top,rcPaint->right-rcPaint->left,rcPaint->bottom-rcPaint->top,hdcMem,rcPaint->left,rcPaint->top,SRCCOPY); + //DeleteDC(hdcMem); + if (hBrushAlternateGrey) DeleteObject(hBrushAlternateGrey); + if (grey) { + PBYTE bits; + BITMAPINFOHEADER bmih = {0}; + int i; + int greyRed,greyGreen,greyBlue; + COLORREF greyColour; + bmih.biBitCount = 32; + bmih.biSize = sizeof(bmih); + bmih.biCompression = BI_RGB; + bmih.biHeight = -clRect.bottom; + bmih.biPlanes = 1; + bmih.biWidth = clRect.right; + bits = (PBYTE)mir_alloc(4*bmih.biWidth*-bmih.biHeight); + GetDIBits(hdc,hBmpOsb,0,clRect.bottom,bits,(BITMAPINFO*)&bmih,DIB_RGB_COLORS); + greyColour = GetSysColor(COLOR_3DFACE); + greyRed = GetRValue(greyColour)*2; + greyGreen = GetGValue(greyColour)*2; + greyBlue = GetBValue(greyColour)*2; + if (divide3[0] == 255) { + for (i = 0; i < SIZEOF(divide3); i++) divide3[i] = (i+1)/3; + } + for (i = 4*clRect.right*clRect.bottom-4;i>=0;i -= 4) { + bits[i] = divide3[bits[i]+greyBlue]; + bits[i+1] = divide3[bits[i+1]+greyGreen]; + bits[i+2] = divide3[bits[i+2]+greyRed]; + } + SetDIBitsToDevice(hdc,0,0,clRect.right,clRect.bottom,0,0,0,clRect.bottom,bits,(BITMAPINFO*)&bmih,DIB_RGB_COLORS); + mir_free(bits); + } + SelectObject(hdcMem,oldfont); + SelectObject(hdcMem,oldbmp); + DeleteObject(hBmpOsb); + DeleteDC(hdcMem); +} + +void PaintClc(HWND hwnd,struct ClcData *dat,HDC hdc,RECT *rcPaint) +{ + if (SED.cbSize == sizeof(SED)&&SED.PaintClc != NULL) { + SED.PaintClc(hwnd,dat,hdc,rcPaint,pcli->hClcProtoCount,pcli->clcProto,himlCListClc); + return; + } + InternalPaintClc(hwnd,dat,hdc,rcPaint); +} diff --git a/plugins/Clist_mw/src/clcutils.cpp b/plugins/Clist_mw/src/clcutils.cpp new file mode 100644 index 0000000000..e9253b4082 --- /dev/null +++ b/plugins/Clist_mw/src/clcutils.cpp @@ -0,0 +1,289 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 "commonheaders.h" +#include "m_clc.h" +#include "clc.h" + +//loads of stuff that didn't really fit anywhere else + +int HitTest(HWND hwnd,struct ClcData *dat,int testx,int testy,struct ClcContact **contact,struct ClcGroup **group,DWORD *flags) +{ + struct ClcContact *hitcontact; + struct ClcGroup *hitgroup; + int hit,indent,width,i,cxSmIcon; + int checkboxWidth, subident,ic = 0; + SIZE textSize; + HDC hdc; + HFONT oldfont; + RECT clRect; + DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE); + + if (flags) *flags = 0; + GetClientRect(hwnd,&clRect); + if (testx<0 || testy<0 || testy>=clRect.bottom || testx>=clRect.right) { + if (flags) { + if (testx<0) *flags |= CLCHT_TOLEFT; + else if (testx>=clRect.right) *flags |= CLCHT_TORIGHT; + if (testy<0) *flags |= CLCHT_ABOVE; + else if (testy>=clRect.bottom) *flags |= CLCHT_BELOW; + } + return -1; + } + if (testxleftMargin) { + if (flags) *flags |= CLCHT_INLEFTMARGIN|CLCHT_NOWHERE; + return -1; + } + hit = GetRowByIndex(dat ,(testy+dat->yScroll)/dat->rowHeight,&hitcontact,&hitgroup); + if (hit == -1) { + if (flags) *flags |= CLCHT_NOWHERE|CLCHT_BELOWITEMS; + return -1; + } + if (contact) *contact = hitcontact; + if (group) *group = hitgroup; + ///////// + if (hitcontact->type == CLCIT_CONTACT && hitcontact->isSubcontact) + subident = dat->rowHeight/2; + else + subident = 0; + + for (indent = 0;hitgroup->parent;indent++,hitgroup = hitgroup->parent); + if (testxleftMargin+indent*dat->groupIndent+subident) { + if (flags) *flags |= CLCHT_ONITEMINDENT; + return hit; + } + checkboxWidth = 0; + if (style&CLS_CHECKBOXES && hitcontact->type == CLCIT_CONTACT) checkboxWidth = dat->checkboxSize+2; + if (style&CLS_GROUPCHECKBOXES && hitcontact->type == CLCIT_GROUP) checkboxWidth = dat->checkboxSize+2; + if (hitcontact->type == CLCIT_INFO && hitcontact->flags&CLCIIF_CHECKBOX) checkboxWidth = dat->checkboxSize+2; + if (testxleftMargin+indent*dat->groupIndent+checkboxWidth+subident) { + if (flags) *flags |= CLCHT_ONITEMCHECK; + return hit; + } + if (testxleftMargin+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace+subident) { + if (flags) *flags |= CLCHT_ONITEMICON; + return hit; + } + + hdc = GetDC(hwnd); + GetTextExtentPoint32(hdc,hitcontact->szText,lstrlen(hitcontact->szText),&textSize); + width = textSize.cx; + + cxSmIcon = GetSystemMetrics(SM_CXSMICON); + + for (i = 0;iextraColumnsCount;i++) { + int x; + if (hitcontact->iExtraImage[i] == 0xFF) continue; + + if ((style&CLS_EX_MULTICOLUMNALIGNLEFT)) + { + x = (dat->leftMargin+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace-2+width); + x += 16; + x = x+dat->extraColumnSpacing*(ic); + if (i == dat->extraColumnsCount-1) {x = clRect.right-18;} + }else + { + int ir; + if (dat->MetaIgnoreEmptyExtra) + { + int j; + ir = 0; + for (j = i;jextraColumnsCount;j++) + if (hitcontact->iExtraImage[j] != 0xFF) + ir++; + }else + ir = dat->extraColumnsCount-i; + + x = clRect.right-dat->extraColumnSpacing*ir; + } + ic++; + + if (testx>=x && + testxtype == CLCIT_GROUP) + oldfont = (HFONT)SelectObject(hdc,dat->fontInfo[FONTID_GROUPS].hFont); + else + oldfont = (HFONT)SelectObject(hdc,dat->fontInfo[FONTID_CONTACTS].hFont); + + GetTextExtentPoint32(hdc,hitcontact->szText,lstrlen(hitcontact->szText),&textSize); + width = textSize.cx; + if (hitcontact->type == CLCIT_GROUP) { + char *szCounts = pcli->pfnGetGroupCountsText(dat,hitcontact); + if (szCounts[0]) { + GetTextExtentPoint32A(hdc," ",1,&textSize); + width += textSize.cx; + SelectObject(hdc,dat->fontInfo[FONTID_GROUPCOUNTS].hFont); + GetTextExtentPoint32A(hdc,szCounts,lstrlenA(szCounts),&textSize); + width += textSize.cx; + } + } + SelectObject(hdc,oldfont); + ReleaseDC(hwnd,hdc); + if (testxleftMargin+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace+width+4+subident) { + if (flags) *flags |= CLCHT_ONITEMLABEL; + return hit; + } + if (flags) *flags |= CLCHT_NOWHERE; + return -1; +} + +void ScrollTo(HWND hwnd,struct ClcData *dat,int desty,int noSmooth) +{ + DWORD startTick,nowTick; + int oldy = dat->yScroll; + RECT clRect,rcInvalidate; + int maxy,previousy; + + if (dat->iHotTrack != -1 && dat->yScroll != desty) { + pcli->pfnInvalidateItem(hwnd,dat,dat->iHotTrack); + dat->iHotTrack = -1; + ReleaseCapture(); + } + GetClientRect(hwnd,&clRect); + rcInvalidate = clRect; + maxy = dat->rowHeight*GetGroupContentsCount(&dat->list,2)-clRect.bottom; + if (desty>maxy) desty = maxy; + if (desty<0) desty = 0; + if (abs(desty-dat->yScroll)<4) noSmooth = 1; + if (!noSmooth && dat->exStyle&CLS_EX_NOSMOOTHSCROLLING) noSmooth = 1; + previousy = dat->yScroll; + if (!noSmooth) { + startTick = GetTickCount(); + for (;;) { + nowTick = GetTickCount(); + if (nowTick>=startTick+dat->scrollTime) break; + dat->yScroll = oldy+(desty-oldy)*(int)(nowTick-startTick)/dat->scrollTime; + if (dat->backgroundBmpUse&CLBF_SCROLL || dat->hBmpBackground == NULL) + ScrollWindowEx(hwnd,0,previousy-dat->yScroll,NULL,NULL,NULL,NULL,SW_INVALIDATE); + else + InvalidateRect(hwnd,NULL,FALSE); + previousy = dat->yScroll; + SetScrollPos(hwnd,SB_VERT,dat->yScroll,TRUE); + UpdateWindow(hwnd); + } + } + dat->yScroll = desty; + if (dat->backgroundBmpUse&CLBF_SCROLL || dat->hBmpBackground == NULL) + ScrollWindowEx(hwnd,0,previousy-dat->yScroll,NULL,NULL,NULL,NULL,SW_INVALIDATE); + else + InvalidateRect(hwnd,NULL,FALSE); + SetScrollPos(hwnd,SB_VERT,dat->yScroll,TRUE); +} + +void RecalcScrollBar(HWND hwnd,struct ClcData *dat) +{ + SCROLLINFO si = {0}; + RECT clRect; + NMCLISTCONTROL nm; + boolean sbar = FALSE; + + GetClientRect(hwnd,&clRect); + + si.cbSize = sizeof(si); + si.fMask = SIF_ALL; + si.nMin = 0; + si.nMax = dat->rowHeight*GetGroupContentsCount(&dat->list,2)-1; + si.nPage = clRect.bottom; + si.nPos = dat->yScroll; + + nm.hdr.code = CLN_LISTSIZECHANGE; + nm.hdr.hwndFrom = hwnd; + nm.hdr.idFrom = GetDlgCtrlID(hwnd); + nm.pt.y = si.nMax; + SendMessage(GetParent(hwnd),WM_NOTIFY,0,(LPARAM)&nm); + + GetClientRect(hwnd,&clRect); + si.cbSize = sizeof(si); + si.fMask = SIF_ALL; + si.nMin = 0; + si.nMax = dat->rowHeight*GetGroupContentsCount(&dat->list,2)-1; + si.nPage = clRect.bottom; + si.nPos = dat->yScroll; + + sbar = (dat->noVScrollbar == 1||(int)si.nPage>si.nMax); + + ShowScrollBar(hwnd,SB_VERT,sbar? FALSE : TRUE); + if (!sbar) { + if ( GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_CONTACTLIST ) { + if ( dat->noVScrollbar == 0 ) SetScrollInfo(hwnd,SB_VERT,&si,TRUE); + else SetScrollInfo(hwnd,SB_VERT,&si,FALSE); + } + else SetScrollInfo(hwnd,SB_VERT,&si,TRUE); + } + ScrollTo(hwnd,dat,dat->yScroll,1); +} + +void CalcEipPosition( struct ClcData *dat, struct ClcContact *contact, struct ClcGroup *group, POINT *result) +{ + int indent; + for (indent = 0; group->parent; indent++, group = group->parent); + result->x = indent * dat->groupIndent + dat->iconXSpace - 2; + result->y = dat->selection * dat->rowHeight - dat->yScroll; + + if (contact->type == CLCIT_CONTACT && contact->isSubcontact) + result->x += dat->rowHeight/2; +} + +void GetDefaultFontSetting(int i,LOGFONT *lf,COLORREF *colour) +{ + SystemParametersInfo(SPI_GETICONTITLELOGFONT,sizeof(LOGFONT),lf,FALSE); + *colour = GetSysColor(COLOR_WINDOWTEXT); + switch(i) { + case FONTID_GROUPS: + lf->lfWeight = FW_BOLD; + break; + case FONTID_GROUPCOUNTS: + lf->lfHeight = (int)(lf->lfHeight*.75); + *colour = GetSysColor(COLOR_3DSHADOW); + break; + case FONTID_OFFINVIS: + case FONTID_INVIS: + lf->lfItalic = !lf->lfItalic; + break; + case FONTID_DIVIDERS: + lf->lfHeight = (int)(lf->lfHeight*.75); + break; + case FONTID_NOTONLIST: + *colour = GetSysColor(COLOR_3DSHADOW); + break; +} } + +extern void ( *saveLoadClcOptions )(HWND hwnd,struct ClcData *dat); + +void LoadClcOptions(HWND hwnd,struct ClcData *dat) +{ + int i; + + dat->style = GetWindowLongPtr(hwnd,GWL_STYLE); + dat->MetaIgnoreEmptyExtra = DBGetContactSettingByte(NULL,"CLC","MetaIgnoreEmptyExtra",1); + saveLoadClcOptions( hwnd, dat ); + + for (i = 0; i <= FONTID_MAX; i++) + if (dat->fontInfo[i].fontHeight > dat->rowHeight) + dat->rowHeight = dat->fontInfo[i].fontHeight; +} diff --git a/plugins/Clist_mw/src/clist.h b/plugins/Clist_mw/src/clist.h new file mode 100644 index 0000000000..20c8a7ce80 --- /dev/null +++ b/plugins/Clist_mw/src/clist.h @@ -0,0 +1,55 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 _CLIST_H_ +#define _CLIST_H_ + +void LoadContactTree(void); +int ExtIconFromStatusMode(HANDLE hContact, const char *szProto,int status); +HTREEITEM GetTreeItemByHContact(HANDLE hContact); +void TrayIconUpdateWithImageList(int iImage,const char *szNewTip,char *szPreferredProto); +void SortContacts(void); +void ChangeContactIcon(HANDLE hContact,int iIcon,int add); +int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status); + +struct displayNameCacheEntry : public ClcCacheEntryBase +{ + int noHiddenOffline; + + char *szProto; + boolean protoNotExists; + int status; + + int i; + int ApparentMode; + int NotOnList; + int IdleTS; + void *ClcContact; + BYTE IsExpanded; + boolean isUnknown; +}; + +typedef displayNameCacheEntry *pdisplayNameCacheEntry; + +pdisplayNameCacheEntry GetContactFullCacheEntry(HANDLE hContact); + +#endif \ No newline at end of file diff --git a/plugins/Clist_mw/src/clistmenus.cpp b/plugins/Clist_mw/src/clistmenus.cpp new file mode 100644 index 0000000000..db84dca927 --- /dev/null +++ b/plugins/Clist_mw/src/clistmenus.cpp @@ -0,0 +1,60 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2006 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 "commonheaders.h" +#pragma hdrstop + +static HMENU hMainMenu, hMainStatusMenu; + +void DestroyTrayMenu(HMENU hMenu) +{ + int i, cnt; + + cnt = GetMenuItemCount(hMenu); + for (i = 0; ihwndContactList); + + return 0; +} + +int InitCustomMenus(void) +{ + CreateServiceFunction("CloseAction",CloseAction); + hMainStatusMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); + hMainMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0); + + return 0; +} + +void UninitCustomMenus(void) +{ +} diff --git a/plugins/Clist_mw/src/clistmod.cpp b/plugins/Clist_mw/src/clistmod.cpp new file mode 100644 index 0000000000..5f769427f8 --- /dev/null +++ b/plugins/Clist_mw/src/clistmod.cpp @@ -0,0 +1,153 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 "commonheaders.h" + +extern int DefaultImageListColorDepth; + +int InitCustomMenus(void); +void UninitCustomMenus(void); +int ContactSettingChanged(WPARAM wParam,LPARAM lParam); +int CListOptInit(WPARAM wParam,LPARAM lParam); +INT_PTR ContactChangeGroup(WPARAM wParam,LPARAM lParam); +INT_PTR HotkeysProcessMessage(WPARAM wParam,LPARAM lParam) { return pcli->pfnHotkeysProcessMessage(wParam, lParam); } +void InitTrayMenus(void); + +HIMAGELIST hCListImages; + +HANDLE hContactIconChangedEvent; +extern BYTE nameOrder[]; + +static HANDLE hSettingChanged, hProtoAckHook; + +/////////// End by FYR //////// +int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact) +{ + int result = -1; + if (hContact && szProto) { + char * szActProto = (char*)szProto; + char AdvancedService[255] = {0}; + int nActStatus = nStatus; + HANDLE hActContact = hContact; + if (!DBGetContactSettingByte(NULL,"CLC","Meta",0) && !strcmp(szActProto,"MetaContacts")) { + // substitute params by mostonline contact datas + HANDLE hMostOnlineContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hActContact,0); + if (hMostOnlineContact && hMostOnlineContact != (HANDLE)CALLSERVICE_NOTFOUND) { + pdisplayNameCacheEntry cacheEntry; + cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hMostOnlineContact); + if (cacheEntry && cacheEntry->szProto) { + szActProto = cacheEntry->szProto; + nActStatus = cacheEntry->status; + hActContact = hMostOnlineContact; + } + } + } + _snprintf(AdvancedService,sizeof(AdvancedService),"%s%s",szActProto,"/GetAdvancedStatusIcon"); + + if (ServiceExists(AdvancedService)) + result = CallService(AdvancedService,(WPARAM)hActContact, (LPARAM)0); + + if (result == -1 || !(LOWORD(result))) + // result == -1 means no Advanced icon. LOWORD(result) == 0 happens when Advanced icon returned by ICQ (i.e. no transpot) + result = saveIconFromStatusMode(szActProto,nActStatus,NULL); + } + else result = saveIconFromStatusMode(szProto,nStatus,NULL); + return result; +} + + +////////// By FYR///////////// +int ExtIconFromStatusMode(HANDLE hContact, const char *szProto,int status) +{ +/* if ( DBGetContactSettingByte( NULL, "CLC", "Meta", 0 ) == 1 ) + return pcli->pfnIconFromStatusMode(szProto,status,hContact); + + if ( szProto != NULL ) { + if (strcmp(szProto,"MetaContacts") == 0 ) { + hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(UINT)hContact,0); + if ( hContact != 0 ) { + szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(UINT)hContact,0); + status = DBGetContactSettingWord(hContact,szProto,"Status",ID_STATUS_OFFLINE); + } + } + }*/ + + return pcli->pfnIconFromStatusMode(szProto,status,hContact); +} + +/////////// End by FYR //////// + +static int ProtocolAck(WPARAM wParam,LPARAM lParam) +{ + ACKDATA *ack = (ACKDATA*)lParam; + if (ack->type == ACKTYPE_AWAYMSG && ack->lParam) { + DBVARIANT dbv; + if (!DBGetContactSettingTString(ack->hContact, "CList", "StatusMsg", &dbv)) { + if ( !_tcscmp(dbv.ptszVal, (TCHAR *)ack->lParam)) { + DBFreeVariant(&dbv); + return 0; + } + DBFreeVariant(&dbv); + } + if ( DBGetContactSettingByte(NULL,"CList","ShowStatusMsg",0) || DBGetContactSettingByte(ack->hContact,"CList","StatusMsgAuto",0)) + DBWriteContactSettingTString(ack->hContact, "CList", "StatusMsg", (TCHAR *)ack->lParam); + } + + return 0; +} + +static INT_PTR GetStatusMode(WPARAM wParam, LPARAM lParam) +{ + return pcli->currentDesiredStatusMode; +} + +static int ContactListShutdownProc(WPARAM wParam,LPARAM lParam) +{ + UnhookEvent(hProtoAckHook); + UninitCustomMenus(); + return 0; +} + +int LoadContactListModule(void) +{ + HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); + while (hContact != NULL) { + DBWriteContactSettingString(hContact, "CList", "StatusMsg", ""); + hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); + } + + hCListImages = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0); + DefaultImageListColorDepth = DBGetContactSettingDword(NULL,"CList","DefaultImageListColorDepth",ILC_COLOR32); + + hProtoAckHook = (HANDLE) HookEvent(ME_PROTO_ACK, ProtocolAck); + HookEvent(ME_OPT_INITIALISE,CListOptInit); + HookEvent(ME_SYSTEM_SHUTDOWN,ContactListShutdownProc); + hSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED,ContactSettingChanged); + hContactIconChangedEvent = CreateHookableEvent(ME_CLIST_CONTACTICONCHANGED); + CreateServiceFunction(MS_CLIST_CONTACTCHANGEGROUP,ContactChangeGroup); + CreateServiceFunction(MS_CLIST_HOTKEYSPROCESSMESSAGE,HotkeysProcessMessage); + CreateServiceFunction(MS_CLIST_GETSTATUSMODE, GetStatusMode); + + InitCustomMenus(); + InitTrayMenus(); + return 0; +} diff --git a/plugins/Clist_mw/src/clistopts.cpp b/plugins/Clist_mw/src/clistopts.cpp new file mode 100644 index 0000000000..b845c5a0a0 --- /dev/null +++ b/plugins/Clist_mw/src/clistopts.cpp @@ -0,0 +1,243 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 "commonheaders.h" +#include "m_clui.h" +#include "clist.h" +#include "m_clc.h" + +int HotKeysRegister(HWND hwnd); +void HotKeysUnregister(HWND hwnd); +void LoadContactTree(void); +void SortContacts(void); + +static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + +static UINT expertOnlyControls[] = {IDC_ALWAYSSTATUS}; +int CListOptInit(WPARAM wParam,LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp; + + ZeroMemory(&odp,sizeof(odp)); + odp.cbSize = sizeof(odp); + odp.position = -1000000000; + odp.hInstance = g_hInst; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLIST); + odp.pszTitle = LPGEN("Contact List"); + odp.pfnDlgProc = DlgProcGenOpts; + odp.flags = ODPF_BOLDGROUPS; + odp.nIDBottomSimpleControl = IDC_STCLISTGROUP; + odp.expertOnlyControls = expertOnlyControls; + odp.nExpertOnlyControls = sizeof(expertOnlyControls)/sizeof(expertOnlyControls[0]); + Options_AddPage(wParam, &odp); + return 0; +} + +static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_USER+1: + { + HANDLE hContact = (HANDLE)wParam; + DBCONTACTWRITESETTING * ws = (DBCONTACTWRITESETTING *)lParam; + if ( hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL + && lstrcmpiA(ws->szModule,"CList") == 0 && lstrcmpiA(ws->szSetting,"UseGroups") == 0 + && IsWindowVisible(hwndDlg)) { + CheckDlgButton(hwndDlg,IDC_DISABLEGROUPS,ws->value.bVal == 0); + } + break; + } + case WM_DESTROY: + { + UnhookEvent( (HANDLE)GetWindowLongPtr(hwndDlg,GWLP_USERDATA)); + break; + } + + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED,hwndDlg,WM_USER+1)); + + CheckDlgButton(hwndDlg,IDC_GAMMACORRECT,DBGetContactSettingByte(NULL,"CLC","GammaCorrect",CLCDEFAULT_GAMMACORRECT)?BST_CHECKED:BST_UNCHECKED); + + SendDlgItemMessage(hwndDlg,IDC_ROWHEIGHTSPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_ROWHEIGHT),0); + SendDlgItemMessage(hwndDlg,IDC_ROWHEIGHTSPIN,UDM_SETRANGE,0,MAKELONG(255,0)); + SendDlgItemMessage(hwndDlg,IDC_ROWHEIGHTSPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingByte(NULL,"CLC","RowHeight",CLCDEFAULT_ROWHEIGHT),0)); + + CheckDlgButton(hwndDlg, IDC_ONTOP, DBGetContactSettingByte(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, DBGetContactSettingByte(NULL,"CList","HideEmptyGroups",SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, DBGetContactSettingByte(NULL,"CList","UseGroups",SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED); + CheckDlgButton(hwndDlg, IDC_SORTBYNAME, + !DBGetContactSettingByte(NULL,"CList","SortByStatus",SETTING_SORTBYSTATUS_DEFAULT) && + !DBGetContactSettingByte(NULL,"CList","SortByProto",SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + + CheckDlgButton(hwndDlg, IDC_SORTBYSTATUS, DBGetContactSettingByte(NULL,"CList","SortByStatus",SETTING_SORTBYSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_NOOFFLINEMOVE, DBGetContactSettingByte(NULL,"CList","NoOfflineBottom",SETTING_NOOFFLINEBOTTOM_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + + CheckDlgButton(hwndDlg, IDC_SORTBYPROTO, DBGetContactSettingByte(NULL,"CList","SortByProto",SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, DBGetContactSettingByte(NULL,"CList","ConfirmDelete",SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AUTOHIDE, DBGetContactSettingByte(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIME),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); + EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); + { DWORD caps = CallService(MS_CLUI_GETCAPS,CLUICAPS_FLAGS1,0); + if (!(caps&CLUIF_HIDEEMPTYGROUPS)) ShowWindow(GetDlgItem(hwndDlg,IDC_HIDEEMPTYGROUPS),SW_HIDE); + if (!(caps&CLUIF_DISABLEGROUPS)) ShowWindow(GetDlgItem(hwndDlg,IDC_DISABLEGROUPS),SW_HIDE); + if (caps&CLUIF_HASONTOPOPTION) ShowWindow(GetDlgItem(hwndDlg,IDC_ONTOP),SW_HIDE); + if (caps&CLUIF_HASAUTOHIDEOPTION) { + ShowWindow(GetDlgItem(hwndDlg,IDC_AUTOHIDE),SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg,IDC_HIDETIME),SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN),SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg,IDC_STAUTOHIDESECS),SW_HIDE); + } + } + SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETRANGE,0,MAKELONG(900,1)); + SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),0)); + CheckDlgButton(hwndDlg, IDC_ONECLK, DBGetContactSettingByte(NULL,"CList","Tray1Click",SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, DBGetContactSettingByte(NULL,"CList","AlwaysStatus",SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI, !DBGetContactSettingByte(NULL,"CList","AlwaysMulti",SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DONTCYCLE, DBGetContactSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CYCLE, DBGetContactSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_MULTITRAY, DBGetContactSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, DBGetContactSettingByte(NULL,"CList","DisableTrayFlash",0) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ICONBLINK, DBGetContactSettingByte(NULL,"CList","NoIconBlink",0) == 1 ? BST_CHECKED : BST_UNCHECKED ); + + if (IsDlgButtonChecked(hwndDlg,IDC_DONTCYCLE)) { + EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIMESPIN),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIME),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_ALWAYSMULTI),FALSE); + } + if (IsDlgButtonChecked(hwndDlg,IDC_CYCLE)) { + EnableWindow(GetDlgItem(hwndDlg,IDC_PRIMARYSTATUS),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_ALWAYSMULTI),FALSE); + } + if (IsDlgButtonChecked(hwndDlg,IDC_MULTITRAY)) { + EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIMESPIN),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIME),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_PRIMARYSTATUS),FALSE); + } + SendDlgItemMessage(hwndDlg,IDC_CYCLETIMESPIN,UDM_SETRANGE,0,MAKELONG(120,1)); + SendDlgItemMessage(hwndDlg,IDC_CYCLETIMESPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"CList","CycleTime",SETTING_CYCLETIME_DEFAULT),0)); + { int i,count,item; + PROTOACCOUNT **accs; + DBVARIANT dbv = {DBVT_DELETED}; + DBGetContactSettingString(NULL,"CList","PrimaryStatus",&dbv); + ProtoEnumAccounts( &count, &accs ); + item = SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_ADDSTRING,0,(LPARAM)TranslateT("Global")); + SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_SETITEMDATA,item,(LPARAM)0); + for ( i = 0; i < count; i++ ) { + if ( !IsAccountEnabled( accs[i] ) || CallProtoService( accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0 ) == 0 ) + continue; + + item = SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_ADDSTRING,0,(LPARAM)accs[i]->tszAccountName); + SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_SETITEMDATA,item,(LPARAM)accs[i] ); + if ( dbv.type == DBVT_ASCIIZ && !lstrcmpA( dbv.pszVal, accs[i]->szModuleName )) + SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_SETCURSEL,item,0); + } + } + if (-1 == (int)SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_GETCURSEL,0,0)) + SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_SETCURSEL,0,0); + SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_BLINKTIME),0); // set buddy + SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_SETRANGE,0,MAKELONG(0x3FFF,250)); + SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"CList","IconFlashTime",550),0)); + return TRUE; + case WM_VSCROLL: + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_AUTOHIDE: + EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIME),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); + EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); + break; + case IDC_DONTCYCLE: + case IDC_CYCLE: + case IDC_MULTITRAY: + EnableWindow(GetDlgItem(hwndDlg,IDC_PRIMARYSTATUS),IsDlgButtonChecked(hwndDlg,IDC_DONTCYCLE)); + EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIME),IsDlgButtonChecked(hwndDlg,IDC_CYCLE)); + EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIMESPIN),IsDlgButtonChecked(hwndDlg,IDC_CYCLE)); + EnableWindow(GetDlgItem(hwndDlg,IDC_ALWAYSMULTI),IsDlgButtonChecked(hwndDlg,IDC_MULTITRAY)); + break; + case IDC_ROWHEIGHT: + if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0; + break; + } + if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_CYCLETIME) && HIWORD(wParam) != EN_CHANGE) break; + if (LOWORD(wParam) == IDC_PRIMARYSTATUS && HIWORD(wParam) != CBN_SELCHANGE) break; + if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_CYCLETIME) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; + if (LOWORD(wParam) == IDC_BLINKTIME && HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0; // dont make apply enabled during buddy set crap + + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case WM_NOTIFY: + switch (((LPNMHDR)lParam)->idFrom) { + case 0: + switch (((LPNMHDR)lParam)->code) + { + case PSN_APPLY: + DBWriteContactSettingByte(NULL,"CList","HideOffline",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDEOFFLINE)); + { DWORD caps = CallService(MS_CLUI_GETCAPS,CLUICAPS_FLAGS1,0); + if (caps&CLUIF_HIDEEMPTYGROUPS) DBWriteContactSettingByte(NULL,"CList","HideEmptyGroups",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDEEMPTYGROUPS)); + if (caps&CLUIF_DISABLEGROUPS) DBWriteContactSettingByte(NULL,"CList","UseGroups",(BYTE)!IsDlgButtonChecked(hwndDlg,IDC_DISABLEGROUPS)); + if (!(caps&CLUIF_HASONTOPOPTION)) { + DBWriteContactSettingByte(NULL,"CList","OnTop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONTOP)); + SetWindowPos(pcli->hwndContactList,IsDlgButtonChecked(hwndDlg,IDC_ONTOP)?HWND_TOPMOST:HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + } + if (!(caps&CLUIF_HASAUTOHIDEOPTION)) { + DBWriteContactSettingByte(NULL,"CList","AutoHide",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); + DBWriteContactSettingWord(NULL,"CList","HideTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_GETPOS,0,0)); + } + } + DBWriteContactSettingByte(NULL,"CList","SortByStatus",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SORTBYSTATUS)); + DBWriteContactSettingByte(NULL,"CList","SortByProto",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SORTBYPROTO)); + DBWriteContactSettingByte(NULL,"CList","NoOfflineBottom",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_NOOFFLINEMOVE)); + DBWriteContactSettingByte(NULL,"CLC","RowHeight",(BYTE)SendDlgItemMessage(hwndDlg,IDC_ROWHEIGHTSPIN,UDM_GETPOS,0,0)); + DBWriteContactSettingByte(NULL,"CLC","GammaCorrect",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_GAMMACORRECT)); + + DBWriteContactSettingByte(NULL,"CList","ConfirmDelete",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CONFIRMDELETE)); + DBWriteContactSettingByte(NULL,"CList","Tray1Click",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONECLK)); + DBWriteContactSettingByte(NULL,"CList","AlwaysStatus",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ALWAYSSTATUS)); + DBWriteContactSettingByte(NULL,"CList","AlwaysMulti",(BYTE)!IsDlgButtonChecked(hwndDlg,IDC_ALWAYSMULTI)); + DBWriteContactSettingByte(NULL,"CList","TrayIcon",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_DONTCYCLE)?SETTING_TRAYICON_SINGLE:(IsDlgButtonChecked(hwndDlg,IDC_CYCLE)?SETTING_TRAYICON_CYCLE:SETTING_TRAYICON_MULTI))); + DBWriteContactSettingWord(NULL,"CList","CycleTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_CYCLETIMESPIN,UDM_GETPOS,0,0)); + DBWriteContactSettingWord(NULL,"CList","IconFlashTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_GETPOS,0,0)); + DBWriteContactSettingByte(NULL,"CList","DisableTrayFlash",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DISABLEBLINK)); + DBWriteContactSettingByte(NULL,"CList","NoIconBlink", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_ICONBLINK)); + { + int cursel = SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_GETCURSEL,0,0); + PROTOACCOUNT* pa = (PROTOACCOUNT*)SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_GETITEMDATA,cursel,0); + if ( pa == NULL ) + DBDeleteContactSetting(NULL, "CList","PrimaryStatus"); + else + DBWriteContactSettingString(NULL,"CList","PrimaryStatus", pa->szModuleName); + } + pcli->pfnTrayIconIconsChanged(); + LoadContactTree(); /* this won't do job properly since it only really works when changes happen */ + SendMessage(pcli->hwndContactTree,CLM_AUTOREBUILD,0,0); /* force reshuffle */ + return TRUE; + } + break; + } + break; + } + return FALSE; +} diff --git a/plugins/Clist_mw/src/clistsettings.cpp b/plugins/Clist_mw/src/clistsettings.cpp new file mode 100644 index 0000000000..f18a4452f2 --- /dev/null +++ b/plugins/Clist_mw/src/clistsettings.cpp @@ -0,0 +1,374 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 "commonheaders.h" +#include "m_clui.h" +#include "m_clc.h" +#include "clist.h" + +TCHAR *GetNameForContact(HANDLE hContact,int flag,boolean *isUnknown); +char *GetProtoForContact(HANDLE hContact); +int GetStatusForContact(HANDLE hContact,char *szProto); +TCHAR *UnknownConctactTranslatedName; +extern boolean OnModulesLoadedCalled; +void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,pdisplayNameCacheEntry pdnce,int SettingType); + +static int handleCompare( displayNameCacheEntry* c1, displayNameCacheEntry* c2 ) +{ + return (char*)c1->hContact - (char*)c2->hContact; +} + +void InitDisplayNameCache(SortedList *list) +{ + int i, idx; + HANDLE hContact; + + memset(list,0,sizeof(SortedList)); + list->sortFunc = (FSortFunc)handleCompare; + list->increment = CallService(MS_DB_CONTACT_GETCOUNT,0,0)+1; + + hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); + i = 0; + while (hContact != 0) + { + displayNameCacheEntry *pdnce = (pdisplayNameCacheEntry)mir_calloc(sizeof(displayNameCacheEntry)); + pdnce->hContact = hContact; + InvalidateDisplayNameCacheEntryByPDNE(hContact,pdnce,0); + List_GetIndex(list,pdnce,&idx); + List_Insert(list,pdnce,idx); + hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0); + i++; +} } + +void FreeDisplayNameCacheItem(ClcCacheEntryBase *_p) +{ + pdisplayNameCacheEntry p = (pdisplayNameCacheEntry)_p; + if ( p->tszName) { mir_free(p->tszName); p->tszName = NULL; } + if ( p->szProto) { mir_free(p->szProto); p->szProto = NULL; } + if ( p->tszGroup) { mir_free(p->tszGroup); p->tszGroup = NULL; } +} + +void FreeDisplayNameCache(SortedList *list) +{ + int i; + + for ( i = 0; i < list->realCount; i++) { + FreeDisplayNameCacheItem((ClcCacheEntryBase*)list->items[i] ); + mir_free(list->items[i]); + } + + List_Destroy(list); +} + +void CheckPDNCE(ClcCacheEntryBase *_pdnce) +{ + pdisplayNameCacheEntry pdnce = (pdisplayNameCacheEntry)_pdnce; + if (pdnce == NULL) + return; + + if (pdnce->szProto == NULL && pdnce->protoNotExists == FALSE) { + pdnce->szProto = GetProtoForContact(pdnce->hContact); + if (pdnce->szProto == NULL) + pdnce->protoNotExists = FALSE; + else { + if (CallService(MS_PROTO_ISPROTOCOLLOADED,0,(LPARAM)pdnce->szProto) == 0) + pdnce->protoNotExists = TRUE; + else { + if ( pdnce->szProto && pdnce->tszName ) { + mir_free(pdnce->tszName); + pdnce->tszName = NULL; + } } } } + + if (pdnce->tszName == NULL) + { + if (pdnce->protoNotExists) + pdnce->tszName = mir_tstrdup(TranslateT("_NoProtocol_")); + else { + if (OnModulesLoadedCalled) + pdnce->tszName = GetNameForContact(pdnce->hContact,0,&pdnce->isUnknown); + else + pdnce->tszName = GetNameForContact(pdnce->hContact,0,NULL); + } + } + else { + if (pdnce->isUnknown&&pdnce->szProto&&pdnce->protoNotExists == TRUE&&OnModulesLoadedCalled) { + pdnce->protoNotExists = FALSE; + mir_free(pdnce->tszName); + pdnce->tszName = GetNameForContact(pdnce->hContact,0,&pdnce->isUnknown); + } } + + if (pdnce->status == 0) + pdnce->status = GetStatusForContact(pdnce->hContact,pdnce->szProto); + + if (pdnce->tszGroup == NULL) + { + DBVARIANT dbv; + + if (!DBGetContactSettingTString(pdnce->hContact,"CList","Group",&dbv)) + { + pdnce->tszGroup = mir_tstrdup(dbv.ptszVal); + mir_free(dbv.pszVal); + } + else pdnce->tszGroup = mir_tstrdup( _T("")); + } + + if (pdnce->bIsHidden == -1) + pdnce->bIsHidden = DBGetContactSettingByte(pdnce->hContact,"CList","bIsHidden",0); + + if (pdnce->noHiddenOffline == -1) + pdnce->noHiddenOffline = DBGetContactSettingByte(pdnce->hContact,"CList","noOffline",0); + + if ( pdnce->IdleTS == -1 ) + pdnce->IdleTS = DBGetContactSettingDword(pdnce->hContact,pdnce->szProto,"IdleTS",0); + + if (pdnce->ApparentMode == -1) + pdnce->ApparentMode = DBGetContactSettingWord(pdnce->hContact,pdnce->szProto,"ApparentMode",0); + + if (pdnce->NotOnList == -1) + pdnce->NotOnList = DBGetContactSettingByte(pdnce->hContact,"CList","NotOnList",0); + + if (pdnce->IsExpanded == -1) + pdnce->IsExpanded = DBGetContactSettingByte(pdnce->hContact,"CList","Expanded",0); +} + +void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,pdisplayNameCacheEntry pdnce,int SettingType) +{ + if ( hContact == NULL || pdnce == NULL ) + return; + + if ( SettingType == -1 || SettingType == DBVT_DELETED ) + { + mir_free(pdnce->tszName); + pdnce->tszName = NULL; + mir_free(pdnce->tszGroup); + pdnce->tszGroup = NULL; + + pdnce->bIsHidden = -1; + pdnce->protoNotExists = FALSE; + mir_free(pdnce->szProto); + pdnce->szProto = NULL; + pdnce->status = 0; + pdnce->IdleTS = -1; + pdnce->ApparentMode = -1; + pdnce->NotOnList = -1; + pdnce->isUnknown = FALSE; + pdnce->noHiddenOffline = -1; + pdnce->IsExpanded = -1; + return; + } + + if (SettingType >= DBVT_WCHAR) + { + mir_free(pdnce->tszName); + pdnce->tszName = NULL; + mir_free(pdnce->tszGroup); + pdnce->tszGroup = NULL; + mir_free(pdnce->szProto); + pdnce->szProto = NULL; + return; + } + + // in other cases clear all binary cache + pdnce->bIsHidden = -1; + pdnce->protoNotExists = FALSE; + pdnce->status = 0; + pdnce->IdleTS = -1; + pdnce->ApparentMode = -1; + pdnce->NotOnList = -1; + pdnce->isUnknown = FALSE; + pdnce->noHiddenOffline = -1; + pdnce->IsExpanded = -1; +} + +char *GetContactCachedProtocol(HANDLE hContact) +{ + pdisplayNameCacheEntry cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact); + if (cacheEntry&&cacheEntry->szProto) + return cacheEntry->szProto; + + return NULL; +} + +char *GetProtoForContact(HANDLE hContact) +{ + DBVARIANT dbv; + DBCONTACTGETSETTING dbcgs; + char name[32]; + + dbv.type = DBVT_ASCIIZ; + dbv.pszVal = name; + dbv.cchVal = SIZEOF(name); + dbcgs.pValue = &dbv; + dbcgs.szModule = "Protocol"; + dbcgs.szSetting = "p"; + if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC,(WPARAM)hContact,(LPARAM)&dbcgs)) return NULL; + return mir_strdup(dbcgs.pValue->pszVal); +} + +int GetStatusForContact(HANDLE hContact,char *szProto) +{ + int status = ID_STATUS_OFFLINE; + if (szProto) + status = DBGetContactSettingWord((HANDLE)hContact,szProto,"Status",ID_STATUS_OFFLINE); + + return (status); +} + +TCHAR* GetNameForContact(HANDLE hContact,int flag,boolean *isUnknown) +{ + TCHAR* result = pcli->pfnGetContactDisplayName(hContact, flag | GCDNF_NOCACHE); + + if (isUnknown) { + if (UnknownConctactTranslatedName == NULL) + UnknownConctactTranslatedName = TranslateT("(Unknown Contact)"); + + *isUnknown = lstrcmp(result ,UnknownConctactTranslatedName) == 0; + } + + return result; +} + +pdisplayNameCacheEntry GetContactFullCacheEntry(HANDLE hContact) +{ + pdisplayNameCacheEntry cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact); + if (cacheEntry != NULL) + return(cacheEntry); + + return NULL; +} + +int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status) +{ + pdisplayNameCacheEntry cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact); + if (cacheEntry != NULL) + { + if (Proto != NULL) *Proto = cacheEntry->szProto; + if (Name != NULL) *Name = cacheEntry->tszName; + if (Status != NULL) *Status = cacheEntry->status; + } + return 0; +} + +int GetContactCachedStatus(HANDLE hContact) +{ + pdisplayNameCacheEntry cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact); + if (cacheEntry&&cacheEntry->status != 0) return cacheEntry->status; + return 0; +} + +int ContactSettingChanged(WPARAM wParam,LPARAM lParam) +{ + DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; + pdisplayNameCacheEntry pdnce; + + // Early exit + if ((HANDLE)wParam == NULL) + return 0; + + __try + { + pdnce = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry((HANDLE)wParam); + if (pdnce == NULL) + { + OutputDebugStringA("!!! Very bad pdnce not found."); + return 0; + } + + if (pdnce && pdnce->protoNotExists == FALSE && pdnce->szProto) + { + if (!strcmp(cws->szModule,pdnce->szProto)) + { + InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); + + if (cws->value.type == DBVT_WORD&&!strcmp(cws->szSetting, "Status")) { + if (!(pdnce->bIsHidden == 1)) { + + if (DBGetContactSettingByte((HANDLE)NULL,"CList","ShowStatusMsg",0)||DBGetContactSettingByte((HANDLE)wParam,"CList","StatusMsgAuto",0)) + DBWriteContactSettingString((HANDLE)wParam, "CList", "StatusMsg", ""); + + if (DBGetContactSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) { + // User's state is changing, and we are hideOffline-ing + + if (cws->value.wVal == ID_STATUS_OFFLINE) { + ChangeContactIcon((HANDLE)wParam, ExtIconFromStatusMode((HANDLE)wParam,cws->szModule, cws->value.wVal), 0); //by FYR + return 0; + } + ChangeContactIcon((HANDLE)wParam, ExtIconFromStatusMode((HANDLE)wParam,cws->szModule, cws->value.wVal), 0); //by FYR + } + else + { + ChangeContactIcon((HANDLE)wParam, ExtIconFromStatusMode((HANDLE)wParam,cws->szModule, cws->value.wVal), 0); //by FYR + } + } + } + else if (!strcmp(cws->szModule,"MetaContacts")) + { + PostMessage(pcli->hwndContactTree,CLM_AUTOREBUILD,0,0); + return 0; + } + else return 0; + + SortContacts(); + } } + + if (!strcmp(cws->szModule,"CList")) { + /* + sprintf(buf,"CHANGE: module:CList setting:%s %s\r\n",cws->szSetting,cws->value.pszVal); + OutputDebugStringA(buf); + */ + + //name is null or (setting is myhandle) + if (pdnce->tszName == NULL||(!strcmp(cws->szSetting,"MyHandle"))) + InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); + + if ((!strcmp(cws->szSetting,"Group"))) + InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); + + if (!strcmp(cws->szSetting,"bIsHidden")) { + InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); + if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0) { + char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0); + ChangeContactIcon((HANDLE)wParam,ExtIconFromStatusMode((HANDLE)wParam,szProto,szProto == NULL?ID_STATUS_OFFLINE:DBGetContactSettingWord((HANDLE)wParam,szProto,"Status",ID_STATUS_OFFLINE)),1); //by FYR + } } + + if (!strcmp(cws->szSetting,"noOffline")) + InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); + } + + if (!strcmp(cws->szModule,"Protocol")) { + if (!strcmp(cws->szSetting,"p")) { + char *szProto; + + OutputDebugStringA("CHANGE: proto\r\n"); + InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); + if (cws->value.type == DBVT_DELETED) szProto = NULL; + else szProto = cws->value.pszVal; + ChangeContactIcon((HANDLE)wParam,ExtIconFromStatusMode((HANDLE)wParam,szProto,szProto == NULL?ID_STATUS_OFFLINE:DBGetContactSettingWord((HANDLE)wParam,szProto,"Status",ID_STATUS_OFFLINE)),0); //by FYR + } + } + } + __except (exceptFunction(GetExceptionInformation())) + { + } + + return 0; +} diff --git a/plugins/Clist_mw/src/clisttray.cpp b/plugins/Clist_mw/src/clisttray.cpp new file mode 100644 index 0000000000..d0e6e3ae93 --- /dev/null +++ b/plugins/Clist_mw/src/clisttray.cpp @@ -0,0 +1,281 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 "commonheaders.h" +#include "m_clui.h" + +#define TIM_CALLBACK (WM_USER+1857) +#define TIM_CREATE (WM_USER+1858) + +extern INT_PTR ( *saveTrayIconProcessMessage )(WPARAM wParam,LPARAM lParam); +void DestroyTrayMenu(HMENU hMenu); + +INT_PTR TrayIconProcessMessage(WPARAM wParam,LPARAM lParam) +{ + MSG *msg = (MSG*)wParam; + switch(msg->message) { + case WM_DRAWITEM: + return CallService(MS_CLIST_MENUDRAWITEM,msg->wParam,msg->lParam); + break; + case WM_MEASUREITEM: + return CallService(MS_CLIST_MENUMEASUREITEM,msg->wParam,msg->lParam); + break; + case TIM_CALLBACK: + if (msg->lParam == WM_RBUTTONUP) + { + POINT pt; + HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDTRAY,(WPARAM)0,(LPARAM)0); + + SetForegroundWindow(msg->hwnd); + SetFocus(msg->hwnd); + GetCursorPos(&pt); + TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN, pt.x, pt.y, 0, msg->hwnd, NULL); + DestroyTrayMenu(hMenu); + } + else break; + + *((LRESULT*)lParam) = 0; + return TRUE; + } + + return saveTrayIconProcessMessage( wParam, lParam ); +} + +//////////////////////////////TRAY MENU///////////////////////// +HANDLE hTrayMenuObject; + +HANDLE hTrayMainMenuItemProxy; +HANDLE hHideShowMainMenuItem; +HANDLE hTrayStatusMenuItemProxy; +HANDLE hPreBuildTrayMenuEvent; + +//traymenu exec param(ownerdata) +typedef struct{ +char *szServiceName; +INT_PTR Param1; +}TrayMenuExecParam,*lpTrayMenuExecParam; + +/* +wparam = handle to the menu item returned by MS_CLIST_ADDCONTACTMENUITEM +return 0 on success. +*/ +static INT_PTR RemoveTrayMenuItem(WPARAM wParam,LPARAM lParam) +{ + CallService(MO_REMOVEMENUITEM,wParam,0); + return 0; +} + +static INT_PTR BuildTrayMenu(WPARAM wParam,LPARAM lParam) +{ + int tick; + HMENU hMenu; + ListParam param = { 0 }; + param.MenuObjectHandle = hTrayMenuObject; + + //hMenu = hMainMenu; + hMenu = CreatePopupMenu(); + //hMenu = wParam; + tick = GetTickCount(); + + NotifyEventHooks(hPreBuildTrayMenuEvent,0,0); + + CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m); + //DrawMenuBar((HWND)CallService("CLUI/GetHwnd",0,0)); + tick = GetTickCount()-tick; + return (INT_PTR)hMenu; +} + +static INT_PTR AddTrayMenuItem(WPARAM wParam,LPARAM lParam) +{ + TMO_MenuItem tmi; + CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; + if ( !pcli->pfnConvertMenu(mi, &tmi)) + return NULL; + + lpTrayMenuExecParam mmep = (lpTrayMenuExecParam)mir_alloc(sizeof(TrayMenuExecParam)); + if (mmep == NULL) + return 0; + + mmep->szServiceName = mir_strdup(mi->pszService); + mmep->Param1 = mi->popupPosition; + tmi.ownerdata = mmep; + + OptParam op; + op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hTrayMenuObject,(LPARAM)&tmi); + op.Setting = OPT_MENUITEMSETUNIQNAME; + op.Value = (INT_PTR)mi->pszService; + CallService(MO_SETOPTIONSMENUITEM,(WPARAM)0,(LPARAM)&op); + return (INT_PTR)op.Handle; +} + +INT_PTR TrayMenuCheckService(WPARAM wParam,LPARAM lParam) +{ + return 0; +} + +INT_PTR TrayMenuonAddService(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 (hTrayMainMenuItemProxy == (HANDLE)lParam) { + mii->fMask |= MIIM_SUBMENU; + mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0); + } + + if (hTrayStatusMenuItemProxy == (HANDLE)lParam) { + mii->fMask |= MIIM_SUBMENU; + mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); + } + + return(TRUE); +} + + +//called with: +//wparam - ownerdata +//lparam - lparam from winproc +INT_PTR TrayMenuExecService(WPARAM wParam,LPARAM lParam) { + if (wParam != 0) + { + lpTrayMenuExecParam mmep = (lpTrayMenuExecParam)wParam; + if (!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); + } + return(1); +} + +INT_PTR FreeOwnerDataTrayMenu (WPARAM wParam,LPARAM lParam) +{ + + lpTrayMenuExecParam mmep; + mmep = (lpTrayMenuExecParam)lParam; + if (mmep != NULL){ + FreeAndNil((void**)&mmep->szServiceName); + FreeAndNil((void**)&mmep); + } + + return 0; +} + +void InitTrayMenus(void) +{ + TMenuParam tmp; + OptParam op; + + //Tray menu + memset(&tmp,0,sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + tmp.CheckService = NULL; + tmp.ExecService = "CLISTMENUSTRAY/ExecService"; + tmp.name = "TrayMenu"; + hTrayMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp); + + CreateServiceFunction("CLISTMENUSTRAY/ExecService",TrayMenuExecService); + CreateServiceFunction("CLISTMENUSTRAY/FreeOwnerDataTrayMenu",FreeOwnerDataTrayMenu); + CreateServiceFunction("CLISTMENUSTRAY/TrayMenuonAddService",TrayMenuonAddService); + + CreateServiceFunction("CList/AddTrayMenuItem",AddTrayMenuItem); + CreateServiceFunction(MS_CLIST_REMOVETRAYMENUITEM,RemoveTrayMenuItem); + CreateServiceFunction(MS_CLIST_MENUBUILDTRAY,BuildTrayMenu); + hPreBuildTrayMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDTRAYMENU); + + op.Handle = hTrayMenuObject; + op.Setting = OPT_USERDEFINEDITEMS; + op.Value = TRUE; + CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); + + op.Handle = hTrayMenuObject; + op.Setting = OPT_MENUOBJECT_SET_FREE_SERVICE; + op.Value = (INT_PTR)"CLISTMENUSTRAY/FreeOwnerDataTrayMenu"; + CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); + + op.Handle = hTrayMenuObject; + op.Setting = OPT_MENUOBJECT_SET_ONADD_SERVICE; + op.Value = (INT_PTR)"CLISTMENUSTRAY/TrayMenuonAddService"; + CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); + + { + //add exit command to menu + CLISTMENUITEM mi; + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 900000; + mi.pszService = "CloseAction"; + mi.pszName = LPGEN("E&xit"); + AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 100000; + mi.pszService = MS_CLIST_SHOWHIDE; + mi.pszName = LPGEN("&Hide/Show"); + hHideShowMainMenuItem = (HANDLE)AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 200000; + mi.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_FINDUSER)); + mi.pszService = "FindAdd/FindAddCommand"; + mi.pszName = LPGEN("&Find/Add Contacts..."); + AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 300000; + mi.pszService = ""; + mi.pszName = LPGEN("&Main Menu"); + hTrayMainMenuItemProxy = (HANDLE)AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 300100; + mi.pszService = ""; + mi.pszName = LPGEN("&Status"); + hTrayStatusMenuItemProxy = (HANDLE)AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 400000; + mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_OPTIONS)); + mi.pszService = "Options/OptionsCommand"; + mi.pszName = LPGEN("&Options..."); + AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 500000; + mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_CLIENTMIRANDA)); + mi.pszService = "Help/AboutCommand"; + mi.pszName = LPGEN("&About"); + AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); +} } diff --git a/plugins/Clist_mw/src/clui.cpp b/plugins/Clist_mw/src/clui.cpp new file mode 100644 index 0000000000..bddf0478e0 --- /dev/null +++ b/plugins/Clist_mw/src/clui.cpp @@ -0,0 +1,922 @@ +/* + + Miranda IM: the free IM client for Microsoft* Windows* + + Copyright 2000-2003 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 "commonheaders.h" + +#define TM_AUTOALPHA 1 +#define TM_STATUSBARUPDATE 200 +#define MENU_MIRANDAMENU 0xFFFF1234 + +extern int DefaultImageListColorDepth; + +static HMODULE hUserDll; +HMENU hMenuMain; +static HANDLE hContactDraggingEvent,hContactDroppedEvent,hContactDragStopEvent; +UINT hMsgGetProfile = 0; + +extern boolean canloadstatusbar; +boolean OnModulesLoadedCalled = FALSE; + +HANDLE hSettingChangedHook = 0; + +static int transparentFocus = 1; +static byte oldhideoffline; +static int lastreqh = 0,requr = 0,disableautoupd = 1; +HANDLE hFrameContactTree; +BYTE showOpts;//for statusbar + +typedef struct{ +int IconsCount; +int CycleStartTick; +char *szProto; +int n; +int TimerCreated; +} ProtoTicks,*pProtoTicks; + +ProtoTicks CycleStartTick[64];//max 64 protocols + +int CycleTimeInterval = 2000; +int CycleIconCount = 8; +int DefaultStep = 100; + +BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); +BOOL (WINAPI *MyAnimateWindow)(HWND hWnd,DWORD dwTime,DWORD dwFlags); + +int CluiOptInit(WPARAM wParam,LPARAM lParam); +int SortList(WPARAM wParam,LPARAM lParam); + +void CluiProtocolStatusChanged(int parStatus, const char* szProto); + +extern void SetAllExtraIcons(HWND hwndList,HANDLE hContact); +extern void ReloadExtraIcons(); +extern void LoadExtraImageFunc(); +extern HWND CreateStatusBarhWnd(HWND parent); +extern HANDLE CreateStatusBarFrame(); +extern int CLUIFramesUpdateFrame(WPARAM wParam,LPARAM lParam); +extern int ExtraToColumnNum(int extra); +extern int ColumnNumToExtra(int column); +extern void DrawDataForStatusBar(LPDRAWITEMSTRUCT dis); +extern void InitGroupMenus(); +extern int UseOwnerDrawStatusBar; +extern HANDLE hExtraImageClick; + +HICON GetConnectingIconForProto(char *szProto,int b); +HICON GetConnectingIconForProto_DLL(char *szProto,int b); + +void RegisterProtoIconsForAllProtoIconLib(); + +#define M_CREATECLC (WM_USER+1) +#define M_SETALLEXTRAICONS (WM_USER+2) + +static int CluiModulesLoaded(WPARAM wParam,LPARAM lParam) +{ + MENUITEMINFO mii; + ZeroMemory(&mii,sizeof(mii)); + mii.cbSize = MENUITEMINFO_V4_SIZE; + mii.fMask = MIIM_SUBMENU; + mii.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0); + SetMenuItemInfo(hMenuMain,0,TRUE,&mii); + mii.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); + SetMenuItemInfo(hMenuMain,1,TRUE,&mii); + + canloadstatusbar = TRUE; + SendMessage(pcli->hwndContactList,WM_SIZE,0,0); + CluiProtocolStatusChanged(0,0); + Sleep(0); + PostMessage(pcli->hwndContactList,M_CREATECLC,0,0); + + OnModulesLoadedCalled = TRUE; + pcli->pfnInvalidateDisplayNameCacheEntry(INVALID_HANDLE_VALUE); + InitGroupMenus(); + RegisterProtoIconsForAllProtoIconLib(); + return 0; +} + +pProtoTicks GetProtoTicksByProto(char * szProto) +{ + int i; + + for (i = 0;i<64;i++) + { + if (CycleStartTick[i].szProto == NULL) break; + if (strcmp(CycleStartTick[i].szProto,szProto)) continue; + return(&CycleStartTick[i]); + } + for (i = 0;i<64;i++) + { + if (CycleStartTick[i].szProto == NULL) + { + CycleStartTick[i].szProto = mir_strdup(szProto); + CycleStartTick[i].CycleStartTick = 0; + CycleStartTick[i].n = i; + return(&CycleStartTick[i]); + } + } + return NULL; +} + +int GetConnectingIconForProtoCount(char *szProto) +{ + char file[MAX_PATH],fileFull[MAX_PATH],szFullPath[MAX_PATH]; + char szPath[MAX_PATH]; + char *str; + int ret; + + GetModuleFileNameA(GetModuleHandle(NULL), szPath, MAX_PATH); + str = strrchr(szPath,'\\'); + if (str != NULL) *str = 0; + _snprintf(szFullPath, SIZEOF(szFullPath), "%s\\Icons\\proto_conn_%s.dll", szPath, szProto); + + lstrcpynA(file,szFullPath,SIZEOF(file)); + CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)file, (LPARAM)fileFull); + ret = ExtractIconExA(fileFull,-1,NULL,NULL,1); + if (ret == 0&&!strcmp(szProto,"ICQ")) ret = 8; + return ret; +} + +static HICON ExtractIconFromPath(const char *path) +{ + char *comma; + char file[MAX_PATH],fileFull[MAX_PATH]; + int n; + HICON hIcon; + { +// char buf[512]; +// sprintf(buf,"LoadIcon %s\r\n",path); +// OutputDebugStringA(buf); + } + lstrcpynA(file,path,SIZEOF(file)); + comma = strrchr(file,','); + if (comma == NULL) n = 0; + else {n = atoi(comma+1); *comma = 0;} + CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)file, (LPARAM)fileFull); + +#ifdef _DEBUG + { +// char buf[512]; +// sprintf(buf,"LoadIconFull %d %s\r\n",n,fileFull); +// OutputDebugStringA(buf); + } +#endif + + hIcon = NULL; + ExtractIconExA(fileFull,n,NULL,&hIcon,1); + return hIcon; +} + +HICON LoadIconFromExternalFile(char *filename,int i,boolean UseLibrary,boolean registerit,char *IconName,char *SectName,char *Description,int internalidx,HICON DefIcon) +{ + char szPath[MAX_PATH],szMyPath[MAX_PATH], szFullPath[MAX_PATH],*str; + HICON hIcon = NULL; + SKINICONDESC sid = {0}; + + memset(szMyPath,0,SIZEOF(szMyPath)); + memset(szFullPath,0,SIZEOF(szFullPath)); + + if (filename != NULL) + { + GetModuleFileNameA(GetModuleHandle(NULL), szPath, MAX_PATH); + GetModuleFileNameA(g_hInst, szMyPath, MAX_PATH); + str = strrchr(szPath,'\\'); + if (str != NULL) *str = 0; + _snprintf(szFullPath, SIZEOF(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i); + } + + if (!UseLibrary) { + hIcon = ExtractIconFromPath(szFullPath); + if (hIcon) return hIcon; + } + else { + if (registerit && IconName != NULL && SectName != NULL) { + sid.cbSize = sizeof(sid); + sid.pszSection = SectName; + sid.pszName = IconName; + sid.pszDescription = Description; + if (strlen(szMyPath) != 0) + sid.pszDefaultFile = szMyPath; + + sid.iDefaultIndex = internalidx; + sid.hDefaultIcon = DefIcon; + + Skin_AddIcon(&sid); + + char buf[256]; + sprintf(buf,"Registring Icon %s/%s hDefaultIcon: %p\r\n",SectName,IconName,DefIcon); + OutputDebugStringA(buf); + } + return ((HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)IconName)); + } + + return (HICON)0; +} + +void RegisterProtoIcons (char *protoname) +{ + if (ServiceExists(MS_SKIN2_GETICON)&&DBGetContactSettingByte(NULL,"CList","UseProtoIconFromIcoLib",1)) + { + int i; + char buf[256]; + char buf2[256]; + for (i = 0;i<8;i++) + { + sprintf(buf,"%s #%d",protoname,i); + sprintf(buf2,"Contact List/Connection Icons %s",protoname); + + LoadIconFromExternalFile(NULL,i,TRUE,TRUE,buf,buf2,buf,0,GetConnectingIconForProto_DLL(protoname,i)); + } + } +} + +void RegisterProtoIconsForAllProtoIconLib() +{ + int protoCount,i; + PROTOACCOUNT **accs; + + ProtoEnumAccounts( &protoCount, &accs ); + for ( i = 0; i < protoCount; i++ ) + if ( IsAccountEnabled( accs[i] ) && CallProtoService( accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0 )) + RegisterProtoIcons( accs[i]->szModuleName ); +} + +HICON GetConnectingIconForProto_DLL(char *szProto,int b) +{ + char szFullPath[MAX_PATH]; + HICON hIcon = NULL; + + b = b-1; + _snprintf(szFullPath, SIZEOF(szFullPath), "proto_conn_%s.dll",szProto); + // hIcon = ExtractIconFromPath(szFullPath); + // if (hIcon) return hIcon; + + hIcon = LoadIconFromExternalFile(szFullPath,b+1,FALSE,FALSE,NULL,NULL,NULL,0,0); + if (hIcon) return hIcon; + +#ifdef _DEBUG + { + char buf [256]; + sprintf(buf,"IconNotFound %s %d\r\n",szProto,b); + // OutputDebugStringA(buf); + } +#endif + + if (!strcmp(szProto,"ICQ")) + { + +#ifdef _DEBUG + char buf [256]; + sprintf(buf,"Icon %d %d\r\n",GetTickCount(),b); + //OutputDebugStringA(buf); +#endif + return(LoadIconA(g_hInst,(LPCSTR)(IDI_ICQC1+b))); + } + + return(hIcon); +} + +HICON GetConnectingIconForProto(char *szProto,int b) +{ + if (ServiceExists(MS_SKIN2_GETICON)&&DBGetContactSettingByte(NULL,"CList","UseProtoIconFromIcoLib",1)) { + HICON hIcon = 0; + char buf[256]; + sprintf(buf,"%s #%d",szProto,b); + + hIcon = LoadIconFromExternalFile(NULL,b,TRUE,FALSE,buf,"Contact List/Connection Icons",buf,0,NULL); + if (hIcon == NULL) return (GetConnectingIconForProto_DLL(szProto,b)); + return (CopyIcon(hIcon)); + } + + return GetConnectingIconForProto_DLL(szProto, b); +} + +//wParam == szProto +INT_PTR GetConnectingIconService(WPARAM wParam,LPARAM lParam) +{ + int b; + ProtoTicks *pt = NULL; + HICON hIcon = NULL; + + char *szProto = (char *)wParam; + if (!szProto) return 0; + + pt = GetProtoTicksByProto(szProto); + + if (pt != NULL) { + if (pt->CycleStartTick != 0&&pt->IconsCount != 0) { + b = ((GetTickCount()-pt->CycleStartTick)/(DefaultStep))%pt->IconsCount; + hIcon = GetConnectingIconForProto(szProto,b); + } + } + + return (INT_PTR)hIcon; +} + +int CreateTimerForConnectingIcon(WPARAM wParam,LPARAM lParam) +{ + int status = (int)wParam; + char *szProto = (char *)lParam; + if (!szProto) return 0; + if (!status) return 0; + + if (( DBGetContactSettingByte(NULL,"CLUI","UseConnectingIcon",1) == 1) && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES) { + ProtoTicks *pt = NULL; + int cnt; + + pt = GetProtoTicksByProto(szProto); + if (pt != NULL) { + if (pt->CycleStartTick == 0) { + KillTimer(pcli->hwndContactList,TM_STATUSBARUPDATE+pt->n); + cnt = GetConnectingIconForProtoCount(szProto); + if (ServiceExists(MS_SKIN2_GETICON)&&DBGetContactSettingByte(NULL,"Clist","UseProtoIconFromIcoLib",1)) + cnt = 8; + + if (cnt != 0) { + DefaultStep = DBGetContactSettingWord(NULL,"CLUI","DefaultStepConnectingIcon",100); + pt->IconsCount = cnt; + SetTimer(pcli->hwndContactList,TM_STATUSBARUPDATE+pt->n,(int)(DefaultStep)/1,0); + pt->TimerCreated = 1; + pt->CycleStartTick = GetTickCount(); + } + } + } + } + return 0; +} + +// Restore protocols to the last global status. +// Used to reconnect on restore after standby. + +int OnSettingChanging(WPARAM wParam,LPARAM lParam) +{ + DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *)lParam; + if (wParam == 0) { + if ((dbcws->value.type == DBVT_BYTE)&&!strcmp(dbcws->szModule,"CLUI")) { + if (!strcmp(dbcws->szSetting,"SBarShow")) { + showOpts = dbcws->value.bVal; + return 0; + } + } + } + else { + if (dbcws == NULL) + return 0; + + if ( !ServiceExists("ExtraIcon/Register")) { + if (dbcws->value.type == DBVT_ASCIIZ&&!strcmp(dbcws->szSetting,"e-mail")) { + SetAllExtraIcons(pcli->hwndContactTree,(HANDLE)wParam); + return 0; + } + if (dbcws->value.type == DBVT_ASCIIZ&&!strcmp(dbcws->szSetting,"Cellular")) { + SetAllExtraIcons(pcli->hwndContactTree,(HANDLE)wParam); + return 0; + } + + if (dbcws->value.type == DBVT_ASCIIZ&&strstr(dbcws->szModule,"ICQ")) { + if ( !strcmp(dbcws->szSetting, "MirVer")) { + SetAllExtraIcons(pcli->hwndContactTree,(HANDLE)wParam); + return 0; + } + } + + if (dbcws->value.type == DBVT_ASCIIZ&&!strcmp(dbcws->szModule,"UserInfo")) { + if ( !strcmp(dbcws->szSetting, "MyPhone0")) { + SetAllExtraIcons(pcli->hwndContactTree,(HANDLE)wParam); + return 0; + } + if (!strcmp(dbcws->szSetting, "Mye-mail0")) { + SetAllExtraIcons(pcli->hwndContactTree,(HANDLE)wParam); + return 0; + } + } + } + } + return 0; +} + +HWND PreCreateCLC(HWND parent) +{ + pcli->hwndContactTree = CreateWindow(CLISTCONTROL_CLASS,_T(""), + WS_CHILD|WS_CLIPCHILDREN|CLS_CONTACTLIST + |(DBGetContactSettingByte(NULL,"CList","UseGroups",SETTING_USEGROUPS_DEFAULT)?CLS_USEGROUPS:0) + |CLS_HIDEOFFLINE + //|(DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CLS_HIDEOFFLINE:0) + |(DBGetContactSettingByte(NULL,"CList","HideEmptyGroups",SETTING_HIDEEMPTYGROUPS_DEFAULT)?CLS_HIDEEMPTYGROUPS:0) + |(DBGetContactSettingByte(NULL,"CList","ShowStatusMessages",1)?CLS_SHOWSTATUSMESSAGES:0) + |CLS_MULTICOLUMN + //|DBGetContactSettingByte(NULL,"CLUI","ExtraIconsAlignToLeft",1)?CLS_EX_MULTICOLUMNALIGNLEFT:0 + ,0,0,0,0,parent,NULL,g_hInst,NULL); + + return pcli->hwndContactTree; +} + +int CreateCLC(HWND parent) +{ + Sleep(0); + { + // create contact list frame + CLISTFrame Frame; + memset(&Frame,0,sizeof(Frame)); + Frame.cbSize = sizeof(CLISTFrame); + Frame.hWnd = pcli->hwndContactTree; + Frame.align = alClient; + Frame.hIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); + //LoadIcon(hInst,MAKEINTRESOURCE(IDI_MIRANDA)); + Frame.Flags = F_VISIBLE|F_SHOWTB|F_SHOWTBTIP|F_TCHAR; + Frame.tname = _T("My Contacts"); + Frame.TBtname = TranslateT("My Contacts"); + hFrameContactTree = (HWND)CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&Frame,(LPARAM)0); + //free(Frame.name); + CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_TBTIPNAME,hFrameContactTree),(LPARAM)TranslateT("My Contacts")); + } + + ReloadExtraIcons(); + { + lastreqh = 0; + { + CallService(MS_CLIST_SETHIDEOFFLINE,(WPARAM)oldhideoffline,0); + } + + { int state = DBGetContactSettingByte(NULL,"CList","State",SETTING_STATE_NORMAL); + if (state == SETTING_STATE_NORMAL) ShowWindow(pcli->hwndContactList, SW_SHOW); + else if (state == SETTING_STATE_MINIMIZED) ShowWindow(pcli->hwndContactList, SW_SHOWMINIMIZED); + } + + lastreqh = 0; + disableautoupd = 0; + + } + hSettingChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED,OnSettingChanging); + return 0; +} + +int GetStatsuBarProtoRect(HWND hwnd,char *szProto,RECT *rc) +{ + int nParts,nPanel; + ProtocolData *PD; + int startoffset = DBGetContactSettingDword(NULL,"StatusBar","FirstIconOffset",0); + + if (!UseOwnerDrawStatusBar) startoffset = 0; + + nParts = SendMessage(hwnd,SB_GETPARTS,0,0); + FillMemory(rc,sizeof(RECT),0); + + for (nPanel = 0;nPanelhwndStatus,SB_GETTEXT,(WPARAM)nPanel,(LPARAM)0); + if ( PD == NULL ) + return 0; + + if (!strcmp(szProto,PD->RealName)) + { + SendMessage(hwnd,SB_GETRECT,(WPARAM)nPanel,(LPARAM)rc); + rc->left += startoffset; + rc->right += startoffset; + return 0; + } + } + return 0; +} + +extern LRESULT ( CALLBACK *saveContactListWndProc )(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); + +LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + /* + This registers a window message with RegisterWindowMessage() and then waits for such a message, + if it gets it, it tries to open a file mapping object and then maps it to this process space, + it expects 256 bytes of data (incl. NULL) it will then write back the profile it is using the DB to fill in the answer. + + The caller is expected to create this mapping object and tell us the ID we need to open ours. + */ + + if (msg == hMsgGetProfile && wParam != 0) { /* got IPC message */ + HANDLE hMap; + char szName[MAX_PATH]; + int rc = 0; + _snprintf(szName,SIZEOF(szName),"Miranda::%u", wParam); // caller will tell us the ID of the map + hMap = OpenFileMappingA(FILE_MAP_ALL_ACCESS,FALSE,szName); + if (hMap != NULL) { + void *hView = NULL; + hView = MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, MAX_PATH); + if (hView) { + char szFilePath[MAX_PATH], szProfile[MAX_PATH]; + CallService(MS_DB_GETPROFILEPATH,MAX_PATH,(LPARAM)&szFilePath); + CallService(MS_DB_GETPROFILENAME,MAX_PATH,(LPARAM)&szProfile); + _snprintf((char*)hView, MAX_PATH, "%s\\%s", szFilePath, szProfile); + UnmapViewOfFile(hView); + rc = 1; + } + CloseHandle(hMap); + } + return rc; + } + + switch (msg) { + case WM_CREATE: + TranslateMenu(GetMenu(hwnd)); + DrawMenuBar(hwnd); + showOpts = DBGetContactSettingByte(NULL,"CLUI","SBarShow",1); + + //create the status wnd + //pcli->hwndStatus == CreateStatusWindow(WS_CHILD | (DBGetContactSettingByte(NULL,"CLUI","ShowSBar",1)?WS_VISIBLE:0), "", hwnd, 0); + CluiProtocolStatusChanged(0,0); + + hMsgGetProfile = RegisterWindowMessageA( "Miranda::GetProfile" ); // don't localise + + if ( DBGetContactSettingByte( NULL, "CList", "Transparent", 0 )) { + SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); + if ( MySetLayeredWindowAttributes ) + MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); + } + transparentFocus = 1; + return FALSE; + + case M_SETALLEXTRAICONS: + return TRUE; + + case M_CREATECLC: + CreateCLC(hwnd); + return TRUE; + + case WM_SIZE: + { + RECT rc; + if ( wParam != SIZE_MINIMIZED ) { + if ( pcli->hwndContactList != NULL ) + CLUIFramesOnClistResize((WPARAM)hwnd,(LPARAM)0); + + GetWindowRect(hwnd, &rc); + if (!CallService(MS_CLIST_DOCKINGISDOCKED,0,0)) { + //if docked, dont remember pos (except for width) + DBWriteContactSettingDword(NULL,"CList","Height",(DWORD)(rc.bottom - rc.top)); + DBWriteContactSettingDword(NULL,"CList","x",(DWORD)rc.left); + DBWriteContactSettingDword(NULL,"CList","y",(DWORD)rc.top); + } + DBWriteContactSettingDword(NULL,"CList","Width",(DWORD)(rc.right - rc.left)); + } + if ( wParam == SIZE_MINIMIZED ) { + if ( DBGetContactSettingByte(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT )) { + ShowWindow(hwnd, SW_HIDE); + DBWriteContactSettingByte(NULL,"CList","State",SETTING_STATE_HIDDEN); + } + else DBWriteContactSettingByte(NULL,"CList","State",SETTING_STATE_MINIMIZED); + } + return 0; + } + + case WM_SETFOCUS: + { + boolean isfloating; + if ( hFrameContactTree ) { + isfloating = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS,MAKEWPARAM(FO_FLOATING,hFrameContactTree),0); + if ( isfloating == FALSE) + SetFocus(pcli->hwndContactTree); + } + return 0; + } + case WM_TIMER: + if ((int)wParam>=TM_STATUSBARUPDATE&&(int)wParam<=TM_STATUSBARUPDATE+64) { + int status,i; + + ProtoTicks *pt = NULL; + for (i = 0;i<64;i++) { + pt = &CycleStartTick[i]; + if (pt->szProto != NULL&&pt->TimerCreated == 1) { + status = CallProtoService(pt->szProto,PS_GETSTATUS,0,0); + if (!(status>=ID_STATUS_CONNECTING&&status<=ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES)) + { + pt->CycleStartTick = 0; + KillTimer(hwnd,TM_STATUSBARUPDATE+pt->n); + pt->TimerCreated = 0; + } } } + + pt = &CycleStartTick[wParam-TM_STATUSBARUPDATE]; + { + RECT rc; + GetStatsuBarProtoRect(pcli->hwndStatus,pt->szProto,&rc); + rc.right = rc.left+GetSystemMetrics(SM_CXSMICON)+1; + rc.top = 0; + + if (IsWindowVisible(pcli->hwndStatus)) InvalidateRect(pcli->hwndStatus,&rc,TRUE); + pcli->pfnTrayIconUpdateBase(pt->szProto); + } + //SendMessage(pcli->hwndStatus,WM_PAINT,0,0); + UpdateWindow(pcli->hwndStatus); + return TRUE; + } + break; + + case WM_DRAWITEM: + { + LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; + if ( dis->hwndItem == pcli->hwndStatus ) { + DrawDataForStatusBar(dis); + return 0; + } + if ( dis->CtlType != ODT_MENU ) + return 0; + break; + } + case WM_KEYDOWN: + CallService(MS_CLIST_MENUPROCESSHOTKEY,wParam,MPCF_MAINMENU|MPCF_CONTACTMENU); + if (wParam == VK_F5) + SendMessage(pcli->hwndContactTree,CLM_AUTOREBUILD,0,0); + return TRUE; + + case WM_GETMINMAXINFO: + DefWindowProc(hwnd,msg,wParam,lParam); + ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 18; + if (requr == 0){((LPMINMAXINFO)lParam)->ptMinTrackSize.y = CLUIFramesGetMinHeight();} + return 0; + + //MSG FROM CHILD CONTROL + case WM_NOTIFY: + if (((LPNMHDR)lParam)->hwndFrom == pcli->hwndContactTree) { + switch (((LPNMHDR)lParam)->code) { + case CLN_NEWCONTACT: + { + NMCLISTCONTROL *nm = (NMCLISTCONTROL *)lParam; + if (nm != NULL) SetAllExtraIcons(pcli->hwndContactTree,nm->hItem ); + return TRUE; + } + case CLN_LISTREBUILT: + SetAllExtraIcons(pcli->hwndContactTree,0); + return(FALSE); + + case CLN_LISTSIZECHANGE: + { + NMCLISTCONTROL *nmc = (NMCLISTCONTROL*)lParam; + RECT rcWindow,rcTree,rcWorkArea; + int maxHeight,newHeight; + int winstyle; + + if ( !disableautoupd && DBGetContactSettingByte( NULL, "CLUI", "AutoSize", 0 )) { + if ( !CallService(MS_CLIST_DOCKINGISDOCKED,0,0) && hFrameContactTree != 0 ) { + maxHeight = DBGetContactSettingByte(NULL,"CLUI","MaxSizeHeight",75); + GetWindowRect(hwnd,&rcWindow); + GetWindowRect(pcli->hwndContactTree,&rcTree); + winstyle = GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE); + + SystemParametersInfo(SPI_GETWORKAREA,0,&rcWorkArea,FALSE); + lastreqh = nmc->pt.y; + newHeight = max(nmc->pt.y,3)+1+((winstyle&WS_BORDER)?2:0)+(rcWindow.bottom-rcWindow.top)-(rcTree.bottom-rcTree.top); + if (newHeight != rcWindow.bottom - rcWindow.top ) { + if (newHeight>(rcWorkArea.bottom-rcWorkArea.top)*maxHeight/100) + newHeight = (rcWorkArea.bottom-rcWorkArea.top)*maxHeight/100; + if (DBGetContactSettingByte(NULL,"CLUI","AutoSizeUpward",0)) { + rcWindow.top = rcWindow.bottom-newHeight; + if (rcWindow.toprcWorkArea.bottom) rcWindow.bottom = rcWorkArea.bottom; + } + + if (requr == 0) { + requr = 1; + SetWindowPos(hwnd,0,rcWindow.left,rcWindow.top,rcWindow.right-rcWindow.left,rcWindow.bottom-rcWindow.top,SWP_NOZORDER|SWP_NOACTIVATE); + GetWindowRect(hwnd,&rcWindow); + requr = 0; + } } } } + return TRUE; + } + case NM_CLICK: + { + NMCLISTCONTROL *nm = (NMCLISTCONTROL*)lParam; + DWORD hitFlags; + HANDLE hItem = (HANDLE)SendMessage(pcli->hwndContactTree,CLM_HITTEST,(WPARAM)&hitFlags,MAKELPARAM(nm->pt.x,nm->pt.y)); + + if (hitFlags&CLCHT_ONITEMEXTRA) { + if (!IsHContactGroup(hItem)&&!IsHContactInfo(hItem)) + { + int extra; + pdisplayNameCacheEntry pdnce; + + pdnce = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(nm->hItem); + if (pdnce == NULL) return 0; + + extra = ColumnNumToExtra(nm->iColumn); + NotifyEventHooks(hExtraImageClick, (WPARAM)nm->hItem, extra); + + if (!ServiceExists("ExtraIcon/Register")) + { + int v,e,w; + v = ExtraToColumnNum(EXTRA_ICON_PROTO); + e = ExtraToColumnNum(EXTRA_ICON_EMAIL); + w = ExtraToColumnNum(EXTRA_ICON_ADV1); + + if (nm->iColumn == v) + CallService(MS_USERINFO_SHOWDIALOG,(WPARAM)nm->hItem,0); + + if (nm->iColumn == e) { + //CallService(MS_USERINFO_SHOWDIALOG,(WPARAM)nm->hItem,0); + char *email,buf[4096]; + email = DBGetStringA(nm->hItem,"UserInfo", "Mye-mail0"); + if (email) { + sprintf(buf,"mailto:%s",email); + ShellExecuteA(hwnd,"open",buf,NULL,NULL,SW_SHOW); + } + } + if (nm->iColumn == w) { + char *homepage; + homepage = DBGetStringA(pdnce->hContact,pdnce->szProto, "Homepage"); + if (homepage != NULL) + ShellExecuteA(hwnd,"open",homepage,NULL,NULL,SW_SHOW); + } } } } + + if (hItem) break; + if ((hitFlags&(CLCHT_NOWHERE|CLCHT_INLEFTMARGIN|CLCHT_BELOWITEMS)) == 0) break; + if (DBGetContactSettingByte(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)) { + POINT pt; + pt = nm->pt; + ClientToScreen(pcli->hwndContactTree,&pt); + return SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE|HTCAPTION,MAKELPARAM(pt.x,pt.y)); + } + return TRUE; + } + } + } + else if (((LPNMHDR)lParam)->hwndFrom == pcli->hwndStatus) { + if (((LPNMHDR)lParam)->code == NM_CLICK ) { + int nParts = 0, nPanel = 0; + NMMOUSE *nm = (NMMOUSE*)lParam; + HMENU hMenu; + RECT rc; + POINT pt; + int totcount; + ProtocolData *PD; + int menuid; + int startoffset = DBGetContactSettingDword(NULL,"StatusBar","FirstIconOffset",0); + int extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0); + boolean UseOwnerDrawStatusBar = DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",0); + + hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); + nParts = SendMessage(pcli->hwndStatus,SB_GETPARTS,0,0); + + if (nm->dwItemSpec == 0xFFFFFFFE) { + nPanel = nParts-1; + SendMessage(pcli->hwndStatus,SB_GETRECT,nPanel,(LPARAM)&rc); + if (nm->pt.x < rc.left) return FALSE; + } + else { + if (!((startoffset) != 0&&UseOwnerDrawStatusBar)) + { + nPanel = nm->dwItemSpec; + SendMessage(pcli->hwndStatus,SB_GETRECT,nPanel,(LPARAM)&rc); + } + else { + RECT clrc; + int sectwidth; + + memset(&rc,0,sizeof(RECT)); + GetClientRect(pcli->hwndStatus,&clrc); + clrc.right -= clrc.left; + clrc.right -= startoffset; + sectwidth = clrc.right/nParts; + + for (nPanel = 0;nPanelhwndStatus,SB_GETTEXT,(WPARAM)nPanel,(LPARAM)0); + if (PD == NULL) + continue; + + rc.top = 0; + rc.bottom = clrc.bottom; + rc.left = nPanel*sectwidth+startoffset; + rc.right = rc.left+sectwidth-1; + + if (PtInRect(&rc,nm->pt)) + break; + } } } + + totcount = DBGetContactSettingDword(0,"Protocols","ProtoCount",0); + PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,(WPARAM)nPanel,(LPARAM)0); + if (PD == NULL){return 0;} + menuid = nPanel; + + if (menuid<0){break;} + hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); + { + int i; + unsigned int cpnl = 0; + int mcnt = GetMenuItemCount(hMenu); + for (i = 0; iprotopos: %d,PD->RealName %s\r\n",nPanel,PD->protopos,PD->RealName); + OutputDebugStringA(buf); + } + + if (hMenu != NULL) { + GetCursorPos(&pt); + TrackPopupMenu(hMenu,TPM_BOTTOMALIGN|TPM_LEFTALIGN,pt.x,pt.y,0,hwnd,NULL); + } } + return TRUE; + } + break; + + case WM_DESTROY: + { + //saving state + int state = DBGetContactSettingByte(NULL,"CList","State",SETTING_STATE_NORMAL); + + FreeProtocolData(); + if ( hSettingChangedHook != 0 ) + UnhookEvent(hSettingChangedHook); + + if ( state == SETTING_STATE_NORMAL ) + ShowWindow(hwnd,SW_HIDE); + + CallService(MS_CLIST_FRAMES_REMOVEFRAME,(WPARAM)hFrameContactTree,(LPARAM)0); + DestroyWindow(pcli->hwndContactTree); + pcli->hwndContactList = NULL; + + UnLoadCLUIFramesModule(); + DBWriteContactSettingByte(NULL,"CList","State",(BYTE)state); + PostQuitMessage(0); + } + break; + } + + return saveContactListWndProc( hwnd, msg, wParam, lParam ); +} + +int LoadCLUIModule(void) +{ + DBVARIANT dbv; + TCHAR titleText[256]; + int laster; + canloadstatusbar = FALSE; + hFrameContactTree = 0; + + hUserDll = LoadLibraryA("user32.dll"); + if (hUserDll) { + MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll, "SetLayeredWindowAttributes"); + MyAnimateWindow = (BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(hUserDll,"AnimateWindow"); + } + + HookEvent(ME_SYSTEM_MODULESLOADED,CluiModulesLoaded); + HookEvent(ME_OPT_INITIALISE,CluiOptInit); + hContactDraggingEvent = CreateHookableEvent(ME_CLUI_CONTACTDRAGGING); + hContactDroppedEvent = CreateHookableEvent(ME_CLUI_CONTACTDROPPED); + hContactDragStopEvent = CreateHookableEvent(ME_CLUI_CONTACTDRAGSTOP); + + CreateServiceFunction("CLUI/GetConnectingIconForProtocol",GetConnectingIconService); + + if (DBGetContactSettingTString(NULL,"CList","TitleText",&dbv)) + lstrcpyn(titleText,_T(MIRANDANAME),SIZEOF(titleText)); + else { + lstrcpyn(titleText,dbv.ptszVal,SIZEOF(titleText)); + DBFreeVariant(&dbv); + } + + oldhideoffline = DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT); + + laster = GetLastError(); + PreCreateCLC(pcli->hwndContactList); + + // create status bar frame + CreateStatusBarhWnd(pcli->hwndContactList); + + { //int state = DBGetContactSettingByte(NULL,"CList","State",SETTING_STATE_NORMAL); + hMenuMain = GetMenu(pcli->hwndContactList); + if (!DBGetContactSettingByte(NULL,"CLUI","ShowMainMenu",SETTING_SHOWMAINMENU_DEFAULT)) SetMenu(pcli->hwndContactList,NULL); + SetWindowPos(pcli->hwndContactList, DBGetContactSettingByte(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); + } + + lastreqh = 0; + return 0; +} + +void UnloadCLUIModule() +{ + int i; + + for ( i = 0; i < SIZEOF(CycleStartTick); i++ ) + if ( CycleStartTick[i].szProto != NULL ) + mir_free(CycleStartTick[i].szProto); +} \ No newline at end of file diff --git a/plugins/Clist_mw/src/cluiopts.cpp b/plugins/Clist_mw/src/cluiopts.cpp new file mode 100644 index 0000000000..8fd1c1651e --- /dev/null +++ b/plugins/Clist_mw/src/cluiopts.cpp @@ -0,0 +1,435 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 "commonheaders.h" + +extern HMENU hMenuMain; +extern BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); +static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +extern HANDLE hFrameHelperStatusBar; +extern int UseOwnerDrawStatusBar; + +void ReAssignExtraIcons(); +void CluiProtocolStatusChanged(int parStatus, const char* szProto); +int OnStatusBarBackgroundChange(); + +static UINT expertOnlyControls[] = {IDC_BRINGTOFRONT, IDC_AUTOSIZE,IDC_STATIC21,IDC_MAXSIZEHEIGHT,IDC_MAXSIZESPIN,IDC_STATIC22,IDC_AUTOSIZEUPWARD,IDC_SHOWMAINMENU,IDC_SHOWCAPTION,IDC_CLIENTDRAG}; +int CluiOptInit(WPARAM wParam,LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp = { 0 }; + odp.cbSize = sizeof(odp); + odp.hInstance = g_hInst; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLUI); + odp.pszTitle = LPGEN("Window"); + odp.pszGroup = LPGEN("Contact List"); + odp.pfnDlgProc = DlgProcCluiOpts; + odp.flags = ODPF_BOLDGROUPS; + odp.nIDBottomSimpleControl = IDC_STWINDOWGROUP; + odp.expertOnlyControls = expertOnlyControls; + odp.nExpertOnlyControls = SIZEOF(expertOnlyControls); + Options_AddPage(wParam, &odp); + + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SBAR); + odp.pszTitle = LPGEN("Status Bar"); + odp.pfnDlgProc = DlgProcSBarOpts; + odp.flags = ODPF_BOLDGROUPS | ODPF_EXPERTONLY; + odp.nIDBottomSimpleControl = 0; + odp.nExpertOnlyControls = 0; + odp.expertOnlyControls = NULL; + Options_AddPage(wParam, &odp); + return 0; +} + +static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT, DBGetContactSettingByte(NULL,"CList","BringToFront",SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ONTOP, DBGetContactSettingByte(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_TOOLWND, DBGetContactSettingByte(NULL,"CList","ToolWindow",SETTING_TOOLWINDOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_MIN2TRAY, DBGetContactSettingByte(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + if (IsDlgButtonChecked(hwndDlg,IDC_TOOLWND)) EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),FALSE); + CheckDlgButton(hwndDlg, IDC_SHOWCAPTION, DBGetContactSettingByte(NULL,"CLUI","ShowCaption",SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU, DBGetContactSettingByte(NULL,"CLUI","ShowMainMenu",SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CLIENTDRAG, DBGetContactSettingByte(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + if (!IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) { + EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_TOOLWND),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_TITLETEXT),FALSE); + } + CheckDlgButton(hwndDlg, IDC_FADEINOUT, DBGetContactSettingByte(NULL,"CLUI","FadeInOut",0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AUTOSIZE, DBGetContactSettingByte(NULL,"CLUI","AutoSize",0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DROPSHADOW, DBGetContactSettingByte(NULL,"CList","WindowShadow",0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ONDESKTOP, DBGetContactSettingByte(NULL,"CList","OnDesktop", 0) ? BST_CHECKED : BST_UNCHECKED); + SendDlgItemMessage(hwndDlg,IDC_MAXSIZESPIN,UDM_SETRANGE,0,MAKELONG(100,0)); + SendDlgItemMessage(hwndDlg,IDC_MAXSIZESPIN,UDM_SETPOS,0,DBGetContactSettingByte(NULL,"CLUI","MaxSizeHeight",75)); + CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, DBGetContactSettingByte(NULL,"CLUI","AutoSizeUpward",0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AUTOHIDE, DBGetContactSettingByte(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETRANGE,0,MAKELONG(900,1)); + SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),0)); + EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIME),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); + EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); + EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC01),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); + if (!IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)) { + EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC21),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC22),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_MAXSIZEHEIGHT),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_MAXSIZESPIN),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_AUTOSIZEUPWARD),FALSE); + } + + { DBVARIANT dbv; + char *s; + char szUin[20]; + + if (DBGetContactSettingString(NULL,"CList","TitleText",&dbv) == 0&&(dbv.pszVal)) + { + s = mir_strdup(dbv.pszVal); + mir_free(dbv.pszVal); + } + else + { + s = mir_strdup(MIRANDANAME); + } + + if (s) + { + SetDlgItemTextA(hwndDlg,IDC_TITLETEXT,s); + mir_free(s); + } + + SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)MIRANDANAME); + wsprintfA(szUin,"%u",DBGetContactSettingDword(NULL,"ICQ","UIN",0)); + SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)szUin); + + if (!DBGetContactSettingString(NULL,"ICQ","Nick",&dbv)) { + SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)dbv.pszVal); + mir_free(dbv.pszVal); + dbv.pszVal = NULL; + } + if (!DBGetContactSettingString(NULL,"ICQ","FirstName",&dbv)) { + SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)dbv.pszVal); + mir_free(dbv.pszVal); + dbv.pszVal = NULL; + } + if (!DBGetContactSettingString(NULL,"ICQ","e-mail",&dbv)) { + SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)dbv.pszVal); + mir_free(dbv.pszVal); + dbv.pszVal = NULL; + } + } + if (!IsWinVer2000Plus()) { + EnableWindow(GetDlgItem(hwndDlg,IDC_FADEINOUT),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENT),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_DROPSHADOW),FALSE); + } + else CheckDlgButton(hwndDlg,IDC_TRANSPARENT,DBGetContactSettingByte(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)?BST_CHECKED:BST_UNCHECKED); + if (!IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)) { + EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC11),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC12),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSACTIVE),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSINACTIVE),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_ACTIVEPERC),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_INACTIVEPERC),FALSE); + } + SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_SETRANGE,FALSE,MAKELONG(1,255)); + SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_SETRANGE,FALSE,MAKELONG(1,255)); + SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_SETPOS,TRUE,DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT)); + SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_SETPOS,TRUE,DBGetContactSettingByte(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT)); + SendMessage(hwndDlg,WM_HSCROLL,0x12345678,0); + + // EXTRA Icons + if (ServiceExists("ExtraIcon/Register")) + { + ShowWindow(GetDlgItem(hwndDlg,IDC_EXTRA_FRAME), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg,IDC_EXTRA_PROTO), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg,IDC_EXTRA_WEB), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg,IDC_EXTRA_EMAIL), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg,IDC_EXTRA_CELLULAR), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg,IDC_EXTRA_ADV1), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg,IDC_EXTRA_ADV2), SW_HIDE); + } + else + { + CheckDlgButton(hwndDlg, IDC_EXTRA_PROTO, DBGetContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_PROTO",1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_EXTRA_WEB, DBGetContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_WEB",1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_EXTRA_EMAIL, DBGetContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_EMAIL",1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_EXTRA_CELLULAR, DBGetContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_SMS",1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_EXTRA_ADV1, DBGetContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_ADV1",1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_EXTRA_ADV2, DBGetContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_ADV2",1) ? BST_CHECKED : BST_UNCHECKED); + } + + return TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDC_AUTOHIDE) { + EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIME),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); + EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); + EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC01),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); + } + else if (LOWORD(wParam) == IDC_TRANSPARENT) { + EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC11),IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)); + EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC12),IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)); + EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSACTIVE),IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)); + EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSINACTIVE),IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)); + EnableWindow(GetDlgItem(hwndDlg,IDC_ACTIVEPERC),IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)); + EnableWindow(GetDlgItem(hwndDlg,IDC_INACTIVEPERC),IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)); + } + else if (LOWORD(wParam) == IDC_AUTOSIZE) { + EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC21),IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)); + EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC22),IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)); + EnableWindow(GetDlgItem(hwndDlg,IDC_MAXSIZEHEIGHT),IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)); + EnableWindow(GetDlgItem(hwndDlg,IDC_MAXSIZESPIN),IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)); + EnableWindow(GetDlgItem(hwndDlg,IDC_AUTOSIZEUPWARD),IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)); + } + else if (LOWORD(wParam) == IDC_TOOLWND) { + EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),!IsDlgButtonChecked(hwndDlg,IDC_TOOLWND)); + } + else if (LOWORD(wParam) == IDC_SHOWCAPTION) { + EnableWindow(GetDlgItem(hwndDlg,IDC_TOOLWND),IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)); + EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),!IsDlgButtonChecked(hwndDlg,IDC_TOOLWND) && IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)); + EnableWindow(GetDlgItem(hwndDlg,IDC_TITLETEXT),IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)); + } + + if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_TITLETEXT || LOWORD(wParam) == IDC_MAXSIZEHEIGHT) && + (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) + return 0; + + // Enable apply button + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + + case WM_HSCROLL: + { char str[10]; + wsprintfA(str,"%d%%",100*SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_GETPOS,0,0)/255); + SetDlgItemTextA(hwndDlg,IDC_INACTIVEPERC,str); + wsprintfA(str,"%d%%",100*SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_GETPOS,0,0)/255); + SetDlgItemTextA(hwndDlg,IDC_ACTIVEPERC,str); + } + if (wParam != 0x12345678) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case WM_NOTIFY: + switch (((LPNMHDR)lParam)->code) + { + case PSN_APPLY: + DBWriteContactSettingByte(NULL,"CList","OnTop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONTOP)); + SetWindowPos(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg,IDC_ONTOP)?HWND_TOPMOST:HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + + DBWriteContactSettingByte(NULL,"CList","ToolWindow",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_TOOLWND)); + DBWriteContactSettingByte(NULL,"CList","BringToFront",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BRINGTOFRONT)); + if (IsDlgButtonChecked(hwndDlg,IDC_TOOLWND)) { + // Window must be hidden to dynamically remove the taskbar button. + // See http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_programming/taskbar.asp + WINDOWPLACEMENT p; + p.length = sizeof(p); + GetWindowPlacement(pcli->hwndContactList,&p); + ShowWindow(pcli->hwndContactList,SW_HIDE); + SetWindowLongPtr(pcli->hwndContactList,GWL_EXSTYLE,GetWindowLongPtr(pcli->hwndContactList,GWL_EXSTYLE)|WS_EX_TOOLWINDOW|WS_EX_WINDOWEDGE); + SetWindowPlacement(pcli->hwndContactList,&p); + } + else + SetWindowLongPtr(pcli->hwndContactList,GWL_EXSTYLE,GetWindowLongPtr(pcli->hwndContactList,GWL_EXSTYLE)&~WS_EX_TOOLWINDOW); + + if (IsDlgButtonChecked(hwndDlg,IDC_ONDESKTOP)) { + HWND hProgMan = FindWindowA("Progman",NULL); + if (IsWindow(hProgMan)) SetParent(pcli->hwndContactList,hProgMan); + } else { + SetParent(pcli->hwndContactList,NULL); + } + + DBWriteContactSettingByte(NULL,"CLUI","ShowCaption",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)); + DBWriteContactSettingByte(NULL,"CLUI","ShowMainMenu",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWMAINMENU)); + DBWriteContactSettingByte(NULL,"CLUI","ClientAreaDrag",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CLIENTDRAG)); + + if (IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) + SetWindowLongPtr(pcli->hwndContactList,GWL_STYLE,GetWindowLongPtr(pcli->hwndContactList,GWL_STYLE)|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX); + else + SetWindowLongPtr(pcli->hwndContactList,GWL_STYLE,GetWindowLongPtr(pcli->hwndContactList,GWL_STYLE)&~(WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX)); + + if (!IsDlgButtonChecked(hwndDlg,IDC_SHOWMAINMENU)) SetMenu(pcli->hwndContactList,NULL); + else SetMenu(pcli->hwndContactList,hMenuMain); + + SetWindowPos(pcli->hwndContactList,0,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED); + RedrawWindow(pcli->hwndContactList,NULL,NULL,RDW_FRAME|RDW_INVALIDATE); + + DBWriteContactSettingByte(NULL,"CList","Min2Tray",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_MIN2TRAY)); + if (IsIconic(pcli->hwndContactList) && !IsDlgButtonChecked(hwndDlg,IDC_TOOLWND)) + ShowWindow(pcli->hwndContactList,IsDlgButtonChecked(hwndDlg,IDC_MIN2TRAY)?SW_HIDE:SW_SHOW); + + { TCHAR title[256]; + GetDlgItemText(hwndDlg,IDC_TITLETEXT,title,SIZEOF(title)); + DBWriteContactSettingTString(NULL,"CList","TitleText",title); + SetWindowText(pcli->hwndContactList,title); + } + DBWriteContactSettingByte(NULL,"CLUI","FadeInOut",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_FADEINOUT)); + DBWriteContactSettingByte(NULL,"CLUI","AutoSize",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)); + DBWriteContactSettingByte(NULL,"CLUI","MaxSizeHeight",(BYTE)GetDlgItemInt(hwndDlg,IDC_MAXSIZEHEIGHT,NULL,FALSE)); + DBWriteContactSettingByte(NULL,"CLUI","AutoSizeUpward",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZEUPWARD)); + DBWriteContactSettingByte(NULL,"CList","AutoHide",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); + DBWriteContactSettingWord(NULL,"CList","HideTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_GETPOS,0,0)); + + DBWriteContactSettingByte(NULL,"CList","Transparent",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)); + DBWriteContactSettingByte(NULL,"CList","Alpha",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_GETPOS,0,0)); + DBWriteContactSettingByte(NULL,"CList","AutoAlpha",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_GETPOS,0,0)); + DBWriteContactSettingByte(NULL,"CList","WindowShadow",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DROPSHADOW)); + DBWriteContactSettingByte(NULL,"CList","OnDesktop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONDESKTOP)); + if (IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)) { + SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); + if (MySetLayeredWindowAttributes) MySetLayeredWindowAttributes(pcli->hwndContactList, RGB(0,0,0), (BYTE)DBGetContactSettingByte(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA); + } + else { + SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED); + } + SendMessage(pcli->hwndContactTree,WM_SIZE,0,0); //forces it to send a cln_listsizechanged + + if (!ServiceExists("ExtraIcon/Register")) + { + DBWriteContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_PROTO",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EXTRA_PROTO)); + DBWriteContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_WEB",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EXTRA_WEB)); + DBWriteContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_EMAIL",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EXTRA_EMAIL)); + DBWriteContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_SMS",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EXTRA_CELLULAR)); + DBWriteContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_ADV1",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EXTRA_ADV1)); + DBWriteContactSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_ADV2",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EXTRA_ADV2)); + //SetAllExtraIcons() + ReAssignExtraIcons(); + } + + return TRUE; + } + break; + } + return FALSE; +} + +static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + CheckDlgButton(hwndDlg, IDC_SHOWSBAR, DBGetContactSettingByte(NULL,"CLUI","ShowSBar",1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_USECONNECTINGICON, DBGetContactSettingByte(NULL,"CLUI","UseConnectingIcon",1) ? BST_CHECKED : BST_UNCHECKED); + { BYTE showOpts = DBGetContactSettingByte(NULL,"CLUI","SBarShow",1); + CheckDlgButton(hwndDlg, IDC_SHOWICON, showOpts&1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWPROTO, showOpts&2 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWSTATUS, showOpts&4 ? BST_CHECKED : BST_UNCHECKED); + } + CheckDlgButton(hwndDlg, IDC_RIGHTSTATUS, DBGetContactSettingByte(NULL,"CLUI","SBarRightClk",0) ? BST_UNCHECKED : BST_CHECKED); + CheckDlgButton(hwndDlg, IDC_RIGHTMIRANDA, !IsDlgButtonChecked(hwndDlg,IDC_RIGHTSTATUS) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, DBGetContactSettingByte(NULL,"CLUI","EqualSections",0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SBPANELBEVEL, DBGetContactSettingByte(NULL,"CLUI","SBarBevel",1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWSIZEGRIP, DBGetContactSettingByte(NULL,"CLUI","SBarUseSizeGrip",1) ? BST_CHECKED : BST_UNCHECKED); + + CheckDlgButton(hwndDlg, IDC_USEOWNERDRAW, DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",1) ? BST_CHECKED : BST_UNCHECKED); + + SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"CLUI","SBarBKColor",CLR_DEFAULT)); + + if (!IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)) { + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWICON),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWPROTO),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWSTATUS),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_RIGHTSTATUS),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_RIGHTMIRANDA),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_EQUALSECTIONS),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_SBPANELBEVEL),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWSIZEGRIP),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_USECONNECTINGICON),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_USEOWNERDRAW),FALSE); + + } + return TRUE; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_SHOWSBAR) { + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWICON),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWPROTO),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWSTATUS),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); + EnableWindow(GetDlgItem(hwndDlg,IDC_RIGHTSTATUS),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); + EnableWindow(GetDlgItem(hwndDlg,IDC_RIGHTMIRANDA),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); + EnableWindow(GetDlgItem(hwndDlg,IDC_EQUALSECTIONS),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); + EnableWindow(GetDlgItem(hwndDlg,IDC_SBPANELBEVEL),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWSIZEGRIP),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); + EnableWindow(GetDlgItem(hwndDlg,IDC_USECONNECTINGICON),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); + EnableWindow(GetDlgItem(hwndDlg,IDC_USEOWNERDRAW),IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); + + } + if (LOWORD(wParam) == IDC_DEFBKCOLOR) + { + SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,CLR_DEFAULT); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case WM_NOTIFY: + switch (((LPNMHDR)lParam)->code) + { + case PSN_APPLY: + { + int frameopt; + + COLORREF col; + col = SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_GETCOLOUR,0,0); + DBWriteContactSettingDword(NULL,"CLUI","SBarBKColor",col); + + + + DBWriteContactSettingByte(NULL,"CLUI","ShowSBar",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); + DBWriteContactSettingByte(NULL,"CLUI","SBarShow",(BYTE)((IsDlgButtonChecked(hwndDlg,IDC_SHOWICON)?1:0)|(IsDlgButtonChecked(hwndDlg,IDC_SHOWPROTO)?2:0)|(IsDlgButtonChecked(hwndDlg,IDC_SHOWSTATUS)?4:0))); + DBWriteContactSettingByte(NULL,"CLUI","SBarRightClk",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_RIGHTMIRANDA)); + DBWriteContactSettingByte(NULL,"CLUI","EqualSections",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EQUALSECTIONS)); + DBWriteContactSettingByte(NULL,"CLUI","SBarBevel",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SBPANELBEVEL)); + DBWriteContactSettingByte(NULL,"CLUI","SBarUseSizeGrip",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWSIZEGRIP)); + + DBWriteContactSettingByte(NULL,"CLUI","UseConnectingIcon",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USECONNECTINGICON)); + DBWriteContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USEOWNERDRAW)); + UseOwnerDrawStatusBar = DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",0); +/* + if (IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)) ShowWindow(pcli->hwndStatus,SW_SHOW); + else ShowWindow(pcli->hwndStatus,SW_HIDE); +*/ + + frameopt = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,hFrameHelperStatusBar),0); + + frameopt = frameopt & (~F_VISIBLE); + + if (IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)) { + ShowWindow(pcli->hwndStatus,SW_SHOW); + frameopt |= F_VISIBLE; + } + else ShowWindow(pcli->hwndStatus,SW_HIDE); + + CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,hFrameHelperStatusBar),frameopt); + + SendMessage(pcli->hwndContactList,WM_SIZE,0,0); + + OnStatusBarBackgroundChange(); + CluiProtocolStatusChanged(0,0); + return TRUE; + } + } + break; + } + return FALSE; +} diff --git a/plugins/Clist_mw/src/cluiservices.cpp b/plugins/Clist_mw/src/cluiservices.cpp new file mode 100644 index 0000000000..f75fbc9dac --- /dev/null +++ b/plugins/Clist_mw/src/cluiservices.cpp @@ -0,0 +1,176 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 "commonheaders.h" +#include "m_clc.h" +#include "m_clui.h" + +extern int CreateTimerForConnectingIcon(WPARAM,LPARAM); + +void FreeProtocolData( void ) +{ + //free protocol data + int nPanel; + int nParts = SendMessage(pcli->hwndStatus,SB_GETPARTS,0,0); + for (nPanel = 0;nPanelhwndStatus,SB_GETTEXT,(WPARAM)nPanel,(LPARAM)0); + if (PD != NULL && !IsBadCodePtr(( FARPROC )PD)) { + SendMessage(pcli->hwndStatus,SB_SETTEXT,(WPARAM)nPanel|SBT_OWNERDRAW,(LPARAM)0); + if (PD->RealName) mir_free(PD->RealName); + if (PD) mir_free(PD); +} } } + +void CluiProtocolStatusChanged(int parStatus, const char* szProto) +{ + int protoCount,i; + PROTOACCOUNT **accs; + int *partWidths,partCount; + int borders[3]; + int flags; + int FirstIconOffset; + + if ( pcli->hwndStatus == 0 ) + return; + + FirstIconOffset = DBGetContactSettingDword(NULL,"CLUI","FirstIconOffset",0); + + ProtoEnumAccounts( &protoCount, &accs ); + if ( protoCount == 0 ) + return; + + OutputDebugStringA("CluiProtocolStatusChanged"); + OutputDebugStringA("\r\n"); + FreeProtocolData(); + + SendMessage(pcli->hwndStatus,SB_GETBORDERS,0,(LPARAM)&borders); + + SendMessage(pcli->hwndStatus,SB_SETBKCOLOR,0,DBGetContactSettingDword(0,"CLUI","SBarBKColor",CLR_DEFAULT)); + partWidths = (int*)alloca((protoCount+1)*sizeof(int)); + //partWidths[0] = FirstIconOffset; + if (DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",0)||DBGetContactSettingByte(NULL,"CLUI","EqualSections",1)) + { + RECT rc; + int toshow, part; + + SendMessage(pcli->hwndStatus,WM_SIZE,0,0); + GetClientRect(pcli->hwndStatus,&rc); + rc.right -= borders[0]*2; + toshow = 0; + for (i = 0;ipfnGetProtocolVisibility( accs[i]->szModuleName )) + continue; + + toshow++; + } + + if (toshow>0) + { + for (part = 0,i = 0;ipfnGetProtocolVisibility( accs[i]->szModuleName )) + continue; + + partWidths[part] = ((part+1)*(rc.right/toshow))-(borders[2]>>1); + //partWidths[part] = 40*part+40; + part++; + } + //partCount = part; + } + partCount = toshow; + + } + else { + HDC hdc; + SIZE textSize; + BYTE showOpts = DBGetContactSettingByte(NULL,"CLUI","SBarShow",5); + DWORD extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0); + DWORD startoffset = DBGetContactSettingDword(NULL,"StatusBar","FirstIconOffset",0); + int x; + + hdc = GetDC(pcli->hwndStatus); + + for (partCount = 0,i = 0;ipfnGetAccountIndexByPos(i); + if (ind < 0) + continue; + + if (!pcli->pfnGetProtocolVisibility(accs[ind]->szModuleName)) + continue; + + x = 2; + if (showOpts & 1) x += GetSystemMetrics(SM_CXSMICON); + if (showOpts & 2) { + TCHAR szName[64]; + mir_sntprintf(szName, SIZEOF(szName), _T("%s%s"), accs[ind]->tszAccountName, showOpts&4 ? _T(" ") : _T("")); + GetTextExtentPoint32(hdc, szName, (int)_tcslen(szName), &textSize); + x += textSize.cx; + } + if (showOpts & 4) { + int status = CallProtoService(accs[ind]->szModuleName, PS_GETSTATUS, 0, 0); + TCHAR *szStatus = pcli->pfnGetStatusModeDescription(status, 0); + if (!szStatus) + szStatus = _T(""); + GetTextExtentPoint32(hdc, szStatus, (int)_tcslen(szStatus), &textSize); + x += textSize.cx; + } + if (showOpts&6) x += 2; + partWidths[partCount] = (partCount?partWidths[partCount-1]:startoffset)+x+extraspace; + partCount++; + } + ReleaseDC(pcli->hwndStatus,hdc); + } + if (partCount == 0) { + SendMessage(pcli->hwndStatus,SB_SIMPLE,TRUE,0); + return; + } + SendMessage(pcli->hwndStatus,SB_SIMPLE,FALSE,0); + + partWidths[partCount-1] = -1; + + SendMessage(pcli->hwndStatus,SB_SETMINHEIGHT,GetSystemMetrics(SM_CYSMICON)+2,0); + SendMessage(pcli->hwndStatus,SB_SETPARTS,partCount,(LPARAM)partWidths); + + flags = SBT_OWNERDRAW; + if ( !DBGetContactSettingByte(NULL, "CLUI", "SBarBevel", 1)) + flags |= SBT_NOBORDERS; + + for (partCount = 0, i = 0; ipfnGetAccountIndexByPos(i); + if (ind < 0) continue; + + if (!pcli->pfnGetProtocolVisibility(accs[ind]->szModuleName)) + continue; + + ProtocolData *PD = (ProtocolData*)mir_alloc(sizeof(ProtocolData)); + PD->RealName = mir_strdup(accs[ind]->szModuleName); + PD->protopos = accs[ind]->iOrder; + + SendMessage(pcli->hwndStatus, SB_SETTEXT, partCount++ | flags, (LPARAM)PD); + } + + CreateTimerForConnectingIcon(parStatus, (LPARAM)szProto); + InvalidateRect(pcli->hwndStatus, NULL, FALSE); + return; +} diff --git a/plugins/Clist_mw/src/commonheaders.cpp b/plugins/Clist_mw/src/commonheaders.cpp new file mode 100644 index 0000000000..df68c5385c --- /dev/null +++ b/plugins/Clist_mw/src/commonheaders.cpp @@ -0,0 +1,29 @@ +#include "commonheaders.h" + +#define SAFE_PTR(a) a?(IsBadReadPtr(a,1)?a = NULL:a):a + +int __cdecl MyStrCmp (const char *a, const char *b) +{ + SAFE_PTR(a); + SAFE_PTR(b); + if ( !(a && b)) return a != b; + return (strcmp(a,b)); +} + +DWORD exceptFunction(LPEXCEPTION_POINTERS EP) +{ + //printf("1 "); // printed first + char buf[4096]; + + + sprintf(buf,"\r\nExceptCode: %x\r\nExceptFlags: %x\r\nExceptAddress: %p\r\n", + EP->ExceptionRecord->ExceptionCode, + EP->ExceptionRecord->ExceptionFlags, + EP->ExceptionRecord->ExceptionAddress + ); + OutputDebugStringA(buf); + MessageBoxA(0,buf,"clist_mw Exception",0); + + + return EXCEPTION_EXECUTE_HANDLER; +} diff --git a/plugins/Clist_mw/src/commonheaders.h b/plugins/Clist_mw/src/commonheaders.h new file mode 100644 index 0000000000..61af060b38 --- /dev/null +++ b/plugins/Clist_mw/src/commonheaders.h @@ -0,0 +1,126 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2004 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. +*/ +#define _CRT_SECURE_NO_WARNINGS +#ifndef _COMMON_HEADERS_H_ +#define _COMMON_HEADERS_H_ 1 + +#define MIRANDA_VER 0x0A00 + +#define _WIN32_WINNT 0x0501 +#define _WIN32_IE 0x0501 + +#include "m_stdhdr.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "resource.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "m_genmenu.h" +#include "m_clui.h" + +#include "clc.h" +#include "clist.h" +#include "m_icolib.h" +#include +#include "CLUIFrames/cluiframes.h" +#include "m_cluiframes.h" +#include "m_metacontacts.h" +#include "BkgrCfg.h" +#include +#include +#include "m_fontservice.h" + +// shared vars +extern HINSTANCE g_hInst; + +/* most free()'s are invalid when the code is executed from a dll, so this changes + all the bad free()'s to good ones, however it's still incorrect code. The reasons for not + changing them include: + + * DBFreeVariant has a CallService() lookup + * free() is executed in some large loops to do with clist creation of group data + * easy search and replace + +*/ + +#ifndef CS_DROPSHADOW +#define CS_DROPSHADOW 0x00020000 +#endif + +extern BOOL __cdecl strstri(const char *a, const char *b); +extern BOOL __cdecl boolstrcmpi(const char *a, const char *b); +extern int __cdecl MyStrCmp (const char *a, const char *b); +extern int __cdecl MyStrLen (const char *a); +extern int __cdecl MyStrCmpi(const char *a, const char *b); +extern int __cdecl MyStrCmpiT(const TCHAR *a, const TCHAR *b); + +extern DWORD exceptFunction(LPEXCEPTION_POINTERS EP); + +extern int ( *saveIconFromStatusMode )( const char *szProto,int nStatus, HANDLE hContact); + +//from bkg options + +// 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 "BkgrCfg/Register" + +// +// Notification about changed background +// wParam = ModuleName +// lParam = 0 +#define ME_BACKGROUNDCONFIG_CHANGED "BkgrCfg/Changed" + + + +#define EXTRACOLUMNCOUNT 9 + + +#endif diff --git a/plugins/Clist_mw/src/contact.cpp b/plugins/Clist_mw/src/contact.cpp new file mode 100644 index 0000000000..d8cf0f37d4 --- /dev/null +++ b/plugins/Clist_mw/src/contact.cpp @@ -0,0 +1,197 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 "commonheaders.h" +#include "m_clui.h" +#include "clist.h" + +extern HANDLE hContactIconChangedEvent; +extern int GetContactCachedStatus(HANDLE hContact); +extern char *GetContactCachedProtocol(HANDLE hContact); + +int sortByStatus; +static int sortByProto; +static int sortNoOfflineBottom; +struct { + int status,order; +} statusModeOrder[] = { + {ID_STATUS_OFFLINE,500}, + {ID_STATUS_ONLINE,0}, + {ID_STATUS_AWAY,200}, + {ID_STATUS_DND,400}, + {ID_STATUS_NA,450}, + {ID_STATUS_OCCUPIED,100}, + {ID_STATUS_FREECHAT,50}, + {ID_STATUS_INVISIBLE,20}, + {ID_STATUS_ONTHEPHONE,150}, + {ID_STATUS_OUTTOLUNCH,425}}; + +static int GetContactStatus(HANDLE hContact) +{ + /* + + char *szProto; + + szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); + if (szProto == NULL) return ID_STATUS_OFFLINE; + return DBGetContactSettingWord(hContact,szProto,"Status",ID_STATUS_OFFLINE); + */ + return (GetContactCachedStatus(hContact)); +} + +void ChangeContactIcon(HANDLE hContact,int iIcon,int add) +{ + //clui MS_CLUI_CONTACTADDED MS_CLUI_CONTACTSETICON this methods is null + //CallService(add?MS_CLUI_CONTACTADDED:MS_CLUI_CONTACTSETICON,(WPARAM)hContact,iIcon); + NotifyEventHooks(hContactIconChangedEvent,(WPARAM)hContact,iIcon); +} + +static int GetStatusModeOrdering(int statusMode) +{ + int i; + for (i = 0; i< SIZEOF(statusModeOrder); i++) + if (statusModeOrder[i].status == statusMode) return statusModeOrder[i].order; + return 1000; +} + +void LoadContactTree(void) +{ + HANDLE hContact; + int i,hideOffline,status,tick; + pdisplayNameCacheEntry cacheEntry; + + + + tick = GetTickCount(); + CallService(MS_CLUI_LISTBEGINREBUILD,0,0); + for (i = 1;;i++) { + if ((char*)CallService(MS_CLIST_GROUPGETNAME2,i,(LPARAM)(int*)NULL) == NULL) break; + CallService(MS_CLUI_GROUPADDED,i,0); + } + + hideOffline = DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT); + hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); + + while(hContact != NULL) { + cacheEntry = GetContactFullCacheEntry(hContact); + if (cacheEntry == NULL) + { + MessageBoxA(0,"Fail To Get CacheEntry for hContact","!!!!!",0); + break; + } + status = cacheEntry->status; + if ((!hideOffline || status != ID_STATUS_OFFLINE) && !cacheEntry->bIsHidden) + ChangeContactIcon(hContact,ExtIconFromStatusMode(hContact,(char*)cacheEntry->szProto,status),1); + hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0); + } + sortByStatus = DBGetContactSettingByte(NULL,"CList","SortByStatus",SETTING_SORTBYSTATUS_DEFAULT); + sortByProto = DBGetContactSettingByte(NULL,"CList","SortByProto",SETTING_SORTBYPROTO_DEFAULT); + sortNoOfflineBottom = DBGetContactSettingByte(NULL,"CList","NoOfflineBottom",SETTING_NOOFFLINEBOTTOM_DEFAULT); + + CallService(MS_CLUI_SORTLIST,0,0); + CallService(MS_CLUI_LISTENDREBUILD,0,0); + + tick = GetTickCount()-tick; + { + char buf[255]; + //sprintf(buf,"%s %s took %i ms",__FILE__,__LINE__,tick); + sprintf(buf,"LoadContactTree %d \r\n",tick); + + OutputDebugStringA(buf); + } +} + +#define SAFESTRING(a) a?a:"" + +int CompareContacts( const struct ClcContact *contact1, const struct ClcContact *contact2 ) +{ + HANDLE a = contact1->hContact, b = contact2->hContact; + TCHAR *namea,*nameb; + int statusa,statusb; + char *szProto1,*szProto2; + int rc; + + GetContactInfosForSort(a,&szProto1,&namea,&statusa); + GetContactInfosForSort(b,&szProto2,&nameb,&statusb); + + if (sortByProto) { + + /* deal with statuses, online contacts have to go above offline */ + if (sortNoOfflineBottom == 0) + if ((statusa == ID_STATUS_OFFLINE) != (statusb == ID_STATUS_OFFLINE)) { + return 2*(statusa == ID_STATUS_OFFLINE)-1; + } + /* both are online, now check protocols */ + rc = strcmp(SAFESTRING(szProto1),SAFESTRING(szProto2)); /* strcmp() doesn't like NULL so feed in "" as needed */ + if (rc != 0 && (szProto1 != NULL && szProto2 != NULL)) return rc; + /* protocols are the same, order by display name */ + } + + if (sortByStatus) { + int ordera,orderb; + ordera = GetStatusModeOrdering(statusa); + orderb = GetStatusModeOrdering(statusb); + if (ordera != orderb) return ordera-orderb; + } + else { + //one is offline: offline goes below online + if (sortNoOfflineBottom == 0) + { + if ((statusa == ID_STATUS_OFFLINE) != (statusb == ID_STATUS_OFFLINE)) { + return 2*(statusa == ID_STATUS_OFFLINE)-1; + } + } + } + + //otherwise just compare names + return _tcsicmp(namea,nameb); +} + +#undef SAFESTRING + +static UINT_PTR resortTimerId = 0; +static VOID CALLBACK SortContactsTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD dwTime) +{ + KillTimer(NULL,resortTimerId); + resortTimerId = 0; + CallService(MS_CLUI_SORTLIST,0,0); +} + +void SortContacts(void) +{ + //avoid doing lots of resorts in quick succession + sortByStatus = DBGetContactSettingByte(NULL,"CList","SortByStatus",SETTING_SORTBYSTATUS_DEFAULT); + sortByProto = DBGetContactSettingByte(NULL,"CList","SortByProto",SETTING_SORTBYPROTO_DEFAULT); + if (resortTimerId) KillTimer(NULL,resortTimerId); + resortTimerId = SetTimer(NULL,0,50,SortContactsTimer); +} + +INT_PTR ContactChangeGroup(WPARAM wParam,LPARAM lParam) +{ + CallService(MS_CLUI_CONTACTDELETED,wParam,0); + if ((HANDLE)lParam == NULL) + DBDeleteContactSetting((HANDLE)wParam,"CList","Group"); + else + DBWriteContactSettingString((HANDLE)wParam,"CList","Group",(char*)CallService(MS_CLIST_GROUPGETNAME2,lParam,(LPARAM)(int*)NULL)); + CallService(MS_CLUI_CONTACTADDED,wParam,ExtIconFromStatusMode((HANDLE)wParam,(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0),GetContactStatus((HANDLE)wParam))); + return 0; +} diff --git a/plugins/Clist_mw/src/groupmenu.cpp b/plugins/Clist_mw/src/groupmenu.cpp new file mode 100644 index 0000000000..496f98e78c --- /dev/null +++ b/plugins/Clist_mw/src/groupmenu.cpp @@ -0,0 +1,651 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 "commonheaders.h" +#include "m_clui.h" +#include "clist.h" +#include "clc.h" + +//////////////////////////////Group MENU///////////////////////// + +extern HANDLE hHideShowMainMenuItem; +HANDLE hGroupMenuObject; + +HANDLE hGroupMainMenuItemProxy; +HANDLE hGroupStatusMenuItemProxy; +HANDLE hPreBuildGroupMenuEvent; + +HANDLE hHideOfflineUsersMenuItem; +HANDLE hHideOfflineUsersOutHereMenuItem; +HANDLE hHideEmptyGroupsMenuItem; +HANDLE hDisableGroupsMenuItem; +HANDLE hNewGroupMenuItem; +HANDLE hNewSubGroupMenuItem; + +int NewGroupIconidx; + +extern HIMAGELIST hCListImages; +HICON LoadIconFromExternalFile(char *filename,int i,boolean UseLibrary,boolean registerit,char *IconName,char *SectName,char *Description,int internalidx,HICON DefIcon); + +void InitSubGroupMenus(void); + +//Groupmenu exec param(ownerdata) +typedef struct{ +char *szServiceName; +int Param1,Param2; +}GroupMenuExecParam,*lpGroupMenuExecParam; + +/* +wparam = handle to the menu item returned by MS_CLIST_ADDCONTACTMENUITEM +return 0 on success. +*/ +static INT_PTR RemoveGroupMenuItem(WPARAM wParam,LPARAM lParam) +{ + CallService(MO_REMOVEMENUITEM,wParam,0); + return 0; +} + + +static INT_PTR BuildGroupMenu(WPARAM wParam,LPARAM lParam) +{ + int tick; + HMENU hMenu; + ListParam param = { 0 }; + param.MenuObjectHandle = hGroupMenuObject; + + //hMenu = hMainMenu; + hMenu = CreatePopupMenu(); + //hMenu = wParam; + tick = GetTickCount(); + + NotifyEventHooks(hPreBuildGroupMenuEvent,0,0); + + CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m); + //DrawMenuBar((HWND)CallService("CLUI/GetHwnd",0,0)); + tick = GetTickCount()-tick; + return (INT_PTR)hMenu; +} + +static INT_PTR AddGroupMenuItem(WPARAM wParam,LPARAM lParam) +{ + TMO_MenuItem tmi; + CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; + if ( !pcli->pfnConvertMenu(mi, &tmi)) + return 0; + + lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)mir_calloc(sizeof(GroupMenuExecParam)); + if (mmep == NULL) + return 0; + + //we need just one parametr. + mmep->szServiceName = mir_strdup(mi->pszService); + mmep->Param1 = mi->popupPosition; + lpGroupMenuParam gmp = (lpGroupMenuParam)wParam; + if (gmp != NULL) { + mmep->Param1 = gmp->wParam; + mmep->Param2 = gmp->lParam; + } + tmi.ownerdata = mmep; + + char buf[1024]; + sprintf(buf,"%s/%s",mi->pszService,mi->pszName); + + OptParam op; + op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hGroupMenuObject,(LPARAM)&tmi); + op.Setting = OPT_MENUITEMSETUNIQNAME; + op.Value = (INT_PTR)buf; + CallService(MO_SETOPTIONSMENUITEM,(WPARAM)0,(LPARAM)&op); + return (INT_PTR)op.Handle; + +// mainItemCount++; +// return MENU_CUSTOMITEMMAIN|(mainMenuItem[mainItemCount-1].id); +} + +INT_PTR GroupMenuCheckService(WPARAM wParam,LPARAM lParam) { +//not used + return 0; +} + +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 = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0); + } + + if (hGroupStatusMenuItemProxy == (HANDLE)lParam) { + mii->fMask |= MIIM_SUBMENU; + mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); + } + + 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 (!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 wParam,LPARAM lParam) +{ + + lpGroupMenuExecParam mmep; + mmep = (lpGroupMenuExecParam)lParam; + if (mmep != NULL){ + FreeAndNil((void**)&mmep->szServiceName); + FreeAndNil((void**)&mmep); + } + +return 0; +} + +INT_PTR HideGroupsHelper(WPARAM wParam,LPARAM lParam) +{ + int newVal = !(GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_HIDEEMPTYGROUPS); + DBWriteContactSettingByte(NULL,"CList","HideEmptyGroups",(BYTE)newVal); + SendMessage(pcli->hwndContactTree,CLM_SETHIDEEMPTYGROUPS,newVal,0); + return 0; +} + +INT_PTR UseGroupsHelper(WPARAM wParam,LPARAM lParam) +{ + int newVal = !(GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_USEGROUPS); + DBWriteContactSettingByte(NULL,"CList","UseGroups",(BYTE)newVal); + SendMessage(pcli->hwndContactTree,CLM_SETUSEGROUPS,newVal,0); + return 0; +} + +INT_PTR HideOfflineRootHelper(WPARAM wParam,LPARAM lParam) +{ +SendMessage( + pcli->hwndContactTree, + CLM_SETHIDEOFFLINEROOT, + !SendMessage(pcli->hwndContactTree,CLM_GETHIDEOFFLINEROOT,0,0), + 0); + return 0; +} + +static int OnBuildGroupMenu(WPARAM wParam,LPARAM lParam) +{ + CLISTMENUITEM mi; + + + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.flags = CMIM_FLAGS | (DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CMIF_CHECKED:0); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersMenuItem, (LPARAM)&mi); + + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.flags = CMIM_FLAGS | (SendMessage(pcli->hwndContactTree,CLM_GETHIDEOFFLINEROOT,0,0)?CMIF_CHECKED:0); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersOutHereMenuItem, (LPARAM)&mi); + + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_HIDEEMPTYGROUPS?CMIF_CHECKED:0); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideEmptyGroupsMenuItem, (LPARAM)&mi); + + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_USEGROUPS?0:CMIF_CHECKED); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hDisableGroupsMenuItem, (LPARAM)&mi); + + return 0; +} + +int static OnIconLibIconChanged(WPARAM wParam,LPARAM lParam) +{ + HICON hicon; + CLISTMENUITEM clmi = {0}; + + hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,FALSE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP,0); + NewGroupIconidx = ImageList_ReplaceIcon(hCListImages,NewGroupIconidx,hicon); + + clmi.cbSize = sizeof(clmi); + clmi.flags = CMIM_ICON; + clmi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0); + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewSubGroupMenuItem,(LPARAM)&clmi); + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewGroupMenuItem,(LPARAM)&clmi); + return 0; +} + +void InitGroupMenus(void) +{ + TMenuParam tmp; + OptParam op; + HICON hicon; + hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,TRUE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP2,0); + NewGroupIconidx = ImageList_AddIcon(hCListImages,hicon ); + + 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("CList/AddGroupMenuItem",AddGroupMenuItem); + CreateServiceFunction(MS_CLIST_REMOVEGROUPMENUITEM,RemoveGroupMenuItem); + CreateServiceFunction(MS_CLIST_MENUBUILDGROUP,BuildGroupMenu); + hPreBuildGroupMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDGROUPMENU); + HookEvent(ME_CLIST_PREBUILDGROUPMENU,OnBuildGroupMenu); + + InitSubGroupMenus(); + + //Group menu + memset(&tmp,0,sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + tmp.CheckService = NULL; + tmp.ExecService = "CLISTMENUSGroup/ExecService"; + tmp.name = "Group Menu"; + hGroupMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp); + + + op.Handle = hGroupMenuObject; + op.Setting = OPT_USERDEFINEDITEMS; + op.Value = TRUE; + CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); + + op.Handle = hGroupMenuObject; + op.Setting = OPT_MENUOBJECT_SET_FREE_SERVICE; + op.Value = (INT_PTR)"CLISTMENUSGroup/FreeOwnerDataGroupMenu"; + CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); + + op.Handle = hGroupMenuObject; + op.Setting = OPT_MENUOBJECT_SET_ONADD_SERVICE; + op.Value = (INT_PTR)"CLISTMENUSGroup/GroupMenuonAddService"; + CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); + + { + //add exit command to menu + CLISTMENUITEM mi; + GroupMenuParam gmp; + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 1900000; + mi.pszService = "CloseAction"; + mi.pszName = LPGEN("E&xit"); + AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 500; + mi.pszService = MS_CLIST_SHOWHIDE; + mi.pszName = LPGEN("&Hide/Show"); + hHideShowMainMenuItem = (HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 200000; + mi.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_FINDUSER)); + mi.pszService = "FindAdd/FindAddCommand"; + mi.pszName = LPGEN("&Find/Add Contacts..."); + AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 300000; + mi.pszService = ""; + mi.pszName = LPGEN("&Main Menu"); + hGroupMainMenuItemProxy = (HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 300100; + mi.pszService = ""; + mi.pszName = LPGEN("&Status"); + hGroupStatusMenuItemProxy = (HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 400000; + mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_OPTIONS)); + mi.pszService = "Options/OptionsCommand"; + mi.pszName = LPGEN("&Options..."); + + AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 500000; + mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_CLIENTMIRANDA)); + mi.pszService = "Help/AboutCommand"; + mi.pszName = LPGEN("&About"); + + //AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 100000; + mi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0); + mi.pszService = MS_CLIST_GROUPCREATE; + mi.pszName = LPGEN("&New Group"); + hNewGroupMenuItem = (HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 100001; + mi.hIcon = NULL; + mi.pszService = MS_CLIST_SETHIDEOFFLINE; + mi.pszName = LPGEN("&Hide Offline Users"); + gmp.lParam = 0;gmp.wParam = -1; + hHideOfflineUsersMenuItem = (HANDLE)AddGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 100002; + mi.hIcon = NULL; + mi.pszService = "CLISTMENUSGroup/HideOfflineRootHelper"; + mi.pszName = LPGEN("Hide &Offline Users out here"); + hHideOfflineUsersOutHereMenuItem = (HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 100003; + mi.hIcon = NULL; + mi.pszService = "CLISTMENUSGroup/HideGroupsHelper"; + mi.pszName = LPGEN("Hide &Empty Groups"); + hHideEmptyGroupsMenuItem = (HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 100004; + mi.hIcon = NULL; + mi.pszService = "CLISTMENUSGroup/UseGroupsHelper"; + mi.pszName = LPGEN("Disable &Groups"); + hDisableGroupsMenuItem = (HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + + HookEvent(ME_SKIN2_ICONSCHANGED,OnIconLibIconChanged); + + //MS_CLIST_GROUPCREATE + + } +} + +//////////////////////////////END Group MENU///////////////////////// + + + + +//////////////////////////////SubGroup MENU///////////////////////// +HANDLE hSubGroupMenuObject; + +HANDLE hSubGroupMainMenuItemProxy; +HANDLE hSubGroupStatusMenuItemProxy; +HANDLE hPreBuildSubGroupMenuEvent; +HANDLE hHideOfflineUsersHereMenuItem; + +//SubGroupmenu exec param(ownerdata) +typedef struct{ +char *szServiceName; +int Param1,Param2; +}SubGroupMenuExecParam,*lpSubGroupMenuExecParam; + +/* +wparam = handle to the menu item returned by MS_CLIST_ADDCONTACTMENUITEM +return 0 on success. +*/ +static INT_PTR RemoveSubGroupMenuItem(WPARAM wParam,LPARAM lParam) +{ + CallService(MO_REMOVEMENUITEM,wParam,0); + return 0; +} + +static int OnBuildSubGroupMenu(WPARAM wParam,LPARAM lParam) +{ + CLISTMENUITEM mi; + struct ClcGroup *group = (struct ClcGroup *)wParam; + if (wParam == 0) return 0; + + //contact->group + + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.flags = CMIM_FLAGS | (group->hideOffline?CMIF_CHECKED:0); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersHereMenuItem, (LPARAM)&mi); + + return 0; +} +static INT_PTR BuildSubGroupMenu(WPARAM wParam,LPARAM lParam) +{ + int tick; + HMENU hMenu; + ListParam param = { 0 }; + param.MenuObjectHandle = hSubGroupMenuObject; + param.wParam = wParam; + + //hMenu = hMainMenu; + hMenu = CreatePopupMenu(); + //hMenu = wParam; + tick = GetTickCount(); + + NotifyEventHooks(hPreBuildSubGroupMenuEvent,wParam,0); + + CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m); + //DrawMenuBar((HWND)CallService("CLUI/GetHwnd",0,0)); + tick = GetTickCount()-tick; + return (INT_PTR)hMenu; +} + +static INT_PTR AddSubGroupMenuItem(WPARAM wParam,LPARAM lParam) +{ + TMO_MenuItem tmi; + CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; + if ( !pcli->pfnConvertMenu(mi, &tmi)) + return 0; + + lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)mir_calloc(sizeof(SubGroupMenuExecParam)); + if ( mmep == NULL) + return 0; + + //we need just one parametr. + mmep->szServiceName = mir_strdup(mi->pszService); + mmep->Param1 = mi->popupPosition; + lpGroupMenuParam gmp = (lpGroupMenuParam)wParam; + if ( gmp != NULL ) { + mmep->Param1 = gmp->wParam; + mmep->Param2 = gmp->lParam; + } + tmi.ownerdata = mmep; + + char buf[1024]; + sprintf(buf,"%s/%s",mi->pszService,mi->pszName); + + OptParam op; + op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hSubGroupMenuObject,(LPARAM)&tmi); + op.Setting = OPT_MENUITEMSETUNIQNAME; + op.Value = (INT_PTR)buf; + CallService(MO_SETOPTIONSMENUITEM,(WPARAM)0,(LPARAM)&op); + return (INT_PTR)op.Handle; +} + +INT_PTR SubGroupMenuCheckService(WPARAM wParam,LPARAM lParam) +{ + return 0; +} + +INT_PTR SubGroupMenuonAddService(WPARAM wParam,LPARAM 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 (!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 FreeOwnerDataSubGroupMenu (WPARAM wParam,LPARAM lParam) +{ + lpSubGroupMenuExecParam mmep; + mmep = (lpSubGroupMenuExecParam)lParam; + if (mmep != NULL) { + FreeAndNil((void**)&mmep->szServiceName); + FreeAndNil((void**)&mmep); + } + + return 0; +} + +//wparam menu handle to pass to clc.c +INT_PTR GroupMenuExecProxy(WPARAM wParam,LPARAM lParam) +{ + SendMessage(pcli->hwndContactTree,WM_COMMAND,wParam,0); + return 0; +} + +void InitSubGroupMenus(void) +{ + TMenuParam tmp; + OptParam op; + + CreateServiceFunction("CLISTMENUSSubGroup/ExecService",SubGroupMenuExecService); + CreateServiceFunction("CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu",FreeOwnerDataSubGroupMenu); + CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuonAddService",SubGroupMenuonAddService); + CreateServiceFunction("CLISTMENUSSubGroup/GroupMenuExecProxy",GroupMenuExecProxy); + + CreateServiceFunction("CList/AddSubGroupMenuItem",AddSubGroupMenuItem); + CreateServiceFunction(MS_CLIST_REMOVESUBGROUPMENUITEM,RemoveSubGroupMenuItem); + CreateServiceFunction(MS_CLIST_MENUBUILDSUBGROUP,BuildSubGroupMenu); + hPreBuildSubGroupMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDSUBGROUPMENU); + HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU,OnBuildSubGroupMenu); + + //SubGroup menu + memset(&tmp,0,sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + tmp.CheckService = NULL; + tmp.ExecService = "CLISTMENUSSubGroup/ExecService"; + tmp.name = "SubGroupMenu"; + hSubGroupMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp); + + + op.Handle = hSubGroupMenuObject; + op.Setting = OPT_USERDEFINEDITEMS; + op.Value = TRUE; + CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); + + op.Handle = hSubGroupMenuObject; + op.Setting = OPT_MENUOBJECT_SET_FREE_SERVICE; + op.Value = (INT_PTR)"CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu"; + CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); + + op.Handle = hSubGroupMenuObject; + op.Setting = OPT_MENUOBJECT_SET_ONADD_SERVICE; + op.Value = (INT_PTR)"CLISTMENUSSubGroup/SubGroupMenuonAddService"; + CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); + + { + //add exit command to menu + CLISTMENUITEM mi; + GroupMenuParam gmp; + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 1000; + mi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0); + mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; + mi.pszName = LPGEN("&New SubGroup"); + gmp.lParam = 0;gmp.wParam = POPUP_NEWSUBGROUP; + hNewSubGroupMenuItem = (HANDLE)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 1001; + mi.hIcon = NULL; + mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; + mi.pszName = LPGEN("&Hide Offline Users in here"); + gmp.lParam = 0;gmp.wParam = POPUP_GROUPHIDEOFFLINE; + hHideOfflineUsersHereMenuItem = (HANDLE)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 900001; + mi.flags = CMIF_ICONFROMICOLIB; + mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_RENAME); //LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_RENAME)); + mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; + mi.pszName = LPGEN("&Rename Group"); + gmp.lParam = 0;gmp.wParam = POPUP_RENAMEGROUP; + AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = 900002; + mi.flags = CMIF_ICONFROMICOLIB; + mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_DELETE); //LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_DELETE)); + mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; + mi.pszName = LPGEN("&Delete Group"); + gmp.lParam = 0;gmp.wParam = POPUP_DELETEGROUP; + AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); + + //MS_CLIST_SubGroupCREATE + + } +} + +//////////////////////////////END SubGroup MENU///////////////////////// diff --git a/plugins/Clist_mw/src/init.cpp b/plugins/Clist_mw/src/init.cpp new file mode 100644 index 0000000000..2bec98ea31 --- /dev/null +++ b/plugins/Clist_mw/src/init.cpp @@ -0,0 +1,240 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2004 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 "commonheaders.h" + +HINSTANCE g_hInst = 0; +CLIST_INTERFACE* pcli = NULL; +int hLangpack; + +static HANDLE hCListShutdown = 0; + +HMENU BuildGroupPopupMenu( struct ClcGroup* group ); + +void CalcEipPosition( struct ClcData *dat, struct ClcContact *contact, struct ClcGroup *group, POINT *result); +void CheckPDNCE(ClcCacheEntryBase*); +void CluiProtocolStatusChanged( int, const char* ); +int CompareContacts( const struct ClcContact *contact1, const struct ClcContact *contact2 ); +void FreeDisplayNameCacheItem(ClcCacheEntryBase*); +void GetDefaultFontSetting(int i,LOGFONT *lf,COLORREF *colour); +void RebuildEntireList(HWND hwnd,struct ClcData *dat); +void RecalcScrollBar(HWND hwnd,struct ClcData *dat); + +struct ClcGroup* ( *saveAddGroup )(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flags,int groupId,int calcTotalMembers); +struct ClcGroup* ( *saveRemoveItemFromGroup )(HWND hwnd,struct ClcGroup *group,struct ClcContact *contact,int updateTotalCount); + +void (*saveFreeContact)(struct ClcContact *p); +void (*saveFreeGroup)(struct ClcGroup *p); + +LRESULT ( CALLBACK *saveContactListControlWndProc )( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); +LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); + +LRESULT ( CALLBACK *saveContactListWndProc )(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); +LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); + +void ( *saveLoadClcOptions )(HWND hwnd,struct ClcData *dat); + +int ( *saveAddItemToGroup )( struct ClcGroup *group, int iAboveItem ); +int AddItemToGroup(struct ClcGroup *group, int iAboveItem); + +int ( *saveAddInfoItemToGroup)(struct ClcGroup *group,int flags,const TCHAR *pszText); +int AddInfoItemToGroup(struct ClcGroup *group,int flags,const TCHAR *pszText); + +void ( *saveSortCLC )(HWND hwnd,struct ClcData *dat,int useInsertionSort); +void SortCLC(HWND hwnd,struct ClcData *dat,int useInsertionSort); + +INT_PTR ( *saveTrayIconProcessMessage )(WPARAM wParam,LPARAM lParam); +INT_PTR TrayIconProcessMessage(WPARAM wParam,LPARAM lParam); + +int (*saveIconFromStatusMode)(const char *szProto,int nStatus, HANDLE hContact); +int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact); + +//from clcfonts +void RegisterCListFonts( void ); +//from bgrcfg +extern int BGModuleLoad(); +extern int BGModuleUnload(); + +PLUGININFOEX pluginInfo = { + sizeof(PLUGININFOEX), + "MultiWindow Contact List", + PLUGIN_MAKE_VERSION(0,9,0,0), + "Display contacts, event notifications, protocol status with MW modifications", + "", + "bethoven@mailgate.ru" , + "Copyright 2000-2010 Miranda-IM project ["__DATE__" "__TIME__"]", + "http://www.miranda-im.org", + UNICODE_AWARE, + //{2A417AB9-16F2-472d-9AE3-415103C78A64} + {0x2a417ab9, 0x16f2, 0x472d, { 0x9a, 0xe3, 0x41, 0x51, 0x3, 0xc7, 0x8a, 0x64 }} +}; + +BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD dwReason, LPVOID reserved) +{ + g_hInst = hInstDLL; + DisableThreadLibraryCalls(g_hInst); + return TRUE; +} + +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +{ + return &pluginInfo; +} + +static const MUUID interfaces[] = {MIID_CLIST, MIID_LAST}; +extern "C" __declspec(dllexport) const MUUID * MirandaPluginInterfaces(void) +{ + return interfaces; +} + +int LoadContactListModule(void); +int LoadCLCModule(void); +int LoadCLUIModule(); +int InitSkinHotKeys(); + +static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) +{ + if ( LoadCLUIModule()) + return 1; + + InitSkinHotKeys(); + RegisterCListFonts(); + return 0; +} + +INT_PTR SetDrawer(WPARAM wParam,LPARAM lParam) +{ + pDrawerServiceStruct DSS = (pDrawerServiceStruct)wParam; + if (DSS->cbSize != sizeof(*DSS)) return -1; + if (DSS->PluginName == NULL) return -1; + if (DSS->PluginName == NULL) return -1; + if (!ServiceExists(DSS->GetDrawFuncsServiceName)) return -1; + + + SED.cbSize = sizeof(SED); + SED.PaintClc = (void (__cdecl *)(HWND,struct ClcData *,HDC,RECT *,int ,ClcProtoStatus *,HIMAGELIST))CallService(DSS->GetDrawFuncsServiceName,CLUI_EXT_FUNC_PAINTCLC,0); + if (!SED.PaintClc) return -1; + return 0; +} + +static struct ClcContact* fnCreateClcContact( void ) +{ + return (struct ClcContact*)mir_calloc( sizeof( struct ClcContact )); +} + +static ClcCacheEntryBase* fnCreateCacheItem( HANDLE hContact ) +{ + pdisplayNameCacheEntry p = (pdisplayNameCacheEntry)mir_calloc( sizeof( displayNameCacheEntry )); + if ( p ) + p->hContact = hContact; + return (ClcCacheEntryBase*)p; +} + +extern "C" int __declspec(dllexport) CListInitialise() +{ + int rc = 0; + + // get the internal malloc/free() + __try { + + OutputDebugStringA("CListInitialise ClistMW\r\n"); + mir_getLP( &pluginInfo ); + + pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInst); + if ( (INT_PTR)pcli == CALLSERVICE_NOTFOUND ) { +LBL_Error: + MessageBoxA( NULL, "This version of plugin requires Miranda IM 0.8.0.9 or later", "Fatal error", MB_OK ); + return 1; + } + if ( pcli->version < 6 ) + goto LBL_Error; + + pcli->pfnBuildGroupPopupMenu = BuildGroupPopupMenu; + pcli->pfnCalcEipPosition = CalcEipPosition; + pcli->pfnCheckCacheItem = CheckPDNCE; + pcli->pfnCluiProtocolStatusChanged = CluiProtocolStatusChanged; + pcli->pfnCompareContacts = CompareContacts; + pcli->pfnCreateClcContact = fnCreateClcContact; + pcli->pfnCreateCacheItem = fnCreateCacheItem; + pcli->pfnFindItem = FindItem; + pcli->pfnFreeCacheItem = FreeDisplayNameCacheItem; + pcli->pfnGetDefaultFontSetting = GetDefaultFontSetting; + pcli->pfnGetRowsPriorTo = GetRowsPriorTo; + pcli->pfnGetRowByIndex = GetRowByIndex; + pcli->pfnHitTest = HitTest; + pcli->pfnPaintClc = PaintClc; + pcli->pfnRebuildEntireList = RebuildEntireList; + pcli->pfnRecalcScrollBar = RecalcScrollBar; + pcli->pfnScrollTo = ScrollTo; + + saveIconFromStatusMode = pcli->pfnIconFromStatusMode; + pcli->pfnIconFromStatusMode = cli_IconFromStatusMode; + + saveAddGroup = pcli->pfnAddGroup; pcli->pfnAddGroup = AddGroup; + saveAddInfoItemToGroup = pcli->pfnAddInfoItemToGroup; pcli->pfnAddInfoItemToGroup = AddInfoItemToGroup; + saveAddItemToGroup = pcli->pfnAddItemToGroup; pcli->pfnAddItemToGroup = AddItemToGroup; + saveRemoveItemFromGroup = pcli->pfnRemoveItemFromGroup; pcli->pfnRemoveItemFromGroup = RemoveItemFromGroup; + saveFreeContact = pcli->pfnFreeContact; pcli->pfnFreeContact = FreeContact; + saveFreeGroup = pcli->pfnFreeGroup; pcli->pfnFreeGroup = FreeGroup; + saveContactListControlWndProc = pcli->pfnContactListControlWndProc; pcli->pfnContactListControlWndProc = ContactListControlWndProc; + saveTrayIconProcessMessage = pcli->pfnTrayIconProcessMessage; pcli->pfnTrayIconProcessMessage = TrayIconProcessMessage; + saveContactListWndProc = pcli->pfnContactListWndProc; pcli->pfnContactListWndProc = ContactListWndProc; + saveLoadClcOptions = pcli->pfnLoadClcOptions; pcli->pfnLoadClcOptions = LoadClcOptions; + saveSortCLC = pcli->pfnSortCLC; pcli->pfnSortCLC = SortCLC; + + memset(&SED,0,sizeof(SED)); + CreateServiceFunction(CLUI_SetDrawerService,SetDrawer); + + rc = LoadContactListModule(); + if (rc == 0) rc = LoadCLCModule(); + + HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + BGModuleLoad(); + + OutputDebugStringA("CListInitialise ClistMW...Done\r\n"); + } + __except (exceptFunction(GetExceptionInformation())) + { + return 0; + } + + return rc; +} + +// never called by a newer plugin loader. +extern "C" int __declspec(dllexport) Load(void) +{ + OutputDebugStringA("Load ClistMW\r\n"); + MessageBoxA(0,"You Running Old Miranda, use >30-10-2004 version!","MultiWindow Clist",0); + CListInitialise(); + return 1; +} + +extern "C" int __declspec(dllexport) Unload(void) +{ + OutputDebugStringA("Unloading ClistMW\r\n"); + if (IsWindow(pcli->hwndContactList)) DestroyWindow(pcli->hwndContactList); + BGModuleUnload(); + pcli->hwndContactList = 0; + return 0; +} diff --git a/plugins/Clist_mw/src/keyboard.cpp b/plugins/Clist_mw/src/keyboard.cpp new file mode 100644 index 0000000000..d099fab37c --- /dev/null +++ b/plugins/Clist_mw/src/keyboard.cpp @@ -0,0 +1,65 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 "commonheaders.h" +#include + +INT_PTR hkCloseMiranda(WPARAM wParam,LPARAM lParam) +{ + CallService("CloseAction", 0, 0); + return 0; +} + +INT_PTR hkRestoreStatus(WPARAM wParam,LPARAM lParam) +{ + int nStatus = DBGetContactSettingWord(NULL, "CList", "Status", ID_STATUS_OFFLINE); + CallService(MS_CLIST_SETSTATUSMODE, nStatus, 0); + + return 0; +} + +int InitSkinHotKeys(void) +{ + CreateServiceFunction("CLIST/HK/CloseMiranda",hkCloseMiranda); + CreateServiceFunction("CLIST/HK/RestoreStatus",hkRestoreStatus); + + HOTKEYDESC shk = {0}; + shk.cbSize = sizeof(shk); + + shk.pszDescription = LPGEN("Close Miranda"); + shk.pszName = "CloseMiranda"; + shk.pszSection = "Main"; + shk.pszService = "CLIST/HK/CloseMiranda"; + Hotkey_Register(&shk); + + shk.pszDescription = LPGEN("Restore last status"); + shk.pszName = "RestoreLastStatus"; + shk.pszSection = "Status"; + shk.pszService = "CLIST/HK/RestoreStatus"; + Hotkey_Register(&shk); + + return 0; +} + +void UninitSkinHotKeys(void) +{ +} diff --git a/plugins/Clist_mw/src/resource.h b/plugins/Clist_mw/src/resource.h new file mode 100644 index 0000000000..06c9b4c9df --- /dev/null +++ b/plugins/Clist_mw/src/resource.h @@ -0,0 +1,649 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by resource.rc +// +#define IDC_AUTHICON 1 +#define IDC_NOTOALL 3 +#define IDC_APPLY 3 +#define MIM_V1 10 +#define IDI_GLOBUS 11 +#define MIM_V2 20 +#define MIM_V3 30 +#define MIM_V4 30 +#define IDD_ABOUT 103 +#define IDI_SMS 103 +#define IDI_ONLINE 104 +#define IDI_OFFLINE 105 +#define IDD_GNUPL 110 +#define IDD_ADDED 115 +#define IDD_URLSEND 119 +#define IDD_URLRECV 120 +#define IDD_AUTHREQ 121 +#define IDD_DETAILS 125 +#define IDD_OPT_CLIST 126 +#define IDD_HISTORY 127 +#define IDI_AWAY 128 +#define IDI_FREE4CHAT 129 +#define IDI_INVISIBLE 130 +#define IDI_NA 131 +#define IDD_OPT_SOUND 134 +#define IDD_OPT_HOTKEYS 134 +#define IDI_SENDURL 135 +#define IDI_RECVMSG 136 +#define IDI_SENDMSG 137 +#define IDI_URL 138 +#define IDI_DND 158 +#define IDI_OCCUPIED 159 +#define IDI_USERDETAILS 160 +#define IDI_FINDUSER 161 +#define IDI_HELP 162 +#define IDI_OPTIONS 163 +#define IDI_MIRANDAWEBSITE 172 +#define IDI_RENAME 173 +#define IDI_HISTORY 174 +#define IDI_DELETE 175 +#define IDR_CONTEXT 180 +#define IDC_DROP 183 +#define IDD_OPT_HOTKEY 184 +#define IDD_HISTORY_FIND 192 +#define IDI_SENDEMAIL 193 +#define IDD_FILERECV 194 +#define IDD_PROFILEMANAGER 197 +#define IDD_NEWPROFILE 198 +#define IDR_CLISTMENU 199 +#define IDI_BLANK 200 +#define IDD_FINDADD 201 +#define IDI_USERONLINE 201 +#define IDD_OPT_AUTOAWAY 202 +#define IDI_GROUPSHUT 202 +#define IDD_OPTIONS 203 +#define IDI_GROUPOPEN 203 +#define IDD_PLUGINCONFLICT 204 +#define IDD_FILESEND 205 +#define IDI_NOTICK 205 +#define IDD_OPT_PLUGINS 206 +#define IDI_TICK 206 +#define IDD_OPT_ICONS 207 +#define IDI_FILE 207 +#define IDI_TIMESTAMP 208 +#define IDI_CHANGEFONT 209 +#define IDI_ADDCONTACT 210 +#define IDI_SMALLDOT 211 +#define IDI_FILLEDBLOB 212 +#define IDD_READAWAYMSG 213 +#define IDI_EMPTYBLOB 213 +#define IDD_OPT_IGNORE 214 +#define IDC_HYPERLINKHAND 214 +#define IDD_OPT_VISIBILITY 215 +#define IDC_DROPUSER 215 +#define IDD_SETAWAYMSG 216 +#define IDI_DETAILSLOGO 216 +#define IDD_OPT_AWAYMSG 217 +#define IDD_OPT_CLUI 218 +#define IDD_INFO_SUMMARY 220 +#define IDD_INFO_CONTACT 221 +#define IDD_INFO_BACKGROUND 222 +#define IDD_INFO_NOTES 223 +#define IDD_ADDEMAIL 226 +#define IDD_ICONINDEX 227 +#define IDD_OPT_CLC 228 +#define IDD_OPT_CLCBKG 230 +#define IDD_INFO_LOCATION 231 +#define IDD_INFO_WORK 232 +#define IDD_ADDPHONE 233 +#define IDD_OPT_SBAR 234 +#define IDD_INSTALLINI 235 +#define IDD_WARNINICHANGE 236 +#define IDD_INIIMPORTDONE 237 +#define IDB_SORTCOLUP 239 +#define IDB_SORTCOLDOWN 240 +#define IDD_OPT_NETLIB 246 +#define IDD_NETLIBLOGOPTS 247 +#define IDD_FILETRANSFERINFO 249 +#define IDD_OPT_FILETRANSFER 250 +#define IDD_FILEEXISTS 251 +#define IDD_DELETECONTACT 254 +#define IDD_DENYREASON 256 +#define IDD_ADDCONTACT 257 +#define IDD_OPT_CONTACT 261 +#define IDD_OPT_PROTOCOLORDER 262 +#define IDI_MULTISEND 263 +#define IDI_DOWNARROW 264 +#define IDD_CREDITS 265 +#define IDD_OPT_IDLE 268 +#define IDI_ICQC1 269 +#define IDI_ICQC2 270 +#define IDI_ICQC3 271 +#define IDI_ICQC4 272 +#define IDI_ICQC5 273 +#define IDI_ICQC6 274 +#define IDI_ICQC7 275 +#define IDI_ICQC8 276 +#define IDI_EMAIL 277 +#define IDD_OPT_META_CLC 279 +#define IDI_NEWGROUP 282 +#define IDI_NEWGROUP2 282 +#define IDI_CLIENTTRILLIAN 298 +#define IDI_CLIENTMIRANDA 299 +#define IDI_CLIENTRQ 300 +#define IDI_CLIENTGAIM 301 +#define IDI_CLIENTIM2 302 +#define IDI_CLIENTKOPETE 303 +#define IDI_CLIENTLICQ 304 +#define IDI_CLIENTQIP 305 +#define IDI_CLIENTSIM 306 +#define IDI_MIRANDA2 307 +#define IDD_OPT_CLCBKG2 308 +#define IDI_CLIENTICQL5 315 +#define IDI_CLIENTAGILE 318 +#define IDI_CLIENTGNOMEICU 319 +#define IDI_ICON1 320 +#define IDI_CLIENTMOBICQ 320 +#define IDI_CLIENTSPAMBOT 321 +#define IDI_CLIENTICQMAC 322 +#define IDI_CLIENTIMPLUS 323 +#define IDI_CLIENTYSM 324 +#define IDI_CLIENTYAMIGO 325 +#define IDI_CLIENTWEBICQ 326 +#define IDI_CLIENTVICQ 327 +#define IDI_CLIENTSTRICQ 328 +#define IDI_CLIENTSTICQ 329 +#define IDI_CLIENTNICQ2 330 +#define IDI_CLIENTPSI 331 +#define IDI_CLIENTMOB2ICQ 333 +#define IDI_CLIENTMICQ 334 +#define IDI_CLIENTLIBICQ2000 335 +#define IDI_CLIENTCENTERICQ 336 +#define IDI_CLIENTALICQ 337 +#define IDI_CLIENTICQ2000 339 +#define IDI_CLIENTICQ2001 340 +#define IDI_CLIENTICQ2003 341 +#define IDI_CLIENTICQLITE 342 +#define IDI_CLIENTICQLITE4 343 +#define IDI_CLIENTICQLITE5 344 +#define IDI_CLIENTICQGOF 345 +#define IDI_CLIENTICQGOJ 346 +#define IDC_RESETPROTOCOLDATA 1000 +#define IDC_SAVE 1001 +#define IDC_DEFBKCOLOR 1001 +#define IDI_ONTHEPHONE 1002 +#define IDC_MESSAGE 1002 +#define IDI_OUTTOLUNCH 1003 +#define IDC_AUTOCLOSE 1004 +#define IDC_FROM 1005 +#define IDC_AUTOMIN 1005 +#define IDC_DATE 1006 +#define IDC_DUMPRECV 1006 +#define IDC_MSG 1008 +#define IDC_PROXYDNS 1008 +#define IDC_NAME 1009 +#define IDC_PROXYTYPE 1009 +#define IDC_STATIC23 1010 +#define IDC_NAMEVAL 1010 +#define IDC_SPECIFYPORTS 1013 +#define IDC_ST_ENTERMSG 1013 +#define IDC_ST_ENTERURL 1014 +#define IDC_SPECIFYPORTSO 1014 +#define IDC_TEXT 1019 +#define IDC_SHOWNAMES 1024 +#define IDC_ABOUT 1032 +#define IDC_MYNOTES 1033 +#define IDC_URLS 1037 +#define IDC_REPLY 1039 +#define IDC_URL 1041 +#define IDC_REASON 1046 +#define IDC_EMAIL 1048 +#define IDC_NAMENICK 1049 +#define IDC_NAMEFIRST 1050 +#define IDC_NAMELAST 1051 +#define IDC_NICK 1053 +#define IDC_GENDER 1060 +#define IDC_CITY 1061 +#define IDC_STATE 1062 +#define IDC_COUNTRY 1063 +#define IDC_AGE 1064 +#define IDC_ZIP 1064 +#define IDC_PHONE 1065 +#define IDC_STREET 1065 +#define IDC_COMPANY 1066 +#define IDC_LANGUAGE1 1066 +#define IDC_TIMEZONE 1067 +#define IDC_DEPARTMENT 1067 +#define IDC_LOCALTIME 1068 +#define IDC_DETAILS 1069 +#define IDC_POSITION 1069 +#define IDC_LANGUAGE2 1069 +#define IDC_ADD 1070 +#define IDC_LANGUAGE3 1070 +#define IDC_MOREOPTIONS 1071 +#define IDC_USERMENU 1071 +#define IDC_MIN2TRAY 1073 +#define IDC_ONTOP 1074 +#define IDC_SHOWMAINMENU 1075 +#define IDC_CLIENTDRAG 1076 +#define IDC_EDIT 1078 +#define IDC_LIST 1079 +#define IDC_HISTORY 1080 +#define IDC_USESOUND 1085 +#define IDC_TOOLWND 1097 +#define IDC_ONECLK 1098 +#define IDC_SHOWCAPTION 1098 +#define IDC_HIDEOFFLINE 1099 +#define IDC_SHOWHIDE 1100 +#define IDC_HIDEEMPTYGROUPS 1100 +#define IDC_SORTBYSTATUS 1101 +#define IDC_FADEINOUT 1101 +#define IDC_READMSG 1102 +#define IDC_AUTOSIZE 1102 +#define IDC_DISABLEGROUPS 1102 +#define IDC_AUTOSIZEUPWARD 1103 +#define IDC_ALWAYSSTATUS 1103 +#define IDC_NETSEARCH 1104 +#define IDC_CONFIRMDELETE 1104 +#define IDC_EXTRA_PROTO 1104 +#define IDC_SORTBYPROTO 1105 +#define IDC_SHOWOPTIONS 1105 +#define IDC_EXTRA_EMAIL 1105 +#define IDC_SEARCHURL 1106 +#define IDC_EXTRA_CELLULAR 1106 +#define IDC_EXTRA_ADV2 1107 +#define IDC_BUILDTIME 1108 +#define IDC_EXTRA_ADV1 1108 +#define IDC_EXTRA_WEB 1109 +#define IDC_NUMBER 1113 +#define IDC_UIN 1123 +#define IDC_TRANSPARENT 1124 +#define IDC_TRANSINACTIVE 1126 +#define IDC_TRANSACTIVE 1128 +#define IDC_FINDWHAT 1131 +#define IDC_FIND 1132 +#define IDC_FILE 1133 +#define IDC_PROFILELIST 1134 +#define IDC_NEWPROFILE 1135 +#define IDC_NEWPROFILENAME 1136 +#define IDC_TABS 1141 +#define IDC_RESULTS 1142 +#define IDC_STATUS 1144 +#define IDC_SCREENSAVE 1145 +#define IDC_TIMED 1146 +#define IDC_AWAYTIME 1147 +#define IDC_USEPROXY 1148 +#define IDC_SETNA 1148 +#define IDC_PROXYAUTH 1149 +#define IDC_NATIME 1149 +#define IDC_PROXYHOST 1150 +#define IDC_PROXYPORT 1151 +#define IDC_PROXYUSER 1152 +#define IDC_PROXYPASS 1153 +#define IDC_STATIC11 1154 +#define IDC_STATIC12 1155 +#define IDC_STATIC21 1156 +#define IDC_STATIC22 1157 +#define IDC_STATIC31 1158 +#define IDC_STATIC32 1159 +#define IDC_PROXYAUTHNTLM 1160 +#define IDC_HKSHOWHIDE 1162 +#define IDC_HKREADMSG 1163 +#define IDC_SOUNDLIST 1163 +#define IDC_HKSEARCH 1164 +#define IDC_CHANGE 1164 +#define IDC_PREVIEW 1165 +#define IDC_HKSHOWOPTIONS 1165 +#define IDC_PLUGINLIST 1167 +#define IDC_FEATURENAME 1168 +#define IDC_CHOOSE 1169 +#define IDC_TO 1170 +#define IDC_ABOUTGROUP 1175 +#define IDC_DESCRIPTION 1176 +#define IDC_AUTHOR 1177 +#define IDC_COPYRIGHT 1178 +#define IDC_VERSION 1179 +#define IDC_HOMEPAGE 1181 +#define IDC_RESTARTREQD 1182 +#define IDC_ICONSET 1183 +#define IDC_BROWSE 1184 +#define IDC_RUNATSTARTBROWSE 1185 +#define IDC_PAGETREE 1186 +#define IDC_RUNNOW 1186 +#define IDC_INACTIVEPERC 1187 +#define IDC_ACTIVEPERC 1188 +#define IDC_SEARCHNEWWND 1188 +#define IDC_RETRIEVING 1193 +#define IDC_TITLETEXT 1196 +#define IDC_GETMORE 1200 +#define IDC_VISIBLEICON 1204 +#define IDC_INVISIBLEICON 1205 +#define IDC_FILEICON 1206 +#define IDC_ONLINEICON 1207 +#define IDC_FILENAMES 1208 +#define IDC_ALLICON 1208 +#define IDC_DONTREPLY 1209 +#define IDC_NONEICON 1209 +#define IDC_USEPREVIOUS 1210 +#define IDC_NODIALOG 1211 +#define IDC_USESPECIFIC 1212 +#define IDC_FILEDIR 1213 +#define IDC_ALLFILESPROGRESS 1217 +#define IDC_CURRENTSPEED 1219 +#define IDC_STAWAYTYPE 1220 +#define IDC_WHITERECT 1221 +#define IDC_ALLSPEED 1221 +#define IDC_CURRENTFILEPROGRESS 1222 +#define IDC_CURRENTFILEGROUP 1223 +#define IDC_FIRSTNAME 1224 +#define IDC_LASTNAME 1225 +#define IDC_CURRENTTRANSFERRED 1225 +#define IDC_DOBDAY 1226 +#define IDC_DOBMONTH 1227 +#define IDC_WEBPAGE 1228 +#define IDC_DOBYEAR 1228 +#define IDC_UPDATING 1231 +#define IDC_NAMEORDER 1234 +#define IDC_AUTOHIDE 1235 +#define IDC_HIDETIME 1236 +#define IDC_RECONNECTREQD 1239 +#define IDC_IMPORT 1241 +#define IDC_TOMAIN 1243 +#define IDC_TOPROTO 1244 +#define IDC_PROTOLIST 1245 +#define IDC_TODEFICON 1246 +#define IDC_IMPORTMULTI 1247 +#define IDC_MAXSIZEHEIGHT 1254 +#define IDC_MAXSIZESPIN 1255 +#define IDC_FONTID 1256 +#define IDC_SAMETYPE 1257 +#define IDC_SAMESTYLE 1258 +#define IDC_SAMECOLOUR 1259 +#define IDC_SAMEAS 1260 +#define IDC_TYPEFACE 1261 +#define IDC_BOLD 1262 +#define IDC_ITALIC 1263 +#define IDC_COLOUR 1264 +#define IDC_UNDERLINE 1265 +#define IDC_HOTCOLOUR 1267 +#define IDC_SAMESIZE 1268 +#define IDC_BKGCOLOUR 1269 +#define IDC_FILENAME 1271 +#define IDC_SCROLL 1277 +#define IDC_PROPORTIONAL 1278 +#define IDC_SELCOLOUR 1281 +#define IDC_QUICKCOLOUR 1282 +#define IDC_SMOOTHTIME 1283 +#define IDC_SMOOTHTIMESPIN 1284 +#define IDC_GREYOUT 1285 +#define IDC_ROWHEIGHT 1285 +#define IDC_ROWHEIGHTSPIN 1286 +#define IDC_GREYOUTOPTS 1288 +#define IDC_GROUPINDENT 1289 +#define IDC_GROUPINDENTSPIN 1290 +#define IDC_LEFTMARGIN 1291 +#define IDC_SAMPLE 1292 +#define IDC_LEFTMARGINSPIN 1292 +#define IDC_FONTSIZE 1293 +#define IDC_STRETCHH 1298 +#define IDC_STRETCHV 1299 +#define IDC_TILEH 1300 +#define IDC_SCRIPT 1300 +#define IDC_TILEV 1301 +#define IDC_GAMMACORRECT 1302 +#define IDC_TILEVROWH 1302 +#define IDC_INTERESTS 1305 +#define IDC_EMAILS 1306 +#define IDC_PAST 1307 +#define IDC_HIDEOFFLINEOPTS 1308 +#define IDC_PHONES 1308 +#define IDC_SMS 1310 +#define IDC_AREA 1312 +#define IDC_UPDATE 1313 +#define IDC_DONTCYCLE 1315 +#define IDC_PRIMARYSTATUS 1316 +#define IDC_CYCLE 1317 +#define IDC_CYCLETIME 1318 +#define IDC_CYCLETIMESPIN 1319 +#define IDC_HIDETIMESPIN 1320 +#define IDC_MULTITRAY 1321 +#define IDC_ALWAYSMULTI 1322 +#define IDC_SHOWICON 1323 +#define IDC_SHOWPROTO 1324 +#define IDC_SHOWSTATUS 1325 +#define IDC_EQUALSECTIONS 1326 +#define IDC_SHOWSIZEGRIP 1327 +#define IDC_USEOWNERDRAW 1328 +#define IDC_SHOWSBAR 1329 +#define IDC_RIGHTMIRANDA 1330 +#define IDC_RIGHTSTATUS 1331 +#define IDC_ININAME 1333 +#define IDC_VIEWINI 1334 +#define IDC_SECURITYINFO 1335 +#define IDC_SETTINGNAME 1336 +#define IDC_NEWVALUE 1337 +#define IDC_WARNNOMORE 1338 +#define IDC_DELETE 1339 +#define IDC_RECYCLE 1340 +#define IDC_NEWNAME 1341 +#define IDC_MOVE 1342 +#define IDC_LEAVE 1343 +#define IDC_EXPERT 1346 +#define IDC_SORTBYNAME 1347 +#define IDC_STAUTOHIDESECS 1349 +#define IDC_STCLISTGROUP 1350 +#define IDC_DISABLEDRAGDROP 1351 +#define IDC_NOTEDITLABELS 1352 +#define IDC_SHOWSELALWAYS 1353 +#define IDC_TRACKSELECT 1354 +#define IDC_SHOWGROUPCOUNTS 1355 +#define IDC_HIDECOUNTSWHENEMPTY 1356 +#define IDC_DIVIDERONOFF 1357 +#define IDC_NOTNOTRANSLUCENTSEL 1358 +#define IDC_LINEWITHGROUPS 1359 +#define IDC_QUICKSEARCHVISONLY 1360 +#define IDC_SORTGROUPSALPHA 1361 +#define IDC_NOTNOSMOOTHSCROLLING 1362 +#define IDC_BITMAP 1363 +#define IDC_STWINDOWGROUP 1364 +#define IDC_STATIC01 1365 +#define IDC_CATEGORYLIST 1366 +#define IDC_LOADICONS 1369 +#define IDC_STICONSGROUP 1371 +#define IDC_MSGICON 1375 +#define IDC_URLICON 1376 +#define IDC_STNOPAGE 1377 +#define IDC_STCHECKMARKS 1380 +#define IDC_STSAMETEXT 1382 +#define IDC_STASTEXT 1383 +#define IDC_STSIZETEXT 1384 +#define IDC_STCOLOURTEXT 1385 +#define IDC_STHORZBAR 1386 +#define IDC_MIRANDA 1388 +#define IDC_STATUSBAR 1389 +#define IDC_PROTOIDGROUP 1392 +#define IDC_BYPROTOID 1393 +#define IDC_PROTOID 1394 +#define IDC_EMAILGROUP 1395 +#define IDC_BYEMAIL 1396 +#define IDC_STNAMENICK 1397 +#define IDC_NAMEGROUP 1398 +#define IDC_BYNAME 1399 +#define IDC_STNAMEFIRST 1400 +#define IDC_STNAMELAST 1401 +#define IDC_ADVANCEDGROUP 1402 +#define IDC_BYADVANCED 1403 +#define IDC_ADVANCED 1404 +#define IDC_STSIMPLERIGHT 1440 +#define IDC_NETLIBUSERS 1443 +#define IDC_STOFTENPORT 1445 +#define IDC_STATIC51 1446 +#define IDC_STATIC52 1447 +#define IDC_STATIC43 1448 +#define IDC_LOGOPTIONS 1449 +#define IDC_PORTSRANGE 1450 +#define IDC_TOCONSOLE 1451 +#define IDC_STATIC53 1451 +#define IDC_SHOWCONSOLEATSTART 1452 +#define IDC_PORTSRANGEO 1452 +#define IDC_STATIC54 1453 +#define IDC_SHOWCONSOLE 1454 +#define IDC_TOOUTPUTDEBUGSTRING 1455 +#define IDC_TOFILE 1456 +#define IDC_CLEARCONSOLE 1457 +#define IDC_RUNATSTART 1458 +#define IDC_DUMPSENT 1464 +#define IDC_DUMPPROXY 1466 +#define IDC_TEXTDUMPS 1467 +#define IDC_AUTODETECTTEXT 1468 +#define IDC_TIMEFORMAT 1469 +#define IDC_FILENAMEBROWSE 1470 +#define IDC_SHOWTHISDLGATSTART 1471 +#define IDC_FILEDIRBROWSE 1475 +#define IDC_ALLFILESGROUP 1476 +#define IDC_SCANCMDLINEBROWSE 1476 +#define IDC_ALLTRANSFERRED 1477 +#define IDC_OPENFOLDER 1478 +#define IDC_OPENFILE 1479 +#define IDC_TOTALSIZE 1480 +#define IDC_APPENDNICKTODIR 1483 +#define IDC_AUTOACCEPT 1484 +#define IDC_SCANCMDLINE 1485 +#define IDC_WARNBEFOREOPENING 1488 +#define IDC_SCANDURINGDL 1489 +#define IDC_SCANAFTERDL 1490 +#define IDC_NOSCANNER 1491 +#define IDC_ST_CMDLINE 1492 +#define IDC_ST_CMDLINEHELP 1493 +#define IDC_PROPERTIES 1496 +#define IDC_RESUME 1497 +#define IDC_EXISTINGICON 1499 +#define IDC_RESUMEALL 1500 +#define IDC_OVERWRITE 1501 +#define IDC_OVERWRITEALL 1502 +#define IDC_SKIP 1503 +#define IDC_EXISTINGSIZE 1506 +#define IDC_EXISTINGDATE 1507 +#define IDC_EXISTINGTYPE 1508 +#define IDC_NEWICON 1509 +#define IDC_NEWSIZE 1510 +#define IDC_NEWDATE 1511 +#define IDC_NEWTYPE 1512 +#define IDC_SAVEAS 1513 +#define IDC_ASK 1516 +#define IDC_RENAME 1519 +#define IDC_VIRUSSCANNERGROUP 1520 +#define IDC_HIDE 1534 +#define IDC_TOPLINE 1535 +#define IDC_GPLBTN 1536 +#define IDC_MAIL 1536 +#define IDC_MYHANDLE 1540 +#define IDC_GROUP 1541 +#define IDC_ADDED 1542 +#define IDC_AUTH 1543 +#define IDC_PLUGINSTATIC1 1559 +#define IDC_DELETEHISTORY 1560 +#define IDC_HOTKEYURLSTR 1567 +#define IDC_SETNASTR 1568 +#define IDC_AAUTHOR 1569 +#define IDC_AHOMEPAGE 1570 +#define IDC_AVERSION 1571 +#define IDC_ACOPYRIGHT 1572 +#define IDC_ADESCRIPTION 1573 +#define IDC_PLUGINENABLE 1574 +#define IDC_AUTHREQ 1577 +#define IDC_AUTHGB 1578 +#define IDC_BRINGTOFRONT 1579 +#define IDC_PROTOCOL 1580 +#define IDC_CONTRIBLINK 1586 +#define IDC_HOMELINK 1587 +#define IDC_SUPPORTLINK 1588 +#define IDC_DEVS 1589 +#define IDC_GPL 1590 +#define IDC_LOGO 1591 +#define IDC_PROTOCOLORDER 1591 +#define IDC_PROTOCOLORDERWARNING 1592 +#define IDC_CREDITSTEXT 1595 +#define IDC_WSLOCK 1599 +#define IDC_BLINKTIME 1607 +#define IDC_BLINKSPIN 1608 +#define IDC_DISABLEBLINK 1609 +#define IDC_IDLE 1610 +#define IDC_SBPANELBEVEL 1611 +#define IDC_META 1611 +#define IDC_DROPSHADOW 1612 +#define IDC_METADBLCLK 1612 +#define IDC_NOSCROLLBAR 1613 +#define IDC_METASUBEXTRA 1614 +#define IDC_METASUBEXTRA_IGN 1615 +#define IDC_METASUB_HIDEOFFLINE 1616 +#define IDC_BUTTON1 1633 +#define IDC_IDLECHECK 1636 +#define IDC_IDLEONWINDOWS 1637 +#define IDC_IDLEONMIRANDA 1638 +#define IDC_IDLEUSEGLI 1639 +#define IDC_SCREENSAVER 1642 +#define IDC_LOCKED 1643 +#define IDC_IDLESHORT 1644 +#define IDC_IDLELONG 1645 +#define IDC_IDLE1STTIME 1646 +#define IDC_IDLE2NDTIME 1647 +#define IDC_IDLEPRIVATE 1649 +#define IDC_AASTATUS 1650 +#define IDC_AASHORTIDLE 1651 +#define IDC_AALONGSTATUS 1652 +#define IDC_AALONGIDLE 1656 +#define IDC_NOOFFLINEMOVE 1657 +#define IDC_HOTKEYTREE 1657 +#define IDC_LOCATION 1659 +#define IDC_SGROUP 1660 +#define IDC_SLOC 1661 +#define IDC_ONDESKTOP 1662 +#define IDC_SETHOTKEY 1759 +#define IDC_HKTITLE 1760 +#define IDC_CHECK1 1761 +#define IDC_USECONNECTINGICON 1761 +#define IDC_BKGRLIST 1762 +#define IDC_EXTRA_FRAME 1762 +#define IDC_BC_STATIC 1763 +#define IDC_SC_STATIC 1764 +#define IDD_OPT_GENMENU 11267 +#define IDC_MENUITEMS 11710 +#define IDC_MENUOBJECTS 11711 +#define IDC_NOTSUPPORTWARNING 11712 +#define IDC_INSERTSEPARATOR 11715 +#define IDC_GENMENU_SERVICE 11716 +#define IDC_GENMENU_CUSTOMNAME 11717 +#define IDC_GENMENU_SET 11718 +#define IDC_GENMENU_SET2 11719 +#define IDC_GENMENU_DEFAULT 11719 +#define IDC_ICONBLINK 11720 +#define IDI_SEARCHALL 32548 +#define ID_ICQ_EXIT 40001 +#define IDM_COPY 40001 +#define ID_RESET 40002 +#define POPUP_HIDEEMPTYGROUPS 40003 +#define POPUP_NEWSUBGROUP 40004 +#define POPUP_HIDEOFFLINE 40005 +#define POPUP_GROUPHIDEOFFLINE 40006 +#define POPUP_HIDEOFFLINEROOT 40007 +#define POPUP_DISABLEGROUPS 40008 +#define IDC_SENDMESSAGE 40009 +#define IDM_COPYALL 40011 +#define IDM_SELECTALL 40012 +#define IDM_CLEAR 40013 +#define IDM_OPENNEW 40014 +#define IDM_OPENEXISTING 40015 +#define IDM_COPYLINK 40016 +#define POPUP_HIDEMIRANDA 40017 +#define ID_TRAY_HIDE 40038 +#define ID_TRAY_EXIT 40040 +#define POPUP_NEWGROUP 40050 +#define POPUP_RENAMEGROUP 40052 +#define POPUP_DELETEGROUP 40053 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 347 +#define _APS_NEXT_COMMAND_VALUE 40018 +#define _APS_NEXT_CONTROL_VALUE 1763 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/plugins/Clist_nicer/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/CLUIFrames/cluiframes.cpp deleted file mode 100644 index 8fbaa547e6..0000000000 --- a/plugins/Clist_nicer/CLUIFrames/cluiframes.cpp +++ /dev/null @@ -1,3584 +0,0 @@ -/* -astyle --force-indent=tab=4 --brackets=linux --indent-switches - --pad=oper --one-line=keep-blocks --unpad=paren - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 -#include "cluiframes.h" -HFONT __fastcall ChangeToFont(HDC hdc, struct ClcData *dat, int id, int *fontHeight); - -extern HIMAGELIST himlExtraImages; -extern HWND g_hwndViewModeFrame, g_hwndEventArea; -extern StatusItems_t *StatusItems; -extern int mf_updatethread_running; - -extern DWORD WINAPI MF_UpdateThread(LPVOID p); -extern HANDLE hThreadMFUpdate;; - -HANDLE hExtraImageListRebuilding, hExtraImageApplying; -HANDLE hStatusBarShowToolTipEvent, hStatusBarHideToolTipEvent; -HANDLE g_hEventThread = 0; - -//not needed,now use MS_CLIST_FRAMEMENUNOTIFY service -//HANDLE hPreBuildFrameMenuEvent;//external event from clistmenus - -LOGFONT TitleBarLogFont = {0}; - -extern HINSTANCE g_hInst; - -//we use dynamic frame list, -//but who wants so huge number of frames ?? -#define MAX_FRAMES 40 - -#define UNCOLLAPSED_FRAME_SIZE 0 - -//legacy menu support -#define frame_menu_lock 1 -#define frame_menu_visible 2 -#define frame_menu_showtitlebar 3 -#define frame_menu_floating 4 -#define frame_menu_skinned 5 - -extern INT_PTR ModifyMenuItemProxy(WPARAM wParam, LPARAM lParam); -static int UpdateTBToolTip(int framepos); -INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam); -int CLUIFrameResizeFloatingFrame(int framepos); -extern int ProcessCommandProxy(WPARAM wParam, LPARAM lParam); -extern int InitFramesMenus(void); -extern int UnitFramesMenu(); -static int CLUIFramesReSort(); - -boolean FramesSysNotStarted = TRUE; -HPEN g_hPenCLUIFrames = 0; - -typedef struct { - int order; - int realpos; -} SortData; - -static SortData g_sd[MAX_FRAMES]; - -static HHOOK g_hFrameHook = 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); -} - -#define CLUIFRAMESSETALIGN "CLUIFramesSetAlign" -#define CLUIFRAMESSETALIGNALTOP "CLUIFramesSetAlignalTop" -#define CLUIFRAMESSETALIGNALCLIENT "CLUIFramesSetAlignalClient" -#define CLUIFRAMESSETALIGNALBOTTOM "CLUIFramesSetAlignalBottom" -#define CLUIFRAMESMOVEUP "CLUIFramesMoveUp" -#define CLUIFRAMESMOVEDOWN "CLUIFramesMoveDown" - -static wndFrame *Frames = NULL; - -wndFrame *wndFrameCLC = NULL, *wndFrameEventArea = NULL, *wndFrameViewMode = NULL; - -static int nFramescount = 0; -static int alclientFrame = -1;//for fast access to frame with alclient properties -static int NextFrameId = 100; - -static int TitleBarH = DEFAULT_TITLEBAR_HEIGHT; -static boolean resizing = FALSE; - -// menus -static HANDLE contMIVisible, contMITitle, contMITBVisible, contMILock, contMIColl, contMIFloating; -static HANDLE contMIAlignRoot; -static HANDLE contMIAlignTop, contMIAlignClient, contMIAlignBottom; -static HANDLE contMIBorder, contMISkinned; -static HANDLE MainMIRoot = (HANDLE) - 1; - -// others -static int ContactListHeight; -static int LastStoreTick = 0; - -static int lbypos = -1; -static int oldframeheight = -1; -static int curdragbar = -1; -static CRITICAL_SECTION csFrameHook; - -static BOOLEAN CLUIFramesFitInSize(void); -HWND hWndExplorerToolBar; -static int GapBetweenFrames = 1; - -static int RemoveItemFromList(int pos, wndFrame **lpFrames, int *FrameItemCount) -{ - memcpy(&((*lpFrames)[pos]), &((*lpFrames)[pos+1]), sizeof(wndFrame)*(*FrameItemCount - pos - 1)); - (*FrameItemCount)--; - return 0; -} - -static int id2pos(int id) -{ - int i; - - if (FramesSysNotStarted) - return -1; - - for (i = 0;i < nFramescount;i++) { - if (Frames[i].id == id) - return(i); - } - return(-1); -} - -int __forceinline btoint(BOOLEAN b) -{ - return(b ? 1 : 0); -} - -void __forceinline lockfrm() -{ - if (FramesSysNotStarted == FALSE) - EnterCriticalSection(&csFrameHook); -} - -void __forceinline ulockfrm() -{ - LeaveCriticalSection(&csFrameHook); -} - -static wndFrame* FindFrameByWnd(HWND hwnd) -{ - BOOL bFound = FALSE; - int i; - - if (hwnd == NULL) - return(NULL); - - for (i = 0;i < nFramescount;i++) { - if ((Frames[i].floating) && (Frames[i].ContainerWnd == hwnd)) - return(&Frames[i]); - } - return(NULL); -} - - -static void DockThumbs(wndFrame *pThumbLeft, wndFrame *pThumbRight, BOOL bMoveLeft) -{ - if ((pThumbRight->dockOpt.hwndLeft == NULL) && (pThumbLeft->dockOpt.hwndRight == NULL)) { - pThumbRight->dockOpt.hwndLeft = pThumbLeft->ContainerWnd; - pThumbLeft->dockOpt.hwndRight = pThumbRight->ContainerWnd; - } -} - - -static void UndockThumbs(wndFrame *pThumb1, wndFrame *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; -} - -BOOLEAN bMoveTogether; - -static void PositionThumb(wndFrame *pThumb, short nX, short nY) -{ - wndFrame *pCurThumb = &Frames[0]; - wndFrame *pDockThumb = pThumb; - wndFrame fakeMainWindow; - wndFrame fakeTaskBarWindow; - RECT rc; - RECT rcThumb; - RECT rcOld; - SIZE sizeScreen; - 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; - - 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); - - 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, TRUE); - } - - if (bDockedLeft) { - DockThumbs(pCurThumb, pThumb, FALSE); - } - } - - // 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 == nFramescount) { - pCurThumb = &fakeMainWindow; - continue; - } - pCurThumb = &Frames[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, - 0, - nNewX, - nNewY, - 0, - 0, - SWP_NOSIZE | SWP_NOZORDER); - - - // OK, move all docked thumbs - if (bMoveTogether) { - pDockThumb = FindFrameByWnd(pDockThumb->dockOpt.hwndRight); - - PositionThumb(pDockThumb, (short)(nNewX + nWidth), (short)nNewY); - } -} - -void GetBorderSize(HWND hwnd, RECT *rect) -{ - RECT wr, cr; - POINT pt1, pt2; - - 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; -} - -//append string -char __forceinline *AS(char *str, const char *setting, char *addstr) -{ - if (str != NULL) { - strcpy(str, setting); - strcat(str, addstr); - } - return str; -} - -int DBLoadFrameSettingsAtPos(int pos, int Frameid) -{ - char sadd[15]; - char buf[255]; - - _itoa(pos, sadd, 10); - - Frames[Frameid].collapsed = cfg::getByte(CLUIFrameModule, AS(buf, "Collapse", sadd), Frames[Frameid].collapsed); - - Frames[Frameid].Locked = cfg::getByte(CLUIFrameModule, AS(buf, "Locked", sadd), Frames[Frameid].Locked); - Frames[Frameid].visible = cfg::getByte(CLUIFrameModule, AS(buf, "Visible", sadd), Frames[Frameid].visible); - Frames[Frameid].TitleBar.ShowTitleBar = cfg::getByte(CLUIFrameModule, AS(buf, "TBVisile", sadd), Frames[Frameid].TitleBar.ShowTitleBar); - - Frames[Frameid].height = cfg::getWord(CLUIFrameModule, AS(buf, "Height", sadd), Frames[Frameid].height); - Frames[Frameid].HeightWhenCollapsed = cfg::getWord(CLUIFrameModule, AS(buf, "HeightCollapsed", sadd), 0); - Frames[Frameid].align = cfg::getWord(CLUIFrameModule, AS(buf, "Align", sadd), Frames[Frameid].align); - - Frames[Frameid].FloatingPos.x = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatX", sadd), 100, 0, 1024); - Frames[Frameid].FloatingPos.y = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatY", sadd), 100, 0, 1024); - Frames[Frameid].FloatingSize.x = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatW", sadd), 100, 0, 1024); - Frames[Frameid].FloatingSize.y = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatH", sadd), 100, 0, 1024); - - Frames[Frameid].floating = cfg::getByte(CLUIFrameModule, AS(buf, "Floating", sadd), 0); - Frames[Frameid].order = cfg::getWord(CLUIFrameModule, AS(buf, "Order", sadd), 0); - - Frames[Frameid].UseBorder = cfg::getByte(CLUIFrameModule, AS(buf, "UseBorder", sadd), Frames[Frameid].UseBorder); - Frames[Frameid].Skinned = cfg::getByte(CLUIFrameModule, AS(buf, "Skinned", sadd), Frames[Frameid].Skinned); - return 0; -} - -int DBStoreFrameSettingsAtPos(int pos, int Frameid) -{ - char sadd[16]; - char buf[255]; - - _itoa(pos, sadd, 10); - - cfg::writeTString(0, CLUIFrameModule, AS(buf, "Name", sadd), Frames[Frameid].name); - //boolean - cfg::writeByte(0, CLUIFrameModule, AS(buf, "Collapse", sadd), (BYTE)btoint(Frames[Frameid].collapsed)); - cfg::writeByte(0, CLUIFrameModule, AS(buf, "Locked", sadd), (BYTE)btoint(Frames[Frameid].Locked)); - cfg::writeByte(0, CLUIFrameModule, AS(buf, "Visible", sadd), (BYTE)btoint(Frames[Frameid].visible)); - cfg::writeByte(0, CLUIFrameModule, AS(buf, "TBVisile", sadd), (BYTE)btoint(Frames[Frameid].TitleBar.ShowTitleBar)); - - cfg::writeWord(CLUIFrameModule, AS(buf, "Height", sadd), (WORD)Frames[Frameid].height); - cfg::writeWord(CLUIFrameModule, AS(buf, "HeightCollapsed", sadd), (WORD)Frames[Frameid].HeightWhenCollapsed); - cfg::writeWord(CLUIFrameModule, AS(buf, "Align", sadd), (WORD)Frames[Frameid].align); - //FloatingPos - cfg::writeWord(CLUIFrameModule, AS(buf, "FloatX", sadd), (WORD)Frames[Frameid].FloatingPos.x); - cfg::writeWord(CLUIFrameModule, AS(buf, "FloatY", sadd), (WORD)Frames[Frameid].FloatingPos.y); - cfg::writeWord(CLUIFrameModule, AS(buf, "FloatW", sadd), (WORD)Frames[Frameid].FloatingSize.x); - cfg::writeWord(0, CLUIFrameModule, AS(buf, "FloatH", sadd), (WORD)Frames[Frameid].FloatingSize.y); - - cfg::writeByte(0, CLUIFrameModule, AS(buf, "Floating", sadd), (BYTE)btoint(Frames[Frameid].floating)); - cfg::writeByte(0, CLUIFrameModule, AS(buf, "UseBorder", sadd), (BYTE)btoint(Frames[Frameid].UseBorder)); - cfg::writeWord(0, CLUIFrameModule, AS(buf, "Order", sadd), (WORD)Frames[Frameid].order); - - cfg::writeByte(CLUIFrameModule, AS(buf, "Skinned", sadd), Frames[Frameid].Skinned); - return 0; -} - -int LocateStorePosition(int Frameid, int maxstored) -{ - int i; - LPTSTR frmname; - char settingname[255]; - if (Frames[Frameid].name == NULL) return -1; - - for (i = 0;i < maxstored;i++) { - mir_snprintf(settingname, sizeof(settingname), "Name%d", i); - frmname = DBGetStringT(0, CLUIFrameModule, settingname); - if (frmname == NULL) continue; - if (lstrcmpi(frmname, Frames[Frameid].name) == 0) { - mir_free(frmname); - return i; - } - mir_free(frmname); - } - return -1; -} - -int CLUIFramesLoadFrameSettings(int Frameid) -{ - int storpos, maxstored; - - if (FramesSysNotStarted) return -1; - - if (Frameid < 0 || Frameid >= nFramescount) - return -1; - - maxstored = cfg::getWord(CLUIFrameModule, "StoredFrames", -1); - if (maxstored == -1) - return 0; - - storpos = LocateStorePosition(Frameid, maxstored); - if (storpos == -1) - return 0; - - DBLoadFrameSettingsAtPos(storpos, Frameid); - return 0; -} - -int CLUIFramesStoreFrameSettings(int Frameid) -{ - int maxstored, storpos; - - if (FramesSysNotStarted) - return -1; - - if (Frameid < 0 || Frameid >= nFramescount) - return -1; - - maxstored = cfg::getWord(CLUIFrameModule, "StoredFrames", -1); - if (maxstored == -1) - maxstored = 0; - - storpos = LocateStorePosition(Frameid, maxstored); - if (storpos == -1) { - storpos = maxstored; - maxstored++; - } - - DBStoreFrameSettingsAtPos(storpos, Frameid); - cfg::writeWord(CLUIFrameModule, "StoredFrames", (WORD)maxstored); - return 0; -} - -int CLUIFramesStoreAllFrames() -{ - int i; - - if (FramesSysNotStarted) - return -1; - - if (cfg::shutDown) - return -1; - - lockfrm(); - for (i = 0;i < nFramescount;i++) - CLUIFramesStoreFrameSettings(i); - ulockfrm(); - return 0; -} - -// Get client frame -int CLUIFramesGetalClientFrame(void) -{ - int i; - if (FramesSysNotStarted) - return -1; - - if (alclientFrame != -1) - return alclientFrame; - - if (alclientFrame != -1) { - /* this value could become invalid if RemoveItemFromList was called, - * so we double-check */ - if (alclientFrame < nFramescount) { - if (Frames[alclientFrame].align == alClient) { - return alclientFrame; - } - } - } - - for (i = 0;i < nFramescount;i++) - if (Frames[i].align == alClient) { - alclientFrame = i; - return i; - } - return -1; -} - -HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, HGENMENU (*pfnAdd )( CLISTMENUITEM* )) -{ - CLISTMENUITEM mi; - //TMO_MenuItem tmi; - HANDLE menuid; - int framepos = id2pos(frameid); - - if (FramesSysNotStarted) return NULL; - - ZeroMemory(&mi, sizeof(mi)); - - mi.cbSize = sizeof(mi); - mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_MIRANDA); //LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA)); - mi.pszPopupName = (char *)root; - mi.popupPosition = frameid; - mi.position = popuppos++; - mi.pszName = LPGEN("&FrameTitle"); - mi.flags = CMIF_CHILDPOPUP | CMIF_GRAYED | CMIF_ICONFROMICOLIB; - mi.pszContactOwner = (char *)0; - menuid = pfnAdd(&mi); - if (frameid == -1) contMITitle = menuid; - else Frames[framepos].MenuHandles.MITitle = menuid; - - popuppos += 100000; - mi.hIcon = NULL; - mi.cbSize = sizeof(mi); - mi.pszPopupName = (char *)root; - mi.popupPosition = frameid; - mi.position = popuppos++; - mi.pszName = LPGEN("&Visible"); - mi.flags = CMIF_CHILDPOPUP | CMIF_CHECKED; - mi.pszContactOwner = (char *)0; - mi.pszService = MS_CLIST_FRAMES_SHFRAME; - menuid = pfnAdd(&mi); - if (frameid == -1) contMIVisible = menuid; - else Frames[framepos].MenuHandles.MIVisible = menuid; - - mi.pszPopupName = (char *)root; - mi.popupPosition = frameid; - mi.position = popuppos++; - mi.pszName = LPGEN("&Show TitleBar"); - mi.flags = CMIF_CHILDPOPUP | CMIF_CHECKED; - mi.pszService = MS_CLIST_FRAMES_SHFRAMETITLEBAR; - mi.pszContactOwner = (char *)0; - menuid = pfnAdd(&mi); - if (frameid == -1) contMITBVisible = menuid; - else Frames[framepos].MenuHandles.MITBVisible = menuid; - - - popuppos += 100000; - - mi.pszPopupName = (char *)root; - mi.popupPosition = frameid; - mi.position = popuppos++; - mi.pszName = LPGEN("&Locked"); - mi.flags = CMIF_CHILDPOPUP | CMIF_CHECKED; - mi.pszService = MS_CLIST_FRAMES_ULFRAME; - mi.pszContactOwner = (char *)0; - menuid = pfnAdd(&mi); - if (frameid == -1) contMILock = menuid; - else Frames[framepos].MenuHandles.MILock = menuid; - - mi.pszPopupName = (char *)root; - mi.popupPosition = frameid; - mi.position = popuppos++; - mi.pszName = LPGEN("&Collapsed"); - mi.flags = CMIF_CHILDPOPUP | CMIF_CHECKED; - mi.pszService = MS_CLIST_FRAMES_UCOLLFRAME; - mi.pszContactOwner = (char *)0; - menuid = pfnAdd(&mi); - if (frameid == -1) contMIColl = menuid; - else Frames[framepos].MenuHandles.MIColl = menuid; - - //floating - mi.pszPopupName = (char *)root; - mi.popupPosition = frameid; - mi.position = popuppos++; - mi.pszName = LPGEN("&Floating Mode"); - mi.flags = CMIF_CHILDPOPUP; - mi.pszService = "Set_Floating"; - mi.pszContactOwner = (char *)0; - menuid = pfnAdd(&mi); - if (frameid == -1) contMIFloating = menuid; - else Frames[framepos].MenuHandles.MIFloating = menuid; - - - popuppos += 100000; - - mi.pszPopupName = (char *)root; - mi.popupPosition = frameid; - mi.position = popuppos++; - mi.pszName = LPGEN("&Border"); - mi.flags = CMIF_CHILDPOPUP | CMIF_CHECKED; - mi.pszService = MS_CLIST_FRAMES_SETUNBORDER; - mi.pszContactOwner = (char *)0; - menuid = pfnAdd(&mi); - if (frameid == -1) contMIBorder = menuid; - else Frames[framepos].MenuHandles.MIBorder = menuid; - - popuppos += 100000; - - mi.pszPopupName = (char *)root; - mi.popupPosition = frameid; - mi.position = popuppos++; - mi.pszName = LPGEN("&Skinned frame"); - mi.flags = CMIF_CHILDPOPUP | CMIF_CHECKED; - mi.pszService = MS_CLIST_FRAMES_SETSKINNED; - mi.pszContactOwner = (char *)0; - menuid = pfnAdd(&mi); - if (frameid == -1) contMISkinned = menuid; - else Frames[framepos].MenuHandles.MISkinned = menuid; - - popuppos += 100000; - - { - //alignment root - mi.pszPopupName = (char *)root; - mi.popupPosition = frameid; - mi.position = popuppos++; - mi.pszName = LPGEN("&Align"); - mi.flags = CMIF_CHILDPOPUP | CMIF_ROOTPOPUP; - mi.pszService = ""; - mi.pszContactOwner = (char *)0; - menuid = pfnAdd(&mi); - if (frameid == -1) contMIAlignRoot = menuid; - else Frames[framepos].MenuHandles.MIAlignRoot = menuid; - - mi.flags = CMIF_CHILDPOPUP; - //align top - mi.pszPopupName = (char *)menuid; - mi.popupPosition = frameid; - mi.position = popuppos++; - mi.pszName = LPGEN("&Top"); - mi.pszService = CLUIFRAMESSETALIGNALTOP; - mi.pszContactOwner = (char *)alTop; - menuid = pfnAdd(&mi); - if (frameid == -1) contMIAlignTop = menuid; - else Frames[framepos].MenuHandles.MIAlignTop = menuid; - - - //align client - mi.position = popuppos++; - mi.pszName = LPGEN("&Client"); - mi.pszService = CLUIFRAMESSETALIGNALCLIENT; - mi.pszContactOwner = (char *)alClient; - menuid = pfnAdd(&mi); - if (frameid == -1) contMIAlignClient = menuid; - else Frames[framepos].MenuHandles.MIAlignClient = menuid; - - //align bottom - mi.position = popuppos++; - mi.pszName = LPGEN("&Bottom"); - mi.pszService = CLUIFRAMESSETALIGNALBOTTOM; - mi.pszContactOwner = (char *)alBottom; - menuid = pfnAdd(&mi); - if (frameid == -1) contMIAlignBottom = menuid; - else Frames[framepos].MenuHandles.MIAlignBottom = menuid; - - } - - { //position - //position root - mi.pszPopupName = (char *)root; - mi.popupPosition = frameid; - mi.position = popuppos++; - mi.pszName = LPGEN("&Position"); - mi.flags = CMIF_CHILDPOPUP | CMIF_ROOTPOPUP; - mi.pszService = ""; - mi.pszContactOwner = (char *)0; - menuid = pfnAdd(&mi); - - mi.pszPopupName = (char *)menuid; - mi.popupPosition = frameid; - mi.position = popuppos++; - mi.pszName = LPGEN("&Up"); - mi.flags = CMIF_CHILDPOPUP; - mi.pszService = CLUIFRAMESMOVEUP; - mi.pszContactOwner = (char *)1; - pfnAdd(&mi); - - mi.pszPopupName = (char *)menuid; - mi.popupPosition = frameid; - mi.position = popuppos++; - mi.pszName = LPGEN("&Down"); - mi.flags = CMIF_CHILDPOPUP; - mi.pszService = CLUIFRAMESMOVEDOWN; - mi.pszContactOwner = (char *) - 1; - pfnAdd(&mi); - } - - return 0; -} - -int ModifyMItem(WPARAM wParam, LPARAM lParam) -{ - return ModifyMenuItemProxy(wParam, lParam); -}; - - -static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM lParam) -{ - int pos; - CLISTMENUITEM mi; - - if (FramesSysNotStarted) - return -1; - - lockfrm(); - pos = id2pos((INT_PTR)wParam); - - if (pos >= 0 && pos < nFramescount) { - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.flags = CMIM_NAME | CMIF_CHILDPOPUP | CMIF_TCHAR; - mi.ptszName = Frames[pos].TitleBar.tbname ? Frames[pos].TitleBar.tbname : Frames[pos].name; - ModifyMItem((WPARAM)contMITitle, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].visible) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIVisible, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].Locked) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMILock, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].TitleBar.ShowTitleBar) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMITBVisible, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].floating) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIFloating, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if ((Frames[pos].UseBorder)) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIBorder, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if ((Frames[pos].Skinned)) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMISkinned, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].align&alTop) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIAlignTop, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].align&alClient) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIAlignClient, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].align&alBottom) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIAlignBottom, (LPARAM)&mi); - - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (!Frames[pos].collapsed) mi.flags |= CMIF_CHECKED; - if ((!Frames[pos].visible) || (Frames[pos].Locked) || (pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED; - ModifyMItem((WPARAM)contMIColl, (LPARAM)&mi); - } - ulockfrm(); - return 0; -} - -INT_PTR CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM lParam) -{ - int pos; - CLISTMENUITEM mi; - - if (FramesSysNotStarted) - return -1; - - lockfrm(); - pos = id2pos((INT_PTR)wParam); - - if (pos >= 0 && pos < nFramescount) { - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.flags = CMIM_NAME | CMIF_CHILDPOPUP | CMIF_TCHAR; - mi.ptszName = Frames[pos].TitleBar.tbname ? Frames[pos].TitleBar.tbname : Frames[pos].name; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MITitle, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].visible) mi.flags |= CMIF_CHECKED; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MIVisible, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].Locked) mi.flags |= CMIF_CHECKED; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MILock, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].TitleBar.ShowTitleBar) mi.flags |= CMIF_CHECKED; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MITBVisible, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].floating) mi.flags |= CMIF_CHECKED; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MIFloating, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if ((Frames[pos].UseBorder)) mi.flags |= CMIF_CHECKED; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MIBorder, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if ((Frames[pos].Skinned)) mi.flags |= CMIF_CHECKED; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MISkinned, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | ((Frames[pos].align & alClient) ? CMIF_GRAYED : 0); - if (Frames[pos].align&alTop) mi.flags |= CMIF_CHECKED; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MIAlignTop, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].align&alClient) mi.flags |= CMIF_CHECKED; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MIAlignClient, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | ((Frames[pos].align & alClient) ? CMIF_GRAYED : 0); - if (Frames[pos].align&alBottom) mi.flags |= CMIF_CHECKED; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MIAlignBottom, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (!Frames[pos].collapsed) mi.flags |= CMIF_CHECKED; - if ((!Frames[pos].visible) || Frames[pos].Locked || (pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MIColl, (LPARAM)&mi); - } - ulockfrm(); - return 0; -} - -INT_PTR CLUIFramesGetFrameOptions(WPARAM wParam, LPARAM lParam) -{ - int pos; - INT_PTR retval; - - if (FramesSysNotStarted) return -1; - - lockfrm(); - pos = id2pos(HIWORD(wParam)); - if (pos < 0 || pos >= nFramescount) { - ulockfrm(); - return -1; - } - - switch (LOWORD(wParam)) { - case FO_FLAGS: - retval = 0; - if (Frames[pos].visible) retval |= F_VISIBLE; - if (!Frames[pos].collapsed) retval |= F_UNCOLLAPSED; - if (Frames[pos].Locked) retval |= F_LOCKED; - if (Frames[pos].TitleBar.ShowTitleBar) retval |= F_SHOWTB; - if (Frames[pos].TitleBar.ShowTitleBarTip) retval |= F_SHOWTBTIP; - if (Frames[pos].Skinned) retval |= F_SKINNED; - if (!(GetWindowLongPtr(Frames[pos].hWnd, GWL_STYLE)&WS_BORDER)) retval |= F_NOBORDER; - break; - - case FO_NAME: - retval = (INT_PTR)Frames[pos].name; - break; - - case FO_TBNAME: - retval = (INT_PTR)Frames[pos].TitleBar.tbname; - break; - - case FO_TBTIPNAME: - retval = (INT_PTR)Frames[pos].TitleBar.tooltip; - break; - - case FO_TBSTYLE: - retval = GetWindowLongPtr(Frames[pos].TitleBar.hwnd, GWL_STYLE); - break; - - case FO_TBEXSTYLE: - retval = GetWindowLongPtr(Frames[pos].TitleBar.hwnd, GWL_EXSTYLE); - break; - - case FO_ICON: - retval = (INT_PTR)Frames[pos].TitleBar.hicon; - break; - - case FO_HEIGHT: - retval = (INT_PTR)Frames[pos].height; - break; - - case FO_ALIGN: - retval = (INT_PTR)Frames[pos].align; - break; - case FO_FLOATING: - retval = (int)Frames[pos].floating; - break; - default: - retval = -1; - break; - } - ulockfrm(); - return retval; -} - -INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam) -{ - int pos; - int retval; // value to be returned - - if (FramesSysNotStarted) - return -1; - - lockfrm(); - pos = id2pos(HIWORD(wParam)); - if (pos < 0 || pos >= nFramescount) { - ulockfrm(); - return -1; - } - - switch (LOWORD(wParam) & ~FO_UNICODETEXT) { - case FO_FLAGS: { - int flag = lParam; - int style; - - Frames[pos].dwFlags = flag; - Frames[pos].visible = FALSE; - if (flag&F_VISIBLE) Frames[pos].visible = TRUE; - - Frames[pos].collapsed = TRUE; - if (flag&F_UNCOLLAPSED) Frames[pos].collapsed = FALSE; - - Frames[pos].Locked = FALSE; - if (flag&F_LOCKED) Frames[pos].Locked = TRUE; - - Frames[pos].UseBorder = TRUE; - if (flag&F_NOBORDER) Frames[pos].UseBorder = FALSE; - - Frames[pos].TitleBar.ShowTitleBar = FALSE; - if (flag&F_SHOWTB) Frames[pos].TitleBar.ShowTitleBar = TRUE; - - Frames[pos].TitleBar.ShowTitleBarTip = FALSE; - if (flag&F_SHOWTBTIP) Frames[pos].TitleBar.ShowTitleBarTip = TRUE; - - SendMessage(Frames[pos].TitleBar.hwndTip, TTM_ACTIVATE, (WPARAM)Frames[pos].TitleBar.ShowTitleBarTip, 0); - - style = (int)GetWindowLongPtr(Frames[pos].hWnd, GWL_STYLE); - style |= WS_BORDER; - style |= CLS_SKINNEDFRAME; - - if (flag&F_NOBORDER) - style &= (~WS_BORDER); - - Frames[pos].Skinned = FALSE; - if (flag & F_SKINNED) - Frames[pos].Skinned = TRUE; - - if (!(flag & F_SKINNED)) - style &= ~CLS_SKINNEDFRAME; - - SetWindowLongPtr(Frames[pos].hWnd, GWL_STYLE, (LONG)style); - SetWindowLongPtr(Frames[pos].TitleBar.hwnd, GWL_STYLE, (LONG)style & ~(WS_VSCROLL | WS_HSCROLL)); - - ulockfrm(); - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); - SetWindowPos(Frames[pos].TitleBar.hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); - return 0; - } - - case FO_NAME: - if (lParam == (LPARAM)NULL) { - ulockfrm(); - return -1; - } - mir_free(Frames[pos].name); - Frames[pos].name = (wParam & FO_UNICODETEXT) ? mir_u2t((LPWSTR)lParam) : mir_a2t((LPSTR)lParam); - ulockfrm(); - return 0; - - case FO_TBNAME: - if (lParam == (LPARAM)NULL) { - ulockfrm(); - return(-1); - } - mir_free(Frames[pos].TitleBar.tbname); - Frames[pos].TitleBar.tbname = (wParam & FO_UNICODETEXT) ? mir_u2t((LPWSTR)lParam) : mir_a2t((LPSTR)lParam); - ulockfrm(); - if (Frames[pos].floating && (Frames[pos].TitleBar.tbname != NULL)) - SetWindowText(Frames[pos].ContainerWnd, Frames[pos].TitleBar.tbname); - return 0; - - case FO_TBTIPNAME: - if (lParam == (LPARAM)NULL) { - ulockfrm(); - return(-1); - } - mir_free(Frames[pos].TitleBar.tooltip); - Frames[pos].TitleBar.tooltip = (wParam & FO_UNICODETEXT) ? mir_u2t((LPWSTR)lParam) : mir_a2t((LPSTR)lParam); - UpdateTBToolTip(pos); - ulockfrm(); - return 0; - - case FO_TBSTYLE: - SetWindowLongPtr(Frames[pos].TitleBar.hwnd, GWL_STYLE, lParam); - ulockfrm(); - return 0; - - case FO_TBEXSTYLE: - SetWindowLongPtr(Frames[pos].TitleBar.hwnd, GWL_EXSTYLE, lParam); - ulockfrm(); - return 0; - - case FO_ICON: - Frames[pos].TitleBar.hicon = (HICON)lParam; - ulockfrm(); - return 0; - - case FO_HEIGHT: - { - if (lParam < 0) { - ulockfrm(); - return -1; - } - if(Frames[pos].Skinned) { - int uID = (Frames[pos].TitleBar.ShowTitleBar ? ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE : ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE); - lParam += (StatusItems[uID].MARGIN_BOTTOM + StatusItems[uID].MARGIN_TOP); - } - if (Frames[pos].collapsed) { - int oldHeight = Frames[pos].height; - retval = Frames[pos].height; - Frames[pos].height = lParam; - if (!CLUIFramesFitInSize()) - Frames[pos].height = retval; - retval = Frames[pos].height; - - if (Frames[pos].height != oldHeight) { - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,(LPARAM)0); - if(Frames[pos].Skinned) - RedrawWindow(Frames[pos].hWnd, 0, 0, RDW_FRAME|RDW_UPDATENOW|RDW_INVALIDATE); - } - } - else { - retval = Frames[pos].HeightWhenCollapsed; - Frames[pos].HeightWhenCollapsed = lParam; - if (!CLUIFramesFitInSize()) - Frames[pos].HeightWhenCollapsed = retval; - retval = Frames[pos].HeightWhenCollapsed; - } - ulockfrm(); - return(retval); - } - - case FO_FLOATING: - if (lParam < 0) { - ulockfrm(); - return -1; - } - { - int id = Frames[pos].id; - Frames[pos].floating = !(lParam); - ulockfrm(); - - CLUIFrameSetFloat(id, 1);//lparam=1 use stored width and height - return(wParam); - } - case FO_ALIGN: - if (!(lParam&alTop || lParam&alBottom || lParam&alClient)) { - ulockfrm(); - return(-1); - } - if ((lParam&alClient) && (CLUIFramesGetalClientFrame() >= 0)) { //only one alClient frame possible - alclientFrame = -1;//recalc it - ulockfrm(); - return -1; - } - Frames[pos].align = lParam; - ulockfrm(); - return(0); - } - ulockfrm(); - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); - return -1; -} - -static INT_PTR CLUIFramesShowAll(WPARAM wParam, LPARAM lParam) -{ - int i; - - if (FramesSysNotStarted) return -1; - - for (i = 0;i < nFramescount;i++) - Frames[i].visible = TRUE; - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); - return 0; -} - -INT_PTR CLUIFramesShowAllTitleBars(WPARAM wParam, LPARAM lParam) -{ - int i; - - if (FramesSysNotStarted) return -1; - - for (i = 0;i < nFramescount;i++) { - Frames[i].TitleBar.ShowTitleBar = TRUE; - SetWindowPos(Frames[i].hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); - } - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); - return 0; -} - -//wparam=lparam=0 -INT_PTR CLUIFramesHideAllTitleBars(WPARAM wParam, LPARAM lParam) -{ - int i; - - if (FramesSysNotStarted) return -1; - - for (i = 0;i < nFramescount;i++) { - Frames[i].TitleBar.ShowTitleBar = FALSE; - SetWindowPos(Frames[i].hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); - } - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); - return 0; -} - -//wparam=frameid -INT_PTR CLUIFramesShowHideFrame(WPARAM wParam, LPARAM lParam) -{ - int pos; - - if (FramesSysNotStarted) - return -1; - - lockfrm(); - pos = id2pos((INT_PTR)wParam); - if (pos >= 0 && !lstrcmp(Frames[pos].name, _T("My Contacts"))) - Frames[pos].visible = 1; - else { - if (pos >= 0 && (int)pos < nFramescount) - Frames[pos].visible = !Frames[pos].visible; - if (Frames[pos].floating) - CLUIFrameResizeFloatingFrame(pos); - } - ulockfrm(); - if (!Frames[pos].floating) - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); - return 0; -} - -//wparam=frameid -INT_PTR CLUIFramesShowHideFrameTitleBar(WPARAM wParam, LPARAM lParam) -{ - int pos; - - if (FramesSysNotStarted) - return -1; - - lockfrm(); - pos = id2pos((INT_PTR)wParam); - if (pos >= 0 && (int)pos < nFramescount) { - Frames[pos].TitleBar.ShowTitleBar = !Frames[pos].TitleBar.ShowTitleBar; - SetWindowPos(Frames[pos].hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); - } - ulockfrm(); - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); - return 0; -} - - -//wparam=frameid -//lparam=-1 up ,1 down -INT_PTR CLUIFramesMoveUpDown(WPARAM wParam, LPARAM lParam) -{ - int pos, i, curpos, curalign, v, tmpval; - - if (FramesSysNotStarted) - return -1; - - lockfrm(); - pos = id2pos((INT_PTR)wParam); - if (pos >= 0 && (int)pos < nFramescount) { - curpos = Frames[pos].order; - curalign = Frames[pos].align; - v = 0; - memset(g_sd, 0, sizeof(SortData) * MAX_FRAMES); - for (i = 0;i < nFramescount;i++) { - if (Frames[i].floating || (!Frames[i].visible) || (Frames[i].align != curalign)) - continue; - g_sd[v].order = Frames[i].order; - g_sd[v].realpos = i; - v++; - } - if (v == 0) { - ulockfrm(); - return(0); - } - qsort(g_sd, v, sizeof(SortData), sortfunc); - for (i = 0;i < v;i++) { - if (g_sd[i].realpos == pos) { - if (lParam == -1) { - if (i < 1) break; - tmpval = Frames[g_sd[i-1].realpos].order; - Frames[g_sd[i-1].realpos].order = Frames[pos].order; - Frames[pos].order = tmpval; - break; - } - if (lParam == 1) { - if (i > v - 1) break; - tmpval = Frames[g_sd[i+1].realpos].order; - Frames[g_sd[i+1].realpos].order = Frames[pos].order; - Frames[pos].order = tmpval; - break; - } - } - } - ulockfrm(); - CLUIFramesReSort(); - //CLUIFramesStoreAllFrames(); - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - PostMessage(pcli->hwndContactList, CLUIINTM_REDRAW, 0, 0); - } - return(0); -} - -static INT_PTR CLUIFramesMoveUp(WPARAM wParam, LPARAM lParam) -{ - return(CLUIFramesMoveUpDown(wParam, -1)); -} - -static INT_PTR CLUIFramesMoveDown(WPARAM wParam, LPARAM lParam) -{ - return(CLUIFramesMoveUpDown(wParam, 1)); -} - - -//wparam=frameid -//lparam=alignment -INT_PTR CLUIFramesSetAlign(WPARAM wParam, LPARAM lParam) -{ - if (FramesSysNotStarted) return -1; - - CLUIFramesSetFrameOptions(MAKEWPARAM(FO_ALIGN, wParam), lParam); - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); - return(0); -} -INT_PTR CLUIFramesSetAlignalTop(WPARAM wParam, LPARAM lParam) -{ - if (FramesSysNotStarted) return -1; - - return CLUIFramesSetAlign(wParam, alTop); -} -INT_PTR CLUIFramesSetAlignalBottom(WPARAM wParam, LPARAM lParam) -{ - if (FramesSysNotStarted) return -1; - - return CLUIFramesSetAlign(wParam, alBottom); -} -INT_PTR CLUIFramesSetAlignalClient(WPARAM wParam, LPARAM lParam) -{ - if (FramesSysNotStarted) return -1; - - return CLUIFramesSetAlign(wParam, alClient); -} - - -//wparam=frameid -INT_PTR CLUIFramesLockUnlockFrame(WPARAM wParam, LPARAM lParam) -{ - int pos; - - if (FramesSysNotStarted) - return -1; - - lockfrm(); - pos = id2pos((INT_PTR)wParam); - if (pos >= 0 && (int)pos < nFramescount) { - Frames[pos].Locked = !Frames[pos].Locked; - CLUIFramesStoreFrameSettings(pos); - } - ulockfrm(); - return 0; -} - -//wparam=frameid -INT_PTR CLUIFramesSetUnSetBorder(WPARAM wParam, LPARAM lParam) -{ - RECT rc; - int FrameId, oldflags; - HWND hw; - boolean flt; - - if (FramesSysNotStarted) - return -1; - - lockfrm(); - FrameId = id2pos((INT_PTR)wParam); - if (FrameId == -1) { - ulockfrm(); - return(-1); - } - flt = oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, wParam), 0); - - if (oldflags&F_NOBORDER) - oldflags &= (~F_NOBORDER); - else - oldflags |= F_NOBORDER; - - hw = Frames[FrameId].hWnd; - GetWindowRect(hw, &rc); - ulockfrm(); - CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, wParam), oldflags); - SetWindowPos(hw, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOZORDER); - return(0); -} - -//wparam=frameid -INT_PTR CLUIFramesSetUnSetSkinned(WPARAM wParam, LPARAM lParam) -{ - RECT rc; - int FrameId, oldflags; - HWND hw; - boolean flt; - - if (FramesSysNotStarted) - return -1; - - lockfrm(); - FrameId = id2pos((INT_PTR)wParam); - if (FrameId == -1) { - ulockfrm(); - return(-1); - } - flt = oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, wParam), 0); - - if (oldflags & F_SKINNED) - oldflags &= ~F_SKINNED; - else - oldflags |= F_SKINNED; - - hw = Frames[FrameId].hWnd; - GetWindowRect(hw, &rc); - ulockfrm(); - CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, wParam), oldflags); - SetWindowPos(hw, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOZORDER); - return(0); -} - -//wparam=frameid -INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam, LPARAM lParam) -{ - int FrameId; - - if (FramesSysNotStarted) - return -1; - - TitleBarH = cfg::dat.titleBarHeight; - lockfrm(); - FrameId = id2pos((INT_PTR)wParam); - if (FrameId >= 0 && FrameId < nFramescount) { - int oldHeight; - - // do not collapse/uncollapse client/locked/invisible frames - if (Frames[FrameId].align == alClient && !(Frames[FrameId].Locked || (!Frames[FrameId].visible) || Frames[FrameId].floating)) { - RECT rc; - if (CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { - ulockfrm(); - return 0; - } - if (cfg::getByte("CLUI", "AutoSize", 0)) { - ulockfrm(); - return 0; - } - GetWindowRect(pcli->hwndContactList, &rc); - - if (Frames[FrameId].collapsed == TRUE) { - rc.bottom -= rc.top; - rc.bottom -= Frames[FrameId].height; - Frames[FrameId].HeightWhenCollapsed = Frames[FrameId].height; - Frames[FrameId].collapsed = FALSE; - } else { - rc.bottom -= rc.top; - rc.bottom += Frames[FrameId].HeightWhenCollapsed; - Frames[FrameId].collapsed = TRUE; - } - - SetWindowPos(pcli->hwndContactList, NULL, 0, 0, rc.right - rc.left, rc.bottom, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE); - - CLUIFramesStoreAllFrames(); - ulockfrm(); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); - return 0; - - } - if (Frames[FrameId].Locked || (!Frames[FrameId].visible)) { - ulockfrm(); - return 0; - } - - oldHeight = Frames[FrameId].height; - - // if collapsed, uncollapse - if (Frames[FrameId].collapsed == TRUE) { - Frames[FrameId].HeightWhenCollapsed = Frames[FrameId].height; - Frames[FrameId].height = UNCOLLAPSED_FRAME_SIZE; - Frames[FrameId].collapsed = FALSE; - } - // if uncollapsed, collapse - else { - Frames[FrameId].height = Frames[FrameId].HeightWhenCollapsed; - Frames[FrameId].collapsed = TRUE; - } - - if (!Frames[FrameId].floating) { - - if (!CLUIFramesFitInSize()) { - //cant collapse,we can resize only for height 2*UNCOLLAPSED_FRAME_SIZE) { - oldHeight = Frames[alfrm].height - UNCOLLAPSED_FRAME_SIZE; - Frames[FrameId].collapsed = TRUE; - } - } else { - int i, sumheight = 0; - - for (i = 0;i < nFramescount;i++) { - if ((Frames[i].align != alClient) && (!Frames[i].floating) && (Frames[i].visible) && (!Frames[i].needhide)) { - sumheight += (Frames[i].height) + (TitleBarH * btoint(Frames[i].TitleBar.ShowTitleBar)) + 2; - ulockfrm(); - return FALSE; - } - if (sumheight > ContactListHeight - 0 - 2) - Frames[FrameId].height = (ContactListHeight - 0 - 2) - sumheight; - } - } - Frames[FrameId].height = oldHeight; - if (Frames[FrameId].collapsed == FALSE) { - if (Frames[FrameId].floating) - SetWindowPos(Frames[FrameId].ContainerWnd, HWND_TOP, 0, 0, Frames[FrameId].wndSize.right - Frames[FrameId].wndSize.left + 6, Frames[FrameId].height + DEFAULT_TITLEBAR_HEIGHT + 4, SWP_SHOWWINDOW | SWP_NOMOVE); - ulockfrm(); - return -1; - } - } - } - ulockfrm(); - if (!Frames[FrameId].floating) - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - else { - RECT contwnd; - GetWindowRect(Frames[FrameId].ContainerWnd, &contwnd); - contwnd.top = contwnd.bottom - contwnd.top;//height - contwnd.left = contwnd.right - contwnd.left;//width - - contwnd.top -= (oldHeight - Frames[FrameId].height);//newheight - SetWindowPos(Frames[FrameId].ContainerWnd, HWND_TOP, 0, 0, contwnd.left, contwnd.top, SWP_SHOWWINDOW | SWP_NOMOVE); - } - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); - CLUIFramesStoreAllFrames(); - return(0); - } else { - ulockfrm(); - return -1; - } - ulockfrm(); - return 0; -} - -static int CLUIFramesLoadMainMenu() -{ - CLISTMENUITEM mi; - int i, separator; - - if (FramesSysNotStarted) - return -1; - - if (MainMIRoot != (HANDLE) - 1) { - CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)MainMIRoot, 0); - MainMIRoot = (HANDLE) - 1; - } - - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); - - // create root menu - mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_MIRANDA); //LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA)); - mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB; - mi.position = (int)3000090000; - mi.pszPopupName = (char*) - 1; - mi.pszName = LPGEN("Frames"); - mi.pszService = 0; - MainMIRoot = Menu_AddMainMenuItem(&mi); - - // create frames menu - separator = (int)3000200000; - for (i = 0;i < nFramescount;i++) { - mi.hIcon = Frames[i].TitleBar.hicon; - mi.flags = CMIF_CHILDPOPUP | CMIF_ROOTPOPUP | CMIF_TCHAR; - mi.position = separator; - mi.pszPopupName = (char*)MainMIRoot; - mi.ptszName = Frames[i].TitleBar.tbname ? Frames[i].TitleBar.tbname : Frames[i].name; - mi.pszService = 0; - Frames[i].MenuHandles.MainMenuItem = Menu_AddMainMenuItem(&mi); - CLUIFramesCreateMenuForFrame(Frames[i].id, (int)Frames[i].MenuHandles.MainMenuItem, separator, Menu_AddMainMenuItem); - CLUIFramesModifyMainMenuItems(Frames[i].id, 0); - //NotifyEventHooks(hPreBuildFrameMenuEvent,i,(LPARAM)Frames[i].MenuHandles.MainMenuItem); - CallService(MS_CLIST_FRAMEMENUNOTIFY, (WPARAM)Frames[i].id, (LPARAM)Frames[i].MenuHandles.MainMenuItem); - separator++; - } - - separator += 100000; - - // create "show all frames" menu - mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA)); - mi.flags = CMIF_CHILDPOPUP; - mi.position = separator++; - mi.pszPopupName = (char*)MainMIRoot; - mi.pszName = LPGEN("Show All Frames"); - mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMES; - Menu_AddMainMenuItem(&mi); - - // create "show all titlebars" menu - mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_HELP)); - mi.position = separator++; - mi.pszPopupName = (char*)MainMIRoot; - mi.flags = CMIF_CHILDPOPUP; - mi.pszName = LPGEN("Show All Titlebars"); - mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMESTB; - Menu_AddMainMenuItem(&mi); - - // create "hide all titlebars" menu - mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_HELP)); - mi.position = separator++; - mi.pszPopupName = (char*)MainMIRoot; - mi.flags = CMIF_CHILDPOPUP; - mi.pszName = LPGEN("Hide All Titlebars"); - mi.pszService = MS_CLIST_FRAMES_HIDEALLFRAMESTB; - Menu_AddMainMenuItem(&mi); - - return 0; -} - -static HFONT CLUILoadTitleBarFont() -{ - char facename[] = "MS Shell Dlg"; - HFONT hfont; - LOGFONT logfont; - memset(&logfont, 0, sizeof(logfont)); - memcpy(logfont.lfFaceName, facename, sizeof(facename)); - logfont.lfWeight = FW_NORMAL; - logfont.lfHeight = -10; - hfont = CreateFontIndirect(&logfont); - return hfont; -} - -static int UpdateTBToolTip(int framepos) -{ - { - TOOLINFO ti; - - ZeroMemory(&ti, sizeof(ti)); - ti.cbSize = sizeof(ti); - ti.lpszText = Frames[framepos].TitleBar.tooltip; - ti.hinst = g_hInst; - ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS ; - ti.uId = (UINT_PTR)Frames[framepos].TitleBar.hwnd; - - return(SendMessage(Frames[framepos].TitleBar.hwndTip, TTM_UPDATETIPTEXT, (WPARAM)0, (LPARAM)&ti)); - } - -}; - -int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BOOL hasTitleBar) -{ - HDC hdc; - RECT rcWindow, rc; - HWND hwndParent = GetParent(hwnd); - LRESULT result; - - if (hwndParent != pcli->hwndContactList || !cfg::dat.bSkinnedScrollbar) - result = CallWindowProc(oldWndProc, hwnd, WM_NCPAINT, wParam, lParam); - else - result = 0; - - if (pcli && pcli->hwndContactList && GetParent(hwnd) == pcli->hwndContactList) { - if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SKINNEDFRAME) { - StatusItems_t *item = StatusItems ? (hasTitleBar ? &StatusItems[ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE] : &StatusItems[ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE]) : 0; - HDC realDC; - HBITMAP hbmDraw, hbmOld; - - if (item == 0) - return 0; - - GetWindowRect(hwnd, &rcWindow); - rc.left = rc.top = 0; - rc.right = rcWindow.right - rcWindow.left; - rc.bottom = rcWindow.bottom - rcWindow.top; - - hdc = realDC = GetWindowDC(hwnd); - if (hwnd == pcli->hwndContactTree) { - realDC = CreateCompatibleDC(hdc); - hbmDraw = CreateCompatibleBitmap(hdc, rc.right, rc.bottom); - hbmOld = reinterpret_cast(SelectObject(realDC, hbmDraw)); - } - - ExcludeClipRect(realDC, item->MARGIN_LEFT, item->MARGIN_TOP, rc.right - item->MARGIN_RIGHT, rc.bottom - item->MARGIN_BOTTOM); - - BitBlt(realDC, 0, 0, rc.right - rc.left, rc.bottom - rc.top, cfg::dat.hdcBg, rcWindow.left - cfg::dat.ptW.x, rcWindow.top - cfg::dat.ptW.y, SRCCOPY); - - DrawAlpha(realDC, &rc, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT, item->GRADIENT, - item->CORNER, item->BORDERSTYLE, item->imageItem); - if (hwnd == pcli->hwndContactTree) { - ExcludeClipRect(hdc, item->MARGIN_LEFT, item->MARGIN_TOP, rc.right - item->MARGIN_RIGHT, rc.bottom - item->MARGIN_BOTTOM); - BitBlt(hdc, 0, 0, rc.right, rc.bottom, realDC, 0, 0, SRCCOPY); - SelectObject(realDC, hbmOld); - DeleteObject(hbmDraw); - DeleteDC(realDC); - } - ReleaseDC(hwnd, hdc); - return 0; - } else if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_BORDER) { - HPEN hPenOld; - HBRUSH brold; - - hdc = GetWindowDC(hwnd); - hPenOld = reinterpret_cast(SelectObject(hdc, g_hPenCLUIFrames)); - GetWindowRect(hwnd, &rcWindow); - rc.left = rc.top = 0; - rc.right = rcWindow.right - rcWindow.left; - rc.bottom = rcWindow.bottom - rcWindow.top; - brold = reinterpret_cast(SelectObject(hdc, GetStockObject(HOLLOW_BRUSH))); - Rectangle(hdc, 0, 0, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top); - SelectObject(hdc, hPenOld); - SelectObject(hdc, brold); - ReleaseDC(hwnd, hdc); - return 0; - } - } - return result; -} - -int FrameNCCalcSize(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BOOL hasTitleBar) -{ - StatusItems_t *item = StatusItems ? (hasTitleBar ? &StatusItems[ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE] : &StatusItems[ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE]) : 0; - LRESULT orig = oldWndProc ? CallWindowProc(oldWndProc, hwnd, WM_NCCALCSIZE, wParam, lParam) : 0; - NCCALCSIZE_PARAMS *nccp = (NCCALCSIZE_PARAMS *)lParam; - DWORD dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); - - if (item == 0 || pcli == 0) - return orig; - - if (item->IGNORED || !(dwStyle & CLS_SKINNEDFRAME) || GetParent(hwnd) != pcli->hwndContactList) - return orig; - - nccp->rgrc[0].left += item->MARGIN_LEFT; - nccp->rgrc[0].right -= item->MARGIN_RIGHT; - nccp->rgrc[0].bottom -= item->MARGIN_BOTTOM; - nccp->rgrc[0].top += item->MARGIN_TOP; - return WVR_REDRAW; -} - -static LRESULT CALLBACK FramesSubClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - int i; - - WNDPROC oldWndProc = 0; - BOOL hasTitleBar = FALSE; - - for (i = 0; i < nFramescount; i++) { - if (Frames[i].hWnd == hwnd) { - oldWndProc = Frames[i].wndProc; - hasTitleBar = Frames[i].TitleBar.ShowTitleBar; - } - } - switch (msg) { - case WM_NCPAINT: { - return FrameNCPaint(hwnd, oldWndProc ? oldWndProc : DefWindowProc, wParam, lParam, hasTitleBar); - } - case WM_NCCALCSIZE: { - return FrameNCCalcSize(hwnd, oldWndProc, wParam, lParam, hasTitleBar); - } - case WM_PRINTCLIENT: - return 0; - default: - break; - } - if (oldWndProc) - return CallWindowProc(oldWndProc, hwnd, msg, wParam, lParam); - return DefWindowProc(hwnd, msg, wParam, lParam); -} - -/* - * re-sort all frames and correct frame ordering - */ - -static int CLUIFramesReSort() -{ - int v = 0, i; - int order = 1; - - lockfrm(); - memset(g_sd, 0, sizeof(SortData) * MAX_FRAMES); - for (i = 0;i < nFramescount;i++) { - if (Frames[i].align != alTop) - continue; - g_sd[v].order = Frames[i].order; - g_sd[v].realpos = i; - v++; - } - if (v > 0) { - qsort(g_sd, v, sizeof(SortData), sortfunc); - for (i = 0; i < v; i++) - Frames[g_sd[i].realpos].order = order++; - } - - memset(g_sd, 0, sizeof(SortData) * MAX_FRAMES); - v = 0; - for (i = 0;i < nFramescount;i++) { - if (Frames[i].align != alBottom) - continue; - g_sd[v].order = Frames[i].order; - g_sd[v].realpos = i; - v++; - } - if (v > 0) { - qsort(g_sd, v, sizeof(SortData), sortfunc); - for (i = 0; i < v; i++) - Frames[g_sd[i].realpos].order = order++; - } - CLUIFramesStoreAllFrames(); - ulockfrm(); - return(0); -} - -//wparam=(CLISTFrame*)clfrm -INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM lParam) -{ - int style, retval; - char * CustomName = NULL; - CLISTFrame *clfrm = (CLISTFrame *)wParam; - - if (pcli->hwndContactList == 0) return -1; - if (FramesSysNotStarted) return -1; - if (clfrm->cbSize != sizeof(CLISTFrame)) return -1; - - lockfrm(); - if (nFramescount >= MAX_FRAMES) { - ulockfrm(); - return -1; - } - if (Frames == NULL) { - Frames = (wndFrame*)malloc(sizeof(wndFrame) * (MAX_FRAMES + 2)); - ZeroMemory(Frames, sizeof(wndFrame) * (MAX_FRAMES + 2)); - } - memset(&Frames[nFramescount], 0, sizeof(wndFrame)); - - Frames[nFramescount].id = NextFrameId++; - Frames[nFramescount].align = clfrm->align; - Frames[nFramescount].hWnd = clfrm->hWnd; - Frames[nFramescount].height = clfrm->height; - Frames[nFramescount].TitleBar.hicon = clfrm->hIcon; - //Frames[nFramescount].TitleBar.BackColour; - Frames[nFramescount].floating = FALSE; - - if (clfrm->Flags & F_NO_SUBCONTAINER) - Frames[nFramescount].OwnerWindow = (HWND) - 2; - else - Frames[nFramescount].OwnerWindow = pcli->hwndContactList; - - SetClassLong(clfrm->hWnd, GCL_STYLE, GetClassLong(clfrm->hWnd, GCL_STYLE) & ~(CS_VREDRAW | CS_HREDRAW)); - SetWindowLongPtr(clfrm->hWnd, GWL_STYLE, GetWindowLongPtr(clfrm->hWnd, GWL_STYLE) | WS_CLIPCHILDREN); - - if (GetCurrentThreadId() == GetWindowThreadProcessId(clfrm->hWnd, NULL)) { - if (clfrm->hWnd != pcli->hwndContactTree && clfrm->hWnd != g_hwndViewModeFrame && clfrm->hWnd != g_hwndEventArea) { - Frames[nFramescount].wndProc = (WNDPROC)GetWindowLongPtr(clfrm->hWnd, GWLP_WNDPROC); - SetWindowLongPtr(clfrm->hWnd, GWLP_WNDPROC, (LONG_PTR)FramesSubClassProc); - } - } - - if (clfrm->hWnd == g_hwndEventArea) - wndFrameEventArea = &Frames[nFramescount]; - else if (clfrm->hWnd == pcli->hwndContactTree) - wndFrameCLC = &Frames[nFramescount]; - else if (clfrm->hWnd == g_hwndViewModeFrame) - wndFrameViewMode = &Frames[nFramescount]; - - Frames[nFramescount].dwFlags = clfrm->Flags; - - if (clfrm->name == NULL || ((clfrm->Flags&F_UNICODE) ? lstrlenW(clfrm->wname) : lstrlenA(clfrm->name)) == 0) { - TCHAR ptszClassName[ 256 ]; - GetClassName(Frames[nFramescount].hWnd, ptszClassName, SIZEOF(ptszClassName)); - Frames[nFramescount].name = mir_tstrdup(ptszClassName); - } else Frames[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) ? lstrlenW(clfrm->TBwname) : lstrlenA(clfrm->TBname)) == 0) - Frames[nFramescount].TitleBar.tbname = mir_tstrdup(Frames[nFramescount].name); - else - Frames[nFramescount].TitleBar.tbname = (clfrm->Flags & F_UNICODE) ? mir_u2t(clfrm->TBwname) : mir_a2t(clfrm->TBname); - Frames[nFramescount].needhide = FALSE; - Frames[nFramescount].TitleBar.ShowTitleBar = (clfrm->Flags & F_SHOWTB ? TRUE : FALSE); - Frames[nFramescount].TitleBar.ShowTitleBarTip = (clfrm->Flags & F_SHOWTBTIP ? TRUE : FALSE); - - Frames[nFramescount].collapsed = clfrm->Flags & F_UNCOLLAPSED ? FALSE : TRUE; - Frames[nFramescount].Locked = clfrm->Flags & F_LOCKED ? TRUE : FALSE; - Frames[nFramescount].visible = clfrm->Flags & F_VISIBLE ? TRUE : FALSE; - - Frames[nFramescount].UseBorder = (clfrm->Flags & F_NOBORDER) ? FALSE : TRUE; - Frames[nFramescount].Skinned = (clfrm->Flags & F_SKINNED) ? TRUE : FALSE; - - // create frame - Frames[nFramescount].TitleBar.hwnd = - CreateWindow(CLUIFrameTitleBarClassName, Frames[nFramescount].name, - (cfg::getByte(CLUIFrameModule, "RemoveAllTitleBarBorders", 1) ? 0 : WS_BORDER) - | WS_CHILD | WS_CLIPCHILDREN | (Frames[nFramescount].TitleBar.ShowTitleBar ? WS_VISIBLE : 0) | - WS_CLIPCHILDREN, 0, 0, 0, 0, pcli->hwndContactList, NULL, g_hInst, NULL); - - SetWindowLongPtr(Frames[nFramescount].TitleBar.hwnd, GWLP_USERDATA, Frames[nFramescount].id); - - Frames[nFramescount].TitleBar.hwndTip = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - pcli->hwndContactList, NULL, g_hInst, NULL); - - SetWindowPos(Frames[nFramescount].TitleBar.hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - { - TOOLINFOA ti; - int res; - - ZeroMemory(&ti, sizeof(ti)); - ti.cbSize = sizeof(ti); - ti.lpszText = ""; - ti.hinst = g_hInst; - ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS ; - ti.uId = (UINT_PTR)Frames[nFramescount].TitleBar.hwnd; - res = SendMessageA(Frames[nFramescount].TitleBar.hwndTip, TTM_ADDTOOL, (WPARAM)0, (LPARAM) & ti); - } - - SendMessage(Frames[nFramescount].TitleBar.hwndTip, TTM_ACTIVATE, (WPARAM)Frames[nFramescount].TitleBar.ShowTitleBarTip, 0); - - Frames[nFramescount].oldstyles = GetWindowLongPtr(Frames[nFramescount].hWnd, GWL_STYLE); - Frames[nFramescount].TitleBar.oldstyles = GetWindowLongPtr(Frames[nFramescount].TitleBar.hwnd, GWL_STYLE); - //Frames[nFramescount].FloatingPos.x= - - retval = Frames[nFramescount].id; - Frames[nFramescount].order = nFramescount + 1; - nFramescount++; - - CLUIFramesLoadFrameSettings(id2pos(retval)); - style = GetWindowLongPtr(Frames[nFramescount-1].hWnd, GWL_STYLE); - style &= ~(WS_BORDER); - style |= ((Frames[nFramescount-1].UseBorder) ? WS_BORDER : 0); - - style |= Frames[nFramescount-1].Skinned ? CLS_SKINNEDFRAME : 0; - - SetWindowLongPtr(Frames[nFramescount-1].hWnd, GWL_STYLE, style); - SetWindowLongPtr(Frames[nFramescount-1].TitleBar.hwnd, GWL_STYLE, style & ~(WS_VSCROLL | WS_HSCROLL)); - - if (Frames[nFramescount-1].order == 0) { - Frames[nFramescount-1].order = nFramescount; - } - - ulockfrm(); - - alclientFrame = -1;//recalc it - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - - if (Frames[nFramescount-1].floating) { - Frames[nFramescount-1].floating = FALSE; - CLUIFrameSetFloat(retval, 1);//lparam=1 use stored width and height - } - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); - return retval; -} - -static INT_PTR CLUIFramesRemoveFrame(WPARAM wParam, LPARAM lParam) -{ - int pos; - if (FramesSysNotStarted) - return -1; - - lockfrm(); - pos = id2pos((INT_PTR)wParam); - - if (pos < 0 || pos > nFramescount) { - ulockfrm(); - return(-1); - } - - { - wndFrame* F = &Frames[pos]; - if (F->hWnd == g_hwndEventArea) - wndFrameEventArea = NULL; - else if (F->hWnd == pcli->hwndContactTree) - wndFrameCLC = NULL; - else if (F->hWnd == g_hwndViewModeFrame) - wndFrameViewMode = NULL; - - mir_free(F->name); - mir_free(F->TitleBar.tbname); - mir_free(F->TitleBar.tooltip); - - DestroyWindow(F->hWnd); - F->hWnd = (HWND) - 1; - DestroyWindow(F->TitleBar.hwnd); - F->TitleBar.hwnd = (HWND) - 1; - DestroyWindow(F->ContainerWnd); - F->ContainerWnd = (HWND) - 1; - DestroyMenu(F->TitleBar.hmenu); - } - - RemoveItemFromList(pos, &Frames, &nFramescount); - - ulockfrm(); - if (!cfg::shutDown) { - InvalidateRect(pcli->hwndContactList, NULL, TRUE); - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); - } - return(0); -} - -INT_PTR CLUIFramesForceUpdateTB(const wndFrame *Frame) -{ - if (Frame->TitleBar.hwnd != 0) - RedrawWindow(Frame->TitleBar.hwnd, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); - return 0; -} - -INT_PTR CLUIFramesForceUpdateFrame(const wndFrame *Frame) -{ - if (Frame->hWnd != 0) - RedrawWindow(Frame->hWnd, NULL, NULL, RDW_UPDATENOW | RDW_FRAME | RDW_ERASE | RDW_INVALIDATE); - - if (Frame->floating) - if (Frame->ContainerWnd != 0) RedrawWindow(Frame->ContainerWnd, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); - return 0; -} - -int CLUIFrameMoveResize(const wndFrame *Frame) -{ - TitleBarH = cfg::dat.titleBarHeight; - // we need to show or hide the frame? - if (Frame->visible && (!Frame->needhide)) { - ShowWindow(Frame->hWnd, SW_SHOW); - ShowWindow(Frame->TitleBar.hwnd, Frame->TitleBar.ShowTitleBar == TRUE ? SW_SHOW : SW_HIDE); - } else { - ShowWindow(Frame->hWnd, SW_HIDE); - ShowWindow(Frame->TitleBar.hwnd, SW_HIDE); - return(0); - } - - SetWindowPos(Frame->hWnd, NULL, Frame->wndSize.left + cfg::dat.bCLeft, Frame->wndSize.top + cfg::dat.topOffset, - (Frame->wndSize.right - Frame->wndSize.left), - (Frame->wndSize.bottom - Frame->wndSize.top), SWP_NOZORDER | SWP_NOREDRAW); - if (Frame->TitleBar.ShowTitleBar) { - SetWindowPos(Frame->TitleBar.hwnd, NULL, Frame->wndSize.left + cfg::dat.bCLeft, Frame->wndSize.top + cfg::dat.topOffset - TitleBarH, - (Frame->wndSize.right - Frame->wndSize.left), - TitleBarH + (Frame->UseBorder ? (!Frame->collapsed ? (Frame->align == alClient ? 0 : 2) : 1) : 0), SWP_NOZORDER); - } - return 0; -} - -BOOLEAN CLUIFramesFitInSize(void) -{ - int i; - int sumheight = 0; - int tbh = 0; // title bar height - int clientfrm; - - TitleBarH = cfg::dat.titleBarHeight; - - clientfrm = CLUIFramesGetalClientFrame(); - if (clientfrm != -1) - tbh = TitleBarH * btoint(Frames[clientfrm].TitleBar.ShowTitleBar); - - for (i = 0;i < nFramescount;i++) { - if ((Frames[i].align != alClient) && (!Frames[i].floating) && (Frames[i].visible) && (!Frames[i].needhide)) { - sumheight += (Frames[i].height) + (TitleBarH * btoint(Frames[i].TitleBar.ShowTitleBar)) + 2/*+btoint(Frames[i].UseBorder)*2*/; - if (sumheight > ContactListHeight - tbh - 2) - return FALSE; - } - } - return TRUE; -} - -int CLUIFramesGetMinHeight() -{ - int i, tbh, clientfrm, sumheight = 0; - RECT border; - int allbord = 0; - - if (pcli->hwndContactList == NULL) - return 0; - - lockfrm(); - - TitleBarH = cfg::dat.titleBarHeight; - // search for alClient frame and get the titlebar's height - tbh = 0; - clientfrm = CLUIFramesGetalClientFrame(); - if (clientfrm != -1) - tbh = TitleBarH * btoint(Frames[clientfrm].TitleBar.ShowTitleBar); - - for (i = 0;i < nFramescount;i++) { - if ((Frames[i].align != alClient) && (Frames[i].visible) && (!Frames[i].needhide) && (!Frames[i].floating)) { - RECT wsize; - - GetWindowRect(Frames[i].hWnd, &wsize); - sumheight += (wsize.bottom - wsize.top) + (TitleBarH * btoint(Frames[i].TitleBar.ShowTitleBar)) + 3; - } - } - ulockfrm(); - GetBorderSize(pcli->hwndContactList, &border); - return(sumheight + border.top + border.bottom + allbord + tbh + 3); -} - -int SizeMoveNewSizes() -{ - int i; - for (i = 0;i < nFramescount;i++) { - - if (Frames[i].floating) { - CLUIFrameResizeFloatingFrame(i); - } else { - CLUIFrameMoveResize(&Frames[i]); - }; - } - return 0; -} - -/* - * changed Nightwish - * gap calculation was broken. Now, it doesn't calculate and store the gaps in Frames[] anymore. - * instead, it remembers the smallest wndSize.top value (which has to be the top frame) and then passes - * the gap to all following frame(s) to the actual resizing function which just adds the gap to - * wndSize.top and corrects the frame height accordingly. - - * Title bar gap has been removed (can be simulated by using a clist_nicer skin item for frame title bars - * and setting the bottom margin of the skin item - */ - -int CLUIFramesResize(const RECT newsize) -{ - int sumheight = 9999999, newheight; - int prevframe, prevframebottomline; - int tbh, curfrmtbh; - int drawitems; - int clientfrm, clientframe = -1; - int i, j; - int sepw; - int topOff = 0, botOff = 0, last_bottomtop;; - - GapBetweenFrames = cfg::dat.gapBetweenFrames; - sepw = GapBetweenFrames; - - if (nFramescount < 1 || cfg::shutDown) - return 0; - - newheight = newsize.bottom - newsize.top; - TitleBarH = cfg::dat.titleBarHeight; - - // search for alClient frame and get the titlebar's height - tbh = 0; - clientfrm = CLUIFramesGetalClientFrame(); - if (clientfrm != -1) - tbh = (TitleBarH) * btoint(Frames[clientfrm].TitleBar.ShowTitleBar); - - for (i = 0;i < nFramescount;i++) { - if (!Frames[i].floating) { - Frames[i].needhide = FALSE; - Frames[i].wndSize.left = 0; - Frames[i].wndSize.right = newsize.right - newsize.left; - } - } - { - //sorting stuff - memset(g_sd, 0, sizeof(SortData) * MAX_FRAMES); - for (i = 0;i < nFramescount;i++) { - g_sd[i].order = Frames[i].order; - g_sd[i].realpos = i; - } - qsort(g_sd, nFramescount, sizeof(SortData), sortfunc); - - } - drawitems = nFramescount; - while (sumheight > (newheight - tbh) && drawitems > 0) { - sumheight = 0; - drawitems = 0; - for (i = 0;i < nFramescount;i++) { - if (((Frames[i].align != alClient)) && (!Frames[i].floating) && (Frames[i].visible) && (!Frames[i].needhide)) { - drawitems++; - curfrmtbh = (TitleBarH) * btoint(Frames[i].TitleBar.ShowTitleBar); - sumheight += (Frames[i].height) + curfrmtbh + (i > 0 ? sepw : 0) + (Frames[i].UseBorder ? 2 : 0); - if (sumheight > newheight - tbh) { - sumheight -= (Frames[i].height) + curfrmtbh + (i > 0 ? sepw : 0); - Frames[i].needhide = TRUE; - drawitems--; - break; - } - } - } - } - - prevframe = -1; - prevframebottomline = 0; - for (j = 0;j < nFramescount;j++) { - //move all alTop frames - i = g_sd[j].realpos; - if ((!Frames[i].needhide) && (!Frames[i].floating) && (Frames[i].visible) && (Frames[i].align == alTop)) { - curfrmtbh = (TitleBarH) * btoint(Frames[i].TitleBar.ShowTitleBar); - Frames[i].wndSize.top = prevframebottomline + (prevframebottomline > 0 ? sepw : 0) + (curfrmtbh); - Frames[i].wndSize.bottom = Frames[i].height + Frames[i].wndSize.top + (Frames[i].UseBorder ? 2 : 0); - Frames[i].prevvisframe = prevframe; - prevframe = i; - prevframebottomline = Frames[i].wndSize.bottom; - topOff = prevframebottomline; - } - } - - if (sumheight < newheight) { - for (j = 0;j < nFramescount;j++) { - //move alClient frame - i = g_sd[j].realpos; - if ((!Frames[i].needhide) && (!Frames[i].floating) && (Frames[i].visible) && (Frames[i].align == alClient)) { - int oldh; - Frames[i].wndSize.top = prevframebottomline + (prevframebottomline > 0 ? sepw : 0) + (tbh); - Frames[i].wndSize.bottom = Frames[i].wndSize.top + newheight - sumheight - tbh - ((prevframebottomline > 0) ? sepw : 0); - clientframe = i; - oldh = Frames[i].height; - Frames[i].height = Frames[i].wndSize.bottom - Frames[i].wndSize.top; - Frames[i].prevvisframe = prevframe; - prevframe = i; - prevframebottomline = Frames[i].wndSize.bottom; - if (prevframebottomline > newheight) { - //prevframebottomline-=Frames[i].height+(tbh+1); - //Frames[i].needhide=TRUE; - } - break; - } - } - } - - //newheight - prevframebottomline = last_bottomtop = newheight; - //prevframe=-1; - for (j = nFramescount - 1;j >= 0;j--) { - //move all alBottom frames - i = g_sd[j].realpos; - if ((Frames[i].visible) && (!Frames[i].floating) && (!Frames[i].needhide) && (Frames[i].align == alBottom)) { - curfrmtbh = (TitleBarH) * btoint(Frames[i].TitleBar.ShowTitleBar); - Frames[i].wndSize.bottom = prevframebottomline - ((prevframebottomline < newheight) ? sepw : 0); - Frames[i].wndSize.top = Frames[i].wndSize.bottom - Frames[i].height - (Frames[i].UseBorder ? 2 : 0); - Frames[i].prevvisframe = prevframe; - prevframe = i; - prevframebottomline = Frames[i].wndSize.top - curfrmtbh; - botOff = prevframebottomline; - last_bottomtop = Frames[i].wndSize.top - curfrmtbh; - } - } - - // correct client frame bottom gap if there is no other top frame. - - if (clientframe != -1) { - Frames[clientframe].wndSize.bottom = last_bottomtop - (last_bottomtop < newheight ? sepw : 0); - Frames[clientframe].height = Frames[clientframe].wndSize.bottom - Frames[clientframe].wndSize.top; - } - return 0; -} - -INT_PTR CLUIFramesUpdateFrame(WPARAM wParam, LPARAM lParam) -{ - int pos; - if (FramesSysNotStarted) - return -1; - if (wParam == -1) { - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); - return 0; - } - if (lParam&FU_FMPOS) - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 1); - - lockfrm(); - pos = id2pos((INT_PTR)wParam); - if (pos < 0 || pos >= nFramescount) { - ulockfrm(); - return -1; - } - if (lParam&FU_TBREDRAW) - CLUIFramesForceUpdateTB(&Frames[pos]); - if (lParam&FU_FMREDRAW) - CLUIFramesForceUpdateFrame(&Frames[pos]); - ulockfrm(); - return 0; -} - -int dock_prevent_moving = 0; - -int CLUIFramesApplyNewSizes(int mode) -{ - int i; - dock_prevent_moving = 0; - for (i = 0;i < nFramescount;i++) { - if ((mode == 1 && Frames[i].OwnerWindow != (HWND) - 2 && Frames[i].OwnerWindow) || - (mode == 2 && Frames[i].OwnerWindow == (HWND) - 2) || - (mode == 3)) - if (Frames[i].floating) - CLUIFrameResizeFloatingFrame(i); - else - CLUIFrameMoveResize(&Frames[i]); - } - dock_prevent_moving = 1; - return 0; -} - -RECT old_window_rect = {0}, new_window_rect = {0}; - -int SizeFramesByWindowRect(RECT *r) -{ - RECT nRect; - DWORD noSize = 0; - - if (FramesSysNotStarted) - return -1; - - TitleBarH = cfg::dat.titleBarHeight; - lockfrm(); - GapBetweenFrames = cfg::dat.gapBetweenFrames; - - nRect = *r; - - nRect.bottom -= (cfg::dat.statusBarHeight + cfg::dat.bottomOffset); - nRect.right -= cfg::dat.bCRight; - nRect.left = cfg::dat.bCLeft; - nRect.top = cfg::dat.topOffset; - ContactListHeight = nRect.bottom - nRect.top; - - CLUIFramesResize(nRect); - { - int i; - for (i = 0;i < nFramescount;i++) { - int dx; - int dy; - dx = new_window_rect.left - old_window_rect.left; - dy = new_window_rect.top - old_window_rect.top; - if (!Frames[i].floating) { - if (Frames[i].OwnerWindow && Frames[i].OwnerWindow != (HWND) - 2) { - /* - if(Frames[i].wndSize.right - Frames[i].wndSize.left == Frames[i].oldWndSize.right - Frames[i].oldWndSize.left && - Frames[i].wndSize.bottom - Frames[i].wndSize.top == Frames[i].oldWndSize.bottom - Frames[i].oldWndSize.top) - noSize = SWP_NOSIZE; - else { - noSize = 0; - CopyRect(&Frames[i].oldWndSize, &Frames[i].wndSize); - }*/ - SetWindowPos(Frames[i].hWnd, NULL, Frames[i].wndSize.left + cfg::dat.bCLeft, Frames[i].wndSize.top + cfg::dat.topOffset, - (Frames[i].wndSize.right - Frames[i].wndSize.left), - (Frames[i].wndSize.bottom - Frames[i].wndSize.top), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS | noSize); - - if (Frames[i].TitleBar.ShowTitleBar) { - SetWindowPos(Frames[i].TitleBar.hwnd, NULL, Frames[i].wndSize.left + cfg::dat.bCLeft, Frames[i].wndSize.top + cfg::dat.topOffset - TitleBarH, - (Frames[i].wndSize.right - Frames[i].wndSize.left), - TitleBarH + (Frames[i].UseBorder ? (!Frames[i].collapsed ? (Frames[i].align == alClient ? 0 : 2) : 1) : 0), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS); - } - } else { - int res = 0; - // set frame position - SetWindowPos(Frames[i].hWnd, NULL, Frames[i].wndSize.left + cfg::dat.bCLeft, Frames[i].wndSize.top + cfg::dat.topOffset, - (Frames[i].wndSize.right - Frames[i].wndSize.left), - (Frames[i].wndSize.bottom - Frames[i].wndSize.top), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOREDRAW); - - // set titlebar position - if (Frames[i].TitleBar.ShowTitleBar) { - SetWindowPos(Frames[i].TitleBar.hwnd, NULL, Frames[i].wndSize.left + cfg::dat.bCLeft, Frames[i].wndSize.top + cfg::dat.topOffset - TitleBarH, - (Frames[i].wndSize.right - Frames[i].wndSize.left), - TitleBarH + (Frames[i].UseBorder ? (!Frames[i].collapsed ? (Frames[i].align == alClient ? 0 : 2) : 1) : 0), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOREDRAW); - } - //UpdateWindow(Frames[i].hWnd); - if (Frames[i].TitleBar.ShowTitleBar) - UpdateWindow(Frames[i].TitleBar.hwnd); - }; - } - - } - if (GetTickCount() - LastStoreTick > 1000) { - CLUIFramesStoreAllFrames(); - LastStoreTick = GetTickCount(); - } - } - ulockfrm(); - return 0; -} - -int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam) -{ - RECT nRect, rcStatus; - int tick; - GapBetweenFrames = cfg::dat.gapBetweenFrames; - - if (FramesSysNotStarted || cfg::shutDown) - return -1; - - lockfrm(); - - GetClientRect(pcli->hwndContactList, &nRect); - if (lParam && lParam != 1) { - 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; - } - - rcStatus.top = rcStatus.bottom = 0; - - nRect.bottom -= (cfg::dat.statusBarHeight + cfg::dat.bottomOffset); - nRect.right -= cfg::dat.bCRight; - nRect.left = cfg::dat.bCLeft; - nRect.top = cfg::dat.topOffset; - ContactListHeight = nRect.bottom - nRect.top; - - tick = GetTickCount(); - - CLUIFramesResize(nRect); - CLUIFramesApplyNewSizes(3); - - ulockfrm(); - tick = GetTickCount() - tick; - - if (pcli->hwndContactList != 0) - InvalidateRect(pcli->hwndContactList, NULL, TRUE); - if (pcli->hwndContactList != 0) - UpdateWindow(pcli->hwndContactList); - - Sleep(0); - - if (GetTickCount() - LastStoreTick > 2000) { - CLUIFramesStoreAllFrames(); - LastStoreTick = GetTickCount(); - } - return 0; -} - -static HBITMAP hBmpBackground; -static int backgroundBmpUse; -static COLORREF bkColour; -static COLORREF SelBkColour; -boolean AlignCOLLIconToLeft; //will hide frame icon - -int OnFrameTitleBarBackgroundChange() -{ - DBVARIANT dbv; - - AlignCOLLIconToLeft = cfg::getByte("FrameTitleBar", "AlignCOLLIconToLeft", 0); - - bkColour = cfg::getDword("FrameTitleBar", "BkColour", CLCDEFAULT_BKCOLOUR); - - if (hBmpBackground) { - DeleteObject(hBmpBackground); - hBmpBackground = NULL; - } - if (cfg::getByte("FrameTitleBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) { - if (!DBGetContactSetting(NULL, "FrameTitleBar", "BkBitmap", &dbv)) { - hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)dbv.pszVal); - mir_free(dbv.pszVal); - } - } - backgroundBmpUse = cfg::getWord("FrameTitleBar", "BkBmpUse", CLCDEFAULT_BKBMPUSE); - - CLUIFramesOnClistResize(0, 0); - return 0; -} - -static int DrawTitleBar(HDC dc, RECT rect, int Frameid) -{ - HDC hdcMem; - HBITMAP hBmpOsb, hoBmp; - HBRUSH hBack, hoBrush; - int pos; - StatusItems_t *item = &StatusItems[ID_EXTBKFRAMETITLE - ID_STATUS_OFFLINE]; - - /* - * no need to redraw anything while shutting down - */ - if (cfg::shutDown) - return 0; - - TitleBarH = cfg::dat.titleBarHeight; - hdcMem = CreateCompatibleDC(dc); - hBmpOsb = CreateCompatibleBitmap(dc, rect.right, rect.bottom); - hoBmp = reinterpret_cast(SelectObject(hdcMem, hBmpOsb)); - - SetBkMode(hdcMem, TRANSPARENT); - - hBack = GetSysColorBrush(COLOR_3DFACE); - hoBrush = reinterpret_cast(SelectObject(hdcMem, hBack)); - - lockfrm(); - pos = id2pos(Frameid); - - if (pos >= 0 && pos < nFramescount) { - HFONT oFont; - int fHeight, fontTop; - GetClientRect(Frames[pos].TitleBar.hwnd, &Frames[pos].TitleBar.wndSize); - - if (cfg::clcdat) { - oFont = ChangeToFont(hdcMem, cfg::clcdat, FONTID_FRAMETITLE, &fHeight); - } else { - oFont = reinterpret_cast(SelectObject(hdcMem, GetStockObject(DEFAULT_GUI_FONT))); - fHeight = 10; - } - fontTop = (TitleBarH - fHeight) / 2; - - if (cfg::dat.bWallpaperMode && !Frames[pos].floating) - SkinDrawBg(Frames[pos].TitleBar.hwnd, hdcMem); - - if (!item->IGNORED) { - RECT rc = Frames[pos].TitleBar.wndSize; - rc.top += item->MARGIN_TOP; - rc.bottom -= item->MARGIN_BOTTOM; - rc.left += item->MARGIN_LEFT; - rc.right -= item->MARGIN_RIGHT; - DrawAlpha(hdcMem, &rc, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT, - item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem); - SetTextColor(hdcMem, item->TEXTCOLOR); - } else if (cfg::clcdat) { - FillRect(hdcMem, &rect, hBack); - SetTextColor(hdcMem, cfg::clcdat->fontInfo[FONTID_FRAMETITLE].colour); - } else { - FillRect(hdcMem, &rect, hBack); - SetTextColor(hdcMem, GetSysColor(COLOR_BTNTEXT)); - } - - - if (!AlignCOLLIconToLeft) { - if (Frames[pos].TitleBar.hicon != NULL) { - DrawIconEx(hdcMem, 6 + cfg::dat.bClipBorder, ((TitleBarH >> 1) - 8), Frames[pos].TitleBar.hicon, 16, 16, 0, NULL, DI_NORMAL); - TextOut(hdcMem, 24 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, lstrlen(Frames[pos].TitleBar.tbname)); - } else - TextOut(hdcMem, 6 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, lstrlen(Frames[pos].TitleBar.tbname)); - } else - TextOut(hdcMem, 18 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, lstrlen(Frames[pos].TitleBar.tbname)); - - - if (!AlignCOLLIconToLeft) - DrawIconEx(hdcMem, Frames[pos].TitleBar.wndSize.right - 22, ((TitleBarH >> 1) - 8), Frames[pos].collapsed ? LoadSkinnedIcon(SKINICON_OTHER_GROUPOPEN) : LoadSkinnedIcon(SKINICON_OTHER_GROUPSHUT), 16, 16, 0, NULL, DI_NORMAL); - else - DrawIconEx(hdcMem, 0, ((TitleBarH >> 1) - 8), Frames[pos].collapsed ? LoadSkinnedIcon(SKINICON_OTHER_GROUPOPEN) : LoadSkinnedIcon(SKINICON_OTHER_GROUPSHUT), 16, 16, 0, NULL, DI_NORMAL); - SelectObject(hdcMem, oFont); - } - ulockfrm(); - BitBlt(dc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, hdcMem, rect.left, rect.top, SRCCOPY); - SelectObject(hdcMem, hoBmp); - SelectObject(hdcMem, hoBrush); - DeleteDC(hdcMem); - DeleteObject(hBack); - DeleteObject(hBmpOsb); - return 0; -} - -#define MPCF_CONTEXTFRAMEMENU 3 -POINT ptOld; -short nLeft = 0; -short nTop = 0; - -LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - RECT rect; - int Frameid, Framemod, direction; - int xpos, ypos; - - Frameid = GetWindowLongPtr(hwnd, GWLP_USERDATA); - memset(&rect, 0, sizeof(rect)); - - switch (msg) { - case WM_CREATE: - return FALSE; - case WM_MEASUREITEM: - return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam); - case WM_DRAWITEM: - return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam); - - case WM_ENABLE: - if (hwnd != 0) InvalidateRect(hwnd, NULL, FALSE); - return 0; - case WM_SIZE: - return 0; - /* - case WM_PRINT: - case WM_PRINTCLIENT: - InvalidateRect(hwnd,NULL,FALSE); - { - RECT rect; - HDC dc; - GetClientRect(hwnd,&rect); - //DrawTitleBar(wParam,rect,Frameid); - SendMessage(hwnd,WM_PAINT,0,0); - SendMessage(hwnd,WM_NCPAINT,1,0); - dc=GetDC(hwnd); - SendMessage(hwnd,WM_ERASEBKGND,dc,0); - ReleaseDC(hwnd,dc); - SendMessage(hwnd,WM_PAINT,0,0); - // UpdateWindow(hwnd); - return(0); - } - */ - /* - case WM_NCPAINT: - { - - // if(wParam==1) break; - { POINT ptTopLeft={0,0}; - HRGN hClientRgn; - ClientToScreen(hwnd,&ptTopLeft); - hClientRgn=CreateRectRgn(0,0,1,1); - CombineRgn(hClientRgn,(HRGN)wParam,NULL,RGN_COPY); - OffsetRgn(hClientRgn,-ptTopLeft.x,-ptTopLeft.y); - InvalidateRgn(hwnd,hClientRgn,FALSE); - DeleteObject(hClientRgn); - UpdateWindow(hwnd); - } - //return(0); - }; - */ - - - case WM_COMMAND: - if (ServiceExists(MO_CREATENEWMENUOBJECT)) { - if (ProcessCommandProxy(MAKEWPARAM(LOWORD(wParam), 0), (LPARAM)Frameid)) - break; - } else { - if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTEXTFRAMEMENU), (LPARAM)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: - Frames[framepos].Locked = !Frames[framepos].Locked; - break; - case frame_menu_visible: - Frames[framepos].visible = !Frames[framepos].visible; - break; - case frame_menu_showtitlebar: - Frames[framepos].TitleBar.ShowTitleBar = !Frames[framepos].TitleBar.ShowTitleBar; - break; - case frame_menu_floating: - CLUIFrameSetFloat(Frameid, 0); - break; - } - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)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 { - int framepos = id2pos(Frameid); - - lockfrm(); - if (framepos == -1) { - ulockfrm(); - break; - } - hmenu = CreatePopupMenu(); - AppendMenu(hmenu, MF_STRING | MF_DISABLED | MF_GRAYED, 15, Frames[framepos].name); - AppendMenu(hmenu, MF_SEPARATOR, 16, _T("")); - - if (Frames[framepos].Locked) - AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_lock, TranslateT("Lock Frame")); - else - AppendMenu(hmenu, MF_STRING, frame_menu_lock, TranslateT("Lock Frame")); - - if (Frames[framepos].visible) - AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_visible, TranslateT("Visible")); - else - AppendMenu(hmenu, MF_STRING, frame_menu_visible, TranslateT("Visible")); - - if (Frames[framepos].TitleBar.ShowTitleBar) - AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_showtitlebar, TranslateT("Show TitleBar")); - else - AppendMenu(hmenu, MF_STRING, frame_menu_showtitlebar, TranslateT("Show TitleBar")); - - if (Frames[framepos].Skinned) - AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_skinned, TranslateT("Skinned frame")); - else - AppendMenu(hmenu, MF_STRING, frame_menu_skinned, TranslateT("Skinned frame")); - - if (Frames[framepos].floating) - AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_floating, TranslateT("Floating")); - else - AppendMenu(hmenu, MF_STRING, frame_menu_floating, TranslateT("Floating")); - - ulockfrm(); - } - TrackPopupMenu(hmenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, 0); - DestroyMenu(hmenu); - } - break; - case WM_LBUTTONDBLCLK: { - Framemod = -1; - lbypos = -1; - oldframeheight = -1; - ReleaseCapture(); - CallService(MS_CLIST_FRAMES_UCOLLFRAME, Frameid, 0); - lbypos = -1; - oldframeheight = -1; - ReleaseCapture(); - } - break; - - case WM_LBUTTONUP: { - if (GetCapture() != hwnd) { - break; - }; - curdragbar = -1; - lbypos = -1; - oldframeheight = -1; - ReleaseCapture(); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); - break; - }; - case WM_LBUTTONDOWN: { - - int framepos = id2pos(Frameid); - lockfrm(); - if (framepos == -1) { - ulockfrm(); - break; - } - if (Frames[framepos].floating) { - - POINT pt; - GetCursorPos(&pt); - Frames[framepos].TitleBar.oldpos = pt; - } - - if ((!(wParam&MK_CONTROL)) && Frames[framepos].Locked && (!(Frames[framepos].floating))) { - if (cfg::getByte("CLUI", "ClientAreaDrag", 0)) { - POINT pt; - GetCursorPos(&pt); - ulockfrm(); - return SendMessage(GetParent(hwnd), WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y)); - } - } - if (Frames[framepos].floating) { - RECT rc; - GetCursorPos(&ptOld); - GetWindowRect(hwnd, &rc); - nLeft = (short)rc.left; - nTop = (short)rc.top; - } - ulockfrm(); - SetCapture(hwnd); - break; - } - case WM_MOUSEMOVE: { - POINT pt, pt2; - RECT wndr; - int pos; - { - char TBcapt[255]; - - lockfrm(); - pos = id2pos(Frameid); - - if (pos != -1) { - int oldflags; - wsprintfA(TBcapt, "%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d", - Frames[pos].name, Frames[pos].height, Frames[pos].visible, Frames[pos].floating, - Frames[pos].FloatingPos.x, Frames[pos].FloatingPos.y, - Frames[pos].FloatingSize.x, Frames[pos].FloatingSize.y, - Frames[pos].order - ); - - oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, Frames[pos].id), (LPARAM)0); - if (!(oldflags&F_SHOWTBTIP)) - oldflags |= F_SHOWTBTIP; - } - ulockfrm(); - } - if ((wParam&MK_LBUTTON)/*&&(wParam&MK_CONTROL)*/) { - RECT rcMiranda; - RECT rcwnd, rcOverlap; - POINT newpt, ofspt, curpt, newpos; - - lockfrm(); - - pos = id2pos(Frameid); - if (Frames[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); - if (IsWindowVisible(pcli->hwndContactList) && IntersectRect(&rcOverlap, &rcwnd, &rcMiranda)) { - int id = Frames[pos].id; - - ulockfrm(); - ofspt.x = 0; - ofspt.y = 0; - ClientToScreen(Frames[pos].TitleBar.hwnd, &ofspt); - ofspt.x = curpt.x - ofspt.x; - ofspt.y = curpt.y - ofspt.y; - - CLUIFrameSetFloat(id, 0); - newpt.x = 0; - newpt.y = 0; - ClientToScreen(Frames[pos].TitleBar.hwnd, &newpt); - SetCursorPos(newpt.x + ofspt.x, newpt.y + ofspt.y); - GetCursorPos(&curpt); - lockfrm(); - Frames[pos].TitleBar.oldpos = curpt; - ulockfrm(); - return(0); - } - } else { - int id = Frames[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); - - if (!IntersectRect(&rcOverlap, &rcwnd, &rcMiranda)) { - ulockfrm(); - GetCursorPos(&curpt); - GetWindowRect(Frames[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; - GetWindowRect(Frames[pos].TitleBar.hwnd, &rcwnd); - ofspt.x = curpt.x - ofspt.x; - ofspt.y = curpt.y - ofspt.y; - Frames[pos].FloatingPos.x = newpos.x; - Frames[pos].FloatingPos.y = newpos.y; - CLUIFrameSetFloat(id, 0); - lockfrm(); - newpt.x = 0; - newpt.y = 0; - ClientToScreen(Frames[pos].TitleBar.hwnd, &newpt); - GetWindowRect(Frames[pos].hWnd, &rcwnd); - SetCursorPos(newpt.x + (rcwnd.right - rcwnd.left) / 2, newpt.y + (rcwnd.bottom - rcwnd.top) / 2); - GetCursorPos(&curpt); - Frames[pos].TitleBar.oldpos = curpt; - ulockfrm(); - return(0); - } - } - ulockfrm(); - } - if (wParam&MK_LBUTTON) { - int newh = -1, prevold; - - if (GetCapture() != hwnd) - break; - - lockfrm(); - pos = id2pos(Frameid); - - if (Frames[pos].floating) { - GetCursorPos(&pt); - if ((Frames[pos].TitleBar.oldpos.x != pt.x) || (Frames[pos].TitleBar.oldpos.y != pt.y)) { - - pt2 = pt; - ScreenToClient(hwnd, &pt2); - GetWindowRect(Frames[pos].ContainerWnd, &wndr); - { - int dX, dY; - POINT ptNew; - - ptNew.x = pt.x; - ptNew.y = pt.y; - - dX = ptNew.x - ptOld.x; - dY = ptNew.y - ptOld.y; - - nLeft += (short)dX; - nTop += (short)dY; - - if (!(wParam&MK_CONTROL)) { - PositionThumb(&Frames[pos], nLeft, nTop); - } else { - - SetWindowPos(Frames[pos].ContainerWnd, - 0, - nLeft, - nTop, - 0, - 0, - SWP_NOSIZE | SWP_NOZORDER); - } - ptOld = ptNew; - } - pt.x = nLeft; - pt.y = nTop; - Frames[pos].TitleBar.oldpos = pt; - } - ulockfrm(); - return(0); - } - if (Frames[pos].prevvisframe != -1) { - GetCursorPos(&pt); - - if ((Frames[pos].TitleBar.oldpos.x == pt.x) && (Frames[pos].TitleBar.oldpos.y == pt.y)) { - ulockfrm(); - break; - } - - ypos = rect.top + pt.y; - xpos = rect.left + pt.x; - Framemod = -1; - - if (Frames[pos].align == alBottom) { - direction = -1; - Framemod = pos; - } else { - direction = 1; - Framemod = Frames[pos].prevvisframe; - } - if (Frames[Framemod].Locked) { - ulockfrm(); - break; - } - if (curdragbar != -1 && curdragbar != pos) { - ulockfrm(); - break; - } - - if (lbypos == -1) { - curdragbar = pos; - lbypos = ypos; - oldframeheight = Frames[Framemod].height; - SetCapture(hwnd); - ulockfrm(); - break;; - } - newh = oldframeheight + direction * (ypos - lbypos); - if (newh > 0) { - prevold = Frames[Framemod].height; - Frames[Framemod].height = newh; - if (!CLUIFramesFitInSize()) { - Frames[Framemod].height = prevold; - ulockfrm(); - return TRUE; - } - Frames[Framemod].height = newh; - if (newh > 3) Frames[Framemod].collapsed = TRUE; - - } - Frames[pos].TitleBar.oldpos = pt; - } - ulockfrm(); - if (newh > 0) { - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); - } - break; - } - curdragbar = -1; - lbypos = -1; - oldframeheight = -1; - ReleaseCapture(); - } - break; - case WM_NCPAINT: { - if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_BORDER) { - HDC hdc = GetWindowDC(hwnd); - HPEN hPenOld = reinterpret_cast(SelectObject(hdc, g_hPenCLUIFrames)); - RECT rcWindow, rc; - HBRUSH brold; - - CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam); - GetWindowRect(hwnd, &rcWindow); - rc.left = rc.top = 0; - rc.right = rcWindow.right - rcWindow.left; - rc.bottom = rcWindow.bottom - rcWindow.top; - brold = reinterpret_cast(SelectObject(hdc, GetStockObject(HOLLOW_BRUSH))); - Rectangle(hdc, 0, 0, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top); - SelectObject(hdc, hPenOld); - SelectObject(hdc, brold); - ReleaseDC(hwnd, hdc); - return 0; - } - break; - } - case WM_PRINT: - case WM_PRINTCLIENT: { - GetClientRect(hwnd, &rect); - DrawTitleBar((HDC)wParam, rect, Frameid); - } - case WM_PAINT: { - HDC paintDC; - PAINTSTRUCT paintStruct; - - paintDC = BeginPaint(hwnd, &paintStruct); - rect = paintStruct.rcPaint; - DrawTitleBar(paintDC, rect, Frameid); - EndPaint(hwnd, &paintStruct); - return 0; - } - default: - return DefWindowProc(hwnd, msg, wParam, lParam); - } - return TRUE; -} -int CLUIFrameResizeFloatingFrame(int framepos) -{ - - int width, height, floatingHeight; - RECT rect; - - if (!Frames[framepos].floating) - return(0); - if (Frames[framepos].ContainerWnd == 0) - return(0); - GetClientRect(Frames[framepos].ContainerWnd, &rect); - - width = rect.right - rect.left; - height = rect.bottom - rect.top; - floatingHeight = cfg::dat.titleBarHeight; - - if(floatingHeight <= 0 || floatingHeight > 50) - floatingHeight = 18; - - Frames[framepos].visible ? ShowWindow(Frames[framepos].ContainerWnd, SW_SHOWNOACTIVATE) : ShowWindow(Frames[framepos].ContainerWnd, SW_HIDE); - - if (Frames[framepos].TitleBar.ShowTitleBar) { - ShowWindow(Frames[framepos].TitleBar.hwnd, SW_SHOWNOACTIVATE); - Frames[framepos].height = height - floatingHeight; - SetWindowPos(Frames[framepos].TitleBar.hwnd, HWND_TOP, 0, 0, width, floatingHeight, SWP_SHOWWINDOW | SWP_DRAWFRAME | SWP_NOACTIVATE); - InvalidateRect(Frames[framepos].TitleBar.hwnd, NULL, FALSE); - SetWindowPos(Frames[framepos].hWnd, HWND_TOP, 0, floatingHeight, width, height - floatingHeight, SWP_SHOWWINDOW | SWP_NOACTIVATE); - - } else { - Frames[framepos].height = height; - ShowWindow(Frames[framepos].TitleBar.hwnd, SW_HIDE); - SetWindowPos(Frames[framepos].hWnd, HWND_TOP, 0, 0, width, height, SWP_SHOWWINDOW | SWP_NOACTIVATE); - } - - if (Frames[framepos].ContainerWnd != 0) - UpdateWindow(Frames[framepos].ContainerWnd); - GetWindowRect(Frames[framepos].hWnd, &Frames[framepos].wndSize); - - if (Frames[framepos].TitleBar.ShowTitleBar) - RedrawWindow(Frames[framepos].TitleBar.hwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); - RedrawWindow(Frames[framepos].hWnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); - - return(0); -} - -static int CLUIFrameOnMainMenuBuild(WPARAM wParam, LPARAM lParam) -{ - CLUIFramesLoadMainMenu(); - return 0; -} - -LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - - RECT rect; - INT_PTR Frameid = GetWindowLongPtr(hwnd, GWLP_USERDATA); - memset(&rect, 0, sizeof(rect)); - switch (msg) { - case WM_CREATE: { - int framepos; - lockfrm(); - framepos = id2pos(Frameid); - ulockfrm(); - return(0); - } - case WM_GETMINMAXINFO: { - int framepos; - MINMAXINFO minmax; - - TitleBarH = cfg::dat.titleBarHeight; - lockfrm(); - - framepos = id2pos(Frameid); - if (framepos < 0 || framepos >= nFramescount) { - ulockfrm(); - break; - } - if (!Frames[framepos].minmaxenabled) { - ulockfrm(); - break; - } - if (Frames[framepos].ContainerWnd == 0) { - ulockfrm(); - break; - } - if (Frames[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; - } - - memset(&minmax, 0, sizeof(minmax)); - if (SendMessage(Frames[framepos].hWnd, WM_GETMINMAXINFO, (WPARAM)0, (LPARAM)&minmax) == 0) { - RECT border; - int tbh = TitleBarH * btoint(Frames[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 { - ulockfrm(); - return(DefWindowProc(hwnd, msg, wParam, lParam)); - } - ulockfrm(); - } - case WM_MOVE: { - int framepos; - RECT rect; - - lockfrm(); - framepos = id2pos(Frameid); - - if (framepos < 0 || framepos >= nFramescount) { - ulockfrm(); - break; - } - if (Frames[framepos].ContainerWnd == 0) { - ulockfrm(); - return(0); - } - GetWindowRect(Frames[framepos].ContainerWnd, &rect); - Frames[framepos].FloatingPos.x = rect.left; - Frames[framepos].FloatingPos.y = rect.top; - Frames[framepos].FloatingSize.x = rect.right - rect.left; - Frames[framepos].FloatingSize.y = rect.bottom - rect.top; - CLUIFramesStoreFrameSettings(framepos); - ulockfrm(); - return(0); - } - case WM_SIZE: { - int framepos; - RECT rect; - lockfrm(); - - framepos = id2pos(Frameid); - - if (framepos < 0 || framepos >= nFramescount) { - ulockfrm(); - break; - } - if (Frames[framepos].ContainerWnd == 0) { - ulockfrm(); - return(0); - } - CLUIFrameResizeFloatingFrame(framepos); - - GetWindowRect(Frames[framepos].ContainerWnd, &rect); - Frames[framepos].FloatingPos.x = rect.left; - Frames[framepos].FloatingPos.y = rect.top; - Frames[framepos].FloatingSize.x = rect.right - rect.left; - Frames[framepos].FloatingSize.y = rect.bottom - rect.top; - - CLUIFramesStoreFrameSettings(framepos); - ulockfrm(); - return(0); - } - 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(CreateWindowA("FramesContainer", "aaaa", WS_POPUP | WS_THICKFRAME, x, y, width, height, parent, 0, g_hInst, 0)); -} - - -INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam) -{ - HWND hwndtmp, hwndtooltiptmp; - - lockfrm(); - wParam = id2pos((INT_PTR)wParam); - if (wParam >= 0 && (int)wParam < nFramescount) - if (Frames[wParam].floating) { - SetParent(Frames[wParam].hWnd, pcli->hwndContactList); - SetParent(Frames[wParam].TitleBar.hwnd, pcli->hwndContactList); - Frames[wParam].floating = FALSE; - DestroyWindow(Frames[wParam].ContainerWnd); - Frames[wParam].ContainerWnd = 0; - } else { - RECT recttb, rectw, border; - int temp; - int neww, newh; - BOOLEAN locked; - - Frames[wParam].oldstyles = GetWindowLongPtr(Frames[wParam].hWnd, GWL_STYLE); - Frames[wParam].TitleBar.oldstyles = GetWindowLongPtr(Frames[wParam].TitleBar.hwnd, GWL_STYLE); - locked = Frames[wParam].Locked; - Frames[wParam].Locked = FALSE; - Frames[wParam].minmaxenabled = FALSE; - - GetWindowRect(Frames[wParam].hWnd, &rectw); - GetWindowRect(Frames[wParam].TitleBar.hwnd, &recttb); - if (!Frames[wParam].TitleBar.ShowTitleBar) { - recttb.top = recttb.bottom = recttb.left = recttb.right = 0; - } - Frames[wParam].ContainerWnd = CreateContainerWindow(pcli->hwndContactList, Frames[wParam].FloatingPos.x, Frames[wParam].FloatingPos.y, 10, 10); - - SetParent(Frames[wParam].hWnd, Frames[wParam].ContainerWnd); - SetParent(Frames[wParam].TitleBar.hwnd, Frames[wParam].ContainerWnd); - - GetBorderSize(Frames[wParam].ContainerWnd, &border); - - SetWindowLongPtr(Frames[wParam].ContainerWnd, GWLP_USERDATA, Frames[wParam].id); - if ((lParam == 1)) { - if ((Frames[wParam].FloatingPos.x != 0) && (Frames[wParam].FloatingPos.y != 0)) { - if (Frames[wParam].FloatingPos.x < 20) { - Frames[wParam].FloatingPos.x = 40; - } - if (Frames[wParam].FloatingPos.y < 20) { - Frames[wParam].FloatingPos.y = 40; - } - SetWindowPos(Frames[wParam].ContainerWnd, HWND_TOPMOST, Frames[wParam].FloatingPos.x, Frames[wParam].FloatingPos.y, Frames[wParam].FloatingSize.x, Frames[wParam].FloatingSize.y, SWP_HIDEWINDOW); - } else { - SetWindowPos(Frames[wParam].ContainerWnd, HWND_TOPMOST, 120, 120, 140, 140, SWP_HIDEWINDOW); - } - } else { - 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 (Frames[wParam].FloatingPos.x < 20) { - Frames[wParam].FloatingPos.x = 40; - } - if (Frames[wParam].FloatingPos.y < 20) { - Frames[wParam].FloatingPos.y = 40; - } - SetWindowPos(Frames[wParam].ContainerWnd, HWND_TOPMOST, Frames[wParam].FloatingPos.x, Frames[wParam].FloatingPos.y, neww, newh, SWP_HIDEWINDOW); - } - SetWindowText(Frames[wParam].ContainerWnd, Frames[wParam].TitleBar.tbname); - temp = GetWindowLongPtr(Frames[wParam].ContainerWnd, GWL_EXSTYLE); - temp |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST ; - SetWindowLongPtr(Frames[wParam].ContainerWnd, GWL_EXSTYLE, temp); - Frames[wParam].floating = TRUE; - Frames[wParam].Locked = locked; - - } - CLUIFramesStoreFrameSettings(wParam); - Frames[wParam].minmaxenabled = TRUE; - hwndtooltiptmp = Frames[wParam].TitleBar.hwndTip; - - hwndtmp = Frames[wParam].ContainerWnd; - ulockfrm(); - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); - SendMessage(hwndtmp, WM_SIZE, 0, 0); - SetWindowPos(hwndtooltiptmp, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - return 0; -} - -TCHAR g_ptszEventName[100]; - -static int CLUIFrameOnModulesLoad(WPARAM wParam, LPARAM lParam) -{ - mir_sntprintf(g_ptszEventName, SIZEOF(g_ptszEventName), _T("mf_update_evt_%d"), GetCurrentThreadId()); - g_hEventThread = CreateEvent(NULL, TRUE, FALSE, g_ptszEventName); - hThreadMFUpdate = (HANDLE)mir_forkthreadex(reinterpret_cast(MF_UpdateThread), NULL, NULL); - SetThreadPriority(hThreadMFUpdate, THREAD_PRIORITY_IDLE); - CLUIFramesLoadMainMenu(); - CLUIFramesCreateMenuForFrame(-1, -1, 000010000, Menu_AddContextFrameMenuItem); - return 0; -} - -static int CLUIFrameOnModulesUnload(WPARAM wParam, LPARAM lParam) -{ - mf_updatethread_running = FALSE; - - SetThreadPriority(hThreadMFUpdate, THREAD_PRIORITY_NORMAL); - SetEvent(g_hEventThread); - WaitForSingleObject(hThreadMFUpdate, 2000); - CloseHandle(hThreadMFUpdate); - CloseHandle(g_hEventThread); - - CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMIVisible, 0); - CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMITitle, 0); - CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMITBVisible, 0); - CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMILock, 0); - CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMIColl, 0); - CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMIFloating, 0); - CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMIAlignRoot, 0); - CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMIAlignTop, 0); - CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMIAlignClient, 0); - CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMIAlignBottom, 0); - CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMIBorder, 0); - return 0; -} - -static INT_PTR SetIconForExtraColumn(WPARAM wParam, LPARAM lParam) -{ - pIconExtraColumn piec; - - if (pcli->hwndContactTree == 0) - return -1; - - if (wParam == 0 || lParam == 0 || IsBadCodePtr((FARPROC)lParam)) - return -1; - - piec = (pIconExtraColumn)lParam; - - if (piec->cbSize != sizeof(IconExtraColumn)) - return -1; - - if (cfg::dat.bMetaAvail && cfg::dat.bMetaEnabled && cfg::getByte((HANDLE)wParam, cfg::dat.szMetaName, "IsSubcontact", 0)) - PostMessage(pcli->hwndContactTree, CLM_SETEXTRAIMAGEINTMETA, wParam, MAKELONG((WORD)piec->ColumnType, (WORD)piec->hImage)); - else - PostMessage(pcli->hwndContactTree, CLM_SETEXTRAIMAGEINT, wParam, MAKELONG((WORD)piec->ColumnType, (WORD)piec->hImage)); - return 0; -} - -/* - * wparam=hIcon - * return hImage on success,-1 on failure - */ -static INT_PTR AddIconToExtraImageList(WPARAM wParam, LPARAM lParam) -{ - if (himlExtraImages == 0 || wParam == 0) - return -1; - - return((int)ImageList_AddIcon(himlExtraImages, (HICON)wParam)); -} - -/* -static INT_PTR SkinDrawBgService(WPARAM wParam, LPARAM lParam) -{ - StatusItems_t item; - HWND hwnd; - RECT rc; - - SKINDRAWREQUEST *sdrq = (SKINDRAWREQUEST *)wParam; - - if(wParam == 0 || IsBadCodePtr((FARPROC)wParam) || pDrawAlpha == NULL) - return 0; - - hwnd = WindowFromDC(sdrq->hDC); - GetClientRect(hwnd, &rc); - if(strstr(sdrq->szObjectID, "/Background") && EqualRect(&sdrq->rcClipRect, &sdrq->rcDestRect)) { - SkinDrawBg(hwnd, sdrq->hDC); - GetItemByStatus(ID_EXTBKEVTAREA, &item); - if(item.IGNORED) - FillRect(sdrq->hDC, &(sdrq->rcClipRect), GetSysColorBrush(COLOR_3DFACE)); - else { - DrawAlpha(sdrq->hDC, &(sdrq->rcClipRect), item.COLOR, item.ALPHA, item.COLOR2, item.COLOR2_TRANSPARENT, - item.GRADIENT, item.CORNER, item.BORDERSTYLE, item.imageItem); - } - } - else { - GetItemByStatus(ID_EXTBKEVTAREA, &item); - if(item.IGNORED) - FillRect(sdrq->hDC, &(sdrq->rcClipRect), GetSysColorBrush(COLOR_3DFACE)); - else { - DrawAlpha(sdrq->hDC, &(sdrq->rcClipRect), item.COLOR, item.ALPHA, item.COLOR2, item.COLOR2_TRANSPARENT, - item.GRADIENT, item.CORNER, item.BORDERSTYLE, item.imageItem); - } - } -} -*/ - -void RegisterCLUIFrameClasses() -{ - WNDCLASS wndclass; - WNDCLASS cntclass; - - wndclass.style = CS_DBLCLKS;//|CS_HREDRAW|CS_VREDRAW ; - wndclass.lpfnWndProc = CLUIFrameTitleBarProc; - wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = 0; - wndclass.hInstance = g_hInst; - wndclass.hIcon = NULL; - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); - wndclass.hbrBackground = NULL; - wndclass.lpszMenuName = NULL; - wndclass.lpszClassName = CLUIFrameTitleBarClassName; - RegisterClass(&wndclass); - - cntclass.style = CS_DBLCLKS/*|CS_HREDRAW|CS_VREDRAW*/ | (IsWinVerXPPlus() ? CS_DROPSHADOW : 0); - cntclass.lpfnWndProc = CLUIFrameContainerWndProc; - cntclass.cbClsExtra = 0; - cntclass.cbWndExtra = 0; - cntclass.hInstance = g_hInst; - cntclass.hIcon = NULL; - cntclass.hCursor = LoadCursor(NULL, IDC_ARROW); - cntclass.hbrBackground = NULL; - cntclass.lpszMenuName = NULL; - cntclass.lpszClassName = _T("FramesContainer"); - RegisterClass(&cntclass); -} - -int LoadCLUIFramesModule(void) -{ - GapBetweenFrames = cfg::dat.gapBetweenFrames; - - nFramescount = 0; - InitializeCriticalSection(&csFrameHook); - InitFramesMenus(); - - HookEvent(ME_SYSTEM_MODULESLOADED, CLUIFrameOnModulesLoad); - HookEvent(ME_CLIST_PREBUILDFRAMEMENU, CLUIFramesModifyContextMenuForFrame); - HookEvent(ME_CLIST_PREBUILDMAINMENU, CLUIFrameOnMainMenuBuild); - HookEvent(ME_SYSTEM_PRESHUTDOWN, CLUIFrameOnModulesUnload); - - CreateServiceFunction(MS_CLIST_FRAMES_ADDFRAME, CLUIFramesAddFrame); - CreateServiceFunction(MS_CLIST_FRAMES_REMOVEFRAME, CLUIFramesRemoveFrame); - - CreateServiceFunction(MS_CLIST_FRAMES_SETFRAMEOPTIONS, CLUIFramesSetFrameOptions); - CreateServiceFunction(MS_CLIST_FRAMES_GETFRAMEOPTIONS, CLUIFramesGetFrameOptions); - CreateServiceFunction(MS_CLIST_FRAMES_UPDATEFRAME, CLUIFramesUpdateFrame); - - CreateServiceFunction(MS_CLIST_FRAMES_SHFRAMETITLEBAR, CLUIFramesShowHideFrameTitleBar); - CreateServiceFunction(MS_CLIST_FRAMES_SHOWALLFRAMESTB, CLUIFramesShowAllTitleBars); - CreateServiceFunction(MS_CLIST_FRAMES_HIDEALLFRAMESTB, CLUIFramesHideAllTitleBars); - CreateServiceFunction(MS_CLIST_FRAMES_SHFRAME, CLUIFramesShowHideFrame); - CreateServiceFunction(MS_CLIST_FRAMES_SHOWALLFRAMES, CLUIFramesShowAll); - - CreateServiceFunction(MS_CLIST_FRAMES_ULFRAME, CLUIFramesLockUnlockFrame); - CreateServiceFunction(MS_CLIST_FRAMES_UCOLLFRAME, CLUIFramesCollapseUnCollapseFrame); - CreateServiceFunction(MS_CLIST_FRAMES_SETUNBORDER, CLUIFramesSetUnSetBorder); - CreateServiceFunction(MS_CLIST_FRAMES_SETSKINNED, CLUIFramesSetUnSetSkinned); - - CreateServiceFunction(CLUIFRAMESSETALIGN, CLUIFramesSetAlign); - CreateServiceFunction(CLUIFRAMESMOVEDOWN, CLUIFramesMoveDown); - CreateServiceFunction(CLUIFRAMESMOVEUP, CLUIFramesMoveUp); - - CreateServiceFunction(CLUIFRAMESSETALIGNALTOP, CLUIFramesSetAlignalTop); - CreateServiceFunction(CLUIFRAMESSETALIGNALCLIENT, CLUIFramesSetAlignalClient); - CreateServiceFunction(CLUIFRAMESSETALIGNALBOTTOM, CLUIFramesSetAlignalBottom); - - CreateServiceFunction("Set_Floating", CLUIFrameSetFloat); - hWndExplorerToolBar = FindWindowExA(0, 0, "Shell_TrayWnd", NULL); - OnFrameTitleBarBackgroundChange(); - - FramesSysNotStarted = FALSE; - g_hPenCLUIFrames = CreatePen(PS_SOLID, 1, cfg::getDword("CLUI", "clr_frameborder", GetSysColor(COLOR_3DDKSHADOW))); - return 0; -} - -void LoadExtraIconModule() -{ - CreateServiceFunction(MS_CLIST_EXTRA_SET_ICON, SetIconForExtraColumn); - CreateServiceFunction(MS_CLIST_EXTRA_ADD_ICON, AddIconToExtraImageList); - - hExtraImageListRebuilding = CreateHookableEvent(ME_CLIST_EXTRA_LIST_REBUILD); - hExtraImageApplying = CreateHookableEvent(ME_CLIST_EXTRA_IMAGE_APPLY); - - hStatusBarShowToolTipEvent = CreateHookableEvent(ME_CLIST_FRAMES_SB_SHOW_TOOLTIP); - hStatusBarHideToolTipEvent = CreateHookableEvent(ME_CLIST_FRAMES_SB_HIDE_TOOLTIP); -} - -int UnLoadCLUIFramesModule(void) -{ - int i; - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - CLUIFramesStoreAllFrames(); - DeleteObject(g_hPenCLUIFrames); - EnterCriticalSection(&csFrameHook); - FramesSysNotStarted = TRUE; - for (i = 0;i < nFramescount;i++) { - DestroyWindow(Frames[i].hWnd); - Frames[i].hWnd = (HWND) - 1; - DestroyWindow(Frames[i].TitleBar.hwnd); - Frames[i].TitleBar.hwnd = (HWND) - 1; - DestroyWindow(Frames[i].ContainerWnd); - Frames[i].ContainerWnd = (HWND) - 1; - DestroyMenu(Frames[i].TitleBar.hmenu); - - if (Frames[i].name != NULL) - mir_free(Frames[i].name); - if (Frames[i].TitleBar.tbname != NULL) - mir_free(Frames[i].TitleBar.tbname); - } - if (Frames) - free(Frames); - Frames = NULL; - nFramescount = 0; - UnregisterClass(CLUIFrameTitleBarClassName, g_hInst); - LeaveCriticalSection(&csFrameHook); - DeleteCriticalSection(&csFrameHook); - UnitFramesMenu(); - return 0; -} - -void ReloadExtraIcons() -{ - NotifyEventHooks(hExtraImageListRebuilding, 0, 0); -} diff --git a/plugins/Clist_nicer/CLUIFrames/cluiframes.h b/plugins/Clist_nicer/CLUIFrames/cluiframes.h deleted file mode 100644 index 083066ca6d..0000000000 --- a/plugins/Clist_nicer/CLUIFrames/cluiframes.h +++ /dev/null @@ -1,105 +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. -*/ - -int LoadCLUIFramesModule(void); -int UnLoadCLUIFramesModule(void); -int CLUIFramesGetMinHeight(); -int CLUIFramesOnClistResize(WPARAM wParam,LPARAM lParam); -int SizeFramesByWindowRect(RECT *r); -int CLUIFramesResizeFrames(RECT *rc); - -typedef struct tagProtocolData { - char *RealName; - int statusbarpos; - boolean show; -} ProtocolData; - -#define OFFSET_PROTOPOS 200 -#define OFFSET_VISIBLE 400 - -#define CLUIFrameTitleBarClassName _T("CLUIFrameTitleBar") -#define CLUIFrameModule "CLUIFrames" - -//integrated menu module -#define MS_INT_MENUMEASUREITEM "CLUIFrames/IntMenuMeasureItem" -#define MS_INT_MENUDRAWITEM "CLUIFrames/IntMenuDrawItem" -#define MS_INT_MENUPROCESSCOMMAND "CLUIFrames/IntMenuProcessCommand" -#define MS_INT_MODIFYMENUITEM "CLUIFrames/IntModifyMenuItem" - -typedef struct _DockOpt { - HWND hwndLeft; - HWND hwndRight; -} -DockOpt; - -typedef struct tagMenuHandles { - HANDLE MainMenuItem; - HANDLE MIVisible,MITitle,MITBVisible,MILock,MIColl,MIFloating,MIAlignRoot; - HANDLE MIAlignTop,MIAlignClient,MIAlignBottom; - HANDLE MIBorder, MISkinned; -} FrameMenuHandles; - -typedef struct tagFrameTitleBar { - HWND hwnd; - HWND TitleBarbutt; - HWND hwndTip; - - LPTSTR tbname; - LPTSTR tooltip; - HMENU hmenu; - HICON hicon; - - BOOLEAN ShowTitleBar; - BOOLEAN ShowTitleBarTip; - int oldstyles; - POINT oldpos; - RECT wndSize; -} FrameTitleBar; - -typedef struct { - int id; - HWND hWnd ; - RECT wndSize; - RECT oldWndSize; - LPTSTR name; - int align; - int height; - int dwFlags; - BOOLEAN Locked; - BOOLEAN Skinned; - BOOLEAN visible; - BOOLEAN needhide; - BOOLEAN collapsed; - int prevvisframe; - int HeightWhenCollapsed; - FrameTitleBar TitleBar; - FrameMenuHandles MenuHandles; - int oldstyles; - BOOLEAN floating; - HWND ContainerWnd; - POINT FloatingPos; - POINT FloatingSize; - BOOLEAN minmaxenabled; - BOOLEAN UseBorder; - int order; - DockOpt dockOpt; - HWND OwnerWindow; - WNDPROC wndProc; -} wndFrame; - diff --git a/plugins/Clist_nicer/CLUIFrames/framesmenu.cpp b/plugins/Clist_nicer/CLUIFrames/framesmenu.cpp deleted file mode 100644 index 07b6ebc4e6..0000000000 --- a/plugins/Clist_nicer/CLUIFrames/framesmenu.cpp +++ /dev/null @@ -1,228 +0,0 @@ -#include -#include "cluiframes.h" - -//==========================Frames -HANDLE hFrameMenuObject; -static HANDLE hPreBuildFrameMenuEvent; -extern int InitCustomMenus(void); - -//contactmenu exec param(ownerdata) -//also used in checkservice -typedef struct{ - char *szServiceName; - int Frameid; - INT_PTR param1; -}FrameMenuExecParam,*lpFrameMenuExecParam; - -void FreeAndNil( void **p ) -{ - if (p!=NULL) - { - if (*p!=NULL) - { - if (!IsBadCodePtr((FARPROC)*p)) - { - mir_free(*p); - } - *p=NULL; - } - } -} - -INT_PTR FreeOwnerDataFrameMenu (WPARAM wParam,LPARAM lParam) -{ - - lpFrameMenuExecParam cmep; - - cmep=(lpFrameMenuExecParam)lParam; - if (cmep!=NULL){ - FreeAndNil((void **)&cmep->szServiceName); - FreeAndNil((void **)&cmep); - } - return(0); -} - -static INT_PTR AddContextFrameMenuItem(WPARAM wParam,LPARAM lParam) -{ - TMO_MenuItem tmi; - CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; - if ( !pcli->pfnConvertMenu(mi, &tmi)) - return NULL; - - tmi.root = (mi->flags & CMIF_ROOTHANDLE) ? mi->hParentMenu : NULL; - - lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)mir_alloc(sizeof(FrameMenuExecParam)); - if (fmep == NULL) - return 0; - - fmep->szServiceName = mir_strdup(mi->pszService); - fmep->Frameid = mi->popupPosition; - fmep->param1 = (INT_PTR)mi->pszContactOwner; - tmi.ownerdata = fmep; - - return CallService(MO_ADDNEWMENUITEM,(WPARAM)hFrameMenuObject,(LPARAM)&tmi); -} - -static INT_PTR RemoveContextFrameMenuItem(WPARAM wParam,LPARAM lParam) -{ - /* this do by free service - lpFrameMenuExecParam fmep; - fmep=(lpFrameMenuExecParam)CallService(MO_MENUITEMGETOWNERDATA,wParam,lParam); - if (fmep!=NULL){ - if (fmep->szServiceName!=NULL){ - mir_free(fmep->szServiceName); - fmep->szServiceName=NULL; - }; - mir_free(fmep); - } - */ - CallService(MO_REMOVEMENUITEM,wParam,0); - return 0; -} - -//called with: -//wparam - ownerdata -//lparam - lparam from winproc -INT_PTR FrameMenuExecService(WPARAM wParam,LPARAM lParam) { - lpFrameMenuExecParam fmep=(lpFrameMenuExecParam)wParam; - if (fmep==NULL) - return(-1); - - CallService(fmep->szServiceName,lParam,fmep->param1); - RedrawWindow(pcli->hwndContactList,NULL,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_FRAME|RDW_UPDATENOW|RDW_ALLCHILDREN); - return(0); -} - -//true - ok,false ignore -INT_PTR FrameMenuCheckService(WPARAM wParam,LPARAM lParam) { - - PCheckProcParam pcpp=(PCheckProcParam)wParam; - lpFrameMenuExecParam fmep; - TMO_MenuItem mi; - - if (pcpp==NULL){return(FALSE);}; - if (CallService(MO_GETMENUITEM,(WPARAM)pcpp->MenuItemHandle,(LPARAM)&mi)==0) - { - fmep = reinterpret_cast(mi.ownerdata); - if (fmep!=NULL) - { - //pcpp->wParam - frameid - if (((WPARAM)fmep->Frameid==pcpp->wParam)||fmep->Frameid==-1) return(TRUE); - } - } - return(FALSE); -} - -static INT_PTR ContextFrameMenuNotify(WPARAM wParam,LPARAM lParam) -{ - NotifyEventHooks(hPreBuildFrameMenuEvent,wParam,lParam); - return(0); -} - -static INT_PTR BuildContextFrameMenu(WPARAM wParam,LPARAM lParam) -{ - CLISTMENUITEM *mi=(CLISTMENUITEM*)lParam; - HMENU hMenu; - ListParam param = { 0 }; - param.MenuObjectHandle=hFrameMenuObject; - param.wParam=wParam; - param.lParam=lParam; - - hMenu=CreatePopupMenu(); - //NotifyEventHooks(hPreBuildFrameMenuEvent,wParam,-1); - ContextFrameMenuNotify(wParam,-1); - CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m); - return (INT_PTR)hMenu; -} - -//==========================Frames end -boolean InternalGenMenuModule=FALSE; - -INT_PTR MeasureItemProxy(WPARAM wParam,LPARAM lParam) -{ - int val; - if (InternalGenMenuModule) - { - val=CallService(MS_INT_MENUMEASUREITEM,wParam,lParam); - if (val) return(val); - } - - return CallService(MS_CLIST_MENUMEASUREITEM,wParam,lParam); -} - -INT_PTR DrawItemProxy(WPARAM wParam,LPARAM lParam) -{ - if (InternalGenMenuModule) - { - int val; - val=CallService(MS_INT_MENUDRAWITEM,wParam,lParam); - if (val) return(val); - } - return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam); -} - -int ProcessCommandProxy(WPARAM wParam,LPARAM lParam) -{ - if (InternalGenMenuModule) { - int val; - val=CallService(MS_INT_MENUPROCESSCOMMAND,wParam,lParam); - if (val) - return(val); - } - return CallService(MS_CLIST_MENUPROCESSCOMMAND,wParam,lParam); -} - -INT_PTR ModifyMenuItemProxy(WPARAM wParam,LPARAM lParam) -{ - if (InternalGenMenuModule) - { - int val; - val=CallService(MS_INT_MODIFYMENUITEM,wParam,lParam); - if (val) return(val); - } - - return CallService(MS_CLIST_MODIFYMENUITEM,wParam,lParam); -} - -int InitFramesMenus(void) -{ - TMenuParam tmp; - - if (!ServiceExists(MO_REMOVEMENUOBJECT)) - InternalGenMenuModule=TRUE; - - if (ServiceExists(MO_REMOVEMENUOBJECT)) - { - CreateServiceFunction("FrameMenuExecService",FrameMenuExecService); - CreateServiceFunction("FrameMenuCheckService",FrameMenuCheckService); - CreateServiceFunction("FrameMenuFreeService",FreeOwnerDataFrameMenu); - - - CreateServiceFunction(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM,RemoveContextFrameMenuItem); - CreateServiceFunction("CList/AddContextFrameMenuItem",AddContextFrameMenuItem); - CreateServiceFunction(MS_CLIST_MENUBUILDFRAMECONTEXT,BuildContextFrameMenu); - CreateServiceFunction(MS_CLIST_FRAMEMENUNOTIFY,ContextFrameMenuNotify); - hPreBuildFrameMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDFRAMEMENU); - - //frame menu object - memset(&tmp,0,sizeof(tmp)); - tmp.cbSize=sizeof(tmp); - tmp.CheckService="FrameMenuCheckService"; - tmp.ExecService="FrameMenuExecService"; - tmp.name="Frames_Menu"; - hFrameMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT,0,(LPARAM)&tmp); - { - OptParam op; - op.Handle=hFrameMenuObject; - op.Setting=OPT_MENUOBJECT_SET_FREE_SERVICE; - op.Value=(INT_PTR)"FrameMenuFreeService"; - CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); - } - } - return 0; -} - -int UnitFramesMenu() -{ - return(0); -} diff --git a/plugins/Clist_nicer/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/CLUIFrames/groupmenu.cpp deleted file mode 100644 index a784e30883..0000000000 --- a/plugins/Clist_nicer/CLUIFrames/groupmenu.cpp +++ /dev/null @@ -1,704 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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 - -//////////////////////////////Group MENU///////////////////////// -HANDLE hGroupMenuObject; - -HANDLE hGroupMainMenuItemProxy; -HANDLE hHideShowMainMenuItem; -HANDLE hGroupStatusMenuItemProxy; -HANDLE hPreBuildGroupMenuEvent; -HANDLE hAppearanceMenuItemProxy; -HANDLE hEventAreaMenuItemProxy; - -static HMENU hMenuOldContext; - -HANDLE hHideOfflineUsersMenuItem; -HANDLE hHideOfflineUsersOutHereMenuItem; -HANDLE hHideEmptyGroupsMenuItem; -HANDLE hDisableGroupsMenuItem; -HANDLE hNewGroupMenuItem; -HANDLE hNewSubGroupMenuItem; - -int NewGroupIconidx; - -extern HIMAGELIST hCListImages; -extern HICON LoadIconFromExternalFile (char *filename,int i,boolean UseLibrary,boolean registerit,char *IconName,char *SectName,char *Description,int internalidx); - -void InitSubGroupMenus(void); - -//Groupmenu exec param(ownerdata) -typedef struct { - char *szServiceName; - int Param1,Param2; -}GroupMenuExecParam,*lpGroupMenuExecParam; - -/* -wparam=handle to the menu item returned by MS_CLIST_ADDCONTACTMENUITEM -return 0 on success. -*/ -static INT_PTR RemoveGroupMenuItem(WPARAM wParam,LPARAM lParam) -{ - CallService(MO_REMOVEMENUITEM,wParam,0); - return 0; -} - - -static INT_PTR BuildGroupMenu(WPARAM wParam,LPARAM lParam) -{ - int tick; - HMENU hMenu; - ListParam param = { 0 }; - param.MenuObjectHandle=hGroupMenuObject; - - //hMenu=hMainMenu; - hMenu=CreatePopupMenu(); - //hMenu=wParam; - tick=GetTickCount(); - - NotifyEventHooks(hPreBuildGroupMenuEvent,0,0); - - CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m); - //DrawMenuBar((HWND)CallService("CLUI/GetHwnd",0,0)); - tick=GetTickCount()-tick; - return(INT_PTR)hMenu; -} - -static INT_PTR AddGroupMenuItem(WPARAM wParam,LPARAM lParam) -{ - TMO_MenuItem tmi; - CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; - if ( !pcli->pfnConvertMenu(mi, &tmi)) - return NULL; - - lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)mir_alloc(sizeof(GroupMenuExecParam)); - if (mmep == NULL) - return 0; - - //we need just one parametr. - mmep->szServiceName = mir_strdup(mi->pszService); - mmep->Param1 = mi->popupPosition; - lpGroupMenuParam gmp=(lpGroupMenuParam)wParam; - if (gmp != NULL) { - mmep->Param1 = gmp->wParam; - mmep->Param2 = gmp->lParam; - } - tmi.ownerdata=mmep; - - char buf[1024]; - sprintf(buf,"%s/%s",mi->pszService,mi->pszName); - - OptParam op; - op.Handle=(HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hGroupMenuObject,(LPARAM)&tmi); - op.Setting=OPT_MENUITEMSETUNIQNAME; - op.Value=(INT_PTR)buf; - CallService(MO_SETOPTIONSMENUITEM,(WPARAM)0,(LPARAM)&op); - return (INT_PTR)op.Handle; -} - -INT_PTR GroupMenuCheckService(WPARAM wParam,LPARAM lParam) -{ - return 0; -} - -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; - //mi.fType=MFT_STRING; - mii->hSubMenu=(HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0); - } - - if (hGroupStatusMenuItemProxy==(HANDLE)lParam) { - mii->fMask|=MIIM_SUBMENU; - //mi.fType=MFT_STRING; - mii->hSubMenu=(HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); - } - if (hAppearanceMenuItemProxy==(HANDLE)lParam) { - hMenuOldContext = GetSubMenu(LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT)), 3); - TranslateMenu(hMenuOldContext); - - CheckMenuItem(hMenuOldContext, POPUP_VISIBILITY, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_SHOWVISI ? MF_CHECKED : MF_UNCHECKED)); - CheckMenuItem(hMenuOldContext, POPUP_FRAME, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN ? MF_CHECKED : MF_UNCHECKED)); - CheckMenuItem(hMenuOldContext, POPUP_BUTTONS, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_FRAME_SHOWBOTTOMBUTTONS ? MF_CHECKED : MF_UNCHECKED)); - CheckMenuItem(hMenuOldContext, POPUP_SHOWMETAICONS, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_USEMETAICONS ? MF_CHECKED : MF_UNCHECKED)); - CheckMenuItem(hMenuOldContext, POPUP_SHOWSTATUSICONS, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_FRAME_STATUSICONS ? MF_CHECKED : MF_UNCHECKED)); - - // floater menu items - - EnableMenuItem(hMenuOldContext, POPUP_FLOATER_AUTOHIDE, MF_BYCOMMAND | (cfg::dat.bUseFloater & CLUI_USE_FLOATER ? MF_ENABLED : MF_GRAYED)); - EnableMenuItem(hMenuOldContext, POPUP_FLOATER_EVENTS, MF_BYCOMMAND | (cfg::dat.bUseFloater & CLUI_USE_FLOATER ? MF_ENABLED : MF_GRAYED)); - CheckMenuItem(hMenuOldContext, POPUP_FLOATER, MF_BYCOMMAND | (cfg::dat.bUseFloater & CLUI_USE_FLOATER ? MF_CHECKED : MF_UNCHECKED)); - CheckMenuItem(hMenuOldContext, POPUP_FLOATER_AUTOHIDE, MF_BYCOMMAND | (cfg::dat.bUseFloater & CLUI_FLOATER_AUTOHIDE ? MF_CHECKED : MF_UNCHECKED)); - CheckMenuItem(hMenuOldContext, POPUP_FLOATER_EVENTS, MF_BYCOMMAND | (cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS ? MF_CHECKED : MF_UNCHECKED)); - - mii->fMask|=MIIM_SUBMENU; - //mi.fType=MFT_STRING; - mii->hSubMenu=(HMENU)hMenuOldContext; - } - 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 (!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 wParam,LPARAM lParam) -{ - - lpGroupMenuExecParam mmep; - mmep=(lpGroupMenuExecParam)lParam; - if (mmep!=NULL) { - FreeAndNil((void **)&mmep->szServiceName); - FreeAndNil((void **)&mmep); - } - - return(0); -}; - -INT_PTR HideGroupsHelper(WPARAM wParam,LPARAM lParam) -{ - int newVal=!(GetWindowLongPtr((HWND)CallService(MS_CLUI_GETHWNDTREE,0,0),GWL_STYLE)&CLS_HIDEEMPTYGROUPS); - cfg::writeByte("CList","HideEmptyGroups",(BYTE)newVal); - SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE,0,0),CLM_SETHIDEEMPTYGROUPS,newVal,0); - return 0; -} - -INT_PTR UseGroupsHelper(WPARAM wParam,LPARAM lParam) -{ - int newVal=!(GetWindowLongPtr((HWND)CallService(MS_CLUI_GETHWNDTREE,0,0),GWL_STYLE)&CLS_USEGROUPS); - cfg::writeByte("CList","UseGroups",(BYTE)newVal); - SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE,0,0),CLM_SETUSEGROUPS,newVal,0); - return 0; -} - -INT_PTR HideOfflineRootHelper(WPARAM wParam,LPARAM lParam) -{ - SendMessage( - (HWND)CallService(MS_CLUI_GETHWNDTREE,0,0), - CLM_SETHIDEOFFLINEROOT, - !SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE,0,0),CLM_GETHIDEOFFLINEROOT,0,0), - 0); - return 0; -}; - -static int OnBuildGroupMenu(WPARAM wParam,LPARAM lParam) -{ - CLISTMENUITEM mi; - - - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.flags = CMIM_FLAGS | (cfg::getByte("CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CMIF_CHECKED:0); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersMenuItem, (LPARAM)&mi); - - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.flags = CMIM_FLAGS | (SendMessage(pcli->hwndContactTree,CLM_GETHIDEOFFLINEROOT,0,0)?CMIF_CHECKED:0); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersOutHereMenuItem, (LPARAM)&mi); - - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_HIDEEMPTYGROUPS?CMIF_CHECKED:0); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideEmptyGroupsMenuItem, (LPARAM)&mi); - - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_USEGROUPS?0:CMIF_CHECKED); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hDisableGroupsMenuItem, (LPARAM)&mi); - - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.flags = CMIM_FLAGS; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hGroupMainMenuItemProxy, (LPARAM)&mi); - - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.flags = CMIM_FLAGS; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hAppearanceMenuItemProxy, (LPARAM)&mi); - - return 0; -}; - -int static OnIconLibIconChanged(WPARAM wParam,LPARAM lParam) -{ - HICON hicon; - CLISTMENUITEM clmi={0}; - - //hicon=LoadIconFromExternalFile("clisticons.dll",2,TRUE,FALSE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP); - NewGroupIconidx=ImageList_ReplaceIcon(hCListImages,NewGroupIconidx,hicon); - - clmi.cbSize=sizeof(clmi); - clmi.flags=CMIM_ICON; - clmi.hIcon=ImageList_GetIcon(hCListImages,NewGroupIconidx,0); - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewSubGroupMenuItem,(LPARAM)&clmi); - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewGroupMenuItem,(LPARAM)&clmi); - // - - - return 0; -}; - -void InitGroupMenus(void) -{ - TMenuParam tmp; - OptParam op; - //hicon=LoadIconFromExternalFile("clisticons.dll",2,TRUE,TRUE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP2); - //NewGroupIconidx=ImageList_AddIcon(hCListImages,hicon ); - - 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("CList/AddGroupMenuItem",AddGroupMenuItem); - CreateServiceFunction(MS_CLIST_REMOVEGROUPMENUITEM,RemoveGroupMenuItem); - CreateServiceFunction(MS_CLIST_MENUBUILDGROUP,BuildGroupMenu); - hPreBuildGroupMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDGROUPMENU); - HookEvent(ME_CLIST_PREBUILDGROUPMENU,OnBuildGroupMenu); - - InitSubGroupMenus(); - - //Group menu - memset(&tmp,0,sizeof(tmp)); - tmp.cbSize=sizeof(tmp); - tmp.CheckService=NULL; - tmp.ExecService="CLISTMENUSGroup/ExecService"; - tmp.name="GroupMenu"; - hGroupMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp); - - - op.Handle=hGroupMenuObject; - op.Setting=OPT_USERDEFINEDITEMS; - op.Value=TRUE; - CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); - - op.Handle=hGroupMenuObject; - op.Setting=OPT_MENUOBJECT_SET_FREE_SERVICE; - op.Value=(INT_PTR)"CLISTMENUSGroup/FreeOwnerDataGroupMenu"; - CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); - - op.Handle=hGroupMenuObject; - op.Setting=OPT_MENUOBJECT_SET_ONADD_SERVICE; - op.Value=(INT_PTR)"CLISTMENUSGroup/GroupMenuonAddService"; - CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); - - { - //add exit command to menu - CLISTMENUITEM mi; - GroupMenuParam gmp; - - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=1900000; - mi.pszService="CloseAction"; - mi.pszName=LPGEN("E&xit"); - AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=500; - mi.pszService=MS_CLIST_SHOWHIDE; - mi.pszName=LPGEN("&Hide/Show"); - hHideShowMainMenuItem=(HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=200000; - mi.flags = CMIF_ICONFROMICOLIB; - mi.icolibItem=LoadSkinnedIconHandle(SKINICON_OTHER_FINDUSER); //LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_FINDUSER)); - mi.pszService="FindAdd/FindAddCommand"; - mi.pszName=LPGEN("&Find/Add Contacts..."); - AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=300000; - mi.pszService=""; - mi.pszName=LPGEN("&Main Menu"); - hGroupMainMenuItemProxy=(HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=300100; - mi.pszService=""; - mi.pszName=LPGEN("&Status"); - hGroupStatusMenuItemProxy=(HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=390100; - mi.pszService=""; - mi.pszName=LPGEN("Appearance"); - hAppearanceMenuItemProxy=(HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=400000; - mi.flags = CMIF_ICONFROMICOLIB; - mi.icolibItem=LoadSkinnedIconHandle(SKINICON_OTHER_OPTIONS); //LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_OPTIONS)); - mi.pszService="Options/OptionsCommand"; - mi.pszName=LPGEN("&Options..."); - - AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=500000; - mi.flags = CMIF_ICONFROMICOLIB; - mi.icolibItem=LoadSkinnedIconHandle(SKINICON_OTHER_MIRANDA); //LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_MIRANDA)); - mi.pszService="CLN/About"; - mi.pszName=LPGEN("&About the contact list..."); - - AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=100000; - mi.hIcon=ImageList_GetIcon(hCListImages,NewGroupIconidx,0); - //mi.pszService=MS_CLIST_GROUPCREATE; - mi.pszService="CLISTMENUSSubGroup/GroupMenuExecProxy"; - //mi.pszService="CLISTMENUSGroup/ExecService"; - mi.pszName=LPGEN("&New Group"); - gmp.lParam=0;gmp.wParam=POPUP_NEWGROUP; - hNewGroupMenuItem=(HANDLE)AddGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=100001; - mi.hIcon=NULL; - mi.pszService=MS_CLIST_SETHIDEOFFLINE; - mi.pszName=LPGEN("&Hide Offline Users"); - gmp.lParam=0;gmp.wParam=-1; - hHideOfflineUsersMenuItem=(HANDLE)AddGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=100002; - mi.hIcon=NULL; - mi.pszService="CLISTMENUSGroup/HideOfflineRootHelper"; - mi.pszName=LPGEN("Hide &Offline Users out here"); - hHideOfflineUsersOutHereMenuItem=(HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=100003; - mi.hIcon=NULL; - mi.pszService="CLISTMENUSGroup/HideGroupsHelper"; - mi.pszName=LPGEN("Hide &Empty Groups"); - hHideEmptyGroupsMenuItem=(HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - - - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=100004; - mi.hIcon=NULL; - mi.pszService="CLISTMENUSGroup/UseGroupsHelper"; - mi.pszName=LPGEN("Disable &Groups"); - hDisableGroupsMenuItem=(HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); - - - //MS_CLIST_GROUPCREATE - - }; -} - -HANDLE hSubGroupMenuObject; - -HANDLE hSubGroupMainMenuItemProxy; -//HANDLE hHideShowMainMenuItem; -HANDLE hSubGroupStatusMenuItemProxy; -HANDLE hPreBuildSubGroupMenuEvent; -HANDLE hHideOfflineUsersHereMenuItem; - -//SubGroupmenu exec param(ownerdata) -typedef struct { - char *szServiceName; - int Param1,Param2; -}SubGroupMenuExecParam,*lpSubGroupMenuExecParam; - -/* -wparam=handle to the menu item returned by MS_CLIST_ADDCONTACTMENUITEM -return 0 on success. -*/ -static INT_PTR RemoveSubGroupMenuItem(WPARAM wParam,LPARAM lParam) -{ - CallService(MO_REMOVEMENUITEM,wParam,0); - return 0; -} - -static int OnBuildSubGroupMenu(WPARAM wParam,LPARAM lParam) -{ - ClcGroup *group=(struct ClcGroup *)wParam; - if (group == 0) - return 0; - - //contact->group - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); - mi.flags = CMIM_FLAGS | (group->hideOffline?CMIF_CHECKED:0); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersHereMenuItem, (LPARAM)&mi); - - return 0; -} - -static INT_PTR BuildSubGroupMenu(WPARAM wParam,LPARAM lParam) -{ - ListParam param = { 0 }; - param.MenuObjectHandle = hSubGroupMenuObject; - param.wParam = wParam; - - HMENU hMenu = CreatePopupMenu(); - int tick = GetTickCount(); - NotifyEventHooks(hPreBuildSubGroupMenuEvent,wParam,0); - - CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m); - tick = GetTickCount()-tick; - return(INT_PTR)hMenu; -} - -static INT_PTR AddSubGroupMenuItem(WPARAM wParam,LPARAM lParam) -{ - TMO_MenuItem tmi; - CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; - if ( !pcli->pfnConvertMenu(mi, &tmi)) - return NULL; - - lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)mir_alloc(sizeof(SubGroupMenuExecParam)); - if (mmep == NULL) - return 0; - - //we need just one parametr. - lpGroupMenuParam gmp=(lpGroupMenuParam)wParam; - mmep->szServiceName = mir_strdup(mi->pszService); - mmep->Param1 = mi->popupPosition; - if (gmp != NULL) { - mmep->Param1 = gmp->wParam; - mmep->Param2 = gmp->lParam; - } - tmi.ownerdata = mmep; - - char buf[1024]; - sprintf(buf,"%s/%s",mi->pszService,mi->pszName); - - OptParam op; - op.Handle=(HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hSubGroupMenuObject,(LPARAM)&tmi); - op.Setting=OPT_MENUITEMSETUNIQNAME; - op.Value=(INT_PTR)buf; - CallService(MO_SETOPTIONSMENUITEM,(WPARAM)0,(LPARAM)&op); - return (INT_PTR)op.Handle; -} - -INT_PTR SubGroupMenuCheckService(WPARAM wParam,LPARAM lParam) { - //not used - return(0); -}; - -INT_PTR SubGroupMenuonAddService(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 (hSubGroupMainMenuItemProxy==(HANDLE)lParam) - { - mii->fMask|=MIIM_SUBMENU; - //mi.fType=MFT_STRING; - mii->hSubMenu=(HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0); - } - - if (hSubGroupStatusMenuItemProxy==(HANDLE)lParam) - { - mii->fMask|=MIIM_SUBMENU; - //mi.fType=MFT_STRING; - mii->hSubMenu=(HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,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 (!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 FreeOwnerDataSubGroupMenu (WPARAM wParam,LPARAM lParam) -{ - lpSubGroupMenuExecParam mmep; - mmep=(lpSubGroupMenuExecParam)lParam; - if (mmep!=NULL) { - FreeAndNil((void **)&mmep->szServiceName); - FreeAndNil((void **)&mmep); - } - - return(0); -} - -//wparam menu handle to pass to clc.c -INT_PTR GroupMenuExecProxy(WPARAM wParam,LPARAM lParam) -{ - SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE,0,0),WM_COMMAND,wParam,0); - return 0; -} - -void InitSubGroupMenus(void) -{ - TMenuParam tmp; - OptParam op; - - CreateServiceFunction("CLISTMENUSSubGroup/ExecService",SubGroupMenuExecService); - CreateServiceFunction("CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu",FreeOwnerDataSubGroupMenu); - CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuonAddService",SubGroupMenuonAddService); - CreateServiceFunction("CLISTMENUSSubGroup/GroupMenuExecProxy",GroupMenuExecProxy); - - //CreateServiceFunction("CLISTMENUSSubGroup/HideSubGroupsHelper",HideSubGroupsHelper); - //CreateServiceFunction("CLISTMENUSSubGroup/UseSubGroupsHelper",UseSubGroupsHelper); - //CreateServiceFunction("CLISTMENUSSubGroup/HideOfflineRootHelper",HideOfflineRootHelper); - - CreateServiceFunction("CList/AddSubGroupMenuItem",AddSubGroupMenuItem); - CreateServiceFunction(MS_CLIST_REMOVESUBGROUPMENUITEM,RemoveSubGroupMenuItem); - CreateServiceFunction(MS_CLIST_MENUBUILDSUBGROUP,BuildSubGroupMenu); - hPreBuildSubGroupMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDSUBGROUPMENU); - HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU,OnBuildSubGroupMenu); - - - //SubGroup menu - memset(&tmp,0,sizeof(tmp)); - tmp.cbSize=sizeof(tmp); - tmp.CheckService=NULL; - tmp.ExecService="CLISTMENUSSubGroup/ExecService"; - tmp.name="SubGroupMenu"; - hSubGroupMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp); - - - op.Handle=hSubGroupMenuObject; - op.Setting=OPT_USERDEFINEDITEMS; - op.Value=TRUE; - CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); - - op.Handle=hSubGroupMenuObject; - op.Setting=OPT_MENUOBJECT_SET_FREE_SERVICE; - op.Value=(INT_PTR)"CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu"; - CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); - - op.Handle=hSubGroupMenuObject; - op.Setting=OPT_MENUOBJECT_SET_ONADD_SERVICE; - op.Value=(INT_PTR)"CLISTMENUSSubGroup/SubGroupMenuonAddService"; - CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); - - { - //add exit command to menu - CLISTMENUITEM mi; - GroupMenuParam gmp; - - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=1000; - mi.hIcon=ImageList_GetIcon(hCListImages,NewGroupIconidx,0); - mi.pszService="CLISTMENUSSubGroup/GroupMenuExecProxy"; - mi.pszName=LPGEN("&New SubGroup"); - gmp.lParam=0;gmp.wParam=POPUP_NEWSUBGROUP; - hNewSubGroupMenuItem=(HANDLE)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=1001; - mi.hIcon=NULL; - mi.pszService="CLISTMENUSSubGroup/GroupMenuExecProxy"; - mi.pszName=LPGEN("&Hide Offline Users in here"); - gmp.lParam=0;gmp.wParam=POPUP_GROUPHIDEOFFLINE; - hHideOfflineUsersHereMenuItem=(HANDLE)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=900001; - mi.flags = CMIF_ICONFROMICOLIB; - mi.icolibItem=LoadSkinnedIconHandle(SKINICON_OTHER_RENAME); //LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_RENAME)); - mi.pszService="CLISTMENUSSubGroup/GroupMenuExecProxy"; - mi.pszName=LPGEN("&Rename Group"); - gmp.lParam=0;gmp.wParam=POPUP_RENAMEGROUP; - AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=900002; - mi.flags = CMIF_ICONFROMICOLIB; - mi.icolibItem=LoadSkinnedIconHandle(SKINICON_OTHER_DELETE); //LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_DELETE)); - mi.pszService="CLISTMENUSSubGroup/GroupMenuExecProxy"; - mi.pszName=LPGEN("&Delete Group"); - gmp.lParam=0;gmp.wParam=POPUP_DELETEGROUP; - AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); - } -} - -//////////////////////////////END SubGroup MENU///////////////////////// diff --git a/plugins/Clist_nicer/CLUIFrames/movetogroup.cpp b/plugins/Clist_nicer/CLUIFrames/movetogroup.cpp deleted file mode 100644 index 89bc2a42e4..0000000000 --- a/plugins/Clist_nicer/CLUIFrames/movetogroup.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include - -HANDLE hOnCntMenuBuild; -HANDLE hPriorityItem = 0, hFloatingItem = 0; - -static int OnContactMenuBuild(WPARAM wParam,LPARAM lParam) -{ - CLISTMENUITEM mi; - BYTE bSetting; - - // Menu Item - Floating Contact - bSetting = cfg::getByte("CList", "flt_enabled", 0); - if (bSetting && !hFloatingItem) - { - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=200000; - mi.pszPopupName=(char *)-1; - mi.pszService="CList/SetContactFloating"; - mi.pszName=LPGEN("&Floating Contact"); - if (pcli) - { - if (SendMessage(pcli->hwndContactTree, CLM_QUERYFLOATINGCONTACT, wParam, 0)) - mi.flags=CMIF_CHECKED; - } - hFloatingItem = Menu_AddContactMenuItem(&mi); - } - else if (!bSetting && hFloatingItem) - { - CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)hFloatingItem, 0); - hFloatingItem = 0; - } - else - { - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.flags=CMIM_FLAGS; - if (pcli) - { - if (SendMessage(pcli->hwndContactTree, CLM_QUERYFLOATINGCONTACT, wParam, 0)) - mi.flags |= CMIF_CHECKED; - } - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hFloatingItem, (LPARAM)&mi); - } - return 0; -} - -int MTG_OnmodulesLoad(WPARAM wParam,LPARAM lParam) -{ - hOnCntMenuBuild=HookEvent(ME_CLIST_PREBUILDCONTACTMENU,OnContactMenuBuild); - return 0; -} - -int UnloadMoveToGroup(void) -{ - if (hOnCntMenuBuild) - UnhookEvent(hOnCntMenuBuild); - - return 0; -} diff --git a/plugins/Clist_nicer/INCLUDE/alphablend.h b/plugins/Clist_nicer/INCLUDE/alphablend.h deleted file mode 100644 index de0e7c4fa8..0000000000 --- a/plugins/Clist_nicer/INCLUDE/alphablend.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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. -*/ - -void __inline gradientVertical(UCHAR *ubRedFinal, UCHAR *ubGreenFinal, UCHAR *ubBlueFinal, - ULONG ulBitmapHeight, UCHAR ubRed, UCHAR ubGreen, UCHAR ubBlue, UCHAR ubRed2, - UCHAR ubGreen2, UCHAR ubBlue2, DWORD FLG_GRADIENT, BOOL transparent, UINT32 y, UCHAR *ubAlpha); - -void __inline gradientHorizontal( UCHAR *ubRedFinal, UCHAR *ubGreenFinal, UCHAR *ubBlueFinal, - ULONG ulBitmapWidth, UCHAR ubRed, UCHAR ubGreen, UCHAR ubBlue, UCHAR ubRed2, - UCHAR ubGreen2, UCHAR ubBlue2, DWORD FLG_GRADIENT, BOOL transparent, UINT32 x, UCHAR *ubAlpha); \ No newline at end of file diff --git a/plugins/Clist_nicer/INCLUDE/clc.h b/plugins/Clist_nicer/INCLUDE/clc.h deleted file mode 100644 index 879fc52553..0000000000 --- a/plugins/Clist_nicer/INCLUDE/clc.h +++ /dev/null @@ -1,632 +0,0 @@ -/* - * astyle --force-indent=tab=4 --brackets=linux --indent-switches - * --pad=oper --one-line=keep-blocks --unpad=paren - * - * Miranda IM: the free IM client for Microsoft* Windows* - * - * Copyright 2000-2010 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. - * - * part of clist_nicer plugin for Miranda. - * - * (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors - * - * $Id: clc.h 13850 2011-09-10 03:26:59Z borkra $ - * - */ - -#define MAXEXTRACOLUMNS 16 - -#define INTM_XSTATUSCHANGED (WM_USER+26) -#define INTM_METACHANGEDEVENT (WM_USER+27) -#define INTM_CODEPAGECHANGED (WM_USER+28) -//#define INTM_CLIENTCHANGED (WM_USER+29) -#define INTM_AVATARCHANGED (WM_USER+30) -#define INTM_STATUSMSGCHANGED (WM_USER+31) -#define INTM_SORTCLC (WM_USER+32) -#define INTM_STATUSCHANGED (WM_USER+33) -#define INTM_METACHANGED (WM_USER+34) -#define INTM_INVALIDATECONTACT (WM_USER+35) -#define INTM_FORCESORT (WM_USER+36) - -#define DEFAULT_TITLEBAR_HEIGHT 18 - -#define CLS_SKINNEDFRAME 0x0800 //this control will be the main contact list (v. 0.3.4.3+ 2004/11/02) - -#define TIMERID_RENAME 10 -#define TIMERID_DRAGAUTOSCROLL 11 -#define TIMERID_INFOTIP 13 -#define TIMERID_SORT 15 -#define TIMERID_REFRESH 18 -#define TIMERID_PAINT 19 -struct 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_STICKY 64 -#define CONTACTF_PRIORITY 128 - -#define STATUSMSG_XSTATUSID 1 -#define STATUSMSG_XSTATUSNAME 2 -#define STATUSMSG_CLIST 4 -#define STATUSMSG_YIM 8 -#define STATUSMSG_GG 16 -#define STATUSMSG_XSTATUS 32 - -#define STATUSMSG_NOTFOUND 0 - -#define SMSG_MAXLEN 700 - -#define EXTRAIMAGECACHESIZE 1000 - -// extra cache contact flags - -#define ECF_RTLNICK 1 -#define ECF_RTLSTATUSMSG 2 -#define ECF_FORCEAVATAR 4 -#define ECF_HIDEAVATAR 8 -#define ECF_FORCEOVERLAY 16 -#define ECF_HIDEOVERLAY 32 -#define ECF_FORCELOCALTIME 64 -#define ECF_HIDELOCALTIME 128 -#define ECF_FORCEVISIBILITY 256 -#define ECF_HIDEVISIBILITY 512 -#define ECF_HASREALTIMEZONE 1024 - -// other contact flags (struct ClCContact; - -#define ECF_AVATAR 1 -#define ECF_SECONDLINE 2 - -struct ContactFloater { - struct ContactFloater *pNextFloater; - HWND hwnd; - HDC hdc; - HBITMAP hbm, hbmOld; - HANDLE hContact; -}; - -typedef struct ContactFloater CONTACTFLOATER; - -#define DSPF_CENTERSTATUSICON 1 -#define DSPF_DIMIDLE 2 -#define DSPF_NOFFLINEAVATARS 4 -#define DSPF_SHOWLOCALTIME 8 -#define DSPF_LOCALTIMESELECTIVE 16 -#define DSPF_DONTSEPARATEOFFLINE 32 -#define DSPF_CENTERGROUPNAMES 64 - -#define EXICON_COUNT 11 - -/* Extra icons settings */ -typedef struct _OrderTreeData -{ - BYTE ID; - const TCHAR * Name; - BYTE Position; - BOOL Visible; - BOOL fReserved; -} *PORDERTREEDATA, ORDERTREEDATA; - -struct DisplayProfile -{ - DWORD dwFlags; - DWORD dwExtraImageMask; - int exIconScale; - BOOL bCenterStatusIcons; - BOOL bDimIdle, bNoOfflineAvatars, bShowLocalTime, bShowLocalTimeSelective, bDontSeparateOffline, bCenterGroupNames; - BYTE dualRowMode; - COLORREF avatarBorder; - DWORD avatarRadius; - int avatarSize; - DWORD clcExStyle; - DWORD clcOfflineModes; - BYTE sortOrder[3], bUseDCMirroring, bGroupAlign; - BYTE avatarPadding; - BYTE bLeftMargin, bRightMargin, bRowSpacing, bGroupIndent, bRowHeight, bGroupRowHeight; - BYTE exIconOrder[EXICON_COUNT]; -}; -typedef struct DisplayProfile DISPLAYPROFILE; - -/* - * a set of 4 (online, offline, selected, hottracked) display profiles - */ - -struct DisplayProfileSet { - UINT uID; - TCHAR tszName[60]; - DISPLAYPROFILE dp[4]; -}; -typedef struct DisplayProfileSet DISPLAYPROFILESET; - -#define DSP_PROFILES_MODULE "CLN_DspProfiles" // db module for display profiles - -struct TExtraCache -{ - BYTE iExtraImage[MAXEXTRACOLUMNS]; - HANDLE hContact; - HANDLE hTimeZone; - DWORD iExtraValid; - BYTE valid; - TCHAR *statusMsg; - BYTE bStatusMsgValid; - DWORD dwCFlags; - DWORD dwDFlags; // display flags for caching only - DWORD dwXMask; // local extra icon mask, calculated from CLN_xmask - StatusItems_t *status_item, *proto_status_item; - CONTACTFLOATER *floater; - DWORD dwLastMsgTime; - DWORD msgFrequency; - BOOL isChatRoom; -}; - -struct ClcContact : public ClcContactBase -{ - BOOL bIsMeta; - HANDLE hSubContact; - BYTE xStatus; - char *metaProto; - DWORD codePage; - struct avatarCacheEntry *ace; - WORD wStatus; - int extraCacheEntry; - int avatarLeft, extraIconRightBegin; - int isRtl; - DWORD cFlags; - BYTE bSecondLine; -}; - -#define DRAGSTAGE_NOTMOVED 0 -#define DRAGSTAGE_ACTIVE 1 -#define DRAGSTAGEM_STAGE 0x00FF -#define DRAGSTAGEF_MAYBERENAME 0x8000 -#define DRAGSTAGEF_OUTSIDE 0x4000 - -#define FONTID_CONTACTS 0 -#define FONTID_INVIS 1 -#define FONTID_OFFLINE 2 -#define FONTID_NOTONLIST 3 -#define FONTID_GROUPS 4 -#define FONTID_GROUPCOUNTS 5 -#define FONTID_DIVIDERS 6 -#define FONTID_OFFINVIS 7 -#define FONTID_STATUS 8 -#define FONTID_FRAMETITLE 9 -#define FONTID_EVENTAREA 10 -#define FONTID_TIMESTAMP 11 -#define FONTID_LAST FONTID_TIMESTAMP - -struct ClcData : public ClcDataBase -{ - int *row_heights; - int row_heights_size; - int row_heights_allocated; - - int row_border; - int min_row_heigh, group_row_height; - - int currentFontID; - int rightMargin; - BYTE SelectMode; - BYTE isMultiSelect; - HWND hwndParent; - DWORD lastSort; - BOOL bNeedPaint, bisEmbedded, bHideSubcontacts; - DWORD lastRepaint; - BOOL forceScroll; - int oldSelection; -}; - -//#define CLUI_FRAME_SHOWTOPBUTTONS 1 -#define CLUI_FRAME_SHOWBOTTOMBUTTONS 2 -#define CLUI_SHOWCLIENTICONS 4 -#define CLUI_SHOWVISI 8 -#define CLUI_FRAME_CLISTSUNKEN 16 -#define CLUI_SHOWXSTATUS 32 -#define CLUI_FRAME_BUTTONSFLAT 64 -#define CLUI_FRAME_BUTTONSCLASSIC 128 -#define CLUI_USEMETAICONS 256 -#define CLUI_FRAME_AUTOHIDENOTIFY 512 -#define CLUI_FRAME_USEXSTATUSASSTATUS 1024 -#define CLUI_STICKYEVENTS 2048 -#define CLUI_FRAME_SBARSHOW 4096 -#define CLUI_STATUSASTEXT 8192 -#define CLUI_FULLROWSELECT 16384 -#define CLUI_FRAME_EVENTAREASUNKEN 32768 -//#define CLUI_FRAME_BUTTONBARSUNKEN 65536 -#define CLUI_FRAME_AVATARS 0x20000 -#define CLUI_FRAME_AVATARSLEFT 0x40000 -#define CLUI_FRAME_GDIPLUS 0x80000 -#define CLUI_FRAME_AVATARBORDER 0x100000 -#define CLUI_FRAME_STATUSICONS 0x200000 -#define CLUI_FRAME_AVATARSRIGHTWITHNICK 0x400000 -#define CLUI_FRAME_TRANSPARENTAVATAR 0x800000 -#define CLUI_FRAME_ROUNDAVATAR 0x1000000 -#define CLUI_FRAME_ALWAYSALIGNNICK 0x2000000 -#define CLUI_FRAME_AVATARSRIGHT 0x4000000 -#define CLUI_FRAME_SHOWSTATUSMSG 0x8000000 -#define CLUI_FRAME_OVERLAYICONS 0x10000000 -#define CLUI_FRAME_SELECTIVEICONS 0x20000000 -#define CLUI_FRAME_ROUNDEDFRAME 0x40000000 -#define CLUI_FRAME_NOGROUPICON 0x80000000 - -#define MULTIROW_NEVER 0 -#define MULTIROW_ALWAYS 1 -#define MULTIROW_IFSPACE 2 -#define MULTIROW_IFNEEDED 3 - -#define CLUI_USE_FLOATER 1 -#define CLUI_FLOATER_AUTOHIDE 2 -#define CLUI_FLOATER_EVENTS 4 - -#define CLC_GROUPALIGN_LEFT 0 -#define CLC_GROUPALIGN_RIGHT 1 -#define CLC_GROUPALIGN_AUTO 2 - -struct TCluiData { - DWORD dwFlags; - DWORD topOffset, bottomOffset; - int statusBarHeight; - int soundsOff; - BYTE tabSRMM_Avail; - BYTE bMetaAvail; - BYTE bAvatarServiceAvail; - HICON hIconVisible, hIconInvisible, hIconChatactive, hIconConnecting; - DWORD winFlags; - DWORD winFlagsEx; - int notifyActive; - int hIconNotify; - HMENU hMenuNotify; - int iLastEventAdded; - int wNextMenuID; - HANDLE hUpdateContact; - DWORD sortTimer; - TCHAR *szNoEvents; - BOOL forceResize; - BOOL neeedSnap; - COLORREF avatarBorder; - HBRUSH hBrushAvatarBorder, hBrushColorKey; - HBRUSH hBrushCLCBk; - DWORD avatarRadius; - int avatarSize; - BOOL bForceRefetchOnPaint; - BYTE dualRowMode; - BYTE avatarPadding; - BYTE cornerRadius; - BYTE isTransparent; - BYTE alpha, autoalpha; - BYTE fadeinout; - BYTE autosize; - BYTE gapBetweenFrames; - BYTE titleBarHeight; - DWORD dwExtraImageMask; - BYTE bClipBorder, bRowSpacing; - HBITMAP bmpBackground, hbmBgOld, hbmBg; - HDC hdcBg; - HDC hdcPic; - HBITMAP hbmPicOld; - BITMAP bminfoBg; - SIZE dcSize; - POINT ptW; - BOOL bWallpaperMode; - BOOL bNoOfflineAvatars; - BOOL bEventAreaEnabled; - BOOL bFullTransparent; - BOOL bDblClkAvatars; - BOOL bApplyIndentToBg; - BOOL bEqualSections; - DWORD bFilterEffective; - BOOL bCenterStatusIcons; - BOOL bSkinnedToolbar; - BOOL bSkinnedStatusBar; - BOOL bUsePerProto; - BOOL bOverridePerStatusColors; - BOOL bDontSeparateOffline; - TCHAR groupFilter[2048]; - char protoFilter[2048]; - char varFilter[2048]; - DWORD lastMsgFilter; - char current_viewmode[256], old_viewmode[256]; - BYTE boldHideOffline; - DWORD statusMaskFilter; - DWORD stickyMaskFilter; - DWORD filterFlags; - COLORREF colorkey; - char szMetaName[256]; - BOOL bMetaEnabled; - BOOL bSecIMAvail; - BOOL bNoTrayTips; - int exIconScale; - BOOL bShowLocalTime; - BOOL bShowLocalTimeSelective; - BOOL bShowXStatusOnSbar; - BOOL bLayeredHack; - HPEN hPen3DBright, hPen3DDark; - BYTE bSkinnedButtonMode; - BYTE bFirstRun; - BYTE bUseDCMirroring; - BYTE bCLeft, bCRight, bCTop, bCBottom; - BYTE bUseFloater; - BYTE fullyInited; - BYTE bAutoExpandGroups; - SIZE szOldCTreeSize; - BYTE bWantFastGradients, bUseFastGradients; - BYTE sortOrder[3]; - BYTE bGroupAlign; - BYTE bSkinnedScrollbar; - DWORD langPackCP; - BOOL fOnDesktop; - int group_padding; - DWORD t_now; - BYTE exIconOrder[EXICON_COUNT]; - BOOL realTimeSaving; - TCHAR tszProfilePath[MAX_PATH]; - FILETIME ft; - SYSTEMTIME st; -}; - -#define SORTBY_NAME 1 -#define SORTBY_PROTO 2 -#define SORTBY_STATUS 3 -#define SORTBY_LASTMSG 4 -#define SORTBY_FREQUENCY 5 -#define SORTBY_PRIOCONTACTS 6 - -struct IconDesc { - char *szName; - char *szDesc; - int uId; // icon ID -}; - -struct NotifyMenuItemExData { - HANDLE hContact; - int iIcon; // icon index in the image list - HICON hIcon; // corresponding icon handle - HANDLE hDbEvent; -}; - -// #define NOTIFY_HEIGHT 24 - -struct TrayIconInfo { - union { - HICON hIcon; - int iIcon; - }; -}; - -typedef struct { - char protoName[50]; - UINT menuID; - BOOL added; - HICON hIcon; -} protoMenu; - -//clcidents.c -int FindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact **contact, struct ClcGroup **subgroup, int *isVisible); -HANDLE ContactToItemHandle(struct ClcContact *contact, DWORD *nmFlags); - -//clcitems.c -void RebuildEntireList(HWND hwnd, struct ClcData *dat); -void SaveStateAndRebuildList(HWND hwnd, struct ClcData *dat); -DWORD INTSORT_GetLastMsgTime(HANDLE hContact); - -//clcmsgs.c -LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); - -//clcutils.c -void SetGroupExpand(HWND hwnd, struct ClcData *dat, struct ClcGroup *group, int newState); -void DoSelectionDefaultAction(HWND hwnd, struct ClcData *dat); -int FindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk); -void BeginRenameSelection(HWND hwnd, struct ClcData *dat); -int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcContact **contact, struct ClcGroup **group, DWORD *flags); -void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth); -void RecalcScrollBar(HWND hwnd, struct ClcData *dat); -size_t MY_pathToRelative(const TCHAR *pSrc, TCHAR *pOut); -size_t MY_pathToAbsolute(const TCHAR *pSrc, TCHAR *pOut); - -#define DROPTARGET_OUTSIDE 0 -#define DROPTARGET_ONSELF 1 -#define DROPTARGET_ONNOTHING 2 -#define DROPTARGET_ONGROUP 3 -#define DROPTARGET_ONCONTACT 4 -#define DROPTARGET_INSERTION 5 -int GetDropTargetInformation(HWND hwnd, struct ClcData *dat, POINT pt); -void LoadClcOptions(HWND hwnd, struct ClcData *dat); -void RecalculateGroupCheckboxes(HWND hwnd, struct ClcData *dat); -void SetGroupChildCheckboxes(struct ClcGroup *group, int checked); -BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto); -int __fastcall GetStatusOnlineness(int status); -void GetExtendedInfo(struct ClcContact *contact, struct ClcData *dat); -extern LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -void HideShowNotifyFrame(); -DWORD GetCLUIWindowStyle(BYTE style); -void ApplyCLUIBorderStyle(HWND hwnd); - -int FrameNCCalcSize(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BOOL hasTitleBar); -int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BOOL hasTitleBar); - -void FreeProtocolData( void ); - -void GetClientID(struct ClcContact *contact, char *client); -int LoadCLCButtonModule(void); -void SetButtonStates(HWND hwnd); -void ConfigureCLUIGeometry(int mode); -void IcoLibReloadIcons(); -int CompareContacts(const struct ClcContact* p1, const struct ClcContact* p2); -void PaintNotifyArea(HDC hDC, RECT *rc); -int AvatarChanged(WPARAM wParam, LPARAM lParam); -void ConfigureFrame(); -void ConfigureEventArea(HWND hwnd); -void ClearIcons(int mode); -void SkinDrawBg(HWND hwnd, HDC hdc); -int GetBasicFontID(struct ClcContact * contact); -extern int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szStatus, struct ClcData *dat); -void CreateViewModeFrame(); -int GetExtraCache(HANDLE hContact, char *szProto); -void ReloadExtraInfo(HANDLE hContact); -void LoadAvatarForContact(struct ClcContact *p); -void ApplyViewMode(const char *name); -DWORD CalcXMask(HANDLE hContact); -void ClcSetButtonState(int ctrlId, int status); - -//clcpaint.c -void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint); -void __inline PaintItem(HDC hdcMem, struct ClcGroup *group, struct ClcContact *contact, int indent, int y, struct ClcData *dat, int index, HWND hwnd, DWORD style, RECT *clRect, BOOL *bFirstNGdrawn, int groupCountsFontTopShift, int rowHeight); -void Reload3dBevelColors(); -void ReloadThemedOptions(); -void SetButtonToSkinned(); -void RTL_DetectAndSet(struct ClcContact *contact, HANDLE hContact); -void RTL_DetectGroupName(struct ClcContact *group); -void CLN_LoadAllIcons(BOOL mode); -void ReloadSkinItemsToCache(); -void SFL_RegisterWindowClass(), SFL_UnregisterWindowClass(); -void SFL_Create(); -void SFL_Destroy(); -void SFL_SetState(int iMode); -void SFL_SetSize(); -void SFL_PaintNotifyArea(); -void SFL_Update(HICON hIcon, int iIcon, HIMAGELIST hIml, const TCHAR *szText, BOOL refresh); - -void FLT_Update(struct ClcData *dat, struct ClcContact *contact); -int FLT_CheckAvail(); -void FLT_Create(int iEntry); -void FLT_SetSize(struct TExtraCache *centry, LONG width, LONG height); -void FLT_SyncWithClist(); -void FLT_ReadOptions(), FLT_WriteOptions(), FLT_RefreshAll(); - -//clcopts.c -int ClcOptInit(WPARAM wParam, LPARAM lParam); -DWORD GetDefaultExStyle(void); -void GetFontSetting(int i, LOGFONTA *lf, COLORREF *colour); -void CluiProtocolStatusChanged( int parStatus, const char* szProto ); - -void LoadSkinItemToCache(struct TExtraCache *cEntry, const char *szProto); - -// debugging support - -void _DebugTraceW(const wchar_t *fmt, ...); -#ifdef _CLN_GDIP -extern "C" void _DebugTraceA(const char *fmt, ...); -#else -void _DebugTraceA(const char *fmt, ...); -#endif - -// Docking.c - -int Docking_IsDocked(WPARAM wParam, LPARAM lParam); - -// Buttons - -#define BUTTONSETIMLICON (WM_USER+20) -#define BUTTONSETSKINNED (WM_USER+21) -#define BUTTONSETASMENUACTION (WM_USER+22) -#define BUTTONSETBTNITEM (WM_USER+23) - -// Menus - -void IMG_DeleteItems(); -int CoolSB_SetupScrollBar(); - -#define NIIF_INTERN_UNICODE 0x00000100 - -#define SETTING_WINDOWSTYLE_DEFAULT 0 - -#define SETTING_TRAYICON_SINGLE 0 -#define SETTING_TRAYICON_CYCLE 1 -#define SETTING_TRAYICON_MULTI 2 - -#define SETTING_STATE_HIDDEN 0 -#define SETTING_STATE_MINIMIZED 1 -#define SETTING_STATE_NORMAL 2 - -#define SETTING_BRINGTOFRONT_DEFAULT 0 - -#define SETTING_WINDOWSTYLE_TOOLWINDOW 1 -#define SETTING_WINDOWSTYLE_THINBORDER 2 -#define SETTING_WINDOWSTYLE_NOBORDER 3 - -#define EIMG_SHOW_RES0 8 -#define EIMG_SHOW_EMAIL 1 -#define EIMG_SHOW_WEB 2 -#define EIMG_SHOW_SMS 4 -#define EIMG_SHOW_ADV1 16 -#define EIMG_SHOW_ADV2 32 -#define EIMG_SHOW_ADV3 512 -#define EIMG_SHOW_CLIENT 64 -#define EIMG_SHOW_ADV4 1024 -#define EIMG_SHOW_RES1 128 -#define EIMG_SHOW_RES2 256 - -#define CLCHT_ONITEMEXTRAEX 0x1000 //on an extra icon, HIBYTE(HIWORD()) says which -#define CLCHT_ONAVATAR 0x2000 -#define CLCHT_ONITEMSPACE 0x4000 - -#define CLM_SETEXTRAIMAGEINT (CLM_FIRST+101) -#define CLM_SETSTICKY (CLM_FIRST+100) -#define CLM_ISMULTISELECT (CLM_FIRST+102) -#define CLM_SETEXTRAIMAGEINTMETA (CLM_FIRST+104) -#define CLM_GETSTATUSMSG (CLM_FIRST+105) -#define CLM_SETHIDESUBCONTACTS (CLM_FIRST+106) -#define CLM_TOGGLEPRIORITYCONTACT (CLM_FIRST+107) -#define CLM_QUERYPRIORITYCONTACT (CLM_FIRST+108) -#define CLM_TOGGLEFLOATINGCONTACT (CLM_FIRST+109) -#define CLM_QUERYFLOATINGCONTACT (CLM_FIRST+110) - -#define IDC_RESETMODES 110 -#define IDC_SELECTMODE 108 -#define IDC_CONFIGUREMODES 109 - -#define NR_CLIENTS 40 - -typedef BOOL (WINAPI *PGF)(HDC, PTRIVERTEX, ULONG, PVOID, ULONG, ULONG); - -/* - * floating stuff - */ - -#define FLT_SIMPLE 1 -#define FLT_AVATARS 2 -#define FLT_DUALROW 4 -#define FLT_EXTRAICONS 8 -#define FLT_SYNCWITHCLIST 16 -#define FLT_AUTOHIDE 32 -#define FLT_SNAP 64 -#define FLT_BORDER 128 -#define FLT_ROUNDED 256 -#define FLT_FILLSTDCOLOR 512 -#define FLT_SHOWTOOLTIPS 1024 - -typedef struct _floatopts { - DWORD dwFlags; - BYTE pad_left, pad_right, pad_top, pad_bottom; - DWORD width; - COLORREF border_colour; - BYTE trans, act_trans; - BYTE radius; - BYTE enabled; - BYTE def_hover_time; - WORD hover_time; -} FLOATINGOPTIONS; - -extern FLOATINGOPTIONS g_floatoptions; - - diff --git a/plugins/Clist_nicer/INCLUDE/clist.h b/plugins/Clist_nicer/INCLUDE/clist.h deleted file mode 100644 index 1969039350..0000000000 --- a/plugins/Clist_nicer/INCLUDE/clist.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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. -*/ -void LoadContactTree(void); -int IconFromStatusMode(const char *szProto, int status, HANDLE hContact, HICON *phIcon); -HTREEITEM GetTreeItemByHContact(HANDLE hContact); -void SortContacts(void); - -#define CLUIINTM_REDRAW (WM_USER+100) -#define CLUIINTM_STATUSBARUPDATE (WM_USER+101) -#define CLUIINTM_REMOVEFROMTASKBAR (WM_USER+102) - -#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_MODULE "CLVM_W" diff --git a/plugins/Clist_nicer/INCLUDE/commonheaders.h b/plugins/Clist_nicer/INCLUDE/commonheaders.h deleted file mode 100644 index 91de256f0a..0000000000 --- a/plugins/Clist_nicer/INCLUDE/commonheaders.h +++ /dev/null @@ -1,224 +0,0 @@ -/* - * astyle --force-indent=tab=4 --brackets=linux --indent-switches - * --pad=oper --one-line=keep-blocks --unpad=paren - * - * Miranda IM: the free IM client for Microsoft* Windows* - * - * Copyright 2000-2010 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. - * - * part of clist_nicer plugin for Miranda. - * - * (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors - * - * $Id: commonheaders.h 14157 2012-03-10 18:53:26Z george.hazan $ - * - */ - -#define MIRANDA_VER 0x0A00 - -#define _WIN32_WINNT 0x0501 -#define _WIN32_IE 0x0501 - -#define _CRT_SECURE_NO_WARNINGS -#define EXTRA_ICON_COUNT 11 - -#undef FASTCALL - -#define TSAPI __stdcall -#define FASTCALL __fastcall - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" -#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 "extbackg.h" -#include "clc.h" -#include - - -#include "clist.h" -#include "alphablend.h" -#include "rowheight_funcs.h" - - /* - * text shadow types (DrawThemeTextEx() / Vista+ uxtheme) - */ - #define TST_NONE 0 - #define TST_SINGLE 1 - #define TST_CONTINUOUS 2 - - typedef struct _DWM_THUMBNAIL_PROPERTIES - { - DWORD dwFlags; - RECT rcDestination; - RECT rcSource; - BYTE opacity; - BOOL fVisible; - BOOL fSourceClientAreaOnly; - } DWM_THUMBNAIL_PROPERTIES, *PDWM_THUMBNAIL_PROPERTIES; - - enum DWMWINDOWATTRIBUTE - { - DWMWA_NCRENDERING_ENABLED = 1, // [get] Is non-client rendering enabled/disabled - DWMWA_NCRENDERING_POLICY, // [set] Non-client rendering policy - DWMWA_TRANSITIONS_FORCEDISABLED, // [set] Potentially enable/forcibly disable transitions - DWMWA_ALLOW_NCPAINT, // [set] Allow contents rendered in the non-client area to be visible on the DWM-drawn frame. - DWMWA_CAPTION_BUTTON_BOUNDS, // [get] Bounds of the caption button area in window-relative space. - DWMWA_NONCLIENT_RTL_LAYOUT, // [set] Is non-client content RTL mirrored - DWMWA_FORCE_ICONIC_REPRESENTATION, // [set] Force this window to display iconic thumbnails. - DWMWA_FLIP3D_POLICY, // [set] Designates how Flip3D will treat the window. - DWMWA_EXTENDED_FRAME_BOUNDS, // [get] Gets the extended frame bounds rectangle in screen space - DWMWA_HAS_ICONIC_BITMAP, // [set] Indicates an available bitmap when there is no better thumbnail representation. - DWMWA_DISALLOW_PEEK, // [set] Don't invoke Peek on the window. - DWMWA_EXCLUDED_FROM_PEEK, // [set] LivePreview exclusion information - DWMWA_LAST - }; - - #define DWM_TNP_RECTDESTINATION 0x00000001 - #define DWM_TNP_RECTSOURCE 0x00000002 - #define DWM_TNP_OPACITY 0x00000004 - #define DWM_TNP_VISIBLE 0x00000008 - #define DWM_TNP_SOURCECLIENTAREAONLY 0x00000010 - - #define DWM_SIT_DISPLAYFRAME 0x00000001 // Display a window frame around the provided bitmap - - typedef HANDLE HTHUMBNAIL; - typedef HTHUMBNAIL* PHTHUMBNAIL; - -#ifndef BPPF_ERASE - typedef enum _BP_BUFFERFORMAT - { - BPBF_COMPATIBLEBITMAP, // Compatible bitmap - BPBF_DIB, // Device-independent bitmap - BPBF_TOPDOWNDIB, // Top-down device-independent bitmap - BPBF_TOPDOWNMONODIB // Top-down monochrome device-independent bitmap - } BP_BUFFERFORMAT; - - - typedef struct _BP_PAINTPARAMS - { - DWORD cbSize; - DWORD dwFlags; // BPPF_ flags - const RECT * prcExclude; - const BLENDFUNCTION * pBlendFunction; - } BP_PAINTPARAMS, *PBP_PAINTPARAMS; - - #define BPPF_ERASE 1 - #define BPPF_NOCLIP 2 - #define BPPF_NONCLIENT 4 -#endif - - typedef struct _DWM_BLURBEHIND - { - DWORD dwFlags; - BOOL fEnable; - HRGN hRgnBlur; - BOOL fTransitionOnMaximized; - } DWM_BLURBEHIND, *PDWM_BLURBEHIND; - - #define DWM_BB_ENABLE 1 - -#ifndef LOCALE_SISO3166CTRYNAME2 - #define LOCALE_SISO3166CTRYNAME2 0x00000068 // 3 character ISO country name, eg "USA Vista+ - #define LOCALE_SISO639LANGNAME2 0x00000067 // 3 character ISO abbreviated language name, eg "eng" -#endif - -#ifndef WM_DWMCOMPOSITIONCHANGED - #define WM_DWMCOMPOSITIONCHANGED 0x031E - #define WM_DWMCOLORIZATIONCOLORCHANGED 0x0320 -#endif - -#ifndef WM_DWMSENDICONICTHUMBNAIL - #define WM_DWMSENDICONICTHUMBNAIL 0x0323 - #define WM_DWMSENDICONICLIVEPREVIEWBITMAP 0x0326 -#endif - -// shared vars -extern HINSTANCE g_hInst; -extern LONG g_cxsmIcon, g_cysmIcon; -extern StatusItems_t *StatusItems; -extern ImageItem *g_glyphItem; - -/* most free()'s are invalid when the code is executed from a dll, so this changes - all the bad free()'s to good ones, however it's still incorrect code. The reasons for not - changing them include: - - * DBFreeVariant has a CallService() lookup - * free() is executed in some large loops to do with clist creation of group data - * easy search and replace - -*/ - -#define MAX_REGS(_A_) (sizeof(_A_)/sizeof(_A_[0])) - -typedef int (__cdecl *pfnDrawAvatar)(HDC hdcOrig, HDC hdcMem, RECT *rc, struct ClcContact *contact, int y, struct ClcData *dat, int selected, WORD cstatus, int rowHeight); - -#define safe_sizeof(a) (sizeof((a)) / sizeof((a)[0])) - -BOOL __forceinline GetItemByStatus(int status, StatusItems_t *retitem); - -void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor2, BOOL transparent, BYTE FLG_GRADIENT, BYTE FLG_CORNER, DWORD BORDERSTYLE, ImageItem *item); - -void CustomizeButton(HWND hWnd, bool bIsSkinned, bool bIsThemed, bool bIsFlat); - -void FreeAndNil( void** ); - -#if _MSC_VER >= 1500 - #define wEffects wReserved -#endif diff --git a/plugins/Clist_nicer/INCLUDE/config.h b/plugins/Clist_nicer/INCLUDE/config.h deleted file mode 100644 index 4ee9983798..0000000000 --- a/plugins/Clist_nicer/INCLUDE/config.h +++ /dev/null @@ -1,209 +0,0 @@ -/* - * astyle --force-indent=tab=4 --brackets=linux --indent-switches - * --pad=oper --one-line=keep-blocks --unpad=paren - * - * Miranda IM: the free IM client for Microsoft* Windows* - * - * Copyright 2000-2010 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. - * - * part of clist_nicer plugin for Miranda. - * - * (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors - * - * $Id: config.h 12709 2010-09-16 12:06:06Z borkra $ - * - */ - -#include - -#ifndef __CONFIG_H_ -#define __CONFIG_H_ - -#define DEFAULT_MODULE "Clist" - -#define IS_THEMED (API::sysState.isThemed) -#define IS_AERO (API::sysState.isAero) - -typedef int (__cdecl *pfnDrawAvatar)(HDC hdcOrig, HDC hdcMem, RECT *rc, struct ClcContact *contact, int y, struct ClcData *dat, int selected, WORD cstatus, int rowHeight); -typedef BOOL (WINAPI *pfnSetLayeredWindowAttributes_t)(HWND, COLORREF, BYTE, DWORD); -typedef BOOL (WINAPI *pfnUpdateLayeredWindow_t)(HWND, HDC, POINT *, SIZE *, HDC, POINT *, COLORREF, BLENDFUNCTION *, DWORD); -typedef HMONITOR (WINAPI *pfnMonitorFromPoint_t)(POINT,DWORD); -typedef HMONITOR (WINAPI *pfnMonitorFromWindow_t)(HWND,DWORD); -typedef BOOL (WINAPI *pfnGetMonitorInfo_t)(HMONITOR,LPMONITORINFO); -typedef BOOL (WINAPI *pfnTrackMouseEvent_t)(LPTRACKMOUSEEVENT); -typedef DWORD (WINAPI *pfnSetLayout_t )(HDC, DWORD); -typedef void (__cdecl *pfnDrawAlpha_t)(HDC hdcwnd, PRECT rc, DWORD basecolor, BYTE alpha, DWORD basecolor2, BOOL transparent, DWORD FLG_GRADIENT, DWORD FLG_CORNER, DWORD BORDERSTYLE, ImageItem *item); -typedef BOOL (WINAPI *pfnAlphaBlend_t)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION); - -typedef BOOL (WINAPI *pfnIsThemeActive_t)(); -typedef HANDLE (WINAPI *pfnOpenThemeData_t)(HWND, LPCWSTR); -typedef UINT (WINAPI *pfnDrawThemeBackground_t)(HANDLE, HDC, int, int, RECT *, RECT *); -typedef UINT (WINAPI *pfnCloseThemeData_t)(HANDLE); -typedef UINT (WINAPI *pfnDrawThemeText_t)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, DWORD, RECT *); -typedef UINT (WINAPI *pfnDrawThemeTextEx_t)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, RECT *, const DTTOPTS *); -typedef BOOL (WINAPI *pfnIsThemeBackgroundPartiallyTransparent_t)(HANDLE, int, int); -typedef HRESULT (WINAPI *pfnDrawThemeParentBackground_t)(HWND, HDC, RECT *); -typedef HRESULT (WINAPI *pfnGetThemeBackgroundContentRect_t)(HANDLE, HDC, int, int, const RECT *, const RECT *); -typedef BOOL (WINAPI *pfnEnableThemeDialogTexture_t)(HANDLE, DWORD); -typedef HRESULT (WINAPI *pfnDwmExtendFrameIntoClientArea_t)(HWND hwnd, const MARGINS *margins); -typedef HRESULT (WINAPI *pfnDwmIsCompositionEnabled_t)(BOOL *); - -class CRTException : public std::runtime_error -{ -public: - CRTException(const char *szMsg, const TCHAR *szParam); - ~CRTException() {} - - void display() const; - -private: - TCHAR m_szParam[MAX_PATH]; -}; - -class cfg -{ -public: - static void init (); - - static DWORD getDword (const HANDLE hContact, const char *szModule, const char *szSetting, DWORD uDefault); - static DWORD getDword (const char *szModule, const char *szSetting, DWORD uDefault); - static DWORD getDword (const char *szSetting, DWORD uDefault); - - static WORD getWord (const HANDLE hContact, const char *szModule, const char *szSetting, WORD uDefault); - static WORD getWord (const char *szModule, const char *szSetting, WORD uDefault); - static WORD getWord (const char *szSetting, WORD uDefault); - - static int getByte (const HANDLE hContact, const char *szModule, const char *szSetting, int uDefault); - static int getByte (const char *szModule, const char *szSetting, int uDefault); - static int getByte (const char *szSetting, int uDefault); - - static INT_PTR getTString (const HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); - static INT_PTR getString (const HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); - - static INT_PTR writeDword (const HANDLE hContact, const char *szModule, const char *szSetting, DWORD value); - static INT_PTR writeDword (const char *szModule, const char *szSetting, DWORD value); - - static INT_PTR writeWord (const HANDLE hContact, const char *szModule, const char *szSetting, WORD value); - static INT_PTR writeWord (const char *szModule, const char *szSetting, WORD value); - - static INT_PTR writeByte (const HANDLE hContact, const char *szModule, const char *szSetting, BYTE value); - static INT_PTR writeByte (const char *szModule, const char *szSetting, BYTE value); - - static INT_PTR writeTString (const HANDLE hContact, const char *szModule, const char *szSetting, const TCHAR *st); - static INT_PTR writeString (const HANDLE hContact, const char *szModule, const char *szSetting, const char *st); - static int getCache (const HANDLE hContact, const char *szProto); - -public: - static TCluiData dat; - static ClcData* clcdat; - static TExtraCache* eCache; - static int nextCacheEntry, maxCacheEntry; - - static CRITICAL_SECTION cachecs; - - static bool shutDown; -}; - -struct TSysConfig { - bool isVistaPlus; - bool isSevenPlus; - bool isXPPlus; - bool uxThemeValid; - bool isWin2KPlus; -}; - -struct TSysState { - bool isThemed; - bool isAero; - bool isDwmActive; -}; - -class API -{ -public: - static void onInit (); - static void onUnload (); - static void updateState (); - - static void Ex_CopyEditToClipboard (HWND hWnd); - static INT_PTR CALLBACK Ex_DlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - static void Ex_Handler (); - static int Ex_ShowDialog (EXCEPTION_POINTERS *ep, const char *szFile, int line, TCHAR* szReason, bool fAllowContinue); - - - /* - * helpers - */ - - static BOOL SetLayeredWindowAttributes(HWND hWnd, COLORREF clr, BYTE alpha, DWORD dwFlags); - - static pfnSetLayeredWindowAttributes_t pfnSetLayeredWindowAttributes; - static pfnUpdateLayeredWindow_t pfnUpdateLayeredWindow; - static pfnMonitorFromPoint_t pfnMonitorFromPoint; - static pfnMonitorFromWindow_t pfnMonitorFromWindow; - static pfnGetMonitorInfo_t pfnGetMonitorInfo; - static pfnTrackMouseEvent_t pfnTrackMouseEvent; - // static pfnDrawAlpha_t pfnDrawAlpha; - static pfnSetLayout_t pfnSetLayout; - static PGF pfnGradientFill; - static pfnAlphaBlend_t pfnAlphaBlend; - - /* - * uxtheme - */ - - static pfnIsThemeActive_t pfnIsThemeActive; - static pfnOpenThemeData_t pfnOpenThemeData; - static pfnDrawThemeBackground_t pfnDrawThemeBackground; - static pfnCloseThemeData_t pfnCloseThemeData; - static pfnDrawThemeText_t pfnDrawThemeText; - static pfnDrawThemeTextEx_t pfnDrawThemeTextEx; - static pfnIsThemeBackgroundPartiallyTransparent_t pfnIsThemeBackgroundPartiallyTransparent; - static pfnDrawThemeParentBackground_t pfnDrawThemeParentBackground; - static pfnGetThemeBackgroundContentRect_t pfnGetThemeBackgroundContentRect; - static pfnEnableThemeDialogTexture_t pfnEnableThemeDialogTexture; - - static pfnDwmExtendFrameIntoClientArea_t pfnDwmExtendFrameIntoClientArea; - static pfnDwmIsCompositionEnabled_t pfnDwmIsCompositionEnabled; - - static TSysConfig sysConfig; - static TSysState sysState; - - static EXCEPTION_RECORD exRecord; - static CONTEXT exCtx; - static LRESULT exLastResult; - static char exSzFile[MAX_PATH]; - static TCHAR exReason[256]; - static int exLine; - static bool exAllowContinue; - - static HMODULE hUxTheme, hDwm; -}; - - -class Utils -{ -public: - static void TSAPI enableDlgControl(const HWND hwnd, UINT id, BOOL fEnable); - static void TSAPI showDlgControl(const HWND hwnd, UINT id, int showCmd); - static HMODULE loadSystemLibrary(const TCHAR* szFilename, bool useGetHandle = false); - -}; - -#endif /* __CONFIG_H_*/ diff --git a/plugins/Clist_nicer/INCLUDE/extBackg.h b/plugins/Clist_nicer/INCLUDE/extBackg.h deleted file mode 100644 index 53450dcc0b..0000000000 --- a/plugins/Clist_nicer/INCLUDE/extBackg.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 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. -*/ - -#define ID_EXTBKIDLE 40081 -#define ID_EXTBKEXPANDEDGROUP 40082 -#define ID_EXTBKCOLLAPSEDDGROUP 40083 -#define ID_EXTBKEMPTYGROUPS 40084 -#define ID_EXTBKFIRSTITEM 40085 -#define ID_EXTBKSINGLEITEM 40086 -#define ID_EXTBKLASTITEM 40087 - - -#define ID_EXTBKFIRSTITEM_NG 40088 -#define ID_EXTBKSINGLEITEM_NG 40089 -#define ID_EXTBKLASTITEM_NG 40090 - -#define ID_EXTBKEVEN_CNTCTPOS 40091 -#define ID_EXTBKODD_CNTCTPOS 40092 - -#define ID_EXTBKSELECTION 40093 -#define ID_EXTBKHOTTRACK 40094 -#define ID_EXTBKFRAMETITLE 40095 -#define ID_EXTBKEVTAREA 40096 -#define ID_EXTBKSTATUSBAR 40097 -#define ID_EXTBKBUTTONBAR 40098 -#define ID_EXTBKBUTTONSPRESSED 40099 -#define ID_EXTBKBUTTONSNPRESSED 40100 -#define ID_EXTBKBUTTONSMOUSEOVER 40101 -#define ID_EXTBKTBBUTTONSPRESSED 40102 -#define ID_EXTBKTBBUTTONSNPRESSED 40103 -#define ID_EXTBKTBBUTTONMOUSEOVER 40104 -#define ID_EXTBKSTATUSFLOATER 40105 -#define ID_EXTBKOWNEDFRAMEBORDER 40106 -#define ID_EXTBKOWNEDFRAMEBORDERTB 40107 -#define ID_EXTBKAVATARFRAME 40108 -#define ID_EXTBKAVATARFRAMEOFFLINE 40109 -#define ID_EXTBKSCROLLBACK 40110 -#define ID_EXTBKSCROLLBACKLOWER 40111 -#define ID_EXTBKSCROLLTHUMB 40112 -#define ID_EXTBKSCROLLTHUMBHOVER 40113 -#define ID_EXTBKSCROLLTHUMBPRESSED 40114 -#define ID_EXTBKSCROLLBUTTON 40115 -#define ID_EXTBKSCROLLBUTTONHOVER 40116 -#define ID_EXTBKSCROLLBUTTONPRESSED 40117 -#define ID_EXTBKSCROLLARROWUP 40118 -#define ID_EXTBKSCROLLARROWDOWN 40119 -#define ID_EXTBK_LAST_D 40119 - -#define ID_EXTBKSEPARATOR 40200 - -BOOL CheckItem(int item, HWND hwndDlg); -BOOL isValidItem(void); -void extbk_export(char *file); -void extbk_import(char *file, HWND hwndDlg); - -void LoadExtBkSettingsFromDB(); -void IMG_LoadItems(); -void __fastcall IMG_RenderImageItem(HDC hdc, ImageItem *item, RECT *rc); -void IMG_InitDecoder(); -void LoadPerContactSkins(TCHAR *file); - -static void SaveCompleteStructToDB(); -StatusItems_t *GetProtocolStatusItem(const char *szProto); - -void OnListItemsChange(HWND hwndDlg); - -void UpdateStatusStructSettingsFromOptDlg(HWND hwndDlg, int index); - -void SaveNonStatusItemsSettings(HWND hwndDlg); - -void FillItemList(HWND hwndDlg); -void FillOptionDialogByCurrentSel(HWND hwndDlg); -void ReActiveCombo(HWND hwndDlg); -//BOOL __fastcall GetItemByStatus(int status, StatusItems_t *retitem); - -void FillOptionDialogByStatusItem(HWND hwndDlg, StatusItems_t *item); - diff --git a/plugins/Clist_nicer/INCLUDE/m_cln_skinedit.h b/plugins/Clist_nicer/INCLUDE/m_cln_skinedit.h deleted file mode 100644 index a1e69bb6e1..0000000000 --- a/plugins/Clist_nicer/INCLUDE/m_cln_skinedit.h +++ /dev/null @@ -1,174 +0,0 @@ - -/* - * services - */ - -#define MS_CLNSE_INVOKE "CLN_Skinedit/Invoke" -#define MS_CLNSE_FILLBYCURRENTSEL "CLN_Skinedit/FillByCurrentSel" - -/* - * data structs - */ - -typedef struct _tagImageItem { - char szName[40]; - HBITMAP hbm; - BYTE bLeft, bRight, bTop, bBottom; // sizing margins - BYTE alpha; - DWORD dwFlags; - HDC hdc; - HBITMAP hbmOld; - LONG inner_height, inner_width; - LONG width, height; - BLENDFUNCTION bf; - BYTE bStretch; - HBRUSH fillBrush; - LONG glyphMetrics[4]; - struct _tagImageItem *nextItem; -} ImageItem; - -typedef struct _tagButtonItem { - char szName[40]; - HWND hWnd; - LONG xOff, yOff; - LONG width, height; - ImageItem *imgNormal, *imgPressed, *imgHover; - LONG normalGlyphMetrics[4]; - LONG hoverGlyphMetrics[4]; - LONG pressedGlyphMetrics[4]; - DWORD dwFlags, dwStockFlags; - DWORD uId; - TCHAR szTip[256]; - char szService[256]; - char szModule[256], szSetting[256]; - BYTE bValuePush[256], bValueRelease[256]; - DWORD type; - void (*pfnAction)(struct _tagButtonItem *item, HWND hwndDlg, struct MessageWindowData *dat, HWND hwndItem); - void (*pfnCallback)(struct _tagButtonItem *item, HWND hwndDlg, struct MessageWindowData *dat, HWND hwndItem); - TCHAR tszLabel[40]; - struct _tagButtonItem *nextItem; -} ButtonItem; - -typedef struct _tagButtonSet { - ButtonItem *items; - LONG left, top, right, bottom; // client area offsets, calculated from button layout -} ButtonSet; - -typedef struct { - char szName[40]; - char szDBname[40]; - int statusID; - - BYTE GRADIENT; - BYTE CORNER; - - DWORD COLOR; - DWORD COLOR2; - - BYTE COLOR2_TRANSPARENT; - - DWORD TEXTCOLOR; - - int ALPHA; - - int MARGIN_LEFT; - int MARGIN_TOP; - int MARGIN_RIGHT; - int MARGIN_BOTTOM; - BYTE IGNORED; - DWORD BORDERSTYLE; - ImageItem *imageItem; -} StatusItems_t; - -typedef struct { - BOOL bGRADIENT; - BOOL bCORNER; - BOOL bCOLOR; - BOOL bCOLOR2; - BOOL bCOLOR2_TRANSPARENT; - BOOL bTEXTCOLOR; - BOOL bALPHA; - BOOL bMARGIN_LEFT; - BOOL bMARGIN_TOP; - BOOL bMARGIN_RIGHT; - BOOL bMARGIN_BOTTOM; - BOOL bIGNORED; - BOOL bBORDERSTYLE; -} ChangedSItems_t; - -typedef struct _tagSkinDescription { - DWORD cbSize; - StatusItems_t *StatusItems; - int lastItem; - int firstItem; - char szModule[100]; - HWND hWndParent, hWndTab; - HWND hwndCLUI; - HWND hwndSkinEdit; /* out param */ - HWND hwndImageEdit; /* out param */ - HMENU hMenuItems; - void (*pfnSaveCompleteStruct)(void); - void (*pfnClcOptionsChanged )(void); - void* (*pfnMalloc)(unsigned int); - void (*pfnFree)(void); - void* (*pfnRealloc)(void *, unsigned int); - void* reserved[20]; -} SKINDESCRIPTION; - -// defines - -// FLAGS -#define CORNER_NONE 0 -#define CORNER_ACTIVE 1 -#define CORNER_TL 2 -#define CORNER_TR 4 -#define CORNER_BR 8 -#define CORNER_BL 16 - -#define GRADIENT_NONE 0 -#define GRADIENT_ACTIVE 1 -#define GRADIENT_LR 2 -#define GRADIENT_RL 4 -#define GRADIENT_TB 8 -#define GRADIENT_BT 16 - -#define IMAGE_PERPIXEL_ALPHA 1 -#define IMAGE_FLAG_DIVIDED 2 -#define IMAGE_FILLSOLID 4 -#define IMAGE_GLYPH 8 - -#define IMAGE_STRETCH_V 1 -#define IMAGE_STRETCH_H 2 -#define IMAGE_STRETCH_B 4 - -#define BUTTON_ISINTERNAL 1 -#define BUTTON_ISTOGGLE 2 -#define BUTTON_ISSERVICE 4 -#define BUTTON_ISPROTOSERVICE 8 -#define BUTTON_PASSHCONTACTW 16 -#define BUTTON_PASSHCONTACTL 32 -#define BUTTON_ISDBACTION 64 -#define BUTTON_ISCONTACTDBACTION 128 -#define BUTTON_DBACTIONONCONTACT 256 -#define BUTTON_ISSIDEBAR 512 -#define BUTTON_NORMALGLYPHISICON 1024 -#define BUTTON_PRESSEDGLYPHISICON 2048 -#define BUTTON_HOVERGLYPHISICON 4096 -#define BUTTON_HASLABEL 8192 - -#define CLCDEFAULT_GRADIENT 0 -#define CLCDEFAULT_CORNER 0 - -#define CLCDEFAULT_COLOR 0xd0d0d0 -#define CLCDEFAULT_COLOR2 0xd0d0d0 - -#define CLCDEFAULT_TEXTCOLOR 0x000000 - -#define CLCDEFAULT_COLOR2_TRANSPARENT 1 - -#define CLCDEFAULT_ALPHA 100 -#define CLCDEFAULT_MRGN_LEFT 0 -#define CLCDEFAULT_MRGN_TOP 0 -#define CLCDEFAULT_MRGN_RIGHT 0 -#define CLCDEFAULT_MRGN_BOTTOM 0 -#define CLCDEFAULT_IGNORE 1 diff --git a/plugins/Clist_nicer/INCLUDE/resource.h b/plugins/Clist_nicer/INCLUDE/resource.h deleted file mode 100644 index a2b1f5a072..0000000000 --- a/plugins/Clist_nicer/INCLUDE/resource.h +++ /dev/null @@ -1,416 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by D:\Develop\miranda\plugins\miranda\miranda\plugins\clist_nicer\resource.rc -// -#define IDD_OPT_VIEWMODES 1 -#define IDD_OPT_FLOATING 3 -#define IDD_OPT_SKIN 4 -#define IDD_QUICKIGNORE 5 -#define IDD_OPT 6 -#define IDD_EXCEPTION 20 -#define IDD_OPTIONSDIALOG 101 -#define IDD_CLNABOUT 102 -#define IDD_OPT_CLIST 126 -#define IDI_NOTICK 143 -#define IDI_TICK 146 -#define IDI_OPTIONS 163 -#define IDI_RENAME 173 -#define IDI_DELETE 175 -#define IDI_CLVM_OPTIONS 176 -#define IDI_CLVM_SELECT 177 -#define IDR_CONTEXT 180 -#define IDC_DROP 183 -#define IDR_CLISTMENU 199 -#define IDI_BLANK 200 -#define IDI_ADDCONTACT 210 -#define IDC_HYPERLINKHAND 214 -#define IDC_DROPUSER 215 -#define IDD_OPT_CLUI 218 -#define IDD_OPT_XICONS 219 -#define IDD_OPT_CLC 228 -#define IDD_OPT_CLCBKG 230 -#define IDD_OPT_SBAR 234 -#define IDD_DELETECONTACT 254 -#define IDD_OPT_DSPPROFILES 300 -#define IDD_OPT_DSPADVANCED 301 -#define IDD_OPT_DSPITEMS 302 -#define IDD_OPT_DSPGROUPS 303 -#define IDC_ACTIVEPERC 1000 -#define IDC_OPTIONSTAB 1000 -#define IDC_ALWAYSSTATUS 1009 -#define IDC_APPLY 1011 -#define IDC_AUTOSIZE 1013 -#define IDC_AUTOSIZEUPWARD 1014 -#define IDC_AVATARSIZESPIN 1015 -#define IDC_SKINMODE 1020 -#define IDC_FULLTRANSPARENT 1020 -#define IDC_STATUSICONSCENTERED 1020 -#define IDC_NOTRAYINFOTIPS 1020 -#define IDC_SHOWXSTATUS 1020 -#define IDC_AUTOCLEAR 1020 -#define IDC_FLT_SIMPLELAYOUT 1020 -#define IDC_USESKIN 1020 -#define IDC_IGN_MSGEVENTS 1020 -#define IDC_AUTOCLEARVAL 1021 -#define IDC_MARKLOCKED 1021 -#define IDC_IGN_FILEEVENTS 1021 -#define IDC_AUTOCLEARSPIN 1022 -#define IDC_IGN_URLEVENTS 1022 -#define IDC_LASTMSG 1023 -#define IDC_IGN_AUTH 1023 -#define IDC_IGN_ADD 1024 -#define IDC_CONFIRMDELETE 1025 -#define IDC_IGN_ONLINE 1025 -#define IDC_IGN_ALWAYSONLINE 1026 -#define IDC_IGN_ALWAYSOFFLINE 1027 -#define IDC_IGN_PRIORITY 1028 -#define IDC_DISABLEGROUPS 1030 -#define IDC_DROPSHADOW 1035 -#define IDC_EQUALSELECTION 1040 -#define IDC_USEPERPROTO 1041 -#define IDC_OVERRIDEPERSTATUSCOLOR 1042 -#define IDC_EVENTAREASUNKEN 1043 -#define IDC_SETALLBUTTONSKINNED 1043 -#define IDC_EVENTSONTOP 1044 -#define IDC_FASTGRADIENT 1044 -#define IDC_EXTRA_ICON_EMAIL 1045 -#define IDC_DONTSEPARATE 1045 -#define IDC_EXTRA_ICON_SMS 1047 -#define IDC_EXTRA_ICON_RES0 1054 -#define IDC_EXTRA_ICON_WEB 1055 -#define IDC_FADEINOUT 1056 -#define IDC_EXTRA_ICON_ADV2 1057 -#define IDC_EXTRA_ICON_RES1 1058 -#define IDC_EXTRA_ICON_RES2 1059 -#define IDC_EXTRA_ICON_ADV3 1060 -#define IDC_EXTRAORDER 1061 -#define IDC_FRAMEGAP 1064 -#define IDC_FRAMEGAPSPIN 1065 -#define IDC_CLIPBORDER 1066 -#define IDC_FULLROWSELECT 1067 -#define IDC_CLIPBORDERSPIN 1067 -#define IDC_LOCALTIME 1068 -#define IDC_EXICONSCALE 1068 -#define IDC_EXICONSCALESPIN 1069 -#define IDC_CLEFT 1070 -#define IDC_CLEFTSPIN 1071 -#define IDC_GREYOUT 1072 -#define IDC_CTOP 1072 -#define IDC_ONTOP 1074 -#define IDC_SHOWMAINMENU 1075 -#define IDC_CLIENTDRAG 1076 -#define IDC_HIDEEMPTYGROUPS 1077 -#define IDC_CTOPSPIN 1077 -#define IDC_CBOTTOM 1078 -#define IDC_CBOTTOMSPIN 1079 -#define IDC_CRIGHT 1080 -#define IDC_HIDEOFFLINE 1081 -#define IDC_CRIGHTSPIN 1081 -#define IDC_HIDEOFFLINEOPTS 1082 -#define IDC_EXTRA_ICON_ADV4 1085 -#define IDC_LEFTMARGINSPIN 1092 -#define IDC_NOGROUPICON 1102 -#define IDC_ONECLK 1105 -#define IDC_BUILDTIME 1108 -#define IDC_RIGHTMARGIN 1121 -#define IDC_ROWGAP 1122 -#define IDC_TRANSPARENT 1124 -#define IDC_ROWHEIGHT 1125 -#define IDC_TRANSINACTIVE 1126 -#define IDC_GROUPROWHEIGHT 1126 -#define IDC_TRANSACTIVE 1128 -#define IDC_PROFILELIST 1134 -#define IDC_CLASSLIST 1135 -#define IDC_SELBLEND 1140 -#define IDC_SHOWBOTTOMBUTTONS 1148 -#define IDC_STATIC11 1154 -#define IDC_STATIC12 1155 -#define IDC_STATIC21 1156 -#define IDC_STATIC13 1156 -#define IDC_STATIC22 1157 -#define IDC_STATIC14 1157 -#define IDC_STATIC15 1158 -#define IDC_EXTRA_ICON_CLIENT 1164 -#define IDC_EXTRA_ICON_ADV1 1166 -#define IDC_SHOWGRIP 1169 -#define IDC_SKINBACKGROUND 1170 -#define IDC_FILLWALLPAPER 1171 -#define IDC_SHOWMETA 1172 -#define IDC_CENTERGROUPNAMES 1173 -#define IDC_APPLYINDENTBG 1174 -#define IDC_COPYRIGHT 1178 -#define IDC_VERSION 1179 -#define IDC_SHOWSTATUSICONS 1180 -#define IDC_BROWSE 1184 -#define IDC_INACTIVEPERC 1187 -#define IDC_SHOWSTATUSMSG 1188 -#define IDC_SHOWLOCALTIME 1189 -#define IDC_SHOWVISIBILITY 1190 -#define IDC_SHOWLOCALTIMEONLYWHENDIFFERENT 1191 -#define IDC_TITLETEXT 1196 -#define IDC_EXCEPTION_DETAILS 1200 -#define IDC_COPY_EXCEPTION 1201 -#define IDC_EX_REASON 1202 -#define IDC_TILEH 1208 -#define IDC_WHITERECT 1225 -#define IDC_AUTOHIDE 1235 -#define IDC_HIDETIME 1236 -#define IDC_ALWAYSHIDEONTASKBAR 1237 -#define IDC_IMPORT 1241 -#define IDC_MAXSIZEHEIGHT 1254 -#define IDC_MAXSIZESPIN 1255 -#define IDC_BKGCOLOUR 1269 -#define IDC_FILENAME 1271 -#define IDC_SCROLL 1277 -#define IDC_PROPORTIONAL 1278 -#define IDC_SMOOTHTIME 1283 -#define IDC_SMOOTHTIMESPIN 1284 -#define IDC_ROWHEIGHTSPIN 1286 -#define IDC_GROUPROWHEIGHTSPIN 1287 -#define IDC_GREYOUTOPTS 1288 -#define IDC_GROUPINDENT 1289 -#define IDC_GROUPINDENTSPIN 1290 -#define IDC_LEFTMARGIN 1291 -#define IDC_RIGHTMARGINSPIN 1294 -#define IDC_ROWGAPSPIN 1295 -#define IDC_STRETCHH 1298 -#define IDC_STRETCHV 1299 -#define IDC_TILEV 1301 -#define IDC_DONTCYCLE 1315 -#define IDC_PRIMARYSTATUS 1316 -#define IDC_CYCLE 1317 -#define IDC_CYCLETIME 1318 -#define IDC_CYCLETIMESPIN 1319 -#define IDC_HIDETIMESPIN 1320 -#define IDC_MULTITRAY 1321 -#define IDC_ALWAYSMULTI 1322 -#define IDC_SHOWICON 1323 -#define IDC_SORTTHEN 1323 -#define IDC_SHOWPROTO 1324 -#define IDC_SORTFINALLY 1324 -#define IDC_SHOWSTATUS 1325 -#define IDC_EQUALSECTIONS 1326 -#define IDC_SHOWSBAR 1329 -#define IDC_RIGHTMIRANDA 1330 -#define IDC_RIGHTSTATUS 1331 -#define IDC_STCLISTGROUP 1350 -#define IDC_DISABLEDRAGDROP 1351 -#define IDC_NOTEDITLABELS 1352 -#define IDC_SHOWSELALWAYS 1353 -#define IDC_TRACKSELECT 1354 -#define IDC_SHOWGROUPCOUNTS 1355 -#define IDC_HIDECOUNTSWHENEMPTY 1356 -#define IDC_DIVIDERONOFF 1357 -#define IDC_NOTNOTRANSLUCENTSEL 1358 -#define IDC_LINEWITHGROUPS 1359 -#define IDC_QUICKSEARCHVISONLY 1360 -#define IDC_SORTGROUPSALPHA 1361 -#define IDC_NOTNOSMOOTHSCROLLING 1362 -#define IDC_BITMAP 1363 -#define IDC_STWINDOWGROUP 1364 -#define IDC_STATIC01 1365 -#define IDC_SORTPRIMARY 1420 -#define IDC_HIDE 1534 -#define IDC_TOPLINE 1535 -#define IDC_BRINGTOFRONT 1579 -#define IDC_LOGO 1591 -#define IDC_BLINKTIME 1607 -#define IDC_BLINKSPIN 1608 -#define IDC_DISABLEBLINK 1609 -#define IDC_IDLE 1610 -#define IDC_SBPANELBEVEL 1611 -#define IDC_DBLCLKAVATARS 1611 -#define IDC_XSTATUSASSTATUS 1611 -#define IDC_NOSCROLLBAR 1613 -#define IDC_ADDVIEWMODE 1633 -#define IDC_SKINFILESELECT 1633 -#define IDC_IGN_ALL 1633 -#define IDC_EXPORT 1634 -#define IDC_DELETEVIEWMODE 1634 -#define IDC_IGN_NONE 1634 -#define IDC_RELOAD 1635 -#define IDC_IGN_ADDPERMANENTLY 1635 -#define IDC_DSP_LOADDEFAULT 1636 -#define IDC_ONDESKTOP 1657 -#define IDC_WINCOLOUR 1659 -#define IDC_ICONBLINK 1660 -#define IDC_APPLYLASTVIEWMODE 1661 -#define IDC_IGNORESELFORGROUPS 1722 -#define IDC_CLISTAVATARS 1729 -#define IDC_ALIGNMENT 1730 -#define IDC_AVATARSBORDER 1732 -#define IDC_AVATARBORDERCLR 1733 -#define IDC_AVATARSROUNDED 1734 -#define IDC_DUALROWMODE 1735 -#define IDC_CLISTALIGN 1737 -#define IDC_CLISTSUNKEN 1738 -#define IDC_EVENTAREAAUTOHIDE 1740 -#define IDC_RADIUS 1742 -#define IDC_RADIUSSPIN 1743 -#define IDC_ALWAYSALIGNNICK 1744 -#define IDC_SELECTIVEICONS 1746 -#define IDC_OVERLAYICONS 1747 -#define IDC_AVATARHEIGHT 1748 -#define IDC_NOAVATARSOFFLINE 1749 -#define IDC_CORNERRAD 1751 -#define IDC_CORNERSPIN 1752 -#define IDC_AVATARPADDING 1753 -#define IDC_GRPTOPPADDING 1753 -#define IDC_AVATARPADDINGSPIN 1754 -#define IDC_GRPPADDINGSPIN 1754 -#define IDC_LASTITEMPADDING 1755 -#define IDC_LASTITEMPADDINGSPIN 1756 -#define IDC_TBHIDEOFFLINE 1800 -#define IDC_TBHIDEGROUPS 1801 -#define IDC_TBSOUND 1802 -#define IDC_TBFINDANDADD 1803 -#define IDC_TBOPTIONS 1804 -#define IDC_TBMINIMIZE 1805 -#define IDC_TBMENU 1806 -#define IDC_TBGLOBALSTATUS 1807 -#define IDC_TABSRMMSLIST 1808 -#define IDC_TABSRMMMENU 1809 -#define IDC_TBSELECTVIEWMODE 1810 -#define IDC_ROUNDEDBORDER 1810 -#define IDC_TBCLEARVIEWMODE 1811 -#define IDC_TBCONFIGUREVIEWMODE 1812 -#define IDC_TBTOPMENU 1813 -#define IDC_TBTOPSTATUS 1814 -#define IDC_TBFOLDER 1815 -#define IDC_TBPOPUP 1816 -#define IDC_TBACCOUNTS 1817 -#define IDC_TBFIRSTUID 1820 -#define IDC_NOTIFYBUTTON 1900 -#define IDC_CLNICER 2002 -#define IDC_SUPPORT 2003 -#define IDI_OVL_OFFLINE 2050 -#define IDI_OVL_ONLINE 2051 -#define IDI_OVL_AWAY 2052 -#define IDI_OVL_DND 2053 -#define IDI_OVL_NA 2054 -#define IDI_OVL_OCCUPIED 2055 -#define IDI_OVL_FREEFORCHAT 2056 -#define IDI_OVL_INVISIBLE 2057 -#define IDI_OVL_ONTHEPHONE 2058 -#define IDI_OVL_OUTTOLUNCH 2059 -#define IDI_HIDEOFFLINE 2100 -#define IDI_HIDEGROUPS 2101 -#define IDI_SOUNDSON 2102 -#define IDI_FINDANDADD 2103 -#define IDI_TBOPTIONS 2104 -#define IDI_MINIMIZE 2105 -#define IDI_SOUNDSOFF 2106 -#define IDI_TABSRMMSESSIONLIST 2107 -#define IDI_TABSRMMMENU 2108 -#define IDI_CLVISIBLE 2109 -#define IDI_CLINVISIBLE 2110 -#define IDI_PROTOCONNECTING 2111 -#define IDI_TBTOPMENU 2112 -#define IDI_TBACCOUNTS 2113 -#define IDC_FLT_DEFHOVERTIME 2200 -#define IDC_CLUIFRAMESBDR 25492 -#define IDC_FLT_PADLEFTSPIN 25494 -#define IDC_FLT_PADLEFT 25495 -#define IDC_GROUPALIGN 25499 -#define IDC_BORDERSTYLE 25501 -#define IDC_CURVIEWMODE2 25503 -#define ID_ICQ_EXIT 40001 -#define IDC_STATIC7 40002 -#define POPUP_HIDEEMPTYGROUPS 40003 -#define POPUP_NEWSUBGROUP 40004 -#define POPUP_HIDEOFFLINE 40005 -#define POPUP_GROUPHIDEOFFLINE 40006 -#define POPUP_HIDEOFFLINEROOT 40007 -#define POPUP_DISABLEGROUPS 40008 -#define IDC_VIEWMODES 40010 -#define IDC_PROTOCOLS 40011 -#define IDC_GROUPS 40012 -#define IDC_STATUSMODES 40013 -#define IDC_NEWVIEMODE 40014 -#define POPUP_HIDEMIRANDA 40017 -#define IDC_TAB 40017 -#define IDC_STATIC1 40018 -#define IDC_STATIC2 40019 -#define IDC_STATIC3 40020 -#define POPUP_VISIBILITY 40021 -#define IDC_STATIC16 40021 -#define IDC_STATIC4 40022 -#define IDC_STATIC5 40023 -#define IDC_CLIST 40025 -#define IDC_STATIC8 40026 -#define IDC_STATIC9 40027 -#define POPUP_BUTTONS 40028 -#define IDC_CLEARALL 40028 -#define POPUP_FRAME 40029 -#define IDC_STATIC10 40029 -#define IDC_PROTOGROUPOP 40030 -#define POPUP_MOVEMARKEDHERE 40031 -#define IDC_GROUPSTATUSOP 40031 -#define IDC_LASTMESSAGEOP 40032 -#define ID_BUTTONS_ONLINE 40033 -#define IDC_SKINFILE 40034 -#define IDC_LASTMESSAGEUNIT 40034 -#define IDC_FLT_AVATARS 40036 -#define IDC_HIDECONTACT 40036 -#define IDC_FLT_DUALROWS 40037 -#define IDC_FLT_EXTRAICONS 40038 -#define ID_TRAY_HIDE 40038 -#define ID_TRAY_EXIT 40039 -#define IDC_FLT_SYNCED 40039 -#define POPUP_SHOWMETAICONS 40040 -#define IDC_FLT_AUTOHIDE 40040 -#define IDC_FLT_FILLSTD 40041 -#define IDC_FLT_PADRIGHT 40043 -#define IDC_LASTMSGVALUE 40043 -#define IDC_FLT_PADRIGHTSPIN 40044 -#define IDC_FLT_PADTOP 40045 -#define IDC_SKINFILENAME 40045 -#define IDC_FLT_PADTOPSPIN 40046 -#define IDC_SELECTSKINFILE 40046 -#define IDC_FLT_PADBOTTOM 40047 -#define IDC_RELOADSKIN 40047 -#define IDC_FLT_PADBOTTOMSPIN 40048 -#define IDC_UNLOAD 40048 -#define POPUP_NEWGROUP 40050 -#define IDC_SECONDLINEMODE 40050 -#define POPUP_SHOWSTATUSICONS 40051 -#define IDC_OVERLAYICON 40051 -#define IDC_SHOWLOCALTIME1 40052 -#define POPUP_RENAMEGROUP 40052 -#define POPUP_DELETEGROUP 40053 -#define IDC_DSP_ADD -25483 -#define IDC_DSP_DELETE 40054 -#define IDC_FLT_ENABLED 40054 -#define IDC_DSP_RENAME 40055 -#define IDC_FLT_OPACITY 40055 -#define IDC_DSP_APPLY 40056 -#define IDC_FLT_ACTIVEOPACITY 40056 -#define POPUP_FLOATER 40057 -#define POPUP_FLOATER_AUTOHIDE 40058 -#define IDC_FLT_WIDTH 40058 -#define IDC_AVATARDISPMODE 40059 -#define IDC_FLT_WIDTHSPIN 40059 -#define POPUP_FLOATER_EVENTS 40060 -#define IDC_FLT_SNAP 40060 -#define IDC_FLT_ACTIVEOPACITYVALUE 40061 -#define IDC_FLT_BORDER 40062 -#define IDC_FLT_ROUNDED 40063 -#define IDC_FLT_RADIUS 40065 -#define IDC_FLT_RADIUSSPIN 40066 -#define IDC_FLT_HOVERTIME 40067 -#define IDC_RESETXICONS 40067 -#define IDC_FLT_SHOWTOOLTIPS 40068 -#define IDC_FLT_HOVERTIMESPIN 40069 -#define IDC_FLT_OPACITYVALUE 40070 -#define IDC_FLT_BORDERCOLOUR 40072 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 10 -#define _APS_NEXT_COMMAND_VALUE 40061 -#define _APS_NEXT_CONTROL_VALUE 40066 -#define _APS_NEXT_SYMED_VALUE 40154 -#endif -#endif diff --git a/plugins/Clist_nicer/INCLUDE/rowheight_funcs.h b/plugins/Clist_nicer/INCLUDE/rowheight_funcs.h deleted file mode 100644 index 383db5b592..0000000000 --- a/plugins/Clist_nicer/INCLUDE/rowheight_funcs.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef __ROWHEIGHT_FUNCS_H__ -# define __ROWHEIGHT_FUNCS_H__ - -#define ROW_SPACE_BEETWEEN_LINES 0 -#define ICON_HEIGHT 16 - -class RowHeight { - -public: - static BOOL Alloc (ClcData *dat, int size); - static BOOL Init (ClcData *dat); - static void Free (ClcData *dat); - static void Clear (ClcData *dat); - - // Calc and store max row height - static int getMaxRowHeight (ClcData *dat, const HWND hwnd); - - - // Calc and store row height - static int getRowHeight (ClcData *dat, const HWND hwnd, ClcContact* contact, int item, DWORD style) - { - int height = 0; - //DWORD style=GetWindowLongPtr(hwnd,GWL_STYLE); - - //if(contact->iRowHeight == item) - // return(dat->row_heights[item]); - - if (!Alloc(dat, item + 1)) - return -1; - - height = dat->fontInfo[GetBasicFontID(contact)].fontHeight; - - if (!dat->bisEmbedded) { - if(contact->bSecondLine != MULTIROW_NEVER && contact->bSecondLine != MULTIROW_IFSPACE && contact->type == CLCIT_CONTACT) { - if ((contact->bSecondLine == MULTIROW_ALWAYS || ((cfg::dat.dwFlags & CLUI_FRAME_SHOWSTATUSMSG && contact->bSecondLine == MULTIROW_IFNEEDED) && (contact->xStatus > 0 || cfg::eCache[contact->extraCacheEntry].bStatusMsgValid > STATUSMSG_XSTATUSID)))) - height += (dat->fontInfo[FONTID_STATUS].fontHeight + cfg::dat.avatarPadding); - } - - // Avatar size - if (contact->cFlags & ECF_AVATAR && contact->type == CLCIT_CONTACT && contact->ace != NULL && !(contact->ace->dwFlags & AVS_HIDEONCLIST)) - height = max(height, cfg::dat.avatarSize + cfg::dat.avatarPadding); - } - - // Checkbox size - if ((style&CLS_CHECKBOXES && contact->type==CLCIT_CONTACT) || - (style&CLS_GROUPCHECKBOXES && contact->type==CLCIT_GROUP) || - (contact->type==CLCIT_INFO && contact->flags&CLCIIF_CHECKBOX)) - { - height = max(height, dat->checkboxSize); - } - - //height += 2 * dat->row_border; - // Min size - height = max(height, contact->type == CLCIT_GROUP ? dat->group_row_height : dat->min_row_heigh); - height += cfg::dat.bRowSpacing; - - dat->row_heights[item] = height; - //contact->iRowHeight = item; - - return height; - } - - // Calc and store row height for all itens in the list - static void calcRowHeights (ClcData *dat, HWND hwnd); - - // Calc item top Y (using stored data) - static int getItemTopY (ClcData *dat, int item); - - // Calc item bottom Y (using stored data) - static int getItemBottomY (ClcData *dat, int item); - - // Calc total height of rows (using stored data) - static int getTotalHeight (ClcData *dat); - - // Return the line that pos_y is at or -1 (using stored data). Y start at 0 - static int hitTest (ClcData *dat, int pos_y); - - // Returns the height of the chosen row - static int getHeight (ClcData *dat, int item); - - // returns the height for a floating contact - static int getFloatingRowHeight(const ClcData *dat, HWND hwnd, ClcContact *contact, DWORD dwFlags); -}; - -#endif // __ROWHEIGHT_FUNCS_H__ diff --git a/plugins/Clist_nicer/INCLUDE/vsstyle.h b/plugins/Clist_nicer/INCLUDE/vsstyle.h deleted file mode 100644 index b65e223b51..0000000000 --- a/plugins/Clist_nicer/INCLUDE/vsstyle.h +++ /dev/null @@ -1,1606 +0,0 @@ -//-------------------------------------------------------------------------// -// VisualStyle Style Guide symbols -//-------------------------------------------------------------------------// - -#ifndef __VSSTYLE_H__ -#define __VSSTYLE_H__ - -// -// property symbol definitions -// - -#define TMTVS_RESERVEDLOW 100000 -#define TMTVS_RESERVEDHIGH 19999 - - - -// -// AEROWIZARDSTYLE class parts and states -// -#define VSCLASS_AEROWIZARDSTYLE L"AEROWIZARDSTYLE" -#define VSCLASS_AEROWIZARD L"AEROWIZARD" - -enum AEROWIZARDPARTS { - AW_TITLEBAR = 1, - AW_HEADERAREA = 2, - AW_CONTENTAREA = 3, - AW_COMMANDAREA = 4, - AW_BUTTON = 5, -}; - -#define AEROWIZARDSTYLEPARTS AEROWIZARDPARTS; - -enum TITLEBARSTATES { - AW_S_TITLEBAR_ACTIVE = 1, - AW_S_TITLEBAR_INACTIVE = 2, -}; - -enum HEADERAREASTATES { - AW_S_HEADERAREA_NOMARGIN = 1, -}; - -enum CONTENTAREASTATES { - AW_S_CONTENTAREA_NOMARGIN = 1, -}; - - -// -// BUTTONSTYLE class parts and states -// -#define VSCLASS_BUTTONSTYLE L"BUTTONSTYLE" -#define VSCLASS_BUTTON L"BUTTON" - -enum BUTTONPARTS { - BP_PUSHBUTTON = 1, - BP_RADIOBUTTON = 2, - BP_CHECKBOX = 3, - BP_GROUPBOX = 4, - BP_USERBUTTON = 5, - BP_COMMANDLINK = 6, - BP_COMMANDLINKGLYPH = 7, -}; - -#define BUTTONSTYLEPARTS BUTTONPARTS; - -enum PUSHBUTTONSTATES { - PBS_NORMAL = 1, - PBS_HOT = 2, - PBS_PRESSED = 3, - PBS_DISABLED = 4, - PBS_DEFAULTED = 5, - PBS_DEFAULTED_ANIMATING = 6, -}; - -enum RADIOBUTTONSTATES { - RBS_UNCHECKEDNORMAL = 1, - RBS_UNCHECKEDHOT = 2, - RBS_UNCHECKEDPRESSED = 3, - RBS_UNCHECKEDDISABLED = 4, - RBS_CHECKEDNORMAL = 5, - RBS_CHECKEDHOT = 6, - RBS_CHECKEDPRESSED = 7, - RBS_CHECKEDDISABLED = 8, -}; - -enum CHECKBOXSTATES { - CBS_UNCHECKEDNORMAL = 1, - CBS_UNCHECKEDHOT = 2, - CBS_UNCHECKEDPRESSED = 3, - CBS_UNCHECKEDDISABLED = 4, - CBS_CHECKEDNORMAL = 5, - CBS_CHECKEDHOT = 6, - CBS_CHECKEDPRESSED = 7, - CBS_CHECKEDDISABLED = 8, - CBS_MIXEDNORMAL = 9, - CBS_MIXEDHOT = 10, - CBS_MIXEDPRESSED = 11, - CBS_MIXEDDISABLED = 12, - CBS_IMPLICITNORMAL = 13, - CBS_IMPLICITHOT = 14, - CBS_IMPLICITPRESSED = 15, - CBS_IMPLICITDISABLED = 16, - CBS_EXCLUDEDNORMAL = 17, - CBS_EXCLUDEDHOT = 18, - CBS_EXCLUDEDPRESSED = 19, - CBS_EXCLUDEDDISABLED = 20, -}; - -enum GROUPBOXSTATES { - GBS_NORMAL = 1, - GBS_DISABLED = 2, -}; - -enum COMMANDLINKSTATES { - CMDLS_NORMAL = 1, - CMDLS_HOT = 2, - CMDLS_PRESSED = 3, - CMDLS_DISABLED = 4, - CMDLS_DEFAULTED = 5, - CMDLS_DEFAULTED_ANIMATING = 6, -}; - -enum COMMANDLINKGLYPHSTATES { - CMDLGS_NORMAL = 1, - CMDLGS_HOT = 2, - CMDLGS_PRESSED = 3, - CMDLGS_DISABLED = 4, - CMDLGS_DEFAULTED = 5, -}; - - -// -// COMBOBOXSTYLE class parts and states -// -#define VSCLASS_COMBOBOXSTYLE L"COMBOBOXSTYLE" -#define VSCLASS_COMBOBOX L"COMBOBOX" - -enum COMBOBOXPARTS { - CP_DROPDOWNBUTTON = 1, - CP_BACKGROUND = 2, - CP_TRANSPARENTBACKGROUND = 3, - CP_BORDER = 4, - CP_READONLY = 5, - CP_DROPDOWNBUTTONRIGHT = 6, - CP_DROPDOWNBUTTONLEFT = 7, - CP_CUEBANNER = 8, -}; - -#define COMBOBOXSTYLEPARTS COMBOBOXPARTS; - -enum COMBOBOXSTYLESTATES { - CBXS_NORMAL = 1, - CBXS_HOT = 2, - CBXS_PRESSED = 3, - CBXS_DISABLED = 4, -}; - -enum DROPDOWNBUTTONRIGHTSTATES { - CBXSR_NORMAL = 1, - CBXSR_HOT = 2, - CBXSR_PRESSED = 3, - CBXSR_DISABLED = 4, -}; - -enum DROPDOWNBUTTONLEFTSTATES { - CBXSL_NORMAL = 1, - CBXSL_HOT = 2, - CBXSL_PRESSED = 3, - CBXSL_DISABLED = 4, -}; - -enum TRANSPARENTBACKGROUNDSTATES { - CBTBS_NORMAL = 1, - CBTBS_HOT = 2, - CBTBS_DISABLED = 3, - CBTBS_FOCUSED = 4, -}; - -enum BORDERSTATES { - CBB_NORMAL = 1, - CBB_HOT = 2, - CBB_FOCUSED = 3, - CBB_DISABLED = 4, -}; - -enum READONLYSTATES { - CBRO_NORMAL = 1, - CBRO_HOT = 2, - CBRO_PRESSED = 3, - CBRO_DISABLED = 4, -}; - -enum CUEBANNERSTATES { - CBCB_NORMAL = 1, - CBCB_HOT = 2, - CBCB_PRESSED = 3, - CBCB_DISABLED = 4, -}; - - -// -// COMMUNICATIONSSTYLE class parts and states -// -#define VSCLASS_COMMUNICATIONSSTYLE L"COMMUNICATIONSSTYLE" -#define VSCLASS_COMMUNICATIONS L"COMMUNICATIONS" - -enum COMMUNICATIONSPARTS { - CSST_TAB = 1, -}; - -#define COMMUNICATIONSSTYLEPARTS COMMUNICATIONSPARTS; - -enum TABSTATES { - CSTB_NORMAL = 1, - CSTB_HOT = 2, - CSTB_SELECTED = 3, -}; - - -// -// CONTROLPANELSTYLE class parts and states -// -#define VSCLASS_CONTROLPANELSTYLE L"CONTROLPANELSTYLE" -#define VSCLASS_CONTROLPANEL L"CONTROLPANEL" - -enum CONTROLPANELPARTS { - CPANEL_NAVIGATIONPANE = 1, - CPANEL_CONTENTPANE = 2, - CPANEL_NAVIGATIONPANELABEL = 3, - CPANEL_CONTENTPANELABEL = 4, - CPANEL_TITLE = 5, - CPANEL_BODYTEXT = 6, - CPANEL_HELPLINK = 7, - CPANEL_TASKLINK = 8, - CPANEL_GROUPTEXT = 9, - CPANEL_CONTENTLINK = 10, - CPANEL_SECTIONTITLELINK = 11, - CPANEL_LARGECOMMANDAREA = 12, - CPANEL_SMALLCOMMANDAREA = 13, - CPANEL_BUTTON = 14, - CPANEL_MESSAGETEXT = 15, - CPANEL_NAVIGATIONPANELINE = 16, - CPANEL_CONTENTPANELINE = 17, - CPANEL_BANNERAREA = 18, - CPANEL_BODYTITLE = 19, -}; - -#define CONTROLPANELSTYLEPARTS CONTROLPANELPARTS; - -enum HELPLINKSTATES { - CPHL_NORMAL = 1, - CPHL_HOT = 2, - CPHL_PRESSED = 3, - CPHL_DISABLED = 4, -}; - -enum TASKLINKSTATES { - CPTL_NORMAL = 1, - CPTL_HOT = 2, - CPTL_PRESSED = 3, - CPTL_DISABLED = 4, - CPTL_PAGE = 5, -}; - -enum CONTENTLINKSTATES { - CPCL_NORMAL = 1, - CPCL_HOT = 2, - CPCL_PRESSED = 3, - CPCL_DISABLED = 4, -}; - -enum SECTIONTITLELINKSTATES { - CPSTL_NORMAL = 1, - CPSTL_HOT = 2, -}; - - -// -// DATEPICKERSTYLE class parts and states -// -#define VSCLASS_DATEPICKERSTYLE L"DATEPICKERSTYLE" -#define VSCLASS_DATEPICKER L"DATEPICKER" - -enum DATEPICKERPARTS { - DP_DATETEXT = 1, - DP_DATEBORDER = 2, - DP_SHOWCALENDARBUTTONRIGHT = 3, -}; - -#define DATEPICKERSTYLEPARTS DATEPICKERPARTS; - -enum DATETEXTSTATES { - DPDT_NORMAL = 1, - DPDT_DISABLED = 2, - DPDT_SELECTED = 3, -}; - -enum DATEBORDERSTATES { - DPDB_NORMAL = 1, - DPDB_HOT = 2, - DPDB_FOCUSED = 3, - DPDB_DISABLED = 4, -}; - -enum SHOWCALENDARBUTTONRIGHTSTATES { - DPSCBR_NORMAL = 1, - DPSCBR_HOT = 2, - DPSCBR_PRESSED = 3, - DPSCBR_DISABLED = 4, -}; - - -// -// DRAGDROPSTYLE class parts and states -// -#define VSCLASS_DRAGDROPSTYLE L"DRAGDROPSTYLE" -#define VSCLASS_DRAGDROP L"DRAGDROP" - -enum DRAGDROPPARTS { - DD_COPY = 1, - DD_MOVE = 2, - DD_UPDATEMETADATA = 3, - DD_CREATELINK = 4, - DD_WARNING = 5, - DD_NONE = 6, - DD_IMAGEBG = 7, - DD_TEXTBG = 8, -}; - -#define DRAGDROPSTYLEPARTS DRAGDROPPARTS; - -enum COPYSTATES { - DDCOPY_HIGHLIGHT = 1, - DDCOPY_NOHIGHLIGHT = 2, -}; - -enum MOVESTATES { - DDMOVE_HIGHLIGHT = 1, - DDMOVE_NOHIGHLIGHT = 2, -}; - -enum UPDATEMETADATASTATES { - DDUPDATEMETADATA_HIGHLIGHT = 1, - DDUPDATEMETADATA_NOHIGHLIGHT = 2, -}; - -enum CREATELINKSTATES { - DDCREATELINK_HIGHLIGHT = 1, - DDCREATELINK_NOHIGHLIGHT = 2, -}; - -enum WARNINGSTATES { - DDWARNING_HIGHLIGHT = 1, - DDWARNING_NOHIGHLIGHT = 2, -}; - -enum NONESTATES { - DDNONE_HIGHLIGHT = 1, - DDNONE_NOHIGHLIGHT = 2, -}; - - -// -// EDITSTYLE class parts and states -// -#define VSCLASS_EDITSTYLE L"EDITSTYLE" -#define VSCLASS_EDIT L"EDIT" - -enum EDITPARTS { - EP_EDITTEXT = 1, - EP_CARET = 2, - EP_BACKGROUND = 3, - EP_PASSWORD = 4, - EP_BACKGROUNDWITHBORDER = 5, - EP_EDITBORDER_NOSCROLL = 6, - EP_EDITBORDER_HSCROLL = 7, - EP_EDITBORDER_VSCROLL = 8, - EP_EDITBORDER_HVSCROLL = 9, -}; - -#define EDITSTYLEPARTS EDITPARTS; - -enum EDITTEXTSTATES { - ETS_NORMAL = 1, - ETS_HOT = 2, - ETS_SELECTED = 3, - ETS_DISABLED = 4, - ETS_FOCUSED = 5, - ETS_READONLY = 6, - ETS_ASSIST = 7, - ETS_CUEBANNER = 8, -}; - -enum BACKGROUNDSTATES { - EBS_NORMAL = 1, - EBS_HOT = 2, - EBS_DISABLED = 3, - EBS_FOCUSED = 4, - EBS_READONLY = 5, - EBS_ASSIST = 6, -}; - -enum BACKGROUNDWITHBORDERSTATES { - EBWBS_NORMAL = 1, - EBWBS_HOT = 2, - EBWBS_DISABLED = 3, - EBWBS_FOCUSED = 4, -}; - -enum EDITBORDER_NOSCROLLSTATES { - EPSN_NORMAL = 1, - EPSN_HOT = 2, - EPSN_FOCUSED = 3, - EPSN_DISABLED = 4, -}; - -enum EDITBORDER_HSCROLLSTATES { - EPSH_NORMAL = 1, - EPSH_HOT = 2, - EPSH_FOCUSED = 3, - EPSH_DISABLED = 4, -}; - -enum EDITBORDER_VSCROLLSTATES { - EPSV_NORMAL = 1, - EPSV_HOT = 2, - EPSV_FOCUSED = 3, - EPSV_DISABLED = 4, -}; - -enum EDITBORDER_HVSCROLLSTATES { - EPSHV_NORMAL = 1, - EPSHV_HOT = 2, - EPSHV_FOCUSED = 3, - EPSHV_DISABLED = 4, -}; - - -// -// EXPLORERBARSTYLE class parts and states -// -#define VSCLASS_EXPLORERBARSTYLE L"EXPLORERBARSTYLE" -#define VSCLASS_EXPLORERBAR L"EXPLORERBAR" - -enum EXPLORERBARPARTS { - EBP_HEADERBACKGROUND = 1, - EBP_HEADERCLOSE = 2, - EBP_HEADERPIN = 3, - EBP_IEBARMENU = 4, - EBP_NORMALGROUPBACKGROUND = 5, - EBP_NORMALGROUPCOLLAPSE = 6, - EBP_NORMALGROUPEXPAND = 7, - EBP_NORMALGROUPHEAD = 8, - EBP_SPECIALGROUPBACKGROUND = 9, - EBP_SPECIALGROUPCOLLAPSE = 10, - EBP_SPECIALGROUPEXPAND = 11, - EBP_SPECIALGROUPHEAD = 12, -}; - -#define EXPLORERBARSTYLEPARTS EXPLORERBARPARTS; - -enum HEADERCLOSESTATES { - EBHC_NORMAL = 1, - EBHC_HOT = 2, - EBHC_PRESSED = 3, -}; - -enum HEADERPINSTATES { - EBHP_NORMAL = 1, - EBHP_HOT = 2, - EBHP_PRESSED = 3, - EBHP_SELECTEDNORMAL = 4, - EBHP_SELECTEDHOT = 5, - EBHP_SELECTEDPRESSED = 6, -}; - -enum IEBARMENUSTATES { - EBM_NORMAL = 1, - EBM_HOT = 2, - EBM_PRESSED = 3, -}; - -enum NORMALGROUPCOLLAPSESTATES { - EBNGC_NORMAL = 1, - EBNGC_HOT = 2, - EBNGC_PRESSED = 3, -}; - -enum NORMALGROUPEXPANDSTATES { - EBNGE_NORMAL = 1, - EBNGE_HOT = 2, - EBNGE_PRESSED = 3, -}; - -enum SPECIALGROUPCOLLAPSESTATES { - EBSGC_NORMAL = 1, - EBSGC_HOT = 2, - EBSGC_PRESSED = 3, -}; - -enum SPECIALGROUPEXPANDSTATES { - EBSGE_NORMAL = 1, - EBSGE_HOT = 2, - EBSGE_PRESSED = 3, -}; - - -// -// FLYOUTSTYLE class parts and states -// -#define VSCLASS_FLYOUTSTYLE L"FLYOUTSTYLE" -#define VSCLASS_FLYOUT L"FLYOUT" - -enum FLYOUTPARTS { - FLYOUT_HEADER = 1, - FLYOUT_BODY = 2, - FLYOUT_LABEL = 3, - FLYOUT_LINK = 4, - FLYOUT_DIVIDER = 5, - FLYOUT_WINDOW = 6, - FLYOUT_LINKAREA = 7, - FLYOUT_LINKHEADER = 8, -}; - -#define FLYOUTSTYLEPARTS FLYOUTPARTS; - -enum LABELSTATES { - FLS_NORMAL = 1, - FLS_SELECTED = 2, - FLS_EMPHASIZED = 3, - FLS_DISABLED = 4, -}; - -enum LINKSTATES { - FLYOUTLINK_NORMAL = 1, - FLYOUTLINK_HOVER = 2, -}; - -enum BODYSTATES { - FBS_NORMAL = 1, - FBS_EMPHASIZED = 2, -}; - -enum LINKHEADERSTATES { - FLH_NORMAL = 1, - FLH_HOVER = 2, -}; - - -// -// HEADERSTYLE class parts and states -// -#define VSCLASS_HEADERSTYLE L"HEADERSTYLE" -#define VSCLASS_HEADER L"HEADER" - -enum HEADERPARTS { - HP_HEADERITEM = 1, - HP_HEADERITEMLEFT = 2, - HP_HEADERITEMRIGHT = 3, - HP_HEADERSORTARROW = 4, - HP_HEADERDROPDOWN = 5, - HP_HEADERDROPDOWNFILTER = 6, - HP_HEADEROVERFLOW = 7, -}; - -#define HEADERSTYLEPARTS HEADERPARTS; - -enum HEADERSTYLESTATES { - HBG_DETAILS = 1, - HBG_ICON = 2, -}; - -enum HEADERITEMSTATES { - HIS_NORMAL = 1, - HIS_HOT = 2, - HIS_PRESSED = 3, - HIS_SORTEDNORMAL = 4, - HIS_SORTEDHOT = 5, - HIS_SORTEDPRESSED = 6, - HIS_ICONNORMAL = 7, - HIS_ICONHOT = 8, - HIS_ICONPRESSED = 9, - HIS_ICONSORTEDNORMAL = 10, - HIS_ICONSORTEDHOT = 11, - HIS_ICONSORTEDPRESSED = 12, -}; - -enum HEADERITEMLEFTSTATES { - HILS_NORMAL = 1, - HILS_HOT = 2, - HILS_PRESSED = 3, -}; - -enum HEADERITEMRIGHTSTATES { - HIRS_NORMAL = 1, - HIRS_HOT = 2, - HIRS_PRESSED = 3, -}; - -enum HEADERSORTARROWSTATES { - HSAS_SORTEDUP = 1, - HSAS_SORTEDDOWN = 2, -}; - -enum HEADERDROPDOWNSTATES { - HDDS_NORMAL = 1, - HDDS_SOFTHOT = 2, - HDDS_HOT = 3, -}; - -enum HEADERDROPDOWNFILTERSTATES { - HDDFS_NORMAL = 1, - HDDFS_SOFTHOT = 2, - HDDFS_HOT = 3, -}; - -enum HEADEROVERFLOWSTATES { - HOFS_NORMAL = 1, - HOFS_HOT = 2, -}; - - -// -// LISTBOXSTYLE class parts and states -// -#define VSCLASS_LISTBOXSTYLE L"LISTBOXSTYLE" -#define VSCLASS_LISTBOX L"LISTBOX" - -enum LISTBOXPARTS { - LBCP_BORDER_HSCROLL = 1, - LBCP_BORDER_HVSCROLL = 2, - LBCP_BORDER_NOSCROLL = 3, - LBCP_BORDER_VSCROLL = 4, - LBCP_ITEM = 5, -}; - -#define LISTBOXSTYLEPARTS LISTBOXPARTS; - -enum BORDER_HSCROLLSTATES { - LBPSH_NORMAL = 1, - LBPSH_FOCUSED = 2, - LBPSH_HOT = 3, - LBPSH_DISABLED = 4, -}; - -enum BORDER_HVSCROLLSTATES { - LBPSHV_NORMAL = 1, - LBPSHV_FOCUSED = 2, - LBPSHV_HOT = 3, - LBPSHV_DISABLED = 4, -}; - -enum BORDER_NOSCROLLSTATES { - LBPSN_NORMAL = 1, - LBPSN_FOCUSED = 2, - LBPSN_HOT = 3, - LBPSN_DISABLED = 4, -}; - -enum BORDER_VSCROLLSTATES { - LBPSV_NORMAL = 1, - LBPSV_FOCUSED = 2, - LBPSV_HOT = 3, - LBPSV_DISABLED = 4, -}; - -enum ITEMSTATES { - LBPSI_HOT = 1, - LBPSI_HOTSELECTED = 2, - LBPSI_SELECTED = 3, - LBPSI_SELECTEDNOTFOCUS = 4, -}; - - -// -// LISTVIEWSTYLE class parts and states -// -#define VSCLASS_LISTVIEWSTYLE L"LISTVIEWSTYLE" -#define VSCLASS_LISTVIEW L"LISTVIEW" - -enum LISTVIEWPARTS { - LVP_LISTITEM = 1, - LVP_LISTGROUP = 2, - LVP_LISTDETAIL = 3, - LVP_LISTSORTEDDETAIL = 4, - LVP_EMPTYTEXT = 5, - LVP_GROUPHEADER = 6, - LVP_GROUPHEADERLINE = 7, - LVP_EXPANDBUTTON = 8, - LVP_COLLAPSEBUTTON = 9, - LVP_COLUMNDETAIL = 10, -}; - -#define LISTVIEWSTYLEPARTS LISTVIEWPARTS; - -enum LISTITEMSTATES { - LISS_NORMAL = 1, - LISS_HOT = 2, - LISS_SELECTED = 3, - LISS_DISABLED = 4, - LISS_SELECTEDNOTFOCUS = 5, - LISS_HOTSELECTED = 6, -}; - -enum GROUPHEADERSTATES { - LVGH_OPEN = 1, - LVGH_OPENHOT = 2, - LVGH_OPENSELECTED = 3, - LVGH_OPENSELECTEDHOT = 4, - LVGH_OPENSELECTEDNOTFOCUSED = 5, - LVGH_OPENSELECTEDNOTFOCUSEDHOT = 6, - LVGH_OPENMIXEDSELECTION = 7, - LVGH_OPENMIXEDSELECTIONHOT = 8, - LVGH_CLOSE = 9, - LVGH_CLOSEHOT = 10, - LVGH_CLOSESELECTED = 11, - LVGH_CLOSESELECTEDHOT = 12, - LVGH_CLOSESELECTEDNOTFOCUSED = 13, - LVGH_CLOSESELECTEDNOTFOCUSEDHOT = 14, - LVGH_CLOSEMIXEDSELECTION = 15, - LVGH_CLOSEMIXEDSELECTIONHOT = 16, -}; - -enum GROUPHEADERLINESTATES { - LVGHL_OPEN = 1, - LVGHL_OPENHOT = 2, - LVGHL_OPENSELECTED = 3, - LVGHL_OPENSELECTEDHOT = 4, - LVGHL_OPENSELECTEDNOTFOCUSED = 5, - LVGHL_OPENSELECTEDNOTFOCUSEDHOT = 6, - LVGHL_OPENMIXEDSELECTION = 7, - LVGHL_OPENMIXEDSELECTIONHOT = 8, - LVGHL_CLOSE = 9, - LVGHL_CLOSEHOT = 10, - LVGHL_CLOSESELECTED = 11, - LVGHL_CLOSESELECTEDHOT = 12, - LVGHL_CLOSESELECTEDNOTFOCUSED = 13, - LVGHL_CLOSESELECTEDNOTFOCUSEDHOT = 14, - LVGHL_CLOSEMIXEDSELECTION = 15, - LVGHL_CLOSEMIXEDSELECTIONHOT = 16, -}; - -enum EXPANDBUTTONSTATES { - LVEB_NORMAL = 1, - LVEB_HOVER = 2, - LVEB_PUSHED = 3, -}; - -enum COLLAPSEBUTTONSTATES { - LVCB_NORMAL = 1, - LVCB_HOVER = 2, - LVCB_PUSHED = 3, -}; - - -// -// MENUSTYLE class parts and states -// -#define VSCLASS_MENUSTYLE L"MENUSTYLE" -#define VSCLASS_MENU L"MENU" - -enum MENUPARTS { - MENU_MENUITEM_TMSCHEMA = 1, - MENU_MENUDROPDOWN_TMSCHEMA = 2, - MENU_MENUBARITEM_TMSCHEMA = 3, - MENU_MENUBARDROPDOWN_TMSCHEMA = 4, - MENU_CHEVRON_TMSCHEMA = 5, - MENU_SEPARATOR_TMSCHEMA = 6, - MENU_BARBACKGROUND = 7, - MENU_BARITEM = 8, - MENU_POPUPBACKGROUND = 9, - MENU_POPUPBORDERS = 10, - MENU_POPUPCHECK = 11, - MENU_POPUPCHECKBACKGROUND = 12, - MENU_POPUPGUTTER = 13, - MENU_POPUPITEM = 14, - MENU_POPUPSEPARATOR = 15, - MENU_POPUPSUBMENU = 16, - MENU_SYSTEMCLOSE = 17, - MENU_SYSTEMMAXIMIZE = 18, - MENU_SYSTEMMINIMIZE = 19, - MENU_SYSTEMRESTORE = 20, -}; - -#define MENUSTYLEPARTS MENUPARTS; - -enum BARBACKGROUNDSTATES { - MB_ACTIVE = 1, - MB_INACTIVE = 2, -}; - -enum BARITEMSTATES { - MBI_NORMAL = 1, - MBI_HOT = 2, - MBI_PUSHED = 3, - MBI_DISABLED = 4, - MBI_DISABLEDHOT = 5, - MBI_DISABLEDPUSHED = 6, -}; - -enum POPUPCHECKSTATES { - MC_CHECKMARKNORMAL = 1, - MC_CHECKMARKDISABLED = 2, - MC_BULLETNORMAL = 3, - MC_BULLETDISABLED = 4, -}; - -enum POPUPCHECKBACKGROUNDSTATES { - MCB_DISABLED = 1, - MCB_NORMAL = 2, - MCB_BITMAP = 3, -}; - -enum POPUPITEMSTATES { - MPI_NORMAL = 1, - MPI_HOT = 2, - MPI_DISABLED = 3, - MPI_DISABLEDHOT = 4, -}; - -enum POPUPSUBMENUSTATES { - MSM_NORMAL = 1, - MSM_DISABLED = 2, -}; - -enum SYSTEMCLOSESTATES { - MSYSC_NORMAL = 1, - MSYSC_DISABLED = 2, -}; - -enum SYSTEMMAXIMIZESTATES { - MSYSMX_NORMAL = 1, - MSYSMX_DISABLED = 2, -}; - -enum SYSTEMMINIMIZESTATES { - MSYSMN_NORMAL = 1, - MSYSMN_DISABLED = 2, -}; - -enum SYSTEMRESTORESTATES { - MSYSR_NORMAL = 1, - MSYSR_DISABLED = 2, -}; - - -// -// NAVIGATION class parts and states -// -#define VSCLASS_NAVIGATION L"NAVIGATION" - -enum NAVIGATIONPARTS { - NAV_BACKBUTTON = 1, - NAV_FORWARDBUTTON = 2, - NAV_MENUBUTTON = 3, -}; - -enum NAV_BACKBUTTONSTATES { - NAV_BB_NORMAL = 1, - NAV_BB_HOT = 2, - NAV_BB_PRESSED = 3, - NAV_BB_DISABLED = 4, -}; - -enum NAV_FORWARDBUTTONSTATES { - NAV_FB_NORMAL = 1, - NAV_FB_HOT = 2, - NAV_FB_PRESSED = 3, - NAV_FB_DISABLED = 4, -}; - -enum NAV_MENUBUTTONSTATES { - NAV_MB_NORMAL = 1, - NAV_MB_HOT = 2, - NAV_MB_PRESSED = 3, - NAV_MB_DISABLED = 4, -}; - - -// -// PROGRESSSTYLE class parts and states -// -#define VSCLASS_PROGRESSSTYLE L"PROGRESSSTYLE" -#define VSCLASS_PROGRESS L"PROGRESS" - -enum PROGRESSPARTS { - PP_BAR = 1, - PP_BARVERT = 2, - PP_CHUNK = 3, - PP_CHUNKVERT = 4, - PP_FILL = 5, - PP_FILLVERT = 6, - PP_PULSEOVERLAY = 7, - PP_MOVEOVERLAY = 8, - PP_PULSEOVERLAYVERT = 9, - PP_MOVEOVERLAYVERT = 10, - PP_TRANSPARENTBAR = 11, - PP_TRANSPARENTBARVERT = 12, -}; - -#define PROGRESSSTYLEPARTS PROGRESSPARTS; - -enum TRANSPARENTBARSTATES { - PBBS_NORMAL = 1, - PBBS_PARTIAL = 2, -}; - -enum TRANSPARENTBARVERTSTATES { - PBBVS_NORMAL = 1, - PBBVS_PARTIAL = 2, -}; - -enum FILLSTATES { - PBFS_NORMAL = 1, - PBFS_ERROR = 2, - PBFS_PAUSED = 3, - PBFS_PARTIAL = 4, -}; - -enum FILLVERTSTATES { - PBFVS_NORMAL = 1, - PBFVS_ERROR = 2, - PBFVS_PAUSED = 3, - PBFVS_PARTIAL = 4, -}; - - -// -// REBARSTYLE class parts and states -// -#define VSCLASS_REBARSTYLE L"REBARSTYLE" -#define VSCLASS_REBAR L"REBAR" - -enum REBARPARTS { - RP_GRIPPER = 1, - RP_GRIPPERVERT = 2, - RP_BAND = 3, - RP_CHEVRON = 4, - RP_CHEVRONVERT = 5, - RP_BACKGROUND = 6, - RP_SPLITTER = 7, - RP_SPLITTERVERT = 8, -}; - -#define REBARSTYLEPARTS REBARPARTS; - -enum CHEVRONSTATES { - CHEVS_NORMAL = 1, - CHEVS_HOT = 2, - CHEVS_PRESSED = 3, -}; - -enum CHEVRONVERTSTATES { - CHEVSV_NORMAL = 1, - CHEVSV_HOT = 2, - CHEVSV_PRESSED = 3, -}; - -enum SPLITTERSTATES { - SPLITS_NORMAL = 1, - SPLITS_HOT = 2, - SPLITS_PRESSED = 3, -}; - -enum SPLITTERVERTSTATES { - SPLITSV_NORMAL = 1, - SPLITSV_HOT = 2, - SPLITSV_PRESSED = 3, -}; - - -// -// SCROLLBARSTYLE class parts and states -// -#define VSCLASS_SCROLLBARSTYLE L"SCROLLBARSTYLE" -#define VSCLASS_SCROLLBAR L"SCROLLBAR" - -enum SCROLLBARPARTS { - SBP_ARROWBTN = 1, - SBP_THUMBBTNHORZ = 2, - SBP_THUMBBTNVERT = 3, - SBP_LOWERTRACKHORZ = 4, - SBP_UPPERTRACKHORZ = 5, - SBP_LOWERTRACKVERT = 6, - SBP_UPPERTRACKVERT = 7, - SBP_GRIPPERHORZ = 8, - SBP_GRIPPERVERT = 9, - SBP_SIZEBOX = 10, -}; - -#define SCROLLBARSTYLEPARTS SCROLLBARPARTS; - -enum ARROWBTNSTATES { - ABS_UPNORMAL = 1, - ABS_UPHOT = 2, - ABS_UPPRESSED = 3, - ABS_UPDISABLED = 4, - ABS_DOWNNORMAL = 5, - ABS_DOWNHOT = 6, - ABS_DOWNPRESSED = 7, - ABS_DOWNDISABLED = 8, - ABS_LEFTNORMAL = 9, - ABS_LEFTHOT = 10, - ABS_LEFTPRESSED = 11, - ABS_LEFTDISABLED = 12, - ABS_RIGHTNORMAL = 13, - ABS_RIGHTHOT = 14, - ABS_RIGHTPRESSED = 15, - ABS_RIGHTDISABLED = 16, - ABS_UPHOVER = 17, - ABS_DOWNHOVER = 18, - ABS_LEFTHOVER = 19, - ABS_RIGHTHOVER = 20, -}; - -enum SCROLLBARSTYLESTATES { - SCRBS_NORMAL = 1, - SCRBS_HOT = 2, - SCRBS_PRESSED = 3, - SCRBS_DISABLED = 4, - SCRBS_HOVER = 5, -}; - -enum SIZEBOXSTATES { - SZB_RIGHTALIGN = 1, - SZB_LEFTALIGN = 2, - SZB_TOPRIGHTALIGN = 3, - SZB_TOPLEFTALIGN = 4, - SZB_HALFBOTTOMRIGHTALIGN = 5, - SZB_HALFBOTTOMLEFTALIGN = 6, - SZB_HALFTOPRIGHTALIGN = 7, - SZB_HALFTOPLEFTALIGN = 8, -}; - - -// -// SPINSTYLE class parts and states -// -#define VSCLASS_SPINSTYLE L"SPINSTYLE" -#define VSCLASS_SPIN L"SPIN" - -enum SPINPARTS { - SPNP_UP = 1, - SPNP_DOWN = 2, - SPNP_UPHORZ = 3, - SPNP_DOWNHORZ = 4, -}; - -#define SPINSTYLEPARTS SPINPARTS; - -enum UPSTATES { - UPS_NORMAL = 1, - UPS_HOT = 2, - UPS_PRESSED = 3, - UPS_DISABLED = 4, -}; - -enum DOWNSTATES { - DNS_NORMAL = 1, - DNS_HOT = 2, - DNS_PRESSED = 3, - DNS_DISABLED = 4, -}; - -enum UPHORZSTATES { - UPHZS_NORMAL = 1, - UPHZS_HOT = 2, - UPHZS_PRESSED = 3, - UPHZS_DISABLED = 4, -}; - -enum DOWNHORZSTATES { - DNHZS_NORMAL = 1, - DNHZS_HOT = 2, - DNHZS_PRESSED = 3, - DNHZS_DISABLED = 4, -}; - - -// -// STATUSSTYLE class parts and states -// -#define VSCLASS_STATUSSTYLE L"STATUSSTYLE" -#define VSCLASS_STATUS L"STATUS" - -enum STATUSPARTS { - SP_PANE = 1, - SP_GRIPPERPANE = 2, - SP_GRIPPER = 3, -}; - -#define STATUSSTYLEPARTS STATUSPARTS; - - -// -// TABSTYLE class parts and states -// -#define VSCLASS_TABSTYLE L"TABSTYLE" -#define VSCLASS_TAB L"TAB" - -enum TABPARTS { - TABP_TABITEM = 1, - TABP_TABITEMLEFTEDGE = 2, - TABP_TABITEMRIGHTEDGE = 3, - TABP_TABITEMBOTHEDGE = 4, - TABP_TOPTABITEM = 5, - TABP_TOPTABITEMLEFTEDGE = 6, - TABP_TOPTABITEMRIGHTEDGE = 7, - TABP_TOPTABITEMBOTHEDGE = 8, - TABP_PANE = 9, - TABP_BODY = 10, - TABP_AEROWIZARDBODY = 11, -}; - -#define TABSTYLEPARTS TABPARTS; - -enum TABITEMSTATES { - TIS_NORMAL = 1, - TIS_HOT = 2, - TIS_SELECTED = 3, - TIS_DISABLED = 4, - TIS_FOCUSED = 5, -}; - -enum TABITEMLEFTEDGESTATES { - TILES_NORMAL = 1, - TILES_HOT = 2, - TILES_SELECTED = 3, - TILES_DISABLED = 4, - TILES_FOCUSED = 5, -}; - -enum TABITEMRIGHTEDGESTATES { - TIRES_NORMAL = 1, - TIRES_HOT = 2, - TIRES_SELECTED = 3, - TIRES_DISABLED = 4, - TIRES_FOCUSED = 5, -}; - -enum TABITEMBOTHEDGESTATES { - TIBES_NORMAL = 1, - TIBES_HOT = 2, - TIBES_SELECTED = 3, - TIBES_DISABLED = 4, - TIBES_FOCUSED = 5, -}; - -enum TOPTABITEMSTATES { - TTIS_NORMAL = 1, - TTIS_HOT = 2, - TTIS_SELECTED = 3, - TTIS_DISABLED = 4, - TTIS_FOCUSED = 5, -}; - -enum TOPTABITEMLEFTEDGESTATES { - TTILES_NORMAL = 1, - TTILES_HOT = 2, - TTILES_SELECTED = 3, - TTILES_DISABLED = 4, - TTILES_FOCUSED = 5, -}; - -enum TOPTABITEMRIGHTEDGESTATES { - TTIRES_NORMAL = 1, - TTIRES_HOT = 2, - TTIRES_SELECTED = 3, - TTIRES_DISABLED = 4, - TTIRES_FOCUSED = 5, -}; - -enum TOPTABITEMBOTHEDGESTATES { - TTIBES_NORMAL = 1, - TTIBES_HOT = 2, - TTIBES_SELECTED = 3, - TTIBES_DISABLED = 4, - TTIBES_FOCUSED = 5, -}; - - -// -// TASKDIALOGSTYLE class parts and states -// -#define VSCLASS_TASKDIALOGSTYLE L"TASKDIALOGSTYLE" -#define VSCLASS_TASKDIALOG L"TASKDIALOG" - -enum TASKDIALOGPARTS { - TDLG_PRIMARYPANEL = 1, - TDLG_MAININSTRUCTIONPANE = 2, - TDLG_MAINICON = 3, - TDLG_CONTENTPANE = 4, - TDLG_CONTENTICON = 5, - TDLG_EXPANDEDCONTENT = 6, - TDLG_COMMANDLINKPANE = 7, - TDLG_SECONDARYPANEL = 8, - TDLG_CONTROLPANE = 9, - TDLG_BUTTONSECTION = 10, - TDLG_BUTTONWRAPPER = 11, - TDLG_EXPANDOTEXT = 12, - TDLG_EXPANDOBUTTON = 13, - TDLG_VERIFICATIONTEXT = 14, - TDLG_FOOTNOTEPANE = 15, - TDLG_FOOTNOTEAREA = 16, - TDLG_FOOTNOTESEPARATOR = 17, - TDLG_EXPANDEDFOOTERAREA = 18, - TDLG_PROGRESSBAR = 19, - TDLG_IMAGEALIGNMENT = 20, - TDLG_RADIOBUTTONPANE = 21, -}; - -#define TASKDIALOGSTYLEPARTS TASKDIALOGPARTS; - -enum CONTENTPANESTATES { - TDLGCPS_STANDALONE = 1, -}; - -enum EXPANDOBUTTONSTATES { - TDLGEBS_NORMAL = 1, - TDLGEBS_HOVER = 2, - TDLGEBS_PRESSED = 3, - TDLGEBS_EXPANDEDNORMAL = 4, - TDLGEBS_EXPANDEDHOVER = 5, - TDLGEBS_EXPANDEDPRESSED = 6, -}; - - -// -// TEXTSTYLE class parts and states -// -#define VSCLASS_TEXTSTYLE L"TEXTSTYLE" - -enum TEXTSTYLEPARTS { - TEXT_MAININSTRUCTION = 1, - TEXT_INSTRUCTION = 2, - TEXT_BODYTITLE = 3, - TEXT_BODYTEXT = 4, - TEXT_SECONDARYTEXT = 5, - TEXT_HYPERLINKTEXT = 6, - TEXT_EXPANDED = 7, - TEXT_LABEL = 8, - TEXT_CONTROLLABEL = 9, -}; - -enum HYPERLINKTEXTSTATES { - TS_HYPERLINK_NORMAL = 1, - TS_HYPERLINK_HOT = 2, - TS_HYPERLINK_PRESSED = 3, - TS_HYPERLINK_DISABLED = 4, -}; - -enum CONTROLLABELSTATES { - TS_CONTROLLABEL_NORMAL = 1, - TS_CONTROLLABEL_DISABLED = 2, -}; - - -// -// TOOLBARSTYLE class parts and states -// -#define VSCLASS_TOOLBARSTYLE L"TOOLBARSTYLE" -#define VSCLASS_TOOLBAR L"TOOLBAR" - -enum TOOLBARPARTS { - TP_BUTTON = 1, - TP_DROPDOWNBUTTON = 2, - TP_SPLITBUTTON = 3, - TP_SPLITBUTTONDROPDOWN = 4, - TP_SEPARATOR = 5, - TP_SEPARATORVERT = 6, - TP_DROPDOWNBUTTONGLYPH = 7, -}; - -#define TOOLBARSTYLEPARTS TOOLBARPARTS; - -enum TOOLBARSTYLESTATES { - TS_NORMAL = 1, - TS_HOT = 2, - TS_PRESSED = 3, - TS_DISABLED = 4, - TS_CHECKED = 5, - TS_HOTCHECKED = 6, - TS_NEARHOT = 7, - TS_OTHERSIDEHOT = 8, -}; - - -// -// TOOLTIPSTYLE class parts and states -// -#define VSCLASS_TOOLTIPSTYLE L"TOOLTIPSTYLE" -#define VSCLASS_TOOLTIP L"TOOLTIP" - -enum TOOLTIPPARTS { - TTP_STANDARD = 1, - TTP_STANDARDTITLE = 2, - TTP_BALLOON = 3, - TTP_BALLOONTITLE = 4, - TTP_CLOSE = 5, - TTP_BALLOONSTEM = 6, - TTP_WRENCH = 7, -}; - -#define TOOLTIPSTYLEPARTS TOOLTIPPARTS; - -enum CLOSESTATES { - TTCS_NORMAL = 1, - TTCS_HOT = 2, - TTCS_PRESSED = 3, -}; - -enum STANDARDSTATES { - TTSS_NORMAL = 1, - TTSS_LINK = 2, -}; - -enum BALLOONSTATES { - TTBS_NORMAL = 1, - TTBS_LINK = 2, -}; - -enum BALLOONSTEMSTATES { - TTBSS_POINTINGUPLEFTWALL = 1, - TTBSS_POINTINGUPCENTERED = 2, - TTBSS_POINTINGUPRIGHTWALL = 3, - TTBSS_POINTINGDOWNRIGHTWALL = 4, - TTBSS_POINTINGDOWNCENTERED = 5, - TTBSS_POINTINGDOWNLEFTWALL = 6, -}; - -enum WRENCHSTATES { - TTWS_NORMAL = 1, - TTWS_HOT = 2, - TTWS_PRESSED = 3, -}; - - -// -// TRACKBARSTYLE class parts and states -// -#define VSCLASS_TRACKBARSTYLE L"TRACKBARSTYLE" -#define VSCLASS_TRACKBAR L"TRACKBAR" - -enum TRACKBARPARTS { - TKP_TRACK = 1, - TKP_TRACKVERT = 2, - TKP_THUMB = 3, - TKP_THUMBBOTTOM = 4, - TKP_THUMBTOP = 5, - TKP_THUMBVERT = 6, - TKP_THUMBLEFT = 7, - TKP_THUMBRIGHT = 8, - TKP_TICS = 9, - TKP_TICSVERT = 10, -}; - -#define TRACKBARSTYLEPARTS TRACKBARPARTS; - -enum TRACKBARSTYLESTATES { - TKS_NORMAL = 1, -}; - -enum TRACKSTATES { - TRS_NORMAL = 1, -}; - -enum TRACKVERTSTATES { - TRVS_NORMAL = 1, -}; - -enum THUMBSTATES { - TUS_NORMAL = 1, - TUS_HOT = 2, - TUS_PRESSED = 3, - TUS_FOCUSED = 4, - TUS_DISABLED = 5, -}; - -enum THUMBBOTTOMSTATES { - TUBS_NORMAL = 1, - TUBS_HOT = 2, - TUBS_PRESSED = 3, - TUBS_FOCUSED = 4, - TUBS_DISABLED = 5, -}; - -enum THUMBTOPSTATES { - TUTS_NORMAL = 1, - TUTS_HOT = 2, - TUTS_PRESSED = 3, - TUTS_FOCUSED = 4, - TUTS_DISABLED = 5, -}; - -enum THUMBVERTSTATES { - TUVS_NORMAL = 1, - TUVS_HOT = 2, - TUVS_PRESSED = 3, - TUVS_FOCUSED = 4, - TUVS_DISABLED = 5, -}; - -enum THUMBLEFTSTATES { - TUVLS_NORMAL = 1, - TUVLS_HOT = 2, - TUVLS_PRESSED = 3, - TUVLS_FOCUSED = 4, - TUVLS_DISABLED = 5, -}; - -enum THUMBRIGHTSTATES { - TUVRS_NORMAL = 1, - TUVRS_HOT = 2, - TUVRS_PRESSED = 3, - TUVRS_FOCUSED = 4, - TUVRS_DISABLED = 5, -}; - -enum TICSSTATES { - TSS_NORMAL = 1, -}; - -enum TICSVERTSTATES { - TSVS_NORMAL = 1, -}; - - -// -// TREEVIEWSTYLE class parts and states -// -#define VSCLASS_TREEVIEWSTYLE L"TREEVIEWSTYLE" -#define VSCLASS_TREEVIEW L"TREEVIEW" - -enum TREEVIEWPARTS { - TVP_TREEITEM = 1, - TVP_GLYPH = 2, - TVP_BRANCH = 3, - TVP_HOTGLYPH = 4, -}; - -#define TREEVIEWSTYLEPARTS TREEVIEWPARTS; - -enum TREEITEMSTATES { - TREIS_NORMAL = 1, - TREIS_HOT = 2, - TREIS_SELECTED = 3, - TREIS_DISABLED = 4, - TREIS_SELECTEDNOTFOCUS = 5, - TREIS_HOTSELECTED = 6, -}; - -enum GLYPHSTATES { - GLPS_CLOSED = 1, - GLPS_OPENED = 2, -}; - -enum HOTGLYPHSTATES { - HGLPS_CLOSED = 1, - HGLPS_OPENED = 2, -}; - - -// -// WINDOWSTYLE class parts and states -// -#define VSCLASS_WINDOWSTYLE L"WINDOWSTYLE" -#define VSCLASS_WINDOW L"WINDOW" - -enum WINDOWPARTS { - WP_CAPTION = 1, - WP_SMALLCAPTION = 2, - WP_MINCAPTION = 3, - WP_SMALLMINCAPTION = 4, - WP_MAXCAPTION = 5, - WP_SMALLMAXCAPTION = 6, - WP_FRAMELEFT = 7, - WP_FRAMERIGHT = 8, - WP_FRAMEBOTTOM = 9, - WP_SMALLFRAMELEFT = 10, - WP_SMALLFRAMERIGHT = 11, - WP_SMALLFRAMEBOTTOM = 12, - WP_SYSBUTTON = 13, - WP_MDISYSBUTTON = 14, - WP_MINBUTTON = 15, - WP_MDIMINBUTTON = 16, - WP_MAXBUTTON = 17, - WP_CLOSEBUTTON = 18, - WP_SMALLCLOSEBUTTON = 19, - WP_MDICLOSEBUTTON = 20, - WP_RESTOREBUTTON = 21, - WP_MDIRESTOREBUTTON = 22, - WP_HELPBUTTON = 23, - WP_MDIHELPBUTTON = 24, - WP_HORZSCROLL = 25, - WP_HORZTHUMB = 26, - WP_VERTSCROLL = 27, - WP_VERTTHUMB = 28, - WP_DIALOG = 29, - WP_CAPTIONSIZINGTEMPLATE = 30, - WP_SMALLCAPTIONSIZINGTEMPLATE = 31, - WP_FRAMELEFTSIZINGTEMPLATE = 32, - WP_SMALLFRAMELEFTSIZINGTEMPLATE = 33, - WP_FRAMERIGHTSIZINGTEMPLATE = 34, - WP_SMALLFRAMERIGHTSIZINGTEMPLATE = 35, - WP_FRAMEBOTTOMSIZINGTEMPLATE = 36, - WP_SMALLFRAMEBOTTOMSIZINGTEMPLATE = 37, - WP_FRAME = 38, -}; - -#define WINDOWSTYLEPARTS WINDOWPARTS; - -enum FRAMESTATES { - FS_ACTIVE = 1, - FS_INACTIVE = 2, -}; - -enum CAPTIONSTATES { - CS_ACTIVE = 1, - CS_INACTIVE = 2, - CS_DISABLED = 3, -}; - -enum MAXCAPTIONSTATES { - MXCS_ACTIVE = 1, - MXCS_INACTIVE = 2, - MXCS_DISABLED = 3, -}; - -enum MINCAPTIONSTATES { - MNCS_ACTIVE = 1, - MNCS_INACTIVE = 2, - MNCS_DISABLED = 3, -}; - -enum HORZSCROLLSTATES { - HSS_NORMAL = 1, - HSS_HOT = 2, - HSS_PUSHED = 3, - HSS_DISABLED = 4, -}; - -enum HORZTHUMBSTATES { - HTS_NORMAL = 1, - HTS_HOT = 2, - HTS_PUSHED = 3, - HTS_DISABLED = 4, -}; - -enum VERTSCROLLSTATES { - VSS_NORMAL = 1, - VSS_HOT = 2, - VSS_PUSHED = 3, - VSS_DISABLED = 4, -}; - -enum VERTTHUMBSTATES { - VTS_NORMAL = 1, - VTS_HOT = 2, - VTS_PUSHED = 3, - VTS_DISABLED = 4, -}; - -enum SYSBUTTONSTATES { - SBS_NORMAL = 1, - SBS_HOT = 2, - SBS_PUSHED = 3, - SBS_DISABLED = 4, -}; - -enum MINBUTTONSTATES { - MINBS_NORMAL = 1, - MINBS_HOT = 2, - MINBS_PUSHED = 3, - MINBS_DISABLED = 4, -}; - -enum MAXBUTTONSTATES { - MAXBS_NORMAL = 1, - MAXBS_HOT = 2, - MAXBS_PUSHED = 3, - MAXBS_DISABLED = 4, -}; - -enum RESTOREBUTTONSTATES { - RBS_NORMAL = 1, - RBS_HOT = 2, - RBS_PUSHED = 3, - RBS_DISABLED = 4, -}; - -enum HELPBUTTONSTATES { - HBS_NORMAL = 1, - HBS_HOT = 2, - HBS_PUSHED = 3, - HBS_DISABLED = 4, -}; - -enum CLOSEBUTTONSTATES { - CBS_NORMAL = 1, - CBS_HOT = 2, - CBS_PUSHED = 3, - CBS_DISABLED = 4, -}; - - -#endif //__VSSTYLE_H__ - diff --git a/plugins/Clist_nicer/INCLUDE/vssym32.h b/plugins/Clist_nicer/INCLUDE/vssym32.h deleted file mode 100644 index 4d2b6fd62d..0000000000 --- a/plugins/Clist_nicer/INCLUDE/vssym32.h +++ /dev/null @@ -1,712 +0,0 @@ -//-------------------------------------------------------------------------// -// VisualStyle Core Win32/ComCtl32 symbols -//-------------------------------------------------------------------------// - -#ifndef __VSSYM32_H__ -#define __VSSYM32_H__ - -#include "VSStyle.h" - -// -// enumerated property values -// - -enum BGTYPE { - BT_IMAGEFILE = 0, - BT_BORDERFILL = 1, - BT_NONE = 2, -}; - - -// -// enumerated property values -// - -enum IMAGELAYOUT { - IL_VERTICAL = 0, - IL_HORIZONTAL = 1, -}; - - -// -// enumerated property values -// - -enum BORDERTYPE { - BT_RECT = 0, - BT_ROUNDRECT = 1, - BT_ELLIPSE = 2, -}; - - -// -// enumerated property values -// - -enum FILLTYPE { - FT_SOLID = 0, - FT_VERTGRADIENT = 1, - FT_HORZGRADIENT = 2, - FT_RADIALGRADIENT = 3, - FT_TILEIMAGE = 4, -}; - - -// -// enumerated property values -// - -enum SIZINGTYPE { - ST_TRUESIZE = 0, - ST_STRETCH = 1, - ST_TILE = 2, -}; - - -// -// enumerated property values -// - -enum HALIGN { - HA_LEFT = 0, - HA_CENTER = 1, - HA_RIGHT = 2, -}; - - -// -// enumerated property values -// - -enum CONTENTALIGNMENT { - CA_LEFT = 0, - CA_CENTER = 1, - CA_RIGHT = 2, -}; - - -// -// enumerated property values -// - -enum VALIGN { - VA_TOP = 0, - VA_CENTER = 1, - VA_BOTTOM = 2, -}; - - -// -// enumerated property values -// - -enum OFFSETTYPE { - OT_TOPLEFT = 0, - OT_TOPRIGHT = 1, - OT_TOPMIDDLE = 2, - OT_BOTTOMLEFT = 3, - OT_BOTTOMRIGHT = 4, - OT_BOTTOMMIDDLE = 5, - OT_MIDDLELEFT = 6, - OT_MIDDLERIGHT = 7, - OT_LEFTOFCAPTION = 8, - OT_RIGHTOFCAPTION = 9, - OT_LEFTOFLASTBUTTON = 10, - OT_RIGHTOFLASTBUTTON = 11, - OT_ABOVELASTBUTTON = 12, - OT_BELOWLASTBUTTON = 13, -}; - - -// -// enumerated property values -// - -enum ICONEFFECT { - ICE_NONE = 0, - ICE_GLOW = 1, - ICE_SHADOW = 2, - ICE_PULSE = 3, - ICE_ALPHA = 4, -}; - - -// -// enumerated property values -// - -enum TEXTSHADOWTYPE { - TST_NONE = 0, - TST_SINGLE = 1, - TST_CONTINUOUS = 2, -}; - - -// -// enumerated property values -// - -enum GLYPHTYPE { - GT_NONE = 0, - GT_IMAGEGLYPH = 1, - GT_FONTGLYPH = 2, -}; - - -// -// enumerated property values -// - -enum IMAGESELECTTYPE { - IST_NONE = 0, - IST_SIZE = 1, - IST_DPI = 2, -}; - - -// -// enumerated property values -// - -enum TRUESIZESCALINGTYPE { - TSST_NONE = 0, - TSST_SIZE = 1, - TSST_DPI = 2, -}; - - -// -// enumerated property values -// - -enum GLYPHFONTSIZINGTYPE { - GFST_NONE = 0, - GFST_SIZE = 1, - GFST_DPI = 2, -}; - -// -// property symbol definitions -// - -#define TMT_RESERVEDLOW 0 -#define TMT_RESERVEDHIGH 7999 - -#define TMT_DIBDATA 2 -#define TMT_GLYPHDIBDATA 8 -#define TMT_ENUM 200 -#define TMT_STRING 201 -#define TMT_INT 202 -#define TMT_BOOL 203 -#define TMT_COLOR 204 -#define TMT_MARGINS 205 -#define TMT_FILENAME 206 -#define TMT_SIZE 207 -#define TMT_POSITION 208 -#define TMT_RECT 209 -#define TMT_FONT 210 -#define TMT_INTLIST 211 -#define TMT_HBITMAP 212 -#define TMT_DISKSTREAM 213 -#define TMT_STREAM 214 -#define TMT_BITMAPREF 215 -#define TMT_COLORSCHEMES 401 -#define TMT_SIZES 402 -#define TMT_CHARSET 403 -#define TMT_NAME 600 -#define TMT_DISPLAYNAME 601 -#define TMT_TOOLTIP 602 -#define TMT_COMPANY 603 -#define TMT_AUTHOR 604 -#define TMT_COPYRIGHT 605 -#define TMT_URL 606 -#define TMT_VERSION 607 -#define TMT_DESCRIPTION 608 -#define TMT_FIRST_RCSTRING_NAME TMT_DISPLAYNAME -#define TMT_LAST_RCSTRING_NAME TMT_DESCRIPTION -#define TMT_CAPTIONFONT 801 -#define TMT_SMALLCAPTIONFONT 802 -#define TMT_MENUFONT 803 -#define TMT_STATUSFONT 804 -#define TMT_MSGBOXFONT 805 -#define TMT_ICONTITLEFONT 806 -#define TMT_HEADING1FONT 807 -#define TMT_HEADING2FONT 808 -#define TMT_BODYFONT 809 -#define TMT_FIRSTFONT TMT_CAPTIONFONT -#define TMT_LASTFONT TMT_BODYFONT -#define TMT_FLATMENUS 1001 -#define TMT_FIRSTBOOL TMT_FLATMENUS -#define TMT_LASTBOOL TMT_FLATMENUS -#define TMT_SIZINGBORDERWIDTH 1201 -#define TMT_SCROLLBARWIDTH 1202 -#define TMT_SCROLLBARHEIGHT 1203 -#define TMT_CAPTIONBARWIDTH 1204 -#define TMT_CAPTIONBARHEIGHT 1205 -#define TMT_SMCAPTIONBARWIDTH 1206 -#define TMT_SMCAPTIONBARHEIGHT 1207 -#define TMT_MENUBARWIDTH 1208 -#define TMT_MENUBARHEIGHT 1209 -#define TMT_PADDEDBORDERWIDTH 1210 -#define TMT_FIRSTSIZE TMT_SIZINGBORDERWIDTH -#define TMT_LASTSIZE TMT_PADDEDBORDERWIDTH -#define TMT_MINCOLORDEPTH 1301 -#define TMT_FIRSTINT TMT_MINCOLORDEPTH -#define TMT_LASTINT TMT_MINCOLORDEPTH -#define TMT_CSSNAME 1401 -#define TMT_XMLNAME 1402 -#define TMT_LASTUPDATED 1403 -#define TMT_ALIAS 1404 -#define TMT_FIRSTSTRING TMT_CSSNAME -#define TMT_LASTSTRING TMT_ALIAS -#define TMT_SCROLLBAR 1601 -#define TMT_BACKGROUND 1602 -#define TMT_ACTIVECAPTION 1603 -#define TMT_INACTIVECAPTION 1604 -#define TMT_MENU 1605 -#define TMT_WINDOW 1606 -#define TMT_WINDOWFRAME 1607 -#define TMT_MENUTEXT 1608 -#define TMT_WINDOWTEXT 1609 -#define TMT_CAPTIONTEXT 1610 -#define TMT_ACTIVEBORDER 1611 -#define TMT_INACTIVEBORDER 1612 -#define TMT_APPWORKSPACE 1613 -#define TMT_HIGHLIGHT 1614 -#define TMT_HIGHLIGHTTEXT 1615 -#define TMT_BTNFACE 1616 -#define TMT_BTNSHADOW 1617 -#define TMT_GRAYTEXT 1618 -#define TMT_BTNTEXT 1619 -#define TMT_INACTIVECAPTIONTEXT 1620 -#define TMT_BTNHIGHLIGHT 1621 -#define TMT_DKSHADOW3D 1622 -#define TMT_LIGHT3D 1623 -#define TMT_INFOTEXT 1624 -#define TMT_INFOBK 1625 -#define TMT_BUTTONALTERNATEFACE 1626 -#define TMT_HOTTRACKING 1627 -#define TMT_GRADIENTACTIVECAPTION 1628 -#define TMT_GRADIENTINACTIVECAPTION 1629 -#define TMT_MENUHILIGHT 1630 -#define TMT_MENUBAR 1631 -#define TMT_FIRSTCOLOR TMT_SCROLLBAR -#define TMT_LASTCOLOR TMT_MENUBAR -#define TMT_FROMHUE1 1801 -#define TMT_FROMHUE2 1802 -#define TMT_FROMHUE3 1803 -#define TMT_FROMHUE4 1804 -#define TMT_FROMHUE5 1805 -#define TMT_TOHUE1 1806 -#define TMT_TOHUE2 1807 -#define TMT_TOHUE3 1808 -#define TMT_TOHUE4 1809 -#define TMT_TOHUE5 1810 -#define TMT_FROMCOLOR1 2001 -#define TMT_FROMCOLOR2 2002 -#define TMT_FROMCOLOR3 2003 -#define TMT_FROMCOLOR4 2004 -#define TMT_FROMCOLOR5 2005 -#define TMT_TOCOLOR1 2006 -#define TMT_TOCOLOR2 2007 -#define TMT_TOCOLOR3 2008 -#define TMT_TOCOLOR4 2009 -#define TMT_TOCOLOR5 2010 -#define TMT_TRANSPARENT 2201 -#define TMT_AUTOSIZE 2202 -#define TMT_BORDERONLY 2203 -#define TMT_COMPOSITED 2204 -#define TMT_BGFILL 2205 -#define TMT_GLYPHTRANSPARENT 2206 -#define TMT_GLYPHONLY 2207 -#define TMT_ALWAYSSHOWSIZINGBAR 2208 -#define TMT_MIRRORIMAGE 2209 -#define TMT_UNIFORMSIZING 2210 -#define TMT_INTEGRALSIZING 2211 -#define TMT_SOURCEGROW 2212 -#define TMT_SOURCESHRINK 2213 -#define TMT_DRAWBORDERS 2214 -#define TMT_NOETCHEDEFFECT 2215 -#define TMT_TEXTAPPLYOVERLAY 2216 -#define TMT_TEXTGLOW 2217 -#define TMT_TEXTITALIC 2218 -#define TMT_COMPOSITEDOPAQUE 2219 -#define TMT_LOCALIZEDMIRRORIMAGE 2220 -#define TMT_IMAGECOUNT 2401 -#define TMT_ALPHALEVEL 2402 -#define TMT_BORDERSIZE 2403 -#define TMT_ROUNDCORNERWIDTH 2404 -#define TMT_ROUNDCORNERHEIGHT 2405 -#define TMT_GRADIENTRATIO1 2406 -#define TMT_GRADIENTRATIO2 2407 -#define TMT_GRADIENTRATIO3 2408 -#define TMT_GRADIENTRATIO4 2409 -#define TMT_GRADIENTRATIO5 2410 -#define TMT_PROGRESSCHUNKSIZE 2411 -#define TMT_PROGRESSSPACESIZE 2412 -#define TMT_SATURATION 2413 -#define TMT_TEXTBORDERSIZE 2414 -#define TMT_ALPHATHRESHOLD 2415 -#define TMT_WIDTH 2416 -#define TMT_HEIGHT 2417 -#define TMT_GLYPHINDEX 2418 -#define TMT_TRUESIZESTRETCHMARK 2419 -#define TMT_MINDPI1 2420 -#define TMT_MINDPI2 2421 -#define TMT_MINDPI3 2422 -#define TMT_MINDPI4 2423 -#define TMT_MINDPI5 2424 -#define TMT_TEXTGLOWSIZE 2425 -#define TMT_FRAMESPERSECOND 2426 -#define TMT_PIXELSPERFRAME 2427 -#define TMT_ANIMATIONDELAY 2428 -#define TMT_GLOWINTENSITY 2429 -#define TMT_OPACITY 2430 -#define TMT_COLORIZATIONCOLOR 2431 -#define TMT_COLORIZATIONOPACITY 2432 -#define TMT_GLYPHFONT 2601 -#define TMT_IMAGEFILE 3001 -#define TMT_IMAGEFILE1 3002 -#define TMT_IMAGEFILE2 3003 -#define TMT_IMAGEFILE3 3004 -#define TMT_IMAGEFILE4 3005 -#define TMT_IMAGEFILE5 3006 -#define TMT_GLYPHIMAGEFILE 3008 -#define TMT_TEXT 3201 -#define TMT_CLASSICVALUE 3202 -#define TMT_OFFSET 3401 -#define TMT_TEXTSHADOWOFFSET 3402 -#define TMT_MINSIZE 3403 -#define TMT_MINSIZE1 3404 -#define TMT_MINSIZE2 3405 -#define TMT_MINSIZE3 3406 -#define TMT_MINSIZE4 3407 -#define TMT_MINSIZE5 3408 -#define TMT_NORMALSIZE 3409 -#define TMT_SIZINGMARGINS 3601 -#define TMT_CONTENTMARGINS 3602 -#define TMT_CAPTIONMARGINS 3603 -#define TMT_BORDERCOLOR 3801 -#define TMT_FILLCOLOR 3802 -#define TMT_TEXTCOLOR 3803 -#define TMT_EDGELIGHTCOLOR 3804 -#define TMT_EDGEHIGHLIGHTCOLOR 3805 -#define TMT_EDGESHADOWCOLOR 3806 -#define TMT_EDGEDKSHADOWCOLOR 3807 -#define TMT_EDGEFILLCOLOR 3808 -#define TMT_TRANSPARENTCOLOR 3809 -#define TMT_GRADIENTCOLOR1 3810 -#define TMT_GRADIENTCOLOR2 3811 -#define TMT_GRADIENTCOLOR3 3812 -#define TMT_GRADIENTCOLOR4 3813 -#define TMT_GRADIENTCOLOR5 3814 -#define TMT_SHADOWCOLOR 3815 -#define TMT_GLOWCOLOR 3816 -#define TMT_TEXTBORDERCOLOR 3817 -#define TMT_TEXTSHADOWCOLOR 3818 -#define TMT_GLYPHTEXTCOLOR 3819 -#define TMT_GLYPHTRANSPARENTCOLOR 3820 -#define TMT_FILLCOLORHINT 3821 -#define TMT_BORDERCOLORHINT 3822 -#define TMT_ACCENTCOLORHINT 3823 -#define TMT_TEXTCOLORHINT 3824 -#define TMT_HEADING1TEXTCOLOR 3825 -#define TMT_HEADING2TEXTCOLOR 3826 -#define TMT_BODYTEXTCOLOR 3827 -#define TMT_BGTYPE 4001 -#define TMT_BORDERTYPE 4002 -#define TMT_FILLTYPE 4003 -#define TMT_SIZINGTYPE 4004 -#define TMT_HALIGN 4005 -#define TMT_CONTENTALIGNMENT 4006 -#define TMT_VALIGN 4007 -#define TMT_OFFSETTYPE 4008 -#define TMT_ICONEFFECT 4009 -#define TMT_TEXTSHADOWTYPE 4010 -#define TMT_IMAGELAYOUT 4011 -#define TMT_GLYPHTYPE 4012 -#define TMT_IMAGESELECTTYPE 4013 -#define TMT_GLYPHFONTSIZINGTYPE 4014 -#define TMT_TRUESIZESCALINGTYPE 4015 -#define TMT_USERPICTURE 5001 -#define TMT_DEFAULTPANESIZE 5002 -#define TMT_BLENDCOLOR 5003 -#define TMT_CUSTOMSPLITRECT 5004 -#define TMT_ANIMATIONBUTTONRECT 5005 -#define TMT_ANIMATIONDURATION 5006 -#define TMT_TRANSITIONDURATIONS 6000 -#define TMT_SCALEDBACKGROUND 7001 -#define TMT_ATLASIMAGE 8000 -#define TMT_ATLASINPUTIMAGE 8001 -#define TMT_ATLASRECT 8002 - - -// -// LINK class parts and states -// -#define VSCLASS_LINK L"LINK" - -enum LINKPARTS { - LP_HYPERLINK = 1, -}; - -enum HYPERLINKSTATES { - HLS_NORMALTEXT = 1, - HLS_LINKTEXT = 2, -}; - - -// -// EMPTYMARKUP class parts and states -// -#define VSCLASS_EMPTYMARKUP L"EMPTYMARKUP" - -enum EMPTYMARKUPPARTS { - EMP_MARKUPTEXT = 1, -}; - -enum MARKUPTEXTSTATES { - EMT_NORMALTEXT = 1, - EMT_LINKTEXT = 2, -}; - - -// -// STATIC class parts and states -// -#define VSCLASS_STATIC L"STATIC" - -enum STATICPARTS { - STAT_TEXT = 1, -}; - - -// -// PAGE class parts and states -// -#define VSCLASS_PAGE L"PAGE" - -enum PAGEPARTS { - PGRP_UP = 1, - PGRP_DOWN = 2, - PGRP_UPHORZ = 3, - PGRP_DOWNHORZ = 4, -}; - - -// -// MONTHCAL class parts and states -// -#define VSCLASS_MONTHCAL L"MONTHCAL" - -enum MONTHCALPARTS { - MC_BACKGROUND = 1, - MC_BORDERS = 2, - MC_GRIDBACKGROUND = 3, - MC_COLHEADERSPLITTER = 4, - MC_GRIDCELLBACKGROUND = 5, - MC_GRIDCELL = 6, - MC_GRIDCELLUPPER = 7, - MC_TRAILINGGRIDCELL = 8, - MC_TRAILINGGRIDCELLUPPER = 9, - MC_NAVNEXT = 10, - MC_NAVPREV = 11, -}; - -enum GRIDCELLBACKGROUNDSTATES { - MCGCB_SELECTED = 1, - MCGCB_HOT = 2, - MCGCB_SELECTEDHOT = 3, - MCGCB_SELECTEDNOTFOCUSED = 4, - MCGCB_TODAY = 5, -}; - -enum GRIDCELLSTATES { - MCGC_HOT = 1, - MCGC_HASSTATE = 2, - MCGC_HASSTATEHOT = 3, - MCGC_TODAY = 4, -}; - -enum GRIDCELLUPPERSTATES { - MCGCU_HOT = 1, - MCGCU_HASSTATE = 2, - MCGCU_HASSTATEHOT = 3, -}; - -enum TRAILINGGRIDCELLSTATES { - MCTGC_HOT = 1, - MCTGC_HASSTATE = 2, - MCTGC_HASSTATEHOT = 3, - MCTGC_TODAY = 4, -}; - -enum TRAILINGGRIDCELLUPPERSTATES { - MCTGCU_HOT = 1, - MCTGCU_HASSTATE = 2, - MCTGCU_HASSTATEHOT = 3, -}; - -enum NAVNEXTSTATES { - MCNN_NORMAL = 1, - MCNN_HOT = 2, - MCNN_PRESSED = 3, - MCNN_DISABLED = 4, -}; - -enum NAVPREVSTATES { - MCNP_NORMAL = 1, - MCNP_HOT = 2, - MCNP_PRESSED = 3, - MCNP_DISABLED = 4, -}; - - -// -// CLOCK class parts and states -// -#define VSCLASS_CLOCK L"CLOCK" - -enum CLOCKPARTS { - CLP_TIME = 1, -}; - -enum CLOCKSTATES { - CLS_NORMAL = 1, - CLS_HOT = 2, - CLS_PRESSED = 3, -}; - - -// -// TRAYNOTIFY class parts and states -// -#define VSCLASS_TRAYNOTIFY L"TRAYNOTIFY" - -enum TRAYNOTIFYPARTS { - TNP_BACKGROUND = 1, - TNP_ANIMBACKGROUND = 2, -}; - - -// -// TASKBAR class parts and states -// -#define VSCLASS_TASKBAR L"TASKBAR" - -enum TASKBARPARTS { - TBP_BACKGROUNDBOTTOM = 1, - TBP_BACKGROUNDRIGHT = 2, - TBP_BACKGROUNDTOP = 3, - TBP_BACKGROUNDLEFT = 4, - TBP_SIZINGBARBOTTOM = 5, - TBP_SIZINGBARRIGHT = 6, - TBP_SIZINGBARTOP = 7, - TBP_SIZINGBARLEFT = 8, -}; - - -// -// TASKBAND class parts and states -// -#define VSCLASS_TASKBAND L"TASKBAND" - -enum TASKBANDPARTS { - TDP_GROUPCOUNT = 1, - TDP_FLASHBUTTON = 2, - TDP_FLASHBUTTONGROUPMENU = 3, -}; - - -// -// STARTPANEL class parts and states -// -#define VSCLASS_STARTPANEL L"STARTPANEL" - -enum STARTPANELPARTS { - SPP_USERPANE = 1, - SPP_MOREPROGRAMS = 2, - SPP_MOREPROGRAMSARROW = 3, - SPP_PROGLIST = 4, - SPP_PROGLISTSEPARATOR = 5, - SPP_PLACESLIST = 6, - SPP_PLACESLISTSEPARATOR = 7, - SPP_LOGOFF = 8, - SPP_LOGOFFBUTTONS = 9, - SPP_USERPICTURE = 10, - SPP_PREVIEW = 11, - SPP_MOREPROGRAMSTAB = 12, - SPP_NSCHOST = 13, - SPP_SOFTWAREEXPLORER = 14, - SPP_OPENBOX = 15, - SPP_SEARCHVIEW = 16, - SPP_MOREPROGRAMSARROWBACK = 17, - SPP_TOPMATCH = 18, - SPP_LOGOFFSPLITBUTTONDROPDOWN = 19, -}; - -enum MOREPROGRAMSTABSTATES { - SPMPT_NORMAL = 1, - SPMPT_HOT = 2, - SPMPT_SELECTED = 3, - SPMPT_DISABLED = 4, - SPMPT_FOCUSED = 5, -}; - -enum SOFTWAREEXPLORERSTATES { - SPSE_NORMAL = 1, - SPSE_HOT = 2, - SPSE_SELECTED = 3, - SPSE_DISABLED = 4, - SPSE_FOCUSED = 5, -}; - -enum OPENBOXSTATES { - SPOB_NORMAL = 1, - SPOB_HOT = 2, - SPOB_SELECTED = 3, - SPOB_DISABLED = 4, - SPOB_FOCUSED = 5, -}; - -enum MOREPROGRAMSARROWSTATES { - SPS_NORMAL = 1, - SPS_HOT = 2, - SPS_PRESSED = 3, -}; - -enum MOREPROGRAMSARROWBACKSTATES { - SPSB_NORMAL = 1, - SPSB_HOT = 2, - SPSB_PRESSED = 3, -}; - -enum LOGOFFBUTTONSSTATES { - SPLS_NORMAL = 1, - SPLS_HOT = 2, - SPLS_PRESSED = 3, -}; - - -// -// MENUBAND class parts and states -// -#define VSCLASS_MENUBAND L"MENUBAND" - -enum MENUBANDPARTS { - MDP_NEWAPPBUTTON = 1, - MDP_SEPERATOR = 2, -}; - -enum MENUBANDSTATES { - MDS_NORMAL = 1, - MDS_HOT = 2, - MDS_PRESSED = 3, - MDS_DISABLED = 4, - MDS_CHECKED = 5, - MDS_HOTCHECKED = 6, -}; - - -#endif //__VSSYM32_H__ - diff --git a/plugins/Clist_nicer/SRC/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/SRC/CLUIFrames/cluiframes.cpp new file mode 100644 index 0000000000..8fbaa547e6 --- /dev/null +++ b/plugins/Clist_nicer/SRC/CLUIFrames/cluiframes.cpp @@ -0,0 +1,3584 @@ +/* +astyle --force-indent=tab=4 --brackets=linux --indent-switches + --pad=oper --one-line=keep-blocks --unpad=paren + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 +#include "cluiframes.h" +HFONT __fastcall ChangeToFont(HDC hdc, struct ClcData *dat, int id, int *fontHeight); + +extern HIMAGELIST himlExtraImages; +extern HWND g_hwndViewModeFrame, g_hwndEventArea; +extern StatusItems_t *StatusItems; +extern int mf_updatethread_running; + +extern DWORD WINAPI MF_UpdateThread(LPVOID p); +extern HANDLE hThreadMFUpdate;; + +HANDLE hExtraImageListRebuilding, hExtraImageApplying; +HANDLE hStatusBarShowToolTipEvent, hStatusBarHideToolTipEvent; +HANDLE g_hEventThread = 0; + +//not needed,now use MS_CLIST_FRAMEMENUNOTIFY service +//HANDLE hPreBuildFrameMenuEvent;//external event from clistmenus + +LOGFONT TitleBarLogFont = {0}; + +extern HINSTANCE g_hInst; + +//we use dynamic frame list, +//but who wants so huge number of frames ?? +#define MAX_FRAMES 40 + +#define UNCOLLAPSED_FRAME_SIZE 0 + +//legacy menu support +#define frame_menu_lock 1 +#define frame_menu_visible 2 +#define frame_menu_showtitlebar 3 +#define frame_menu_floating 4 +#define frame_menu_skinned 5 + +extern INT_PTR ModifyMenuItemProxy(WPARAM wParam, LPARAM lParam); +static int UpdateTBToolTip(int framepos); +INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam); +int CLUIFrameResizeFloatingFrame(int framepos); +extern int ProcessCommandProxy(WPARAM wParam, LPARAM lParam); +extern int InitFramesMenus(void); +extern int UnitFramesMenu(); +static int CLUIFramesReSort(); + +boolean FramesSysNotStarted = TRUE; +HPEN g_hPenCLUIFrames = 0; + +typedef struct { + int order; + int realpos; +} SortData; + +static SortData g_sd[MAX_FRAMES]; + +static HHOOK g_hFrameHook = 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); +} + +#define CLUIFRAMESSETALIGN "CLUIFramesSetAlign" +#define CLUIFRAMESSETALIGNALTOP "CLUIFramesSetAlignalTop" +#define CLUIFRAMESSETALIGNALCLIENT "CLUIFramesSetAlignalClient" +#define CLUIFRAMESSETALIGNALBOTTOM "CLUIFramesSetAlignalBottom" +#define CLUIFRAMESMOVEUP "CLUIFramesMoveUp" +#define CLUIFRAMESMOVEDOWN "CLUIFramesMoveDown" + +static wndFrame *Frames = NULL; + +wndFrame *wndFrameCLC = NULL, *wndFrameEventArea = NULL, *wndFrameViewMode = NULL; + +static int nFramescount = 0; +static int alclientFrame = -1;//for fast access to frame with alclient properties +static int NextFrameId = 100; + +static int TitleBarH = DEFAULT_TITLEBAR_HEIGHT; +static boolean resizing = FALSE; + +// menus +static HANDLE contMIVisible, contMITitle, contMITBVisible, contMILock, contMIColl, contMIFloating; +static HANDLE contMIAlignRoot; +static HANDLE contMIAlignTop, contMIAlignClient, contMIAlignBottom; +static HANDLE contMIBorder, contMISkinned; +static HANDLE MainMIRoot = (HANDLE) - 1; + +// others +static int ContactListHeight; +static int LastStoreTick = 0; + +static int lbypos = -1; +static int oldframeheight = -1; +static int curdragbar = -1; +static CRITICAL_SECTION csFrameHook; + +static BOOLEAN CLUIFramesFitInSize(void); +HWND hWndExplorerToolBar; +static int GapBetweenFrames = 1; + +static int RemoveItemFromList(int pos, wndFrame **lpFrames, int *FrameItemCount) +{ + memcpy(&((*lpFrames)[pos]), &((*lpFrames)[pos+1]), sizeof(wndFrame)*(*FrameItemCount - pos - 1)); + (*FrameItemCount)--; + return 0; +} + +static int id2pos(int id) +{ + int i; + + if (FramesSysNotStarted) + return -1; + + for (i = 0;i < nFramescount;i++) { + if (Frames[i].id == id) + return(i); + } + return(-1); +} + +int __forceinline btoint(BOOLEAN b) +{ + return(b ? 1 : 0); +} + +void __forceinline lockfrm() +{ + if (FramesSysNotStarted == FALSE) + EnterCriticalSection(&csFrameHook); +} + +void __forceinline ulockfrm() +{ + LeaveCriticalSection(&csFrameHook); +} + +static wndFrame* FindFrameByWnd(HWND hwnd) +{ + BOOL bFound = FALSE; + int i; + + if (hwnd == NULL) + return(NULL); + + for (i = 0;i < nFramescount;i++) { + if ((Frames[i].floating) && (Frames[i].ContainerWnd == hwnd)) + return(&Frames[i]); + } + return(NULL); +} + + +static void DockThumbs(wndFrame *pThumbLeft, wndFrame *pThumbRight, BOOL bMoveLeft) +{ + if ((pThumbRight->dockOpt.hwndLeft == NULL) && (pThumbLeft->dockOpt.hwndRight == NULL)) { + pThumbRight->dockOpt.hwndLeft = pThumbLeft->ContainerWnd; + pThumbLeft->dockOpt.hwndRight = pThumbRight->ContainerWnd; + } +} + + +static void UndockThumbs(wndFrame *pThumb1, wndFrame *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; +} + +BOOLEAN bMoveTogether; + +static void PositionThumb(wndFrame *pThumb, short nX, short nY) +{ + wndFrame *pCurThumb = &Frames[0]; + wndFrame *pDockThumb = pThumb; + wndFrame fakeMainWindow; + wndFrame fakeTaskBarWindow; + RECT rc; + RECT rcThumb; + RECT rcOld; + SIZE sizeScreen; + 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; + + 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); + + 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, TRUE); + } + + if (bDockedLeft) { + DockThumbs(pCurThumb, pThumb, FALSE); + } + } + + // 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 == nFramescount) { + pCurThumb = &fakeMainWindow; + continue; + } + pCurThumb = &Frames[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, + 0, + nNewX, + nNewY, + 0, + 0, + SWP_NOSIZE | SWP_NOZORDER); + + + // OK, move all docked thumbs + if (bMoveTogether) { + pDockThumb = FindFrameByWnd(pDockThumb->dockOpt.hwndRight); + + PositionThumb(pDockThumb, (short)(nNewX + nWidth), (short)nNewY); + } +} + +void GetBorderSize(HWND hwnd, RECT *rect) +{ + RECT wr, cr; + POINT pt1, pt2; + + 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; +} + +//append string +char __forceinline *AS(char *str, const char *setting, char *addstr) +{ + if (str != NULL) { + strcpy(str, setting); + strcat(str, addstr); + } + return str; +} + +int DBLoadFrameSettingsAtPos(int pos, int Frameid) +{ + char sadd[15]; + char buf[255]; + + _itoa(pos, sadd, 10); + + Frames[Frameid].collapsed = cfg::getByte(CLUIFrameModule, AS(buf, "Collapse", sadd), Frames[Frameid].collapsed); + + Frames[Frameid].Locked = cfg::getByte(CLUIFrameModule, AS(buf, "Locked", sadd), Frames[Frameid].Locked); + Frames[Frameid].visible = cfg::getByte(CLUIFrameModule, AS(buf, "Visible", sadd), Frames[Frameid].visible); + Frames[Frameid].TitleBar.ShowTitleBar = cfg::getByte(CLUIFrameModule, AS(buf, "TBVisile", sadd), Frames[Frameid].TitleBar.ShowTitleBar); + + Frames[Frameid].height = cfg::getWord(CLUIFrameModule, AS(buf, "Height", sadd), Frames[Frameid].height); + Frames[Frameid].HeightWhenCollapsed = cfg::getWord(CLUIFrameModule, AS(buf, "HeightCollapsed", sadd), 0); + Frames[Frameid].align = cfg::getWord(CLUIFrameModule, AS(buf, "Align", sadd), Frames[Frameid].align); + + Frames[Frameid].FloatingPos.x = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatX", sadd), 100, 0, 1024); + Frames[Frameid].FloatingPos.y = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatY", sadd), 100, 0, 1024); + Frames[Frameid].FloatingSize.x = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatW", sadd), 100, 0, 1024); + Frames[Frameid].FloatingSize.y = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatH", sadd), 100, 0, 1024); + + Frames[Frameid].floating = cfg::getByte(CLUIFrameModule, AS(buf, "Floating", sadd), 0); + Frames[Frameid].order = cfg::getWord(CLUIFrameModule, AS(buf, "Order", sadd), 0); + + Frames[Frameid].UseBorder = cfg::getByte(CLUIFrameModule, AS(buf, "UseBorder", sadd), Frames[Frameid].UseBorder); + Frames[Frameid].Skinned = cfg::getByte(CLUIFrameModule, AS(buf, "Skinned", sadd), Frames[Frameid].Skinned); + return 0; +} + +int DBStoreFrameSettingsAtPos(int pos, int Frameid) +{ + char sadd[16]; + char buf[255]; + + _itoa(pos, sadd, 10); + + cfg::writeTString(0, CLUIFrameModule, AS(buf, "Name", sadd), Frames[Frameid].name); + //boolean + cfg::writeByte(0, CLUIFrameModule, AS(buf, "Collapse", sadd), (BYTE)btoint(Frames[Frameid].collapsed)); + cfg::writeByte(0, CLUIFrameModule, AS(buf, "Locked", sadd), (BYTE)btoint(Frames[Frameid].Locked)); + cfg::writeByte(0, CLUIFrameModule, AS(buf, "Visible", sadd), (BYTE)btoint(Frames[Frameid].visible)); + cfg::writeByte(0, CLUIFrameModule, AS(buf, "TBVisile", sadd), (BYTE)btoint(Frames[Frameid].TitleBar.ShowTitleBar)); + + cfg::writeWord(CLUIFrameModule, AS(buf, "Height", sadd), (WORD)Frames[Frameid].height); + cfg::writeWord(CLUIFrameModule, AS(buf, "HeightCollapsed", sadd), (WORD)Frames[Frameid].HeightWhenCollapsed); + cfg::writeWord(CLUIFrameModule, AS(buf, "Align", sadd), (WORD)Frames[Frameid].align); + //FloatingPos + cfg::writeWord(CLUIFrameModule, AS(buf, "FloatX", sadd), (WORD)Frames[Frameid].FloatingPos.x); + cfg::writeWord(CLUIFrameModule, AS(buf, "FloatY", sadd), (WORD)Frames[Frameid].FloatingPos.y); + cfg::writeWord(CLUIFrameModule, AS(buf, "FloatW", sadd), (WORD)Frames[Frameid].FloatingSize.x); + cfg::writeWord(0, CLUIFrameModule, AS(buf, "FloatH", sadd), (WORD)Frames[Frameid].FloatingSize.y); + + cfg::writeByte(0, CLUIFrameModule, AS(buf, "Floating", sadd), (BYTE)btoint(Frames[Frameid].floating)); + cfg::writeByte(0, CLUIFrameModule, AS(buf, "UseBorder", sadd), (BYTE)btoint(Frames[Frameid].UseBorder)); + cfg::writeWord(0, CLUIFrameModule, AS(buf, "Order", sadd), (WORD)Frames[Frameid].order); + + cfg::writeByte(CLUIFrameModule, AS(buf, "Skinned", sadd), Frames[Frameid].Skinned); + return 0; +} + +int LocateStorePosition(int Frameid, int maxstored) +{ + int i; + LPTSTR frmname; + char settingname[255]; + if (Frames[Frameid].name == NULL) return -1; + + for (i = 0;i < maxstored;i++) { + mir_snprintf(settingname, sizeof(settingname), "Name%d", i); + frmname = DBGetStringT(0, CLUIFrameModule, settingname); + if (frmname == NULL) continue; + if (lstrcmpi(frmname, Frames[Frameid].name) == 0) { + mir_free(frmname); + return i; + } + mir_free(frmname); + } + return -1; +} + +int CLUIFramesLoadFrameSettings(int Frameid) +{ + int storpos, maxstored; + + if (FramesSysNotStarted) return -1; + + if (Frameid < 0 || Frameid >= nFramescount) + return -1; + + maxstored = cfg::getWord(CLUIFrameModule, "StoredFrames", -1); + if (maxstored == -1) + return 0; + + storpos = LocateStorePosition(Frameid, maxstored); + if (storpos == -1) + return 0; + + DBLoadFrameSettingsAtPos(storpos, Frameid); + return 0; +} + +int CLUIFramesStoreFrameSettings(int Frameid) +{ + int maxstored, storpos; + + if (FramesSysNotStarted) + return -1; + + if (Frameid < 0 || Frameid >= nFramescount) + return -1; + + maxstored = cfg::getWord(CLUIFrameModule, "StoredFrames", -1); + if (maxstored == -1) + maxstored = 0; + + storpos = LocateStorePosition(Frameid, maxstored); + if (storpos == -1) { + storpos = maxstored; + maxstored++; + } + + DBStoreFrameSettingsAtPos(storpos, Frameid); + cfg::writeWord(CLUIFrameModule, "StoredFrames", (WORD)maxstored); + return 0; +} + +int CLUIFramesStoreAllFrames() +{ + int i; + + if (FramesSysNotStarted) + return -1; + + if (cfg::shutDown) + return -1; + + lockfrm(); + for (i = 0;i < nFramescount;i++) + CLUIFramesStoreFrameSettings(i); + ulockfrm(); + return 0; +} + +// Get client frame +int CLUIFramesGetalClientFrame(void) +{ + int i; + if (FramesSysNotStarted) + return -1; + + if (alclientFrame != -1) + return alclientFrame; + + if (alclientFrame != -1) { + /* this value could become invalid if RemoveItemFromList was called, + * so we double-check */ + if (alclientFrame < nFramescount) { + if (Frames[alclientFrame].align == alClient) { + return alclientFrame; + } + } + } + + for (i = 0;i < nFramescount;i++) + if (Frames[i].align == alClient) { + alclientFrame = i; + return i; + } + return -1; +} + +HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, HGENMENU (*pfnAdd )( CLISTMENUITEM* )) +{ + CLISTMENUITEM mi; + //TMO_MenuItem tmi; + HANDLE menuid; + int framepos = id2pos(frameid); + + if (FramesSysNotStarted) return NULL; + + ZeroMemory(&mi, sizeof(mi)); + + mi.cbSize = sizeof(mi); + mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_MIRANDA); //LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA)); + mi.pszPopupName = (char *)root; + mi.popupPosition = frameid; + mi.position = popuppos++; + mi.pszName = LPGEN("&FrameTitle"); + mi.flags = CMIF_CHILDPOPUP | CMIF_GRAYED | CMIF_ICONFROMICOLIB; + mi.pszContactOwner = (char *)0; + menuid = pfnAdd(&mi); + if (frameid == -1) contMITitle = menuid; + else Frames[framepos].MenuHandles.MITitle = menuid; + + popuppos += 100000; + mi.hIcon = NULL; + mi.cbSize = sizeof(mi); + mi.pszPopupName = (char *)root; + mi.popupPosition = frameid; + mi.position = popuppos++; + mi.pszName = LPGEN("&Visible"); + mi.flags = CMIF_CHILDPOPUP | CMIF_CHECKED; + mi.pszContactOwner = (char *)0; + mi.pszService = MS_CLIST_FRAMES_SHFRAME; + menuid = pfnAdd(&mi); + if (frameid == -1) contMIVisible = menuid; + else Frames[framepos].MenuHandles.MIVisible = menuid; + + mi.pszPopupName = (char *)root; + mi.popupPosition = frameid; + mi.position = popuppos++; + mi.pszName = LPGEN("&Show TitleBar"); + mi.flags = CMIF_CHILDPOPUP | CMIF_CHECKED; + mi.pszService = MS_CLIST_FRAMES_SHFRAMETITLEBAR; + mi.pszContactOwner = (char *)0; + menuid = pfnAdd(&mi); + if (frameid == -1) contMITBVisible = menuid; + else Frames[framepos].MenuHandles.MITBVisible = menuid; + + + popuppos += 100000; + + mi.pszPopupName = (char *)root; + mi.popupPosition = frameid; + mi.position = popuppos++; + mi.pszName = LPGEN("&Locked"); + mi.flags = CMIF_CHILDPOPUP | CMIF_CHECKED; + mi.pszService = MS_CLIST_FRAMES_ULFRAME; + mi.pszContactOwner = (char *)0; + menuid = pfnAdd(&mi); + if (frameid == -1) contMILock = menuid; + else Frames[framepos].MenuHandles.MILock = menuid; + + mi.pszPopupName = (char *)root; + mi.popupPosition = frameid; + mi.position = popuppos++; + mi.pszName = LPGEN("&Collapsed"); + mi.flags = CMIF_CHILDPOPUP | CMIF_CHECKED; + mi.pszService = MS_CLIST_FRAMES_UCOLLFRAME; + mi.pszContactOwner = (char *)0; + menuid = pfnAdd(&mi); + if (frameid == -1) contMIColl = menuid; + else Frames[framepos].MenuHandles.MIColl = menuid; + + //floating + mi.pszPopupName = (char *)root; + mi.popupPosition = frameid; + mi.position = popuppos++; + mi.pszName = LPGEN("&Floating Mode"); + mi.flags = CMIF_CHILDPOPUP; + mi.pszService = "Set_Floating"; + mi.pszContactOwner = (char *)0; + menuid = pfnAdd(&mi); + if (frameid == -1) contMIFloating = menuid; + else Frames[framepos].MenuHandles.MIFloating = menuid; + + + popuppos += 100000; + + mi.pszPopupName = (char *)root; + mi.popupPosition = frameid; + mi.position = popuppos++; + mi.pszName = LPGEN("&Border"); + mi.flags = CMIF_CHILDPOPUP | CMIF_CHECKED; + mi.pszService = MS_CLIST_FRAMES_SETUNBORDER; + mi.pszContactOwner = (char *)0; + menuid = pfnAdd(&mi); + if (frameid == -1) contMIBorder = menuid; + else Frames[framepos].MenuHandles.MIBorder = menuid; + + popuppos += 100000; + + mi.pszPopupName = (char *)root; + mi.popupPosition = frameid; + mi.position = popuppos++; + mi.pszName = LPGEN("&Skinned frame"); + mi.flags = CMIF_CHILDPOPUP | CMIF_CHECKED; + mi.pszService = MS_CLIST_FRAMES_SETSKINNED; + mi.pszContactOwner = (char *)0; + menuid = pfnAdd(&mi); + if (frameid == -1) contMISkinned = menuid; + else Frames[framepos].MenuHandles.MISkinned = menuid; + + popuppos += 100000; + + { + //alignment root + mi.pszPopupName = (char *)root; + mi.popupPosition = frameid; + mi.position = popuppos++; + mi.pszName = LPGEN("&Align"); + mi.flags = CMIF_CHILDPOPUP | CMIF_ROOTPOPUP; + mi.pszService = ""; + mi.pszContactOwner = (char *)0; + menuid = pfnAdd(&mi); + if (frameid == -1) contMIAlignRoot = menuid; + else Frames[framepos].MenuHandles.MIAlignRoot = menuid; + + mi.flags = CMIF_CHILDPOPUP; + //align top + mi.pszPopupName = (char *)menuid; + mi.popupPosition = frameid; + mi.position = popuppos++; + mi.pszName = LPGEN("&Top"); + mi.pszService = CLUIFRAMESSETALIGNALTOP; + mi.pszContactOwner = (char *)alTop; + menuid = pfnAdd(&mi); + if (frameid == -1) contMIAlignTop = menuid; + else Frames[framepos].MenuHandles.MIAlignTop = menuid; + + + //align client + mi.position = popuppos++; + mi.pszName = LPGEN("&Client"); + mi.pszService = CLUIFRAMESSETALIGNALCLIENT; + mi.pszContactOwner = (char *)alClient; + menuid = pfnAdd(&mi); + if (frameid == -1) contMIAlignClient = menuid; + else Frames[framepos].MenuHandles.MIAlignClient = menuid; + + //align bottom + mi.position = popuppos++; + mi.pszName = LPGEN("&Bottom"); + mi.pszService = CLUIFRAMESSETALIGNALBOTTOM; + mi.pszContactOwner = (char *)alBottom; + menuid = pfnAdd(&mi); + if (frameid == -1) contMIAlignBottom = menuid; + else Frames[framepos].MenuHandles.MIAlignBottom = menuid; + + } + + { //position + //position root + mi.pszPopupName = (char *)root; + mi.popupPosition = frameid; + mi.position = popuppos++; + mi.pszName = LPGEN("&Position"); + mi.flags = CMIF_CHILDPOPUP | CMIF_ROOTPOPUP; + mi.pszService = ""; + mi.pszContactOwner = (char *)0; + menuid = pfnAdd(&mi); + + mi.pszPopupName = (char *)menuid; + mi.popupPosition = frameid; + mi.position = popuppos++; + mi.pszName = LPGEN("&Up"); + mi.flags = CMIF_CHILDPOPUP; + mi.pszService = CLUIFRAMESMOVEUP; + mi.pszContactOwner = (char *)1; + pfnAdd(&mi); + + mi.pszPopupName = (char *)menuid; + mi.popupPosition = frameid; + mi.position = popuppos++; + mi.pszName = LPGEN("&Down"); + mi.flags = CMIF_CHILDPOPUP; + mi.pszService = CLUIFRAMESMOVEDOWN; + mi.pszContactOwner = (char *) - 1; + pfnAdd(&mi); + } + + return 0; +} + +int ModifyMItem(WPARAM wParam, LPARAM lParam) +{ + return ModifyMenuItemProxy(wParam, lParam); +}; + + +static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM lParam) +{ + int pos; + CLISTMENUITEM mi; + + if (FramesSysNotStarted) + return -1; + + lockfrm(); + pos = id2pos((INT_PTR)wParam); + + if (pos >= 0 && pos < nFramescount) { + memset(&mi, 0, sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.flags = CMIM_NAME | CMIF_CHILDPOPUP | CMIF_TCHAR; + mi.ptszName = Frames[pos].TitleBar.tbname ? Frames[pos].TitleBar.tbname : Frames[pos].name; + ModifyMItem((WPARAM)contMITitle, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; + if (Frames[pos].visible) mi.flags |= CMIF_CHECKED; + ModifyMItem((WPARAM)contMIVisible, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; + if (Frames[pos].Locked) mi.flags |= CMIF_CHECKED; + ModifyMItem((WPARAM)contMILock, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; + if (Frames[pos].TitleBar.ShowTitleBar) mi.flags |= CMIF_CHECKED; + ModifyMItem((WPARAM)contMITBVisible, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; + if (Frames[pos].floating) mi.flags |= CMIF_CHECKED; + ModifyMItem((WPARAM)contMIFloating, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; + if ((Frames[pos].UseBorder)) mi.flags |= CMIF_CHECKED; + ModifyMItem((WPARAM)contMIBorder, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; + if ((Frames[pos].Skinned)) mi.flags |= CMIF_CHECKED; + ModifyMItem((WPARAM)contMISkinned, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; + if (Frames[pos].align&alTop) mi.flags |= CMIF_CHECKED; + ModifyMItem((WPARAM)contMIAlignTop, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; + if (Frames[pos].align&alClient) mi.flags |= CMIF_CHECKED; + ModifyMItem((WPARAM)contMIAlignClient, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; + if (Frames[pos].align&alBottom) mi.flags |= CMIF_CHECKED; + ModifyMItem((WPARAM)contMIAlignBottom, (LPARAM)&mi); + + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; + if (!Frames[pos].collapsed) mi.flags |= CMIF_CHECKED; + if ((!Frames[pos].visible) || (Frames[pos].Locked) || (pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED; + ModifyMItem((WPARAM)contMIColl, (LPARAM)&mi); + } + ulockfrm(); + return 0; +} + +INT_PTR CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM lParam) +{ + int pos; + CLISTMENUITEM mi; + + if (FramesSysNotStarted) + return -1; + + lockfrm(); + pos = id2pos((INT_PTR)wParam); + + if (pos >= 0 && pos < nFramescount) { + memset(&mi, 0, sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.flags = CMIM_NAME | CMIF_CHILDPOPUP | CMIF_TCHAR; + mi.ptszName = Frames[pos].TitleBar.tbname ? Frames[pos].TitleBar.tbname : Frames[pos].name; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MITitle, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; + if (Frames[pos].visible) mi.flags |= CMIF_CHECKED; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MIVisible, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; + if (Frames[pos].Locked) mi.flags |= CMIF_CHECKED; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MILock, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; + if (Frames[pos].TitleBar.ShowTitleBar) mi.flags |= CMIF_CHECKED; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MITBVisible, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; + if (Frames[pos].floating) mi.flags |= CMIF_CHECKED; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MIFloating, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; + if ((Frames[pos].UseBorder)) mi.flags |= CMIF_CHECKED; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MIBorder, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; + if ((Frames[pos].Skinned)) mi.flags |= CMIF_CHECKED; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MISkinned, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | ((Frames[pos].align & alClient) ? CMIF_GRAYED : 0); + if (Frames[pos].align&alTop) mi.flags |= CMIF_CHECKED; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MIAlignTop, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; + if (Frames[pos].align&alClient) mi.flags |= CMIF_CHECKED; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MIAlignClient, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | ((Frames[pos].align & alClient) ? CMIF_GRAYED : 0); + if (Frames[pos].align&alBottom) mi.flags |= CMIF_CHECKED; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MIAlignBottom, (LPARAM)&mi); + + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; + if (!Frames[pos].collapsed) mi.flags |= CMIF_CHECKED; + if ((!Frames[pos].visible) || Frames[pos].Locked || (pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MIColl, (LPARAM)&mi); + } + ulockfrm(); + return 0; +} + +INT_PTR CLUIFramesGetFrameOptions(WPARAM wParam, LPARAM lParam) +{ + int pos; + INT_PTR retval; + + if (FramesSysNotStarted) return -1; + + lockfrm(); + pos = id2pos(HIWORD(wParam)); + if (pos < 0 || pos >= nFramescount) { + ulockfrm(); + return -1; + } + + switch (LOWORD(wParam)) { + case FO_FLAGS: + retval = 0; + if (Frames[pos].visible) retval |= F_VISIBLE; + if (!Frames[pos].collapsed) retval |= F_UNCOLLAPSED; + if (Frames[pos].Locked) retval |= F_LOCKED; + if (Frames[pos].TitleBar.ShowTitleBar) retval |= F_SHOWTB; + if (Frames[pos].TitleBar.ShowTitleBarTip) retval |= F_SHOWTBTIP; + if (Frames[pos].Skinned) retval |= F_SKINNED; + if (!(GetWindowLongPtr(Frames[pos].hWnd, GWL_STYLE)&WS_BORDER)) retval |= F_NOBORDER; + break; + + case FO_NAME: + retval = (INT_PTR)Frames[pos].name; + break; + + case FO_TBNAME: + retval = (INT_PTR)Frames[pos].TitleBar.tbname; + break; + + case FO_TBTIPNAME: + retval = (INT_PTR)Frames[pos].TitleBar.tooltip; + break; + + case FO_TBSTYLE: + retval = GetWindowLongPtr(Frames[pos].TitleBar.hwnd, GWL_STYLE); + break; + + case FO_TBEXSTYLE: + retval = GetWindowLongPtr(Frames[pos].TitleBar.hwnd, GWL_EXSTYLE); + break; + + case FO_ICON: + retval = (INT_PTR)Frames[pos].TitleBar.hicon; + break; + + case FO_HEIGHT: + retval = (INT_PTR)Frames[pos].height; + break; + + case FO_ALIGN: + retval = (INT_PTR)Frames[pos].align; + break; + case FO_FLOATING: + retval = (int)Frames[pos].floating; + break; + default: + retval = -1; + break; + } + ulockfrm(); + return retval; +} + +INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam) +{ + int pos; + int retval; // value to be returned + + if (FramesSysNotStarted) + return -1; + + lockfrm(); + pos = id2pos(HIWORD(wParam)); + if (pos < 0 || pos >= nFramescount) { + ulockfrm(); + return -1; + } + + switch (LOWORD(wParam) & ~FO_UNICODETEXT) { + case FO_FLAGS: { + int flag = lParam; + int style; + + Frames[pos].dwFlags = flag; + Frames[pos].visible = FALSE; + if (flag&F_VISIBLE) Frames[pos].visible = TRUE; + + Frames[pos].collapsed = TRUE; + if (flag&F_UNCOLLAPSED) Frames[pos].collapsed = FALSE; + + Frames[pos].Locked = FALSE; + if (flag&F_LOCKED) Frames[pos].Locked = TRUE; + + Frames[pos].UseBorder = TRUE; + if (flag&F_NOBORDER) Frames[pos].UseBorder = FALSE; + + Frames[pos].TitleBar.ShowTitleBar = FALSE; + if (flag&F_SHOWTB) Frames[pos].TitleBar.ShowTitleBar = TRUE; + + Frames[pos].TitleBar.ShowTitleBarTip = FALSE; + if (flag&F_SHOWTBTIP) Frames[pos].TitleBar.ShowTitleBarTip = TRUE; + + SendMessage(Frames[pos].TitleBar.hwndTip, TTM_ACTIVATE, (WPARAM)Frames[pos].TitleBar.ShowTitleBarTip, 0); + + style = (int)GetWindowLongPtr(Frames[pos].hWnd, GWL_STYLE); + style |= WS_BORDER; + style |= CLS_SKINNEDFRAME; + + if (flag&F_NOBORDER) + style &= (~WS_BORDER); + + Frames[pos].Skinned = FALSE; + if (flag & F_SKINNED) + Frames[pos].Skinned = TRUE; + + if (!(flag & F_SKINNED)) + style &= ~CLS_SKINNEDFRAME; + + SetWindowLongPtr(Frames[pos].hWnd, GWL_STYLE, (LONG)style); + SetWindowLongPtr(Frames[pos].TitleBar.hwnd, GWL_STYLE, (LONG)style & ~(WS_VSCROLL | WS_HSCROLL)); + + ulockfrm(); + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); + SetWindowPos(Frames[pos].TitleBar.hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + return 0; + } + + case FO_NAME: + if (lParam == (LPARAM)NULL) { + ulockfrm(); + return -1; + } + mir_free(Frames[pos].name); + Frames[pos].name = (wParam & FO_UNICODETEXT) ? mir_u2t((LPWSTR)lParam) : mir_a2t((LPSTR)lParam); + ulockfrm(); + return 0; + + case FO_TBNAME: + if (lParam == (LPARAM)NULL) { + ulockfrm(); + return(-1); + } + mir_free(Frames[pos].TitleBar.tbname); + Frames[pos].TitleBar.tbname = (wParam & FO_UNICODETEXT) ? mir_u2t((LPWSTR)lParam) : mir_a2t((LPSTR)lParam); + ulockfrm(); + if (Frames[pos].floating && (Frames[pos].TitleBar.tbname != NULL)) + SetWindowText(Frames[pos].ContainerWnd, Frames[pos].TitleBar.tbname); + return 0; + + case FO_TBTIPNAME: + if (lParam == (LPARAM)NULL) { + ulockfrm(); + return(-1); + } + mir_free(Frames[pos].TitleBar.tooltip); + Frames[pos].TitleBar.tooltip = (wParam & FO_UNICODETEXT) ? mir_u2t((LPWSTR)lParam) : mir_a2t((LPSTR)lParam); + UpdateTBToolTip(pos); + ulockfrm(); + return 0; + + case FO_TBSTYLE: + SetWindowLongPtr(Frames[pos].TitleBar.hwnd, GWL_STYLE, lParam); + ulockfrm(); + return 0; + + case FO_TBEXSTYLE: + SetWindowLongPtr(Frames[pos].TitleBar.hwnd, GWL_EXSTYLE, lParam); + ulockfrm(); + return 0; + + case FO_ICON: + Frames[pos].TitleBar.hicon = (HICON)lParam; + ulockfrm(); + return 0; + + case FO_HEIGHT: + { + if (lParam < 0) { + ulockfrm(); + return -1; + } + if(Frames[pos].Skinned) { + int uID = (Frames[pos].TitleBar.ShowTitleBar ? ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE : ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE); + lParam += (StatusItems[uID].MARGIN_BOTTOM + StatusItems[uID].MARGIN_TOP); + } + if (Frames[pos].collapsed) { + int oldHeight = Frames[pos].height; + retval = Frames[pos].height; + Frames[pos].height = lParam; + if (!CLUIFramesFitInSize()) + Frames[pos].height = retval; + retval = Frames[pos].height; + + if (Frames[pos].height != oldHeight) { + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,(LPARAM)0); + if(Frames[pos].Skinned) + RedrawWindow(Frames[pos].hWnd, 0, 0, RDW_FRAME|RDW_UPDATENOW|RDW_INVALIDATE); + } + } + else { + retval = Frames[pos].HeightWhenCollapsed; + Frames[pos].HeightWhenCollapsed = lParam; + if (!CLUIFramesFitInSize()) + Frames[pos].HeightWhenCollapsed = retval; + retval = Frames[pos].HeightWhenCollapsed; + } + ulockfrm(); + return(retval); + } + + case FO_FLOATING: + if (lParam < 0) { + ulockfrm(); + return -1; + } + { + int id = Frames[pos].id; + Frames[pos].floating = !(lParam); + ulockfrm(); + + CLUIFrameSetFloat(id, 1);//lparam=1 use stored width and height + return(wParam); + } + case FO_ALIGN: + if (!(lParam&alTop || lParam&alBottom || lParam&alClient)) { + ulockfrm(); + return(-1); + } + if ((lParam&alClient) && (CLUIFramesGetalClientFrame() >= 0)) { //only one alClient frame possible + alclientFrame = -1;//recalc it + ulockfrm(); + return -1; + } + Frames[pos].align = lParam; + ulockfrm(); + return(0); + } + ulockfrm(); + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); + return -1; +} + +static INT_PTR CLUIFramesShowAll(WPARAM wParam, LPARAM lParam) +{ + int i; + + if (FramesSysNotStarted) return -1; + + for (i = 0;i < nFramescount;i++) + Frames[i].visible = TRUE; + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); + return 0; +} + +INT_PTR CLUIFramesShowAllTitleBars(WPARAM wParam, LPARAM lParam) +{ + int i; + + if (FramesSysNotStarted) return -1; + + for (i = 0;i < nFramescount;i++) { + Frames[i].TitleBar.ShowTitleBar = TRUE; + SetWindowPos(Frames[i].hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + } + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); + RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + return 0; +} + +//wparam=lparam=0 +INT_PTR CLUIFramesHideAllTitleBars(WPARAM wParam, LPARAM lParam) +{ + int i; + + if (FramesSysNotStarted) return -1; + + for (i = 0;i < nFramescount;i++) { + Frames[i].TitleBar.ShowTitleBar = FALSE; + SetWindowPos(Frames[i].hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + } + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); + RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + return 0; +} + +//wparam=frameid +INT_PTR CLUIFramesShowHideFrame(WPARAM wParam, LPARAM lParam) +{ + int pos; + + if (FramesSysNotStarted) + return -1; + + lockfrm(); + pos = id2pos((INT_PTR)wParam); + if (pos >= 0 && !lstrcmp(Frames[pos].name, _T("My Contacts"))) + Frames[pos].visible = 1; + else { + if (pos >= 0 && (int)pos < nFramescount) + Frames[pos].visible = !Frames[pos].visible; + if (Frames[pos].floating) + CLUIFrameResizeFloatingFrame(pos); + } + ulockfrm(); + if (!Frames[pos].floating) + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); + RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + return 0; +} + +//wparam=frameid +INT_PTR CLUIFramesShowHideFrameTitleBar(WPARAM wParam, LPARAM lParam) +{ + int pos; + + if (FramesSysNotStarted) + return -1; + + lockfrm(); + pos = id2pos((INT_PTR)wParam); + if (pos >= 0 && (int)pos < nFramescount) { + Frames[pos].TitleBar.ShowTitleBar = !Frames[pos].TitleBar.ShowTitleBar; + SetWindowPos(Frames[pos].hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + } + ulockfrm(); + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); + RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + return 0; +} + + +//wparam=frameid +//lparam=-1 up ,1 down +INT_PTR CLUIFramesMoveUpDown(WPARAM wParam, LPARAM lParam) +{ + int pos, i, curpos, curalign, v, tmpval; + + if (FramesSysNotStarted) + return -1; + + lockfrm(); + pos = id2pos((INT_PTR)wParam); + if (pos >= 0 && (int)pos < nFramescount) { + curpos = Frames[pos].order; + curalign = Frames[pos].align; + v = 0; + memset(g_sd, 0, sizeof(SortData) * MAX_FRAMES); + for (i = 0;i < nFramescount;i++) { + if (Frames[i].floating || (!Frames[i].visible) || (Frames[i].align != curalign)) + continue; + g_sd[v].order = Frames[i].order; + g_sd[v].realpos = i; + v++; + } + if (v == 0) { + ulockfrm(); + return(0); + } + qsort(g_sd, v, sizeof(SortData), sortfunc); + for (i = 0;i < v;i++) { + if (g_sd[i].realpos == pos) { + if (lParam == -1) { + if (i < 1) break; + tmpval = Frames[g_sd[i-1].realpos].order; + Frames[g_sd[i-1].realpos].order = Frames[pos].order; + Frames[pos].order = tmpval; + break; + } + if (lParam == 1) { + if (i > v - 1) break; + tmpval = Frames[g_sd[i+1].realpos].order; + Frames[g_sd[i+1].realpos].order = Frames[pos].order; + Frames[pos].order = tmpval; + break; + } + } + } + ulockfrm(); + CLUIFramesReSort(); + //CLUIFramesStoreAllFrames(); + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + PostMessage(pcli->hwndContactList, CLUIINTM_REDRAW, 0, 0); + } + return(0); +} + +static INT_PTR CLUIFramesMoveUp(WPARAM wParam, LPARAM lParam) +{ + return(CLUIFramesMoveUpDown(wParam, -1)); +} + +static INT_PTR CLUIFramesMoveDown(WPARAM wParam, LPARAM lParam) +{ + return(CLUIFramesMoveUpDown(wParam, 1)); +} + + +//wparam=frameid +//lparam=alignment +INT_PTR CLUIFramesSetAlign(WPARAM wParam, LPARAM lParam) +{ + if (FramesSysNotStarted) return -1; + + CLUIFramesSetFrameOptions(MAKEWPARAM(FO_ALIGN, wParam), lParam); + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + return(0); +} +INT_PTR CLUIFramesSetAlignalTop(WPARAM wParam, LPARAM lParam) +{ + if (FramesSysNotStarted) return -1; + + return CLUIFramesSetAlign(wParam, alTop); +} +INT_PTR CLUIFramesSetAlignalBottom(WPARAM wParam, LPARAM lParam) +{ + if (FramesSysNotStarted) return -1; + + return CLUIFramesSetAlign(wParam, alBottom); +} +INT_PTR CLUIFramesSetAlignalClient(WPARAM wParam, LPARAM lParam) +{ + if (FramesSysNotStarted) return -1; + + return CLUIFramesSetAlign(wParam, alClient); +} + + +//wparam=frameid +INT_PTR CLUIFramesLockUnlockFrame(WPARAM wParam, LPARAM lParam) +{ + int pos; + + if (FramesSysNotStarted) + return -1; + + lockfrm(); + pos = id2pos((INT_PTR)wParam); + if (pos >= 0 && (int)pos < nFramescount) { + Frames[pos].Locked = !Frames[pos].Locked; + CLUIFramesStoreFrameSettings(pos); + } + ulockfrm(); + return 0; +} + +//wparam=frameid +INT_PTR CLUIFramesSetUnSetBorder(WPARAM wParam, LPARAM lParam) +{ + RECT rc; + int FrameId, oldflags; + HWND hw; + boolean flt; + + if (FramesSysNotStarted) + return -1; + + lockfrm(); + FrameId = id2pos((INT_PTR)wParam); + if (FrameId == -1) { + ulockfrm(); + return(-1); + } + flt = oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, wParam), 0); + + if (oldflags&F_NOBORDER) + oldflags &= (~F_NOBORDER); + else + oldflags |= F_NOBORDER; + + hw = Frames[FrameId].hWnd; + GetWindowRect(hw, &rc); + ulockfrm(); + CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, wParam), oldflags); + SetWindowPos(hw, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOZORDER); + return(0); +} + +//wparam=frameid +INT_PTR CLUIFramesSetUnSetSkinned(WPARAM wParam, LPARAM lParam) +{ + RECT rc; + int FrameId, oldflags; + HWND hw; + boolean flt; + + if (FramesSysNotStarted) + return -1; + + lockfrm(); + FrameId = id2pos((INT_PTR)wParam); + if (FrameId == -1) { + ulockfrm(); + return(-1); + } + flt = oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, wParam), 0); + + if (oldflags & F_SKINNED) + oldflags &= ~F_SKINNED; + else + oldflags |= F_SKINNED; + + hw = Frames[FrameId].hWnd; + GetWindowRect(hw, &rc); + ulockfrm(); + CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, wParam), oldflags); + SetWindowPos(hw, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOZORDER); + return(0); +} + +//wparam=frameid +INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam, LPARAM lParam) +{ + int FrameId; + + if (FramesSysNotStarted) + return -1; + + TitleBarH = cfg::dat.titleBarHeight; + lockfrm(); + FrameId = id2pos((INT_PTR)wParam); + if (FrameId >= 0 && FrameId < nFramescount) { + int oldHeight; + + // do not collapse/uncollapse client/locked/invisible frames + if (Frames[FrameId].align == alClient && !(Frames[FrameId].Locked || (!Frames[FrameId].visible) || Frames[FrameId].floating)) { + RECT rc; + if (CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { + ulockfrm(); + return 0; + } + if (cfg::getByte("CLUI", "AutoSize", 0)) { + ulockfrm(); + return 0; + } + GetWindowRect(pcli->hwndContactList, &rc); + + if (Frames[FrameId].collapsed == TRUE) { + rc.bottom -= rc.top; + rc.bottom -= Frames[FrameId].height; + Frames[FrameId].HeightWhenCollapsed = Frames[FrameId].height; + Frames[FrameId].collapsed = FALSE; + } else { + rc.bottom -= rc.top; + rc.bottom += Frames[FrameId].HeightWhenCollapsed; + Frames[FrameId].collapsed = TRUE; + } + + SetWindowPos(pcli->hwndContactList, NULL, 0, 0, rc.right - rc.left, rc.bottom, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE); + + CLUIFramesStoreAllFrames(); + ulockfrm(); + RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + return 0; + + } + if (Frames[FrameId].Locked || (!Frames[FrameId].visible)) { + ulockfrm(); + return 0; + } + + oldHeight = Frames[FrameId].height; + + // if collapsed, uncollapse + if (Frames[FrameId].collapsed == TRUE) { + Frames[FrameId].HeightWhenCollapsed = Frames[FrameId].height; + Frames[FrameId].height = UNCOLLAPSED_FRAME_SIZE; + Frames[FrameId].collapsed = FALSE; + } + // if uncollapsed, collapse + else { + Frames[FrameId].height = Frames[FrameId].HeightWhenCollapsed; + Frames[FrameId].collapsed = TRUE; + } + + if (!Frames[FrameId].floating) { + + if (!CLUIFramesFitInSize()) { + //cant collapse,we can resize only for height 2*UNCOLLAPSED_FRAME_SIZE) { + oldHeight = Frames[alfrm].height - UNCOLLAPSED_FRAME_SIZE; + Frames[FrameId].collapsed = TRUE; + } + } else { + int i, sumheight = 0; + + for (i = 0;i < nFramescount;i++) { + if ((Frames[i].align != alClient) && (!Frames[i].floating) && (Frames[i].visible) && (!Frames[i].needhide)) { + sumheight += (Frames[i].height) + (TitleBarH * btoint(Frames[i].TitleBar.ShowTitleBar)) + 2; + ulockfrm(); + return FALSE; + } + if (sumheight > ContactListHeight - 0 - 2) + Frames[FrameId].height = (ContactListHeight - 0 - 2) - sumheight; + } + } + Frames[FrameId].height = oldHeight; + if (Frames[FrameId].collapsed == FALSE) { + if (Frames[FrameId].floating) + SetWindowPos(Frames[FrameId].ContainerWnd, HWND_TOP, 0, 0, Frames[FrameId].wndSize.right - Frames[FrameId].wndSize.left + 6, Frames[FrameId].height + DEFAULT_TITLEBAR_HEIGHT + 4, SWP_SHOWWINDOW | SWP_NOMOVE); + ulockfrm(); + return -1; + } + } + } + ulockfrm(); + if (!Frames[FrameId].floating) + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + else { + RECT contwnd; + GetWindowRect(Frames[FrameId].ContainerWnd, &contwnd); + contwnd.top = contwnd.bottom - contwnd.top;//height + contwnd.left = contwnd.right - contwnd.left;//width + + contwnd.top -= (oldHeight - Frames[FrameId].height);//newheight + SetWindowPos(Frames[FrameId].ContainerWnd, HWND_TOP, 0, 0, contwnd.left, contwnd.top, SWP_SHOWWINDOW | SWP_NOMOVE); + } + RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + CLUIFramesStoreAllFrames(); + return(0); + } else { + ulockfrm(); + return -1; + } + ulockfrm(); + return 0; +} + +static int CLUIFramesLoadMainMenu() +{ + CLISTMENUITEM mi; + int i, separator; + + if (FramesSysNotStarted) + return -1; + + if (MainMIRoot != (HANDLE) - 1) { + CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)MainMIRoot, 0); + MainMIRoot = (HANDLE) - 1; + } + + ZeroMemory(&mi, sizeof(mi)); + mi.cbSize = sizeof(mi); + + // create root menu + mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_MIRANDA); //LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA)); + mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB; + mi.position = (int)3000090000; + mi.pszPopupName = (char*) - 1; + mi.pszName = LPGEN("Frames"); + mi.pszService = 0; + MainMIRoot = Menu_AddMainMenuItem(&mi); + + // create frames menu + separator = (int)3000200000; + for (i = 0;i < nFramescount;i++) { + mi.hIcon = Frames[i].TitleBar.hicon; + mi.flags = CMIF_CHILDPOPUP | CMIF_ROOTPOPUP | CMIF_TCHAR; + mi.position = separator; + mi.pszPopupName = (char*)MainMIRoot; + mi.ptszName = Frames[i].TitleBar.tbname ? Frames[i].TitleBar.tbname : Frames[i].name; + mi.pszService = 0; + Frames[i].MenuHandles.MainMenuItem = Menu_AddMainMenuItem(&mi); + CLUIFramesCreateMenuForFrame(Frames[i].id, (int)Frames[i].MenuHandles.MainMenuItem, separator, Menu_AddMainMenuItem); + CLUIFramesModifyMainMenuItems(Frames[i].id, 0); + //NotifyEventHooks(hPreBuildFrameMenuEvent,i,(LPARAM)Frames[i].MenuHandles.MainMenuItem); + CallService(MS_CLIST_FRAMEMENUNOTIFY, (WPARAM)Frames[i].id, (LPARAM)Frames[i].MenuHandles.MainMenuItem); + separator++; + } + + separator += 100000; + + // create "show all frames" menu + mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA)); + mi.flags = CMIF_CHILDPOPUP; + mi.position = separator++; + mi.pszPopupName = (char*)MainMIRoot; + mi.pszName = LPGEN("Show All Frames"); + mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMES; + Menu_AddMainMenuItem(&mi); + + // create "show all titlebars" menu + mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_HELP)); + mi.position = separator++; + mi.pszPopupName = (char*)MainMIRoot; + mi.flags = CMIF_CHILDPOPUP; + mi.pszName = LPGEN("Show All Titlebars"); + mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMESTB; + Menu_AddMainMenuItem(&mi); + + // create "hide all titlebars" menu + mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_HELP)); + mi.position = separator++; + mi.pszPopupName = (char*)MainMIRoot; + mi.flags = CMIF_CHILDPOPUP; + mi.pszName = LPGEN("Hide All Titlebars"); + mi.pszService = MS_CLIST_FRAMES_HIDEALLFRAMESTB; + Menu_AddMainMenuItem(&mi); + + return 0; +} + +static HFONT CLUILoadTitleBarFont() +{ + char facename[] = "MS Shell Dlg"; + HFONT hfont; + LOGFONT logfont; + memset(&logfont, 0, sizeof(logfont)); + memcpy(logfont.lfFaceName, facename, sizeof(facename)); + logfont.lfWeight = FW_NORMAL; + logfont.lfHeight = -10; + hfont = CreateFontIndirect(&logfont); + return hfont; +} + +static int UpdateTBToolTip(int framepos) +{ + { + TOOLINFO ti; + + ZeroMemory(&ti, sizeof(ti)); + ti.cbSize = sizeof(ti); + ti.lpszText = Frames[framepos].TitleBar.tooltip; + ti.hinst = g_hInst; + ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS ; + ti.uId = (UINT_PTR)Frames[framepos].TitleBar.hwnd; + + return(SendMessage(Frames[framepos].TitleBar.hwndTip, TTM_UPDATETIPTEXT, (WPARAM)0, (LPARAM)&ti)); + } + +}; + +int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BOOL hasTitleBar) +{ + HDC hdc; + RECT rcWindow, rc; + HWND hwndParent = GetParent(hwnd); + LRESULT result; + + if (hwndParent != pcli->hwndContactList || !cfg::dat.bSkinnedScrollbar) + result = CallWindowProc(oldWndProc, hwnd, WM_NCPAINT, wParam, lParam); + else + result = 0; + + if (pcli && pcli->hwndContactList && GetParent(hwnd) == pcli->hwndContactList) { + if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SKINNEDFRAME) { + StatusItems_t *item = StatusItems ? (hasTitleBar ? &StatusItems[ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE] : &StatusItems[ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE]) : 0; + HDC realDC; + HBITMAP hbmDraw, hbmOld; + + if (item == 0) + return 0; + + GetWindowRect(hwnd, &rcWindow); + rc.left = rc.top = 0; + rc.right = rcWindow.right - rcWindow.left; + rc.bottom = rcWindow.bottom - rcWindow.top; + + hdc = realDC = GetWindowDC(hwnd); + if (hwnd == pcli->hwndContactTree) { + realDC = CreateCompatibleDC(hdc); + hbmDraw = CreateCompatibleBitmap(hdc, rc.right, rc.bottom); + hbmOld = reinterpret_cast(SelectObject(realDC, hbmDraw)); + } + + ExcludeClipRect(realDC, item->MARGIN_LEFT, item->MARGIN_TOP, rc.right - item->MARGIN_RIGHT, rc.bottom - item->MARGIN_BOTTOM); + + BitBlt(realDC, 0, 0, rc.right - rc.left, rc.bottom - rc.top, cfg::dat.hdcBg, rcWindow.left - cfg::dat.ptW.x, rcWindow.top - cfg::dat.ptW.y, SRCCOPY); + + DrawAlpha(realDC, &rc, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT, item->GRADIENT, + item->CORNER, item->BORDERSTYLE, item->imageItem); + if (hwnd == pcli->hwndContactTree) { + ExcludeClipRect(hdc, item->MARGIN_LEFT, item->MARGIN_TOP, rc.right - item->MARGIN_RIGHT, rc.bottom - item->MARGIN_BOTTOM); + BitBlt(hdc, 0, 0, rc.right, rc.bottom, realDC, 0, 0, SRCCOPY); + SelectObject(realDC, hbmOld); + DeleteObject(hbmDraw); + DeleteDC(realDC); + } + ReleaseDC(hwnd, hdc); + return 0; + } else if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_BORDER) { + HPEN hPenOld; + HBRUSH brold; + + hdc = GetWindowDC(hwnd); + hPenOld = reinterpret_cast(SelectObject(hdc, g_hPenCLUIFrames)); + GetWindowRect(hwnd, &rcWindow); + rc.left = rc.top = 0; + rc.right = rcWindow.right - rcWindow.left; + rc.bottom = rcWindow.bottom - rcWindow.top; + brold = reinterpret_cast(SelectObject(hdc, GetStockObject(HOLLOW_BRUSH))); + Rectangle(hdc, 0, 0, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top); + SelectObject(hdc, hPenOld); + SelectObject(hdc, brold); + ReleaseDC(hwnd, hdc); + return 0; + } + } + return result; +} + +int FrameNCCalcSize(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BOOL hasTitleBar) +{ + StatusItems_t *item = StatusItems ? (hasTitleBar ? &StatusItems[ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE] : &StatusItems[ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE]) : 0; + LRESULT orig = oldWndProc ? CallWindowProc(oldWndProc, hwnd, WM_NCCALCSIZE, wParam, lParam) : 0; + NCCALCSIZE_PARAMS *nccp = (NCCALCSIZE_PARAMS *)lParam; + DWORD dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); + + if (item == 0 || pcli == 0) + return orig; + + if (item->IGNORED || !(dwStyle & CLS_SKINNEDFRAME) || GetParent(hwnd) != pcli->hwndContactList) + return orig; + + nccp->rgrc[0].left += item->MARGIN_LEFT; + nccp->rgrc[0].right -= item->MARGIN_RIGHT; + nccp->rgrc[0].bottom -= item->MARGIN_BOTTOM; + nccp->rgrc[0].top += item->MARGIN_TOP; + return WVR_REDRAW; +} + +static LRESULT CALLBACK FramesSubClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + int i; + + WNDPROC oldWndProc = 0; + BOOL hasTitleBar = FALSE; + + for (i = 0; i < nFramescount; i++) { + if (Frames[i].hWnd == hwnd) { + oldWndProc = Frames[i].wndProc; + hasTitleBar = Frames[i].TitleBar.ShowTitleBar; + } + } + switch (msg) { + case WM_NCPAINT: { + return FrameNCPaint(hwnd, oldWndProc ? oldWndProc : DefWindowProc, wParam, lParam, hasTitleBar); + } + case WM_NCCALCSIZE: { + return FrameNCCalcSize(hwnd, oldWndProc, wParam, lParam, hasTitleBar); + } + case WM_PRINTCLIENT: + return 0; + default: + break; + } + if (oldWndProc) + return CallWindowProc(oldWndProc, hwnd, msg, wParam, lParam); + return DefWindowProc(hwnd, msg, wParam, lParam); +} + +/* + * re-sort all frames and correct frame ordering + */ + +static int CLUIFramesReSort() +{ + int v = 0, i; + int order = 1; + + lockfrm(); + memset(g_sd, 0, sizeof(SortData) * MAX_FRAMES); + for (i = 0;i < nFramescount;i++) { + if (Frames[i].align != alTop) + continue; + g_sd[v].order = Frames[i].order; + g_sd[v].realpos = i; + v++; + } + if (v > 0) { + qsort(g_sd, v, sizeof(SortData), sortfunc); + for (i = 0; i < v; i++) + Frames[g_sd[i].realpos].order = order++; + } + + memset(g_sd, 0, sizeof(SortData) * MAX_FRAMES); + v = 0; + for (i = 0;i < nFramescount;i++) { + if (Frames[i].align != alBottom) + continue; + g_sd[v].order = Frames[i].order; + g_sd[v].realpos = i; + v++; + } + if (v > 0) { + qsort(g_sd, v, sizeof(SortData), sortfunc); + for (i = 0; i < v; i++) + Frames[g_sd[i].realpos].order = order++; + } + CLUIFramesStoreAllFrames(); + ulockfrm(); + return(0); +} + +//wparam=(CLISTFrame*)clfrm +INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM lParam) +{ + int style, retval; + char * CustomName = NULL; + CLISTFrame *clfrm = (CLISTFrame *)wParam; + + if (pcli->hwndContactList == 0) return -1; + if (FramesSysNotStarted) return -1; + if (clfrm->cbSize != sizeof(CLISTFrame)) return -1; + + lockfrm(); + if (nFramescount >= MAX_FRAMES) { + ulockfrm(); + return -1; + } + if (Frames == NULL) { + Frames = (wndFrame*)malloc(sizeof(wndFrame) * (MAX_FRAMES + 2)); + ZeroMemory(Frames, sizeof(wndFrame) * (MAX_FRAMES + 2)); + } + memset(&Frames[nFramescount], 0, sizeof(wndFrame)); + + Frames[nFramescount].id = NextFrameId++; + Frames[nFramescount].align = clfrm->align; + Frames[nFramescount].hWnd = clfrm->hWnd; + Frames[nFramescount].height = clfrm->height; + Frames[nFramescount].TitleBar.hicon = clfrm->hIcon; + //Frames[nFramescount].TitleBar.BackColour; + Frames[nFramescount].floating = FALSE; + + if (clfrm->Flags & F_NO_SUBCONTAINER) + Frames[nFramescount].OwnerWindow = (HWND) - 2; + else + Frames[nFramescount].OwnerWindow = pcli->hwndContactList; + + SetClassLong(clfrm->hWnd, GCL_STYLE, GetClassLong(clfrm->hWnd, GCL_STYLE) & ~(CS_VREDRAW | CS_HREDRAW)); + SetWindowLongPtr(clfrm->hWnd, GWL_STYLE, GetWindowLongPtr(clfrm->hWnd, GWL_STYLE) | WS_CLIPCHILDREN); + + if (GetCurrentThreadId() == GetWindowThreadProcessId(clfrm->hWnd, NULL)) { + if (clfrm->hWnd != pcli->hwndContactTree && clfrm->hWnd != g_hwndViewModeFrame && clfrm->hWnd != g_hwndEventArea) { + Frames[nFramescount].wndProc = (WNDPROC)GetWindowLongPtr(clfrm->hWnd, GWLP_WNDPROC); + SetWindowLongPtr(clfrm->hWnd, GWLP_WNDPROC, (LONG_PTR)FramesSubClassProc); + } + } + + if (clfrm->hWnd == g_hwndEventArea) + wndFrameEventArea = &Frames[nFramescount]; + else if (clfrm->hWnd == pcli->hwndContactTree) + wndFrameCLC = &Frames[nFramescount]; + else if (clfrm->hWnd == g_hwndViewModeFrame) + wndFrameViewMode = &Frames[nFramescount]; + + Frames[nFramescount].dwFlags = clfrm->Flags; + + if (clfrm->name == NULL || ((clfrm->Flags&F_UNICODE) ? lstrlenW(clfrm->wname) : lstrlenA(clfrm->name)) == 0) { + TCHAR ptszClassName[ 256 ]; + GetClassName(Frames[nFramescount].hWnd, ptszClassName, SIZEOF(ptszClassName)); + Frames[nFramescount].name = mir_tstrdup(ptszClassName); + } else Frames[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) ? lstrlenW(clfrm->TBwname) : lstrlenA(clfrm->TBname)) == 0) + Frames[nFramescount].TitleBar.tbname = mir_tstrdup(Frames[nFramescount].name); + else + Frames[nFramescount].TitleBar.tbname = (clfrm->Flags & F_UNICODE) ? mir_u2t(clfrm->TBwname) : mir_a2t(clfrm->TBname); + Frames[nFramescount].needhide = FALSE; + Frames[nFramescount].TitleBar.ShowTitleBar = (clfrm->Flags & F_SHOWTB ? TRUE : FALSE); + Frames[nFramescount].TitleBar.ShowTitleBarTip = (clfrm->Flags & F_SHOWTBTIP ? TRUE : FALSE); + + Frames[nFramescount].collapsed = clfrm->Flags & F_UNCOLLAPSED ? FALSE : TRUE; + Frames[nFramescount].Locked = clfrm->Flags & F_LOCKED ? TRUE : FALSE; + Frames[nFramescount].visible = clfrm->Flags & F_VISIBLE ? TRUE : FALSE; + + Frames[nFramescount].UseBorder = (clfrm->Flags & F_NOBORDER) ? FALSE : TRUE; + Frames[nFramescount].Skinned = (clfrm->Flags & F_SKINNED) ? TRUE : FALSE; + + // create frame + Frames[nFramescount].TitleBar.hwnd = + CreateWindow(CLUIFrameTitleBarClassName, Frames[nFramescount].name, + (cfg::getByte(CLUIFrameModule, "RemoveAllTitleBarBorders", 1) ? 0 : WS_BORDER) + | WS_CHILD | WS_CLIPCHILDREN | (Frames[nFramescount].TitleBar.ShowTitleBar ? WS_VISIBLE : 0) | + WS_CLIPCHILDREN, 0, 0, 0, 0, pcli->hwndContactList, NULL, g_hInst, NULL); + + SetWindowLongPtr(Frames[nFramescount].TitleBar.hwnd, GWLP_USERDATA, Frames[nFramescount].id); + + Frames[nFramescount].TitleBar.hwndTip = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + pcli->hwndContactList, NULL, g_hInst, NULL); + + SetWindowPos(Frames[nFramescount].TitleBar.hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + { + TOOLINFOA ti; + int res; + + ZeroMemory(&ti, sizeof(ti)); + ti.cbSize = sizeof(ti); + ti.lpszText = ""; + ti.hinst = g_hInst; + ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS ; + ti.uId = (UINT_PTR)Frames[nFramescount].TitleBar.hwnd; + res = SendMessageA(Frames[nFramescount].TitleBar.hwndTip, TTM_ADDTOOL, (WPARAM)0, (LPARAM) & ti); + } + + SendMessage(Frames[nFramescount].TitleBar.hwndTip, TTM_ACTIVATE, (WPARAM)Frames[nFramescount].TitleBar.ShowTitleBarTip, 0); + + Frames[nFramescount].oldstyles = GetWindowLongPtr(Frames[nFramescount].hWnd, GWL_STYLE); + Frames[nFramescount].TitleBar.oldstyles = GetWindowLongPtr(Frames[nFramescount].TitleBar.hwnd, GWL_STYLE); + //Frames[nFramescount].FloatingPos.x= + + retval = Frames[nFramescount].id; + Frames[nFramescount].order = nFramescount + 1; + nFramescount++; + + CLUIFramesLoadFrameSettings(id2pos(retval)); + style = GetWindowLongPtr(Frames[nFramescount-1].hWnd, GWL_STYLE); + style &= ~(WS_BORDER); + style |= ((Frames[nFramescount-1].UseBorder) ? WS_BORDER : 0); + + style |= Frames[nFramescount-1].Skinned ? CLS_SKINNEDFRAME : 0; + + SetWindowLongPtr(Frames[nFramescount-1].hWnd, GWL_STYLE, style); + SetWindowLongPtr(Frames[nFramescount-1].TitleBar.hwnd, GWL_STYLE, style & ~(WS_VSCROLL | WS_HSCROLL)); + + if (Frames[nFramescount-1].order == 0) { + Frames[nFramescount-1].order = nFramescount; + } + + ulockfrm(); + + alclientFrame = -1;//recalc it + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + + if (Frames[nFramescount-1].floating) { + Frames[nFramescount-1].floating = FALSE; + CLUIFrameSetFloat(retval, 1);//lparam=1 use stored width and height + } + RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + return retval; +} + +static INT_PTR CLUIFramesRemoveFrame(WPARAM wParam, LPARAM lParam) +{ + int pos; + if (FramesSysNotStarted) + return -1; + + lockfrm(); + pos = id2pos((INT_PTR)wParam); + + if (pos < 0 || pos > nFramescount) { + ulockfrm(); + return(-1); + } + + { + wndFrame* F = &Frames[pos]; + if (F->hWnd == g_hwndEventArea) + wndFrameEventArea = NULL; + else if (F->hWnd == pcli->hwndContactTree) + wndFrameCLC = NULL; + else if (F->hWnd == g_hwndViewModeFrame) + wndFrameViewMode = NULL; + + mir_free(F->name); + mir_free(F->TitleBar.tbname); + mir_free(F->TitleBar.tooltip); + + DestroyWindow(F->hWnd); + F->hWnd = (HWND) - 1; + DestroyWindow(F->TitleBar.hwnd); + F->TitleBar.hwnd = (HWND) - 1; + DestroyWindow(F->ContainerWnd); + F->ContainerWnd = (HWND) - 1; + DestroyMenu(F->TitleBar.hmenu); + } + + RemoveItemFromList(pos, &Frames, &nFramescount); + + ulockfrm(); + if (!cfg::shutDown) { + InvalidateRect(pcli->hwndContactList, NULL, TRUE); + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + } + return(0); +} + +INT_PTR CLUIFramesForceUpdateTB(const wndFrame *Frame) +{ + if (Frame->TitleBar.hwnd != 0) + RedrawWindow(Frame->TitleBar.hwnd, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); + return 0; +} + +INT_PTR CLUIFramesForceUpdateFrame(const wndFrame *Frame) +{ + if (Frame->hWnd != 0) + RedrawWindow(Frame->hWnd, NULL, NULL, RDW_UPDATENOW | RDW_FRAME | RDW_ERASE | RDW_INVALIDATE); + + if (Frame->floating) + if (Frame->ContainerWnd != 0) RedrawWindow(Frame->ContainerWnd, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); + return 0; +} + +int CLUIFrameMoveResize(const wndFrame *Frame) +{ + TitleBarH = cfg::dat.titleBarHeight; + // we need to show or hide the frame? + if (Frame->visible && (!Frame->needhide)) { + ShowWindow(Frame->hWnd, SW_SHOW); + ShowWindow(Frame->TitleBar.hwnd, Frame->TitleBar.ShowTitleBar == TRUE ? SW_SHOW : SW_HIDE); + } else { + ShowWindow(Frame->hWnd, SW_HIDE); + ShowWindow(Frame->TitleBar.hwnd, SW_HIDE); + return(0); + } + + SetWindowPos(Frame->hWnd, NULL, Frame->wndSize.left + cfg::dat.bCLeft, Frame->wndSize.top + cfg::dat.topOffset, + (Frame->wndSize.right - Frame->wndSize.left), + (Frame->wndSize.bottom - Frame->wndSize.top), SWP_NOZORDER | SWP_NOREDRAW); + if (Frame->TitleBar.ShowTitleBar) { + SetWindowPos(Frame->TitleBar.hwnd, NULL, Frame->wndSize.left + cfg::dat.bCLeft, Frame->wndSize.top + cfg::dat.topOffset - TitleBarH, + (Frame->wndSize.right - Frame->wndSize.left), + TitleBarH + (Frame->UseBorder ? (!Frame->collapsed ? (Frame->align == alClient ? 0 : 2) : 1) : 0), SWP_NOZORDER); + } + return 0; +} + +BOOLEAN CLUIFramesFitInSize(void) +{ + int i; + int sumheight = 0; + int tbh = 0; // title bar height + int clientfrm; + + TitleBarH = cfg::dat.titleBarHeight; + + clientfrm = CLUIFramesGetalClientFrame(); + if (clientfrm != -1) + tbh = TitleBarH * btoint(Frames[clientfrm].TitleBar.ShowTitleBar); + + for (i = 0;i < nFramescount;i++) { + if ((Frames[i].align != alClient) && (!Frames[i].floating) && (Frames[i].visible) && (!Frames[i].needhide)) { + sumheight += (Frames[i].height) + (TitleBarH * btoint(Frames[i].TitleBar.ShowTitleBar)) + 2/*+btoint(Frames[i].UseBorder)*2*/; + if (sumheight > ContactListHeight - tbh - 2) + return FALSE; + } + } + return TRUE; +} + +int CLUIFramesGetMinHeight() +{ + int i, tbh, clientfrm, sumheight = 0; + RECT border; + int allbord = 0; + + if (pcli->hwndContactList == NULL) + return 0; + + lockfrm(); + + TitleBarH = cfg::dat.titleBarHeight; + // search for alClient frame and get the titlebar's height + tbh = 0; + clientfrm = CLUIFramesGetalClientFrame(); + if (clientfrm != -1) + tbh = TitleBarH * btoint(Frames[clientfrm].TitleBar.ShowTitleBar); + + for (i = 0;i < nFramescount;i++) { + if ((Frames[i].align != alClient) && (Frames[i].visible) && (!Frames[i].needhide) && (!Frames[i].floating)) { + RECT wsize; + + GetWindowRect(Frames[i].hWnd, &wsize); + sumheight += (wsize.bottom - wsize.top) + (TitleBarH * btoint(Frames[i].TitleBar.ShowTitleBar)) + 3; + } + } + ulockfrm(); + GetBorderSize(pcli->hwndContactList, &border); + return(sumheight + border.top + border.bottom + allbord + tbh + 3); +} + +int SizeMoveNewSizes() +{ + int i; + for (i = 0;i < nFramescount;i++) { + + if (Frames[i].floating) { + CLUIFrameResizeFloatingFrame(i); + } else { + CLUIFrameMoveResize(&Frames[i]); + }; + } + return 0; +} + +/* + * changed Nightwish + * gap calculation was broken. Now, it doesn't calculate and store the gaps in Frames[] anymore. + * instead, it remembers the smallest wndSize.top value (which has to be the top frame) and then passes + * the gap to all following frame(s) to the actual resizing function which just adds the gap to + * wndSize.top and corrects the frame height accordingly. + + * Title bar gap has been removed (can be simulated by using a clist_nicer skin item for frame title bars + * and setting the bottom margin of the skin item + */ + +int CLUIFramesResize(const RECT newsize) +{ + int sumheight = 9999999, newheight; + int prevframe, prevframebottomline; + int tbh, curfrmtbh; + int drawitems; + int clientfrm, clientframe = -1; + int i, j; + int sepw; + int topOff = 0, botOff = 0, last_bottomtop;; + + GapBetweenFrames = cfg::dat.gapBetweenFrames; + sepw = GapBetweenFrames; + + if (nFramescount < 1 || cfg::shutDown) + return 0; + + newheight = newsize.bottom - newsize.top; + TitleBarH = cfg::dat.titleBarHeight; + + // search for alClient frame and get the titlebar's height + tbh = 0; + clientfrm = CLUIFramesGetalClientFrame(); + if (clientfrm != -1) + tbh = (TitleBarH) * btoint(Frames[clientfrm].TitleBar.ShowTitleBar); + + for (i = 0;i < nFramescount;i++) { + if (!Frames[i].floating) { + Frames[i].needhide = FALSE; + Frames[i].wndSize.left = 0; + Frames[i].wndSize.right = newsize.right - newsize.left; + } + } + { + //sorting stuff + memset(g_sd, 0, sizeof(SortData) * MAX_FRAMES); + for (i = 0;i < nFramescount;i++) { + g_sd[i].order = Frames[i].order; + g_sd[i].realpos = i; + } + qsort(g_sd, nFramescount, sizeof(SortData), sortfunc); + + } + drawitems = nFramescount; + while (sumheight > (newheight - tbh) && drawitems > 0) { + sumheight = 0; + drawitems = 0; + for (i = 0;i < nFramescount;i++) { + if (((Frames[i].align != alClient)) && (!Frames[i].floating) && (Frames[i].visible) && (!Frames[i].needhide)) { + drawitems++; + curfrmtbh = (TitleBarH) * btoint(Frames[i].TitleBar.ShowTitleBar); + sumheight += (Frames[i].height) + curfrmtbh + (i > 0 ? sepw : 0) + (Frames[i].UseBorder ? 2 : 0); + if (sumheight > newheight - tbh) { + sumheight -= (Frames[i].height) + curfrmtbh + (i > 0 ? sepw : 0); + Frames[i].needhide = TRUE; + drawitems--; + break; + } + } + } + } + + prevframe = -1; + prevframebottomline = 0; + for (j = 0;j < nFramescount;j++) { + //move all alTop frames + i = g_sd[j].realpos; + if ((!Frames[i].needhide) && (!Frames[i].floating) && (Frames[i].visible) && (Frames[i].align == alTop)) { + curfrmtbh = (TitleBarH) * btoint(Frames[i].TitleBar.ShowTitleBar); + Frames[i].wndSize.top = prevframebottomline + (prevframebottomline > 0 ? sepw : 0) + (curfrmtbh); + Frames[i].wndSize.bottom = Frames[i].height + Frames[i].wndSize.top + (Frames[i].UseBorder ? 2 : 0); + Frames[i].prevvisframe = prevframe; + prevframe = i; + prevframebottomline = Frames[i].wndSize.bottom; + topOff = prevframebottomline; + } + } + + if (sumheight < newheight) { + for (j = 0;j < nFramescount;j++) { + //move alClient frame + i = g_sd[j].realpos; + if ((!Frames[i].needhide) && (!Frames[i].floating) && (Frames[i].visible) && (Frames[i].align == alClient)) { + int oldh; + Frames[i].wndSize.top = prevframebottomline + (prevframebottomline > 0 ? sepw : 0) + (tbh); + Frames[i].wndSize.bottom = Frames[i].wndSize.top + newheight - sumheight - tbh - ((prevframebottomline > 0) ? sepw : 0); + clientframe = i; + oldh = Frames[i].height; + Frames[i].height = Frames[i].wndSize.bottom - Frames[i].wndSize.top; + Frames[i].prevvisframe = prevframe; + prevframe = i; + prevframebottomline = Frames[i].wndSize.bottom; + if (prevframebottomline > newheight) { + //prevframebottomline-=Frames[i].height+(tbh+1); + //Frames[i].needhide=TRUE; + } + break; + } + } + } + + //newheight + prevframebottomline = last_bottomtop = newheight; + //prevframe=-1; + for (j = nFramescount - 1;j >= 0;j--) { + //move all alBottom frames + i = g_sd[j].realpos; + if ((Frames[i].visible) && (!Frames[i].floating) && (!Frames[i].needhide) && (Frames[i].align == alBottom)) { + curfrmtbh = (TitleBarH) * btoint(Frames[i].TitleBar.ShowTitleBar); + Frames[i].wndSize.bottom = prevframebottomline - ((prevframebottomline < newheight) ? sepw : 0); + Frames[i].wndSize.top = Frames[i].wndSize.bottom - Frames[i].height - (Frames[i].UseBorder ? 2 : 0); + Frames[i].prevvisframe = prevframe; + prevframe = i; + prevframebottomline = Frames[i].wndSize.top - curfrmtbh; + botOff = prevframebottomline; + last_bottomtop = Frames[i].wndSize.top - curfrmtbh; + } + } + + // correct client frame bottom gap if there is no other top frame. + + if (clientframe != -1) { + Frames[clientframe].wndSize.bottom = last_bottomtop - (last_bottomtop < newheight ? sepw : 0); + Frames[clientframe].height = Frames[clientframe].wndSize.bottom - Frames[clientframe].wndSize.top; + } + return 0; +} + +INT_PTR CLUIFramesUpdateFrame(WPARAM wParam, LPARAM lParam) +{ + int pos; + if (FramesSysNotStarted) + return -1; + if (wParam == -1) { + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); + return 0; + } + if (lParam&FU_FMPOS) + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 1); + + lockfrm(); + pos = id2pos((INT_PTR)wParam); + if (pos < 0 || pos >= nFramescount) { + ulockfrm(); + return -1; + } + if (lParam&FU_TBREDRAW) + CLUIFramesForceUpdateTB(&Frames[pos]); + if (lParam&FU_FMREDRAW) + CLUIFramesForceUpdateFrame(&Frames[pos]); + ulockfrm(); + return 0; +} + +int dock_prevent_moving = 0; + +int CLUIFramesApplyNewSizes(int mode) +{ + int i; + dock_prevent_moving = 0; + for (i = 0;i < nFramescount;i++) { + if ((mode == 1 && Frames[i].OwnerWindow != (HWND) - 2 && Frames[i].OwnerWindow) || + (mode == 2 && Frames[i].OwnerWindow == (HWND) - 2) || + (mode == 3)) + if (Frames[i].floating) + CLUIFrameResizeFloatingFrame(i); + else + CLUIFrameMoveResize(&Frames[i]); + } + dock_prevent_moving = 1; + return 0; +} + +RECT old_window_rect = {0}, new_window_rect = {0}; + +int SizeFramesByWindowRect(RECT *r) +{ + RECT nRect; + DWORD noSize = 0; + + if (FramesSysNotStarted) + return -1; + + TitleBarH = cfg::dat.titleBarHeight; + lockfrm(); + GapBetweenFrames = cfg::dat.gapBetweenFrames; + + nRect = *r; + + nRect.bottom -= (cfg::dat.statusBarHeight + cfg::dat.bottomOffset); + nRect.right -= cfg::dat.bCRight; + nRect.left = cfg::dat.bCLeft; + nRect.top = cfg::dat.topOffset; + ContactListHeight = nRect.bottom - nRect.top; + + CLUIFramesResize(nRect); + { + int i; + for (i = 0;i < nFramescount;i++) { + int dx; + int dy; + dx = new_window_rect.left - old_window_rect.left; + dy = new_window_rect.top - old_window_rect.top; + if (!Frames[i].floating) { + if (Frames[i].OwnerWindow && Frames[i].OwnerWindow != (HWND) - 2) { + /* + if(Frames[i].wndSize.right - Frames[i].wndSize.left == Frames[i].oldWndSize.right - Frames[i].oldWndSize.left && + Frames[i].wndSize.bottom - Frames[i].wndSize.top == Frames[i].oldWndSize.bottom - Frames[i].oldWndSize.top) + noSize = SWP_NOSIZE; + else { + noSize = 0; + CopyRect(&Frames[i].oldWndSize, &Frames[i].wndSize); + }*/ + SetWindowPos(Frames[i].hWnd, NULL, Frames[i].wndSize.left + cfg::dat.bCLeft, Frames[i].wndSize.top + cfg::dat.topOffset, + (Frames[i].wndSize.right - Frames[i].wndSize.left), + (Frames[i].wndSize.bottom - Frames[i].wndSize.top), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS | noSize); + + if (Frames[i].TitleBar.ShowTitleBar) { + SetWindowPos(Frames[i].TitleBar.hwnd, NULL, Frames[i].wndSize.left + cfg::dat.bCLeft, Frames[i].wndSize.top + cfg::dat.topOffset - TitleBarH, + (Frames[i].wndSize.right - Frames[i].wndSize.left), + TitleBarH + (Frames[i].UseBorder ? (!Frames[i].collapsed ? (Frames[i].align == alClient ? 0 : 2) : 1) : 0), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS); + } + } else { + int res = 0; + // set frame position + SetWindowPos(Frames[i].hWnd, NULL, Frames[i].wndSize.left + cfg::dat.bCLeft, Frames[i].wndSize.top + cfg::dat.topOffset, + (Frames[i].wndSize.right - Frames[i].wndSize.left), + (Frames[i].wndSize.bottom - Frames[i].wndSize.top), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOREDRAW); + + // set titlebar position + if (Frames[i].TitleBar.ShowTitleBar) { + SetWindowPos(Frames[i].TitleBar.hwnd, NULL, Frames[i].wndSize.left + cfg::dat.bCLeft, Frames[i].wndSize.top + cfg::dat.topOffset - TitleBarH, + (Frames[i].wndSize.right - Frames[i].wndSize.left), + TitleBarH + (Frames[i].UseBorder ? (!Frames[i].collapsed ? (Frames[i].align == alClient ? 0 : 2) : 1) : 0), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOREDRAW); + } + //UpdateWindow(Frames[i].hWnd); + if (Frames[i].TitleBar.ShowTitleBar) + UpdateWindow(Frames[i].TitleBar.hwnd); + }; + } + + } + if (GetTickCount() - LastStoreTick > 1000) { + CLUIFramesStoreAllFrames(); + LastStoreTick = GetTickCount(); + } + } + ulockfrm(); + return 0; +} + +int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam) +{ + RECT nRect, rcStatus; + int tick; + GapBetweenFrames = cfg::dat.gapBetweenFrames; + + if (FramesSysNotStarted || cfg::shutDown) + return -1; + + lockfrm(); + + GetClientRect(pcli->hwndContactList, &nRect); + if (lParam && lParam != 1) { + 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; + } + + rcStatus.top = rcStatus.bottom = 0; + + nRect.bottom -= (cfg::dat.statusBarHeight + cfg::dat.bottomOffset); + nRect.right -= cfg::dat.bCRight; + nRect.left = cfg::dat.bCLeft; + nRect.top = cfg::dat.topOffset; + ContactListHeight = nRect.bottom - nRect.top; + + tick = GetTickCount(); + + CLUIFramesResize(nRect); + CLUIFramesApplyNewSizes(3); + + ulockfrm(); + tick = GetTickCount() - tick; + + if (pcli->hwndContactList != 0) + InvalidateRect(pcli->hwndContactList, NULL, TRUE); + if (pcli->hwndContactList != 0) + UpdateWindow(pcli->hwndContactList); + + Sleep(0); + + if (GetTickCount() - LastStoreTick > 2000) { + CLUIFramesStoreAllFrames(); + LastStoreTick = GetTickCount(); + } + return 0; +} + +static HBITMAP hBmpBackground; +static int backgroundBmpUse; +static COLORREF bkColour; +static COLORREF SelBkColour; +boolean AlignCOLLIconToLeft; //will hide frame icon + +int OnFrameTitleBarBackgroundChange() +{ + DBVARIANT dbv; + + AlignCOLLIconToLeft = cfg::getByte("FrameTitleBar", "AlignCOLLIconToLeft", 0); + + bkColour = cfg::getDword("FrameTitleBar", "BkColour", CLCDEFAULT_BKCOLOUR); + + if (hBmpBackground) { + DeleteObject(hBmpBackground); + hBmpBackground = NULL; + } + if (cfg::getByte("FrameTitleBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) { + if (!DBGetContactSetting(NULL, "FrameTitleBar", "BkBitmap", &dbv)) { + hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)dbv.pszVal); + mir_free(dbv.pszVal); + } + } + backgroundBmpUse = cfg::getWord("FrameTitleBar", "BkBmpUse", CLCDEFAULT_BKBMPUSE); + + CLUIFramesOnClistResize(0, 0); + return 0; +} + +static int DrawTitleBar(HDC dc, RECT rect, int Frameid) +{ + HDC hdcMem; + HBITMAP hBmpOsb, hoBmp; + HBRUSH hBack, hoBrush; + int pos; + StatusItems_t *item = &StatusItems[ID_EXTBKFRAMETITLE - ID_STATUS_OFFLINE]; + + /* + * no need to redraw anything while shutting down + */ + if (cfg::shutDown) + return 0; + + TitleBarH = cfg::dat.titleBarHeight; + hdcMem = CreateCompatibleDC(dc); + hBmpOsb = CreateCompatibleBitmap(dc, rect.right, rect.bottom); + hoBmp = reinterpret_cast(SelectObject(hdcMem, hBmpOsb)); + + SetBkMode(hdcMem, TRANSPARENT); + + hBack = GetSysColorBrush(COLOR_3DFACE); + hoBrush = reinterpret_cast(SelectObject(hdcMem, hBack)); + + lockfrm(); + pos = id2pos(Frameid); + + if (pos >= 0 && pos < nFramescount) { + HFONT oFont; + int fHeight, fontTop; + GetClientRect(Frames[pos].TitleBar.hwnd, &Frames[pos].TitleBar.wndSize); + + if (cfg::clcdat) { + oFont = ChangeToFont(hdcMem, cfg::clcdat, FONTID_FRAMETITLE, &fHeight); + } else { + oFont = reinterpret_cast(SelectObject(hdcMem, GetStockObject(DEFAULT_GUI_FONT))); + fHeight = 10; + } + fontTop = (TitleBarH - fHeight) / 2; + + if (cfg::dat.bWallpaperMode && !Frames[pos].floating) + SkinDrawBg(Frames[pos].TitleBar.hwnd, hdcMem); + + if (!item->IGNORED) { + RECT rc = Frames[pos].TitleBar.wndSize; + rc.top += item->MARGIN_TOP; + rc.bottom -= item->MARGIN_BOTTOM; + rc.left += item->MARGIN_LEFT; + rc.right -= item->MARGIN_RIGHT; + DrawAlpha(hdcMem, &rc, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT, + item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem); + SetTextColor(hdcMem, item->TEXTCOLOR); + } else if (cfg::clcdat) { + FillRect(hdcMem, &rect, hBack); + SetTextColor(hdcMem, cfg::clcdat->fontInfo[FONTID_FRAMETITLE].colour); + } else { + FillRect(hdcMem, &rect, hBack); + SetTextColor(hdcMem, GetSysColor(COLOR_BTNTEXT)); + } + + + if (!AlignCOLLIconToLeft) { + if (Frames[pos].TitleBar.hicon != NULL) { + DrawIconEx(hdcMem, 6 + cfg::dat.bClipBorder, ((TitleBarH >> 1) - 8), Frames[pos].TitleBar.hicon, 16, 16, 0, NULL, DI_NORMAL); + TextOut(hdcMem, 24 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, lstrlen(Frames[pos].TitleBar.tbname)); + } else + TextOut(hdcMem, 6 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, lstrlen(Frames[pos].TitleBar.tbname)); + } else + TextOut(hdcMem, 18 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, lstrlen(Frames[pos].TitleBar.tbname)); + + + if (!AlignCOLLIconToLeft) + DrawIconEx(hdcMem, Frames[pos].TitleBar.wndSize.right - 22, ((TitleBarH >> 1) - 8), Frames[pos].collapsed ? LoadSkinnedIcon(SKINICON_OTHER_GROUPOPEN) : LoadSkinnedIcon(SKINICON_OTHER_GROUPSHUT), 16, 16, 0, NULL, DI_NORMAL); + else + DrawIconEx(hdcMem, 0, ((TitleBarH >> 1) - 8), Frames[pos].collapsed ? LoadSkinnedIcon(SKINICON_OTHER_GROUPOPEN) : LoadSkinnedIcon(SKINICON_OTHER_GROUPSHUT), 16, 16, 0, NULL, DI_NORMAL); + SelectObject(hdcMem, oFont); + } + ulockfrm(); + BitBlt(dc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, hdcMem, rect.left, rect.top, SRCCOPY); + SelectObject(hdcMem, hoBmp); + SelectObject(hdcMem, hoBrush); + DeleteDC(hdcMem); + DeleteObject(hBack); + DeleteObject(hBmpOsb); + return 0; +} + +#define MPCF_CONTEXTFRAMEMENU 3 +POINT ptOld; +short nLeft = 0; +short nTop = 0; + +LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + RECT rect; + int Frameid, Framemod, direction; + int xpos, ypos; + + Frameid = GetWindowLongPtr(hwnd, GWLP_USERDATA); + memset(&rect, 0, sizeof(rect)); + + switch (msg) { + case WM_CREATE: + return FALSE; + case WM_MEASUREITEM: + return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam); + case WM_DRAWITEM: + return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam); + + case WM_ENABLE: + if (hwnd != 0) InvalidateRect(hwnd, NULL, FALSE); + return 0; + case WM_SIZE: + return 0; + /* + case WM_PRINT: + case WM_PRINTCLIENT: + InvalidateRect(hwnd,NULL,FALSE); + { + RECT rect; + HDC dc; + GetClientRect(hwnd,&rect); + //DrawTitleBar(wParam,rect,Frameid); + SendMessage(hwnd,WM_PAINT,0,0); + SendMessage(hwnd,WM_NCPAINT,1,0); + dc=GetDC(hwnd); + SendMessage(hwnd,WM_ERASEBKGND,dc,0); + ReleaseDC(hwnd,dc); + SendMessage(hwnd,WM_PAINT,0,0); + // UpdateWindow(hwnd); + return(0); + } + */ + /* + case WM_NCPAINT: + { + + // if(wParam==1) break; + { POINT ptTopLeft={0,0}; + HRGN hClientRgn; + ClientToScreen(hwnd,&ptTopLeft); + hClientRgn=CreateRectRgn(0,0,1,1); + CombineRgn(hClientRgn,(HRGN)wParam,NULL,RGN_COPY); + OffsetRgn(hClientRgn,-ptTopLeft.x,-ptTopLeft.y); + InvalidateRgn(hwnd,hClientRgn,FALSE); + DeleteObject(hClientRgn); + UpdateWindow(hwnd); + } + //return(0); + }; + */ + + + case WM_COMMAND: + if (ServiceExists(MO_CREATENEWMENUOBJECT)) { + if (ProcessCommandProxy(MAKEWPARAM(LOWORD(wParam), 0), (LPARAM)Frameid)) + break; + } else { + if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTEXTFRAMEMENU), (LPARAM)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: + Frames[framepos].Locked = !Frames[framepos].Locked; + break; + case frame_menu_visible: + Frames[framepos].visible = !Frames[framepos].visible; + break; + case frame_menu_showtitlebar: + Frames[framepos].TitleBar.ShowTitleBar = !Frames[framepos].TitleBar.ShowTitleBar; + break; + case frame_menu_floating: + CLUIFrameSetFloat(Frameid, 0); + break; + } + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)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 { + int framepos = id2pos(Frameid); + + lockfrm(); + if (framepos == -1) { + ulockfrm(); + break; + } + hmenu = CreatePopupMenu(); + AppendMenu(hmenu, MF_STRING | MF_DISABLED | MF_GRAYED, 15, Frames[framepos].name); + AppendMenu(hmenu, MF_SEPARATOR, 16, _T("")); + + if (Frames[framepos].Locked) + AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_lock, TranslateT("Lock Frame")); + else + AppendMenu(hmenu, MF_STRING, frame_menu_lock, TranslateT("Lock Frame")); + + if (Frames[framepos].visible) + AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_visible, TranslateT("Visible")); + else + AppendMenu(hmenu, MF_STRING, frame_menu_visible, TranslateT("Visible")); + + if (Frames[framepos].TitleBar.ShowTitleBar) + AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_showtitlebar, TranslateT("Show TitleBar")); + else + AppendMenu(hmenu, MF_STRING, frame_menu_showtitlebar, TranslateT("Show TitleBar")); + + if (Frames[framepos].Skinned) + AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_skinned, TranslateT("Skinned frame")); + else + AppendMenu(hmenu, MF_STRING, frame_menu_skinned, TranslateT("Skinned frame")); + + if (Frames[framepos].floating) + AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_floating, TranslateT("Floating")); + else + AppendMenu(hmenu, MF_STRING, frame_menu_floating, TranslateT("Floating")); + + ulockfrm(); + } + TrackPopupMenu(hmenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, 0); + DestroyMenu(hmenu); + } + break; + case WM_LBUTTONDBLCLK: { + Framemod = -1; + lbypos = -1; + oldframeheight = -1; + ReleaseCapture(); + CallService(MS_CLIST_FRAMES_UCOLLFRAME, Frameid, 0); + lbypos = -1; + oldframeheight = -1; + ReleaseCapture(); + } + break; + + case WM_LBUTTONUP: { + if (GetCapture() != hwnd) { + break; + }; + curdragbar = -1; + lbypos = -1; + oldframeheight = -1; + ReleaseCapture(); + RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + break; + }; + case WM_LBUTTONDOWN: { + + int framepos = id2pos(Frameid); + lockfrm(); + if (framepos == -1) { + ulockfrm(); + break; + } + if (Frames[framepos].floating) { + + POINT pt; + GetCursorPos(&pt); + Frames[framepos].TitleBar.oldpos = pt; + } + + if ((!(wParam&MK_CONTROL)) && Frames[framepos].Locked && (!(Frames[framepos].floating))) { + if (cfg::getByte("CLUI", "ClientAreaDrag", 0)) { + POINT pt; + GetCursorPos(&pt); + ulockfrm(); + return SendMessage(GetParent(hwnd), WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y)); + } + } + if (Frames[framepos].floating) { + RECT rc; + GetCursorPos(&ptOld); + GetWindowRect(hwnd, &rc); + nLeft = (short)rc.left; + nTop = (short)rc.top; + } + ulockfrm(); + SetCapture(hwnd); + break; + } + case WM_MOUSEMOVE: { + POINT pt, pt2; + RECT wndr; + int pos; + { + char TBcapt[255]; + + lockfrm(); + pos = id2pos(Frameid); + + if (pos != -1) { + int oldflags; + wsprintfA(TBcapt, "%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d", + Frames[pos].name, Frames[pos].height, Frames[pos].visible, Frames[pos].floating, + Frames[pos].FloatingPos.x, Frames[pos].FloatingPos.y, + Frames[pos].FloatingSize.x, Frames[pos].FloatingSize.y, + Frames[pos].order + ); + + oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, Frames[pos].id), (LPARAM)0); + if (!(oldflags&F_SHOWTBTIP)) + oldflags |= F_SHOWTBTIP; + } + ulockfrm(); + } + if ((wParam&MK_LBUTTON)/*&&(wParam&MK_CONTROL)*/) { + RECT rcMiranda; + RECT rcwnd, rcOverlap; + POINT newpt, ofspt, curpt, newpos; + + lockfrm(); + + pos = id2pos(Frameid); + if (Frames[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); + if (IsWindowVisible(pcli->hwndContactList) && IntersectRect(&rcOverlap, &rcwnd, &rcMiranda)) { + int id = Frames[pos].id; + + ulockfrm(); + ofspt.x = 0; + ofspt.y = 0; + ClientToScreen(Frames[pos].TitleBar.hwnd, &ofspt); + ofspt.x = curpt.x - ofspt.x; + ofspt.y = curpt.y - ofspt.y; + + CLUIFrameSetFloat(id, 0); + newpt.x = 0; + newpt.y = 0; + ClientToScreen(Frames[pos].TitleBar.hwnd, &newpt); + SetCursorPos(newpt.x + ofspt.x, newpt.y + ofspt.y); + GetCursorPos(&curpt); + lockfrm(); + Frames[pos].TitleBar.oldpos = curpt; + ulockfrm(); + return(0); + } + } else { + int id = Frames[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); + + if (!IntersectRect(&rcOverlap, &rcwnd, &rcMiranda)) { + ulockfrm(); + GetCursorPos(&curpt); + GetWindowRect(Frames[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; + GetWindowRect(Frames[pos].TitleBar.hwnd, &rcwnd); + ofspt.x = curpt.x - ofspt.x; + ofspt.y = curpt.y - ofspt.y; + Frames[pos].FloatingPos.x = newpos.x; + Frames[pos].FloatingPos.y = newpos.y; + CLUIFrameSetFloat(id, 0); + lockfrm(); + newpt.x = 0; + newpt.y = 0; + ClientToScreen(Frames[pos].TitleBar.hwnd, &newpt); + GetWindowRect(Frames[pos].hWnd, &rcwnd); + SetCursorPos(newpt.x + (rcwnd.right - rcwnd.left) / 2, newpt.y + (rcwnd.bottom - rcwnd.top) / 2); + GetCursorPos(&curpt); + Frames[pos].TitleBar.oldpos = curpt; + ulockfrm(); + return(0); + } + } + ulockfrm(); + } + if (wParam&MK_LBUTTON) { + int newh = -1, prevold; + + if (GetCapture() != hwnd) + break; + + lockfrm(); + pos = id2pos(Frameid); + + if (Frames[pos].floating) { + GetCursorPos(&pt); + if ((Frames[pos].TitleBar.oldpos.x != pt.x) || (Frames[pos].TitleBar.oldpos.y != pt.y)) { + + pt2 = pt; + ScreenToClient(hwnd, &pt2); + GetWindowRect(Frames[pos].ContainerWnd, &wndr); + { + int dX, dY; + POINT ptNew; + + ptNew.x = pt.x; + ptNew.y = pt.y; + + dX = ptNew.x - ptOld.x; + dY = ptNew.y - ptOld.y; + + nLeft += (short)dX; + nTop += (short)dY; + + if (!(wParam&MK_CONTROL)) { + PositionThumb(&Frames[pos], nLeft, nTop); + } else { + + SetWindowPos(Frames[pos].ContainerWnd, + 0, + nLeft, + nTop, + 0, + 0, + SWP_NOSIZE | SWP_NOZORDER); + } + ptOld = ptNew; + } + pt.x = nLeft; + pt.y = nTop; + Frames[pos].TitleBar.oldpos = pt; + } + ulockfrm(); + return(0); + } + if (Frames[pos].prevvisframe != -1) { + GetCursorPos(&pt); + + if ((Frames[pos].TitleBar.oldpos.x == pt.x) && (Frames[pos].TitleBar.oldpos.y == pt.y)) { + ulockfrm(); + break; + } + + ypos = rect.top + pt.y; + xpos = rect.left + pt.x; + Framemod = -1; + + if (Frames[pos].align == alBottom) { + direction = -1; + Framemod = pos; + } else { + direction = 1; + Framemod = Frames[pos].prevvisframe; + } + if (Frames[Framemod].Locked) { + ulockfrm(); + break; + } + if (curdragbar != -1 && curdragbar != pos) { + ulockfrm(); + break; + } + + if (lbypos == -1) { + curdragbar = pos; + lbypos = ypos; + oldframeheight = Frames[Framemod].height; + SetCapture(hwnd); + ulockfrm(); + break;; + } + newh = oldframeheight + direction * (ypos - lbypos); + if (newh > 0) { + prevold = Frames[Framemod].height; + Frames[Framemod].height = newh; + if (!CLUIFramesFitInSize()) { + Frames[Framemod].height = prevold; + ulockfrm(); + return TRUE; + } + Frames[Framemod].height = newh; + if (newh > 3) Frames[Framemod].collapsed = TRUE; + + } + Frames[pos].TitleBar.oldpos = pt; + } + ulockfrm(); + if (newh > 0) { + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); + } + break; + } + curdragbar = -1; + lbypos = -1; + oldframeheight = -1; + ReleaseCapture(); + } + break; + case WM_NCPAINT: { + if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_BORDER) { + HDC hdc = GetWindowDC(hwnd); + HPEN hPenOld = reinterpret_cast(SelectObject(hdc, g_hPenCLUIFrames)); + RECT rcWindow, rc; + HBRUSH brold; + + CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam); + GetWindowRect(hwnd, &rcWindow); + rc.left = rc.top = 0; + rc.right = rcWindow.right - rcWindow.left; + rc.bottom = rcWindow.bottom - rcWindow.top; + brold = reinterpret_cast(SelectObject(hdc, GetStockObject(HOLLOW_BRUSH))); + Rectangle(hdc, 0, 0, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top); + SelectObject(hdc, hPenOld); + SelectObject(hdc, brold); + ReleaseDC(hwnd, hdc); + return 0; + } + break; + } + case WM_PRINT: + case WM_PRINTCLIENT: { + GetClientRect(hwnd, &rect); + DrawTitleBar((HDC)wParam, rect, Frameid); + } + case WM_PAINT: { + HDC paintDC; + PAINTSTRUCT paintStruct; + + paintDC = BeginPaint(hwnd, &paintStruct); + rect = paintStruct.rcPaint; + DrawTitleBar(paintDC, rect, Frameid); + EndPaint(hwnd, &paintStruct); + return 0; + } + default: + return DefWindowProc(hwnd, msg, wParam, lParam); + } + return TRUE; +} +int CLUIFrameResizeFloatingFrame(int framepos) +{ + + int width, height, floatingHeight; + RECT rect; + + if (!Frames[framepos].floating) + return(0); + if (Frames[framepos].ContainerWnd == 0) + return(0); + GetClientRect(Frames[framepos].ContainerWnd, &rect); + + width = rect.right - rect.left; + height = rect.bottom - rect.top; + floatingHeight = cfg::dat.titleBarHeight; + + if(floatingHeight <= 0 || floatingHeight > 50) + floatingHeight = 18; + + Frames[framepos].visible ? ShowWindow(Frames[framepos].ContainerWnd, SW_SHOWNOACTIVATE) : ShowWindow(Frames[framepos].ContainerWnd, SW_HIDE); + + if (Frames[framepos].TitleBar.ShowTitleBar) { + ShowWindow(Frames[framepos].TitleBar.hwnd, SW_SHOWNOACTIVATE); + Frames[framepos].height = height - floatingHeight; + SetWindowPos(Frames[framepos].TitleBar.hwnd, HWND_TOP, 0, 0, width, floatingHeight, SWP_SHOWWINDOW | SWP_DRAWFRAME | SWP_NOACTIVATE); + InvalidateRect(Frames[framepos].TitleBar.hwnd, NULL, FALSE); + SetWindowPos(Frames[framepos].hWnd, HWND_TOP, 0, floatingHeight, width, height - floatingHeight, SWP_SHOWWINDOW | SWP_NOACTIVATE); + + } else { + Frames[framepos].height = height; + ShowWindow(Frames[framepos].TitleBar.hwnd, SW_HIDE); + SetWindowPos(Frames[framepos].hWnd, HWND_TOP, 0, 0, width, height, SWP_SHOWWINDOW | SWP_NOACTIVATE); + } + + if (Frames[framepos].ContainerWnd != 0) + UpdateWindow(Frames[framepos].ContainerWnd); + GetWindowRect(Frames[framepos].hWnd, &Frames[framepos].wndSize); + + if (Frames[framepos].TitleBar.ShowTitleBar) + RedrawWindow(Frames[framepos].TitleBar.hwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + RedrawWindow(Frames[framepos].hWnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + + return(0); +} + +static int CLUIFrameOnMainMenuBuild(WPARAM wParam, LPARAM lParam) +{ + CLUIFramesLoadMainMenu(); + return 0; +} + +LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + + RECT rect; + INT_PTR Frameid = GetWindowLongPtr(hwnd, GWLP_USERDATA); + memset(&rect, 0, sizeof(rect)); + switch (msg) { + case WM_CREATE: { + int framepos; + lockfrm(); + framepos = id2pos(Frameid); + ulockfrm(); + return(0); + } + case WM_GETMINMAXINFO: { + int framepos; + MINMAXINFO minmax; + + TitleBarH = cfg::dat.titleBarHeight; + lockfrm(); + + framepos = id2pos(Frameid); + if (framepos < 0 || framepos >= nFramescount) { + ulockfrm(); + break; + } + if (!Frames[framepos].minmaxenabled) { + ulockfrm(); + break; + } + if (Frames[framepos].ContainerWnd == 0) { + ulockfrm(); + break; + } + if (Frames[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; + } + + memset(&minmax, 0, sizeof(minmax)); + if (SendMessage(Frames[framepos].hWnd, WM_GETMINMAXINFO, (WPARAM)0, (LPARAM)&minmax) == 0) { + RECT border; + int tbh = TitleBarH * btoint(Frames[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 { + ulockfrm(); + return(DefWindowProc(hwnd, msg, wParam, lParam)); + } + ulockfrm(); + } + case WM_MOVE: { + int framepos; + RECT rect; + + lockfrm(); + framepos = id2pos(Frameid); + + if (framepos < 0 || framepos >= nFramescount) { + ulockfrm(); + break; + } + if (Frames[framepos].ContainerWnd == 0) { + ulockfrm(); + return(0); + } + GetWindowRect(Frames[framepos].ContainerWnd, &rect); + Frames[framepos].FloatingPos.x = rect.left; + Frames[framepos].FloatingPos.y = rect.top; + Frames[framepos].FloatingSize.x = rect.right - rect.left; + Frames[framepos].FloatingSize.y = rect.bottom - rect.top; + CLUIFramesStoreFrameSettings(framepos); + ulockfrm(); + return(0); + } + case WM_SIZE: { + int framepos; + RECT rect; + lockfrm(); + + framepos = id2pos(Frameid); + + if (framepos < 0 || framepos >= nFramescount) { + ulockfrm(); + break; + } + if (Frames[framepos].ContainerWnd == 0) { + ulockfrm(); + return(0); + } + CLUIFrameResizeFloatingFrame(framepos); + + GetWindowRect(Frames[framepos].ContainerWnd, &rect); + Frames[framepos].FloatingPos.x = rect.left; + Frames[framepos].FloatingPos.y = rect.top; + Frames[framepos].FloatingSize.x = rect.right - rect.left; + Frames[framepos].FloatingSize.y = rect.bottom - rect.top; + + CLUIFramesStoreFrameSettings(framepos); + ulockfrm(); + return(0); + } + 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(CreateWindowA("FramesContainer", "aaaa", WS_POPUP | WS_THICKFRAME, x, y, width, height, parent, 0, g_hInst, 0)); +} + + +INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam) +{ + HWND hwndtmp, hwndtooltiptmp; + + lockfrm(); + wParam = id2pos((INT_PTR)wParam); + if (wParam >= 0 && (int)wParam < nFramescount) + if (Frames[wParam].floating) { + SetParent(Frames[wParam].hWnd, pcli->hwndContactList); + SetParent(Frames[wParam].TitleBar.hwnd, pcli->hwndContactList); + Frames[wParam].floating = FALSE; + DestroyWindow(Frames[wParam].ContainerWnd); + Frames[wParam].ContainerWnd = 0; + } else { + RECT recttb, rectw, border; + int temp; + int neww, newh; + BOOLEAN locked; + + Frames[wParam].oldstyles = GetWindowLongPtr(Frames[wParam].hWnd, GWL_STYLE); + Frames[wParam].TitleBar.oldstyles = GetWindowLongPtr(Frames[wParam].TitleBar.hwnd, GWL_STYLE); + locked = Frames[wParam].Locked; + Frames[wParam].Locked = FALSE; + Frames[wParam].minmaxenabled = FALSE; + + GetWindowRect(Frames[wParam].hWnd, &rectw); + GetWindowRect(Frames[wParam].TitleBar.hwnd, &recttb); + if (!Frames[wParam].TitleBar.ShowTitleBar) { + recttb.top = recttb.bottom = recttb.left = recttb.right = 0; + } + Frames[wParam].ContainerWnd = CreateContainerWindow(pcli->hwndContactList, Frames[wParam].FloatingPos.x, Frames[wParam].FloatingPos.y, 10, 10); + + SetParent(Frames[wParam].hWnd, Frames[wParam].ContainerWnd); + SetParent(Frames[wParam].TitleBar.hwnd, Frames[wParam].ContainerWnd); + + GetBorderSize(Frames[wParam].ContainerWnd, &border); + + SetWindowLongPtr(Frames[wParam].ContainerWnd, GWLP_USERDATA, Frames[wParam].id); + if ((lParam == 1)) { + if ((Frames[wParam].FloatingPos.x != 0) && (Frames[wParam].FloatingPos.y != 0)) { + if (Frames[wParam].FloatingPos.x < 20) { + Frames[wParam].FloatingPos.x = 40; + } + if (Frames[wParam].FloatingPos.y < 20) { + Frames[wParam].FloatingPos.y = 40; + } + SetWindowPos(Frames[wParam].ContainerWnd, HWND_TOPMOST, Frames[wParam].FloatingPos.x, Frames[wParam].FloatingPos.y, Frames[wParam].FloatingSize.x, Frames[wParam].FloatingSize.y, SWP_HIDEWINDOW); + } else { + SetWindowPos(Frames[wParam].ContainerWnd, HWND_TOPMOST, 120, 120, 140, 140, SWP_HIDEWINDOW); + } + } else { + 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 (Frames[wParam].FloatingPos.x < 20) { + Frames[wParam].FloatingPos.x = 40; + } + if (Frames[wParam].FloatingPos.y < 20) { + Frames[wParam].FloatingPos.y = 40; + } + SetWindowPos(Frames[wParam].ContainerWnd, HWND_TOPMOST, Frames[wParam].FloatingPos.x, Frames[wParam].FloatingPos.y, neww, newh, SWP_HIDEWINDOW); + } + SetWindowText(Frames[wParam].ContainerWnd, Frames[wParam].TitleBar.tbname); + temp = GetWindowLongPtr(Frames[wParam].ContainerWnd, GWL_EXSTYLE); + temp |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST ; + SetWindowLongPtr(Frames[wParam].ContainerWnd, GWL_EXSTYLE, temp); + Frames[wParam].floating = TRUE; + Frames[wParam].Locked = locked; + + } + CLUIFramesStoreFrameSettings(wParam); + Frames[wParam].minmaxenabled = TRUE; + hwndtooltiptmp = Frames[wParam].TitleBar.hwndTip; + + hwndtmp = Frames[wParam].ContainerWnd; + ulockfrm(); + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, (LPARAM)0); + SendMessage(hwndtmp, WM_SIZE, 0, 0); + SetWindowPos(hwndtooltiptmp, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + return 0; +} + +TCHAR g_ptszEventName[100]; + +static int CLUIFrameOnModulesLoad(WPARAM wParam, LPARAM lParam) +{ + mir_sntprintf(g_ptszEventName, SIZEOF(g_ptszEventName), _T("mf_update_evt_%d"), GetCurrentThreadId()); + g_hEventThread = CreateEvent(NULL, TRUE, FALSE, g_ptszEventName); + hThreadMFUpdate = (HANDLE)mir_forkthreadex(reinterpret_cast(MF_UpdateThread), NULL, NULL); + SetThreadPriority(hThreadMFUpdate, THREAD_PRIORITY_IDLE); + CLUIFramesLoadMainMenu(); + CLUIFramesCreateMenuForFrame(-1, -1, 000010000, Menu_AddContextFrameMenuItem); + return 0; +} + +static int CLUIFrameOnModulesUnload(WPARAM wParam, LPARAM lParam) +{ + mf_updatethread_running = FALSE; + + SetThreadPriority(hThreadMFUpdate, THREAD_PRIORITY_NORMAL); + SetEvent(g_hEventThread); + WaitForSingleObject(hThreadMFUpdate, 2000); + CloseHandle(hThreadMFUpdate); + CloseHandle(g_hEventThread); + + CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMIVisible, 0); + CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMITitle, 0); + CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMITBVisible, 0); + CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMILock, 0); + CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMIColl, 0); + CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMIFloating, 0); + CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMIAlignRoot, 0); + CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMIAlignTop, 0); + CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMIAlignClient, 0); + CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMIAlignBottom, 0); + CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMIBorder, 0); + return 0; +} + +static INT_PTR SetIconForExtraColumn(WPARAM wParam, LPARAM lParam) +{ + pIconExtraColumn piec; + + if (pcli->hwndContactTree == 0) + return -1; + + if (wParam == 0 || lParam == 0 || IsBadCodePtr((FARPROC)lParam)) + return -1; + + piec = (pIconExtraColumn)lParam; + + if (piec->cbSize != sizeof(IconExtraColumn)) + return -1; + + if (cfg::dat.bMetaAvail && cfg::dat.bMetaEnabled && cfg::getByte((HANDLE)wParam, cfg::dat.szMetaName, "IsSubcontact", 0)) + PostMessage(pcli->hwndContactTree, CLM_SETEXTRAIMAGEINTMETA, wParam, MAKELONG((WORD)piec->ColumnType, (WORD)piec->hImage)); + else + PostMessage(pcli->hwndContactTree, CLM_SETEXTRAIMAGEINT, wParam, MAKELONG((WORD)piec->ColumnType, (WORD)piec->hImage)); + return 0; +} + +/* + * wparam=hIcon + * return hImage on success,-1 on failure + */ +static INT_PTR AddIconToExtraImageList(WPARAM wParam, LPARAM lParam) +{ + if (himlExtraImages == 0 || wParam == 0) + return -1; + + return((int)ImageList_AddIcon(himlExtraImages, (HICON)wParam)); +} + +/* +static INT_PTR SkinDrawBgService(WPARAM wParam, LPARAM lParam) +{ + StatusItems_t item; + HWND hwnd; + RECT rc; + + SKINDRAWREQUEST *sdrq = (SKINDRAWREQUEST *)wParam; + + if(wParam == 0 || IsBadCodePtr((FARPROC)wParam) || pDrawAlpha == NULL) + return 0; + + hwnd = WindowFromDC(sdrq->hDC); + GetClientRect(hwnd, &rc); + if(strstr(sdrq->szObjectID, "/Background") && EqualRect(&sdrq->rcClipRect, &sdrq->rcDestRect)) { + SkinDrawBg(hwnd, sdrq->hDC); + GetItemByStatus(ID_EXTBKEVTAREA, &item); + if(item.IGNORED) + FillRect(sdrq->hDC, &(sdrq->rcClipRect), GetSysColorBrush(COLOR_3DFACE)); + else { + DrawAlpha(sdrq->hDC, &(sdrq->rcClipRect), item.COLOR, item.ALPHA, item.COLOR2, item.COLOR2_TRANSPARENT, + item.GRADIENT, item.CORNER, item.BORDERSTYLE, item.imageItem); + } + } + else { + GetItemByStatus(ID_EXTBKEVTAREA, &item); + if(item.IGNORED) + FillRect(sdrq->hDC, &(sdrq->rcClipRect), GetSysColorBrush(COLOR_3DFACE)); + else { + DrawAlpha(sdrq->hDC, &(sdrq->rcClipRect), item.COLOR, item.ALPHA, item.COLOR2, item.COLOR2_TRANSPARENT, + item.GRADIENT, item.CORNER, item.BORDERSTYLE, item.imageItem); + } + } +} +*/ + +void RegisterCLUIFrameClasses() +{ + WNDCLASS wndclass; + WNDCLASS cntclass; + + wndclass.style = CS_DBLCLKS;//|CS_HREDRAW|CS_VREDRAW ; + wndclass.lpfnWndProc = CLUIFrameTitleBarProc; + wndclass.cbClsExtra = 0; + wndclass.cbWndExtra = 0; + wndclass.hInstance = g_hInst; + wndclass.hIcon = NULL; + wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hbrBackground = NULL; + wndclass.lpszMenuName = NULL; + wndclass.lpszClassName = CLUIFrameTitleBarClassName; + RegisterClass(&wndclass); + + cntclass.style = CS_DBLCLKS/*|CS_HREDRAW|CS_VREDRAW*/ | (IsWinVerXPPlus() ? CS_DROPSHADOW : 0); + cntclass.lpfnWndProc = CLUIFrameContainerWndProc; + cntclass.cbClsExtra = 0; + cntclass.cbWndExtra = 0; + cntclass.hInstance = g_hInst; + cntclass.hIcon = NULL; + cntclass.hCursor = LoadCursor(NULL, IDC_ARROW); + cntclass.hbrBackground = NULL; + cntclass.lpszMenuName = NULL; + cntclass.lpszClassName = _T("FramesContainer"); + RegisterClass(&cntclass); +} + +int LoadCLUIFramesModule(void) +{ + GapBetweenFrames = cfg::dat.gapBetweenFrames; + + nFramescount = 0; + InitializeCriticalSection(&csFrameHook); + InitFramesMenus(); + + HookEvent(ME_SYSTEM_MODULESLOADED, CLUIFrameOnModulesLoad); + HookEvent(ME_CLIST_PREBUILDFRAMEMENU, CLUIFramesModifyContextMenuForFrame); + HookEvent(ME_CLIST_PREBUILDMAINMENU, CLUIFrameOnMainMenuBuild); + HookEvent(ME_SYSTEM_PRESHUTDOWN, CLUIFrameOnModulesUnload); + + CreateServiceFunction(MS_CLIST_FRAMES_ADDFRAME, CLUIFramesAddFrame); + CreateServiceFunction(MS_CLIST_FRAMES_REMOVEFRAME, CLUIFramesRemoveFrame); + + CreateServiceFunction(MS_CLIST_FRAMES_SETFRAMEOPTIONS, CLUIFramesSetFrameOptions); + CreateServiceFunction(MS_CLIST_FRAMES_GETFRAMEOPTIONS, CLUIFramesGetFrameOptions); + CreateServiceFunction(MS_CLIST_FRAMES_UPDATEFRAME, CLUIFramesUpdateFrame); + + CreateServiceFunction(MS_CLIST_FRAMES_SHFRAMETITLEBAR, CLUIFramesShowHideFrameTitleBar); + CreateServiceFunction(MS_CLIST_FRAMES_SHOWALLFRAMESTB, CLUIFramesShowAllTitleBars); + CreateServiceFunction(MS_CLIST_FRAMES_HIDEALLFRAMESTB, CLUIFramesHideAllTitleBars); + CreateServiceFunction(MS_CLIST_FRAMES_SHFRAME, CLUIFramesShowHideFrame); + CreateServiceFunction(MS_CLIST_FRAMES_SHOWALLFRAMES, CLUIFramesShowAll); + + CreateServiceFunction(MS_CLIST_FRAMES_ULFRAME, CLUIFramesLockUnlockFrame); + CreateServiceFunction(MS_CLIST_FRAMES_UCOLLFRAME, CLUIFramesCollapseUnCollapseFrame); + CreateServiceFunction(MS_CLIST_FRAMES_SETUNBORDER, CLUIFramesSetUnSetBorder); + CreateServiceFunction(MS_CLIST_FRAMES_SETSKINNED, CLUIFramesSetUnSetSkinned); + + CreateServiceFunction(CLUIFRAMESSETALIGN, CLUIFramesSetAlign); + CreateServiceFunction(CLUIFRAMESMOVEDOWN, CLUIFramesMoveDown); + CreateServiceFunction(CLUIFRAMESMOVEUP, CLUIFramesMoveUp); + + CreateServiceFunction(CLUIFRAMESSETALIGNALTOP, CLUIFramesSetAlignalTop); + CreateServiceFunction(CLUIFRAMESSETALIGNALCLIENT, CLUIFramesSetAlignalClient); + CreateServiceFunction(CLUIFRAMESSETALIGNALBOTTOM, CLUIFramesSetAlignalBottom); + + CreateServiceFunction("Set_Floating", CLUIFrameSetFloat); + hWndExplorerToolBar = FindWindowExA(0, 0, "Shell_TrayWnd", NULL); + OnFrameTitleBarBackgroundChange(); + + FramesSysNotStarted = FALSE; + g_hPenCLUIFrames = CreatePen(PS_SOLID, 1, cfg::getDword("CLUI", "clr_frameborder", GetSysColor(COLOR_3DDKSHADOW))); + return 0; +} + +void LoadExtraIconModule() +{ + CreateServiceFunction(MS_CLIST_EXTRA_SET_ICON, SetIconForExtraColumn); + CreateServiceFunction(MS_CLIST_EXTRA_ADD_ICON, AddIconToExtraImageList); + + hExtraImageListRebuilding = CreateHookableEvent(ME_CLIST_EXTRA_LIST_REBUILD); + hExtraImageApplying = CreateHookableEvent(ME_CLIST_EXTRA_IMAGE_APPLY); + + hStatusBarShowToolTipEvent = CreateHookableEvent(ME_CLIST_FRAMES_SB_SHOW_TOOLTIP); + hStatusBarHideToolTipEvent = CreateHookableEvent(ME_CLIST_FRAMES_SB_HIDE_TOOLTIP); +} + +int UnLoadCLUIFramesModule(void) +{ + int i; + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + CLUIFramesStoreAllFrames(); + DeleteObject(g_hPenCLUIFrames); + EnterCriticalSection(&csFrameHook); + FramesSysNotStarted = TRUE; + for (i = 0;i < nFramescount;i++) { + DestroyWindow(Frames[i].hWnd); + Frames[i].hWnd = (HWND) - 1; + DestroyWindow(Frames[i].TitleBar.hwnd); + Frames[i].TitleBar.hwnd = (HWND) - 1; + DestroyWindow(Frames[i].ContainerWnd); + Frames[i].ContainerWnd = (HWND) - 1; + DestroyMenu(Frames[i].TitleBar.hmenu); + + if (Frames[i].name != NULL) + mir_free(Frames[i].name); + if (Frames[i].TitleBar.tbname != NULL) + mir_free(Frames[i].TitleBar.tbname); + } + if (Frames) + free(Frames); + Frames = NULL; + nFramescount = 0; + UnregisterClass(CLUIFrameTitleBarClassName, g_hInst); + LeaveCriticalSection(&csFrameHook); + DeleteCriticalSection(&csFrameHook); + UnitFramesMenu(); + return 0; +} + +void ReloadExtraIcons() +{ + NotifyEventHooks(hExtraImageListRebuilding, 0, 0); +} diff --git a/plugins/Clist_nicer/SRC/CLUIFrames/cluiframes.h b/plugins/Clist_nicer/SRC/CLUIFrames/cluiframes.h new file mode 100644 index 0000000000..083066ca6d --- /dev/null +++ b/plugins/Clist_nicer/SRC/CLUIFrames/cluiframes.h @@ -0,0 +1,105 @@ +/* +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. +*/ + +int LoadCLUIFramesModule(void); +int UnLoadCLUIFramesModule(void); +int CLUIFramesGetMinHeight(); +int CLUIFramesOnClistResize(WPARAM wParam,LPARAM lParam); +int SizeFramesByWindowRect(RECT *r); +int CLUIFramesResizeFrames(RECT *rc); + +typedef struct tagProtocolData { + char *RealName; + int statusbarpos; + boolean show; +} ProtocolData; + +#define OFFSET_PROTOPOS 200 +#define OFFSET_VISIBLE 400 + +#define CLUIFrameTitleBarClassName _T("CLUIFrameTitleBar") +#define CLUIFrameModule "CLUIFrames" + +//integrated menu module +#define MS_INT_MENUMEASUREITEM "CLUIFrames/IntMenuMeasureItem" +#define MS_INT_MENUDRAWITEM "CLUIFrames/IntMenuDrawItem" +#define MS_INT_MENUPROCESSCOMMAND "CLUIFrames/IntMenuProcessCommand" +#define MS_INT_MODIFYMENUITEM "CLUIFrames/IntModifyMenuItem" + +typedef struct _DockOpt { + HWND hwndLeft; + HWND hwndRight; +} +DockOpt; + +typedef struct tagMenuHandles { + HANDLE MainMenuItem; + HANDLE MIVisible,MITitle,MITBVisible,MILock,MIColl,MIFloating,MIAlignRoot; + HANDLE MIAlignTop,MIAlignClient,MIAlignBottom; + HANDLE MIBorder, MISkinned; +} FrameMenuHandles; + +typedef struct tagFrameTitleBar { + HWND hwnd; + HWND TitleBarbutt; + HWND hwndTip; + + LPTSTR tbname; + LPTSTR tooltip; + HMENU hmenu; + HICON hicon; + + BOOLEAN ShowTitleBar; + BOOLEAN ShowTitleBarTip; + int oldstyles; + POINT oldpos; + RECT wndSize; +} FrameTitleBar; + +typedef struct { + int id; + HWND hWnd ; + RECT wndSize; + RECT oldWndSize; + LPTSTR name; + int align; + int height; + int dwFlags; + BOOLEAN Locked; + BOOLEAN Skinned; + BOOLEAN visible; + BOOLEAN needhide; + BOOLEAN collapsed; + int prevvisframe; + int HeightWhenCollapsed; + FrameTitleBar TitleBar; + FrameMenuHandles MenuHandles; + int oldstyles; + BOOLEAN floating; + HWND ContainerWnd; + POINT FloatingPos; + POINT FloatingSize; + BOOLEAN minmaxenabled; + BOOLEAN UseBorder; + int order; + DockOpt dockOpt; + HWND OwnerWindow; + WNDPROC wndProc; +} wndFrame; + diff --git a/plugins/Clist_nicer/SRC/CLUIFrames/framesmenu.cpp b/plugins/Clist_nicer/SRC/CLUIFrames/framesmenu.cpp new file mode 100644 index 0000000000..07b6ebc4e6 --- /dev/null +++ b/plugins/Clist_nicer/SRC/CLUIFrames/framesmenu.cpp @@ -0,0 +1,228 @@ +#include +#include "cluiframes.h" + +//==========================Frames +HANDLE hFrameMenuObject; +static HANDLE hPreBuildFrameMenuEvent; +extern int InitCustomMenus(void); + +//contactmenu exec param(ownerdata) +//also used in checkservice +typedef struct{ + char *szServiceName; + int Frameid; + INT_PTR param1; +}FrameMenuExecParam,*lpFrameMenuExecParam; + +void FreeAndNil( void **p ) +{ + if (p!=NULL) + { + if (*p!=NULL) + { + if (!IsBadCodePtr((FARPROC)*p)) + { + mir_free(*p); + } + *p=NULL; + } + } +} + +INT_PTR FreeOwnerDataFrameMenu (WPARAM wParam,LPARAM lParam) +{ + + lpFrameMenuExecParam cmep; + + cmep=(lpFrameMenuExecParam)lParam; + if (cmep!=NULL){ + FreeAndNil((void **)&cmep->szServiceName); + FreeAndNil((void **)&cmep); + } + return(0); +} + +static INT_PTR AddContextFrameMenuItem(WPARAM wParam,LPARAM lParam) +{ + TMO_MenuItem tmi; + CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; + if ( !pcli->pfnConvertMenu(mi, &tmi)) + return NULL; + + tmi.root = (mi->flags & CMIF_ROOTHANDLE) ? mi->hParentMenu : NULL; + + lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)mir_alloc(sizeof(FrameMenuExecParam)); + if (fmep == NULL) + return 0; + + fmep->szServiceName = mir_strdup(mi->pszService); + fmep->Frameid = mi->popupPosition; + fmep->param1 = (INT_PTR)mi->pszContactOwner; + tmi.ownerdata = fmep; + + return CallService(MO_ADDNEWMENUITEM,(WPARAM)hFrameMenuObject,(LPARAM)&tmi); +} + +static INT_PTR RemoveContextFrameMenuItem(WPARAM wParam,LPARAM lParam) +{ + /* this do by free service + lpFrameMenuExecParam fmep; + fmep=(lpFrameMenuExecParam)CallService(MO_MENUITEMGETOWNERDATA,wParam,lParam); + if (fmep!=NULL){ + if (fmep->szServiceName!=NULL){ + mir_free(fmep->szServiceName); + fmep->szServiceName=NULL; + }; + mir_free(fmep); + } + */ + CallService(MO_REMOVEMENUITEM,wParam,0); + return 0; +} + +//called with: +//wparam - ownerdata +//lparam - lparam from winproc +INT_PTR FrameMenuExecService(WPARAM wParam,LPARAM lParam) { + lpFrameMenuExecParam fmep=(lpFrameMenuExecParam)wParam; + if (fmep==NULL) + return(-1); + + CallService(fmep->szServiceName,lParam,fmep->param1); + RedrawWindow(pcli->hwndContactList,NULL,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_FRAME|RDW_UPDATENOW|RDW_ALLCHILDREN); + return(0); +} + +//true - ok,false ignore +INT_PTR FrameMenuCheckService(WPARAM wParam,LPARAM lParam) { + + PCheckProcParam pcpp=(PCheckProcParam)wParam; + lpFrameMenuExecParam fmep; + TMO_MenuItem mi; + + if (pcpp==NULL){return(FALSE);}; + if (CallService(MO_GETMENUITEM,(WPARAM)pcpp->MenuItemHandle,(LPARAM)&mi)==0) + { + fmep = reinterpret_cast(mi.ownerdata); + if (fmep!=NULL) + { + //pcpp->wParam - frameid + if (((WPARAM)fmep->Frameid==pcpp->wParam)||fmep->Frameid==-1) return(TRUE); + } + } + return(FALSE); +} + +static INT_PTR ContextFrameMenuNotify(WPARAM wParam,LPARAM lParam) +{ + NotifyEventHooks(hPreBuildFrameMenuEvent,wParam,lParam); + return(0); +} + +static INT_PTR BuildContextFrameMenu(WPARAM wParam,LPARAM lParam) +{ + CLISTMENUITEM *mi=(CLISTMENUITEM*)lParam; + HMENU hMenu; + ListParam param = { 0 }; + param.MenuObjectHandle=hFrameMenuObject; + param.wParam=wParam; + param.lParam=lParam; + + hMenu=CreatePopupMenu(); + //NotifyEventHooks(hPreBuildFrameMenuEvent,wParam,-1); + ContextFrameMenuNotify(wParam,-1); + CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m); + return (INT_PTR)hMenu; +} + +//==========================Frames end +boolean InternalGenMenuModule=FALSE; + +INT_PTR MeasureItemProxy(WPARAM wParam,LPARAM lParam) +{ + int val; + if (InternalGenMenuModule) + { + val=CallService(MS_INT_MENUMEASUREITEM,wParam,lParam); + if (val) return(val); + } + + return CallService(MS_CLIST_MENUMEASUREITEM,wParam,lParam); +} + +INT_PTR DrawItemProxy(WPARAM wParam,LPARAM lParam) +{ + if (InternalGenMenuModule) + { + int val; + val=CallService(MS_INT_MENUDRAWITEM,wParam,lParam); + if (val) return(val); + } + return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam); +} + +int ProcessCommandProxy(WPARAM wParam,LPARAM lParam) +{ + if (InternalGenMenuModule) { + int val; + val=CallService(MS_INT_MENUPROCESSCOMMAND,wParam,lParam); + if (val) + return(val); + } + return CallService(MS_CLIST_MENUPROCESSCOMMAND,wParam,lParam); +} + +INT_PTR ModifyMenuItemProxy(WPARAM wParam,LPARAM lParam) +{ + if (InternalGenMenuModule) + { + int val; + val=CallService(MS_INT_MODIFYMENUITEM,wParam,lParam); + if (val) return(val); + } + + return CallService(MS_CLIST_MODIFYMENUITEM,wParam,lParam); +} + +int InitFramesMenus(void) +{ + TMenuParam tmp; + + if (!ServiceExists(MO_REMOVEMENUOBJECT)) + InternalGenMenuModule=TRUE; + + if (ServiceExists(MO_REMOVEMENUOBJECT)) + { + CreateServiceFunction("FrameMenuExecService",FrameMenuExecService); + CreateServiceFunction("FrameMenuCheckService",FrameMenuCheckService); + CreateServiceFunction("FrameMenuFreeService",FreeOwnerDataFrameMenu); + + + CreateServiceFunction(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM,RemoveContextFrameMenuItem); + CreateServiceFunction("CList/AddContextFrameMenuItem",AddContextFrameMenuItem); + CreateServiceFunction(MS_CLIST_MENUBUILDFRAMECONTEXT,BuildContextFrameMenu); + CreateServiceFunction(MS_CLIST_FRAMEMENUNOTIFY,ContextFrameMenuNotify); + hPreBuildFrameMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDFRAMEMENU); + + //frame menu object + memset(&tmp,0,sizeof(tmp)); + tmp.cbSize=sizeof(tmp); + tmp.CheckService="FrameMenuCheckService"; + tmp.ExecService="FrameMenuExecService"; + tmp.name="Frames_Menu"; + hFrameMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT,0,(LPARAM)&tmp); + { + OptParam op; + op.Handle=hFrameMenuObject; + op.Setting=OPT_MENUOBJECT_SET_FREE_SERVICE; + op.Value=(INT_PTR)"FrameMenuFreeService"; + CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); + } + } + return 0; +} + +int UnitFramesMenu() +{ + return(0); +} diff --git a/plugins/Clist_nicer/SRC/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/SRC/CLUIFrames/groupmenu.cpp new file mode 100644 index 0000000000..a784e30883 --- /dev/null +++ b/plugins/Clist_nicer/SRC/CLUIFrames/groupmenu.cpp @@ -0,0 +1,704 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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 + +//////////////////////////////Group MENU///////////////////////// +HANDLE hGroupMenuObject; + +HANDLE hGroupMainMenuItemProxy; +HANDLE hHideShowMainMenuItem; +HANDLE hGroupStatusMenuItemProxy; +HANDLE hPreBuildGroupMenuEvent; +HANDLE hAppearanceMenuItemProxy; +HANDLE hEventAreaMenuItemProxy; + +static HMENU hMenuOldContext; + +HANDLE hHideOfflineUsersMenuItem; +HANDLE hHideOfflineUsersOutHereMenuItem; +HANDLE hHideEmptyGroupsMenuItem; +HANDLE hDisableGroupsMenuItem; +HANDLE hNewGroupMenuItem; +HANDLE hNewSubGroupMenuItem; + +int NewGroupIconidx; + +extern HIMAGELIST hCListImages; +extern HICON LoadIconFromExternalFile (char *filename,int i,boolean UseLibrary,boolean registerit,char *IconName,char *SectName,char *Description,int internalidx); + +void InitSubGroupMenus(void); + +//Groupmenu exec param(ownerdata) +typedef struct { + char *szServiceName; + int Param1,Param2; +}GroupMenuExecParam,*lpGroupMenuExecParam; + +/* +wparam=handle to the menu item returned by MS_CLIST_ADDCONTACTMENUITEM +return 0 on success. +*/ +static INT_PTR RemoveGroupMenuItem(WPARAM wParam,LPARAM lParam) +{ + CallService(MO_REMOVEMENUITEM,wParam,0); + return 0; +} + + +static INT_PTR BuildGroupMenu(WPARAM wParam,LPARAM lParam) +{ + int tick; + HMENU hMenu; + ListParam param = { 0 }; + param.MenuObjectHandle=hGroupMenuObject; + + //hMenu=hMainMenu; + hMenu=CreatePopupMenu(); + //hMenu=wParam; + tick=GetTickCount(); + + NotifyEventHooks(hPreBuildGroupMenuEvent,0,0); + + CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m); + //DrawMenuBar((HWND)CallService("CLUI/GetHwnd",0,0)); + tick=GetTickCount()-tick; + return(INT_PTR)hMenu; +} + +static INT_PTR AddGroupMenuItem(WPARAM wParam,LPARAM lParam) +{ + TMO_MenuItem tmi; + CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; + if ( !pcli->pfnConvertMenu(mi, &tmi)) + return NULL; + + lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)mir_alloc(sizeof(GroupMenuExecParam)); + if (mmep == NULL) + return 0; + + //we need just one parametr. + mmep->szServiceName = mir_strdup(mi->pszService); + mmep->Param1 = mi->popupPosition; + lpGroupMenuParam gmp=(lpGroupMenuParam)wParam; + if (gmp != NULL) { + mmep->Param1 = gmp->wParam; + mmep->Param2 = gmp->lParam; + } + tmi.ownerdata=mmep; + + char buf[1024]; + sprintf(buf,"%s/%s",mi->pszService,mi->pszName); + + OptParam op; + op.Handle=(HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hGroupMenuObject,(LPARAM)&tmi); + op.Setting=OPT_MENUITEMSETUNIQNAME; + op.Value=(INT_PTR)buf; + CallService(MO_SETOPTIONSMENUITEM,(WPARAM)0,(LPARAM)&op); + return (INT_PTR)op.Handle; +} + +INT_PTR GroupMenuCheckService(WPARAM wParam,LPARAM lParam) +{ + return 0; +} + +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; + //mi.fType=MFT_STRING; + mii->hSubMenu=(HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0); + } + + if (hGroupStatusMenuItemProxy==(HANDLE)lParam) { + mii->fMask|=MIIM_SUBMENU; + //mi.fType=MFT_STRING; + mii->hSubMenu=(HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); + } + if (hAppearanceMenuItemProxy==(HANDLE)lParam) { + hMenuOldContext = GetSubMenu(LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT)), 3); + TranslateMenu(hMenuOldContext); + + CheckMenuItem(hMenuOldContext, POPUP_VISIBILITY, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_SHOWVISI ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(hMenuOldContext, POPUP_FRAME, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(hMenuOldContext, POPUP_BUTTONS, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_FRAME_SHOWBOTTOMBUTTONS ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(hMenuOldContext, POPUP_SHOWMETAICONS, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_USEMETAICONS ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(hMenuOldContext, POPUP_SHOWSTATUSICONS, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_FRAME_STATUSICONS ? MF_CHECKED : MF_UNCHECKED)); + + // floater menu items + + EnableMenuItem(hMenuOldContext, POPUP_FLOATER_AUTOHIDE, MF_BYCOMMAND | (cfg::dat.bUseFloater & CLUI_USE_FLOATER ? MF_ENABLED : MF_GRAYED)); + EnableMenuItem(hMenuOldContext, POPUP_FLOATER_EVENTS, MF_BYCOMMAND | (cfg::dat.bUseFloater & CLUI_USE_FLOATER ? MF_ENABLED : MF_GRAYED)); + CheckMenuItem(hMenuOldContext, POPUP_FLOATER, MF_BYCOMMAND | (cfg::dat.bUseFloater & CLUI_USE_FLOATER ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(hMenuOldContext, POPUP_FLOATER_AUTOHIDE, MF_BYCOMMAND | (cfg::dat.bUseFloater & CLUI_FLOATER_AUTOHIDE ? MF_CHECKED : MF_UNCHECKED)); + CheckMenuItem(hMenuOldContext, POPUP_FLOATER_EVENTS, MF_BYCOMMAND | (cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS ? MF_CHECKED : MF_UNCHECKED)); + + mii->fMask|=MIIM_SUBMENU; + //mi.fType=MFT_STRING; + mii->hSubMenu=(HMENU)hMenuOldContext; + } + 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 (!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 wParam,LPARAM lParam) +{ + + lpGroupMenuExecParam mmep; + mmep=(lpGroupMenuExecParam)lParam; + if (mmep!=NULL) { + FreeAndNil((void **)&mmep->szServiceName); + FreeAndNil((void **)&mmep); + } + + return(0); +}; + +INT_PTR HideGroupsHelper(WPARAM wParam,LPARAM lParam) +{ + int newVal=!(GetWindowLongPtr((HWND)CallService(MS_CLUI_GETHWNDTREE,0,0),GWL_STYLE)&CLS_HIDEEMPTYGROUPS); + cfg::writeByte("CList","HideEmptyGroups",(BYTE)newVal); + SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE,0,0),CLM_SETHIDEEMPTYGROUPS,newVal,0); + return 0; +} + +INT_PTR UseGroupsHelper(WPARAM wParam,LPARAM lParam) +{ + int newVal=!(GetWindowLongPtr((HWND)CallService(MS_CLUI_GETHWNDTREE,0,0),GWL_STYLE)&CLS_USEGROUPS); + cfg::writeByte("CList","UseGroups",(BYTE)newVal); + SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE,0,0),CLM_SETUSEGROUPS,newVal,0); + return 0; +} + +INT_PTR HideOfflineRootHelper(WPARAM wParam,LPARAM lParam) +{ + SendMessage( + (HWND)CallService(MS_CLUI_GETHWNDTREE,0,0), + CLM_SETHIDEOFFLINEROOT, + !SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE,0,0),CLM_GETHIDEOFFLINEROOT,0,0), + 0); + return 0; +}; + +static int OnBuildGroupMenu(WPARAM wParam,LPARAM lParam) +{ + CLISTMENUITEM mi; + + + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.flags = CMIM_FLAGS | (cfg::getByte("CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CMIF_CHECKED:0); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersMenuItem, (LPARAM)&mi); + + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.flags = CMIM_FLAGS | (SendMessage(pcli->hwndContactTree,CLM_GETHIDEOFFLINEROOT,0,0)?CMIF_CHECKED:0); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersOutHereMenuItem, (LPARAM)&mi); + + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_HIDEEMPTYGROUPS?CMIF_CHECKED:0); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideEmptyGroupsMenuItem, (LPARAM)&mi); + + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_USEGROUPS?0:CMIF_CHECKED); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hDisableGroupsMenuItem, (LPARAM)&mi); + + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.flags = CMIM_FLAGS; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hGroupMainMenuItemProxy, (LPARAM)&mi); + + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.flags = CMIM_FLAGS; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hAppearanceMenuItemProxy, (LPARAM)&mi); + + return 0; +}; + +int static OnIconLibIconChanged(WPARAM wParam,LPARAM lParam) +{ + HICON hicon; + CLISTMENUITEM clmi={0}; + + //hicon=LoadIconFromExternalFile("clisticons.dll",2,TRUE,FALSE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP); + NewGroupIconidx=ImageList_ReplaceIcon(hCListImages,NewGroupIconidx,hicon); + + clmi.cbSize=sizeof(clmi); + clmi.flags=CMIM_ICON; + clmi.hIcon=ImageList_GetIcon(hCListImages,NewGroupIconidx,0); + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewSubGroupMenuItem,(LPARAM)&clmi); + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewGroupMenuItem,(LPARAM)&clmi); + // + + + return 0; +}; + +void InitGroupMenus(void) +{ + TMenuParam tmp; + OptParam op; + //hicon=LoadIconFromExternalFile("clisticons.dll",2,TRUE,TRUE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP2); + //NewGroupIconidx=ImageList_AddIcon(hCListImages,hicon ); + + 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("CList/AddGroupMenuItem",AddGroupMenuItem); + CreateServiceFunction(MS_CLIST_REMOVEGROUPMENUITEM,RemoveGroupMenuItem); + CreateServiceFunction(MS_CLIST_MENUBUILDGROUP,BuildGroupMenu); + hPreBuildGroupMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDGROUPMENU); + HookEvent(ME_CLIST_PREBUILDGROUPMENU,OnBuildGroupMenu); + + InitSubGroupMenus(); + + //Group menu + memset(&tmp,0,sizeof(tmp)); + tmp.cbSize=sizeof(tmp); + tmp.CheckService=NULL; + tmp.ExecService="CLISTMENUSGroup/ExecService"; + tmp.name="GroupMenu"; + hGroupMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp); + + + op.Handle=hGroupMenuObject; + op.Setting=OPT_USERDEFINEDITEMS; + op.Value=TRUE; + CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); + + op.Handle=hGroupMenuObject; + op.Setting=OPT_MENUOBJECT_SET_FREE_SERVICE; + op.Value=(INT_PTR)"CLISTMENUSGroup/FreeOwnerDataGroupMenu"; + CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); + + op.Handle=hGroupMenuObject; + op.Setting=OPT_MENUOBJECT_SET_ONADD_SERVICE; + op.Value=(INT_PTR)"CLISTMENUSGroup/GroupMenuonAddService"; + CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); + + { + //add exit command to menu + CLISTMENUITEM mi; + GroupMenuParam gmp; + + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=1900000; + mi.pszService="CloseAction"; + mi.pszName=LPGEN("E&xit"); + AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=500; + mi.pszService=MS_CLIST_SHOWHIDE; + mi.pszName=LPGEN("&Hide/Show"); + hHideShowMainMenuItem=(HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=200000; + mi.flags = CMIF_ICONFROMICOLIB; + mi.icolibItem=LoadSkinnedIconHandle(SKINICON_OTHER_FINDUSER); //LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_FINDUSER)); + mi.pszService="FindAdd/FindAddCommand"; + mi.pszName=LPGEN("&Find/Add Contacts..."); + AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=300000; + mi.pszService=""; + mi.pszName=LPGEN("&Main Menu"); + hGroupMainMenuItemProxy=(HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=300100; + mi.pszService=""; + mi.pszName=LPGEN("&Status"); + hGroupStatusMenuItemProxy=(HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=390100; + mi.pszService=""; + mi.pszName=LPGEN("Appearance"); + hAppearanceMenuItemProxy=(HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=400000; + mi.flags = CMIF_ICONFROMICOLIB; + mi.icolibItem=LoadSkinnedIconHandle(SKINICON_OTHER_OPTIONS); //LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_OPTIONS)); + mi.pszService="Options/OptionsCommand"; + mi.pszName=LPGEN("&Options..."); + + AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=500000; + mi.flags = CMIF_ICONFROMICOLIB; + mi.icolibItem=LoadSkinnedIconHandle(SKINICON_OTHER_MIRANDA); //LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_MIRANDA)); + mi.pszService="CLN/About"; + mi.pszName=LPGEN("&About the contact list..."); + + AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=100000; + mi.hIcon=ImageList_GetIcon(hCListImages,NewGroupIconidx,0); + //mi.pszService=MS_CLIST_GROUPCREATE; + mi.pszService="CLISTMENUSSubGroup/GroupMenuExecProxy"; + //mi.pszService="CLISTMENUSGroup/ExecService"; + mi.pszName=LPGEN("&New Group"); + gmp.lParam=0;gmp.wParam=POPUP_NEWGROUP; + hNewGroupMenuItem=(HANDLE)AddGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=100001; + mi.hIcon=NULL; + mi.pszService=MS_CLIST_SETHIDEOFFLINE; + mi.pszName=LPGEN("&Hide Offline Users"); + gmp.lParam=0;gmp.wParam=-1; + hHideOfflineUsersMenuItem=(HANDLE)AddGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=100002; + mi.hIcon=NULL; + mi.pszService="CLISTMENUSGroup/HideOfflineRootHelper"; + mi.pszName=LPGEN("Hide &Offline Users out here"); + hHideOfflineUsersOutHereMenuItem=(HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=100003; + mi.hIcon=NULL; + mi.pszService="CLISTMENUSGroup/HideGroupsHelper"; + mi.pszName=LPGEN("Hide &Empty Groups"); + hHideEmptyGroupsMenuItem=(HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + + + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=100004; + mi.hIcon=NULL; + mi.pszService="CLISTMENUSGroup/UseGroupsHelper"; + mi.pszName=LPGEN("Disable &Groups"); + hDisableGroupsMenuItem=(HANDLE)AddGroupMenuItem((WPARAM)0,(LPARAM)&mi); + + + //MS_CLIST_GROUPCREATE + + }; +} + +HANDLE hSubGroupMenuObject; + +HANDLE hSubGroupMainMenuItemProxy; +//HANDLE hHideShowMainMenuItem; +HANDLE hSubGroupStatusMenuItemProxy; +HANDLE hPreBuildSubGroupMenuEvent; +HANDLE hHideOfflineUsersHereMenuItem; + +//SubGroupmenu exec param(ownerdata) +typedef struct { + char *szServiceName; + int Param1,Param2; +}SubGroupMenuExecParam,*lpSubGroupMenuExecParam; + +/* +wparam=handle to the menu item returned by MS_CLIST_ADDCONTACTMENUITEM +return 0 on success. +*/ +static INT_PTR RemoveSubGroupMenuItem(WPARAM wParam,LPARAM lParam) +{ + CallService(MO_REMOVEMENUITEM,wParam,0); + return 0; +} + +static int OnBuildSubGroupMenu(WPARAM wParam,LPARAM lParam) +{ + ClcGroup *group=(struct ClcGroup *)wParam; + if (group == 0) + return 0; + + //contact->group + CLISTMENUITEM mi = { 0 }; + mi.cbSize = sizeof(mi); + mi.flags = CMIM_FLAGS | (group->hideOffline?CMIF_CHECKED:0); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersHereMenuItem, (LPARAM)&mi); + + return 0; +} + +static INT_PTR BuildSubGroupMenu(WPARAM wParam,LPARAM lParam) +{ + ListParam param = { 0 }; + param.MenuObjectHandle = hSubGroupMenuObject; + param.wParam = wParam; + + HMENU hMenu = CreatePopupMenu(); + int tick = GetTickCount(); + NotifyEventHooks(hPreBuildSubGroupMenuEvent,wParam,0); + + CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m); + tick = GetTickCount()-tick; + return(INT_PTR)hMenu; +} + +static INT_PTR AddSubGroupMenuItem(WPARAM wParam,LPARAM lParam) +{ + TMO_MenuItem tmi; + CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; + if ( !pcli->pfnConvertMenu(mi, &tmi)) + return NULL; + + lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)mir_alloc(sizeof(SubGroupMenuExecParam)); + if (mmep == NULL) + return 0; + + //we need just one parametr. + lpGroupMenuParam gmp=(lpGroupMenuParam)wParam; + mmep->szServiceName = mir_strdup(mi->pszService); + mmep->Param1 = mi->popupPosition; + if (gmp != NULL) { + mmep->Param1 = gmp->wParam; + mmep->Param2 = gmp->lParam; + } + tmi.ownerdata = mmep; + + char buf[1024]; + sprintf(buf,"%s/%s",mi->pszService,mi->pszName); + + OptParam op; + op.Handle=(HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hSubGroupMenuObject,(LPARAM)&tmi); + op.Setting=OPT_MENUITEMSETUNIQNAME; + op.Value=(INT_PTR)buf; + CallService(MO_SETOPTIONSMENUITEM,(WPARAM)0,(LPARAM)&op); + return (INT_PTR)op.Handle; +} + +INT_PTR SubGroupMenuCheckService(WPARAM wParam,LPARAM lParam) { + //not used + return(0); +}; + +INT_PTR SubGroupMenuonAddService(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 (hSubGroupMainMenuItemProxy==(HANDLE)lParam) + { + mii->fMask|=MIIM_SUBMENU; + //mi.fType=MFT_STRING; + mii->hSubMenu=(HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0); + } + + if (hSubGroupStatusMenuItemProxy==(HANDLE)lParam) + { + mii->fMask|=MIIM_SUBMENU; + //mi.fType=MFT_STRING; + mii->hSubMenu=(HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,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 (!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 FreeOwnerDataSubGroupMenu (WPARAM wParam,LPARAM lParam) +{ + lpSubGroupMenuExecParam mmep; + mmep=(lpSubGroupMenuExecParam)lParam; + if (mmep!=NULL) { + FreeAndNil((void **)&mmep->szServiceName); + FreeAndNil((void **)&mmep); + } + + return(0); +} + +//wparam menu handle to pass to clc.c +INT_PTR GroupMenuExecProxy(WPARAM wParam,LPARAM lParam) +{ + SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE,0,0),WM_COMMAND,wParam,0); + return 0; +} + +void InitSubGroupMenus(void) +{ + TMenuParam tmp; + OptParam op; + + CreateServiceFunction("CLISTMENUSSubGroup/ExecService",SubGroupMenuExecService); + CreateServiceFunction("CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu",FreeOwnerDataSubGroupMenu); + CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuonAddService",SubGroupMenuonAddService); + CreateServiceFunction("CLISTMENUSSubGroup/GroupMenuExecProxy",GroupMenuExecProxy); + + //CreateServiceFunction("CLISTMENUSSubGroup/HideSubGroupsHelper",HideSubGroupsHelper); + //CreateServiceFunction("CLISTMENUSSubGroup/UseSubGroupsHelper",UseSubGroupsHelper); + //CreateServiceFunction("CLISTMENUSSubGroup/HideOfflineRootHelper",HideOfflineRootHelper); + + CreateServiceFunction("CList/AddSubGroupMenuItem",AddSubGroupMenuItem); + CreateServiceFunction(MS_CLIST_REMOVESUBGROUPMENUITEM,RemoveSubGroupMenuItem); + CreateServiceFunction(MS_CLIST_MENUBUILDSUBGROUP,BuildSubGroupMenu); + hPreBuildSubGroupMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDSUBGROUPMENU); + HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU,OnBuildSubGroupMenu); + + + //SubGroup menu + memset(&tmp,0,sizeof(tmp)); + tmp.cbSize=sizeof(tmp); + tmp.CheckService=NULL; + tmp.ExecService="CLISTMENUSSubGroup/ExecService"; + tmp.name="SubGroupMenu"; + hSubGroupMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp); + + + op.Handle=hSubGroupMenuObject; + op.Setting=OPT_USERDEFINEDITEMS; + op.Value=TRUE; + CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); + + op.Handle=hSubGroupMenuObject; + op.Setting=OPT_MENUOBJECT_SET_FREE_SERVICE; + op.Value=(INT_PTR)"CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu"; + CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); + + op.Handle=hSubGroupMenuObject; + op.Setting=OPT_MENUOBJECT_SET_ONADD_SERVICE; + op.Value=(INT_PTR)"CLISTMENUSSubGroup/SubGroupMenuonAddService"; + CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); + + { + //add exit command to menu + CLISTMENUITEM mi; + GroupMenuParam gmp; + + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=1000; + mi.hIcon=ImageList_GetIcon(hCListImages,NewGroupIconidx,0); + mi.pszService="CLISTMENUSSubGroup/GroupMenuExecProxy"; + mi.pszName=LPGEN("&New SubGroup"); + gmp.lParam=0;gmp.wParam=POPUP_NEWSUBGROUP; + hNewSubGroupMenuItem=(HANDLE)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=1001; + mi.hIcon=NULL; + mi.pszService="CLISTMENUSSubGroup/GroupMenuExecProxy"; + mi.pszName=LPGEN("&Hide Offline Users in here"); + gmp.lParam=0;gmp.wParam=POPUP_GROUPHIDEOFFLINE; + hHideOfflineUsersHereMenuItem=(HANDLE)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=900001; + mi.flags = CMIF_ICONFROMICOLIB; + mi.icolibItem=LoadSkinnedIconHandle(SKINICON_OTHER_RENAME); //LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_RENAME)); + mi.pszService="CLISTMENUSSubGroup/GroupMenuExecProxy"; + mi.pszName=LPGEN("&Rename Group"); + gmp.lParam=0;gmp.wParam=POPUP_RENAMEGROUP; + AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); + + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=900002; + mi.flags = CMIF_ICONFROMICOLIB; + mi.icolibItem=LoadSkinnedIconHandle(SKINICON_OTHER_DELETE); //LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_DELETE)); + mi.pszService="CLISTMENUSSubGroup/GroupMenuExecProxy"; + mi.pszName=LPGEN("&Delete Group"); + gmp.lParam=0;gmp.wParam=POPUP_DELETEGROUP; + AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); + } +} + +//////////////////////////////END SubGroup MENU///////////////////////// diff --git a/plugins/Clist_nicer/SRC/CLUIFrames/movetogroup.cpp b/plugins/Clist_nicer/SRC/CLUIFrames/movetogroup.cpp new file mode 100644 index 0000000000..89bc2a42e4 --- /dev/null +++ b/plugins/Clist_nicer/SRC/CLUIFrames/movetogroup.cpp @@ -0,0 +1,60 @@ +#include + +HANDLE hOnCntMenuBuild; +HANDLE hPriorityItem = 0, hFloatingItem = 0; + +static int OnContactMenuBuild(WPARAM wParam,LPARAM lParam) +{ + CLISTMENUITEM mi; + BYTE bSetting; + + // Menu Item - Floating Contact + bSetting = cfg::getByte("CList", "flt_enabled", 0); + if (bSetting && !hFloatingItem) + { + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=200000; + mi.pszPopupName=(char *)-1; + mi.pszService="CList/SetContactFloating"; + mi.pszName=LPGEN("&Floating Contact"); + if (pcli) + { + if (SendMessage(pcli->hwndContactTree, CLM_QUERYFLOATINGCONTACT, wParam, 0)) + mi.flags=CMIF_CHECKED; + } + hFloatingItem = Menu_AddContactMenuItem(&mi); + } + else if (!bSetting && hFloatingItem) + { + CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)hFloatingItem, 0); + hFloatingItem = 0; + } + else + { + memset(&mi,0,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.flags=CMIM_FLAGS; + if (pcli) + { + if (SendMessage(pcli->hwndContactTree, CLM_QUERYFLOATINGCONTACT, wParam, 0)) + mi.flags |= CMIF_CHECKED; + } + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hFloatingItem, (LPARAM)&mi); + } + return 0; +} + +int MTG_OnmodulesLoad(WPARAM wParam,LPARAM lParam) +{ + hOnCntMenuBuild=HookEvent(ME_CLIST_PREBUILDCONTACTMENU,OnContactMenuBuild); + return 0; +} + +int UnloadMoveToGroup(void) +{ + if (hOnCntMenuBuild) + UnhookEvent(hOnCntMenuBuild); + + return 0; +} diff --git a/plugins/Clist_nicer/SRC/Coolsb/coolsb_internal.h b/plugins/Clist_nicer/SRC/Coolsb/coolsb_internal.h new file mode 100644 index 0000000000..8a394f8a51 --- /dev/null +++ b/plugins/Clist_nicer/SRC/Coolsb/coolsb_internal.h @@ -0,0 +1,95 @@ +#ifndef _COOLSB_INTERNAL_INCLUDED +#define _COOLSB_INTERNAL_INCLUDED + +#ifdef __cplusplus +extern "C"{ +#endif + +#include + +// +// SCROLLBAR datatype. There are two of these structures per window +// +typedef struct +{ + UINT fScrollFlags; //flags + BOOL fScrollVisible; //if this scrollbar visible? + SCROLLINFO scrollInfo; //positional data (range, position, page size etc) + + int nArrowLength; //perpendicular size (height of a horizontal, width of a vertical) + int nArrowWidth; //parallel size (width of horz, height of vert) + + //data for inserted buttons + SCROLLBUT sbButtons[MAX_COOLSB_BUTS]; + int nButtons; + int nButSizeBefore; //size to the left / above the bar + int nButSizeAfter; //size to the right / below the bar + + BOOL fButVisibleBefore; //if the buttons to the left are visible + BOOL fButVisibleAfter; //if the buttons to the right are visible + + int nBarType; //SB_HORZ / SB_VERT + + UINT fFlatScrollbar; //do we display flat scrollbars? + int nMinThumbSize; + +} SCROLLBAR; + +// +// Container structure for a cool scrollbar window. +// +typedef struct +{ + UINT bars; //which of the scrollbars do we handle? SB_VERT / SB_HORZ / SB_BOTH + WNDPROC oldproc; //old window procedure to call for every message + + SCROLLBAR sbarHorz; //one scrollbar structure each for + SCROLLBAR sbarVert; //the horizontal and vertical scrollbars + + BOOL fThumbTracking; // are we currently thumb-tracking?? + BOOL fLeftScrollbar; // support the WS_EX_LEFTSCROLLBAR style + + HWND hwndToolTip; // tooltip support!!! + + //size of the window borders + int cxLeftEdge, cxRightEdge; + int cyTopEdge, cyBottomEdge; + + // To prevent calling original WindowProc in response + // to our own temporary style change (fixes TreeView problem) + BOOL bPreventStyleChange; + +} SCROLLWND; + + +// +// PRIVATE INTERNAL FUNCTIONS +// +SCROLLWND *GetScrollWndFromHwnd(HWND hwnd); +#define InvertCOLORREF(col) ((~col) & 0x00ffffff) + +#define COOLSB_TIMERID1 65533 //initial timer +#define COOLSB_TIMERID2 65534 //scroll message timer +#define COOLSB_TIMERID3 -14 //mouse hover timer +#define COOLSB_TIMERINTERVAL1 300 +#define COOLSB_TIMERINTERVAL2 55 +#define COOLSB_TIMERINTERVAL3 20 //mouse hover time + + +// +// direction: 0 - same axis as scrollbar (i.e. width of a horizontal bar) +// 1 - perpendicular dimesion (i.e. height of a horizontal bar) +// +#define SM_CXVERTSB 1 +#define SM_CYVERTSB 0 +#define SM_CXHORZSB 0 +#define SM_CYHORZSB 1 +#define SM_SCROLL_WIDTH 1 +#define SM_SCROLL_LENGTH 0 + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/plugins/Clist_nicer/SRC/Coolsb/coolsblib.cpp b/plugins/Clist_nicer/SRC/Coolsb/coolsblib.cpp new file mode 100644 index 0000000000..42f74c4ca0 --- /dev/null +++ b/plugins/Clist_nicer/SRC/Coolsb/coolsblib.cpp @@ -0,0 +1,1003 @@ +/* + + Cool Scrollbar Library Version 1.2 + + Module: coolsblib.c + Copyright (c) J Brown 2001 + + This code is freeware, however, you may not publish + this code elsewhere or charge any money for it. This code + is supplied as-is. I make no guarantees about the suitability + of this code - use at your own risk. + + It would be nice if you credited me, in the event + that you use this code in a product. + + VERSION HISTORY: + + V1.2: TreeView problem fixed by Diego Tartara + Small problem in thumbsize calculation also fixed (thanks Diego!) + + V1.1: Added support for Right-left windows + Changed calling convention of APIs to WINAPI (__stdcall) + Completely standalone (no need for c-runtime) + + V1.0: Apr 2001: Initial Version + +*/ + +#define _WIN32_WINNT 0x0501 +#define _WIN32_IE 0x0501 + +#include +#include "coolscroll.h" +#include "userdefs.h" +#include "coolsb_internal.h" + +static TCHAR szPropStr[] = _T("CoolSBSubclassPtr"); + +LRESULT CALLBACK CoolSBWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + +SCROLLWND *GetScrollWndFromHwnd(HWND hwnd) +{ + return (SCROLLWND *)GetProp(hwnd, szPropStr); +} + +SCROLLBAR *GetScrollBarFromHwnd(HWND hwnd, UINT nBar) +{ + SCROLLWND *sw = GetScrollWndFromHwnd(hwnd); + + if (!sw) return 0; + + if(nBar == SB_HORZ) + return &sw->sbarHorz; + else if(nBar == SB_VERT) + return &sw->sbarVert; + else + return 0; +} + +BOOL WINAPI CoolSB_IsCoolScrollEnabled(HWND hwnd) +{ + if(GetScrollWndFromHwnd(hwnd)) + return TRUE; + else + return FALSE; +} + +BOOL GetScrollRect(SCROLLWND *sw, UINT nBar, HWND hwnd, RECT *rect); + +// +// Special support for USER32.DLL patching (using Detours library) +// The only place we call a real scrollbar API is in InitializeCoolSB, +// where we call EnableScrollbar. +// +// We HAVE to call the origial EnableScrollbar function, +// so we need to be able to set a pointer to this func when using +// using Detours (or any other LIB??) +// + +typedef BOOL (WINAPI *WPROC)(HWND, UINT, UINT); + +static WPROC pEnableScrollBar = 0; + +void WINAPI CoolSB_SetESBProc(WPROC proc) +{ + pEnableScrollBar = proc; +} +// +// + +static void RedrawNonClient(HWND hwnd, BOOL fFrameChanged) +{ + if(fFrameChanged == FALSE) + { + /* + RECT rect; + HRGN hrgn1, hrgn2; + + SCROLLWND *sw = GetScrollWndFromHwnd(hwnd); + + GetScrollRect(sw, SB_HORZ, hwnd, &rect); + hrgn1 = CreateRectRgnIndirect(&rect); + + GetScrollRect(sw, SB_VERT, hwnd, &rect); + hrgn2 = CreateRectRgnIndirect(&rect); + + CombineRgn(hrgn1, hrgn2, hrgn1, RGN_OR); + + SendMessage(hwnd, WM_NCPAINT, (WPARAM)hrgn1, 0); + + DeleteObject(hrgn1); + DeleteObject(hrgn2);*/ + + SendMessage(hwnd, WM_NCPAINT, (WPARAM)1, 0); + } + else + { + SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE + | SWP_FRAMECHANGED | SWP_DRAWFRAME); + } +} + +// +// return the default minimum size of a scrollbar thumb +// +int WINAPI CoolSB_GetDefaultMinThumbSize(void) +{ + DWORD dwVersion = GetVersion(); + + // set the minimum thumb size for a scrollbar. This + // differs between NT4 and 2000, so need to check to see + // which platform we are running under + if(dwVersion < 0x80000000) // Windows NT/2000 + { + if(LOBYTE(LOWORD(dwVersion)) >= 5) + return MINTHUMBSIZE_2000; + else + return MINTHUMBSIZE_NT4; + } + else + { + return MINTHUMBSIZE_NT4; + } +} + +static SCROLLINFO *GetScrollInfoFromHwnd(HWND hwnd, int fnBar) +{ + SCROLLBAR *sb = GetScrollBarFromHwnd(hwnd, fnBar); + + if(sb == 0) + return FALSE; + + if(fnBar == SB_HORZ) + { + return &sb->scrollInfo; + } + else if(fnBar == SB_VERT) + { + return &sb->scrollInfo; + } + else + return NULL; +} +// +// Initialize the cool scrollbars for a window by subclassing it +// and using the coolsb window procedure instead +// +BOOL WINAPI InitializeCoolSB(HWND hwnd) +{ + SCROLLWND *sw; + SCROLLINFO *si; + INITCOMMONCONTROLSEX ice; + TOOLINFO ti; + RECT rect; + DWORD dwCurStyle; + //BOOL fDisabled; + + if(pEnableScrollBar == 0) + pEnableScrollBar = EnableScrollBar; + + GetClientRect(hwnd, &rect); + + //if we have already initialized Cool Scrollbars for this window, + //then stop the user from doing it again + if(GetScrollWndFromHwnd(hwnd) != 0) + { + return FALSE; + } + + //allocate a private scrollbar structure which we + //will use to keep track of the scrollbar data + sw = (SCROLLWND *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SCROLLWND)); + + si = &sw->sbarHorz.scrollInfo; + si->cbSize = sizeof(SCROLLINFO); + si->fMask = SIF_ALL; + GetScrollInfo(hwnd, SB_HORZ, si); + + si = &sw->sbarVert.scrollInfo; + si->cbSize = sizeof(SCROLLINFO); + si->fMask = SIF_ALL; + GetScrollInfo(hwnd, SB_VERT, si); + + //check to see if the window has left-aligned scrollbars + if(GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_LEFTSCROLLBAR) + sw->fLeftScrollbar = TRUE; + else + sw->fLeftScrollbar = FALSE; + + dwCurStyle = GetWindowLongPtr(hwnd, GWL_STYLE); + + SetProp(hwnd, szPropStr, (HANDLE)sw); + + //try to enable the scrollbar arrows - if the return value is + //non-zero, then the scrollbars were previously disabled + //fDisabled = pEnableScrollBar(hwnd, SB_HORZ, ESB_ENABLE_BOTH); + + //scrollbars will automatically get enabled, even if + //they aren't to start with....sorry, but there isn't an + //easy alternative. + if(dwCurStyle & WS_HSCROLL) + sw->sbarHorz.fScrollFlags = CSBS_VISIBLE; + + if(dwCurStyle & WS_VSCROLL) + sw->sbarVert.fScrollFlags = CSBS_VISIBLE; + + //need to be able to distinguish between horizontal and vertical + //scrollbars in some instances + sw->sbarHorz.nBarType = SB_HORZ; + sw->sbarVert.nBarType = SB_VERT; + + sw->sbarHorz.fFlatScrollbar = CSBS_NORMAL; + sw->sbarVert.fFlatScrollbar = CSBS_NORMAL; + + //set the default arrow sizes for the scrollbars + sw->sbarHorz.nArrowLength = SYSTEM_METRIC; + sw->sbarHorz.nArrowWidth = SYSTEM_METRIC; + sw->sbarVert.nArrowLength = SYSTEM_METRIC; + sw->sbarVert.nArrowWidth = SYSTEM_METRIC; + + sw->bPreventStyleChange = FALSE; + + sw->oldproc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)CoolSBWndProc); + + CoolSB_SetMinThumbSize(hwnd, SB_BOTH, CoolSB_GetDefaultMinThumbSize()); + +#ifdef COOLSB_TOOLTIPS + ice.dwSize = sizeof(ice); + ice.dwICC = ICC_BAR_CLASSES; + InitCommonControlsEx(&ice); + + sw->hwndToolTip = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TOOLWINDOW, TOOLTIPS_CLASS, _T(""), + WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, + CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, + hwnd, NULL, GetModuleHandle(0), + NULL); + + ti.cbSize = sizeof(TOOLINFO); + ti.uFlags = TTF_IDISHWND; + ti.hwnd = hwnd; + ti.uId = (UINT)hwnd; + ti.lpszText = LPSTR_TEXTCALLBACK; + ti.hinst = GetModuleHandle(0); + + SendMessage(sw->hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti); + +#else + + UNREFERENCED_PARAMETER(ice); + UNREFERENCED_PARAMETER(ti); + sw->hwndToolTip = 0; + +#endif + + //send the window a frame changed message to update the scrollbars + RedrawNonClient(hwnd, TRUE); + + return TRUE; +} + +BOOL WINAPI CoolSB_EnableScrollBar (HWND hwnd, int wSBflags, UINT wArrows) +{ + SCROLLBAR *sbar; + UINT oldstate; + BOOL bFailed = FALSE; + + if (!CoolSB_IsCoolScrollEnabled(hwnd)) + return EnableScrollBar(hwnd, wSBflags, wArrows); + + if ((wSBflags == SB_HORZ || wSBflags == SB_BOTH) && + (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) + { + oldstate = sbar->fScrollFlags; + + //clear any existing state, and OR in the disabled flags + sbar->fScrollFlags = (sbar->fScrollFlags & ~ESB_DISABLE_BOTH) | wArrows; + + if(oldstate == sbar->fScrollFlags) + bFailed = TRUE; + + } + + if ((wSBflags == SB_VERT || wSBflags == SB_BOTH) && + (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) + { + oldstate = sbar->fScrollFlags; + + //clear any existing state, and OR in the disabled flags + sbar->fScrollFlags = (sbar->fScrollFlags & ~ESB_DISABLE_BOTH) | wArrows; + + if(oldstate == sbar->fScrollFlags) + bFailed = TRUE; + } + + return !bFailed; +} + +BOOL WINAPI CoolSB_GetScrollBarInfo(HWND hwnd) +{ +// SCROLLBARINFO sbi; not defined in winuser.h + return FALSE; +} + +BOOL WINAPI CoolSB_GetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi) +{ + SCROLLINFO *mysi; + BOOL copied = FALSE; + + if (!lpsi) + return FALSE; + + if (!(mysi = GetScrollInfoFromHwnd(hwnd, fnBar))) + { + return GetScrollInfo(hwnd, fnBar, lpsi); + } + + if(lpsi->fMask & SIF_PAGE) + { + lpsi->nPage = mysi->nPage; + copied = TRUE; + } + + if(lpsi->fMask & SIF_POS) + { + lpsi->nPos = mysi->nPos; + copied = TRUE; + } + + if(lpsi->fMask & SIF_TRACKPOS) + { + lpsi->nTrackPos = mysi->nTrackPos; + copied = TRUE; + } + + if(lpsi->fMask & SIF_RANGE) + { + lpsi->nMin = mysi->nMin; + lpsi->nMax = mysi->nMax; + copied = TRUE; + } + + return copied; +} + +int WINAPI CoolSB_GetScrollPos (HWND hwnd, int nBar) +{ + SCROLLINFO *mysi; + + if (!(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) + return GetScrollPos(hwnd, nBar); + + return mysi->nPos; +} + +BOOL WINAPI CoolSB_GetScrollRange (HWND hwnd, int nBar, LPINT lpMinPos, LPINT lpMaxPos) +{ + SCROLLINFO *mysi; + + if (!lpMinPos || !lpMaxPos) + return FALSE; + + if (!(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) + return GetScrollRange(hwnd, nBar, lpMinPos, lpMaxPos); + + *lpMinPos = mysi->nMin; + *lpMaxPos = mysi->nMax; + + return TRUE; +} + +int WINAPI CoolSB_SetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL fRedraw) +{ + SCROLLINFO *mysi; + SCROLLBAR *sbar; + BOOL fRecalcFrame = FALSE; + + if (!lpsi) + return FALSE; + + if (!(mysi = GetScrollInfoFromHwnd(hwnd, fnBar))) + return SetScrollInfo(hwnd, fnBar, lpsi, fRedraw); + + //if(CoolSB_IsThumbTracking(hwnd)) + // return mysi->nPos; + + if(lpsi->fMask & SIF_RANGE) + { + mysi->nMin = lpsi->nMin; + mysi->nMax = lpsi->nMax; + } + + //The nPage member must specify a value from 0 to nMax - nMin +1. + if(lpsi->fMask & SIF_PAGE) + { + UINT t = (UINT)(mysi->nMax - mysi->nMin + 1); + mysi->nPage = min(max(0, lpsi->nPage), t); + } + + //The nPos member must specify a value between nMin and nMax - max(nPage - 1, 0). + if(lpsi->fMask & SIF_POS) + { + mysi->nPos = max(lpsi->nPos, mysi->nMin); + mysi->nPos = min((UINT)mysi->nPos, mysi->nMax - max(mysi->nPage - 1, 0)); + } + + sbar = GetScrollBarFromHwnd(hwnd, fnBar); + + if ((lpsi->fMask & SIF_DISABLENOSCROLL) || (sbar->fScrollFlags & CSBS_THUMBALWAYS)) + { + if (!sbar->fScrollVisible) + { + CoolSB_ShowScrollBar(hwnd, fnBar, TRUE); + fRecalcFrame = TRUE; + } + } + else + { + if ( mysi->nPage > (UINT)mysi->nMax + || mysi->nPage == (UINT)mysi->nMax && mysi->nMax == 0 + || mysi->nMax <= mysi->nMin) + { + if(sbar->fScrollVisible) + { + CoolSB_ShowScrollBar(hwnd, fnBar, FALSE); + fRecalcFrame = TRUE; + } + } + else + { + if (!sbar->fScrollVisible) + { + CoolSB_ShowScrollBar(hwnd, fnBar, TRUE); + fRecalcFrame = TRUE; + } + + } + + } + + if(fRedraw && !CoolSB_IsThumbTracking(hwnd)) + RedrawNonClient(hwnd, fRecalcFrame); + + return mysi->nPos; +} + + +int WINAPI CoolSB_SetScrollPos(HWND hwnd, int nBar, int nPos, BOOL fRedraw) +{ + SCROLLINFO *mysi; + int oldpos; + + if (!(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) + { + return SetScrollPos(hwnd, nBar, nPos, fRedraw); + } + + //this is what should happen, but real scrollbars don't work like this.. + //if(CoolSB_IsThumbTracking(hwnd)) + // return mysi->nPos; + + //validate and set the scollbar position + oldpos = mysi->nPos; + mysi->nPos = max(nPos, mysi->nMin); + mysi->nPos = min((UINT)mysi->nPos, mysi->nMax - max(mysi->nPage - 1, 0)); + + if(fRedraw && !CoolSB_IsThumbTracking(hwnd)) + RedrawNonClient(hwnd, FALSE); + + return oldpos; +} + +int WINAPI CoolSB_SetScrollRange (HWND hwnd, int nBar, int nMinPos, int nMaxPos, BOOL fRedraw) +{ + SCROLLINFO *mysi; + + if (!(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) + return SetScrollRange(hwnd, nBar, nMinPos, nMaxPos, fRedraw); + + if(CoolSB_IsThumbTracking(hwnd)) + return mysi->nPos; + + //hide the scrollbar if nMin == nMax + //nMax-nMin must not be greater than MAXLONG + mysi->nMin = nMinPos; + mysi->nMax = nMaxPos; + + if(fRedraw) + RedrawNonClient(hwnd, FALSE); + + return TRUE; +} + +// +// Show or hide the specified scrollbars +// +BOOL WINAPI CoolSB_ShowScrollBar (HWND hwnd, int wBar, BOOL fShow) +{ + SCROLLBAR *sbar; + BOOL bFailed = FALSE; + DWORD dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); + + if (!CoolSB_IsCoolScrollEnabled(hwnd)) + return ShowScrollBar(hwnd, wBar, fShow); + + if ((wBar == SB_HORZ || wBar == SB_BOTH) && + (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) + { + sbar->fScrollFlags = sbar->fScrollFlags & ~CSBS_VISIBLE; + sbar->fScrollFlags |= (fShow == TRUE ? CSBS_VISIBLE : 0); + //bFailed = TRUE; + + if(fShow) SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle | WS_HSCROLL); + else SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle & ~WS_HSCROLL); + } + + if ((wBar == SB_VERT || wBar == SB_BOTH) && + (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) + { + sbar->fScrollFlags = sbar->fScrollFlags & ~CSBS_VISIBLE; + sbar->fScrollFlags |= (fShow == TRUE ? CSBS_VISIBLE : 0); + //bFailed = TRUE; + + if(fShow) SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle | WS_VSCROLL); + else SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle & ~WS_VSCROLL); + } + + if(bFailed) + { + return FALSE; + } + else + { + //DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); + //style |= WS_VSCROLL; + + //if(s + //SetWindowLongPtr(hwnd, GWL_STYLE, style); + + SetWindowPos(hwnd, 0, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | + SWP_NOACTIVATE | SWP_FRAMECHANGED); + + return TRUE; + } +} + +// +// Remove cool scrollbars from the specified window. +// +HRESULT WINAPI UninitializeCoolSB(HWND hwnd) +{ + int i = 0; + SCROLLWND *sw = GetScrollWndFromHwnd(hwnd); + if (!sw) return E_FAIL; + + //restore the window procedure with the original one + SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)sw->oldproc); + + RemoveProp(hwnd, szPropStr); + //SetWindowLongPtr(hwnd, GWLP_USERDATA, 0); + + //finally, release the memory needed for the cool scrollbars + HeapFree(GetProcessHeap(), 0, sw); + + //Force WM_NCCALCSIZE and WM_NCPAINT so the original scrollbars can kick in + RedrawNonClient(hwnd, TRUE); + + return S_OK; +} + +#ifdef INCLUDE_BUTTONS + +// +// Cool scrollbar specific interface (BUTTON support) +// + +// +// Insert a button into the scrollbar area +// +// wSBflags - SB_HORZ / SB_VERT only +// uPos - position into which to insert. +// can be 0 to insert at the start, or -1 to insert +// at the end of previously inserted buttons +// + +BOOL WINAPI CoolSB_InsertButton(HWND hwnd, int wSBflags, UINT nPos, SCROLLBUT *psb) +{ + SCROLLBAR *sbar; + SCROLLBUT *sbut; + UINT i; + + if (!psb) return FALSE; + + if (!(sbar = GetScrollBarFromHwnd(hwnd, wSBflags))) + return FALSE; + + //check that we havn't reached the maximum allowed buttons yet + if(sbar->nButtons == MAX_COOLSB_BUTS) + return FALSE; + + //insert at end + if(nPos == -1) + { + sbut = &sbar->sbButtons[sbar->nButtons]; + } + //otherwise, need to make room + else if ((int)nPos < 0 || (int)nPos > (UINT)sbar->nButtons) + { + return FALSE; + } + else + { + //insert space for the button at the specified position + for (i = sbar->nButtons; i > nPos; i--) + { + sbar->sbButtons[i] = sbar->sbButtons[i-1]; + } + + sbut = &sbar->sbButtons[nPos]; + } + + //only set the button's properties if they are + //specified by the SCROLLBUT->fMask. + //Otherwise, use a default property value + + if(psb->fMask & SBBF_TYPE) + sbut->uButType = psb->uButType; + else + sbut->uButType = SBBT_PUSHBUTTON; + + if(psb->fMask & SBBF_STATE) + sbut->uState = psb->uState; + else + sbut->uState = 0; + + if(psb->fMask & SBBF_ID) + sbut->uCmdId = psb->uCmdId; + else + sbut->uCmdId = 0; + + if(psb->fMask & SBBF_SIZE) + sbut->nSize = psb->nSize; + else + sbut->nSize = -1; + + if(psb->fMask & SBBF_PLACEMENT) + sbut->uPlacement = psb->uPlacement; + else + sbut->uPlacement = SBBP_LEFT; + + if(psb->fMask & SBBF_BITMAP) + sbut->hBmp = psb->hBmp; + else + sbut->hBmp = 0; + + if(psb->fMask & SBBF_ENHMETAFILE) + sbut->hEmf = psb->hEmf; + else + sbut->hEmf = 0; + + if(psb->fMask & SBBF_CURSOR) + sbut->hCurs = psb->hCurs; + else + sbut->hCurs = 0; + + /* + We don't use the callback function anymore. The uButType + member must now specify SBBT_OWNERDRAW, and a WM_NOTIFY will + be sent when a button must be drawn + if ((psb->fMask & SBBF_OWNERDRAW) && ((psb->uButType & SBBT_MASK) == SBBT_OWNERDRAW)) + pDrawProc = psb->pDrawProc; + else + pDrawProc = 0;*/ + + sbar->nButtons++; + sbut->nSizeReserved = sbut->nSize; + + //MAKE SURE that any resizable buttons are only to the left / above + //a scrollbar. We don't support resize operations to the right of a scrollbar + if ((sbut->uButType & SBBM_RESIZABLE) && sbut->uPlacement == SBBP_RIGHT) + sbut->uButType &= ~SBBM_RESIZABLE; + + if(psb->fMask & SBBF_BUTMINMAX) + { + sbut->nMinSize = psb->nMinSize; + sbut->nMaxSize = psb->nMaxSize; + } + else + { + sbut->nMinSize = 0; + sbut->nMaxSize = -1; + } + + return TRUE; +} + +static SCROLLBUT *GetButtonFromId(SCROLLBAR *sbar, UINT uCmdId) +{ + int i; + for (i = 0; i < sbar->nButtons; i++) + { + if(sbar->sbButtons[i].uCmdId == uCmdId) + return &sbar->sbButtons[i]; + } + + return 0; +} + +// +// Modify the properties of the specified scrollbar button. +// wSBflags - SB_HORZ / SB_VERT only +// uItem - the command identifier specified when the button was created, +// or a non-negative position of the button, depending on if +// fByCmd is FALSE or TRUE, respectively +// +BOOL WINAPI CoolSB_ModifyButton (HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, SCROLLBUT *psb) +{ + SCROLLBAR *sbar; + SCROLLBUT *sbut; + + if (!psb) return FALSE; + + //find if this window is CoolScroll enabled + if (!(sbar = GetScrollBarFromHwnd(hwnd, wSBflags))) + return FALSE; + + //find the button to modify, depending on if we + //are modifying by position or command id + if(fByCmd == FALSE) + { + //button from position + if ((int)uItem < 0 || (int)uItem >= (UINT)sbar->nButtons) + return FALSE; + else + sbut = &sbar->sbButtons[uItem]; + } + else if(fByCmd == TRUE) + { + //button from command identifier + if (!(sbut = GetButtonFromId(sbar, uItem))) + return FALSE; + } + + if(psb->fMask & SBBF_TYPE) sbut->uButType = psb->uButType; + if(psb->fMask & SBBF_STATE) sbut->uState = psb->uState; + if(psb->fMask & SBBF_ID) sbut->uCmdId = psb->uCmdId; + if(psb->fMask & SBBF_SIZE) sbut->nSize = psb->nSize; + if(psb->fMask & SBBF_PLACEMENT) sbut->uPlacement = psb->uPlacement; + if(psb->fMask & SBBF_BITMAP) sbut->hBmp = psb->hBmp; + if(psb->fMask & SBBF_ENHMETAFILE) sbut->hEmf = psb->hEmf; + if(psb->fMask & SBBF_CURSOR) sbut->hCurs = psb->hCurs; + + if(psb->fMask & SBBF_BUTMINMAX) + { + sbut->nMinSize = psb->nMinSize; + sbut->nMaxSize = psb->nMaxSize; + } + + return TRUE; +} + +BOOL WINAPI CoolSB_RemoveButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd) +{ + int i; + SCROLLBAR *sbar; + + //find if this window is CoolScroll enabled + if (!(sbar = GetScrollBarFromHwnd(hwnd, wSBflags))) + return FALSE; + + //find the button to modify, depending on if we + //are modifying by position or command id + if(fByCmd == FALSE && ((int)uItem < 0 || (int)uItem >= (UINT)sbar->nButtons)) + { + return FALSE; + } + else if(fByCmd == TRUE) + { + //find the button with the specified command id + for (i = 0; i < sbar->nButtons; i++) + { + if(sbar->sbButtons[i].uCmdId == uItem) + { + //change the id to an index + uItem = i; + break; + } + } + + //if we failed to find the button... + if(i == sbar->nButtons) return FALSE; + } + + //remove the button! + for (i = uItem; i < sbar->nButtons - 1; i++) + { + sbar->sbButtons[i] = sbar->sbButtons[i+1]; + } + + sbar->nButtons--; + + RedrawNonClient(hwnd, TRUE); + + return TRUE; +} + +// +// fill in the supplied SCROLLBUT structure +// +BOOL WINAPI CoolSB_GetButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, SCROLLBUT *psb) +{ + SCROLLBAR *sbar; + SCROLLBUT *sbut; + + if (!psb) return FALSE; + + //find if this window is CoolScroll enabled + if (!(sbar = GetScrollBarFromHwnd(hwnd, wSBflags))) + return FALSE; + + //find the button to modify, depending on if we + //are modifying by position or command id + if(fByCmd == FALSE) + { + //button from position + if ((int)uItem < 0 || (int)uItem >= (UINT)sbar->nButtons) + return FALSE; + else + sbut = &sbar->sbButtons[uItem]; + } + else if(fByCmd == TRUE) + { + //button from command identifier + if (!(sbut = GetButtonFromId(sbar, uItem))) + return FALSE; + } + + //copy them across + *psb = *sbut; + + return FALSE; +} + +#else + +BOOL WINAPI CoolSB_InsertButton(HWND hwnd, int wSBflags, UINT nPos, SCROLLBUT *psb) { return FALSE; } +BOOL WINAPI CoolSB_ModifyButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, SCROLLBUT *psb) { return FALSE; } +BOOL WINAPI CoolSB_RemoveButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd) { return FALSE; } +BOOL WINAPI CoolSB_GetButton (HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, SCROLLBUT *psb) { return FALSE; } + +#endif //INCLUDE_BUTTONS + +// +// Set the size of the scrollbars +// +BOOL WINAPI CoolSB_SetSize (HWND hwnd, int wBar, int nLength, int nWidth) +{ + SCROLLBAR *sbar; + + if(nLength == 0 || nWidth == 0) + return FALSE; + + if(nLength < -8 || nWidth < -8) + return FALSE; + + if(nLength > 256 || nWidth > 256) + return FALSE; + + if (!GetScrollWndFromHwnd(hwnd)) + return FALSE; + + if ((wBar == SB_HORZ || wBar == SB_BOTH) && + (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) + { + sbar->nArrowLength = nLength; + sbar->nArrowWidth = nWidth; + } + + if ((wBar == SB_VERT || wBar == SB_BOTH) && + (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) + { + sbar->nArrowLength = nLength; + sbar->nArrowWidth = nWidth; + } + + RedrawNonClient(hwnd, TRUE); + + return TRUE; +} + + +// +// Alter the display mode of the scrollbars +// wBar - SB_HORZ / SB_VERT / SB_BOTH +// nStyle - CSBF_NORMAL / CSBF_FLAT / CSBF_HOTTRACKED +// +BOOL WINAPI CoolSB_SetStyle(HWND hwnd, int wBar, UINT nStyle) +{ + SCROLLBAR *sbar; + + if (!GetScrollWndFromHwnd(hwnd)) + return FALSE; + + if ((wBar == SB_HORZ || wBar == SB_BOTH) && + (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) + { + sbar->fFlatScrollbar = nStyle; + } + + if ((wBar == SB_VERT || wBar == SB_BOTH) && + (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) + { + sbar->fFlatScrollbar = nStyle; + } + + RedrawNonClient(hwnd, FALSE); + + return TRUE; +} + +// +// Set if the thumb is always visible, even if there is no data to +// scroll. Setting this keeps the scrollbar enabled, but the thumb +// covers the whole area +// +BOOL WINAPI CoolSB_SetThumbAlways(HWND hwnd, int wBar, BOOL fThumbAlways) +{ + SCROLLBAR *sbar; + + if (!GetScrollWndFromHwnd(hwnd)) + return FALSE; + + if ((wBar == SB_HORZ || wBar == SB_BOTH) && + (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) + { + if(fThumbAlways) + sbar->fScrollFlags |= CSBS_THUMBALWAYS; + else + sbar->fScrollFlags &= ~CSBS_THUMBALWAYS; + } + + if ((wBar == SB_VERT || wBar == SB_BOTH) && + (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) + { + if(fThumbAlways) + sbar->fScrollFlags |= CSBS_THUMBALWAYS; + else + sbar->fScrollFlags &= ~CSBS_THUMBALWAYS; + } + + RedrawNonClient(hwnd, FALSE); + + return TRUE; +} + +// +// Set the minimum size, in pixels, that the thumb box will shrink to. +// +BOOL WINAPI CoolSB_SetMinThumbSize(HWND hwnd, UINT wBar, UINT size) +{ + SCROLLBAR *sbar; + + if (!GetScrollWndFromHwnd(hwnd)) + return FALSE; + + if(size == -1) + size = CoolSB_GetDefaultMinThumbSize(); + + if ((wBar == SB_HORZ || wBar == SB_BOTH) && + (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) + { + sbar->nMinThumbSize = size; + } + + if ((wBar == SB_VERT || wBar == SB_BOTH) && + (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) + { + sbar->nMinThumbSize = size; + } + + return TRUE; +} diff --git a/plugins/Clist_nicer/SRC/Coolsb/coolsblib.h b/plugins/Clist_nicer/SRC/Coolsb/coolsblib.h new file mode 100644 index 0000000000..d9b1c711f3 --- /dev/null +++ b/plugins/Clist_nicer/SRC/Coolsb/coolsblib.h @@ -0,0 +1,41 @@ +#ifndef _SUPERSCROLL_INCLUDED +#define _SUPERSCROLL_INCLUDED + +#ifdef __cplusplus +extern "C"{ +#endif + +#include + + +#ifdef __cplusplus +} +#endif + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/Clist_nicer/SRC/Coolsb/coolscroll.cpp b/plugins/Clist_nicer/SRC/Coolsb/coolscroll.cpp new file mode 100644 index 0000000000..ac31f86c24 --- /dev/null +++ b/plugins/Clist_nicer/SRC/Coolsb/coolscroll.cpp @@ -0,0 +1,3206 @@ +/* + Cool Scrollbar Library Version 1.2 + + Module: coolscroll.c + Copyright (c) J Brown 2001 + + This code is freeware, however, you may not publish + this code elsewhere or charge any money for it. This code + is supplied as-is. I make no guarantees about the suitability + of this code - use at your own risk. + + It would be nice if you credited me, in the event + that you use this code in a product. + + VERSION HISTORY: + + V1.2: TreeView problem fixed by Diego Tartara + Small problem in thumbsize calculation also fixed (thanks Diego!) + + V1.1: Added support for Right-left windows + Changed calling convention of APIs to WINAPI (__stdcall) + Completely standalone (no need for c-runtime) + Now supports ALL windows with appropriate USER32.DLL patching + (you provide!!) + + V1.0: Apr 2001: Initial Version + + IMPORTANT: + This whole library is based around code for a horizontal scrollbar. + All "vertical" scrollbar drawing / mouse interaction uses the + horizontal scrollbar functions, but uses a trick to convert the vertical + scrollbar coordinates into horizontal equivelants. When I started this project, + I quickly realised that the code for horz/vert bars was IDENTICAL, apart + from the fact that horizontal code uses left/right coords, and vertical code + uses top/bottom coords. On entry to a "vertical" drawing function, for example, + the coordinates are "rotated" before the horizontal function is called, and + then rotated back once the function has completed. When something needs to + be drawn, the coords are converted back again before drawing. + + This trick greatly reduces the amount of code required, and makes + maintanence much simpler. This way, only one function is needed to draw + a scrollbar, but this can be used for both horizontal and vertical bars + with careful thought. +*/ + +#define _WIN32_WINNT 0x0501 +#define _WIN32_IE 0x0501 + +#include +#include "coolscroll.h" +#include "userdefs.h" +#include "coolsb_internal.h" + +//define some values if the new version of common controls +//is not available. +#ifndef NM_CUSTOMDRAW +#define NM_CUSTOMDRAW (NM_FIRST-12) +#define CDRF_DODEFAULT 0x0000 +#define CDRF_SKIPDEFAULT 0x0004 +#define CDDS_PREPAINT 0x0001 +#define CDDS_POSTPAINT 0x0002 +#endif + +// +// Special thumb-tracking variables +// +// +static UINT uCurrentScrollbar = COOLSB_NONE; //SB_HORZ / SB_VERT +static UINT uCurrentScrollPortion = HTSCROLL_NONE; +static UINT uCurrentButton = 0; + +static RECT rcThumbBounds; //area that the scroll thumb can travel in +static int nThumbSize; //(pixels) +static int nThumbPos; //(pixels) +static int nThumbMouseOffset; //(pixels) +static int nLastPos = -1; //(scrollbar units) +static int nThumbPos0; //(pixels) initial thumb position + +// +// Temporary state used to auto-generate timer messages +// +static UINT_PTR uMouseOverId = 0; +static UINT uMouseOverScrollbar = COOLSB_NONE; +static UINT uHitTestPortion = HTSCROLL_NONE; +static UINT uLastHitTestPortion = HTSCROLL_NONE; +static RECT MouseOverRect; + +static UINT uScrollTimerMsg = 0; +static UINT uScrollTimerPortion = HTSCROLL_NONE; +static UINT_PTR uScrollTimerId = 0; +static HWND hwndCurCoolSB = 0; + +extern int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd); + +// +// Provide this so there are NO dependencies on CRT +// +static void CoolSB_ZeroMemory(void *ptr, DWORD bytes) +{ + BYTE *bptr = (BYTE *)ptr; + + while(bytes--) *bptr++ = 0; +} + +BOOL WINAPI CoolSB_IsThumbTracking(HWND hwnd) +{ + SCROLLWND *sw; + + if ((sw = GetScrollWndFromHwnd(hwnd)) == NULL) + return FALSE; + else + return sw->fThumbTracking; +} + +// +// swap the rectangle's x coords with its y coords +// +static void __stdcall RotateRect(RECT *rect) +{ + int temp; + temp = rect->left; + rect->left = rect->top; + rect->top = temp; + + temp = rect->right; + rect->right = rect->bottom; + rect->bottom = temp; +} + +// +// swap the coords if the scrollbar is a SB_VERT +// +static void __stdcall RotateRect0(SCROLLBAR *sb, RECT *rect) +{ + if(sb->nBarType == SB_VERT) + RotateRect(rect); +} + +// +// Calculate if the SCROLLINFO members produce +// an enabled or disabled scrollbar +// +static BOOL IsScrollInfoActive(SCROLLINFO *si) +{ + if ((si->nPage > (UINT)si->nMax + || si->nMax <= si->nMin || si->nMax == 0)) + return FALSE; + else + return TRUE; +} + +// +// Return if the specified scrollbar is enabled or not +// +static BOOL IsScrollbarActive(SCROLLBAR *sb) +{ + SCROLLINFO *si = &sb->scrollInfo; + if (((sb->fScrollFlags & ESB_DISABLE_BOTH) == ESB_DISABLE_BOTH) || + !(sb->fScrollFlags & CSBS_THUMBALWAYS) && !IsScrollInfoActive(si)) + return FALSE; + else + return TRUE; +} + +// +// Draw a standard scrollbar arrow +// +static int DrawScrollArrow(SCROLLBAR *sbar, HDC hdc, RECT *rect, UINT arrow, BOOL fMouseDown, BOOL fMouseOver) +{ + UINT ret; + UINT flags = arrow; + + //HACKY bit so this routine can be called by vertical and horizontal code + if(sbar->nBarType == SB_VERT) + { + if(flags & DFCS_SCROLLLEFT) flags = flags & ~DFCS_SCROLLLEFT | DFCS_SCROLLUP; + if(flags & DFCS_SCROLLRIGHT) flags = flags & ~DFCS_SCROLLRIGHT | DFCS_SCROLLDOWN; + } + + if(fMouseDown) flags |= (DFCS_FLAT | DFCS_PUSHED); + +#ifdef FLAT_SCROLLBARS + if(sbar->fFlatScrollbar != CSBS_NORMAL) + { + HDC hdcmem1, hdcmem2; + HBITMAP hbm1, oldbm1; + HBITMAP hbm2, oldbm2; + RECT rc; + int width, height; + + rc = *rect; + width = rc.right-rc.left; + height = rc.bottom-rc.top; + SetRect(&rc, 0, 0, width, height); + + //MONOCHROME bitmap to convert the arrow to black/white mask + hdcmem1 = CreateCompatibleDC(hdc); + hbm1 = CreateBitmap(width, height, 1, 1, NULL); + UnrealizeObject(hbm1); + oldbm1 = reinterpret_cast(SelectObject(hdcmem1, hbm1)); + + + //NORMAL bitmap to draw the arrow into + hdcmem2 = CreateCompatibleDC(hdc); + hbm2 = CreateCompatibleBitmap(hdc, width, height); + UnrealizeObject(hbm2); + oldbm2 = reinterpret_cast(SelectObject(hdcmem2, hbm2)); + + + flags = flags & ~DFCS_PUSHED | DFCS_FLAT; //just in case + DrawFrameControl(hdcmem2, &rc, DFC_SCROLL, flags); + + +#ifndef HOT_TRACKING + if(fMouseDown) + { + //uncomment these to make the cool scrollbars + //look like the common controls flat scrollbars + //fMouseDown = FALSE; + //fMouseOver = TRUE; + } +#endif + //draw a flat monochrome version of a scrollbar arrow (dark) + if(fMouseDown) + { + SetBkColor(hdcmem2, GetSysColor(COLOR_BTNTEXT)); + BitBlt(hdcmem1, 0, 0, width, height, hdcmem2, 0, 0, SRCCOPY); + SetBkColor(hdc, 0x00ffffff); + SetTextColor(hdc, GetSysColor(COLOR_3DDKSHADOW)); + BitBlt(hdc, rect->left, rect->top, width, height, hdcmem1, 0, 0, SRCCOPY); + } + //draw a flat monochrome version of a scrollbar arrow (grey) + else if(fMouseOver) + { + SetBkColor(hdcmem2, GetSysColor(COLOR_BTNTEXT)); + FillRect(hdcmem1, &rc, reinterpret_cast(GetStockObject(WHITE_BRUSH))); + BitBlt(hdcmem1, 0, 0, width, height, hdcmem2, 0, 0, SRCINVERT); + + SetBkColor(hdc, GetSysColor(COLOR_3DSHADOW)); + SetTextColor(hdc, 0x00ffffff); + BitBlt(hdc, rect->left, rect->top, width, height, hdcmem1, 0, 0, SRCCOPY); + } + //draw the arrow normally + else + { + BitBlt(hdc, rect->left, rect->top, width, height, hdcmem2, 0, 0, SRCCOPY); + } + + SelectObject(hdcmem1, oldbm1); + SelectObject(hdcmem2, oldbm2); + DeleteObject(hbm1); + DeleteObject(hbm2); + DeleteDC(hdcmem1); + DeleteDC(hdcmem2); + + ret = 0; + } + else +#endif + ret = DrawFrameControl(hdc, rect, DFC_SCROLL, flags); + + return ret; +} + +// +// Return the size in pixels for the specified scrollbar metric, +// for the specified scrollbar +// +static int GetScrollMetric(SCROLLBAR *sbar, int metric) +{ + if(sbar->nBarType == SB_HORZ) + { + if(metric == SM_CXHORZSB) + { + if(sbar->nArrowLength < 0) + return -sbar->nArrowLength * GetSystemMetrics(SM_CXHSCROLL); + else + return sbar->nArrowLength; + } + else + { + if(sbar->nArrowWidth < 0) + return -sbar->nArrowWidth * GetSystemMetrics(SM_CYHSCROLL); + else + return sbar->nArrowWidth; + } + } + else if(sbar->nBarType == SB_VERT) + { + if(metric == SM_CYVERTSB) + { + if(sbar->nArrowLength < 0) + return -sbar->nArrowLength * GetSystemMetrics(SM_CYVSCROLL); + else + return sbar->nArrowLength; + } + else + { + if(sbar->nArrowWidth < 0) + return -sbar->nArrowWidth * GetSystemMetrics(SM_CXVSCROLL); + else + return sbar->nArrowWidth; + } + } + + return 0; +} + +// +// +// +static COLORREF GetSBForeColor(void) +{ + COLORREF c1 = GetSysColor(COLOR_3DHILIGHT); + COLORREF c2 = GetSysColor(COLOR_WINDOW); + + if(c1 != 0xffffff && c1 == c2) + { + return GetSysColor(COLOR_BTNFACE); + } + else + { + return GetSysColor(COLOR_3DHILIGHT); + } +} + +static COLORREF GetSBBackColor(void) +{ + return GetSysColor(COLOR_SCROLLBAR); +} + +// +// Paint a checkered rectangle, with each alternate +// pixel being assigned a different colour +// +static void DrawCheckedRect(HDC hdc, RECT *rect, COLORREF fg, COLORREF bg) +{ + static WORD wCheckPat[8] = + { + 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555 + }; + + HBITMAP hbmp; + HBRUSH hbr, hbrold; + COLORREF fgold, bgold; + + hbmp = CreateBitmap(8, 8, 1, 1, wCheckPat); + hbr = CreatePatternBrush(hbmp); + + UnrealizeObject(hbr); + SetBrushOrgEx(hdc, rect->left, rect->top, 0); + + hbrold = (HBRUSH)SelectObject(hdc, hbr); + + fgold = SetTextColor(hdc, fg); + bgold = SetBkColor(hdc, bg); + + PatBlt(hdc, rect->left, rect->top, + rect->right - rect->left, + rect->bottom - rect->top, + PATCOPY); + + SetBkColor(hdc, bgold); + SetTextColor(hdc, fgold); + + SelectObject(hdc, hbrold); + DeleteObject(hbr); + DeleteObject(hbmp); +} + +// +// Fill the specifed rectangle using a solid colour +// +static void PaintRect(HDC hdc, RECT *rect, COLORREF color) +{ + COLORREF oldcol = SetBkColor(hdc, color); + ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, rect, "", 0, NULL); + SetBkColor(hdc, oldcol); +} + +// +// Draw a simple blank scrollbar push-button. Can be used +// to draw a push button, or the scrollbar thumb +// drawflag - could set to BF_FLAT to make flat scrollbars +// +void DrawBlankButton(HDC hdc, const RECT *rect, UINT drawflag) +{ + RECT rc = *rect; + +#ifndef FLAT_SCROLLBARS + drawflag &= ~BF_FLAT; +#endif + + DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | drawflag | BF_ADJUST); + FillRect(hdc, &rc, GetSysColorBrush(COLOR_BTNFACE)); +} + +// +// Send a WM_VSCROLL or WM_HSCROLL message +// +static void SendScrollMessage(HWND hwnd, UINT scrMsg, UINT scrId, UINT pos) +{ + SendMessage(hwnd, scrMsg, MAKEWPARAM(scrId, pos), 0); +} + +// +// Calculate the screen coordinates of the area taken by +// the horizontal scrollbar. Take into account the size +// of the window borders +// +static BOOL GetHScrollRect(SCROLLWND *sw, HWND hwnd, RECT *rect) +{ + GetWindowRect(hwnd, rect); + + if(sw->fLeftScrollbar) + { + rect->left += sw->cxLeftEdge + (sw->sbarVert.fScrollVisible ? + GetScrollMetric(&sw->sbarVert, SM_CXVERTSB) : 0); + rect->right -= sw->cxRightEdge; + } + else + { + rect->left += sw->cxLeftEdge; //left window edge + + rect->right -= sw->cxRightEdge + //right window edge + (sw->sbarVert.fScrollVisible ? + GetScrollMetric(&sw->sbarVert, SM_CXVERTSB) : 0); + } + + rect->bottom -= sw->cyBottomEdge; //bottom window edge + + rect->top = rect->bottom - + (sw->sbarHorz.fScrollVisible ? + GetScrollMetric(&sw->sbarHorz, SM_CYHORZSB) : 0); + + return TRUE; +} + +// +// Calculate the screen coordinates of the area taken by the +// vertical scrollbar +// +static BOOL GetVScrollRect(SCROLLWND *sw, HWND hwnd, RECT *rect) +{ + GetWindowRect(hwnd, rect); + rect->top += sw->cyTopEdge; //top window edge + + rect->bottom -= sw->cyBottomEdge + + (sw->sbarHorz.fScrollVisible ? //bottom window edge + GetScrollMetric(&sw->sbarHorz, SM_CYHORZSB) : 0); + + if(sw->fLeftScrollbar) + { + rect->left += sw->cxLeftEdge; + rect->right = rect->left + (sw->sbarVert.fScrollVisible ? + GetScrollMetric(&sw->sbarVert, SM_CXVERTSB) : 0); + } + else + { + rect->right -= sw->cxRightEdge; + rect->left = rect->right - (sw->sbarVert.fScrollVisible ? + GetScrollMetric(&sw->sbarVert, SM_CXVERTSB) : 0); + } + + return TRUE; +} + +// Depending on what type of scrollbar nBar refers to, call the +// appropriate Get?ScrollRect function +// +BOOL GetScrollRect(SCROLLWND *sw, UINT nBar, HWND hwnd, RECT *rect) +{ + if(nBar == SB_HORZ) + return GetHScrollRect(sw, hwnd, rect); + else if(nBar == SB_VERT) + return GetVScrollRect(sw, hwnd, rect); + else + return FALSE; +} + +// +// This code is a prime candidate for splitting out into a separate +// file at some stage +// +#ifdef INCLUDE_BUTTONS + +// +// Calculate the size in pixels of the specified button +// +static int GetSingleButSize(SCROLLBAR *sbar, SCROLLBUT *sbut) +{ + //multiple of the system button size + //or a specific button size + if(sbut->nSize < 0) + { + if(sbar->nBarType == SB_HORZ) + return -sbut->nSize * GetSystemMetrics(SM_CXHSCROLL); + else + return -sbut->nSize * GetSystemMetrics(SM_CYVSCROLL); + } + else + return sbut->nSize; +} + +// +// Find the size in pixels of all the inserted buttons, +// either before or after the specified scrollbar +// +static int GetButtonSize(SCROLLBAR *sbar, HWND hwnd, UINT uBeforeAfter) +{ + int i; + int nPixels = 0; + + SCROLLBUT *sbut = sbar->sbButtons; + + for (i = 0; i < sbar->nButtons; i++) + { + //only consider those buttons on the same side as nTopBottom says + if(sbut[i].uPlacement == uBeforeAfter) + { + nPixels += GetSingleButSize(sbar, &sbut[i]); + } + } + + return nPixels; +} +#endif //INCLUDE_BUTTONS + +// +// Work out the scrollbar width/height for either type of scrollbar (SB_HORZ/SB_VERT) +// rect - coords of the scrollbar. +// store results into *thumbsize and *thumbpos +// +static int CalcThumbSize(SCROLLBAR *sbar, const RECT *rect, int *pthumbsize, int *pthumbpos) +{ + SCROLLINFO *si; + int scrollsize; //total size of the scrollbar including arrow buttons + int workingsize; //working area (where the thumb can slide) + int siMaxMin; + int butsize; + int startcoord; + int thumbpos = 0, thumbsize = 0; + + int adjust=0; + static int count=0; + + //work out the width (for a horizontal) or the height (for a vertical) + //of a standard scrollbar button + butsize = GetScrollMetric(sbar, SM_SCROLL_LENGTH); + + if(1) //sbar->nBarType == SB_HORZ) + { + scrollsize = rect->right - rect->left; + startcoord = rect->left; + } + /*else if(sbar->nBarType == SB_VERT) + { + scrollsize = rect->bottom - rect->top; + startcoord = rect->top; + } + else + { + return 0; + }*/ + + si = &sbar->scrollInfo; + siMaxMin = si->nMax - si->nMin + 1; + workingsize = scrollsize - butsize * 2; + + // + // Work out the scrollbar thumb SIZE + // + if(si->nPage == 0) + { + thumbsize = butsize; + } + else if(siMaxMin > 0) + { + thumbsize = MulDiv(si->nPage, workingsize, siMaxMin); + + if(thumbsize < sbar->nMinThumbSize) + thumbsize = sbar->nMinThumbSize; + } + + // + // Work out the scrollbar thumb position + // + if(siMaxMin > 0) + { + int pagesize = max(1, si->nPage); + thumbpos = MulDiv(si->nPos - si->nMin, workingsize-thumbsize, siMaxMin - pagesize); + + if(thumbpos < 0) + thumbpos = 0; + + if(thumbpos >= workingsize-thumbsize) + thumbpos = workingsize-thumbsize; + } + + thumbpos += startcoord + butsize; + + *pthumbpos = thumbpos; + *pthumbsize = thumbsize; + + return 1; +} + +// +// return a hit-test value for whatever part of the scrollbar x,y is located in +// rect, x, y: SCREEN coordinates +// the rectangle must not include space for any inserted buttons +// (i.e, JUST the scrollbar area) +// +static UINT GetHorzScrollPortion(SCROLLBAR *sbar, HWND hwnd, const RECT *rect, int x, int y) +{ + int thumbwidth, thumbpos; + int butwidth = GetScrollMetric(sbar, SM_SCROLL_LENGTH); + int scrollwidth = rect->right-rect->left; + int workingwidth = scrollwidth - butwidth*2; + + if(y < rect->top || y >= rect->bottom) + return HTSCROLL_NONE; + + CalcThumbSize(sbar, rect, &thumbwidth, &thumbpos); + + //if we have had to scale the buttons to fit in the rect, + //then adjust the button width accordingly + if(scrollwidth <= butwidth * 2) + { + butwidth = scrollwidth / 2; + } + + //check for left button click + if(x >= rect->left && x < rect->left + butwidth) + { + return HTSCROLL_LEFT; + } + //check for right button click + else if(x >= rect->right-butwidth && x < rect->right) + { + return HTSCROLL_RIGHT; + } + + //if the thumb is too big to fit (i.e. it isn't visible) + //then return a NULL scrollbar area + if(thumbwidth >= workingwidth) + return HTSCROLL_NONE; + + //check for point in the thumbbar + if(x >= thumbpos && x < thumbpos+thumbwidth) + { + return HTSCROLL_THUMB; + } + //check for left margin + else if(x >= rect->left+butwidth && x < thumbpos) + { + return HTSCROLL_PAGELEFT; + } + else if(x >= thumbpos+thumbwidth && x < rect->right-butwidth) + { + return HTSCROLL_PAGERIGHT; + } + + return HTSCROLL_NONE; +} + +// +// For vertical scrollbars, rotate all coordinates by -90 degrees +// so that we can use the horizontal version of this function +// +static UINT GetVertScrollPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) +{ + UINT r; + + RotateRect(rect); + r = GetHorzScrollPortion(sb, hwnd, rect, y, x); + RotateRect(rect); + return r; +} + +// +// CUSTOM DRAW support +// +static LRESULT PostCustomPrePostPaint(HWND hwnd, HDC hdc, SCROLLBAR *sb, UINT dwStage) +{ +#ifdef CUSTOM_DRAW + NMCSBCUSTOMDRAW nmcd; + + CoolSB_ZeroMemory(&nmcd, sizeof nmcd); + nmcd.hdr.hwndFrom = hwnd; + nmcd.hdr.idFrom = GetWindowLongPtr(hwnd, GWLP_ID); + nmcd.hdr.code = NM_COOLSB_CUSTOMDRAW; + nmcd.nBar = sb->nBarType; + nmcd.dwDrawStage = dwStage; + nmcd.hdc = hdc; + + hwnd = GetParent(hwnd); + return CustomDrawScrollBars(&nmcd); +#else + return 0; +#endif +} + +static LRESULT PostCustomDrawNotify(HWND hwnd, HDC hdc, UINT nBar, RECT *prect, UINT nItem, BOOL fMouseDown, BOOL fMouseOver, BOOL fInactive) +{ +#ifdef CUSTOM_DRAW + NMCSBCUSTOMDRAW nmcd; + + //fill in the standard header + nmcd.hdr.hwndFrom = hwnd; + nmcd.hdr.idFrom = GetWindowLongPtr(hwnd, GWLP_ID); + nmcd.hdr.code = NM_COOLSB_CUSTOMDRAW; + + nmcd.dwDrawStage = CDDS_ITEMPREPAINT; + nmcd.nBar = nBar; + nmcd.rect = *prect; + nmcd.uItem = nItem; + nmcd.hdc = hdc; + + if(fMouseDown) + nmcd.uState = CDIS_SELECTED; + else if(fMouseOver) + nmcd.uState = CDIS_HOT; + else if(fInactive) + nmcd.uState = CDIS_DISABLED; + else + nmcd.uState = CDIS_DEFAULT; + + hwnd = GetParent(hwnd); + return CustomDrawScrollBars(&nmcd); +#else + return 0; +#endif +} + +// Depending on if we are supporting custom draw, either define +// a macro to the function name, or to nothing at all. If custom draw +// is turned off, then we can save ALOT of code space by binning all +// calls to the custom draw support. + +/* +#ifdef CUSTOM_DRAW +#define PostCustomDrawNotify PostCustomDrawNotify0 +#define PostCustomPrePostPaint PostCustomPrePostPaint0 +#else +#define PostCustomDrawNotify 1 ? (void)0 : PostCustomDrawNotify0 +#define PostCustomPrePostPaint 1 ? (void)0 : PostCustomPrePostPaint0 +#endif +*/ + +static LRESULT PostMouseNotify0(HWND hwnd, UINT msg, UINT nBar, RECT *prect, UINT nCmdId, POINT pt) +{ +#ifdef NOTIFY_MOUSE + NMCOOLBUTMSG nmcb; + + //fill in the standard header + nmcb.hdr.hwndFrom = hwnd; + nmcb.hdr.idFrom = GetWindowLongPtr(hwnd, GWLP_ID); + nmcb.hdr.code = NM_CLICK; + + nmcb.nBar = nBar; + nmcb.uCmdId = nCmdId; + nmcb.uState = 0; + nmcb.rect = *prect; + nmcb.pt = pt; + + hwnd = GetParent(hwnd); + return SendMessage(hwnd, WM_NOTIFY, nmcb.hdr.idFrom, (LPARAM)&nmcb); +#else + return 0; +#endif +} + +#ifdef NOTIFY_MOUSE +#define PostMouseNotify PostMouseNotify0 +#else +#define PostMouseNotify 1 ? (void)0 : PostMouseNotify0 +#endif + + + +// +// Draw a complete HORIZONTAL scrollbar in the given rectangle +// Don't draw any inserted buttons in this procedure +// +// uDrawFlags - hittest code, to say if to draw the +// specified portion in an active state or not. +// +// +static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *rect, UINT uDrawFlags) +{ + SCROLLINFO *si; + RECT ctrl, thumb; + RECT sbm; + int butwidth = GetScrollMetric(sb, SM_SCROLL_LENGTH); + int scrollwidth = rect->right-rect->left; + int workingwidth = scrollwidth - butwidth*2; + int thumbwidth = 0, thumbpos = 0; + int siMaxMin; + + BOOL fCustomDraw = 0; + + BOOL fMouseDownL = 0, fMouseOverL = 0, fBarHot = 0; + BOOL fMouseDownR = 0, fMouseOverR = 0; + + COLORREF crCheck1 = GetSBForeColor(); + COLORREF crCheck2 = GetSBBackColor(); + COLORREF crInverse1 = InvertCOLORREF(crCheck1); + COLORREF crInverse2 = InvertCOLORREF(crCheck2); + + UINT uDFCFlat = sb->fFlatScrollbar ? DFCS_FLAT : 0; + UINT uDEFlat = sb->fFlatScrollbar ? BF_FLAT : 0; + + //drawing flags to modify the appearance of the scrollbar buttons + UINT uLeftButFlags = DFCS_SCROLLLEFT; + UINT uRightButFlags = DFCS_SCROLLRIGHT; + + if(scrollwidth <= 0) + return 0; + + si = &sb->scrollInfo; + siMaxMin = si->nMax - si->nMin; + + if(hwnd != hwndCurCoolSB) + uDrawFlags = HTSCROLL_NONE; + // + // work out the thumb size and position + // + CalcThumbSize(sb, rect, &thumbwidth, &thumbpos); + + if(sb->fScrollFlags & ESB_DISABLE_LEFT) uLeftButFlags |= DFCS_INACTIVE; + if(sb->fScrollFlags & ESB_DISABLE_RIGHT) uRightButFlags |= DFCS_INACTIVE; + + //if we need to grey the arrows because there is no data to scroll + if (!IsScrollInfoActive(si) && !(sb->fScrollFlags & CSBS_THUMBALWAYS)) + { + uLeftButFlags |= DFCS_INACTIVE; + uRightButFlags |= DFCS_INACTIVE; + } + + if(hwnd == hwndCurCoolSB) + { +#ifdef FLAT_SCROLLBARS + BOOL ldis = !(uLeftButFlags & DFCS_INACTIVE); + BOOL rdis = !(uRightButFlags & DFCS_INACTIVE); + + fBarHot = (sb->nBarType == (int)uMouseOverScrollbar && sb->fFlatScrollbar == CSBS_HOTTRACKED); + + fMouseOverL = uHitTestPortion == HTSCROLL_LEFT && fBarHot && ldis; + fMouseOverR = uHitTestPortion == HTSCROLL_RIGHT && fBarHot && rdis; +#endif + fMouseDownL = (uDrawFlags == HTSCROLL_LEFT); + fMouseDownR = (uDrawFlags == HTSCROLL_RIGHT); + } + + +//#ifdef CUSTOM_DRAW + fCustomDraw = ((PostCustomPrePostPaint(hwnd, hdc, sb, CDDS_PREPAINT)) == CDRF_SKIPDEFAULT); +//#endif + + // + // Draw the scrollbar now + // + if(scrollwidth > butwidth*2) + { + //LEFT ARROW + SetRect(&ctrl, rect->left, rect->top, rect->left + butwidth, rect->bottom); + + RotateRect0(sb, &ctrl); + + if(fCustomDraw) + PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_LINELEFT, fMouseDownL, fMouseOverL, uLeftButFlags & DFCS_INACTIVE); + else + DrawScrollArrow(sb, hdc, &ctrl, uLeftButFlags, fMouseDownL, fMouseOverL); + + RotateRect0(sb, &ctrl); + + //MIDDLE PORTION + //if we can fit the thumbbar in, then draw it + if(thumbwidth > 0 && thumbwidth <= workingwidth + && IsScrollInfoActive(si) && ((sb->fScrollFlags & ESB_DISABLE_BOTH) != ESB_DISABLE_BOTH)) + { + //Draw the scrollbar margin above the thumb + SetRect(&sbm, rect->left + butwidth, rect->top, thumbpos, rect->bottom); + + RotateRect0(sb, &sbm); + + if(fCustomDraw) + { + PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &sbm, SB_PAGELEFT, uDrawFlags == HTSCROLL_PAGELEFT, FALSE, FALSE); + } + else + { + if(uDrawFlags == HTSCROLL_PAGELEFT) + DrawCheckedRect(hdc, &sbm, crInverse1, crInverse2); + else + DrawCheckedRect(hdc, &sbm, crCheck1, crCheck2); + + } + + RotateRect0(sb, &sbm); + + //Draw the margin below the thumb + sbm.left = thumbpos+thumbwidth; + sbm.right = rect->right - butwidth; + + RotateRect0(sb, &sbm); + if(fCustomDraw) + { + PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &sbm, SB_PAGERIGHT, uDrawFlags == HTSCROLL_PAGERIGHT, 0, 0); + } + else + { + if(uDrawFlags == HTSCROLL_PAGERIGHT) + DrawCheckedRect(hdc, &sbm, crInverse1, crInverse2); + else + DrawCheckedRect(hdc, &sbm, crCheck1, crCheck2); + + } + RotateRect0(sb, &sbm); + + //Draw the THUMB finally + SetRect(&thumb, thumbpos, rect->top, thumbpos+thumbwidth, rect->bottom); + + RotateRect0(sb, &thumb); + + if(fCustomDraw) + { + PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &thumb, SB_THUMBTRACK, uDrawFlags==HTSCROLL_THUMB, uHitTestPortion == HTSCROLL_THUMB && fBarHot, FALSE); + } + else + { + +#ifdef FLAT_SCROLLBARS + if(hwnd == hwndCurCoolSB && sb->fFlatScrollbar && (uDrawFlags == HTSCROLL_THUMB || + (uHitTestPortion == HTSCROLL_THUMB && fBarHot))) + { + PaintRect(hdc, &thumb, GetSysColor(COLOR_3DSHADOW)); + } + else +#endif + { + DrawBlankButton(hdc, &thumb, uDEFlat); + } + } + RotateRect0(sb, &thumb); + + } + //otherwise, just leave that whole area blank + else + { + OffsetRect(&ctrl, butwidth, 0); + ctrl.right = rect->right - butwidth; + + //if we always show the thumb covering the whole scrollbar, + //then draw it that way + if (!IsScrollInfoActive(si) && (sb->fScrollFlags & CSBS_THUMBALWAYS) + && ctrl.right - ctrl.left > sb->nMinThumbSize) + { + //leave a 1-pixel gap between the thumb + right button + ctrl.right --; + RotateRect0(sb, &ctrl); + + if(fCustomDraw) + PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_THUMBTRACK, fMouseDownL, FALSE, FALSE); + else + { +#ifdef FLAT_SCROLLBARS + if(sb->fFlatScrollbar == CSBS_HOTTRACKED && uDrawFlags == HTSCROLL_THUMB) + PaintRect(hdc, &ctrl, GetSysColor(COLOR_3DSHADOW)); + else +#endif + DrawBlankButton(hdc, &ctrl, uDEFlat); + + } + RotateRect0(sb, &ctrl); + + //draw the single-line gap + ctrl.left = ctrl.right; + ctrl.right += 1; + + RotateRect0(sb, &ctrl); + + if(fCustomDraw) + PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_PAGERIGHT, 0, 0, 0); + else + PaintRect(hdc, &ctrl, GetSysColor(COLOR_SCROLLBAR)); + + RotateRect0(sb, &ctrl); + } + //otherwise, paint a blank if the thumb doesn't fit in + else + { + RotateRect0(sb, &ctrl); + + if(fCustomDraw) + PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_PAGERIGHT, 0, 0, 0); + else + DrawCheckedRect(hdc, &ctrl, crCheck1, crCheck2); + + RotateRect0(sb, &ctrl); + } + } + + //RIGHT ARROW + SetRect(&ctrl, rect->right - butwidth, rect->top, rect->right, rect->bottom); + + RotateRect0(sb, &ctrl); + + if(fCustomDraw) + PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_LINERIGHT, fMouseDownR, fMouseOverR, uRightButFlags & DFCS_INACTIVE); + else + DrawScrollArrow(sb, hdc, &ctrl, uRightButFlags, fMouseDownR, fMouseOverR); + + RotateRect0(sb, &ctrl); + } + //not enough room for the scrollbar, so just draw the buttons (scaled in size to fit) + else + { + butwidth = scrollwidth / 2; + + //LEFT ARROW + SetRect(&ctrl, rect->left, rect->top, rect->left + butwidth, rect->bottom); + + RotateRect0(sb, &ctrl); + if(fCustomDraw) + PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_LINELEFT, fMouseDownL, fMouseOverL, uLeftButFlags & DFCS_INACTIVE); + else + DrawScrollArrow(sb, hdc, &ctrl, uLeftButFlags, fMouseDownL, fMouseOverL); + RotateRect0(sb, &ctrl); + + //RIGHT ARROW + OffsetRect(&ctrl, scrollwidth - butwidth, 0); + + RotateRect0(sb, &ctrl); + if(fCustomDraw) + PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_LINERIGHT, fMouseDownR, fMouseOverR, uRightButFlags & DFCS_INACTIVE); + else + DrawScrollArrow(sb, hdc, &ctrl, uRightButFlags, fMouseDownR, fMouseOverR); + RotateRect0(sb, &ctrl); + + //if there is a gap between the buttons, fill it with a solid color + //if(butwidth & 0x0001) + if(ctrl.left != rect->left + butwidth) + { + ctrl.left --; + ctrl.right -= butwidth; + RotateRect0(sb, &ctrl); + + if(fCustomDraw) + PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_PAGERIGHT, 0, 0, 0); + else + DrawCheckedRect(hdc, &ctrl, crCheck1, crCheck2); + + RotateRect0(sb, &ctrl); + } + + } + +//#ifdef CUSTOM_DRAW + PostCustomPrePostPaint(hwnd, hdc, sb, CDDS_POSTPAINT); +//#endif + + return fCustomDraw; +} + +// +// Draw a vertical scrollbar using the horizontal draw routine, but +// with the coordinates adjusted accordingly +// +static LRESULT NCDrawVScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *rect, UINT uDrawFlags) +{ + LRESULT ret; + RECT rc; + + rc = *rect; + RotateRect(&rc); + ret = NCDrawHScrollbar(sb, hwnd, hdc, &rc, uDrawFlags); + RotateRect(&rc); + + return ret; +} + +// +// Generic wrapper function for the scrollbar drawing +// +static LRESULT NCDrawScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *rect, UINT uDrawFlags) +{ + if(sb->nBarType == SB_HORZ) + return NCDrawHScrollbar(sb, hwnd, hdc, rect, uDrawFlags); + else + return NCDrawVScrollbar(sb, hwnd, hdc, rect, uDrawFlags); +} + +#ifdef INCLUDE_BUTTONS + +// +// Draw the specified bitmap centered in the rectangle +// +static void DrawImage(HDC hdc, HBITMAP hBitmap, RECT *rc) +{ + BITMAP bm; + int cx; + int cy; + HDC memdc; + HBITMAP hOldBM; + RECT rcDest = *rc; + POINT p; + SIZE delta; + COLORREF colorOld; + + if(hBitmap == NULL) + return; + + // center bitmap in caller's rectangle + GetObject(hBitmap, sizeof bm, &bm); + + cx = bm.bmWidth; + cy = bm.bmHeight; + + delta.cx = (rc->right-rc->left - cx) / 2; + delta.cy = (rc->bottom-rc->top - cy) / 2; + + if(rc->right-rc->left > cx) + { + SetRect(&rcDest, rc->left+delta.cx, rc->top + delta.cy, 0, 0); + rcDest.right = rcDest.left + cx; + rcDest.bottom = rcDest.top + cy; + p.x = 0; + p.y = 0; + } + else + { + p.x = -delta.cx; + p.y = -delta.cy; + } + + // select checkmark into memory DC + memdc = CreateCompatibleDC(hdc); + hOldBM = (HBITMAP)SelectObject(memdc, hBitmap); + + // set BG color based on selected state + colorOld = SetBkColor(hdc, GetSysColor(COLOR_3DFACE)); + + BitBlt(hdc, rcDest.left, rcDest.top, rcDest.right-rcDest.left, rcDest.bottom-rcDest.top, memdc, p.x, p.y, SRCCOPY); + + // restore + SetBkColor(hdc, colorOld); + SelectObject(memdc, hOldBM); + DeleteDC(memdc); +} + +// +// Draw the specified metafile +// +static void DrawMetaFile(HDC hdc, HENHMETAFILE hemf, RECT *rect) +{ + RECT rc; + POINT pt; + + SetRect(&rc, 0, 0, rect->right-rect->left, rect->bottom-rect->top); + SetWindowOrgEx(hdc, -rect->left, -rect->top, &pt); + PlayEnhMetaFile(hdc, hemf, &rc); + SetWindowOrgEx(hdc, pt.x, pt.y, 0); +} + +// +// Draw a single scrollbar inserted button, in whatever style +// it has been defined to use. +// +static UINT DrawScrollButton(SCROLLBUT *sbut, HDC hdc, const RECT *pctrl, UINT flags) +{ + NMCSBCUSTOMDRAW nmcd; + HWND hwnd; + RECT rect = *pctrl; + UINT f; + + switch(sbut->uButType & SBBT_MASK) + { + case SBBT_OWNERDRAW: + + hwnd = WindowFromDC(hdc); + + //fill in the standard header + nmcd.hdr.hwndFrom = hwnd; + nmcd.hdr.idFrom = GetWindowLongPtr(hwnd, GWLP_ID); + nmcd.hdr.code = NM_COOLSB_CUSTOMDRAW; + + nmcd.dwDrawStage = CDDS_ITEMPREPAINT; + nmcd.nBar = SB_INSBUT; + nmcd.rect = *pctrl; + nmcd.uItem = sbut->uCmdId; + nmcd.hdc = hdc; + nmcd.uState = flags; + + IntersectClipRect(hdc, rect.left, rect.top, rect.right, rect.bottom); + SendMessage(GetParent(hwnd), WM_NOTIFY, nmcd.hdr.idFrom, (LPARAM)&nmcd); + SelectClipRgn(hdc, NULL); + + break; + + case SBBT_FIXED: + flags &= ~SBBS_PUSHED; + + case SBBT_TOGGLEBUTTON: + if(sbut->uState != SBBS_NORMAL) + flags |= SBBS_PUSHED; + + //intentionally fall through here... + + case SBBT_PUSHBUTTON: + + f = flags & SBBS_PUSHED ? DFCS_PUSHED | DFCS_FLAT : 0; + if(sbut->uButType & SBBM_LEFTARROW) + { + DrawFrameControl(hdc, &rect, DFC_SCROLL, DFCS_SCROLLLEFT | f); + } + else if(sbut->uButType & SBBM_RIGHTARROW) + { + DrawFrameControl(hdc, &rect, DFC_SCROLL, DFCS_SCROLLRIGHT | f); + } + else if(sbut->uButType & SBBM_UPARROW) + { + DrawFrameControl(hdc, &rect, DFC_SCROLL, DFCS_SCROLLUP | f); + } + else if(sbut->uButType & SBBM_DOWNARROW) + { + DrawFrameControl(hdc, &rect, DFC_SCROLL, DFCS_SCROLLDOWN | f); + } + else + { + // + if(flags & SBBS_PUSHED) + { + if(sbut->uButType & SBBM_RECESSED) + { + InflateRect(&rect, -1, -1); + DrawEdge(hdc, &rect, EDGE_SUNKEN, BF_RECT|BF_FLAT); + InflateRect(&rect, 1, 1); + + FrameRect(hdc, &rect, GetSysColorBrush(COLOR_3DDKSHADOW)); + InflateRect(&rect, -2, -2); + } + else + { + DrawEdge(hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_FLAT | BF_ADJUST); + InflateRect(&rect, 1, 1); + } + } + else + { + // draw the button borders + if(sbut->uButType & SBBM_TYPE2) + { + DrawFrameControl(hdc, &rect, DFC_BUTTON, DFCS_BUTTONPUSH); + InflateRect(&rect, -2, -2); + } + + else if(sbut->uButType & SBBM_TYPE3) + { + DrawFrameControl(hdc, &rect, DFC_BUTTON, DFCS_BUTTONPUSH); + InflateRect(&rect, -1, -1); + } + else + { + DrawEdge(hdc, &rect, EDGE_RAISED, BF_RECT | BF_ADJUST); + rect.bottom++; + rect.right++; + } + + OffsetRect(&rect, -1, -1); + rect.top++; rect.left++; + } + + if(sbut->hBmp) + { + PaintRect(hdc, &rect, GetSysColor(COLOR_3DFACE)); + + if(flags & SBBS_PUSHED) + { + rect.top++; rect.left++; + } + + IntersectClipRect(hdc, rect.left, rect.top, rect.right,rect.bottom); + DrawImage(hdc, sbut->hBmp, &rect); + SelectClipRgn(hdc, 0); + } + else if(sbut->hEmf) + { + PaintRect(hdc, &rect, GetSysColor(COLOR_3DFACE)); + InflateRect(&rect, -1, -1); + + if(flags & SBBS_PUSHED) + { + rect.top++; rect.left++; + } + + IntersectClipRect(hdc, rect.left, rect.top, rect.right,rect.bottom); + DrawMetaFile(hdc, sbut->hEmf, &rect); + SelectClipRgn(hdc, 0); + } + else + { + PaintRect(hdc, &rect, GetSysColor(COLOR_3DFACE)); + } + } + + + break; + + case SBBT_BLANK: + PaintRect(hdc, &rect, GetSysColor(COLOR_3DFACE)); + break; + + case SBBT_FLAT: + DrawBlankButton(hdc, &rect, BF_FLAT); + break; + + case SBBT_DARK: + PaintRect(hdc, &rect, GetSysColor(COLOR_3DDKSHADOW)); + break; + } + + return 0; +} + +// +// Draw any buttons inserted into the horizontal scrollbar +// assume that the button widths have already been calculated +// Note: RECT *rect is the rectangle of the scrollbar +// leftright: 1 = left, 2 = right, 3 = both +// +static LRESULT DrawHorzButtons(SCROLLBAR *sbar, HDC hdc, const RECT *rect, int leftright) +{ + int i; + int xposl, xposr; + RECT ctrl; + SCROLLBUT *sbut = sbar->sbButtons; + + xposl = rect->left - sbar->nButSizeBefore; + xposr = rect->right; + + for (i = 0; i < sbar->nButtons; i++) + { + if ((leftright & SBBP_LEFT) && sbut[i].uPlacement == SBBP_LEFT) + { + int butwidth = GetSingleButSize(sbar, &sbut[i]); + SetRect(&ctrl, xposl, rect->top, xposl + butwidth, rect->bottom); + RotateRect0(sbar, &ctrl); + DrawScrollButton(&sbut[i], hdc, &ctrl, SBBS_NORMAL); + + xposl += butwidth; + } + + if ((leftright & SBBP_RIGHT) && sbut[i].uPlacement == SBBP_RIGHT) + { + int butwidth = GetSingleButSize(sbar, &sbut[i]); + SetRect(&ctrl, xposr, rect->top, xposr + butwidth, rect->bottom); + RotateRect0(sbar, &ctrl); + DrawScrollButton(&sbut[i], hdc, &ctrl, SBBS_NORMAL); + xposr += butwidth; + } + } + return 0; +} + +static LRESULT DrawVertButtons(SCROLLBAR *sbar, HDC hdc, const RECT *rect, int leftright) +{ + RECT rc = *rect; + RotateRect(&rc); + DrawHorzButtons(sbar, hdc, &rc, leftright); + return 0; +} +#endif // INCLUDE_BUTTONS + +// +// Define these two for proper processing of NCPAINT +// NOT needed if we don't bother to mask the scrollbars we draw +// to prevent the old window procedure from accidently drawing over them +// +HDC CoolSB_GetDC(HWND hwnd, WPARAM wParam) +{ + // I just can't figure out GetDCEx, so I'll just use this: + return GetWindowDC(hwnd); + + /* + RECT rc; + DWORD flags = 0x10000; + HRGN hrgn = (HRGN)wParam; + + if(hrgn == (HRGN)1) + { + GetWindowRect(hwnd, &rc); + OffsetRect(&rc, -rc.left, -rc.top); + hrgn = CreateRectRgnIndirect(&rc); + } + + if(GetWindowLongPtr(hwnd, GWL_STYLE) & WS_CLIPCHILDREN) + flags |= DCX_CLIPCHILDREN; + + if(GetWindowLongPtr(hwnd, GWL_STYLE) & WS_CLIPSIBLINGS) + flags |= DCX_CLIPSIBLINGS; + + return GetDCEx(hwnd, hrgn, flags | DCX_CACHE|DCX_NORESETATTRS|DCX_WINDOW | DCX_INTERSECTUPDATE); + */ + //return GetDCEx(hwnd, NULL, flags | DCX_WINDOW| DCX_NORESETATTRS); +} + +static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) +{ + SCROLLBAR *sb; + HDC hdc; + HRGN hrgn; + RECT winrect, rect; + HRGN clip = 0; + BOOL fUpdateAll = ((LONG)wParam == 1); + BOOL fCustomDraw = FALSE; + LRESULT ret; + DWORD dwStyle; + + GetWindowRect(hwnd, &winrect); + + //if entire region needs painting, then make a region to cover the entire window + if(fUpdateAll) + hrgn = (HRGN)wParam; + else + hrgn = (HRGN)wParam; + + //hdc = GetWindowDC(hwnd); + hdc = CoolSB_GetDC(hwnd, wParam); + + // + // Only draw the horizontal scrollbar if the window is tall enough + // + sb = &sw->sbarHorz; + if(sb->fScrollVisible) + { + int hbarwidth = 0, leftright = 0; + + //get the screen coordinates of the whole horizontal scrollbar area + GetHScrollRect(sw, hwnd, &rect); + + //make the coordinates relative to the window for drawing + OffsetRect(&rect, -winrect.left, -winrect.top); + +#ifdef INCLUDE_BUTTONS + + //work out the size of any inserted buttons so we can dra them + sb->nButSizeBefore = GetButtonSize(sb, hwnd, SBBP_LEFT); + sb->nButSizeAfter = GetButtonSize(sb, hwnd, SBBP_RIGHT); + + //make sure there is room for the buttons + hbarwidth = rect.right - rect.left; + + //check that we can fit any left/right buttons in the available space + if(sb->nButSizeAfter < (hbarwidth - MIN_COOLSB_SIZE)) + { + //adjust the scrollbar rectangle to fit the buttons into + sb->fButVisibleAfter = TRUE; + rect.right -= sb->nButSizeAfter; + leftright |= SBBP_RIGHT; + + //check that there is enough space for the right buttons + if(sb->nButSizeBefore + sb->nButSizeAfter < (hbarwidth - MIN_COOLSB_SIZE)) + { + sb->fButVisibleBefore = TRUE; + rect.left += sb->nButSizeBefore; + leftright |= SBBP_LEFT; + } + else + sb->fButVisibleBefore = FALSE; + } + else + sb->fButVisibleAfter = FALSE; + + + DrawHorzButtons(sb, hdc, &rect, leftright); +#endif// INCLUDE_BUTTONS + + if(uCurrentScrollbar == SB_HORZ) + fCustomDraw |= NCDrawHScrollbar(sb, hwnd, hdc, &rect, uScrollTimerPortion); + else + fCustomDraw |= NCDrawHScrollbar(sb, hwnd, hdc, &rect, HTSCROLL_NONE); + } + + // + // Only draw the vertical scrollbar if the window is wide enough to accomodate it + // + sb = &sw->sbarVert; + if(sb->fScrollVisible) + { + int vbarheight = 0, updown = 0; + + //get the screen cooridinates of the whole horizontal scrollbar area + GetVScrollRect(sw, hwnd, &rect); + + //make the coordinates relative to the window for drawing + OffsetRect(&rect, -winrect.left, -winrect.top); + +#ifdef INCLUDE_BUTTONS + + //work out the size of any inserted buttons so we can dra them + sb->nButSizeBefore = GetButtonSize(sb, hwnd, SBBP_LEFT); + sb->nButSizeAfter = GetButtonSize(sb, hwnd, SBBP_RIGHT); + + //make sure there is room for the buttons + vbarheight = rect.bottom - rect.top; + + //check that we can fit any left/right buttons in the available space + if(sb->nButSizeAfter < (vbarheight - MIN_COOLSB_SIZE)) + { + //adjust the scrollbar rectangle to fit the buttons into + sb->fButVisibleAfter = TRUE; + rect.bottom -= sb->nButSizeAfter; + updown |= SBBP_BOTTOM; + + //check that there is enough space for the right buttons + if(sb->nButSizeBefore + sb->nButSizeAfter < (vbarheight - MIN_COOLSB_SIZE)) + { + sb->fButVisibleBefore = TRUE; + rect.top += sb->nButSizeBefore; + updown |= SBBP_TOP; + } + else + sb->fButVisibleBefore = FALSE; + } + else + sb->fButVisibleAfter = FALSE; + + + DrawVertButtons(sb, hdc, &rect, updown); +#endif // INCLUDE_BUTTONS + + if(uCurrentScrollbar == SB_VERT) + fCustomDraw |= NCDrawVScrollbar(sb, hwnd, hdc, &rect, uScrollTimerPortion); + else + fCustomDraw |= NCDrawVScrollbar(sb, hwnd, hdc, &rect, HTSCROLL_NONE); + } + + //Call the default window procedure for WM_NCPAINT, with the + //new window region. ** region must be in SCREEN coordinates ** + dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); + + // If the window has WS_(H-V)SCROLL bits set, we should reset them + // to avoid windows taking the scrollbars into account. + // We temporarily set a flag preventing the subsecuent + // WM_STYLECHANGING/WM_STYLECHANGED to be forwarded to + // the original window procedure + if ( dwStyle & (WS_VSCROLL|WS_HSCROLL)) + { + sw->bPreventStyleChange = TRUE; + SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle & ~(WS_VSCROLL|WS_HSCROLL)); + } + + ret = CallWindowProc(sw->oldproc, hwnd, WM_NCPAINT, (WPARAM)hrgn, lParam); + + if ( dwStyle & (WS_VSCROLL|WS_HSCROLL)) + { + SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle); + sw->bPreventStyleChange = FALSE; + } + + + // DRAW THE DEAD AREA + // only do this if the horizontal and vertical bars are visible + if(sw->sbarHorz.fScrollVisible && sw->sbarVert.fScrollVisible) + { + GetWindowRect(hwnd, &rect); + OffsetRect(&rect, -winrect.left, -winrect.top); + + rect.bottom -= sw->cyBottomEdge; + rect.top = rect.bottom - GetScrollMetric(&sw->sbarHorz, SM_CYHORZSB); + + if(sw->fLeftScrollbar) + { + rect.left += sw->cxLeftEdge; + rect.right = rect.left + GetScrollMetric(&sw->sbarVert, SM_CXVERTSB); + } + else + { + rect.right -= sw->cxRightEdge; + rect.left = rect.right - GetScrollMetric(&sw->sbarVert, SM_CXVERTSB); + } + + if(fCustomDraw) + PostCustomDrawNotify(hwnd, hdc, SB_BOTH, &rect, 32, 0, 0, 0); + else + { + //calculate the position of THIS window's dead area + //with the position of the PARENT window's client rectangle. + //if THIS window has been positioned such that its bottom-right + //corner sits in the parent's bottom-right corner, then we should + //show the sizing-grip. + //Otherwise, assume this window is not in the right place, and + //just draw a blank rectangle + RECT parent; + RECT rect2; + HWND hwndParent = GetParent(hwnd); + + GetClientRect(hwndParent, &parent); + MapWindowPoints(hwndParent, 0, (POINT *)&parent, 2); + + CopyRect(&rect2, &rect); + OffsetRect(&rect2, winrect.left, winrect.top); + + if (!sw->fLeftScrollbar && parent.right == rect2.right+sw->cxRightEdge && parent.bottom == rect2.bottom+sw->cyBottomEdge + || sw->fLeftScrollbar && parent.left == rect2.left -sw->cxLeftEdge && parent.bottom == rect2.bottom+sw->cyBottomEdge) + DrawFrameControl(hdc, &rect, DFC_SCROLL, sw->fLeftScrollbar ? DFCS_SCROLLSIZEGRIPRIGHT : DFCS_SCROLLSIZEGRIP ); + else + PaintRect(hdc, &rect, GetSysColor(COLOR_3DFACE)); + } + } + + UNREFERENCED_PARAMETER(clip); + ReleaseDC(hwnd, hdc); + return ret; +} + +// +// Need to detect if we have clicked in the scrollbar region or not +// +static LRESULT NCHitTest(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) +{ + RECT hrect; + RECT vrect; + POINT pt; + + pt.x = LOWORD(lParam); + pt.y = HIWORD(lParam); + + //work out exactly where the Horizontal and Vertical scrollbars are + GetHScrollRect(sw, hwnd, &hrect); + GetVScrollRect(sw, hwnd, &vrect); + + //Clicked in the horizontal scrollbar area + if(sw->sbarHorz.fScrollVisible && PtInRect(&hrect, pt)) + { + return HTHSCROLL; + } + //Clicked in the vertical scrollbar area + else if(sw->sbarVert.fScrollVisible && PtInRect(&vrect, pt)) + { + return HTVSCROLL; + } + //clicked somewhere else + else + { + return CallWindowProc(sw->oldproc, hwnd, WM_NCHITTEST, wParam, lParam); + } +} + +// +// Return a HT* value indicating what part of the scrollbar was clicked +// Rectangle is not adjusted +// +static UINT GetHorzPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) +{ + RECT rc = *rect; + + if(y < rc.top || y >= rc.bottom) return HTSCROLL_NONE; + +#ifdef INCLUDE_BUTTONS + + if(sb->fButVisibleBefore) + { + //clicked on the buttons to the left of the scrollbar + if(x >= rc.left && x < rc.left + sb->nButSizeBefore) + return HTSCROLL_INSERTED; + + //adjust the rectangle to exclude the left-side buttons, now that we + //know we havn't clicked on them + rc.left += sb->nButSizeBefore; + } + + if(sb->fButVisibleAfter) + { + //clicked on the buttons to the right of the scrollbar + if(x >= rc.right - sb->nButSizeAfter && x < rc.right) + return HTSCROLL_INSERTED; + + //adjust the rectangle to exclude the right-side buttons, now that we + //know we havn't clicked on them + rc.right -= sb->nButSizeAfter; + } + +#endif INCLUDE_BUTTONS + + //Now we have the rectangle for the scrollbar itself, so work out + //what part we clicked on. + return GetHorzScrollPortion(sb, hwnd, &rc, x, y); +} + +// +// Just call the horizontal version, with adjusted coordinates +// +static UINT GetVertPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) +{ + UINT ret; + RotateRect(rect); + ret = GetHorzPortion(sb, hwnd, rect, y, x); + RotateRect(rect); + return ret; +} + +// +// Wrapper function for GetHorzPortion and GetVertPortion +// +static UINT GetPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) +{ + if(sb->nBarType == SB_HORZ) + return GetHorzPortion(sb, hwnd, rect, x, y); + else if(sb->nBarType == SB_VERT) + return GetVertPortion(sb, hwnd, rect, x, y); + else + return HTSCROLL_NONE; +} + +// +// Input: rectangle of the total scrollbar area +// Output: adjusted to take the inserted buttons into account +// +static void GetRealHorzScrollRect(SCROLLBAR *sb, RECT *rect) +{ + if(sb->fButVisibleBefore) rect->left += sb->nButSizeBefore; + if(sb->fButVisibleAfter) rect->right -= sb->nButSizeAfter; +} + +// +// Input: rectangle of the total scrollbar area +// Output: adjusted to take the inserted buttons into account +// +static void GetRealVertScrollRect(SCROLLBAR *sb, RECT *rect) +{ + if(sb->fButVisibleBefore) rect->top += sb->nButSizeBefore; + if(sb->fButVisibleAfter) rect->bottom -= sb->nButSizeAfter; +} + +// +// Decide which type of scrollbar we have before calling +// the real function to do the job +// +static void GetRealScrollRect(SCROLLBAR *sb, RECT *rect) +{ + if(sb->nBarType == SB_HORZ) + { + GetRealHorzScrollRect(sb, rect); + } + else if(sb->nBarType == SB_VERT) + { + GetRealVertScrollRect(sb, rect); + } +} + +// +// All button code shoule be collected together +// +// +#ifdef INCLUDE_BUTTONS + +// +// Return the index of the button covering the specified point +// rect - rectangle of the whole scrollbar area +// pt - screen coords of the mouse +// fReturnRect - do/don't modify the rect to return the button's area +// +static UINT GetHorzButtonFromPt(SCROLLBAR *sb, RECT *rect, POINT pt, BOOL fReturnRect) +{ + int leftpos = rect->left, rightpos = rect->right; + int i; + int butwidth; + SCROLLBUT *sbut = sb->sbButtons; + + if (!PtInRect(rect, pt)) + return -1; + + if(sb->fButVisibleAfter) + rightpos -= sb->nButSizeAfter; + + for (i = 0; i < sb->nButtons; i++) + { + if(sb->fButVisibleBefore && sbut[i].uPlacement == SBBP_LEFT) + { + butwidth = GetSingleButSize(sb, &sbut[i]); + + //if the current button is under the specified point + if(pt.x >= leftpos && pt.x < leftpos + butwidth) + { + //if the caller wants us to return the rectangle of the button + if(fReturnRect) + { + rect->left = leftpos; + rect->right = leftpos + butwidth; + } + + return i; + } + + leftpos += butwidth; + } + else if(sb->fButVisibleAfter && sbut[i].uPlacement == SBBP_RIGHT) + { + butwidth = GetSingleButSize(sb, &sbut[i]); + + //if the current button is under the specified point + if(pt.x >= rightpos && pt.x < rightpos + butwidth) + { + //if the caller wants us to return the rectangle of the button + if(fReturnRect) + { + rect->left = rightpos; + rect->right = rightpos + butwidth; + } + return i; + } + + rightpos += butwidth; + } + } + + return -1; +} + + +static UINT GetVertButtonFromPt(SCROLLBAR *sb, RECT *rect, POINT pt, BOOL fReturnRect) +{ + UINT ret; + int temp; + + //swap the X/Y coords + temp = pt.x; + pt.x = pt.y; + pt.y = temp; + + //swap the rectangle + RotateRect(rect); + + ret = GetHorzButtonFromPt(sb, rect, pt, fReturnRect); + + RotateRect(rect); + return ret; +} + +// +// +// +static UINT GetButtonFromPt(SCROLLBAR *sb, RECT *rect, POINT pt, BOOL fReturnRect) +{ + if(sb->nBarType == SB_HORZ) + { + return GetHorzButtonFromPt(sb, rect, pt, fReturnRect); + } + else + { + return GetVertButtonFromPt(sb, rect, pt, fReturnRect); + } +} + +// +// Find the coordinates (in RECT format) of the specified button index +// +static UINT GetHorzButtonRectFromId(SCROLLBAR *sb, RECT *rect, UINT index) +{ + UINT i; + SCROLLBUT *sbut = sb->sbButtons; + int leftpos = rect->left, rightpos = rect->right; + + if(sb->fButVisibleAfter) + rightpos -= sb->nButSizeAfter; + + //find the particular button in question + for (i = 0; i < index; i++) + { + if(sb->fButVisibleBefore && sbut[i].uPlacement == SBBP_LEFT) + { + leftpos += GetSingleButSize(sb, &sbut[i]); + } + else if(sb->fButVisibleAfter && sbut[i].uPlacement == SBBP_RIGHT) + { + rightpos += GetSingleButSize(sb, &sbut[i]); + } + } + + //now return the rectangle + if(sbut[i].uPlacement == SBBP_LEFT) + { + rect->left = leftpos; + rect->right = leftpos + GetSingleButSize(sb, &sbut[i]); + } + else + { + rect->left = rightpos; + rect->right = rightpos + GetSingleButSize(sb, &sbut[i]); + } + + return 0; +} + +static UINT GetVertButtonRectFromId(SCROLLBAR *sb, RECT *rect, UINT index) +{ + UINT ret; + RotateRect(rect); + ret = GetHorzButtonRectFromId(sb, rect, index); + RotateRect(rect); + return ret; +} + +static UINT GetButtonRectFromId(SCROLLBAR *sb, RECT *rect, UINT index) +{ + if(sb->nBarType == SB_HORZ) + { + return GetHorzButtonRectFromId(sb, rect, index); + } + else + { + return GetVertButtonRectFromId(sb, rect, index); + } +} +#endif //INCLUDE_BUTTONS + +// +// Left button click in the non-client area +// +static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) +{ + RECT rect, winrect; + HDC hdc; + SCROLLBAR *sb; + SCROLLBUT *sbut = 0; + POINT pt; + + pt.x = LOWORD(lParam); + pt.y = HIWORD(lParam); + + hwndCurCoolSB = hwnd; + + // + // HORIZONTAL SCROLLBAR PROCESSING + // + if(wParam == HTHSCROLL) + { + uScrollTimerMsg = WM_HSCROLL; + uCurrentScrollbar = SB_HORZ; + sb = &sw->sbarHorz; + + //get the total area of the normal Horz scrollbar area + GetHScrollRect(sw, hwnd, &rect); + uCurrentScrollPortion = GetHorzPortion(sb, hwnd, &rect, LOWORD(lParam), HIWORD(lParam)); + } + // + // VERTICAL SCROLLBAR PROCESSING + // + else if(wParam == HTVSCROLL) + { + uScrollTimerMsg = WM_VSCROLL; + uCurrentScrollbar = SB_VERT; + sb = &sw->sbarVert; + + //get the total area of the normal Horz scrollbar area + GetVScrollRect(sw, hwnd, &rect); + uCurrentScrollPortion = GetVertPortion(sb, hwnd, &rect, LOWORD(lParam), HIWORD(lParam)); + } + // + // NORMAL PROCESSING + // + else + { + uCurrentScrollPortion = HTSCROLL_NONE; + return CallWindowProc(sw->oldproc, hwnd, WM_NCLBUTTONDOWN, wParam, lParam); + } + + // + // we can now share the same code for vertical + // and horizontal scrollbars + // + switch(uCurrentScrollPortion) + { + //inserted buttons to the left/right +#ifdef INCLUDE_BUTTONS + case HTSCROLL_INSERTED: + +#ifdef HOT_TRACKING + KillTimer(hwnd, uMouseOverId); + uMouseOverId = 0; + uMouseOverScrollbar = COOLSB_NONE; +#endif + + //find the index of the button that has been clicked + //adjust the rectangle to give the button's rectangle + uCurrentButton = GetButtonFromPt(sb, &rect, pt, TRUE); + + sbut = &sb->sbButtons[uCurrentButton]; + + //post a notification message + PostMouseNotify(hwnd, NM_CLICK, sb->nBarType, &rect, sbut->uCmdId, pt); + + GetWindowRect(hwnd, &winrect); + OffsetRect(&rect, -winrect.left, -winrect.top); + hdc = GetWindowDC(hwnd); + + DrawScrollButton(sbut, hdc, &rect, SBBS_PUSHED); + + ReleaseDC(hwnd, hdc); + + break; +#endif //INCLUDE_BUTTONS + + case HTSCROLL_THUMB: + + //if the scrollbar is disabled, then do no further processing + if (!IsScrollbarActive(sb)) + return 0; + + GetRealScrollRect(sb, &rect); + RotateRect0(sb, &rect); + CalcThumbSize(sb, &rect, &nThumbSize, &nThumbPos); + RotateRect0(sb, &rect); + + //remember the bounding rectangle of the scrollbar work area + rcThumbBounds = rect; + + sw->fThumbTracking = TRUE; + sb->scrollInfo.nTrackPos = sb->scrollInfo.nPos; + + if(wParam == HTVSCROLL) + nThumbMouseOffset = pt.y - nThumbPos; + else + nThumbMouseOffset = pt.x - nThumbPos; + + nLastPos = -sb->scrollInfo.nPos; + nThumbPos0 = nThumbPos; + + //if(sb->fFlatScrollbar) + //{ + GetWindowRect(hwnd, &winrect); + OffsetRect(&rect, -winrect.left, -winrect.top); + hdc = GetWindowDC(hwnd); + NCDrawScrollbar(sb, hwnd, hdc, &rect, HTSCROLL_THUMB); + ReleaseDC(hwnd, hdc); + //} + + break; + + //Any part of the scrollbar + case HTSCROLL_LEFT: + if(sb->fScrollFlags & ESB_DISABLE_LEFT) return 0; + else goto target1; + + case HTSCROLL_RIGHT: + if(sb->fScrollFlags & ESB_DISABLE_RIGHT) return 0; + else goto target1; + + goto target1; + + case HTSCROLL_PAGELEFT: case HTSCROLL_PAGERIGHT: + + target1: + + //if the scrollbar is disabled, then do no further processing + if (!IsScrollbarActive(sb)) + break; + + //ajust the horizontal rectangle to NOT include + //any inserted buttons + GetRealScrollRect(sb, &rect); + + SendScrollMessage(hwnd, uScrollTimerMsg, uCurrentScrollPortion, 0); + + // Check what area the mouse is now over : + // If the scroll thumb has moved under the mouse in response to + // a call to SetScrollPos etc, then we don't hilight the scrollbar margin + if(uCurrentScrollbar == SB_HORZ) + uScrollTimerPortion = GetHorzScrollPortion(sb, hwnd, &rect, pt.x, pt.y); + else + uScrollTimerPortion = GetVertScrollPortion(sb, hwnd, &rect, pt.x, pt.y); + + GetWindowRect(hwnd, &winrect); + OffsetRect(&rect, -winrect.left, -winrect.top); + hdc = GetWindowDC(hwnd); + +#ifndef HOT_TRACKING + //if we aren't hot-tracking, then don't highlight + //the scrollbar thumb unless we click on it + if(uScrollTimerPortion == HTSCROLL_THUMB) + uScrollTimerPortion = HTSCROLL_NONE; +#endif + NCDrawScrollbar(sb, hwnd, hdc, &rect, uScrollTimerPortion); + ReleaseDC(hwnd, hdc); + + //Post the scroll message!!!! + uScrollTimerPortion = uCurrentScrollPortion; + + //set a timer going on the first click. + //if this one expires, then we can start off a more regular timer + //to generate the auto-scroll behaviour + uScrollTimerId = SetTimer(hwnd, COOLSB_TIMERID1, COOLSB_TIMERINTERVAL1, 0); + break; + default: + return CallWindowProc(sw->oldproc, hwnd, WM_NCLBUTTONDOWN, wParam, lParam); + //return 0; + } + + SetCapture(hwnd); + return 0; +} + +// +// Left button released +// +static LRESULT LButtonUp(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) +{ + RECT rect; + //UINT thisportion; + HDC hdc; + POINT pt; + RECT winrect; + UINT buttonIdx = 0; + + //current scrollportion is the button that we clicked down on + if(uCurrentScrollPortion != HTSCROLL_NONE) + { + SCROLLBAR *sb = &sw->sbarHorz; + lParam = GetMessagePos(); + ReleaseCapture(); + + GetWindowRect(hwnd, &winrect); + pt.x = LOWORD(lParam); + pt.y = HIWORD(lParam); + + //emulate the mouse input on a scrollbar here... + if(uCurrentScrollbar == SB_HORZ) + { + //get the total area of the normal Horz scrollbar area + sb = &sw->sbarHorz; + GetHScrollRect(sw, hwnd, &rect); + } + else if(uCurrentScrollbar == SB_VERT) + { + //get the total area of the normal Horz scrollbar area + sb = &sw->sbarVert; + GetVScrollRect(sw, hwnd, &rect); + } + + //we need to do different things depending on if the + //user is activating the scrollbar itself, or one of + //the inserted buttons + switch(uCurrentScrollPortion) + { +#ifdef INCLUDE_BUTTONS + //inserted buttons are being clicked + case HTSCROLL_INSERTED: + + //get the rectangle of the ACTIVE button + buttonIdx = GetButtonFromPt(sb, &rect, pt, FALSE); + GetButtonRectFromId(sb, &rect, uCurrentButton); + + OffsetRect(&rect, -winrect.left, -winrect.top); + + //Send the notification BEFORE we redraw, so the + //bitmap can be changed smoothly by the user if they require + if(uCurrentButton == buttonIdx) + { + SCROLLBUT *sbut = &sb->sbButtons[buttonIdx]; + UINT cmdid = sbut->uCmdId; + + if ((sbut->uButType & SBBT_MASK) == SBBT_TOGGLEBUTTON) + sbut->uState ^= 1; + + //send a notify?? + //only post a message if the command id is valid + if(cmdid != -1 && cmdid > 0) + SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(cmdid, CSBN_CLICKED), 0); + + //user might have deleted this button, so redraw whole area + NCPaint(sw, hwnd, 1, 0); + } + else + { + //otherwise, just redraw the button in its new state + hdc = GetWindowDC(hwnd); + DrawScrollButton(&sb->sbButtons[uCurrentButton], hdc, &rect, SBBS_NORMAL); + ReleaseDC(hwnd, hdc); + } + + break; +#endif // INCLUDE_BUTTONS + + //The scrollbar is active + case HTSCROLL_LEFT: case HTSCROLL_RIGHT: + case HTSCROLL_PAGELEFT: case HTSCROLL_PAGERIGHT: + case HTSCROLL_NONE: + + KillTimer(hwnd, uScrollTimerId); + + case HTSCROLL_THUMB: + + //In case we were thumb tracking, make sure we stop NOW + if(sw->fThumbTracking == TRUE) + { + SendScrollMessage(hwnd, uScrollTimerMsg, SB_THUMBPOSITION, nLastPos); + sw->fThumbTracking = FALSE; + } + + //send the SB_ENDSCROLL message now that scrolling has finished + SendScrollMessage(hwnd, uScrollTimerMsg, SB_ENDSCROLL, 0); + + //adjust the total scroll area to become where the scrollbar + //really is (take into account the inserted buttons) + GetRealScrollRect(sb, &rect); + OffsetRect(&rect, -winrect.left, -winrect.top); + hdc = GetWindowDC(hwnd); + + //draw whichever scrollbar sb is + NCDrawScrollbar(sb, hwnd, hdc, &rect, HTSCROLL_NORMAL); + + ReleaseDC(hwnd, hdc); + break; + } + + //reset our state to default + uCurrentScrollPortion = HTSCROLL_NONE; + uScrollTimerPortion = HTSCROLL_NONE; + uScrollTimerId = 0; + + uScrollTimerMsg = 0; + uCurrentScrollbar = COOLSB_NONE; + + return 0; + } + else + { + /* + // Can't remember why I did this! + if(GetCapture() == hwnd) + { + ReleaseCapture(); + }*/ + } + + return CallWindowProc(sw->oldproc, hwnd, WM_LBUTTONUP, wParam, lParam); +} + +// +// This function is called whenever the mouse is moved and +// we are dragging the scrollbar thumb about. +// +static LRESULT ThumbTrackHorz(SCROLLBAR *sbar, HWND hwnd, int x, int y) +{ + POINT pt; + RECT rc, winrect, rc2; + COLORREF crCheck1 = GetSBForeColor(); + COLORREF crCheck2 = GetSBBackColor(); + HDC hdc; + int thumbpos = nThumbPos; + int pos; + int siMaxMin = 0; + UINT flatflag = sbar->fFlatScrollbar ? BF_FLAT : 0; + BOOL fCustomDraw = FALSE; + + SCROLLINFO *si; + si = &sbar->scrollInfo; + + pt.x = x; + pt.y = y; + + //draw the thumb at whatever position + rc = rcThumbBounds; + + SetRect(&rc2, rc.left - THUMBTRACK_SNAPDIST*2, rc.top - THUMBTRACK_SNAPDIST, + rc.right + THUMBTRACK_SNAPDIST*2, rc.bottom + THUMBTRACK_SNAPDIST); + + rc.left += GetScrollMetric(sbar, SM_CXHORZSB); + rc.right -= GetScrollMetric(sbar, SM_CXHORZSB); + + //if the mouse is not in a suitable distance of the scrollbar, + //then "snap" the thumb back to its initial position +#ifdef SNAP_THUMB_BACK + if (!PtInRect(&rc2, pt)) + { + thumbpos = nThumbPos0; + } + //otherwise, move the thumb to where the mouse is + else +#endif //SNAP_THUMB_BACK + { + //keep the thumb within the scrollbar limits + thumbpos = pt.x - nThumbMouseOffset; + if(thumbpos < rc.left) thumbpos = rc.left; + if(thumbpos > rc.right - nThumbSize) thumbpos = rc.right - nThumbSize; + } + + GetWindowRect(hwnd, &winrect); + + if(sbar->nBarType == SB_VERT) + RotateRect(&winrect); + + hdc = GetWindowDC(hwnd); + +//#ifdef CUSTOM_DRAW + fCustomDraw = PostCustomPrePostPaint(hwnd, hdc, sbar, CDDS_PREPAINT) == CDRF_SKIPDEFAULT; +//#endif + + OffsetRect(&rc, -winrect.left, -winrect.top); + thumbpos -= winrect.left; + + //draw the margin before the thumb + SetRect(&rc2, rc.left, rc.top, thumbpos, rc.bottom); + RotateRect0(sbar, &rc2); + + if(fCustomDraw) + PostCustomDrawNotify(hwnd, hdc, sbar->nBarType, &rc2, SB_PAGELEFT, 0, 0, 0); + else + DrawCheckedRect(hdc, &rc2, crCheck1, crCheck2); + + RotateRect0(sbar, &rc2); + + //draw the margin after the thumb + SetRect(&rc2, thumbpos+nThumbSize, rc.top, rc.right, rc.bottom); + + RotateRect0(sbar, &rc2); + + if(fCustomDraw) + PostCustomDrawNotify(hwnd, hdc, sbar->nBarType, &rc2, SB_PAGERIGHT, 0, 0, 0); + else + DrawCheckedRect(hdc, &rc2, crCheck1, crCheck2); + + RotateRect0(sbar, &rc2); + + //finally draw the thumb itelf. This is how it looks on win2000, anyway + SetRect(&rc2, thumbpos, rc.top, thumbpos+nThumbSize, rc.bottom); + + RotateRect0(sbar, &rc2); + + if(fCustomDraw) + PostCustomDrawNotify(hwnd, hdc, sbar->nBarType, &rc2, SB_THUMBTRACK, TRUE, TRUE, FALSE); + else + { + +#ifdef FLAT_SCROLLBARS + if(sbar->fFlatScrollbar) + PaintRect(hdc, &rc2, GetSysColor(COLOR_3DSHADOW)); + else +#endif + { + DrawBlankButton(hdc, &rc2, flatflag); + } + } + + RotateRect0(sbar, &rc2); + ReleaseDC(hwnd, hdc); + + //post a SB_TRACKPOS message!!! + siMaxMin = si->nMax - si->nMin; + + if(siMaxMin > 0) + pos = MulDiv(thumbpos-rc.left, siMaxMin-si->nPage + 1, rc.right-rc.left-nThumbSize); + else + pos = thumbpos - rc.left; + + if(pos != nLastPos) + { + si->nTrackPos = pos; + SendScrollMessage(hwnd, uScrollTimerMsg, SB_THUMBTRACK, pos); + } + + nLastPos = pos; + +//#ifdef CUSTOM_DRAW + PostCustomPrePostPaint(hwnd, hdc, sbar, CDDS_POSTPAINT); +//#endif + + return 0; +} + +// +// remember to rotate the thumb bounds rectangle!! +// +static LRESULT ThumbTrackVert(SCROLLBAR *sb, HWND hwnd, int x, int y) +{ + //sw->swapcoords = TRUE; + RotateRect(&rcThumbBounds); + ThumbTrackHorz(sb, hwnd, y, x); + RotateRect(&rcThumbBounds); + //sw->swapcoords = FALSE; + + return 0; +} + +// +// Called when we have set the capture from the NCLButtonDown(...) +// +static LRESULT MouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) +{ + RECT rect; + UINT thisportion; + HDC hdc; + static UINT lastportion = 0; + static UINT lastbutton = 0; + POINT pt; + RECT winrect; + UINT buttonIdx = 0; + + if(sw->fThumbTracking == TRUE) + { + int x, y; + lParam = GetMessagePos(); + x = LOWORD(lParam); + y = HIWORD(lParam); + + if(uCurrentScrollbar == SB_HORZ) + return ThumbTrackHorz(&sw->sbarHorz, hwnd, x,y); + + + else if(uCurrentScrollbar == SB_VERT) + return ThumbTrackVert(&sw->sbarVert, hwnd, x,y); + } + + if(uCurrentScrollPortion == HTSCROLL_NONE) + { + return CallWindowProc(sw->oldproc, hwnd, WM_MOUSEMOVE, wParam, lParam); + } + else + { + LPARAM nlParam; + SCROLLBAR *sb = &sw->sbarHorz; + SCROLLBUT *sbut = 0; + + nlParam = GetMessagePos(); + + GetWindowRect(hwnd, &winrect); + + pt.x = LOWORD(nlParam); + pt.y = HIWORD(nlParam); + + //emulate the mouse input on a scrollbar here... + if(uCurrentScrollbar == SB_HORZ) + { + sb = &sw->sbarHorz; + } + else if(uCurrentScrollbar == SB_VERT) + { + sb = &sw->sbarVert; + } + + //get the total area of the normal scrollbar area + GetScrollRect(sw, sb->nBarType, hwnd, &rect); + + //see if we clicked in the inserted buttons / normal scrollbar + //thisportion = GetPortion(sb, hwnd, &rect, LOWORD(lParam), HIWORD(lParam)); + thisportion = GetPortion(sb, hwnd, &rect, pt.x, pt.y); + + //we need to do different things depending on if the + //user is activating the scrollbar itself, or one of + //the inserted buttons + switch(uCurrentScrollPortion) + { +#ifdef INCLUDE_BUTTONS + //inserted buttons are being clicked + case HTSCROLL_INSERTED: + + //find the index of the button that has been clicked + //Don't adjust the rectangle though + buttonIdx = GetButtonFromPt(sb, &rect, pt, FALSE); + + //Get the rectangle of the active button + GetButtonRectFromId(sb, &rect, uCurrentButton); + + //if the button to the LEFT of the current + //button is resizable, then resize it +#ifdef RESIZABLE_BUTTONS + if(uCurrentButton > 0) + { + sbut = &sb->sbButtons[uCurrentButton - 1]; + + //only resize if BOTH buttons are on same side of scrollbar + if(sbut->uPlacement == (sbut+1)->uPlacement && (sbut->uButType & SBBM_RESIZABLE)) + { + int oldsize = sbut->nSize; + int butsize1, butsize2; + RECT rect2; + int scrollsize; + + if(uCurrentScrollbar == SB_HORZ) + { + rect.left -= GetSingleButSize(sb, sbut); + sbut->nSize = pt.x - rect.left; + } + else + { + rect.top -= GetSingleButSize(sb, sbut); + sbut->nSize = pt.y - rect.top; + } + + //if(sbut->nSize < 0) sbut->nSize = 0; + if(sbut->nSize < (int)sbut->nMinSize) + sbut->nSize = sbut->nMinSize; + + if ((UINT)sbut->nSize > (UINT)sbut->nMaxSize) + sbut->nSize = sbut->nMaxSize; + + GetScrollRect(sw, uCurrentScrollbar, hwnd, &rect2); + + if(uCurrentScrollbar == SB_HORZ) + scrollsize = rect2.right-rect2.left; + else + scrollsize = rect2.bottom-rect2.top; + + butsize1 = GetButtonSize(sb, hwnd, SBBP_LEFT); + butsize2 = GetButtonSize(sb, hwnd, SBBP_RIGHT); + + //adjust the button size if it gets too big + if(butsize1 + butsize2 > scrollsize - MINSCROLLSIZE) + { + sbut->nSize -= (butsize1+butsize2) - (scrollsize - MINSCROLLSIZE); + } + + //remember what size the USER set the button to + sbut->nSizeReserved = sbut->nSize; + NCPaint(sw, hwnd, (WPARAM)1, (LPARAM)0); + return 0; + } + } +#endif //RESIZABLE_BUTTONS + + OffsetRect(&rect, -winrect.left, -winrect.top); + + hdc = GetWindowDC(hwnd); + + //if the button under the mouse is not the active button, + //then display the active button in its normal state + if(buttonIdx != uCurrentButton + //include this if toggle buttons always stay depressed + //if they are being activated + && (sb->sbButtons[uCurrentButton].uButType & SBBT_MASK) != SBBT_TOGGLEBUTTON) + { + if(lastbutton != buttonIdx) + DrawScrollButton(&sb->sbButtons[uCurrentButton], hdc, &rect, SBBS_NORMAL); + } + //otherwise, depress the active button if the mouse is over + //it (just like a normal scroll button works) + else + { + if(lastbutton != buttonIdx) + DrawScrollButton(&sb->sbButtons[uCurrentButton], hdc, &rect, SBBS_PUSHED); + } + + ReleaseDC(hwnd, hdc); + return CallWindowProc(sw->oldproc, hwnd, WM_MOUSEMOVE, wParam, lParam); + //break; + +#endif //INCLUDE_BUTTONS + + //The scrollbar is active + case HTSCROLL_LEFT: case HTSCROLL_RIGHT:case HTSCROLL_THUMB: + case HTSCROLL_PAGELEFT: case HTSCROLL_PAGERIGHT: + case HTSCROLL_NONE: + + //adjust the total scroll area to become where the scrollbar + //really is (take into account the inserted buttons) + GetRealScrollRect(sb, &rect); + + OffsetRect(&rect, -winrect.left, -winrect.top); + hdc = GetWindowDC(hwnd); + + if(thisportion != uCurrentScrollPortion) + { + uScrollTimerPortion = HTSCROLL_NONE; + + if(lastportion != thisportion) + NCDrawScrollbar(sb, hwnd, hdc, &rect, HTSCROLL_NORMAL); + } + //otherwise, draw the button in its depressed / clicked state + else + { + uScrollTimerPortion = uCurrentScrollPortion; + + if(lastportion != thisportion) + NCDrawScrollbar(sb, hwnd, hdc, &rect, thisportion); + } + + ReleaseDC(hwnd, hdc); + + break; + } + + + lastportion = thisportion; + lastbutton = buttonIdx; + + //must return zero here, because we might get cursor anomilies + //CallWindowProc(sw->oldproc, hwnd, WM_MOUSEMOVE, wParam, lParam); + return 0; + + } +} + +#ifdef INCLUDE_BUTTONS +#ifdef RESIZABLE_BUTTONS +// +// Any resizable buttons must be shrunk to fit if the window is made too small +// +static void ResizeButtonsToFit(SCROLLWND *sw, SCROLLBAR *sbar, HWND hwnd) +{ + int butsize1, butsize2; + RECT rc; + int scrollsize; + int i; + SCROLLBUT *sbut; + + //make sure that the scrollbar can fit into space, by + //shrinking any resizable buttons + GetScrollRect(sw, sbar->nBarType, hwnd, &rc); + + if(sbar->nBarType == SB_HORZ) + scrollsize = rc.right-rc.left; + else + scrollsize = rc.bottom-rc.top; + + //restore any resizable buttons to their user-defined sizes, + //before shrinking them to fit. This means when we make the window + //bigger, the buttons will restore to their initial sizes + for (i = 0; i < sbar->nButtons; i++) + { + sbut = &sbar->sbButtons[i]; + if(sbut->uButType & SBBM_RESIZABLE) + { + sbut->nSize = sbut->nSizeReserved; + } + } + + butsize1 = GetButtonSize(sbar, hwnd, SBBP_LEFT); + butsize2 = GetButtonSize(sbar, hwnd, SBBP_RIGHT); + + if(butsize1 + butsize2 > scrollsize - MINSCROLLSIZE) + { + i = 0; + while(i < sbar->nButtons && + butsize1 + butsize2 > scrollsize - MINSCROLLSIZE) + { + sbut = &sbar->sbButtons[i++]; + if(sbut->uButType & SBBM_RESIZABLE) + { + int oldsize = sbut->nSize; + sbut->nSize -= (butsize1+butsize2) - (scrollsize-MINSCROLLSIZE); + + if(sbut->nSize < (int)sbut->nMinSize) + sbut->nSize = sbut->nMinSize; + + if ((UINT)sbut->nSize > (UINT)sbut->nMaxSize) + sbut->nSize = sbut->nMaxSize; + + + butsize1 -= (oldsize - sbut->nSize); + } + } + } + +} +#endif +#endif + +// +// We must allocate from in the non-client area for our scrollbars +// Call the default window procedure first, to get the borders (if any) +// allocated some space, then allocate the space for the scrollbars +// if they fit +// +static LRESULT NCCalcSize(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) +{ + NCCALCSIZE_PARAMS *nccsp; + RECT *rect; + RECT oldrect; + BOOL fCalcValidRects = (wParam == TRUE); + SCROLLBAR *sb; + LRESULT ret; + DWORD dwStyle; + + //Regardless of the value of fCalcValidRects, the first rectangle + //in the array specified by the rgrc structure member of the + //NCCALCSIZE_PARAMS structure contains the coordinates of the window, + //so we can use the exact same code to modify this rectangle, when + //wParam is TRUE and when it is FALSE. + nccsp = (NCCALCSIZE_PARAMS *)lParam; + rect = &nccsp->rgrc[0]; + oldrect = *rect; + + dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); + + // TURN OFF SCROLL-STYLES. + if ( dwStyle & (WS_VSCROLL|WS_HSCROLL)) + { + sw->bPreventStyleChange = TRUE; + SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle & ~(WS_VSCROLL|WS_HSCROLL)); + } + + //call the default procedure to get the borders allocated + ret = CallWindowProc(sw->oldproc, hwnd, WM_NCCALCSIZE, wParam, lParam); + + // RESTORE PREVIOUS STYLES (if present at all) + if ( dwStyle & (WS_VSCROLL|WS_HSCROLL)) + { + SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle); + sw->bPreventStyleChange = FALSE; + } + + // calculate what the size of each window border is, + sw->cxLeftEdge = rect->left - oldrect.left; + sw->cxRightEdge = oldrect.right - rect->right; + sw->cyTopEdge = rect->top - oldrect.top; + sw->cyBottomEdge = oldrect.bottom - rect->bottom; + + sb = &sw->sbarHorz; + + //if there is room, allocate some space for the horizontal scrollbar + //NOTE: Change the ">" to a ">=" to make the horz bar totally fill the + //window before disappearing + if ((sb->fScrollFlags & CSBS_VISIBLE) && +#ifdef COOLSB_FILLWINDOW + rect->bottom - rect->top >= GetScrollMetric(sb, SM_CYHORZSB)) +#else + rect->bottom - rect->top > GetScrollMetric(sb, SM_CYHORZSB)) +#endif + { + rect->bottom -= GetScrollMetric(sb, SM_CYHORZSB); + sb->fScrollVisible = TRUE; + } + else + sb->fScrollVisible = FALSE; + + sb = &sw->sbarVert; + + //if there is room, allocate some space for the vertical scrollbar + if ((sb->fScrollFlags & CSBS_VISIBLE) && + rect->right - rect->left >= GetScrollMetric(sb, SM_CXVERTSB)) + { + if(sw->fLeftScrollbar) + rect->left += GetScrollMetric(sb, SM_CXVERTSB); + else + rect->right -= GetScrollMetric(sb, SM_CXVERTSB); + + sb->fScrollVisible = TRUE; + } + else + sb->fScrollVisible = FALSE; + +#ifdef INCLUDE_BUTTONS +#ifdef RESIZABLE_BUTTONS + ResizeButtonsToFit(sw, &sw->sbarHorz, hwnd); + ResizeButtonsToFit(sw, &sw->sbarVert, hwnd); +#endif +#endif + + //don't return a value unless we actually modify the other rectangles + //in the NCCALCSIZE_PARAMS structure. In this case, we return 0 + //no matter what the value of fCalcValidRects is + return ret;//FALSE; +} + +// +// used for hot-tracking over the scroll buttons +// +static LRESULT NCMouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wHitTest, LPARAM lParam) +{ + //install a timer for the mouse-over events, if the mouse moves + //over one of the scrollbars +#ifdef HOT_TRACKING + hwndCurCoolSB = hwnd; + if(wHitTest == HTHSCROLL) + { + if(uMouseOverScrollbar == SB_HORZ) + return CallWindowProc(sw->oldproc, hwnd, WM_NCMOUSEMOVE, wHitTest, lParam); + + uLastHitTestPortion = HTSCROLL_NONE; + uHitTestPortion = HTSCROLL_NONE; + GetScrollRect(sw, SB_HORZ, hwnd, &MouseOverRect); + uMouseOverScrollbar = SB_HORZ; + uMouseOverId = SetTimer(hwnd, COOLSB_TIMERID3, COOLSB_TIMERINTERVAL3, 0); + + NCPaint(sw, hwnd, 1, 0); + } + else if(wHitTest == HTVSCROLL) + { + if(uMouseOverScrollbar == SB_VERT) + return CallWindowProc(sw->oldproc, hwnd, WM_NCMOUSEMOVE, wHitTest, lParam); + + uLastHitTestPortion = HTSCROLL_NONE; + uHitTestPortion = HTSCROLL_NONE; + GetScrollRect(sw, SB_VERT, hwnd, &MouseOverRect); + uMouseOverScrollbar = SB_VERT; + uMouseOverId = SetTimer(hwnd, COOLSB_TIMERID3, COOLSB_TIMERINTERVAL3, 0); + + NCPaint(sw, hwnd, 1, 0); + } + +#endif //HOT_TRACKING + return CallWindowProc(sw->oldproc, hwnd, WM_NCMOUSEMOVE, wHitTest, lParam); +} + +// +// Timer routine to generate scrollbar messages +// +static LRESULT CoolSB_Timer(SCROLLWND *swnd, HWND hwnd, WPARAM wTimerId, LPARAM lParam) +{ + //let all timer messages go past if we don't have a timer installed ourselves + if(uScrollTimerId == 0 && uMouseOverId == 0) + { + return CallWindowProc(swnd->oldproc, hwnd, WM_TIMER, wTimerId, lParam); + } + +#ifdef HOT_TRACKING + //mouse-over timer + if(wTimerId == COOLSB_TIMERID3) + { + POINT pt; + RECT rect, winrect; + HDC hdc; + SCROLLBAR *sbar; + + if(swnd->fThumbTracking) + return 0; + + //if the mouse moves outside the current scrollbar, + //then kill the timer.. + GetCursorPos(&pt); + + if (!PtInRect(&MouseOverRect, pt)) + { + KillTimer(hwnd, uMouseOverId); + uMouseOverId = 0; + uMouseOverScrollbar = COOLSB_NONE; + uLastHitTestPortion = HTSCROLL_NONE; + + uHitTestPortion = HTSCROLL_NONE; + NCPaint(swnd, hwnd, 1, 0); + } + else + { + if(uMouseOverScrollbar == SB_HORZ) + { + sbar = &swnd->sbarHorz; + uHitTestPortion = GetHorzPortion(sbar, hwnd, &MouseOverRect, pt.x, pt.y); + } + else + { + sbar = &swnd->sbarVert; + uHitTestPortion = GetVertPortion(sbar, hwnd, &MouseOverRect, pt.x, pt.y); + } + + if(uLastHitTestPortion != uHitTestPortion) + { + rect = MouseOverRect; + GetRealScrollRect(sbar, &rect); + + GetWindowRect(hwnd, &winrect); + OffsetRect(&rect, -winrect.left, -winrect.top); + + hdc = GetWindowDC(hwnd); + NCDrawScrollbar(sbar, hwnd, hdc, &rect, HTSCROLL_NONE); + ReleaseDC(hwnd, hdc); + } + + uLastHitTestPortion = uHitTestPortion; + } + + return 0; + } +#endif // HOT_TRACKING + + //if the first timer goes off, then we can start a more + //regular timer interval to auto-generate scroll messages + //this gives a slight pause between first pressing the scroll arrow, and the + //actual scroll starting + if(wTimerId == COOLSB_TIMERID1) + { + KillTimer(hwnd, uScrollTimerId); + uScrollTimerId = SetTimer(hwnd, COOLSB_TIMERID2, COOLSB_TIMERINTERVAL2, 0); + return 0; + } + //send the scrollbar message repeatedly + else if(wTimerId == COOLSB_TIMERID2) + { + //need to process a spoof WM_MOUSEMOVE, so that + //we know where the mouse is each time the scroll timer goes off. + //This is so we can stop sending scroll messages if the thumb moves + //under the mouse. + POINT pt; + GetCursorPos(&pt); + ScreenToClient(hwnd, &pt); + + MouseMove(swnd, hwnd, MK_LBUTTON, MAKELPARAM(pt.x, pt.y)); + + if(uScrollTimerPortion != HTSCROLL_NONE) + SendScrollMessage(hwnd, uScrollTimerMsg, uScrollTimerPortion, 0); + + return 0; + } + else + { + return CallWindowProc(swnd->oldproc, hwnd, WM_TIMER, wTimerId, lParam); + } +} + +// +// We must intercept any calls to SetWindowLongPtr, to check if +// left-scrollbars are taking effect or not +// +static LRESULT CoolSB_StyleChange(SCROLLWND *swnd, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + STYLESTRUCT *ss = (STYLESTRUCT *)lParam; + + if(wParam == GWL_EXSTYLE) + { + if(ss->styleNew & WS_EX_LEFTSCROLLBAR) + swnd->fLeftScrollbar = TRUE; + else + swnd->fLeftScrollbar = FALSE; + } + + return CallWindowProc(swnd->oldproc, hwnd, msg, wParam, lParam); +} + +static UINT curTool = -1; +static LRESULT CoolSB_Notify(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARAM lParam) +{ +#ifdef COOLSB_TOOLTIPS + + NMTTDISPINFO *nmdi = (NMTTDISPINFO *)lParam; + + if(nmdi->hdr.hwndFrom == swnd->hwndToolTip && + nmdi->hdr.code == TTN_GETDISPINFO) + { + //convert the tooltip notify from a "ISHWND" style + //request to an id-based request. + //We do this because our tooltip is a window-style + //tip, with no tools, and the GETDISPINFO request must + //indicate which button to retrieve the text for + //nmdi->hdr.idFrom = curTool; + nmdi->hdr.idFrom = curTool; + nmdi->hinst = GetModuleHandle(0); + nmdi->uFlags &= ~TTF_IDISHWND; + } +#endif //COOLSB_TOOLTIPS + + return CallWindowProc(swnd->oldproc, hwnd, WM_NOTIFY, wParam, lParam); +} + +static LRESULT SendToolTipMessage0(HWND hwndTT, UINT message, WPARAM wParam, LPARAM lParam) +{ + return SendMessage(hwndTT, message, wParam, lParam); +} + +#ifdef COOLSB_TOOLTIPS +#define SendToolTipMessage SendToolTipMessage0 +#else +#define SendToolTipMessage 1 ? (void)0 : SendToolTipMessage0 +#endif + + +// +// We must intercept any calls to SetWindowLongPtr, to make sure that +// the user does not set the WS_VSCROLL or WS_HSCROLL styles +// +static LRESULT CoolSB_SetCursor(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARAM lParam) +{ +#ifdef INCLUDE_BUTTONS + UINT lo = LOWORD(lParam); + UINT hi = HIWORD(lParam); + UINT xy; + RECT rect; + SCROLLBAR *sbar; + SCROLLBUT *sbut; + POINT pt; + UINT id; + static UINT lastid; + +#ifdef HIDE_CURSOR_AFTER_MOUSEUP + static UINT lastmsg; + if(lastmsg == WM_LBUTTONDOWN) + { + lastmsg = hi; + return CallWindowProc(swnd->oldproc, hwnd, WM_SETCURSOR, wParam, lParam); + } + else + lastmsg = hi; +#endif + + //if we are over either or our scrollbars + if(lo == HTHSCROLL || lo == HTVSCROLL) + { + xy = GetMessagePos(); + pt.x = LOWORD(xy); + pt.y = HIWORD(xy); + + if(lo == HTHSCROLL) + { + sbar = &swnd->sbarHorz; + GetScrollRect(swnd, SB_HORZ, hwnd, &rect); + id = GetHorzPortion(sbar, hwnd, &rect, pt.x, pt.y); + } + else + { + sbar = &swnd->sbarVert; + GetScrollRect(swnd, SB_VERT, hwnd, &rect); + id = GetVertPortion(sbar, hwnd, &rect, pt.x, pt.y); + } + + if(id != HTSCROLL_INSERTED) + { + if(swnd->hwndToolTip != 0) + { + SendToolTipMessage(swnd->hwndToolTip, TTM_ACTIVATE, FALSE, 0); + SendToolTipMessage(swnd->hwndToolTip, TTM_POP, 0, 0); + } + + return CallWindowProc(swnd->oldproc, hwnd, WM_SETCURSOR, wParam, lParam); + } + + if(swnd->hwndToolTip != 0) + { + SendToolTipMessage(swnd->hwndToolTip, TTM_ACTIVATE, TRUE, 0); + } + + //set the cursor if one has been specified + if ((id = GetButtonFromPt(sbar, &rect, pt, TRUE)) != -1) + { + sbut = &sbar->sbButtons[id]; + curTool = sbut->uCmdId; + + if(lastid != id && swnd->hwndToolTip != 0) + { + if(IsWindowVisible(swnd->hwndToolTip)) + SendToolTipMessage(swnd->hwndToolTip, TTM_UPDATE, TRUE, 0); + } + + lastid = id; + + if(sbut->hCurs != 0) + { + SetCursor(sbut->hCurs); + return 0; + } + } + else + { + curTool = -1; + lastid = -1; + } + } + else if(swnd->hwndToolTip != 0) + { + SendToolTipMessage(swnd->hwndToolTip, TTM_ACTIVATE, FALSE, 0); + SendToolTipMessage(swnd->hwndToolTip, TTM_POP, 0, 0); + } + +#endif //INCLUDE_BUTTONS + return CallWindowProc(swnd->oldproc, hwnd, WM_SETCURSOR, wParam, lParam); +} + + +// +// Send the specified message to the tooltip control +// +static void __stdcall RelayMouseEvent(HWND hwnd, HWND hwndToolTip, UINT event) +{ +#ifdef COOLSB_TOOLTIPS + MSG msg; + + CoolSB_ZeroMemory(&msg, sizeof(MSG)); + msg.hwnd = hwnd; + msg.message = event; + + SendMessage(hwndToolTip, TTM_RELAYEVENT, 0, (LONG)&msg); +#else + UNREFERENCED_PARAMETER(hwnd); + UNREFERENCED_PARAMETER(hwndToolTip); + UNREFERENCED_PARAMETER(event); +#endif +} + + +// +// CoolScrollbar subclass procedure. +// Handle all messages needed to mimick normal windows scrollbars +// +LRESULT CALLBACK CoolSBWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + WNDPROC oldproc; + SCROLLWND *swnd = GetScrollWndFromHwnd(hwnd); + static int count; + + switch(message) + { + case WM_NCDESTROY: + //this should NEVER be called, because the user + //should have called Uninitialize() themselves. + + //However, if the user tries to call Uninitialize().. + //after this window is destroyed, this window's entry in the lookup + //table will not be there, and the call will fail + oldproc = swnd->oldproc; + UninitializeCoolSB(hwnd); + + //we must call the original window procedure, otherwise it + //will never get the WM_NCDESTROY message, and it wouldn't + //be able to clean up etc. + return CallWindowProc(oldproc, hwnd, message, wParam, lParam); + + case WM_NCCALCSIZE: + return NCCalcSize(swnd, hwnd, wParam, lParam); + + case WM_NCPAINT: + return NCPaint(swnd, hwnd, wParam, lParam); + + case WM_NCHITTEST: + return NCHitTest(swnd, hwnd, wParam, lParam); + + case WM_NCRBUTTONDOWN: case WM_NCRBUTTONUP: + case WM_NCMBUTTONDOWN: case WM_NCMBUTTONUP: + RelayMouseEvent(hwnd, swnd->hwndToolTip, (WM_MOUSEMOVE-WM_NCMOUSEMOVE) + (message)); + if(wParam == HTHSCROLL || wParam == HTVSCROLL) + return 0; + else + break; + + case WM_NCLBUTTONDBLCLK: + //TRACE("WM_NCLBUTTONDBLCLK %d\n", count++); + if(wParam == HTHSCROLL || wParam == HTVSCROLL) + return NCLButtonDown(swnd, hwnd, wParam, lParam); + else + break; + + case WM_NCLBUTTONDOWN: + //TRACE("WM_NCLBUTTONDOWN%d\n", count++); + RelayMouseEvent(hwnd, swnd->hwndToolTip, WM_LBUTTONDOWN); + return NCLButtonDown(swnd, hwnd, wParam, lParam); + + + case WM_LBUTTONUP: + //TRACE("WM_LBUTTONUP %d\n", count++); + RelayMouseEvent(hwnd, swnd->hwndToolTip, WM_LBUTTONUP); + return LButtonUp(swnd, hwnd, wParam, lParam); + + case WM_NOTIFY: + return CoolSB_Notify(swnd, hwnd, wParam, lParam); + + //Mouse moves are received when we set the mouse capture, + //even when the mouse moves over the non-client area + case WM_MOUSEMOVE: + //TRACE("WM_MOUSEMOVE %d\n", count++); + return MouseMove(swnd, hwnd, wParam, lParam); + + case WM_TIMER: + return CoolSB_Timer(swnd, hwnd, wParam, lParam); + + //case WM_STYLECHANGING: + // return CoolSB_StyleChange(swnd, hwnd, WM_STYLECHANGING, wParam, lParam); + case WM_STYLECHANGED: + + if(swnd->bPreventStyleChange) + { + // the NCPAINT handler has told us to eat this message! + return 0; + } + else + { + if (message == WM_STYLECHANGED) + return CoolSB_StyleChange(swnd, hwnd, WM_STYLECHANGED, wParam, lParam); + else + break; + } + + case WM_NCMOUSEMOVE: + { + static LONG_PTR lastpos = -1; + + //TRACE("WM_NCMOUSEMOVE %d\n", count++); + + //The problem with NCMOUSEMOVE is that it is sent continuously + //even when the mouse is stationary (under win2000 / win98) + // + //Tooltips don't like being sent a continous stream of mouse-moves + //if the cursor isn't moving, because they will think that the mouse + //is moving position, and the internal timer will never expire + // + if(lastpos != lParam) + { + RelayMouseEvent(hwnd, swnd->hwndToolTip, WM_MOUSEMOVE); + lastpos = lParam; + } + } + + return NCMouseMove(swnd, hwnd, wParam, lParam); + + + case WM_SETCURSOR: + return CoolSB_SetCursor(swnd, hwnd, wParam, lParam); + + case WM_CAPTURECHANGED: + break; + + default: + break; + } + + return CallWindowProc(swnd->oldproc, hwnd, message, wParam, lParam); +} + diff --git a/plugins/Clist_nicer/SRC/Coolsb/coolscroll.h b/plugins/Clist_nicer/SRC/Coolsb/coolscroll.h new file mode 100644 index 0000000000..c5fe848a83 --- /dev/null +++ b/plugins/Clist_nicer/SRC/Coolsb/coolscroll.h @@ -0,0 +1,232 @@ +#ifndef _COOLSBLIB_INCLUDED +#define _COOLSBLIB_INCLUDED + +#ifdef __cplusplus +extern "C"{ +#endif + +#include +#include + +// To complement the exisiting SB_HORZ, SB_VERT, SB_BOTH +// scrollbar identifiers +#define COOLSB_NONE (-1) +#define SB_INSBUT (-2) + +// +// Arrow size defines +// +#define SYSTEM_METRIC (-1) + + +// +// general scrollbar styles +// +// use the standard ESB_DISABLE_xxx flags to represent the +// enabled / disabled states. (defined in winuser.h) +// +#define CSBS_THUMBALWAYS 4 +#define CSBS_VISIBLE 8 + +//cool scrollbar styles for Flat scrollbars +#define CSBS_NORMAL 0 +#define CSBS_FLAT 1 +#define CSBS_HOTTRACKED 2 + +// +// Button mask flags for indicating which members of SCROLLBUT +// to use during a button insertion / modification +// +#define SBBF_TYPE 0x0001 +#define SBBF_ID 0x0002 +#define SBBF_PLACEMENT 0x0004 +#define SBBF_SIZE 0x0008 +#define SBBF_BITMAP 0x0010 +#define SBBF_ENHMETAFILE 0x0020 +//#define SBBF_OWNERDRAW 0x0040 //unused at present +#define SBBF_CURSOR 0x0080 +#define SBBF_BUTMINMAX 0x0100 +#define SBBF_STATE 0x0200 + +//button styles (states) +#define SBBS_NORMAL 0 +#define SBBS_PUSHED 1 +#define SBBS_CHECKED SBBS_PUSHED + +// +// scrollbar button types +// +#define SBBT_PUSHBUTTON 1 //standard push button +#define SBBT_TOGGLEBUTTON 2 //toggle button +#define SBBT_FIXED 3 //fixed button (non-clickable) +#define SBBT_FLAT 4 //blank area (flat, with border) +#define SBBT_BLANK 5 //blank area (flat, no border) +#define SBBT_DARK 6 //dark blank area (flat) +#define SBBT_OWNERDRAW 7 //user draws the button via a WM_NOTIFY + +#define SBBT_MASK 0x1f //mask off low 5 bits + +//button type modifiers +#define SBBM_RECESSED 0x0020 //recessed when clicked (like Word 97) +#define SBBM_LEFTARROW 0x0040 +#define SBBM_RIGHTARROW 0x0080 +#define SBBM_UPARROW 0x0100 +#define SBBM_DOWNARROW 0x0200 +#define SBBM_RESIZABLE 0x0400 +#define SBBM_TYPE2 0x0800 +#define SBBM_TYPE3 0x1000 +#define SBBM_TOOLTIPS 0x2000 //currently unused (define COOLSB_TOOLTIPS in userdefs.h) + +//button placement flags +#define SBBP_LEFT 1 +#define SBBP_RIGHT 2 +#define SBBP_TOP 1 //3 +#define SBBP_BOTTOM 2 //4 + + +// +// Button command notification codes +// for sending with a WM_COMMAND message +// +#define CSBN_BASE 0 +#define CSBN_CLICKED (1 + CSBN_BASE) +#define CSBN_HILIGHT (2 + CSBN_BASE) + +// +// Minimum size in pixels of a scrollbar thumb +// +#define MINTHUMBSIZE_NT4 8 +#define MINTHUMBSIZE_2000 6 + +//define some more hittest values for our cool-scrollbar +#define HTSCROLL_LEFT (SB_LINELEFT) +#define HTSCROLL_RIGHT (SB_LINERIGHT) +#define HTSCROLL_UP (SB_LINEUP) +#define HTSCROLL_DOWN (SB_LINEDOWN) +#define HTSCROLL_THUMB (SB_THUMBTRACK) +#define HTSCROLL_PAGEGUP (SB_PAGEUP) +#define HTSCROLL_PAGEGDOWN (SB_PAGEDOWN) +#define HTSCROLL_PAGELEFT (SB_PAGELEFT) +#define HTSCROLL_PAGERIGHT (SB_PAGERIGHT) + +#define HTSCROLL_NONE (-1) +#define HTSCROLL_NORMAL (-1) + +#define HTSCROLL_INSERTED (128) +#define HTSCROLL_PRE (32 | HTSCROLL_INSERTED) +#define HTSCROLL_POST (64 | HTSCROLL_INSERTED) + +/* + + Public interface to the Cool Scrollbar library + + +*/ + +BOOL WINAPI InitializeCoolSB(HWND hwnd); +HRESULT WINAPI UninitializeCoolSB (HWND hwnd); + +BOOL WINAPI CoolSB_SetMinThumbSize(HWND hwnd, UINT wBar, UINT size); +BOOL WINAPI CoolSB_IsThumbTracking(HWND hwnd); +BOOL WINAPI CoolSB_IsCoolScrollEnabled(HWND hwnd); + +// +BOOL WINAPI CoolSB_EnableScrollBar (HWND hwnd, int wSBflags, UINT wArrows); +BOOL WINAPI CoolSB_GetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi); +int WINAPI CoolSB_GetScrollPos (HWND hwnd, int nBar); +BOOL WINAPI CoolSB_GetScrollRange (HWND hwnd, int nBar, LPINT lpMinPos, LPINT lpMaxPos); + +// +int WINAPI CoolSB_SetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL fRedraw); +int WINAPI CoolSB_SetScrollPos (HWND hwnd, int nBar, int nPos, BOOL fRedraw); +int WINAPI CoolSB_SetScrollRange (HWND hwnd, int nBar, int nMinPos, int nMaxPos, BOOL fRedraw); +BOOL WINAPI CoolSB_ShowScrollBar (HWND hwnd, int wBar, BOOL fShow); + +// +// Scrollbar dimension functions +// +BOOL WINAPI CoolSB_SetSize (HWND hwnd, int wBar, int nLength, int nWidth); + +// +// Set the visual nature of a scrollbar (flat, normal etc) +// +BOOL WINAPI CoolSB_SetStyle (HWND hwnd, int wBar, UINT nStyle); +BOOL WINAPI CoolSB_SetThumbAlways (HWND hwnd, int wBar, BOOL fThumbAlways); + +// +// Scrollbar button structure, for inserted buttons only +// +typedef struct +{ + UINT fMask; //which members are in use + UINT uPlacement; //is this button to the left/right (above/below) of the scrollbar?? + UINT uCmdId; //command identifier (WM_COMMAND value to send) + UINT uButType; // + UINT uState; //toggled etc + int nSize; //size in pixels. -1 for autosize + + HBITMAP hBmp; //handle to a bitmap to use as the button face + HENHMETAFILE hEmf; //handle to an enhanced metafile + + HCURSOR hCurs; //handle to a user-supplied mouse cursor to apply + //to this button + + int nSizeReserved; //internal variable used for resizing + int nMinSize; //min size + int nMaxSize; //max size + +} SCROLLBUT; + +BOOL WINAPI CoolSB_InsertButton(HWND hwnd, int wSBflags, UINT nPos, SCROLLBUT *psb); +BOOL WINAPI CoolSB_ModifyButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, SCROLLBUT *psb); +BOOL WINAPI CoolSB_RemoveButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd); +BOOL WINAPI CoolSB_GetButton (HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, SCROLLBUT *psb); + +void WINAPI CoolSB_SetESBProc(void *proc); + +typedef struct +{ + NMHDR hdr; + DWORD dwDrawStage; + HDC hdc; + RECT rect; + UINT uItem; + UINT uState; + UINT nBar; + +} NMCSBCUSTOMDRAW; + +typedef struct +{ + NMHDR hdr; + RECT rect; + POINT pt; + UINT uCmdId; + UINT uState; + int nBar; +} NMCOOLBUTMSG; + +/* +typedef struct +{ + NMHDR hdr; + DWORD dwDrawStage; + HDC hdc; + RECT rect; + UINT uCmdId; + UINT uState; + +} NMCOOLBUTTON_CUSTOMDRAW; +*/ + + +// +// Define the WM_NOTIFY code value for cool-scrollbar custom drawing +// +#define NM_COOLSB_CUSTOMDRAW (0-0xfffU) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/plugins/Clist_nicer/SRC/Coolsb/userdefs.h b/plugins/Clist_nicer/SRC/Coolsb/userdefs.h new file mode 100644 index 0000000000..ea7ea1fe92 --- /dev/null +++ b/plugins/Clist_nicer/SRC/Coolsb/userdefs.h @@ -0,0 +1,79 @@ +#ifndef _USERDEFINES_INCLUDED +#define _USERDEFINES_INCLUDED + +/* + + Define these values to alter the various + features of the coolscroll library. If you don't want + a certain feature, then you might be able to reduce the + size of your app by a few kb... + +*/ + +/* allow inserted buttons. Without this, all button code will + be excluded, resulting in a smaller build (about 4kb less). This + may not seem much, but it is a 25% reduction! */ +//#define INCLUDE_BUTTONS + +/* Allow user-resizable buttons. Makes no difference if INCLUDE_BUTTONS + is not defined for the project */ +#define RESIZABLE_BUTTONS + +/* Include tooltip support for inserted buttons. Without this, no + tooltip requests (TTN_GETDISPINFO's) will be sent to the window */ +//#define COOLSB_TOOLTIPS + +/* Define this to include the custom-draw support */ +#define CUSTOM_DRAW + +/* Define to enable WM_NOTIFY messages to be sent for mouse event */ +#define NOTIFY_MOUSE + +/* Define this value to make the horizontal scrollbar stay visible even + if the window is sized to small vertically. Normal scrollbars always leave + a 1-pixel line of "client" area before hiding the horizontal scrollbar. This + value allows the window to be sized so the client area totally disappears if + sized too small */ +//#define COOLSB_FILLWINDOW + +/* minimum size of scrollbar before inserted buttons are + hidden to make room when the window is sized too small */ +#define MIN_COOLSB_SIZE 24 + +/* min size of scrollbar when resizing a button, before the + resize is stopped because the scrollbar has gotten too small */ +#define MINSCROLLSIZE 50 + +/* define this to display the default mouse arrow whenever the + the mouse is released over a button which has a user-defined cursor. + not really very useful, just provides a different type of feedback */ +#undef HIDE_CURSOR_AFTER_MOUSEUP + +/* enable HOT_TRACKING to provide visual feedback when the mouse + moves over a scrollbar area (like Flat Scrollbars) */ +#define HOT_TRACKING + +/* enable FLAT_SCROLLBARS to include support for flat scrollbars + note that they must be enabled by the user first of all */ +#define FLAT_SCROLLBARS + +/* a normal scrollbar "snaps" its scroll-thumb back into position if + you move the mouse too far away from the window, whilst you are + dragging the thumb, that is. #undeffing this results in the thumb + never snapping back into position, no matter how far away you move + the mouse */ +#define SNAP_THUMB_BACK + +/* distance (in pixels) the mouse must move away from the thumb + during tracking to cause the thumb bar to snap back to its + starting place. Has no effect unless SNAP_THUMB_BACK is defined */ +#define THUMBTRACK_SNAPDIST 24 + +/* maximum number of inserted buttons per bar */ +#define MAX_COOLSB_BUTS 16 + +/* maximum number of coolsb windows per application. + Set to lower if you don't need many. */ +#define MAX_COOLSB 4 + +#endif /* _USERDEFINES_INCLUDED */ \ No newline at end of file diff --git a/plugins/Clist_nicer/SRC/Include/alphablend.h b/plugins/Clist_nicer/SRC/Include/alphablend.h new file mode 100644 index 0000000000..de0e7c4fa8 --- /dev/null +++ b/plugins/Clist_nicer/SRC/Include/alphablend.h @@ -0,0 +1,30 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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. +*/ + +void __inline gradientVertical(UCHAR *ubRedFinal, UCHAR *ubGreenFinal, UCHAR *ubBlueFinal, + ULONG ulBitmapHeight, UCHAR ubRed, UCHAR ubGreen, UCHAR ubBlue, UCHAR ubRed2, + UCHAR ubGreen2, UCHAR ubBlue2, DWORD FLG_GRADIENT, BOOL transparent, UINT32 y, UCHAR *ubAlpha); + +void __inline gradientHorizontal( UCHAR *ubRedFinal, UCHAR *ubGreenFinal, UCHAR *ubBlueFinal, + ULONG ulBitmapWidth, UCHAR ubRed, UCHAR ubGreen, UCHAR ubBlue, UCHAR ubRed2, + UCHAR ubGreen2, UCHAR ubBlue2, DWORD FLG_GRADIENT, BOOL transparent, UINT32 x, UCHAR *ubAlpha); \ No newline at end of file diff --git a/plugins/Clist_nicer/SRC/Include/clc.h b/plugins/Clist_nicer/SRC/Include/clc.h new file mode 100644 index 0000000000..879fc52553 --- /dev/null +++ b/plugins/Clist_nicer/SRC/Include/clc.h @@ -0,0 +1,632 @@ +/* + * astyle --force-indent=tab=4 --brackets=linux --indent-switches + * --pad=oper --one-line=keep-blocks --unpad=paren + * + * Miranda IM: the free IM client for Microsoft* Windows* + * + * Copyright 2000-2010 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. + * + * part of clist_nicer plugin for Miranda. + * + * (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors + * + * $Id: clc.h 13850 2011-09-10 03:26:59Z borkra $ + * + */ + +#define MAXEXTRACOLUMNS 16 + +#define INTM_XSTATUSCHANGED (WM_USER+26) +#define INTM_METACHANGEDEVENT (WM_USER+27) +#define INTM_CODEPAGECHANGED (WM_USER+28) +//#define INTM_CLIENTCHANGED (WM_USER+29) +#define INTM_AVATARCHANGED (WM_USER+30) +#define INTM_STATUSMSGCHANGED (WM_USER+31) +#define INTM_SORTCLC (WM_USER+32) +#define INTM_STATUSCHANGED (WM_USER+33) +#define INTM_METACHANGED (WM_USER+34) +#define INTM_INVALIDATECONTACT (WM_USER+35) +#define INTM_FORCESORT (WM_USER+36) + +#define DEFAULT_TITLEBAR_HEIGHT 18 + +#define CLS_SKINNEDFRAME 0x0800 //this control will be the main contact list (v. 0.3.4.3+ 2004/11/02) + +#define TIMERID_RENAME 10 +#define TIMERID_DRAGAUTOSCROLL 11 +#define TIMERID_INFOTIP 13 +#define TIMERID_SORT 15 +#define TIMERID_REFRESH 18 +#define TIMERID_PAINT 19 +struct 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_STICKY 64 +#define CONTACTF_PRIORITY 128 + +#define STATUSMSG_XSTATUSID 1 +#define STATUSMSG_XSTATUSNAME 2 +#define STATUSMSG_CLIST 4 +#define STATUSMSG_YIM 8 +#define STATUSMSG_GG 16 +#define STATUSMSG_XSTATUS 32 + +#define STATUSMSG_NOTFOUND 0 + +#define SMSG_MAXLEN 700 + +#define EXTRAIMAGECACHESIZE 1000 + +// extra cache contact flags + +#define ECF_RTLNICK 1 +#define ECF_RTLSTATUSMSG 2 +#define ECF_FORCEAVATAR 4 +#define ECF_HIDEAVATAR 8 +#define ECF_FORCEOVERLAY 16 +#define ECF_HIDEOVERLAY 32 +#define ECF_FORCELOCALTIME 64 +#define ECF_HIDELOCALTIME 128 +#define ECF_FORCEVISIBILITY 256 +#define ECF_HIDEVISIBILITY 512 +#define ECF_HASREALTIMEZONE 1024 + +// other contact flags (struct ClCContact; + +#define ECF_AVATAR 1 +#define ECF_SECONDLINE 2 + +struct ContactFloater { + struct ContactFloater *pNextFloater; + HWND hwnd; + HDC hdc; + HBITMAP hbm, hbmOld; + HANDLE hContact; +}; + +typedef struct ContactFloater CONTACTFLOATER; + +#define DSPF_CENTERSTATUSICON 1 +#define DSPF_DIMIDLE 2 +#define DSPF_NOFFLINEAVATARS 4 +#define DSPF_SHOWLOCALTIME 8 +#define DSPF_LOCALTIMESELECTIVE 16 +#define DSPF_DONTSEPARATEOFFLINE 32 +#define DSPF_CENTERGROUPNAMES 64 + +#define EXICON_COUNT 11 + +/* Extra icons settings */ +typedef struct _OrderTreeData +{ + BYTE ID; + const TCHAR * Name; + BYTE Position; + BOOL Visible; + BOOL fReserved; +} *PORDERTREEDATA, ORDERTREEDATA; + +struct DisplayProfile +{ + DWORD dwFlags; + DWORD dwExtraImageMask; + int exIconScale; + BOOL bCenterStatusIcons; + BOOL bDimIdle, bNoOfflineAvatars, bShowLocalTime, bShowLocalTimeSelective, bDontSeparateOffline, bCenterGroupNames; + BYTE dualRowMode; + COLORREF avatarBorder; + DWORD avatarRadius; + int avatarSize; + DWORD clcExStyle; + DWORD clcOfflineModes; + BYTE sortOrder[3], bUseDCMirroring, bGroupAlign; + BYTE avatarPadding; + BYTE bLeftMargin, bRightMargin, bRowSpacing, bGroupIndent, bRowHeight, bGroupRowHeight; + BYTE exIconOrder[EXICON_COUNT]; +}; +typedef struct DisplayProfile DISPLAYPROFILE; + +/* + * a set of 4 (online, offline, selected, hottracked) display profiles + */ + +struct DisplayProfileSet { + UINT uID; + TCHAR tszName[60]; + DISPLAYPROFILE dp[4]; +}; +typedef struct DisplayProfileSet DISPLAYPROFILESET; + +#define DSP_PROFILES_MODULE "CLN_DspProfiles" // db module for display profiles + +struct TExtraCache +{ + BYTE iExtraImage[MAXEXTRACOLUMNS]; + HANDLE hContact; + HANDLE hTimeZone; + DWORD iExtraValid; + BYTE valid; + TCHAR *statusMsg; + BYTE bStatusMsgValid; + DWORD dwCFlags; + DWORD dwDFlags; // display flags for caching only + DWORD dwXMask; // local extra icon mask, calculated from CLN_xmask + StatusItems_t *status_item, *proto_status_item; + CONTACTFLOATER *floater; + DWORD dwLastMsgTime; + DWORD msgFrequency; + BOOL isChatRoom; +}; + +struct ClcContact : public ClcContactBase +{ + BOOL bIsMeta; + HANDLE hSubContact; + BYTE xStatus; + char *metaProto; + DWORD codePage; + struct avatarCacheEntry *ace; + WORD wStatus; + int extraCacheEntry; + int avatarLeft, extraIconRightBegin; + int isRtl; + DWORD cFlags; + BYTE bSecondLine; +}; + +#define DRAGSTAGE_NOTMOVED 0 +#define DRAGSTAGE_ACTIVE 1 +#define DRAGSTAGEM_STAGE 0x00FF +#define DRAGSTAGEF_MAYBERENAME 0x8000 +#define DRAGSTAGEF_OUTSIDE 0x4000 + +#define FONTID_CONTACTS 0 +#define FONTID_INVIS 1 +#define FONTID_OFFLINE 2 +#define FONTID_NOTONLIST 3 +#define FONTID_GROUPS 4 +#define FONTID_GROUPCOUNTS 5 +#define FONTID_DIVIDERS 6 +#define FONTID_OFFINVIS 7 +#define FONTID_STATUS 8 +#define FONTID_FRAMETITLE 9 +#define FONTID_EVENTAREA 10 +#define FONTID_TIMESTAMP 11 +#define FONTID_LAST FONTID_TIMESTAMP + +struct ClcData : public ClcDataBase +{ + int *row_heights; + int row_heights_size; + int row_heights_allocated; + + int row_border; + int min_row_heigh, group_row_height; + + int currentFontID; + int rightMargin; + BYTE SelectMode; + BYTE isMultiSelect; + HWND hwndParent; + DWORD lastSort; + BOOL bNeedPaint, bisEmbedded, bHideSubcontacts; + DWORD lastRepaint; + BOOL forceScroll; + int oldSelection; +}; + +//#define CLUI_FRAME_SHOWTOPBUTTONS 1 +#define CLUI_FRAME_SHOWBOTTOMBUTTONS 2 +#define CLUI_SHOWCLIENTICONS 4 +#define CLUI_SHOWVISI 8 +#define CLUI_FRAME_CLISTSUNKEN 16 +#define CLUI_SHOWXSTATUS 32 +#define CLUI_FRAME_BUTTONSFLAT 64 +#define CLUI_FRAME_BUTTONSCLASSIC 128 +#define CLUI_USEMETAICONS 256 +#define CLUI_FRAME_AUTOHIDENOTIFY 512 +#define CLUI_FRAME_USEXSTATUSASSTATUS 1024 +#define CLUI_STICKYEVENTS 2048 +#define CLUI_FRAME_SBARSHOW 4096 +#define CLUI_STATUSASTEXT 8192 +#define CLUI_FULLROWSELECT 16384 +#define CLUI_FRAME_EVENTAREASUNKEN 32768 +//#define CLUI_FRAME_BUTTONBARSUNKEN 65536 +#define CLUI_FRAME_AVATARS 0x20000 +#define CLUI_FRAME_AVATARSLEFT 0x40000 +#define CLUI_FRAME_GDIPLUS 0x80000 +#define CLUI_FRAME_AVATARBORDER 0x100000 +#define CLUI_FRAME_STATUSICONS 0x200000 +#define CLUI_FRAME_AVATARSRIGHTWITHNICK 0x400000 +#define CLUI_FRAME_TRANSPARENTAVATAR 0x800000 +#define CLUI_FRAME_ROUNDAVATAR 0x1000000 +#define CLUI_FRAME_ALWAYSALIGNNICK 0x2000000 +#define CLUI_FRAME_AVATARSRIGHT 0x4000000 +#define CLUI_FRAME_SHOWSTATUSMSG 0x8000000 +#define CLUI_FRAME_OVERLAYICONS 0x10000000 +#define CLUI_FRAME_SELECTIVEICONS 0x20000000 +#define CLUI_FRAME_ROUNDEDFRAME 0x40000000 +#define CLUI_FRAME_NOGROUPICON 0x80000000 + +#define MULTIROW_NEVER 0 +#define MULTIROW_ALWAYS 1 +#define MULTIROW_IFSPACE 2 +#define MULTIROW_IFNEEDED 3 + +#define CLUI_USE_FLOATER 1 +#define CLUI_FLOATER_AUTOHIDE 2 +#define CLUI_FLOATER_EVENTS 4 + +#define CLC_GROUPALIGN_LEFT 0 +#define CLC_GROUPALIGN_RIGHT 1 +#define CLC_GROUPALIGN_AUTO 2 + +struct TCluiData { + DWORD dwFlags; + DWORD topOffset, bottomOffset; + int statusBarHeight; + int soundsOff; + BYTE tabSRMM_Avail; + BYTE bMetaAvail; + BYTE bAvatarServiceAvail; + HICON hIconVisible, hIconInvisible, hIconChatactive, hIconConnecting; + DWORD winFlags; + DWORD winFlagsEx; + int notifyActive; + int hIconNotify; + HMENU hMenuNotify; + int iLastEventAdded; + int wNextMenuID; + HANDLE hUpdateContact; + DWORD sortTimer; + TCHAR *szNoEvents; + BOOL forceResize; + BOOL neeedSnap; + COLORREF avatarBorder; + HBRUSH hBrushAvatarBorder, hBrushColorKey; + HBRUSH hBrushCLCBk; + DWORD avatarRadius; + int avatarSize; + BOOL bForceRefetchOnPaint; + BYTE dualRowMode; + BYTE avatarPadding; + BYTE cornerRadius; + BYTE isTransparent; + BYTE alpha, autoalpha; + BYTE fadeinout; + BYTE autosize; + BYTE gapBetweenFrames; + BYTE titleBarHeight; + DWORD dwExtraImageMask; + BYTE bClipBorder, bRowSpacing; + HBITMAP bmpBackground, hbmBgOld, hbmBg; + HDC hdcBg; + HDC hdcPic; + HBITMAP hbmPicOld; + BITMAP bminfoBg; + SIZE dcSize; + POINT ptW; + BOOL bWallpaperMode; + BOOL bNoOfflineAvatars; + BOOL bEventAreaEnabled; + BOOL bFullTransparent; + BOOL bDblClkAvatars; + BOOL bApplyIndentToBg; + BOOL bEqualSections; + DWORD bFilterEffective; + BOOL bCenterStatusIcons; + BOOL bSkinnedToolbar; + BOOL bSkinnedStatusBar; + BOOL bUsePerProto; + BOOL bOverridePerStatusColors; + BOOL bDontSeparateOffline; + TCHAR groupFilter[2048]; + char protoFilter[2048]; + char varFilter[2048]; + DWORD lastMsgFilter; + char current_viewmode[256], old_viewmode[256]; + BYTE boldHideOffline; + DWORD statusMaskFilter; + DWORD stickyMaskFilter; + DWORD filterFlags; + COLORREF colorkey; + char szMetaName[256]; + BOOL bMetaEnabled; + BOOL bSecIMAvail; + BOOL bNoTrayTips; + int exIconScale; + BOOL bShowLocalTime; + BOOL bShowLocalTimeSelective; + BOOL bShowXStatusOnSbar; + BOOL bLayeredHack; + HPEN hPen3DBright, hPen3DDark; + BYTE bSkinnedButtonMode; + BYTE bFirstRun; + BYTE bUseDCMirroring; + BYTE bCLeft, bCRight, bCTop, bCBottom; + BYTE bUseFloater; + BYTE fullyInited; + BYTE bAutoExpandGroups; + SIZE szOldCTreeSize; + BYTE bWantFastGradients, bUseFastGradients; + BYTE sortOrder[3]; + BYTE bGroupAlign; + BYTE bSkinnedScrollbar; + DWORD langPackCP; + BOOL fOnDesktop; + int group_padding; + DWORD t_now; + BYTE exIconOrder[EXICON_COUNT]; + BOOL realTimeSaving; + TCHAR tszProfilePath[MAX_PATH]; + FILETIME ft; + SYSTEMTIME st; +}; + +#define SORTBY_NAME 1 +#define SORTBY_PROTO 2 +#define SORTBY_STATUS 3 +#define SORTBY_LASTMSG 4 +#define SORTBY_FREQUENCY 5 +#define SORTBY_PRIOCONTACTS 6 + +struct IconDesc { + char *szName; + char *szDesc; + int uId; // icon ID +}; + +struct NotifyMenuItemExData { + HANDLE hContact; + int iIcon; // icon index in the image list + HICON hIcon; // corresponding icon handle + HANDLE hDbEvent; +}; + +// #define NOTIFY_HEIGHT 24 + +struct TrayIconInfo { + union { + HICON hIcon; + int iIcon; + }; +}; + +typedef struct { + char protoName[50]; + UINT menuID; + BOOL added; + HICON hIcon; +} protoMenu; + +//clcidents.c +int FindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact **contact, struct ClcGroup **subgroup, int *isVisible); +HANDLE ContactToItemHandle(struct ClcContact *contact, DWORD *nmFlags); + +//clcitems.c +void RebuildEntireList(HWND hwnd, struct ClcData *dat); +void SaveStateAndRebuildList(HWND hwnd, struct ClcData *dat); +DWORD INTSORT_GetLastMsgTime(HANDLE hContact); + +//clcmsgs.c +LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); + +//clcutils.c +void SetGroupExpand(HWND hwnd, struct ClcData *dat, struct ClcGroup *group, int newState); +void DoSelectionDefaultAction(HWND hwnd, struct ClcData *dat); +int FindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk); +void BeginRenameSelection(HWND hwnd, struct ClcData *dat); +int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcContact **contact, struct ClcGroup **group, DWORD *flags); +void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth); +void RecalcScrollBar(HWND hwnd, struct ClcData *dat); +size_t MY_pathToRelative(const TCHAR *pSrc, TCHAR *pOut); +size_t MY_pathToAbsolute(const TCHAR *pSrc, TCHAR *pOut); + +#define DROPTARGET_OUTSIDE 0 +#define DROPTARGET_ONSELF 1 +#define DROPTARGET_ONNOTHING 2 +#define DROPTARGET_ONGROUP 3 +#define DROPTARGET_ONCONTACT 4 +#define DROPTARGET_INSERTION 5 +int GetDropTargetInformation(HWND hwnd, struct ClcData *dat, POINT pt); +void LoadClcOptions(HWND hwnd, struct ClcData *dat); +void RecalculateGroupCheckboxes(HWND hwnd, struct ClcData *dat); +void SetGroupChildCheckboxes(struct ClcGroup *group, int checked); +BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto); +int __fastcall GetStatusOnlineness(int status); +void GetExtendedInfo(struct ClcContact *contact, struct ClcData *dat); +extern LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); +void HideShowNotifyFrame(); +DWORD GetCLUIWindowStyle(BYTE style); +void ApplyCLUIBorderStyle(HWND hwnd); + +int FrameNCCalcSize(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BOOL hasTitleBar); +int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BOOL hasTitleBar); + +void FreeProtocolData( void ); + +void GetClientID(struct ClcContact *contact, char *client); +int LoadCLCButtonModule(void); +void SetButtonStates(HWND hwnd); +void ConfigureCLUIGeometry(int mode); +void IcoLibReloadIcons(); +int CompareContacts(const struct ClcContact* p1, const struct ClcContact* p2); +void PaintNotifyArea(HDC hDC, RECT *rc); +int AvatarChanged(WPARAM wParam, LPARAM lParam); +void ConfigureFrame(); +void ConfigureEventArea(HWND hwnd); +void ClearIcons(int mode); +void SkinDrawBg(HWND hwnd, HDC hdc); +int GetBasicFontID(struct ClcContact * contact); +extern int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szStatus, struct ClcData *dat); +void CreateViewModeFrame(); +int GetExtraCache(HANDLE hContact, char *szProto); +void ReloadExtraInfo(HANDLE hContact); +void LoadAvatarForContact(struct ClcContact *p); +void ApplyViewMode(const char *name); +DWORD CalcXMask(HANDLE hContact); +void ClcSetButtonState(int ctrlId, int status); + +//clcpaint.c +void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint); +void __inline PaintItem(HDC hdcMem, struct ClcGroup *group, struct ClcContact *contact, int indent, int y, struct ClcData *dat, int index, HWND hwnd, DWORD style, RECT *clRect, BOOL *bFirstNGdrawn, int groupCountsFontTopShift, int rowHeight); +void Reload3dBevelColors(); +void ReloadThemedOptions(); +void SetButtonToSkinned(); +void RTL_DetectAndSet(struct ClcContact *contact, HANDLE hContact); +void RTL_DetectGroupName(struct ClcContact *group); +void CLN_LoadAllIcons(BOOL mode); +void ReloadSkinItemsToCache(); +void SFL_RegisterWindowClass(), SFL_UnregisterWindowClass(); +void SFL_Create(); +void SFL_Destroy(); +void SFL_SetState(int iMode); +void SFL_SetSize(); +void SFL_PaintNotifyArea(); +void SFL_Update(HICON hIcon, int iIcon, HIMAGELIST hIml, const TCHAR *szText, BOOL refresh); + +void FLT_Update(struct ClcData *dat, struct ClcContact *contact); +int FLT_CheckAvail(); +void FLT_Create(int iEntry); +void FLT_SetSize(struct TExtraCache *centry, LONG width, LONG height); +void FLT_SyncWithClist(); +void FLT_ReadOptions(), FLT_WriteOptions(), FLT_RefreshAll(); + +//clcopts.c +int ClcOptInit(WPARAM wParam, LPARAM lParam); +DWORD GetDefaultExStyle(void); +void GetFontSetting(int i, LOGFONTA *lf, COLORREF *colour); +void CluiProtocolStatusChanged( int parStatus, const char* szProto ); + +void LoadSkinItemToCache(struct TExtraCache *cEntry, const char *szProto); + +// debugging support + +void _DebugTraceW(const wchar_t *fmt, ...); +#ifdef _CLN_GDIP +extern "C" void _DebugTraceA(const char *fmt, ...); +#else +void _DebugTraceA(const char *fmt, ...); +#endif + +// Docking.c + +int Docking_IsDocked(WPARAM wParam, LPARAM lParam); + +// Buttons + +#define BUTTONSETIMLICON (WM_USER+20) +#define BUTTONSETSKINNED (WM_USER+21) +#define BUTTONSETASMENUACTION (WM_USER+22) +#define BUTTONSETBTNITEM (WM_USER+23) + +// Menus + +void IMG_DeleteItems(); +int CoolSB_SetupScrollBar(); + +#define NIIF_INTERN_UNICODE 0x00000100 + +#define SETTING_WINDOWSTYLE_DEFAULT 0 + +#define SETTING_TRAYICON_SINGLE 0 +#define SETTING_TRAYICON_CYCLE 1 +#define SETTING_TRAYICON_MULTI 2 + +#define SETTING_STATE_HIDDEN 0 +#define SETTING_STATE_MINIMIZED 1 +#define SETTING_STATE_NORMAL 2 + +#define SETTING_BRINGTOFRONT_DEFAULT 0 + +#define SETTING_WINDOWSTYLE_TOOLWINDOW 1 +#define SETTING_WINDOWSTYLE_THINBORDER 2 +#define SETTING_WINDOWSTYLE_NOBORDER 3 + +#define EIMG_SHOW_RES0 8 +#define EIMG_SHOW_EMAIL 1 +#define EIMG_SHOW_WEB 2 +#define EIMG_SHOW_SMS 4 +#define EIMG_SHOW_ADV1 16 +#define EIMG_SHOW_ADV2 32 +#define EIMG_SHOW_ADV3 512 +#define EIMG_SHOW_CLIENT 64 +#define EIMG_SHOW_ADV4 1024 +#define EIMG_SHOW_RES1 128 +#define EIMG_SHOW_RES2 256 + +#define CLCHT_ONITEMEXTRAEX 0x1000 //on an extra icon, HIBYTE(HIWORD()) says which +#define CLCHT_ONAVATAR 0x2000 +#define CLCHT_ONITEMSPACE 0x4000 + +#define CLM_SETEXTRAIMAGEINT (CLM_FIRST+101) +#define CLM_SETSTICKY (CLM_FIRST+100) +#define CLM_ISMULTISELECT (CLM_FIRST+102) +#define CLM_SETEXTRAIMAGEINTMETA (CLM_FIRST+104) +#define CLM_GETSTATUSMSG (CLM_FIRST+105) +#define CLM_SETHIDESUBCONTACTS (CLM_FIRST+106) +#define CLM_TOGGLEPRIORITYCONTACT (CLM_FIRST+107) +#define CLM_QUERYPRIORITYCONTACT (CLM_FIRST+108) +#define CLM_TOGGLEFLOATINGCONTACT (CLM_FIRST+109) +#define CLM_QUERYFLOATINGCONTACT (CLM_FIRST+110) + +#define IDC_RESETMODES 110 +#define IDC_SELECTMODE 108 +#define IDC_CONFIGUREMODES 109 + +#define NR_CLIENTS 40 + +typedef BOOL (WINAPI *PGF)(HDC, PTRIVERTEX, ULONG, PVOID, ULONG, ULONG); + +/* + * floating stuff + */ + +#define FLT_SIMPLE 1 +#define FLT_AVATARS 2 +#define FLT_DUALROW 4 +#define FLT_EXTRAICONS 8 +#define FLT_SYNCWITHCLIST 16 +#define FLT_AUTOHIDE 32 +#define FLT_SNAP 64 +#define FLT_BORDER 128 +#define FLT_ROUNDED 256 +#define FLT_FILLSTDCOLOR 512 +#define FLT_SHOWTOOLTIPS 1024 + +typedef struct _floatopts { + DWORD dwFlags; + BYTE pad_left, pad_right, pad_top, pad_bottom; + DWORD width; + COLORREF border_colour; + BYTE trans, act_trans; + BYTE radius; + BYTE enabled; + BYTE def_hover_time; + WORD hover_time; +} FLOATINGOPTIONS; + +extern FLOATINGOPTIONS g_floatoptions; + + diff --git a/plugins/Clist_nicer/SRC/Include/clist.h b/plugins/Clist_nicer/SRC/Include/clist.h new file mode 100644 index 0000000000..1969039350 --- /dev/null +++ b/plugins/Clist_nicer/SRC/Include/clist.h @@ -0,0 +1,48 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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. +*/ +void LoadContactTree(void); +int IconFromStatusMode(const char *szProto, int status, HANDLE hContact, HICON *phIcon); +HTREEITEM GetTreeItemByHContact(HANDLE hContact); +void SortContacts(void); + +#define CLUIINTM_REDRAW (WM_USER+100) +#define CLUIINTM_STATUSBARUPDATE (WM_USER+101) +#define CLUIINTM_REMOVEFROMTASKBAR (WM_USER+102) + +#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_MODULE "CLVM_W" diff --git a/plugins/Clist_nicer/SRC/Include/commonheaders.h b/plugins/Clist_nicer/SRC/Include/commonheaders.h new file mode 100644 index 0000000000..91de256f0a --- /dev/null +++ b/plugins/Clist_nicer/SRC/Include/commonheaders.h @@ -0,0 +1,224 @@ +/* + * astyle --force-indent=tab=4 --brackets=linux --indent-switches + * --pad=oper --one-line=keep-blocks --unpad=paren + * + * Miranda IM: the free IM client for Microsoft* Windows* + * + * Copyright 2000-2010 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. + * + * part of clist_nicer plugin for Miranda. + * + * (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors + * + * $Id: commonheaders.h 14157 2012-03-10 18:53:26Z george.hazan $ + * + */ + +#define MIRANDA_VER 0x0A00 + +#define _WIN32_WINNT 0x0501 +#define _WIN32_IE 0x0501 + +#define _CRT_SECURE_NO_WARNINGS +#define EXTRA_ICON_COUNT 11 + +#undef FASTCALL + +#define TSAPI __stdcall +#define FASTCALL __fastcall + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "resource.h" +#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 "extbackg.h" +#include "clc.h" +#include + + +#include "clist.h" +#include "alphablend.h" +#include "rowheight_funcs.h" + + /* + * text shadow types (DrawThemeTextEx() / Vista+ uxtheme) + */ + #define TST_NONE 0 + #define TST_SINGLE 1 + #define TST_CONTINUOUS 2 + + typedef struct _DWM_THUMBNAIL_PROPERTIES + { + DWORD dwFlags; + RECT rcDestination; + RECT rcSource; + BYTE opacity; + BOOL fVisible; + BOOL fSourceClientAreaOnly; + } DWM_THUMBNAIL_PROPERTIES, *PDWM_THUMBNAIL_PROPERTIES; + + enum DWMWINDOWATTRIBUTE + { + DWMWA_NCRENDERING_ENABLED = 1, // [get] Is non-client rendering enabled/disabled + DWMWA_NCRENDERING_POLICY, // [set] Non-client rendering policy + DWMWA_TRANSITIONS_FORCEDISABLED, // [set] Potentially enable/forcibly disable transitions + DWMWA_ALLOW_NCPAINT, // [set] Allow contents rendered in the non-client area to be visible on the DWM-drawn frame. + DWMWA_CAPTION_BUTTON_BOUNDS, // [get] Bounds of the caption button area in window-relative space. + DWMWA_NONCLIENT_RTL_LAYOUT, // [set] Is non-client content RTL mirrored + DWMWA_FORCE_ICONIC_REPRESENTATION, // [set] Force this window to display iconic thumbnails. + DWMWA_FLIP3D_POLICY, // [set] Designates how Flip3D will treat the window. + DWMWA_EXTENDED_FRAME_BOUNDS, // [get] Gets the extended frame bounds rectangle in screen space + DWMWA_HAS_ICONIC_BITMAP, // [set] Indicates an available bitmap when there is no better thumbnail representation. + DWMWA_DISALLOW_PEEK, // [set] Don't invoke Peek on the window. + DWMWA_EXCLUDED_FROM_PEEK, // [set] LivePreview exclusion information + DWMWA_LAST + }; + + #define DWM_TNP_RECTDESTINATION 0x00000001 + #define DWM_TNP_RECTSOURCE 0x00000002 + #define DWM_TNP_OPACITY 0x00000004 + #define DWM_TNP_VISIBLE 0x00000008 + #define DWM_TNP_SOURCECLIENTAREAONLY 0x00000010 + + #define DWM_SIT_DISPLAYFRAME 0x00000001 // Display a window frame around the provided bitmap + + typedef HANDLE HTHUMBNAIL; + typedef HTHUMBNAIL* PHTHUMBNAIL; + +#ifndef BPPF_ERASE + typedef enum _BP_BUFFERFORMAT + { + BPBF_COMPATIBLEBITMAP, // Compatible bitmap + BPBF_DIB, // Device-independent bitmap + BPBF_TOPDOWNDIB, // Top-down device-independent bitmap + BPBF_TOPDOWNMONODIB // Top-down monochrome device-independent bitmap + } BP_BUFFERFORMAT; + + + typedef struct _BP_PAINTPARAMS + { + DWORD cbSize; + DWORD dwFlags; // BPPF_ flags + const RECT * prcExclude; + const BLENDFUNCTION * pBlendFunction; + } BP_PAINTPARAMS, *PBP_PAINTPARAMS; + + #define BPPF_ERASE 1 + #define BPPF_NOCLIP 2 + #define BPPF_NONCLIENT 4 +#endif + + typedef struct _DWM_BLURBEHIND + { + DWORD dwFlags; + BOOL fEnable; + HRGN hRgnBlur; + BOOL fTransitionOnMaximized; + } DWM_BLURBEHIND, *PDWM_BLURBEHIND; + + #define DWM_BB_ENABLE 1 + +#ifndef LOCALE_SISO3166CTRYNAME2 + #define LOCALE_SISO3166CTRYNAME2 0x00000068 // 3 character ISO country name, eg "USA Vista+ + #define LOCALE_SISO639LANGNAME2 0x00000067 // 3 character ISO abbreviated language name, eg "eng" +#endif + +#ifndef WM_DWMCOMPOSITIONCHANGED + #define WM_DWMCOMPOSITIONCHANGED 0x031E + #define WM_DWMCOLORIZATIONCOLORCHANGED 0x0320 +#endif + +#ifndef WM_DWMSENDICONICTHUMBNAIL + #define WM_DWMSENDICONICTHUMBNAIL 0x0323 + #define WM_DWMSENDICONICLIVEPREVIEWBITMAP 0x0326 +#endif + +// shared vars +extern HINSTANCE g_hInst; +extern LONG g_cxsmIcon, g_cysmIcon; +extern StatusItems_t *StatusItems; +extern ImageItem *g_glyphItem; + +/* most free()'s are invalid when the code is executed from a dll, so this changes + all the bad free()'s to good ones, however it's still incorrect code. The reasons for not + changing them include: + + * DBFreeVariant has a CallService() lookup + * free() is executed in some large loops to do with clist creation of group data + * easy search and replace + +*/ + +#define MAX_REGS(_A_) (sizeof(_A_)/sizeof(_A_[0])) + +typedef int (__cdecl *pfnDrawAvatar)(HDC hdcOrig, HDC hdcMem, RECT *rc, struct ClcContact *contact, int y, struct ClcData *dat, int selected, WORD cstatus, int rowHeight); + +#define safe_sizeof(a) (sizeof((a)) / sizeof((a)[0])) + +BOOL __forceinline GetItemByStatus(int status, StatusItems_t *retitem); + +void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor2, BOOL transparent, BYTE FLG_GRADIENT, BYTE FLG_CORNER, DWORD BORDERSTYLE, ImageItem *item); + +void CustomizeButton(HWND hWnd, bool bIsSkinned, bool bIsThemed, bool bIsFlat); + +void FreeAndNil( void** ); + +#if _MSC_VER >= 1500 + #define wEffects wReserved +#endif diff --git a/plugins/Clist_nicer/SRC/Include/config.h b/plugins/Clist_nicer/SRC/Include/config.h new file mode 100644 index 0000000000..4ee9983798 --- /dev/null +++ b/plugins/Clist_nicer/SRC/Include/config.h @@ -0,0 +1,209 @@ +/* + * astyle --force-indent=tab=4 --brackets=linux --indent-switches + * --pad=oper --one-line=keep-blocks --unpad=paren + * + * Miranda IM: the free IM client for Microsoft* Windows* + * + * Copyright 2000-2010 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. + * + * part of clist_nicer plugin for Miranda. + * + * (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors + * + * $Id: config.h 12709 2010-09-16 12:06:06Z borkra $ + * + */ + +#include + +#ifndef __CONFIG_H_ +#define __CONFIG_H_ + +#define DEFAULT_MODULE "Clist" + +#define IS_THEMED (API::sysState.isThemed) +#define IS_AERO (API::sysState.isAero) + +typedef int (__cdecl *pfnDrawAvatar)(HDC hdcOrig, HDC hdcMem, RECT *rc, struct ClcContact *contact, int y, struct ClcData *dat, int selected, WORD cstatus, int rowHeight); +typedef BOOL (WINAPI *pfnSetLayeredWindowAttributes_t)(HWND, COLORREF, BYTE, DWORD); +typedef BOOL (WINAPI *pfnUpdateLayeredWindow_t)(HWND, HDC, POINT *, SIZE *, HDC, POINT *, COLORREF, BLENDFUNCTION *, DWORD); +typedef HMONITOR (WINAPI *pfnMonitorFromPoint_t)(POINT,DWORD); +typedef HMONITOR (WINAPI *pfnMonitorFromWindow_t)(HWND,DWORD); +typedef BOOL (WINAPI *pfnGetMonitorInfo_t)(HMONITOR,LPMONITORINFO); +typedef BOOL (WINAPI *pfnTrackMouseEvent_t)(LPTRACKMOUSEEVENT); +typedef DWORD (WINAPI *pfnSetLayout_t )(HDC, DWORD); +typedef void (__cdecl *pfnDrawAlpha_t)(HDC hdcwnd, PRECT rc, DWORD basecolor, BYTE alpha, DWORD basecolor2, BOOL transparent, DWORD FLG_GRADIENT, DWORD FLG_CORNER, DWORD BORDERSTYLE, ImageItem *item); +typedef BOOL (WINAPI *pfnAlphaBlend_t)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION); + +typedef BOOL (WINAPI *pfnIsThemeActive_t)(); +typedef HANDLE (WINAPI *pfnOpenThemeData_t)(HWND, LPCWSTR); +typedef UINT (WINAPI *pfnDrawThemeBackground_t)(HANDLE, HDC, int, int, RECT *, RECT *); +typedef UINT (WINAPI *pfnCloseThemeData_t)(HANDLE); +typedef UINT (WINAPI *pfnDrawThemeText_t)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, DWORD, RECT *); +typedef UINT (WINAPI *pfnDrawThemeTextEx_t)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, RECT *, const DTTOPTS *); +typedef BOOL (WINAPI *pfnIsThemeBackgroundPartiallyTransparent_t)(HANDLE, int, int); +typedef HRESULT (WINAPI *pfnDrawThemeParentBackground_t)(HWND, HDC, RECT *); +typedef HRESULT (WINAPI *pfnGetThemeBackgroundContentRect_t)(HANDLE, HDC, int, int, const RECT *, const RECT *); +typedef BOOL (WINAPI *pfnEnableThemeDialogTexture_t)(HANDLE, DWORD); +typedef HRESULT (WINAPI *pfnDwmExtendFrameIntoClientArea_t)(HWND hwnd, const MARGINS *margins); +typedef HRESULT (WINAPI *pfnDwmIsCompositionEnabled_t)(BOOL *); + +class CRTException : public std::runtime_error +{ +public: + CRTException(const char *szMsg, const TCHAR *szParam); + ~CRTException() {} + + void display() const; + +private: + TCHAR m_szParam[MAX_PATH]; +}; + +class cfg +{ +public: + static void init (); + + static DWORD getDword (const HANDLE hContact, const char *szModule, const char *szSetting, DWORD uDefault); + static DWORD getDword (const char *szModule, const char *szSetting, DWORD uDefault); + static DWORD getDword (const char *szSetting, DWORD uDefault); + + static WORD getWord (const HANDLE hContact, const char *szModule, const char *szSetting, WORD uDefault); + static WORD getWord (const char *szModule, const char *szSetting, WORD uDefault); + static WORD getWord (const char *szSetting, WORD uDefault); + + static int getByte (const HANDLE hContact, const char *szModule, const char *szSetting, int uDefault); + static int getByte (const char *szModule, const char *szSetting, int uDefault); + static int getByte (const char *szSetting, int uDefault); + + static INT_PTR getTString (const HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); + static INT_PTR getString (const HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); + + static INT_PTR writeDword (const HANDLE hContact, const char *szModule, const char *szSetting, DWORD value); + static INT_PTR writeDword (const char *szModule, const char *szSetting, DWORD value); + + static INT_PTR writeWord (const HANDLE hContact, const char *szModule, const char *szSetting, WORD value); + static INT_PTR writeWord (const char *szModule, const char *szSetting, WORD value); + + static INT_PTR writeByte (const HANDLE hContact, const char *szModule, const char *szSetting, BYTE value); + static INT_PTR writeByte (const char *szModule, const char *szSetting, BYTE value); + + static INT_PTR writeTString (const HANDLE hContact, const char *szModule, const char *szSetting, const TCHAR *st); + static INT_PTR writeString (const HANDLE hContact, const char *szModule, const char *szSetting, const char *st); + static int getCache (const HANDLE hContact, const char *szProto); + +public: + static TCluiData dat; + static ClcData* clcdat; + static TExtraCache* eCache; + static int nextCacheEntry, maxCacheEntry; + + static CRITICAL_SECTION cachecs; + + static bool shutDown; +}; + +struct TSysConfig { + bool isVistaPlus; + bool isSevenPlus; + bool isXPPlus; + bool uxThemeValid; + bool isWin2KPlus; +}; + +struct TSysState { + bool isThemed; + bool isAero; + bool isDwmActive; +}; + +class API +{ +public: + static void onInit (); + static void onUnload (); + static void updateState (); + + static void Ex_CopyEditToClipboard (HWND hWnd); + static INT_PTR CALLBACK Ex_DlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); + static void Ex_Handler (); + static int Ex_ShowDialog (EXCEPTION_POINTERS *ep, const char *szFile, int line, TCHAR* szReason, bool fAllowContinue); + + + /* + * helpers + */ + + static BOOL SetLayeredWindowAttributes(HWND hWnd, COLORREF clr, BYTE alpha, DWORD dwFlags); + + static pfnSetLayeredWindowAttributes_t pfnSetLayeredWindowAttributes; + static pfnUpdateLayeredWindow_t pfnUpdateLayeredWindow; + static pfnMonitorFromPoint_t pfnMonitorFromPoint; + static pfnMonitorFromWindow_t pfnMonitorFromWindow; + static pfnGetMonitorInfo_t pfnGetMonitorInfo; + static pfnTrackMouseEvent_t pfnTrackMouseEvent; + // static pfnDrawAlpha_t pfnDrawAlpha; + static pfnSetLayout_t pfnSetLayout; + static PGF pfnGradientFill; + static pfnAlphaBlend_t pfnAlphaBlend; + + /* + * uxtheme + */ + + static pfnIsThemeActive_t pfnIsThemeActive; + static pfnOpenThemeData_t pfnOpenThemeData; + static pfnDrawThemeBackground_t pfnDrawThemeBackground; + static pfnCloseThemeData_t pfnCloseThemeData; + static pfnDrawThemeText_t pfnDrawThemeText; + static pfnDrawThemeTextEx_t pfnDrawThemeTextEx; + static pfnIsThemeBackgroundPartiallyTransparent_t pfnIsThemeBackgroundPartiallyTransparent; + static pfnDrawThemeParentBackground_t pfnDrawThemeParentBackground; + static pfnGetThemeBackgroundContentRect_t pfnGetThemeBackgroundContentRect; + static pfnEnableThemeDialogTexture_t pfnEnableThemeDialogTexture; + + static pfnDwmExtendFrameIntoClientArea_t pfnDwmExtendFrameIntoClientArea; + static pfnDwmIsCompositionEnabled_t pfnDwmIsCompositionEnabled; + + static TSysConfig sysConfig; + static TSysState sysState; + + static EXCEPTION_RECORD exRecord; + static CONTEXT exCtx; + static LRESULT exLastResult; + static char exSzFile[MAX_PATH]; + static TCHAR exReason[256]; + static int exLine; + static bool exAllowContinue; + + static HMODULE hUxTheme, hDwm; +}; + + +class Utils +{ +public: + static void TSAPI enableDlgControl(const HWND hwnd, UINT id, BOOL fEnable); + static void TSAPI showDlgControl(const HWND hwnd, UINT id, int showCmd); + static HMODULE loadSystemLibrary(const TCHAR* szFilename, bool useGetHandle = false); + +}; + +#endif /* __CONFIG_H_*/ diff --git a/plugins/Clist_nicer/SRC/Include/extBackg.h b/plugins/Clist_nicer/SRC/Include/extBackg.h new file mode 100644 index 0000000000..53450dcc0b --- /dev/null +++ b/plugins/Clist_nicer/SRC/Include/extBackg.h @@ -0,0 +1,97 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 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. +*/ + +#define ID_EXTBKIDLE 40081 +#define ID_EXTBKEXPANDEDGROUP 40082 +#define ID_EXTBKCOLLAPSEDDGROUP 40083 +#define ID_EXTBKEMPTYGROUPS 40084 +#define ID_EXTBKFIRSTITEM 40085 +#define ID_EXTBKSINGLEITEM 40086 +#define ID_EXTBKLASTITEM 40087 + + +#define ID_EXTBKFIRSTITEM_NG 40088 +#define ID_EXTBKSINGLEITEM_NG 40089 +#define ID_EXTBKLASTITEM_NG 40090 + +#define ID_EXTBKEVEN_CNTCTPOS 40091 +#define ID_EXTBKODD_CNTCTPOS 40092 + +#define ID_EXTBKSELECTION 40093 +#define ID_EXTBKHOTTRACK 40094 +#define ID_EXTBKFRAMETITLE 40095 +#define ID_EXTBKEVTAREA 40096 +#define ID_EXTBKSTATUSBAR 40097 +#define ID_EXTBKBUTTONBAR 40098 +#define ID_EXTBKBUTTONSPRESSED 40099 +#define ID_EXTBKBUTTONSNPRESSED 40100 +#define ID_EXTBKBUTTONSMOUSEOVER 40101 +#define ID_EXTBKTBBUTTONSPRESSED 40102 +#define ID_EXTBKTBBUTTONSNPRESSED 40103 +#define ID_EXTBKTBBUTTONMOUSEOVER 40104 +#define ID_EXTBKSTATUSFLOATER 40105 +#define ID_EXTBKOWNEDFRAMEBORDER 40106 +#define ID_EXTBKOWNEDFRAMEBORDERTB 40107 +#define ID_EXTBKAVATARFRAME 40108 +#define ID_EXTBKAVATARFRAMEOFFLINE 40109 +#define ID_EXTBKSCROLLBACK 40110 +#define ID_EXTBKSCROLLBACKLOWER 40111 +#define ID_EXTBKSCROLLTHUMB 40112 +#define ID_EXTBKSCROLLTHUMBHOVER 40113 +#define ID_EXTBKSCROLLTHUMBPRESSED 40114 +#define ID_EXTBKSCROLLBUTTON 40115 +#define ID_EXTBKSCROLLBUTTONHOVER 40116 +#define ID_EXTBKSCROLLBUTTONPRESSED 40117 +#define ID_EXTBKSCROLLARROWUP 40118 +#define ID_EXTBKSCROLLARROWDOWN 40119 +#define ID_EXTBK_LAST_D 40119 + +#define ID_EXTBKSEPARATOR 40200 + +BOOL CheckItem(int item, HWND hwndDlg); +BOOL isValidItem(void); +void extbk_export(char *file); +void extbk_import(char *file, HWND hwndDlg); + +void LoadExtBkSettingsFromDB(); +void IMG_LoadItems(); +void __fastcall IMG_RenderImageItem(HDC hdc, ImageItem *item, RECT *rc); +void IMG_InitDecoder(); +void LoadPerContactSkins(TCHAR *file); + +static void SaveCompleteStructToDB(); +StatusItems_t *GetProtocolStatusItem(const char *szProto); + +void OnListItemsChange(HWND hwndDlg); + +void UpdateStatusStructSettingsFromOptDlg(HWND hwndDlg, int index); + +void SaveNonStatusItemsSettings(HWND hwndDlg); + +void FillItemList(HWND hwndDlg); +void FillOptionDialogByCurrentSel(HWND hwndDlg); +void ReActiveCombo(HWND hwndDlg); +//BOOL __fastcall GetItemByStatus(int status, StatusItems_t *retitem); + +void FillOptionDialogByStatusItem(HWND hwndDlg, StatusItems_t *item); + diff --git a/plugins/Clist_nicer/SRC/Include/m_cln_skinedit.h b/plugins/Clist_nicer/SRC/Include/m_cln_skinedit.h new file mode 100644 index 0000000000..a1e69bb6e1 --- /dev/null +++ b/plugins/Clist_nicer/SRC/Include/m_cln_skinedit.h @@ -0,0 +1,174 @@ + +/* + * services + */ + +#define MS_CLNSE_INVOKE "CLN_Skinedit/Invoke" +#define MS_CLNSE_FILLBYCURRENTSEL "CLN_Skinedit/FillByCurrentSel" + +/* + * data structs + */ + +typedef struct _tagImageItem { + char szName[40]; + HBITMAP hbm; + BYTE bLeft, bRight, bTop, bBottom; // sizing margins + BYTE alpha; + DWORD dwFlags; + HDC hdc; + HBITMAP hbmOld; + LONG inner_height, inner_width; + LONG width, height; + BLENDFUNCTION bf; + BYTE bStretch; + HBRUSH fillBrush; + LONG glyphMetrics[4]; + struct _tagImageItem *nextItem; +} ImageItem; + +typedef struct _tagButtonItem { + char szName[40]; + HWND hWnd; + LONG xOff, yOff; + LONG width, height; + ImageItem *imgNormal, *imgPressed, *imgHover; + LONG normalGlyphMetrics[4]; + LONG hoverGlyphMetrics[4]; + LONG pressedGlyphMetrics[4]; + DWORD dwFlags, dwStockFlags; + DWORD uId; + TCHAR szTip[256]; + char szService[256]; + char szModule[256], szSetting[256]; + BYTE bValuePush[256], bValueRelease[256]; + DWORD type; + void (*pfnAction)(struct _tagButtonItem *item, HWND hwndDlg, struct MessageWindowData *dat, HWND hwndItem); + void (*pfnCallback)(struct _tagButtonItem *item, HWND hwndDlg, struct MessageWindowData *dat, HWND hwndItem); + TCHAR tszLabel[40]; + struct _tagButtonItem *nextItem; +} ButtonItem; + +typedef struct _tagButtonSet { + ButtonItem *items; + LONG left, top, right, bottom; // client area offsets, calculated from button layout +} ButtonSet; + +typedef struct { + char szName[40]; + char szDBname[40]; + int statusID; + + BYTE GRADIENT; + BYTE CORNER; + + DWORD COLOR; + DWORD COLOR2; + + BYTE COLOR2_TRANSPARENT; + + DWORD TEXTCOLOR; + + int ALPHA; + + int MARGIN_LEFT; + int MARGIN_TOP; + int MARGIN_RIGHT; + int MARGIN_BOTTOM; + BYTE IGNORED; + DWORD BORDERSTYLE; + ImageItem *imageItem; +} StatusItems_t; + +typedef struct { + BOOL bGRADIENT; + BOOL bCORNER; + BOOL bCOLOR; + BOOL bCOLOR2; + BOOL bCOLOR2_TRANSPARENT; + BOOL bTEXTCOLOR; + BOOL bALPHA; + BOOL bMARGIN_LEFT; + BOOL bMARGIN_TOP; + BOOL bMARGIN_RIGHT; + BOOL bMARGIN_BOTTOM; + BOOL bIGNORED; + BOOL bBORDERSTYLE; +} ChangedSItems_t; + +typedef struct _tagSkinDescription { + DWORD cbSize; + StatusItems_t *StatusItems; + int lastItem; + int firstItem; + char szModule[100]; + HWND hWndParent, hWndTab; + HWND hwndCLUI; + HWND hwndSkinEdit; /* out param */ + HWND hwndImageEdit; /* out param */ + HMENU hMenuItems; + void (*pfnSaveCompleteStruct)(void); + void (*pfnClcOptionsChanged )(void); + void* (*pfnMalloc)(unsigned int); + void (*pfnFree)(void); + void* (*pfnRealloc)(void *, unsigned int); + void* reserved[20]; +} SKINDESCRIPTION; + +// defines + +// FLAGS +#define CORNER_NONE 0 +#define CORNER_ACTIVE 1 +#define CORNER_TL 2 +#define CORNER_TR 4 +#define CORNER_BR 8 +#define CORNER_BL 16 + +#define GRADIENT_NONE 0 +#define GRADIENT_ACTIVE 1 +#define GRADIENT_LR 2 +#define GRADIENT_RL 4 +#define GRADIENT_TB 8 +#define GRADIENT_BT 16 + +#define IMAGE_PERPIXEL_ALPHA 1 +#define IMAGE_FLAG_DIVIDED 2 +#define IMAGE_FILLSOLID 4 +#define IMAGE_GLYPH 8 + +#define IMAGE_STRETCH_V 1 +#define IMAGE_STRETCH_H 2 +#define IMAGE_STRETCH_B 4 + +#define BUTTON_ISINTERNAL 1 +#define BUTTON_ISTOGGLE 2 +#define BUTTON_ISSERVICE 4 +#define BUTTON_ISPROTOSERVICE 8 +#define BUTTON_PASSHCONTACTW 16 +#define BUTTON_PASSHCONTACTL 32 +#define BUTTON_ISDBACTION 64 +#define BUTTON_ISCONTACTDBACTION 128 +#define BUTTON_DBACTIONONCONTACT 256 +#define BUTTON_ISSIDEBAR 512 +#define BUTTON_NORMALGLYPHISICON 1024 +#define BUTTON_PRESSEDGLYPHISICON 2048 +#define BUTTON_HOVERGLYPHISICON 4096 +#define BUTTON_HASLABEL 8192 + +#define CLCDEFAULT_GRADIENT 0 +#define CLCDEFAULT_CORNER 0 + +#define CLCDEFAULT_COLOR 0xd0d0d0 +#define CLCDEFAULT_COLOR2 0xd0d0d0 + +#define CLCDEFAULT_TEXTCOLOR 0x000000 + +#define CLCDEFAULT_COLOR2_TRANSPARENT 1 + +#define CLCDEFAULT_ALPHA 100 +#define CLCDEFAULT_MRGN_LEFT 0 +#define CLCDEFAULT_MRGN_TOP 0 +#define CLCDEFAULT_MRGN_RIGHT 0 +#define CLCDEFAULT_MRGN_BOTTOM 0 +#define CLCDEFAULT_IGNORE 1 diff --git a/plugins/Clist_nicer/SRC/Include/resource.h b/plugins/Clist_nicer/SRC/Include/resource.h new file mode 100644 index 0000000000..a2b1f5a072 --- /dev/null +++ b/plugins/Clist_nicer/SRC/Include/resource.h @@ -0,0 +1,416 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by D:\Develop\miranda\plugins\miranda\miranda\plugins\clist_nicer\resource.rc +// +#define IDD_OPT_VIEWMODES 1 +#define IDD_OPT_FLOATING 3 +#define IDD_OPT_SKIN 4 +#define IDD_QUICKIGNORE 5 +#define IDD_OPT 6 +#define IDD_EXCEPTION 20 +#define IDD_OPTIONSDIALOG 101 +#define IDD_CLNABOUT 102 +#define IDD_OPT_CLIST 126 +#define IDI_NOTICK 143 +#define IDI_TICK 146 +#define IDI_OPTIONS 163 +#define IDI_RENAME 173 +#define IDI_DELETE 175 +#define IDI_CLVM_OPTIONS 176 +#define IDI_CLVM_SELECT 177 +#define IDR_CONTEXT 180 +#define IDC_DROP 183 +#define IDR_CLISTMENU 199 +#define IDI_BLANK 200 +#define IDI_ADDCONTACT 210 +#define IDC_HYPERLINKHAND 214 +#define IDC_DROPUSER 215 +#define IDD_OPT_CLUI 218 +#define IDD_OPT_XICONS 219 +#define IDD_OPT_CLC 228 +#define IDD_OPT_CLCBKG 230 +#define IDD_OPT_SBAR 234 +#define IDD_DELETECONTACT 254 +#define IDD_OPT_DSPPROFILES 300 +#define IDD_OPT_DSPADVANCED 301 +#define IDD_OPT_DSPITEMS 302 +#define IDD_OPT_DSPGROUPS 303 +#define IDC_ACTIVEPERC 1000 +#define IDC_OPTIONSTAB 1000 +#define IDC_ALWAYSSTATUS 1009 +#define IDC_APPLY 1011 +#define IDC_AUTOSIZE 1013 +#define IDC_AUTOSIZEUPWARD 1014 +#define IDC_AVATARSIZESPIN 1015 +#define IDC_SKINMODE 1020 +#define IDC_FULLTRANSPARENT 1020 +#define IDC_STATUSICONSCENTERED 1020 +#define IDC_NOTRAYINFOTIPS 1020 +#define IDC_SHOWXSTATUS 1020 +#define IDC_AUTOCLEAR 1020 +#define IDC_FLT_SIMPLELAYOUT 1020 +#define IDC_USESKIN 1020 +#define IDC_IGN_MSGEVENTS 1020 +#define IDC_AUTOCLEARVAL 1021 +#define IDC_MARKLOCKED 1021 +#define IDC_IGN_FILEEVENTS 1021 +#define IDC_AUTOCLEARSPIN 1022 +#define IDC_IGN_URLEVENTS 1022 +#define IDC_LASTMSG 1023 +#define IDC_IGN_AUTH 1023 +#define IDC_IGN_ADD 1024 +#define IDC_CONFIRMDELETE 1025 +#define IDC_IGN_ONLINE 1025 +#define IDC_IGN_ALWAYSONLINE 1026 +#define IDC_IGN_ALWAYSOFFLINE 1027 +#define IDC_IGN_PRIORITY 1028 +#define IDC_DISABLEGROUPS 1030 +#define IDC_DROPSHADOW 1035 +#define IDC_EQUALSELECTION 1040 +#define IDC_USEPERPROTO 1041 +#define IDC_OVERRIDEPERSTATUSCOLOR 1042 +#define IDC_EVENTAREASUNKEN 1043 +#define IDC_SETALLBUTTONSKINNED 1043 +#define IDC_EVENTSONTOP 1044 +#define IDC_FASTGRADIENT 1044 +#define IDC_EXTRA_ICON_EMAIL 1045 +#define IDC_DONTSEPARATE 1045 +#define IDC_EXTRA_ICON_SMS 1047 +#define IDC_EXTRA_ICON_RES0 1054 +#define IDC_EXTRA_ICON_WEB 1055 +#define IDC_FADEINOUT 1056 +#define IDC_EXTRA_ICON_ADV2 1057 +#define IDC_EXTRA_ICON_RES1 1058 +#define IDC_EXTRA_ICON_RES2 1059 +#define IDC_EXTRA_ICON_ADV3 1060 +#define IDC_EXTRAORDER 1061 +#define IDC_FRAMEGAP 1064 +#define IDC_FRAMEGAPSPIN 1065 +#define IDC_CLIPBORDER 1066 +#define IDC_FULLROWSELECT 1067 +#define IDC_CLIPBORDERSPIN 1067 +#define IDC_LOCALTIME 1068 +#define IDC_EXICONSCALE 1068 +#define IDC_EXICONSCALESPIN 1069 +#define IDC_CLEFT 1070 +#define IDC_CLEFTSPIN 1071 +#define IDC_GREYOUT 1072 +#define IDC_CTOP 1072 +#define IDC_ONTOP 1074 +#define IDC_SHOWMAINMENU 1075 +#define IDC_CLIENTDRAG 1076 +#define IDC_HIDEEMPTYGROUPS 1077 +#define IDC_CTOPSPIN 1077 +#define IDC_CBOTTOM 1078 +#define IDC_CBOTTOMSPIN 1079 +#define IDC_CRIGHT 1080 +#define IDC_HIDEOFFLINE 1081 +#define IDC_CRIGHTSPIN 1081 +#define IDC_HIDEOFFLINEOPTS 1082 +#define IDC_EXTRA_ICON_ADV4 1085 +#define IDC_LEFTMARGINSPIN 1092 +#define IDC_NOGROUPICON 1102 +#define IDC_ONECLK 1105 +#define IDC_BUILDTIME 1108 +#define IDC_RIGHTMARGIN 1121 +#define IDC_ROWGAP 1122 +#define IDC_TRANSPARENT 1124 +#define IDC_ROWHEIGHT 1125 +#define IDC_TRANSINACTIVE 1126 +#define IDC_GROUPROWHEIGHT 1126 +#define IDC_TRANSACTIVE 1128 +#define IDC_PROFILELIST 1134 +#define IDC_CLASSLIST 1135 +#define IDC_SELBLEND 1140 +#define IDC_SHOWBOTTOMBUTTONS 1148 +#define IDC_STATIC11 1154 +#define IDC_STATIC12 1155 +#define IDC_STATIC21 1156 +#define IDC_STATIC13 1156 +#define IDC_STATIC22 1157 +#define IDC_STATIC14 1157 +#define IDC_STATIC15 1158 +#define IDC_EXTRA_ICON_CLIENT 1164 +#define IDC_EXTRA_ICON_ADV1 1166 +#define IDC_SHOWGRIP 1169 +#define IDC_SKINBACKGROUND 1170 +#define IDC_FILLWALLPAPER 1171 +#define IDC_SHOWMETA 1172 +#define IDC_CENTERGROUPNAMES 1173 +#define IDC_APPLYINDENTBG 1174 +#define IDC_COPYRIGHT 1178 +#define IDC_VERSION 1179 +#define IDC_SHOWSTATUSICONS 1180 +#define IDC_BROWSE 1184 +#define IDC_INACTIVEPERC 1187 +#define IDC_SHOWSTATUSMSG 1188 +#define IDC_SHOWLOCALTIME 1189 +#define IDC_SHOWVISIBILITY 1190 +#define IDC_SHOWLOCALTIMEONLYWHENDIFFERENT 1191 +#define IDC_TITLETEXT 1196 +#define IDC_EXCEPTION_DETAILS 1200 +#define IDC_COPY_EXCEPTION 1201 +#define IDC_EX_REASON 1202 +#define IDC_TILEH 1208 +#define IDC_WHITERECT 1225 +#define IDC_AUTOHIDE 1235 +#define IDC_HIDETIME 1236 +#define IDC_ALWAYSHIDEONTASKBAR 1237 +#define IDC_IMPORT 1241 +#define IDC_MAXSIZEHEIGHT 1254 +#define IDC_MAXSIZESPIN 1255 +#define IDC_BKGCOLOUR 1269 +#define IDC_FILENAME 1271 +#define IDC_SCROLL 1277 +#define IDC_PROPORTIONAL 1278 +#define IDC_SMOOTHTIME 1283 +#define IDC_SMOOTHTIMESPIN 1284 +#define IDC_ROWHEIGHTSPIN 1286 +#define IDC_GROUPROWHEIGHTSPIN 1287 +#define IDC_GREYOUTOPTS 1288 +#define IDC_GROUPINDENT 1289 +#define IDC_GROUPINDENTSPIN 1290 +#define IDC_LEFTMARGIN 1291 +#define IDC_RIGHTMARGINSPIN 1294 +#define IDC_ROWGAPSPIN 1295 +#define IDC_STRETCHH 1298 +#define IDC_STRETCHV 1299 +#define IDC_TILEV 1301 +#define IDC_DONTCYCLE 1315 +#define IDC_PRIMARYSTATUS 1316 +#define IDC_CYCLE 1317 +#define IDC_CYCLETIME 1318 +#define IDC_CYCLETIMESPIN 1319 +#define IDC_HIDETIMESPIN 1320 +#define IDC_MULTITRAY 1321 +#define IDC_ALWAYSMULTI 1322 +#define IDC_SHOWICON 1323 +#define IDC_SORTTHEN 1323 +#define IDC_SHOWPROTO 1324 +#define IDC_SORTFINALLY 1324 +#define IDC_SHOWSTATUS 1325 +#define IDC_EQUALSECTIONS 1326 +#define IDC_SHOWSBAR 1329 +#define IDC_RIGHTMIRANDA 1330 +#define IDC_RIGHTSTATUS 1331 +#define IDC_STCLISTGROUP 1350 +#define IDC_DISABLEDRAGDROP 1351 +#define IDC_NOTEDITLABELS 1352 +#define IDC_SHOWSELALWAYS 1353 +#define IDC_TRACKSELECT 1354 +#define IDC_SHOWGROUPCOUNTS 1355 +#define IDC_HIDECOUNTSWHENEMPTY 1356 +#define IDC_DIVIDERONOFF 1357 +#define IDC_NOTNOTRANSLUCENTSEL 1358 +#define IDC_LINEWITHGROUPS 1359 +#define IDC_QUICKSEARCHVISONLY 1360 +#define IDC_SORTGROUPSALPHA 1361 +#define IDC_NOTNOSMOOTHSCROLLING 1362 +#define IDC_BITMAP 1363 +#define IDC_STWINDOWGROUP 1364 +#define IDC_STATIC01 1365 +#define IDC_SORTPRIMARY 1420 +#define IDC_HIDE 1534 +#define IDC_TOPLINE 1535 +#define IDC_BRINGTOFRONT 1579 +#define IDC_LOGO 1591 +#define IDC_BLINKTIME 1607 +#define IDC_BLINKSPIN 1608 +#define IDC_DISABLEBLINK 1609 +#define IDC_IDLE 1610 +#define IDC_SBPANELBEVEL 1611 +#define IDC_DBLCLKAVATARS 1611 +#define IDC_XSTATUSASSTATUS 1611 +#define IDC_NOSCROLLBAR 1613 +#define IDC_ADDVIEWMODE 1633 +#define IDC_SKINFILESELECT 1633 +#define IDC_IGN_ALL 1633 +#define IDC_EXPORT 1634 +#define IDC_DELETEVIEWMODE 1634 +#define IDC_IGN_NONE 1634 +#define IDC_RELOAD 1635 +#define IDC_IGN_ADDPERMANENTLY 1635 +#define IDC_DSP_LOADDEFAULT 1636 +#define IDC_ONDESKTOP 1657 +#define IDC_WINCOLOUR 1659 +#define IDC_ICONBLINK 1660 +#define IDC_APPLYLASTVIEWMODE 1661 +#define IDC_IGNORESELFORGROUPS 1722 +#define IDC_CLISTAVATARS 1729 +#define IDC_ALIGNMENT 1730 +#define IDC_AVATARSBORDER 1732 +#define IDC_AVATARBORDERCLR 1733 +#define IDC_AVATARSROUNDED 1734 +#define IDC_DUALROWMODE 1735 +#define IDC_CLISTALIGN 1737 +#define IDC_CLISTSUNKEN 1738 +#define IDC_EVENTAREAAUTOHIDE 1740 +#define IDC_RADIUS 1742 +#define IDC_RADIUSSPIN 1743 +#define IDC_ALWAYSALIGNNICK 1744 +#define IDC_SELECTIVEICONS 1746 +#define IDC_OVERLAYICONS 1747 +#define IDC_AVATARHEIGHT 1748 +#define IDC_NOAVATARSOFFLINE 1749 +#define IDC_CORNERRAD 1751 +#define IDC_CORNERSPIN 1752 +#define IDC_AVATARPADDING 1753 +#define IDC_GRPTOPPADDING 1753 +#define IDC_AVATARPADDINGSPIN 1754 +#define IDC_GRPPADDINGSPIN 1754 +#define IDC_LASTITEMPADDING 1755 +#define IDC_LASTITEMPADDINGSPIN 1756 +#define IDC_TBHIDEOFFLINE 1800 +#define IDC_TBHIDEGROUPS 1801 +#define IDC_TBSOUND 1802 +#define IDC_TBFINDANDADD 1803 +#define IDC_TBOPTIONS 1804 +#define IDC_TBMINIMIZE 1805 +#define IDC_TBMENU 1806 +#define IDC_TBGLOBALSTATUS 1807 +#define IDC_TABSRMMSLIST 1808 +#define IDC_TABSRMMMENU 1809 +#define IDC_TBSELECTVIEWMODE 1810 +#define IDC_ROUNDEDBORDER 1810 +#define IDC_TBCLEARVIEWMODE 1811 +#define IDC_TBCONFIGUREVIEWMODE 1812 +#define IDC_TBTOPMENU 1813 +#define IDC_TBTOPSTATUS 1814 +#define IDC_TBFOLDER 1815 +#define IDC_TBPOPUP 1816 +#define IDC_TBACCOUNTS 1817 +#define IDC_TBFIRSTUID 1820 +#define IDC_NOTIFYBUTTON 1900 +#define IDC_CLNICER 2002 +#define IDC_SUPPORT 2003 +#define IDI_OVL_OFFLINE 2050 +#define IDI_OVL_ONLINE 2051 +#define IDI_OVL_AWAY 2052 +#define IDI_OVL_DND 2053 +#define IDI_OVL_NA 2054 +#define IDI_OVL_OCCUPIED 2055 +#define IDI_OVL_FREEFORCHAT 2056 +#define IDI_OVL_INVISIBLE 2057 +#define IDI_OVL_ONTHEPHONE 2058 +#define IDI_OVL_OUTTOLUNCH 2059 +#define IDI_HIDEOFFLINE 2100 +#define IDI_HIDEGROUPS 2101 +#define IDI_SOUNDSON 2102 +#define IDI_FINDANDADD 2103 +#define IDI_TBOPTIONS 2104 +#define IDI_MINIMIZE 2105 +#define IDI_SOUNDSOFF 2106 +#define IDI_TABSRMMSESSIONLIST 2107 +#define IDI_TABSRMMMENU 2108 +#define IDI_CLVISIBLE 2109 +#define IDI_CLINVISIBLE 2110 +#define IDI_PROTOCONNECTING 2111 +#define IDI_TBTOPMENU 2112 +#define IDI_TBACCOUNTS 2113 +#define IDC_FLT_DEFHOVERTIME 2200 +#define IDC_CLUIFRAMESBDR 25492 +#define IDC_FLT_PADLEFTSPIN 25494 +#define IDC_FLT_PADLEFT 25495 +#define IDC_GROUPALIGN 25499 +#define IDC_BORDERSTYLE 25501 +#define IDC_CURVIEWMODE2 25503 +#define ID_ICQ_EXIT 40001 +#define IDC_STATIC7 40002 +#define POPUP_HIDEEMPTYGROUPS 40003 +#define POPUP_NEWSUBGROUP 40004 +#define POPUP_HIDEOFFLINE 40005 +#define POPUP_GROUPHIDEOFFLINE 40006 +#define POPUP_HIDEOFFLINEROOT 40007 +#define POPUP_DISABLEGROUPS 40008 +#define IDC_VIEWMODES 40010 +#define IDC_PROTOCOLS 40011 +#define IDC_GROUPS 40012 +#define IDC_STATUSMODES 40013 +#define IDC_NEWVIEMODE 40014 +#define POPUP_HIDEMIRANDA 40017 +#define IDC_TAB 40017 +#define IDC_STATIC1 40018 +#define IDC_STATIC2 40019 +#define IDC_STATIC3 40020 +#define POPUP_VISIBILITY 40021 +#define IDC_STATIC16 40021 +#define IDC_STATIC4 40022 +#define IDC_STATIC5 40023 +#define IDC_CLIST 40025 +#define IDC_STATIC8 40026 +#define IDC_STATIC9 40027 +#define POPUP_BUTTONS 40028 +#define IDC_CLEARALL 40028 +#define POPUP_FRAME 40029 +#define IDC_STATIC10 40029 +#define IDC_PROTOGROUPOP 40030 +#define POPUP_MOVEMARKEDHERE 40031 +#define IDC_GROUPSTATUSOP 40031 +#define IDC_LASTMESSAGEOP 40032 +#define ID_BUTTONS_ONLINE 40033 +#define IDC_SKINFILE 40034 +#define IDC_LASTMESSAGEUNIT 40034 +#define IDC_FLT_AVATARS 40036 +#define IDC_HIDECONTACT 40036 +#define IDC_FLT_DUALROWS 40037 +#define IDC_FLT_EXTRAICONS 40038 +#define ID_TRAY_HIDE 40038 +#define ID_TRAY_EXIT 40039 +#define IDC_FLT_SYNCED 40039 +#define POPUP_SHOWMETAICONS 40040 +#define IDC_FLT_AUTOHIDE 40040 +#define IDC_FLT_FILLSTD 40041 +#define IDC_FLT_PADRIGHT 40043 +#define IDC_LASTMSGVALUE 40043 +#define IDC_FLT_PADRIGHTSPIN 40044 +#define IDC_FLT_PADTOP 40045 +#define IDC_SKINFILENAME 40045 +#define IDC_FLT_PADTOPSPIN 40046 +#define IDC_SELECTSKINFILE 40046 +#define IDC_FLT_PADBOTTOM 40047 +#define IDC_RELOADSKIN 40047 +#define IDC_FLT_PADBOTTOMSPIN 40048 +#define IDC_UNLOAD 40048 +#define POPUP_NEWGROUP 40050 +#define IDC_SECONDLINEMODE 40050 +#define POPUP_SHOWSTATUSICONS 40051 +#define IDC_OVERLAYICON 40051 +#define IDC_SHOWLOCALTIME1 40052 +#define POPUP_RENAMEGROUP 40052 +#define POPUP_DELETEGROUP 40053 +#define IDC_DSP_ADD -25483 +#define IDC_DSP_DELETE 40054 +#define IDC_FLT_ENABLED 40054 +#define IDC_DSP_RENAME 40055 +#define IDC_FLT_OPACITY 40055 +#define IDC_DSP_APPLY 40056 +#define IDC_FLT_ACTIVEOPACITY 40056 +#define POPUP_FLOATER 40057 +#define POPUP_FLOATER_AUTOHIDE 40058 +#define IDC_FLT_WIDTH 40058 +#define IDC_AVATARDISPMODE 40059 +#define IDC_FLT_WIDTHSPIN 40059 +#define POPUP_FLOATER_EVENTS 40060 +#define IDC_FLT_SNAP 40060 +#define IDC_FLT_ACTIVEOPACITYVALUE 40061 +#define IDC_FLT_BORDER 40062 +#define IDC_FLT_ROUNDED 40063 +#define IDC_FLT_RADIUS 40065 +#define IDC_FLT_RADIUSSPIN 40066 +#define IDC_FLT_HOVERTIME 40067 +#define IDC_RESETXICONS 40067 +#define IDC_FLT_SHOWTOOLTIPS 40068 +#define IDC_FLT_HOVERTIMESPIN 40069 +#define IDC_FLT_OPACITYVALUE 40070 +#define IDC_FLT_BORDERCOLOUR 40072 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 10 +#define _APS_NEXT_COMMAND_VALUE 40061 +#define _APS_NEXT_CONTROL_VALUE 40066 +#define _APS_NEXT_SYMED_VALUE 40154 +#endif +#endif diff --git a/plugins/Clist_nicer/SRC/Include/rowheight_funcs.h b/plugins/Clist_nicer/SRC/Include/rowheight_funcs.h new file mode 100644 index 0000000000..383db5b592 --- /dev/null +++ b/plugins/Clist_nicer/SRC/Include/rowheight_funcs.h @@ -0,0 +1,85 @@ +#ifndef __ROWHEIGHT_FUNCS_H__ +# define __ROWHEIGHT_FUNCS_H__ + +#define ROW_SPACE_BEETWEEN_LINES 0 +#define ICON_HEIGHT 16 + +class RowHeight { + +public: + static BOOL Alloc (ClcData *dat, int size); + static BOOL Init (ClcData *dat); + static void Free (ClcData *dat); + static void Clear (ClcData *dat); + + // Calc and store max row height + static int getMaxRowHeight (ClcData *dat, const HWND hwnd); + + + // Calc and store row height + static int getRowHeight (ClcData *dat, const HWND hwnd, ClcContact* contact, int item, DWORD style) + { + int height = 0; + //DWORD style=GetWindowLongPtr(hwnd,GWL_STYLE); + + //if(contact->iRowHeight == item) + // return(dat->row_heights[item]); + + if (!Alloc(dat, item + 1)) + return -1; + + height = dat->fontInfo[GetBasicFontID(contact)].fontHeight; + + if (!dat->bisEmbedded) { + if(contact->bSecondLine != MULTIROW_NEVER && contact->bSecondLine != MULTIROW_IFSPACE && contact->type == CLCIT_CONTACT) { + if ((contact->bSecondLine == MULTIROW_ALWAYS || ((cfg::dat.dwFlags & CLUI_FRAME_SHOWSTATUSMSG && contact->bSecondLine == MULTIROW_IFNEEDED) && (contact->xStatus > 0 || cfg::eCache[contact->extraCacheEntry].bStatusMsgValid > STATUSMSG_XSTATUSID)))) + height += (dat->fontInfo[FONTID_STATUS].fontHeight + cfg::dat.avatarPadding); + } + + // Avatar size + if (contact->cFlags & ECF_AVATAR && contact->type == CLCIT_CONTACT && contact->ace != NULL && !(contact->ace->dwFlags & AVS_HIDEONCLIST)) + height = max(height, cfg::dat.avatarSize + cfg::dat.avatarPadding); + } + + // Checkbox size + if ((style&CLS_CHECKBOXES && contact->type==CLCIT_CONTACT) || + (style&CLS_GROUPCHECKBOXES && contact->type==CLCIT_GROUP) || + (contact->type==CLCIT_INFO && contact->flags&CLCIIF_CHECKBOX)) + { + height = max(height, dat->checkboxSize); + } + + //height += 2 * dat->row_border; + // Min size + height = max(height, contact->type == CLCIT_GROUP ? dat->group_row_height : dat->min_row_heigh); + height += cfg::dat.bRowSpacing; + + dat->row_heights[item] = height; + //contact->iRowHeight = item; + + return height; + } + + // Calc and store row height for all itens in the list + static void calcRowHeights (ClcData *dat, HWND hwnd); + + // Calc item top Y (using stored data) + static int getItemTopY (ClcData *dat, int item); + + // Calc item bottom Y (using stored data) + static int getItemBottomY (ClcData *dat, int item); + + // Calc total height of rows (using stored data) + static int getTotalHeight (ClcData *dat); + + // Return the line that pos_y is at or -1 (using stored data). Y start at 0 + static int hitTest (ClcData *dat, int pos_y); + + // Returns the height of the chosen row + static int getHeight (ClcData *dat, int item); + + // returns the height for a floating contact + static int getFloatingRowHeight(const ClcData *dat, HWND hwnd, ClcContact *contact, DWORD dwFlags); +}; + +#endif // __ROWHEIGHT_FUNCS_H__ diff --git a/plugins/Clist_nicer/SRC/Include/vsstyle.h b/plugins/Clist_nicer/SRC/Include/vsstyle.h new file mode 100644 index 0000000000..b65e223b51 --- /dev/null +++ b/plugins/Clist_nicer/SRC/Include/vsstyle.h @@ -0,0 +1,1606 @@ +//-------------------------------------------------------------------------// +// VisualStyle Style Guide symbols +//-------------------------------------------------------------------------// + +#ifndef __VSSTYLE_H__ +#define __VSSTYLE_H__ + +// +// property symbol definitions +// + +#define TMTVS_RESERVEDLOW 100000 +#define TMTVS_RESERVEDHIGH 19999 + + + +// +// AEROWIZARDSTYLE class parts and states +// +#define VSCLASS_AEROWIZARDSTYLE L"AEROWIZARDSTYLE" +#define VSCLASS_AEROWIZARD L"AEROWIZARD" + +enum AEROWIZARDPARTS { + AW_TITLEBAR = 1, + AW_HEADERAREA = 2, + AW_CONTENTAREA = 3, + AW_COMMANDAREA = 4, + AW_BUTTON = 5, +}; + +#define AEROWIZARDSTYLEPARTS AEROWIZARDPARTS; + +enum TITLEBARSTATES { + AW_S_TITLEBAR_ACTIVE = 1, + AW_S_TITLEBAR_INACTIVE = 2, +}; + +enum HEADERAREASTATES { + AW_S_HEADERAREA_NOMARGIN = 1, +}; + +enum CONTENTAREASTATES { + AW_S_CONTENTAREA_NOMARGIN = 1, +}; + + +// +// BUTTONSTYLE class parts and states +// +#define VSCLASS_BUTTONSTYLE L"BUTTONSTYLE" +#define VSCLASS_BUTTON L"BUTTON" + +enum BUTTONPARTS { + BP_PUSHBUTTON = 1, + BP_RADIOBUTTON = 2, + BP_CHECKBOX = 3, + BP_GROUPBOX = 4, + BP_USERBUTTON = 5, + BP_COMMANDLINK = 6, + BP_COMMANDLINKGLYPH = 7, +}; + +#define BUTTONSTYLEPARTS BUTTONPARTS; + +enum PUSHBUTTONSTATES { + PBS_NORMAL = 1, + PBS_HOT = 2, + PBS_PRESSED = 3, + PBS_DISABLED = 4, + PBS_DEFAULTED = 5, + PBS_DEFAULTED_ANIMATING = 6, +}; + +enum RADIOBUTTONSTATES { + RBS_UNCHECKEDNORMAL = 1, + RBS_UNCHECKEDHOT = 2, + RBS_UNCHECKEDPRESSED = 3, + RBS_UNCHECKEDDISABLED = 4, + RBS_CHECKEDNORMAL = 5, + RBS_CHECKEDHOT = 6, + RBS_CHECKEDPRESSED = 7, + RBS_CHECKEDDISABLED = 8, +}; + +enum CHECKBOXSTATES { + CBS_UNCHECKEDNORMAL = 1, + CBS_UNCHECKEDHOT = 2, + CBS_UNCHECKEDPRESSED = 3, + CBS_UNCHECKEDDISABLED = 4, + CBS_CHECKEDNORMAL = 5, + CBS_CHECKEDHOT = 6, + CBS_CHECKEDPRESSED = 7, + CBS_CHECKEDDISABLED = 8, + CBS_MIXEDNORMAL = 9, + CBS_MIXEDHOT = 10, + CBS_MIXEDPRESSED = 11, + CBS_MIXEDDISABLED = 12, + CBS_IMPLICITNORMAL = 13, + CBS_IMPLICITHOT = 14, + CBS_IMPLICITPRESSED = 15, + CBS_IMPLICITDISABLED = 16, + CBS_EXCLUDEDNORMAL = 17, + CBS_EXCLUDEDHOT = 18, + CBS_EXCLUDEDPRESSED = 19, + CBS_EXCLUDEDDISABLED = 20, +}; + +enum GROUPBOXSTATES { + GBS_NORMAL = 1, + GBS_DISABLED = 2, +}; + +enum COMMANDLINKSTATES { + CMDLS_NORMAL = 1, + CMDLS_HOT = 2, + CMDLS_PRESSED = 3, + CMDLS_DISABLED = 4, + CMDLS_DEFAULTED = 5, + CMDLS_DEFAULTED_ANIMATING = 6, +}; + +enum COMMANDLINKGLYPHSTATES { + CMDLGS_NORMAL = 1, + CMDLGS_HOT = 2, + CMDLGS_PRESSED = 3, + CMDLGS_DISABLED = 4, + CMDLGS_DEFAULTED = 5, +}; + + +// +// COMBOBOXSTYLE class parts and states +// +#define VSCLASS_COMBOBOXSTYLE L"COMBOBOXSTYLE" +#define VSCLASS_COMBOBOX L"COMBOBOX" + +enum COMBOBOXPARTS { + CP_DROPDOWNBUTTON = 1, + CP_BACKGROUND = 2, + CP_TRANSPARENTBACKGROUND = 3, + CP_BORDER = 4, + CP_READONLY = 5, + CP_DROPDOWNBUTTONRIGHT = 6, + CP_DROPDOWNBUTTONLEFT = 7, + CP_CUEBANNER = 8, +}; + +#define COMBOBOXSTYLEPARTS COMBOBOXPARTS; + +enum COMBOBOXSTYLESTATES { + CBXS_NORMAL = 1, + CBXS_HOT = 2, + CBXS_PRESSED = 3, + CBXS_DISABLED = 4, +}; + +enum DROPDOWNBUTTONRIGHTSTATES { + CBXSR_NORMAL = 1, + CBXSR_HOT = 2, + CBXSR_PRESSED = 3, + CBXSR_DISABLED = 4, +}; + +enum DROPDOWNBUTTONLEFTSTATES { + CBXSL_NORMAL = 1, + CBXSL_HOT = 2, + CBXSL_PRESSED = 3, + CBXSL_DISABLED = 4, +}; + +enum TRANSPARENTBACKGROUNDSTATES { + CBTBS_NORMAL = 1, + CBTBS_HOT = 2, + CBTBS_DISABLED = 3, + CBTBS_FOCUSED = 4, +}; + +enum BORDERSTATES { + CBB_NORMAL = 1, + CBB_HOT = 2, + CBB_FOCUSED = 3, + CBB_DISABLED = 4, +}; + +enum READONLYSTATES { + CBRO_NORMAL = 1, + CBRO_HOT = 2, + CBRO_PRESSED = 3, + CBRO_DISABLED = 4, +}; + +enum CUEBANNERSTATES { + CBCB_NORMAL = 1, + CBCB_HOT = 2, + CBCB_PRESSED = 3, + CBCB_DISABLED = 4, +}; + + +// +// COMMUNICATIONSSTYLE class parts and states +// +#define VSCLASS_COMMUNICATIONSSTYLE L"COMMUNICATIONSSTYLE" +#define VSCLASS_COMMUNICATIONS L"COMMUNICATIONS" + +enum COMMUNICATIONSPARTS { + CSST_TAB = 1, +}; + +#define COMMUNICATIONSSTYLEPARTS COMMUNICATIONSPARTS; + +enum TABSTATES { + CSTB_NORMAL = 1, + CSTB_HOT = 2, + CSTB_SELECTED = 3, +}; + + +// +// CONTROLPANELSTYLE class parts and states +// +#define VSCLASS_CONTROLPANELSTYLE L"CONTROLPANELSTYLE" +#define VSCLASS_CONTROLPANEL L"CONTROLPANEL" + +enum CONTROLPANELPARTS { + CPANEL_NAVIGATIONPANE = 1, + CPANEL_CONTENTPANE = 2, + CPANEL_NAVIGATIONPANELABEL = 3, + CPANEL_CONTENTPANELABEL = 4, + CPANEL_TITLE = 5, + CPANEL_BODYTEXT = 6, + CPANEL_HELPLINK = 7, + CPANEL_TASKLINK = 8, + CPANEL_GROUPTEXT = 9, + CPANEL_CONTENTLINK = 10, + CPANEL_SECTIONTITLELINK = 11, + CPANEL_LARGECOMMANDAREA = 12, + CPANEL_SMALLCOMMANDAREA = 13, + CPANEL_BUTTON = 14, + CPANEL_MESSAGETEXT = 15, + CPANEL_NAVIGATIONPANELINE = 16, + CPANEL_CONTENTPANELINE = 17, + CPANEL_BANNERAREA = 18, + CPANEL_BODYTITLE = 19, +}; + +#define CONTROLPANELSTYLEPARTS CONTROLPANELPARTS; + +enum HELPLINKSTATES { + CPHL_NORMAL = 1, + CPHL_HOT = 2, + CPHL_PRESSED = 3, + CPHL_DISABLED = 4, +}; + +enum TASKLINKSTATES { + CPTL_NORMAL = 1, + CPTL_HOT = 2, + CPTL_PRESSED = 3, + CPTL_DISABLED = 4, + CPTL_PAGE = 5, +}; + +enum CONTENTLINKSTATES { + CPCL_NORMAL = 1, + CPCL_HOT = 2, + CPCL_PRESSED = 3, + CPCL_DISABLED = 4, +}; + +enum SECTIONTITLELINKSTATES { + CPSTL_NORMAL = 1, + CPSTL_HOT = 2, +}; + + +// +// DATEPICKERSTYLE class parts and states +// +#define VSCLASS_DATEPICKERSTYLE L"DATEPICKERSTYLE" +#define VSCLASS_DATEPICKER L"DATEPICKER" + +enum DATEPICKERPARTS { + DP_DATETEXT = 1, + DP_DATEBORDER = 2, + DP_SHOWCALENDARBUTTONRIGHT = 3, +}; + +#define DATEPICKERSTYLEPARTS DATEPICKERPARTS; + +enum DATETEXTSTATES { + DPDT_NORMAL = 1, + DPDT_DISABLED = 2, + DPDT_SELECTED = 3, +}; + +enum DATEBORDERSTATES { + DPDB_NORMAL = 1, + DPDB_HOT = 2, + DPDB_FOCUSED = 3, + DPDB_DISABLED = 4, +}; + +enum SHOWCALENDARBUTTONRIGHTSTATES { + DPSCBR_NORMAL = 1, + DPSCBR_HOT = 2, + DPSCBR_PRESSED = 3, + DPSCBR_DISABLED = 4, +}; + + +// +// DRAGDROPSTYLE class parts and states +// +#define VSCLASS_DRAGDROPSTYLE L"DRAGDROPSTYLE" +#define VSCLASS_DRAGDROP L"DRAGDROP" + +enum DRAGDROPPARTS { + DD_COPY = 1, + DD_MOVE = 2, + DD_UPDATEMETADATA = 3, + DD_CREATELINK = 4, + DD_WARNING = 5, + DD_NONE = 6, + DD_IMAGEBG = 7, + DD_TEXTBG = 8, +}; + +#define DRAGDROPSTYLEPARTS DRAGDROPPARTS; + +enum COPYSTATES { + DDCOPY_HIGHLIGHT = 1, + DDCOPY_NOHIGHLIGHT = 2, +}; + +enum MOVESTATES { + DDMOVE_HIGHLIGHT = 1, + DDMOVE_NOHIGHLIGHT = 2, +}; + +enum UPDATEMETADATASTATES { + DDUPDATEMETADATA_HIGHLIGHT = 1, + DDUPDATEMETADATA_NOHIGHLIGHT = 2, +}; + +enum CREATELINKSTATES { + DDCREATELINK_HIGHLIGHT = 1, + DDCREATELINK_NOHIGHLIGHT = 2, +}; + +enum WARNINGSTATES { + DDWARNING_HIGHLIGHT = 1, + DDWARNING_NOHIGHLIGHT = 2, +}; + +enum NONESTATES { + DDNONE_HIGHLIGHT = 1, + DDNONE_NOHIGHLIGHT = 2, +}; + + +// +// EDITSTYLE class parts and states +// +#define VSCLASS_EDITSTYLE L"EDITSTYLE" +#define VSCLASS_EDIT L"EDIT" + +enum EDITPARTS { + EP_EDITTEXT = 1, + EP_CARET = 2, + EP_BACKGROUND = 3, + EP_PASSWORD = 4, + EP_BACKGROUNDWITHBORDER = 5, + EP_EDITBORDER_NOSCROLL = 6, + EP_EDITBORDER_HSCROLL = 7, + EP_EDITBORDER_VSCROLL = 8, + EP_EDITBORDER_HVSCROLL = 9, +}; + +#define EDITSTYLEPARTS EDITPARTS; + +enum EDITTEXTSTATES { + ETS_NORMAL = 1, + ETS_HOT = 2, + ETS_SELECTED = 3, + ETS_DISABLED = 4, + ETS_FOCUSED = 5, + ETS_READONLY = 6, + ETS_ASSIST = 7, + ETS_CUEBANNER = 8, +}; + +enum BACKGROUNDSTATES { + EBS_NORMAL = 1, + EBS_HOT = 2, + EBS_DISABLED = 3, + EBS_FOCUSED = 4, + EBS_READONLY = 5, + EBS_ASSIST = 6, +}; + +enum BACKGROUNDWITHBORDERSTATES { + EBWBS_NORMAL = 1, + EBWBS_HOT = 2, + EBWBS_DISABLED = 3, + EBWBS_FOCUSED = 4, +}; + +enum EDITBORDER_NOSCROLLSTATES { + EPSN_NORMAL = 1, + EPSN_HOT = 2, + EPSN_FOCUSED = 3, + EPSN_DISABLED = 4, +}; + +enum EDITBORDER_HSCROLLSTATES { + EPSH_NORMAL = 1, + EPSH_HOT = 2, + EPSH_FOCUSED = 3, + EPSH_DISABLED = 4, +}; + +enum EDITBORDER_VSCROLLSTATES { + EPSV_NORMAL = 1, + EPSV_HOT = 2, + EPSV_FOCUSED = 3, + EPSV_DISABLED = 4, +}; + +enum EDITBORDER_HVSCROLLSTATES { + EPSHV_NORMAL = 1, + EPSHV_HOT = 2, + EPSHV_FOCUSED = 3, + EPSHV_DISABLED = 4, +}; + + +// +// EXPLORERBARSTYLE class parts and states +// +#define VSCLASS_EXPLORERBARSTYLE L"EXPLORERBARSTYLE" +#define VSCLASS_EXPLORERBAR L"EXPLORERBAR" + +enum EXPLORERBARPARTS { + EBP_HEADERBACKGROUND = 1, + EBP_HEADERCLOSE = 2, + EBP_HEADERPIN = 3, + EBP_IEBARMENU = 4, + EBP_NORMALGROUPBACKGROUND = 5, + EBP_NORMALGROUPCOLLAPSE = 6, + EBP_NORMALGROUPEXPAND = 7, + EBP_NORMALGROUPHEAD = 8, + EBP_SPECIALGROUPBACKGROUND = 9, + EBP_SPECIALGROUPCOLLAPSE = 10, + EBP_SPECIALGROUPEXPAND = 11, + EBP_SPECIALGROUPHEAD = 12, +}; + +#define EXPLORERBARSTYLEPARTS EXPLORERBARPARTS; + +enum HEADERCLOSESTATES { + EBHC_NORMAL = 1, + EBHC_HOT = 2, + EBHC_PRESSED = 3, +}; + +enum HEADERPINSTATES { + EBHP_NORMAL = 1, + EBHP_HOT = 2, + EBHP_PRESSED = 3, + EBHP_SELECTEDNORMAL = 4, + EBHP_SELECTEDHOT = 5, + EBHP_SELECTEDPRESSED = 6, +}; + +enum IEBARMENUSTATES { + EBM_NORMAL = 1, + EBM_HOT = 2, + EBM_PRESSED = 3, +}; + +enum NORMALGROUPCOLLAPSESTATES { + EBNGC_NORMAL = 1, + EBNGC_HOT = 2, + EBNGC_PRESSED = 3, +}; + +enum NORMALGROUPEXPANDSTATES { + EBNGE_NORMAL = 1, + EBNGE_HOT = 2, + EBNGE_PRESSED = 3, +}; + +enum SPECIALGROUPCOLLAPSESTATES { + EBSGC_NORMAL = 1, + EBSGC_HOT = 2, + EBSGC_PRESSED = 3, +}; + +enum SPECIALGROUPEXPANDSTATES { + EBSGE_NORMAL = 1, + EBSGE_HOT = 2, + EBSGE_PRESSED = 3, +}; + + +// +// FLYOUTSTYLE class parts and states +// +#define VSCLASS_FLYOUTSTYLE L"FLYOUTSTYLE" +#define VSCLASS_FLYOUT L"FLYOUT" + +enum FLYOUTPARTS { + FLYOUT_HEADER = 1, + FLYOUT_BODY = 2, + FLYOUT_LABEL = 3, + FLYOUT_LINK = 4, + FLYOUT_DIVIDER = 5, + FLYOUT_WINDOW = 6, + FLYOUT_LINKAREA = 7, + FLYOUT_LINKHEADER = 8, +}; + +#define FLYOUTSTYLEPARTS FLYOUTPARTS; + +enum LABELSTATES { + FLS_NORMAL = 1, + FLS_SELECTED = 2, + FLS_EMPHASIZED = 3, + FLS_DISABLED = 4, +}; + +enum LINKSTATES { + FLYOUTLINK_NORMAL = 1, + FLYOUTLINK_HOVER = 2, +}; + +enum BODYSTATES { + FBS_NORMAL = 1, + FBS_EMPHASIZED = 2, +}; + +enum LINKHEADERSTATES { + FLH_NORMAL = 1, + FLH_HOVER = 2, +}; + + +// +// HEADERSTYLE class parts and states +// +#define VSCLASS_HEADERSTYLE L"HEADERSTYLE" +#define VSCLASS_HEADER L"HEADER" + +enum HEADERPARTS { + HP_HEADERITEM = 1, + HP_HEADERITEMLEFT = 2, + HP_HEADERITEMRIGHT = 3, + HP_HEADERSORTARROW = 4, + HP_HEADERDROPDOWN = 5, + HP_HEADERDROPDOWNFILTER = 6, + HP_HEADEROVERFLOW = 7, +}; + +#define HEADERSTYLEPARTS HEADERPARTS; + +enum HEADERSTYLESTATES { + HBG_DETAILS = 1, + HBG_ICON = 2, +}; + +enum HEADERITEMSTATES { + HIS_NORMAL = 1, + HIS_HOT = 2, + HIS_PRESSED = 3, + HIS_SORTEDNORMAL = 4, + HIS_SORTEDHOT = 5, + HIS_SORTEDPRESSED = 6, + HIS_ICONNORMAL = 7, + HIS_ICONHOT = 8, + HIS_ICONPRESSED = 9, + HIS_ICONSORTEDNORMAL = 10, + HIS_ICONSORTEDHOT = 11, + HIS_ICONSORTEDPRESSED = 12, +}; + +enum HEADERITEMLEFTSTATES { + HILS_NORMAL = 1, + HILS_HOT = 2, + HILS_PRESSED = 3, +}; + +enum HEADERITEMRIGHTSTATES { + HIRS_NORMAL = 1, + HIRS_HOT = 2, + HIRS_PRESSED = 3, +}; + +enum HEADERSORTARROWSTATES { + HSAS_SORTEDUP = 1, + HSAS_SORTEDDOWN = 2, +}; + +enum HEADERDROPDOWNSTATES { + HDDS_NORMAL = 1, + HDDS_SOFTHOT = 2, + HDDS_HOT = 3, +}; + +enum HEADERDROPDOWNFILTERSTATES { + HDDFS_NORMAL = 1, + HDDFS_SOFTHOT = 2, + HDDFS_HOT = 3, +}; + +enum HEADEROVERFLOWSTATES { + HOFS_NORMAL = 1, + HOFS_HOT = 2, +}; + + +// +// LISTBOXSTYLE class parts and states +// +#define VSCLASS_LISTBOXSTYLE L"LISTBOXSTYLE" +#define VSCLASS_LISTBOX L"LISTBOX" + +enum LISTBOXPARTS { + LBCP_BORDER_HSCROLL = 1, + LBCP_BORDER_HVSCROLL = 2, + LBCP_BORDER_NOSCROLL = 3, + LBCP_BORDER_VSCROLL = 4, + LBCP_ITEM = 5, +}; + +#define LISTBOXSTYLEPARTS LISTBOXPARTS; + +enum BORDER_HSCROLLSTATES { + LBPSH_NORMAL = 1, + LBPSH_FOCUSED = 2, + LBPSH_HOT = 3, + LBPSH_DISABLED = 4, +}; + +enum BORDER_HVSCROLLSTATES { + LBPSHV_NORMAL = 1, + LBPSHV_FOCUSED = 2, + LBPSHV_HOT = 3, + LBPSHV_DISABLED = 4, +}; + +enum BORDER_NOSCROLLSTATES { + LBPSN_NORMAL = 1, + LBPSN_FOCUSED = 2, + LBPSN_HOT = 3, + LBPSN_DISABLED = 4, +}; + +enum BORDER_VSCROLLSTATES { + LBPSV_NORMAL = 1, + LBPSV_FOCUSED = 2, + LBPSV_HOT = 3, + LBPSV_DISABLED = 4, +}; + +enum ITEMSTATES { + LBPSI_HOT = 1, + LBPSI_HOTSELECTED = 2, + LBPSI_SELECTED = 3, + LBPSI_SELECTEDNOTFOCUS = 4, +}; + + +// +// LISTVIEWSTYLE class parts and states +// +#define VSCLASS_LISTVIEWSTYLE L"LISTVIEWSTYLE" +#define VSCLASS_LISTVIEW L"LISTVIEW" + +enum LISTVIEWPARTS { + LVP_LISTITEM = 1, + LVP_LISTGROUP = 2, + LVP_LISTDETAIL = 3, + LVP_LISTSORTEDDETAIL = 4, + LVP_EMPTYTEXT = 5, + LVP_GROUPHEADER = 6, + LVP_GROUPHEADERLINE = 7, + LVP_EXPANDBUTTON = 8, + LVP_COLLAPSEBUTTON = 9, + LVP_COLUMNDETAIL = 10, +}; + +#define LISTVIEWSTYLEPARTS LISTVIEWPARTS; + +enum LISTITEMSTATES { + LISS_NORMAL = 1, + LISS_HOT = 2, + LISS_SELECTED = 3, + LISS_DISABLED = 4, + LISS_SELECTEDNOTFOCUS = 5, + LISS_HOTSELECTED = 6, +}; + +enum GROUPHEADERSTATES { + LVGH_OPEN = 1, + LVGH_OPENHOT = 2, + LVGH_OPENSELECTED = 3, + LVGH_OPENSELECTEDHOT = 4, + LVGH_OPENSELECTEDNOTFOCUSED = 5, + LVGH_OPENSELECTEDNOTFOCUSEDHOT = 6, + LVGH_OPENMIXEDSELECTION = 7, + LVGH_OPENMIXEDSELECTIONHOT = 8, + LVGH_CLOSE = 9, + LVGH_CLOSEHOT = 10, + LVGH_CLOSESELECTED = 11, + LVGH_CLOSESELECTEDHOT = 12, + LVGH_CLOSESELECTEDNOTFOCUSED = 13, + LVGH_CLOSESELECTEDNOTFOCUSEDHOT = 14, + LVGH_CLOSEMIXEDSELECTION = 15, + LVGH_CLOSEMIXEDSELECTIONHOT = 16, +}; + +enum GROUPHEADERLINESTATES { + LVGHL_OPEN = 1, + LVGHL_OPENHOT = 2, + LVGHL_OPENSELECTED = 3, + LVGHL_OPENSELECTEDHOT = 4, + LVGHL_OPENSELECTEDNOTFOCUSED = 5, + LVGHL_OPENSELECTEDNOTFOCUSEDHOT = 6, + LVGHL_OPENMIXEDSELECTION = 7, + LVGHL_OPENMIXEDSELECTIONHOT = 8, + LVGHL_CLOSE = 9, + LVGHL_CLOSEHOT = 10, + LVGHL_CLOSESELECTED = 11, + LVGHL_CLOSESELECTEDHOT = 12, + LVGHL_CLOSESELECTEDNOTFOCUSED = 13, + LVGHL_CLOSESELECTEDNOTFOCUSEDHOT = 14, + LVGHL_CLOSEMIXEDSELECTION = 15, + LVGHL_CLOSEMIXEDSELECTIONHOT = 16, +}; + +enum EXPANDBUTTONSTATES { + LVEB_NORMAL = 1, + LVEB_HOVER = 2, + LVEB_PUSHED = 3, +}; + +enum COLLAPSEBUTTONSTATES { + LVCB_NORMAL = 1, + LVCB_HOVER = 2, + LVCB_PUSHED = 3, +}; + + +// +// MENUSTYLE class parts and states +// +#define VSCLASS_MENUSTYLE L"MENUSTYLE" +#define VSCLASS_MENU L"MENU" + +enum MENUPARTS { + MENU_MENUITEM_TMSCHEMA = 1, + MENU_MENUDROPDOWN_TMSCHEMA = 2, + MENU_MENUBARITEM_TMSCHEMA = 3, + MENU_MENUBARDROPDOWN_TMSCHEMA = 4, + MENU_CHEVRON_TMSCHEMA = 5, + MENU_SEPARATOR_TMSCHEMA = 6, + MENU_BARBACKGROUND = 7, + MENU_BARITEM = 8, + MENU_POPUPBACKGROUND = 9, + MENU_POPUPBORDERS = 10, + MENU_POPUPCHECK = 11, + MENU_POPUPCHECKBACKGROUND = 12, + MENU_POPUPGUTTER = 13, + MENU_POPUPITEM = 14, + MENU_POPUPSEPARATOR = 15, + MENU_POPUPSUBMENU = 16, + MENU_SYSTEMCLOSE = 17, + MENU_SYSTEMMAXIMIZE = 18, + MENU_SYSTEMMINIMIZE = 19, + MENU_SYSTEMRESTORE = 20, +}; + +#define MENUSTYLEPARTS MENUPARTS; + +enum BARBACKGROUNDSTATES { + MB_ACTIVE = 1, + MB_INACTIVE = 2, +}; + +enum BARITEMSTATES { + MBI_NORMAL = 1, + MBI_HOT = 2, + MBI_PUSHED = 3, + MBI_DISABLED = 4, + MBI_DISABLEDHOT = 5, + MBI_DISABLEDPUSHED = 6, +}; + +enum POPUPCHECKSTATES { + MC_CHECKMARKNORMAL = 1, + MC_CHECKMARKDISABLED = 2, + MC_BULLETNORMAL = 3, + MC_BULLETDISABLED = 4, +}; + +enum POPUPCHECKBACKGROUNDSTATES { + MCB_DISABLED = 1, + MCB_NORMAL = 2, + MCB_BITMAP = 3, +}; + +enum POPUPITEMSTATES { + MPI_NORMAL = 1, + MPI_HOT = 2, + MPI_DISABLED = 3, + MPI_DISABLEDHOT = 4, +}; + +enum POPUPSUBMENUSTATES { + MSM_NORMAL = 1, + MSM_DISABLED = 2, +}; + +enum SYSTEMCLOSESTATES { + MSYSC_NORMAL = 1, + MSYSC_DISABLED = 2, +}; + +enum SYSTEMMAXIMIZESTATES { + MSYSMX_NORMAL = 1, + MSYSMX_DISABLED = 2, +}; + +enum SYSTEMMINIMIZESTATES { + MSYSMN_NORMAL = 1, + MSYSMN_DISABLED = 2, +}; + +enum SYSTEMRESTORESTATES { + MSYSR_NORMAL = 1, + MSYSR_DISABLED = 2, +}; + + +// +// NAVIGATION class parts and states +// +#define VSCLASS_NAVIGATION L"NAVIGATION" + +enum NAVIGATIONPARTS { + NAV_BACKBUTTON = 1, + NAV_FORWARDBUTTON = 2, + NAV_MENUBUTTON = 3, +}; + +enum NAV_BACKBUTTONSTATES { + NAV_BB_NORMAL = 1, + NAV_BB_HOT = 2, + NAV_BB_PRESSED = 3, + NAV_BB_DISABLED = 4, +}; + +enum NAV_FORWARDBUTTONSTATES { + NAV_FB_NORMAL = 1, + NAV_FB_HOT = 2, + NAV_FB_PRESSED = 3, + NAV_FB_DISABLED = 4, +}; + +enum NAV_MENUBUTTONSTATES { + NAV_MB_NORMAL = 1, + NAV_MB_HOT = 2, + NAV_MB_PRESSED = 3, + NAV_MB_DISABLED = 4, +}; + + +// +// PROGRESSSTYLE class parts and states +// +#define VSCLASS_PROGRESSSTYLE L"PROGRESSSTYLE" +#define VSCLASS_PROGRESS L"PROGRESS" + +enum PROGRESSPARTS { + PP_BAR = 1, + PP_BARVERT = 2, + PP_CHUNK = 3, + PP_CHUNKVERT = 4, + PP_FILL = 5, + PP_FILLVERT = 6, + PP_PULSEOVERLAY = 7, + PP_MOVEOVERLAY = 8, + PP_PULSEOVERLAYVERT = 9, + PP_MOVEOVERLAYVERT = 10, + PP_TRANSPARENTBAR = 11, + PP_TRANSPARENTBARVERT = 12, +}; + +#define PROGRESSSTYLEPARTS PROGRESSPARTS; + +enum TRANSPARENTBARSTATES { + PBBS_NORMAL = 1, + PBBS_PARTIAL = 2, +}; + +enum TRANSPARENTBARVERTSTATES { + PBBVS_NORMAL = 1, + PBBVS_PARTIAL = 2, +}; + +enum FILLSTATES { + PBFS_NORMAL = 1, + PBFS_ERROR = 2, + PBFS_PAUSED = 3, + PBFS_PARTIAL = 4, +}; + +enum FILLVERTSTATES { + PBFVS_NORMAL = 1, + PBFVS_ERROR = 2, + PBFVS_PAUSED = 3, + PBFVS_PARTIAL = 4, +}; + + +// +// REBARSTYLE class parts and states +// +#define VSCLASS_REBARSTYLE L"REBARSTYLE" +#define VSCLASS_REBAR L"REBAR" + +enum REBARPARTS { + RP_GRIPPER = 1, + RP_GRIPPERVERT = 2, + RP_BAND = 3, + RP_CHEVRON = 4, + RP_CHEVRONVERT = 5, + RP_BACKGROUND = 6, + RP_SPLITTER = 7, + RP_SPLITTERVERT = 8, +}; + +#define REBARSTYLEPARTS REBARPARTS; + +enum CHEVRONSTATES { + CHEVS_NORMAL = 1, + CHEVS_HOT = 2, + CHEVS_PRESSED = 3, +}; + +enum CHEVRONVERTSTATES { + CHEVSV_NORMAL = 1, + CHEVSV_HOT = 2, + CHEVSV_PRESSED = 3, +}; + +enum SPLITTERSTATES { + SPLITS_NORMAL = 1, + SPLITS_HOT = 2, + SPLITS_PRESSED = 3, +}; + +enum SPLITTERVERTSTATES { + SPLITSV_NORMAL = 1, + SPLITSV_HOT = 2, + SPLITSV_PRESSED = 3, +}; + + +// +// SCROLLBARSTYLE class parts and states +// +#define VSCLASS_SCROLLBARSTYLE L"SCROLLBARSTYLE" +#define VSCLASS_SCROLLBAR L"SCROLLBAR" + +enum SCROLLBARPARTS { + SBP_ARROWBTN = 1, + SBP_THUMBBTNHORZ = 2, + SBP_THUMBBTNVERT = 3, + SBP_LOWERTRACKHORZ = 4, + SBP_UPPERTRACKHORZ = 5, + SBP_LOWERTRACKVERT = 6, + SBP_UPPERTRACKVERT = 7, + SBP_GRIPPERHORZ = 8, + SBP_GRIPPERVERT = 9, + SBP_SIZEBOX = 10, +}; + +#define SCROLLBARSTYLEPARTS SCROLLBARPARTS; + +enum ARROWBTNSTATES { + ABS_UPNORMAL = 1, + ABS_UPHOT = 2, + ABS_UPPRESSED = 3, + ABS_UPDISABLED = 4, + ABS_DOWNNORMAL = 5, + ABS_DOWNHOT = 6, + ABS_DOWNPRESSED = 7, + ABS_DOWNDISABLED = 8, + ABS_LEFTNORMAL = 9, + ABS_LEFTHOT = 10, + ABS_LEFTPRESSED = 11, + ABS_LEFTDISABLED = 12, + ABS_RIGHTNORMAL = 13, + ABS_RIGHTHOT = 14, + ABS_RIGHTPRESSED = 15, + ABS_RIGHTDISABLED = 16, + ABS_UPHOVER = 17, + ABS_DOWNHOVER = 18, + ABS_LEFTHOVER = 19, + ABS_RIGHTHOVER = 20, +}; + +enum SCROLLBARSTYLESTATES { + SCRBS_NORMAL = 1, + SCRBS_HOT = 2, + SCRBS_PRESSED = 3, + SCRBS_DISABLED = 4, + SCRBS_HOVER = 5, +}; + +enum SIZEBOXSTATES { + SZB_RIGHTALIGN = 1, + SZB_LEFTALIGN = 2, + SZB_TOPRIGHTALIGN = 3, + SZB_TOPLEFTALIGN = 4, + SZB_HALFBOTTOMRIGHTALIGN = 5, + SZB_HALFBOTTOMLEFTALIGN = 6, + SZB_HALFTOPRIGHTALIGN = 7, + SZB_HALFTOPLEFTALIGN = 8, +}; + + +// +// SPINSTYLE class parts and states +// +#define VSCLASS_SPINSTYLE L"SPINSTYLE" +#define VSCLASS_SPIN L"SPIN" + +enum SPINPARTS { + SPNP_UP = 1, + SPNP_DOWN = 2, + SPNP_UPHORZ = 3, + SPNP_DOWNHORZ = 4, +}; + +#define SPINSTYLEPARTS SPINPARTS; + +enum UPSTATES { + UPS_NORMAL = 1, + UPS_HOT = 2, + UPS_PRESSED = 3, + UPS_DISABLED = 4, +}; + +enum DOWNSTATES { + DNS_NORMAL = 1, + DNS_HOT = 2, + DNS_PRESSED = 3, + DNS_DISABLED = 4, +}; + +enum UPHORZSTATES { + UPHZS_NORMAL = 1, + UPHZS_HOT = 2, + UPHZS_PRESSED = 3, + UPHZS_DISABLED = 4, +}; + +enum DOWNHORZSTATES { + DNHZS_NORMAL = 1, + DNHZS_HOT = 2, + DNHZS_PRESSED = 3, + DNHZS_DISABLED = 4, +}; + + +// +// STATUSSTYLE class parts and states +// +#define VSCLASS_STATUSSTYLE L"STATUSSTYLE" +#define VSCLASS_STATUS L"STATUS" + +enum STATUSPARTS { + SP_PANE = 1, + SP_GRIPPERPANE = 2, + SP_GRIPPER = 3, +}; + +#define STATUSSTYLEPARTS STATUSPARTS; + + +// +// TABSTYLE class parts and states +// +#define VSCLASS_TABSTYLE L"TABSTYLE" +#define VSCLASS_TAB L"TAB" + +enum TABPARTS { + TABP_TABITEM = 1, + TABP_TABITEMLEFTEDGE = 2, + TABP_TABITEMRIGHTEDGE = 3, + TABP_TABITEMBOTHEDGE = 4, + TABP_TOPTABITEM = 5, + TABP_TOPTABITEMLEFTEDGE = 6, + TABP_TOPTABITEMRIGHTEDGE = 7, + TABP_TOPTABITEMBOTHEDGE = 8, + TABP_PANE = 9, + TABP_BODY = 10, + TABP_AEROWIZARDBODY = 11, +}; + +#define TABSTYLEPARTS TABPARTS; + +enum TABITEMSTATES { + TIS_NORMAL = 1, + TIS_HOT = 2, + TIS_SELECTED = 3, + TIS_DISABLED = 4, + TIS_FOCUSED = 5, +}; + +enum TABITEMLEFTEDGESTATES { + TILES_NORMAL = 1, + TILES_HOT = 2, + TILES_SELECTED = 3, + TILES_DISABLED = 4, + TILES_FOCUSED = 5, +}; + +enum TABITEMRIGHTEDGESTATES { + TIRES_NORMAL = 1, + TIRES_HOT = 2, + TIRES_SELECTED = 3, + TIRES_DISABLED = 4, + TIRES_FOCUSED = 5, +}; + +enum TABITEMBOTHEDGESTATES { + TIBES_NORMAL = 1, + TIBES_HOT = 2, + TIBES_SELECTED = 3, + TIBES_DISABLED = 4, + TIBES_FOCUSED = 5, +}; + +enum TOPTABITEMSTATES { + TTIS_NORMAL = 1, + TTIS_HOT = 2, + TTIS_SELECTED = 3, + TTIS_DISABLED = 4, + TTIS_FOCUSED = 5, +}; + +enum TOPTABITEMLEFTEDGESTATES { + TTILES_NORMAL = 1, + TTILES_HOT = 2, + TTILES_SELECTED = 3, + TTILES_DISABLED = 4, + TTILES_FOCUSED = 5, +}; + +enum TOPTABITEMRIGHTEDGESTATES { + TTIRES_NORMAL = 1, + TTIRES_HOT = 2, + TTIRES_SELECTED = 3, + TTIRES_DISABLED = 4, + TTIRES_FOCUSED = 5, +}; + +enum TOPTABITEMBOTHEDGESTATES { + TTIBES_NORMAL = 1, + TTIBES_HOT = 2, + TTIBES_SELECTED = 3, + TTIBES_DISABLED = 4, + TTIBES_FOCUSED = 5, +}; + + +// +// TASKDIALOGSTYLE class parts and states +// +#define VSCLASS_TASKDIALOGSTYLE L"TASKDIALOGSTYLE" +#define VSCLASS_TASKDIALOG L"TASKDIALOG" + +enum TASKDIALOGPARTS { + TDLG_PRIMARYPANEL = 1, + TDLG_MAININSTRUCTIONPANE = 2, + TDLG_MAINICON = 3, + TDLG_CONTENTPANE = 4, + TDLG_CONTENTICON = 5, + TDLG_EXPANDEDCONTENT = 6, + TDLG_COMMANDLINKPANE = 7, + TDLG_SECONDARYPANEL = 8, + TDLG_CONTROLPANE = 9, + TDLG_BUTTONSECTION = 10, + TDLG_BUTTONWRAPPER = 11, + TDLG_EXPANDOTEXT = 12, + TDLG_EXPANDOBUTTON = 13, + TDLG_VERIFICATIONTEXT = 14, + TDLG_FOOTNOTEPANE = 15, + TDLG_FOOTNOTEAREA = 16, + TDLG_FOOTNOTESEPARATOR = 17, + TDLG_EXPANDEDFOOTERAREA = 18, + TDLG_PROGRESSBAR = 19, + TDLG_IMAGEALIGNMENT = 20, + TDLG_RADIOBUTTONPANE = 21, +}; + +#define TASKDIALOGSTYLEPARTS TASKDIALOGPARTS; + +enum CONTENTPANESTATES { + TDLGCPS_STANDALONE = 1, +}; + +enum EXPANDOBUTTONSTATES { + TDLGEBS_NORMAL = 1, + TDLGEBS_HOVER = 2, + TDLGEBS_PRESSED = 3, + TDLGEBS_EXPANDEDNORMAL = 4, + TDLGEBS_EXPANDEDHOVER = 5, + TDLGEBS_EXPANDEDPRESSED = 6, +}; + + +// +// TEXTSTYLE class parts and states +// +#define VSCLASS_TEXTSTYLE L"TEXTSTYLE" + +enum TEXTSTYLEPARTS { + TEXT_MAININSTRUCTION = 1, + TEXT_INSTRUCTION = 2, + TEXT_BODYTITLE = 3, + TEXT_BODYTEXT = 4, + TEXT_SECONDARYTEXT = 5, + TEXT_HYPERLINKTEXT = 6, + TEXT_EXPANDED = 7, + TEXT_LABEL = 8, + TEXT_CONTROLLABEL = 9, +}; + +enum HYPERLINKTEXTSTATES { + TS_HYPERLINK_NORMAL = 1, + TS_HYPERLINK_HOT = 2, + TS_HYPERLINK_PRESSED = 3, + TS_HYPERLINK_DISABLED = 4, +}; + +enum CONTROLLABELSTATES { + TS_CONTROLLABEL_NORMAL = 1, + TS_CONTROLLABEL_DISABLED = 2, +}; + + +// +// TOOLBARSTYLE class parts and states +// +#define VSCLASS_TOOLBARSTYLE L"TOOLBARSTYLE" +#define VSCLASS_TOOLBAR L"TOOLBAR" + +enum TOOLBARPARTS { + TP_BUTTON = 1, + TP_DROPDOWNBUTTON = 2, + TP_SPLITBUTTON = 3, + TP_SPLITBUTTONDROPDOWN = 4, + TP_SEPARATOR = 5, + TP_SEPARATORVERT = 6, + TP_DROPDOWNBUTTONGLYPH = 7, +}; + +#define TOOLBARSTYLEPARTS TOOLBARPARTS; + +enum TOOLBARSTYLESTATES { + TS_NORMAL = 1, + TS_HOT = 2, + TS_PRESSED = 3, + TS_DISABLED = 4, + TS_CHECKED = 5, + TS_HOTCHECKED = 6, + TS_NEARHOT = 7, + TS_OTHERSIDEHOT = 8, +}; + + +// +// TOOLTIPSTYLE class parts and states +// +#define VSCLASS_TOOLTIPSTYLE L"TOOLTIPSTYLE" +#define VSCLASS_TOOLTIP L"TOOLTIP" + +enum TOOLTIPPARTS { + TTP_STANDARD = 1, + TTP_STANDARDTITLE = 2, + TTP_BALLOON = 3, + TTP_BALLOONTITLE = 4, + TTP_CLOSE = 5, + TTP_BALLOONSTEM = 6, + TTP_WRENCH = 7, +}; + +#define TOOLTIPSTYLEPARTS TOOLTIPPARTS; + +enum CLOSESTATES { + TTCS_NORMAL = 1, + TTCS_HOT = 2, + TTCS_PRESSED = 3, +}; + +enum STANDARDSTATES { + TTSS_NORMAL = 1, + TTSS_LINK = 2, +}; + +enum BALLOONSTATES { + TTBS_NORMAL = 1, + TTBS_LINK = 2, +}; + +enum BALLOONSTEMSTATES { + TTBSS_POINTINGUPLEFTWALL = 1, + TTBSS_POINTINGUPCENTERED = 2, + TTBSS_POINTINGUPRIGHTWALL = 3, + TTBSS_POINTINGDOWNRIGHTWALL = 4, + TTBSS_POINTINGDOWNCENTERED = 5, + TTBSS_POINTINGDOWNLEFTWALL = 6, +}; + +enum WRENCHSTATES { + TTWS_NORMAL = 1, + TTWS_HOT = 2, + TTWS_PRESSED = 3, +}; + + +// +// TRACKBARSTYLE class parts and states +// +#define VSCLASS_TRACKBARSTYLE L"TRACKBARSTYLE" +#define VSCLASS_TRACKBAR L"TRACKBAR" + +enum TRACKBARPARTS { + TKP_TRACK = 1, + TKP_TRACKVERT = 2, + TKP_THUMB = 3, + TKP_THUMBBOTTOM = 4, + TKP_THUMBTOP = 5, + TKP_THUMBVERT = 6, + TKP_THUMBLEFT = 7, + TKP_THUMBRIGHT = 8, + TKP_TICS = 9, + TKP_TICSVERT = 10, +}; + +#define TRACKBARSTYLEPARTS TRACKBARPARTS; + +enum TRACKBARSTYLESTATES { + TKS_NORMAL = 1, +}; + +enum TRACKSTATES { + TRS_NORMAL = 1, +}; + +enum TRACKVERTSTATES { + TRVS_NORMAL = 1, +}; + +enum THUMBSTATES { + TUS_NORMAL = 1, + TUS_HOT = 2, + TUS_PRESSED = 3, + TUS_FOCUSED = 4, + TUS_DISABLED = 5, +}; + +enum THUMBBOTTOMSTATES { + TUBS_NORMAL = 1, + TUBS_HOT = 2, + TUBS_PRESSED = 3, + TUBS_FOCUSED = 4, + TUBS_DISABLED = 5, +}; + +enum THUMBTOPSTATES { + TUTS_NORMAL = 1, + TUTS_HOT = 2, + TUTS_PRESSED = 3, + TUTS_FOCUSED = 4, + TUTS_DISABLED = 5, +}; + +enum THUMBVERTSTATES { + TUVS_NORMAL = 1, + TUVS_HOT = 2, + TUVS_PRESSED = 3, + TUVS_FOCUSED = 4, + TUVS_DISABLED = 5, +}; + +enum THUMBLEFTSTATES { + TUVLS_NORMAL = 1, + TUVLS_HOT = 2, + TUVLS_PRESSED = 3, + TUVLS_FOCUSED = 4, + TUVLS_DISABLED = 5, +}; + +enum THUMBRIGHTSTATES { + TUVRS_NORMAL = 1, + TUVRS_HOT = 2, + TUVRS_PRESSED = 3, + TUVRS_FOCUSED = 4, + TUVRS_DISABLED = 5, +}; + +enum TICSSTATES { + TSS_NORMAL = 1, +}; + +enum TICSVERTSTATES { + TSVS_NORMAL = 1, +}; + + +// +// TREEVIEWSTYLE class parts and states +// +#define VSCLASS_TREEVIEWSTYLE L"TREEVIEWSTYLE" +#define VSCLASS_TREEVIEW L"TREEVIEW" + +enum TREEVIEWPARTS { + TVP_TREEITEM = 1, + TVP_GLYPH = 2, + TVP_BRANCH = 3, + TVP_HOTGLYPH = 4, +}; + +#define TREEVIEWSTYLEPARTS TREEVIEWPARTS; + +enum TREEITEMSTATES { + TREIS_NORMAL = 1, + TREIS_HOT = 2, + TREIS_SELECTED = 3, + TREIS_DISABLED = 4, + TREIS_SELECTEDNOTFOCUS = 5, + TREIS_HOTSELECTED = 6, +}; + +enum GLYPHSTATES { + GLPS_CLOSED = 1, + GLPS_OPENED = 2, +}; + +enum HOTGLYPHSTATES { + HGLPS_CLOSED = 1, + HGLPS_OPENED = 2, +}; + + +// +// WINDOWSTYLE class parts and states +// +#define VSCLASS_WINDOWSTYLE L"WINDOWSTYLE" +#define VSCLASS_WINDOW L"WINDOW" + +enum WINDOWPARTS { + WP_CAPTION = 1, + WP_SMALLCAPTION = 2, + WP_MINCAPTION = 3, + WP_SMALLMINCAPTION = 4, + WP_MAXCAPTION = 5, + WP_SMALLMAXCAPTION = 6, + WP_FRAMELEFT = 7, + WP_FRAMERIGHT = 8, + WP_FRAMEBOTTOM = 9, + WP_SMALLFRAMELEFT = 10, + WP_SMALLFRAMERIGHT = 11, + WP_SMALLFRAMEBOTTOM = 12, + WP_SYSBUTTON = 13, + WP_MDISYSBUTTON = 14, + WP_MINBUTTON = 15, + WP_MDIMINBUTTON = 16, + WP_MAXBUTTON = 17, + WP_CLOSEBUTTON = 18, + WP_SMALLCLOSEBUTTON = 19, + WP_MDICLOSEBUTTON = 20, + WP_RESTOREBUTTON = 21, + WP_MDIRESTOREBUTTON = 22, + WP_HELPBUTTON = 23, + WP_MDIHELPBUTTON = 24, + WP_HORZSCROLL = 25, + WP_HORZTHUMB = 26, + WP_VERTSCROLL = 27, + WP_VERTTHUMB = 28, + WP_DIALOG = 29, + WP_CAPTIONSIZINGTEMPLATE = 30, + WP_SMALLCAPTIONSIZINGTEMPLATE = 31, + WP_FRAMELEFTSIZINGTEMPLATE = 32, + WP_SMALLFRAMELEFTSIZINGTEMPLATE = 33, + WP_FRAMERIGHTSIZINGTEMPLATE = 34, + WP_SMALLFRAMERIGHTSIZINGTEMPLATE = 35, + WP_FRAMEBOTTOMSIZINGTEMPLATE = 36, + WP_SMALLFRAMEBOTTOMSIZINGTEMPLATE = 37, + WP_FRAME = 38, +}; + +#define WINDOWSTYLEPARTS WINDOWPARTS; + +enum FRAMESTATES { + FS_ACTIVE = 1, + FS_INACTIVE = 2, +}; + +enum CAPTIONSTATES { + CS_ACTIVE = 1, + CS_INACTIVE = 2, + CS_DISABLED = 3, +}; + +enum MAXCAPTIONSTATES { + MXCS_ACTIVE = 1, + MXCS_INACTIVE = 2, + MXCS_DISABLED = 3, +}; + +enum MINCAPTIONSTATES { + MNCS_ACTIVE = 1, + MNCS_INACTIVE = 2, + MNCS_DISABLED = 3, +}; + +enum HORZSCROLLSTATES { + HSS_NORMAL = 1, + HSS_HOT = 2, + HSS_PUSHED = 3, + HSS_DISABLED = 4, +}; + +enum HORZTHUMBSTATES { + HTS_NORMAL = 1, + HTS_HOT = 2, + HTS_PUSHED = 3, + HTS_DISABLED = 4, +}; + +enum VERTSCROLLSTATES { + VSS_NORMAL = 1, + VSS_HOT = 2, + VSS_PUSHED = 3, + VSS_DISABLED = 4, +}; + +enum VERTTHUMBSTATES { + VTS_NORMAL = 1, + VTS_HOT = 2, + VTS_PUSHED = 3, + VTS_DISABLED = 4, +}; + +enum SYSBUTTONSTATES { + SBS_NORMAL = 1, + SBS_HOT = 2, + SBS_PUSHED = 3, + SBS_DISABLED = 4, +}; + +enum MINBUTTONSTATES { + MINBS_NORMAL = 1, + MINBS_HOT = 2, + MINBS_PUSHED = 3, + MINBS_DISABLED = 4, +}; + +enum MAXBUTTONSTATES { + MAXBS_NORMAL = 1, + MAXBS_HOT = 2, + MAXBS_PUSHED = 3, + MAXBS_DISABLED = 4, +}; + +enum RESTOREBUTTONSTATES { + RBS_NORMAL = 1, + RBS_HOT = 2, + RBS_PUSHED = 3, + RBS_DISABLED = 4, +}; + +enum HELPBUTTONSTATES { + HBS_NORMAL = 1, + HBS_HOT = 2, + HBS_PUSHED = 3, + HBS_DISABLED = 4, +}; + +enum CLOSEBUTTONSTATES { + CBS_NORMAL = 1, + CBS_HOT = 2, + CBS_PUSHED = 3, + CBS_DISABLED = 4, +}; + + +#endif //__VSSTYLE_H__ + diff --git a/plugins/Clist_nicer/SRC/Include/vssym32.h b/plugins/Clist_nicer/SRC/Include/vssym32.h new file mode 100644 index 0000000000..4d2b6fd62d --- /dev/null +++ b/plugins/Clist_nicer/SRC/Include/vssym32.h @@ -0,0 +1,712 @@ +//-------------------------------------------------------------------------// +// VisualStyle Core Win32/ComCtl32 symbols +//-------------------------------------------------------------------------// + +#ifndef __VSSYM32_H__ +#define __VSSYM32_H__ + +#include "VSStyle.h" + +// +// enumerated property values +// + +enum BGTYPE { + BT_IMAGEFILE = 0, + BT_BORDERFILL = 1, + BT_NONE = 2, +}; + + +// +// enumerated property values +// + +enum IMAGELAYOUT { + IL_VERTICAL = 0, + IL_HORIZONTAL = 1, +}; + + +// +// enumerated property values +// + +enum BORDERTYPE { + BT_RECT = 0, + BT_ROUNDRECT = 1, + BT_ELLIPSE = 2, +}; + + +// +// enumerated property values +// + +enum FILLTYPE { + FT_SOLID = 0, + FT_VERTGRADIENT = 1, + FT_HORZGRADIENT = 2, + FT_RADIALGRADIENT = 3, + FT_TILEIMAGE = 4, +}; + + +// +// enumerated property values +// + +enum SIZINGTYPE { + ST_TRUESIZE = 0, + ST_STRETCH = 1, + ST_TILE = 2, +}; + + +// +// enumerated property values +// + +enum HALIGN { + HA_LEFT = 0, + HA_CENTER = 1, + HA_RIGHT = 2, +}; + + +// +// enumerated property values +// + +enum CONTENTALIGNMENT { + CA_LEFT = 0, + CA_CENTER = 1, + CA_RIGHT = 2, +}; + + +// +// enumerated property values +// + +enum VALIGN { + VA_TOP = 0, + VA_CENTER = 1, + VA_BOTTOM = 2, +}; + + +// +// enumerated property values +// + +enum OFFSETTYPE { + OT_TOPLEFT = 0, + OT_TOPRIGHT = 1, + OT_TOPMIDDLE = 2, + OT_BOTTOMLEFT = 3, + OT_BOTTOMRIGHT = 4, + OT_BOTTOMMIDDLE = 5, + OT_MIDDLELEFT = 6, + OT_MIDDLERIGHT = 7, + OT_LEFTOFCAPTION = 8, + OT_RIGHTOFCAPTION = 9, + OT_LEFTOFLASTBUTTON = 10, + OT_RIGHTOFLASTBUTTON = 11, + OT_ABOVELASTBUTTON = 12, + OT_BELOWLASTBUTTON = 13, +}; + + +// +// enumerated property values +// + +enum ICONEFFECT { + ICE_NONE = 0, + ICE_GLOW = 1, + ICE_SHADOW = 2, + ICE_PULSE = 3, + ICE_ALPHA = 4, +}; + + +// +// enumerated property values +// + +enum TEXTSHADOWTYPE { + TST_NONE = 0, + TST_SINGLE = 1, + TST_CONTINUOUS = 2, +}; + + +// +// enumerated property values +// + +enum GLYPHTYPE { + GT_NONE = 0, + GT_IMAGEGLYPH = 1, + GT_FONTGLYPH = 2, +}; + + +// +// enumerated property values +// + +enum IMAGESELECTTYPE { + IST_NONE = 0, + IST_SIZE = 1, + IST_DPI = 2, +}; + + +// +// enumerated property values +// + +enum TRUESIZESCALINGTYPE { + TSST_NONE = 0, + TSST_SIZE = 1, + TSST_DPI = 2, +}; + + +// +// enumerated property values +// + +enum GLYPHFONTSIZINGTYPE { + GFST_NONE = 0, + GFST_SIZE = 1, + GFST_DPI = 2, +}; + +// +// property symbol definitions +// + +#define TMT_RESERVEDLOW 0 +#define TMT_RESERVEDHIGH 7999 + +#define TMT_DIBDATA 2 +#define TMT_GLYPHDIBDATA 8 +#define TMT_ENUM 200 +#define TMT_STRING 201 +#define TMT_INT 202 +#define TMT_BOOL 203 +#define TMT_COLOR 204 +#define TMT_MARGINS 205 +#define TMT_FILENAME 206 +#define TMT_SIZE 207 +#define TMT_POSITION 208 +#define TMT_RECT 209 +#define TMT_FONT 210 +#define TMT_INTLIST 211 +#define TMT_HBITMAP 212 +#define TMT_DISKSTREAM 213 +#define TMT_STREAM 214 +#define TMT_BITMAPREF 215 +#define TMT_COLORSCHEMES 401 +#define TMT_SIZES 402 +#define TMT_CHARSET 403 +#define TMT_NAME 600 +#define TMT_DISPLAYNAME 601 +#define TMT_TOOLTIP 602 +#define TMT_COMPANY 603 +#define TMT_AUTHOR 604 +#define TMT_COPYRIGHT 605 +#define TMT_URL 606 +#define TMT_VERSION 607 +#define TMT_DESCRIPTION 608 +#define TMT_FIRST_RCSTRING_NAME TMT_DISPLAYNAME +#define TMT_LAST_RCSTRING_NAME TMT_DESCRIPTION +#define TMT_CAPTIONFONT 801 +#define TMT_SMALLCAPTIONFONT 802 +#define TMT_MENUFONT 803 +#define TMT_STATUSFONT 804 +#define TMT_MSGBOXFONT 805 +#define TMT_ICONTITLEFONT 806 +#define TMT_HEADING1FONT 807 +#define TMT_HEADING2FONT 808 +#define TMT_BODYFONT 809 +#define TMT_FIRSTFONT TMT_CAPTIONFONT +#define TMT_LASTFONT TMT_BODYFONT +#define TMT_FLATMENUS 1001 +#define TMT_FIRSTBOOL TMT_FLATMENUS +#define TMT_LASTBOOL TMT_FLATMENUS +#define TMT_SIZINGBORDERWIDTH 1201 +#define TMT_SCROLLBARWIDTH 1202 +#define TMT_SCROLLBARHEIGHT 1203 +#define TMT_CAPTIONBARWIDTH 1204 +#define TMT_CAPTIONBARHEIGHT 1205 +#define TMT_SMCAPTIONBARWIDTH 1206 +#define TMT_SMCAPTIONBARHEIGHT 1207 +#define TMT_MENUBARWIDTH 1208 +#define TMT_MENUBARHEIGHT 1209 +#define TMT_PADDEDBORDERWIDTH 1210 +#define TMT_FIRSTSIZE TMT_SIZINGBORDERWIDTH +#define TMT_LASTSIZE TMT_PADDEDBORDERWIDTH +#define TMT_MINCOLORDEPTH 1301 +#define TMT_FIRSTINT TMT_MINCOLORDEPTH +#define TMT_LASTINT TMT_MINCOLORDEPTH +#define TMT_CSSNAME 1401 +#define TMT_XMLNAME 1402 +#define TMT_LASTUPDATED 1403 +#define TMT_ALIAS 1404 +#define TMT_FIRSTSTRING TMT_CSSNAME +#define TMT_LASTSTRING TMT_ALIAS +#define TMT_SCROLLBAR 1601 +#define TMT_BACKGROUND 1602 +#define TMT_ACTIVECAPTION 1603 +#define TMT_INACTIVECAPTION 1604 +#define TMT_MENU 1605 +#define TMT_WINDOW 1606 +#define TMT_WINDOWFRAME 1607 +#define TMT_MENUTEXT 1608 +#define TMT_WINDOWTEXT 1609 +#define TMT_CAPTIONTEXT 1610 +#define TMT_ACTIVEBORDER 1611 +#define TMT_INACTIVEBORDER 1612 +#define TMT_APPWORKSPACE 1613 +#define TMT_HIGHLIGHT 1614 +#define TMT_HIGHLIGHTTEXT 1615 +#define TMT_BTNFACE 1616 +#define TMT_BTNSHADOW 1617 +#define TMT_GRAYTEXT 1618 +#define TMT_BTNTEXT 1619 +#define TMT_INACTIVECAPTIONTEXT 1620 +#define TMT_BTNHIGHLIGHT 1621 +#define TMT_DKSHADOW3D 1622 +#define TMT_LIGHT3D 1623 +#define TMT_INFOTEXT 1624 +#define TMT_INFOBK 1625 +#define TMT_BUTTONALTERNATEFACE 1626 +#define TMT_HOTTRACKING 1627 +#define TMT_GRADIENTACTIVECAPTION 1628 +#define TMT_GRADIENTINACTIVECAPTION 1629 +#define TMT_MENUHILIGHT 1630 +#define TMT_MENUBAR 1631 +#define TMT_FIRSTCOLOR TMT_SCROLLBAR +#define TMT_LASTCOLOR TMT_MENUBAR +#define TMT_FROMHUE1 1801 +#define TMT_FROMHUE2 1802 +#define TMT_FROMHUE3 1803 +#define TMT_FROMHUE4 1804 +#define TMT_FROMHUE5 1805 +#define TMT_TOHUE1 1806 +#define TMT_TOHUE2 1807 +#define TMT_TOHUE3 1808 +#define TMT_TOHUE4 1809 +#define TMT_TOHUE5 1810 +#define TMT_FROMCOLOR1 2001 +#define TMT_FROMCOLOR2 2002 +#define TMT_FROMCOLOR3 2003 +#define TMT_FROMCOLOR4 2004 +#define TMT_FROMCOLOR5 2005 +#define TMT_TOCOLOR1 2006 +#define TMT_TOCOLOR2 2007 +#define TMT_TOCOLOR3 2008 +#define TMT_TOCOLOR4 2009 +#define TMT_TOCOLOR5 2010 +#define TMT_TRANSPARENT 2201 +#define TMT_AUTOSIZE 2202 +#define TMT_BORDERONLY 2203 +#define TMT_COMPOSITED 2204 +#define TMT_BGFILL 2205 +#define TMT_GLYPHTRANSPARENT 2206 +#define TMT_GLYPHONLY 2207 +#define TMT_ALWAYSSHOWSIZINGBAR 2208 +#define TMT_MIRRORIMAGE 2209 +#define TMT_UNIFORMSIZING 2210 +#define TMT_INTEGRALSIZING 2211 +#define TMT_SOURCEGROW 2212 +#define TMT_SOURCESHRINK 2213 +#define TMT_DRAWBORDERS 2214 +#define TMT_NOETCHEDEFFECT 2215 +#define TMT_TEXTAPPLYOVERLAY 2216 +#define TMT_TEXTGLOW 2217 +#define TMT_TEXTITALIC 2218 +#define TMT_COMPOSITEDOPAQUE 2219 +#define TMT_LOCALIZEDMIRRORIMAGE 2220 +#define TMT_IMAGECOUNT 2401 +#define TMT_ALPHALEVEL 2402 +#define TMT_BORDERSIZE 2403 +#define TMT_ROUNDCORNERWIDTH 2404 +#define TMT_ROUNDCORNERHEIGHT 2405 +#define TMT_GRADIENTRATIO1 2406 +#define TMT_GRADIENTRATIO2 2407 +#define TMT_GRADIENTRATIO3 2408 +#define TMT_GRADIENTRATIO4 2409 +#define TMT_GRADIENTRATIO5 2410 +#define TMT_PROGRESSCHUNKSIZE 2411 +#define TMT_PROGRESSSPACESIZE 2412 +#define TMT_SATURATION 2413 +#define TMT_TEXTBORDERSIZE 2414 +#define TMT_ALPHATHRESHOLD 2415 +#define TMT_WIDTH 2416 +#define TMT_HEIGHT 2417 +#define TMT_GLYPHINDEX 2418 +#define TMT_TRUESIZESTRETCHMARK 2419 +#define TMT_MINDPI1 2420 +#define TMT_MINDPI2 2421 +#define TMT_MINDPI3 2422 +#define TMT_MINDPI4 2423 +#define TMT_MINDPI5 2424 +#define TMT_TEXTGLOWSIZE 2425 +#define TMT_FRAMESPERSECOND 2426 +#define TMT_PIXELSPERFRAME 2427 +#define TMT_ANIMATIONDELAY 2428 +#define TMT_GLOWINTENSITY 2429 +#define TMT_OPACITY 2430 +#define TMT_COLORIZATIONCOLOR 2431 +#define TMT_COLORIZATIONOPACITY 2432 +#define TMT_GLYPHFONT 2601 +#define TMT_IMAGEFILE 3001 +#define TMT_IMAGEFILE1 3002 +#define TMT_IMAGEFILE2 3003 +#define TMT_IMAGEFILE3 3004 +#define TMT_IMAGEFILE4 3005 +#define TMT_IMAGEFILE5 3006 +#define TMT_GLYPHIMAGEFILE 3008 +#define TMT_TEXT 3201 +#define TMT_CLASSICVALUE 3202 +#define TMT_OFFSET 3401 +#define TMT_TEXTSHADOWOFFSET 3402 +#define TMT_MINSIZE 3403 +#define TMT_MINSIZE1 3404 +#define TMT_MINSIZE2 3405 +#define TMT_MINSIZE3 3406 +#define TMT_MINSIZE4 3407 +#define TMT_MINSIZE5 3408 +#define TMT_NORMALSIZE 3409 +#define TMT_SIZINGMARGINS 3601 +#define TMT_CONTENTMARGINS 3602 +#define TMT_CAPTIONMARGINS 3603 +#define TMT_BORDERCOLOR 3801 +#define TMT_FILLCOLOR 3802 +#define TMT_TEXTCOLOR 3803 +#define TMT_EDGELIGHTCOLOR 3804 +#define TMT_EDGEHIGHLIGHTCOLOR 3805 +#define TMT_EDGESHADOWCOLOR 3806 +#define TMT_EDGEDKSHADOWCOLOR 3807 +#define TMT_EDGEFILLCOLOR 3808 +#define TMT_TRANSPARENTCOLOR 3809 +#define TMT_GRADIENTCOLOR1 3810 +#define TMT_GRADIENTCOLOR2 3811 +#define TMT_GRADIENTCOLOR3 3812 +#define TMT_GRADIENTCOLOR4 3813 +#define TMT_GRADIENTCOLOR5 3814 +#define TMT_SHADOWCOLOR 3815 +#define TMT_GLOWCOLOR 3816 +#define TMT_TEXTBORDERCOLOR 3817 +#define TMT_TEXTSHADOWCOLOR 3818 +#define TMT_GLYPHTEXTCOLOR 3819 +#define TMT_GLYPHTRANSPARENTCOLOR 3820 +#define TMT_FILLCOLORHINT 3821 +#define TMT_BORDERCOLORHINT 3822 +#define TMT_ACCENTCOLORHINT 3823 +#define TMT_TEXTCOLORHINT 3824 +#define TMT_HEADING1TEXTCOLOR 3825 +#define TMT_HEADING2TEXTCOLOR 3826 +#define TMT_BODYTEXTCOLOR 3827 +#define TMT_BGTYPE 4001 +#define TMT_BORDERTYPE 4002 +#define TMT_FILLTYPE 4003 +#define TMT_SIZINGTYPE 4004 +#define TMT_HALIGN 4005 +#define TMT_CONTENTALIGNMENT 4006 +#define TMT_VALIGN 4007 +#define TMT_OFFSETTYPE 4008 +#define TMT_ICONEFFECT 4009 +#define TMT_TEXTSHADOWTYPE 4010 +#define TMT_IMAGELAYOUT 4011 +#define TMT_GLYPHTYPE 4012 +#define TMT_IMAGESELECTTYPE 4013 +#define TMT_GLYPHFONTSIZINGTYPE 4014 +#define TMT_TRUESIZESCALINGTYPE 4015 +#define TMT_USERPICTURE 5001 +#define TMT_DEFAULTPANESIZE 5002 +#define TMT_BLENDCOLOR 5003 +#define TMT_CUSTOMSPLITRECT 5004 +#define TMT_ANIMATIONBUTTONRECT 5005 +#define TMT_ANIMATIONDURATION 5006 +#define TMT_TRANSITIONDURATIONS 6000 +#define TMT_SCALEDBACKGROUND 7001 +#define TMT_ATLASIMAGE 8000 +#define TMT_ATLASINPUTIMAGE 8001 +#define TMT_ATLASRECT 8002 + + +// +// LINK class parts and states +// +#define VSCLASS_LINK L"LINK" + +enum LINKPARTS { + LP_HYPERLINK = 1, +}; + +enum HYPERLINKSTATES { + HLS_NORMALTEXT = 1, + HLS_LINKTEXT = 2, +}; + + +// +// EMPTYMARKUP class parts and states +// +#define VSCLASS_EMPTYMARKUP L"EMPTYMARKUP" + +enum EMPTYMARKUPPARTS { + EMP_MARKUPTEXT = 1, +}; + +enum MARKUPTEXTSTATES { + EMT_NORMALTEXT = 1, + EMT_LINKTEXT = 2, +}; + + +// +// STATIC class parts and states +// +#define VSCLASS_STATIC L"STATIC" + +enum STATICPARTS { + STAT_TEXT = 1, +}; + + +// +// PAGE class parts and states +// +#define VSCLASS_PAGE L"PAGE" + +enum PAGEPARTS { + PGRP_UP = 1, + PGRP_DOWN = 2, + PGRP_UPHORZ = 3, + PGRP_DOWNHORZ = 4, +}; + + +// +// MONTHCAL class parts and states +// +#define VSCLASS_MONTHCAL L"MONTHCAL" + +enum MONTHCALPARTS { + MC_BACKGROUND = 1, + MC_BORDERS = 2, + MC_GRIDBACKGROUND = 3, + MC_COLHEADERSPLITTER = 4, + MC_GRIDCELLBACKGROUND = 5, + MC_GRIDCELL = 6, + MC_GRIDCELLUPPER = 7, + MC_TRAILINGGRIDCELL = 8, + MC_TRAILINGGRIDCELLUPPER = 9, + MC_NAVNEXT = 10, + MC_NAVPREV = 11, +}; + +enum GRIDCELLBACKGROUNDSTATES { + MCGCB_SELECTED = 1, + MCGCB_HOT = 2, + MCGCB_SELECTEDHOT = 3, + MCGCB_SELECTEDNOTFOCUSED = 4, + MCGCB_TODAY = 5, +}; + +enum GRIDCELLSTATES { + MCGC_HOT = 1, + MCGC_HASSTATE = 2, + MCGC_HASSTATEHOT = 3, + MCGC_TODAY = 4, +}; + +enum GRIDCELLUPPERSTATES { + MCGCU_HOT = 1, + MCGCU_HASSTATE = 2, + MCGCU_HASSTATEHOT = 3, +}; + +enum TRAILINGGRIDCELLSTATES { + MCTGC_HOT = 1, + MCTGC_HASSTATE = 2, + MCTGC_HASSTATEHOT = 3, + MCTGC_TODAY = 4, +}; + +enum TRAILINGGRIDCELLUPPERSTATES { + MCTGCU_HOT = 1, + MCTGCU_HASSTATE = 2, + MCTGCU_HASSTATEHOT = 3, +}; + +enum NAVNEXTSTATES { + MCNN_NORMAL = 1, + MCNN_HOT = 2, + MCNN_PRESSED = 3, + MCNN_DISABLED = 4, +}; + +enum NAVPREVSTATES { + MCNP_NORMAL = 1, + MCNP_HOT = 2, + MCNP_PRESSED = 3, + MCNP_DISABLED = 4, +}; + + +// +// CLOCK class parts and states +// +#define VSCLASS_CLOCK L"CLOCK" + +enum CLOCKPARTS { + CLP_TIME = 1, +}; + +enum CLOCKSTATES { + CLS_NORMAL = 1, + CLS_HOT = 2, + CLS_PRESSED = 3, +}; + + +// +// TRAYNOTIFY class parts and states +// +#define VSCLASS_TRAYNOTIFY L"TRAYNOTIFY" + +enum TRAYNOTIFYPARTS { + TNP_BACKGROUND = 1, + TNP_ANIMBACKGROUND = 2, +}; + + +// +// TASKBAR class parts and states +// +#define VSCLASS_TASKBAR L"TASKBAR" + +enum TASKBARPARTS { + TBP_BACKGROUNDBOTTOM = 1, + TBP_BACKGROUNDRIGHT = 2, + TBP_BACKGROUNDTOP = 3, + TBP_BACKGROUNDLEFT = 4, + TBP_SIZINGBARBOTTOM = 5, + TBP_SIZINGBARRIGHT = 6, + TBP_SIZINGBARTOP = 7, + TBP_SIZINGBARLEFT = 8, +}; + + +// +// TASKBAND class parts and states +// +#define VSCLASS_TASKBAND L"TASKBAND" + +enum TASKBANDPARTS { + TDP_GROUPCOUNT = 1, + TDP_FLASHBUTTON = 2, + TDP_FLASHBUTTONGROUPMENU = 3, +}; + + +// +// STARTPANEL class parts and states +// +#define VSCLASS_STARTPANEL L"STARTPANEL" + +enum STARTPANELPARTS { + SPP_USERPANE = 1, + SPP_MOREPROGRAMS = 2, + SPP_MOREPROGRAMSARROW = 3, + SPP_PROGLIST = 4, + SPP_PROGLISTSEPARATOR = 5, + SPP_PLACESLIST = 6, + SPP_PLACESLISTSEPARATOR = 7, + SPP_LOGOFF = 8, + SPP_LOGOFFBUTTONS = 9, + SPP_USERPICTURE = 10, + SPP_PREVIEW = 11, + SPP_MOREPROGRAMSTAB = 12, + SPP_NSCHOST = 13, + SPP_SOFTWAREEXPLORER = 14, + SPP_OPENBOX = 15, + SPP_SEARCHVIEW = 16, + SPP_MOREPROGRAMSARROWBACK = 17, + SPP_TOPMATCH = 18, + SPP_LOGOFFSPLITBUTTONDROPDOWN = 19, +}; + +enum MOREPROGRAMSTABSTATES { + SPMPT_NORMAL = 1, + SPMPT_HOT = 2, + SPMPT_SELECTED = 3, + SPMPT_DISABLED = 4, + SPMPT_FOCUSED = 5, +}; + +enum SOFTWAREEXPLORERSTATES { + SPSE_NORMAL = 1, + SPSE_HOT = 2, + SPSE_SELECTED = 3, + SPSE_DISABLED = 4, + SPSE_FOCUSED = 5, +}; + +enum OPENBOXSTATES { + SPOB_NORMAL = 1, + SPOB_HOT = 2, + SPOB_SELECTED = 3, + SPOB_DISABLED = 4, + SPOB_FOCUSED = 5, +}; + +enum MOREPROGRAMSARROWSTATES { + SPS_NORMAL = 1, + SPS_HOT = 2, + SPS_PRESSED = 3, +}; + +enum MOREPROGRAMSARROWBACKSTATES { + SPSB_NORMAL = 1, + SPSB_HOT = 2, + SPSB_PRESSED = 3, +}; + +enum LOGOFFBUTTONSSTATES { + SPLS_NORMAL = 1, + SPLS_HOT = 2, + SPLS_PRESSED = 3, +}; + + +// +// MENUBAND class parts and states +// +#define VSCLASS_MENUBAND L"MENUBAND" + +enum MENUBANDPARTS { + MDP_NEWAPPBUTTON = 1, + MDP_SEPERATOR = 2, +}; + +enum MENUBANDSTATES { + MDS_NORMAL = 1, + MDS_HOT = 2, + MDS_PRESSED = 3, + MDS_DISABLED = 4, + MDS_CHECKED = 5, + MDS_HOTCHECKED = 6, +}; + + +#endif //__VSSYM32_H__ + diff --git a/plugins/Clist_nicer/clist_nicer-translation.txt b/plugins/Clist_nicer/clist_nicer-translation.txt deleted file mode 100644 index 0eb0d0e5ef..0000000000 --- a/plugins/Clist_nicer/clist_nicer-translation.txt +++ /dev/null @@ -1,498 +0,0 @@ -; Common strings that belong to many files -;[&Delete Group] -;[&Hide Offline Users] -;[&Hide Offline Users in here] -;[&Hide/Show] -;[&New Group] -;[&Rename Group] -;[&Status] -;[Always] -;[Appearance] -;[Background] -;[Configure view modes] -;[Contact List] -;[Dialog] -;[Disable &Groups] -;[E&xit] -;[Event area] -;[General] -;[Groups] -;[Hide &Empty Groups] -;[Hide &Offline Users out here] -;[Icons] -;[Never] -;[Protocol] -;[Setup view modes] -;[Skin items] -;[Status Bar] -;[Status mode] -;[Sticky contacts] -;[Version] -;[Window] - -; ../../plugins/Clist_nicer/CLUIFrames/cluiframes.cpp -;[&Align] -;[&Border] -;[&Bottom] -;[&Client] -;[&Collapsed] -;[&Down] -;[&Floating Mode] -;[&FrameTitle] -;[&Locked] -;[&Position] -;[&Show TitleBar] -;[&Skinned frame] -;[&Top] -;[&Up] -;[&Visible] -;[Floating] -;[Frames] -;[Hide All Titlebars] -;[Lock Frame] -;[Show All Frames] -;[Show All Titlebars] -;[Show TitleBar] -;[Skinned frame] -;[Visible] - -; ../../plugins/Clist_nicer/CLUIFrames/groupmenu.cpp -;[&About the contact list...] -;[&Find/Add Contacts...] -;[&Main Menu] -;[&New SubGroup] -;[&Options...] - -; ../../plugins/Clist_nicer/CLUIFrames/movetogroup.cpp -;[&Floating Contact] - -; ../../plugins/Clist_nicer/SRC/Docking.cpp -;[Clist docking] -;[The clist cannot be docked when using the default title bar and border. Use a toolwindow or borderless style instead.] - -; ../../plugins/Clist_nicer/SRC/clcopts.cpp -;[] -;[Add New...] -;[Advanced] -;[Always Left] -;[Always Right] -;[Apply this profile] -;[Automatic (RTL)] -;[Contact list] -;[Contact rows] -;[Contacts] -;[Default] -;[Delete] -;[Far left] -;[Far right] -;[Floating contacts] -;[For RTL only] -;[Groups and layout] -;[Hottracked contact] -;[Last Message] -;[List layout] -;[Message Frequency] -;[Name] -;[Nothing] -;[Offline contact] -;[RTL TEXT only] -;[Rename...] -;[Selected contact] -;[Skins] -;[Status] -;[When needed] -;[When space allows it] -;[With Nickname - left] -;[With Nickname - right] - -; ../../plugins/Clist_nicer/SRC/clistmenus.cpp -;[&Contact list settings...] -;[Add permanently] -;[Contact list display and ignore options for %s] -;[Default (global setting)] -;[Hide always] -;[Revert to default] -;[Show always when available] -;[When needed by status message] -;[When space is available] - -; ../../plugins/Clist_nicer/SRC/clistopts.cpp -;[Global] - -; ../../plugins/Clist_nicer/SRC/clui.cpp -;[%s Connecting] -;[Accounts] -;[Built %s %s] -;[CList - Nicer/Connecting Icons] -;[CList - Nicer/Default] -;[CList - Nicer/Overlay Icons] -;[Chat room/IRC channel activity] -;[Clear view mode] -;[Contact list local time] -;[Contact on invisible list or blocked] -;[Contact on visible list] -;[Contacts which are 'not on list'] -;[Dividers] -;[Event Area] -;[Find and add contacts] -;[Frame titles] -;[Group member counts] -;[Hottrack Text] -;[Menu] -;[Minimize contact list] -;[My Contacts] -;[Offline] -;[Offline contacts] -;[Offline contacts to whom you have a different visibility] -;[Online contacts to whom you have a different visibility] -;[Open main menu] -;[Open preferences] -;[Quicksearch Text] -;[Reset view mode] -;[Select view mode] -;[Selected Text] -;[Set status modes] -;[Show / hide offline contacts] -;[Show menu] -;[Standard contacts] -;[Status menu] -;[Toggle group mode] -;[Toggle sounds] -;[tabSRMM Menu] -;[tabSRMM session list] - -; ../../plugins/Clist_nicer/SRC/cluiopts.cpp -;[No border] -;[Thin border] -;[Title bar] -;[Tool Window] - -; ../../plugins/Clist_nicer/SRC/extBackg.cpp -;[Load and apply] - -; ../../plugins/Clist_nicer/SRC/viewmodes.cpp -;[A view mode with this name does alredy exist] -;[And] -;[Clear current View Mode] -;[Clear view mode and return to default display] -;[Current view mode: %s] -;[Days] -;[Delete a view mode] -;[Duplicate name] -;[Filtering] -;[Hours] -;[Minutes] -;[Newer than] -;[No view mode] -;[Older than] -;[Or] -;[Really delete this view mode? This cannot be undone] -;[Select a view mode] -;[Setup View Modes...] -;[Ungrouped contacts] -;[View Modes] - -; ../../plugins/Clist_nicer/resource.rc -;[% of screen] -;[&Away\tCtrl+2] -;[&DND\tCtrl+5] -;[&Free for chat\tCtrl+6] -;[&Invisible\tCtrl+7] -;[&NA\tCtrl+3] -;[&New Subgroup] -;[&Offline\tCtrl+0] -;[< Reload] -;[About CList Nicer+] -;[Active] -;[Active opacity:] -;[Advanced #1] -;[Advanced #2] -;[Advanced #3] -;[Advanced #4] -;[Alignment] -;[Although the exception was caught and you may continue working with Miranda, you should restart the program as soon as possible. The exception may have damaged internal data structures and can have a serious impact on stability.] -;[Always Hide On Taskbar] -;[Always align icons and text for missing avatars] -;[Always on top] -;[Always show status in tooltip] -;[Appear always offline (block contact)] -;[Appear always online] -;[Apply] -;[Apply group indent values to background drawing] -;[Apply last active view mode ] -;[Apply skin now] -;[Are you sure you want to delete %s?] -;[Ask before deleting contacts] -;[Auto mode] -;[Auto-Hide Status Floater] -;[Automatically clear this view mode after] -;[Automatically fill background with wallpaper (tiled wallpaper only)] -;[Automatically resize window to height of list] -;[Available view modes] -;[Avatar alignment] -;[Avatars] -;[Background colour] -;[Behaviour] -;[Blend selection with background] -;[Border] -;[Cancel] -;[Center groupnames horizontally] -;[Centered when possible] -;[Clear all] -;[Client] -;[Client margins] -;[Clip border by] -;[Clist Nicer+] -;[Colour] -;[Contact List Background] -;[Contact List Sorting] -;[Contact list layout] -;[Contact list skin] -;[Continue] -;[Copy to clipboard] -;[Copyright © 2004-2010 by the Miranda IM project. More detailed copyright information can be found in the included README file.\n\nThis software is distributed and licensed under the terms of the GNU General Public License V2 or any later version.] -;[Corner radius] -;[Cycle icons every] -;[Delete Contact] -;[Dim idle contacts] -;[Disable drag and drop of items] -;[Disable groups] -;[Disable icon blinking] -;[Disable rename of items by clicking twice] -;[Display options] -;[Display status message when available] -;[Do not separate offline contacts] -;[Do not show system tray icon tooltips on mouse over] -;[Don't request avatars for offline contacts] -;[Double click on avatar opens userinfo] -;[Draw a border around avatars] -;[Draw a line alongside group names] -;[Draw background skin] -;[Draw overlay icon on avatar] -;[Draw sunken Frame] -;[Draw sunken edge] -;[E-Mail] -;[Easy move] -;[Embedded frames border] -;[Enable floating contacts (required restart)] -;[Exit Miranda] -;[Export to skin file] -;[Extra icon size] -;[Extra icons] -;[Extra icons (drag items to reorder them)] -;[Fade contact list in/out] -;[Fill with contact list background color] -;[Finally by] -;[First by] -;[Floating contacts appearance] -;[Frame titlebar height] -;[Fully transparent (like TweakUI)] -;[Gap between frames] -;[Grey out entire list when:] -;[Group] -;[Group row height] -;[Group top padding] -;[Height] -;[Hide Miranda] -;[Hide as offline] -;[Hide contact list after it has been idle for] -;[Hide empty groups] -;[Hide from list only, in order to keep their history and ignore/visibility settings] -;[Hide numbers when all offline] -;[Hide offline users] -;[Hide this contact from the list] -;[Hide vertical scroll bar] -;[Homepage] -;[Hot track items as mouse passes over] -;[Hover time] -;[If window is partially covered, bring to front instead of hiding] -;[If you enable this, the background settings will affect the entire contact list frame.] -;[Ignore all] -;[Ignore none] -;[Ignore selection for groups] -;[Ignore these events] -;[Inactive] -;[Inactive opacity:] -;[Include groups] -;[Include protocols] -;[Include status modes] -;[Incoming file transfers] -;[Indent groups by:] -;[Inner Row vertical padding] -;[Items] -;[Last message ] -;[Load from skin file] -;[Load this skin on startup] -;[Make sections equal width] -;[Make selection highlight translucent] -;[Make selection shape equal to selected item] -;[Margins (left/right)] -;[Margins and spacing] -;[Mark protocols locked from global status changes] -;[Messages] -;[Minimum row height:] -;[Move events to the top of list\nor group] -;[Move marked Contacts to this Group] -;[New] -;[No] -;[No expand/collapse icon] -;[Nowhere] -;[OK] -;[Occ&upied\tCtrl+4] -;[Ok] -;[On the &Phone\tCtrl+8] -;[On&line\tCtrl+1] -;[Only show contact floaters when contact list is hidden or minimized] -;[Only when statuses differ] -;[Only when timezone differs] -;[Opacity] -;[Other] -;[Out to &Lunch\tCtrl+9] -;[Padding] -;[Per contact skins:] -;[Pin to desktop] -;[Protocol skins override status text colors] -;[Quicksearch in open groups only] -;[Radius] -;[Replace status icons with xStatus] -;[Reserved] -;[Reserved #1] -;[Reserved #2] -;[Reset order and visibility to default] -;[Right align contacts] -;[Right click opens Miranda IM menu] -;[Right click opens status menu] -;[Rounded avatars] -;[Rounded border] -;[Rounded corners] -;[Row gap] -;[Scroll list smoothly] -;[Scroll with text] -;[Second text line] -;[Set all buttons to skinned mode] -;[Set base visiblity on the frames menu] -;[Show] -;[Show 2nd line:] -;[Show Avatar:] -;[Show Event Area in Floater] -;[Show ICQ extended status icons] -;[Show Metacontact proto Icons] -;[Show Status Icons] -;[Show Visibility Icons] -;[Show additional Buttons] -;[Show avatars] -;[Show bevels on panels] -;[Show contact with priority] -;[Show contacts local time] -;[Show divider between online and offline contacts] -;[Show drop shadow (restart required)] -;[Show extra icons] -;[Show icons] -;[Show local time] -;[Show menu and status buttons] -;[Show menu bar] -;[Show multiple icons] -;[Show number of contacts in a group] -;[Show protocol names] -;[Show resize grip indicator] -;[Show second text line] -;[Show second text line:] -;[Show selection even when list is not focused] -;[Show status bar] -;[Show status icons] -;[Show status text] -;[Show tooltips] -;[Show visibility icon] -;[Show visibility icons] -;[Simple layout] -;[Single click interface] -;[Size upwards] -;[Skin options] -;[Slider2] -;[Snap to edges (hold CTRL for snap between floaters)] -;[Sort groups alphabetically] -;[Spin1] -;[Spin5] -;[Statisch] -;[Stretch proportionally] -;[Stretch to height] -;[Stretch to width] -;[Support and latest version information] -;[Suppress added notifications] -;[Suppress auth requests] -;[Suppress online notifications] -;[Synchronzie floater visibility with contact list] -;[System tray icon] -;[System tray icon when using multiple protocols] -;[TabSRMM exception] -;[Telephone] -;[Then by] -;[This will erase all history and settings for this contact!] -;[Tile horizontally] -;[Tile vertically] -;[Time:] -;[Title bar text:] -;[To show a previously hidden contact, navigate to Options->Events->Ignore, search the contact in the list and tick the checkbox next to its name.] -;[Tooltips] -;[Translucency options (Windows 2000/XP only)] -;[Transparent contact list] -;[Tray] -;[URL events] -;[Unload skin] -;[Use Options->Ignore (expert mode) to unhide contacts.] -;[Use Overlay icons on avatars] -;[Use Status Floater] -;[Use Windows colours] -;[Use background image] -;[Use default] -;[Use fast gradient drawing] -;[Use full row for selection and hottracking] -;[Use metacontact protocol icons instead of subcontacts] -;[Use per protocol/contact skinning] -;[Use these settings to skin the entire background] -;[Using the contact list on the left side, you can select contacts which will be \"sticky\" for this view mode. These contacts will ignore the standard filter rules and only use the status mode filter below.] -;[View mode options] -;[Visibility] -;[Visual] -;[When possible, draw status icons in avatar space] -;[Width] -;[Yes] -;[build time] -;[icon when statuses differ] -;[maximum] -;[milliseconds] -;[ms] -;[seconds] -;[seconds, when statuses differ] - -; ../../plugins/Clist_nicer/skineditor/main.cpp -;[] -;[Bumped] -;[Etched] -;[Image items] -;[Raised] -;[Sunken] - -; ../../plugins/Clist_nicer/skineditor/skinedit.rc -;[3D border (bright / dark)] -;[Alpha (percent)] -;[Border style] -;[Bottom to top] -;[Bottom-Left] -;[Bottom-Right] -;[First color] -;[Gradient] -;[Item borders] -;[Item colors] -;[Item ignored] -;[Item margins] -;[Left to right] -;[Not yet supported] -;[Right to left] -;[Round corners] -;[Second color] -;[Textcolor] -;[Top to bottom] -;[Top-Left] -;[Top-Right] -;[Transparent] diff --git a/plugins/Clist_nicer/clist_nicer_10.vcxproj b/plugins/Clist_nicer/clist_nicer_10.vcxproj index 40b0971aef..713cbc8ef9 100644 --- a/plugins/Clist_nicer/clist_nicer_10.vcxproj +++ b/plugins/Clist_nicer/clist_nicer_10.vcxproj @@ -71,15 +71,14 @@ - ..\..\include;include;..\ExternalAPI;%(AdditionalIncludeDirectories) + ..\..\include;src\include;..\ExternalAPI;%(AdditionalIncludeDirectories) commonheaders.h EditAndContinue - 4996;%(DisableSpecificWarnings) MultiThreadedDebugDLL Disabled Use Level3 - WIN32;_DEBUG;_WINDOWS;_USRDLL;CLIST_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;CLIST_EXPORTS;%(PreprocessorDefinitions) _DEBUG;%(PreprocessorDefinitions) @@ -101,7 +100,7 @@ Full OnlyExplicitInline Size - ..\..\include;include;..\ExternalAPI;%(AdditionalIncludeDirectories) + ..\..\include;src\include;..\ExternalAPI;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;CLIST_EXPORTS;%(PreprocessorDefinitions) true false @@ -131,17 +130,17 @@ - ..\..\include;include;..\ExternalAPI;%(AdditionalIncludeDirectories) + ..\..\include;src\include;..\ExternalAPI;%(AdditionalIncludeDirectories) MultiThreadedDebugDLL commonheaders.h Disabled Use Level3 - WIN64;_DEBUG;_WINDOWS;_USRDLL;CLIST_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + WIN64;_DEBUG;_WINDOWS;_USRDLL;CLIST_EXPORTS;%(PreprocessorDefinitions) ..\..\include;..\..\include\msapi;%(AdditionalIncludeDirectories) - WIN64;_AMD64;%(PreprocessorDefinitions) + _DEBUG;%(PreprocessorDefinitions) comctl32.lib;shlwapi.lib;%(AdditionalDependencies) @@ -156,7 +155,7 @@ - ..\..\include;include;..\ExternalAPI;%(AdditionalIncludeDirectories) + ..\..\include;src\include;..\ExternalAPI;%(AdditionalIncludeDirectories) Full Size true @@ -171,7 +170,7 @@ ..\..\include;..\..\include\msapi;%(AdditionalIncludeDirectories) - WIN64;_AMD64;%(PreprocessorDefinitions) + NDEBUG;%(PreprocessorDefinitions) comctl32.lib;shlwapi.lib;%(AdditionalDependencies) @@ -187,103 +186,63 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + Create - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - + + diff --git a/plugins/Clist_nicer/clist_nicer_10.vcxproj.filters b/plugins/Clist_nicer/clist_nicer_10.vcxproj.filters index c704196b5b..32981a6589 100644 --- a/plugins/Clist_nicer/clist_nicer_10.vcxproj.filters +++ b/plugins/Clist_nicer/clist_nicer_10.vcxproj.filters @@ -24,277 +24,161 @@ - + 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\COOLSB - + Source Files\COOLSB - + Source Files\CLUIFrames - + Source Files\CLUIFrames - + Source Files\CLUIFrames - + Source Files\CLUIFrames - + Source Files Source Files - + Source Files - + Source Files\CLUIFrames - + Source Files\COOLSB - + Source Files\COOLSB - + Source Files\COOLSB - + Source Files\COOLSB - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Docs - - - Docs - - - Docs - - - Docs - - - - + + Resource Files diff --git a/plugins/Clist_nicer/coolsb/coolsb_internal.h b/plugins/Clist_nicer/coolsb/coolsb_internal.h deleted file mode 100644 index 8a394f8a51..0000000000 --- a/plugins/Clist_nicer/coolsb/coolsb_internal.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef _COOLSB_INTERNAL_INCLUDED -#define _COOLSB_INTERNAL_INCLUDED - -#ifdef __cplusplus -extern "C"{ -#endif - -#include - -// -// SCROLLBAR datatype. There are two of these structures per window -// -typedef struct -{ - UINT fScrollFlags; //flags - BOOL fScrollVisible; //if this scrollbar visible? - SCROLLINFO scrollInfo; //positional data (range, position, page size etc) - - int nArrowLength; //perpendicular size (height of a horizontal, width of a vertical) - int nArrowWidth; //parallel size (width of horz, height of vert) - - //data for inserted buttons - SCROLLBUT sbButtons[MAX_COOLSB_BUTS]; - int nButtons; - int nButSizeBefore; //size to the left / above the bar - int nButSizeAfter; //size to the right / below the bar - - BOOL fButVisibleBefore; //if the buttons to the left are visible - BOOL fButVisibleAfter; //if the buttons to the right are visible - - int nBarType; //SB_HORZ / SB_VERT - - UINT fFlatScrollbar; //do we display flat scrollbars? - int nMinThumbSize; - -} SCROLLBAR; - -// -// Container structure for a cool scrollbar window. -// -typedef struct -{ - UINT bars; //which of the scrollbars do we handle? SB_VERT / SB_HORZ / SB_BOTH - WNDPROC oldproc; //old window procedure to call for every message - - SCROLLBAR sbarHorz; //one scrollbar structure each for - SCROLLBAR sbarVert; //the horizontal and vertical scrollbars - - BOOL fThumbTracking; // are we currently thumb-tracking?? - BOOL fLeftScrollbar; // support the WS_EX_LEFTSCROLLBAR style - - HWND hwndToolTip; // tooltip support!!! - - //size of the window borders - int cxLeftEdge, cxRightEdge; - int cyTopEdge, cyBottomEdge; - - // To prevent calling original WindowProc in response - // to our own temporary style change (fixes TreeView problem) - BOOL bPreventStyleChange; - -} SCROLLWND; - - -// -// PRIVATE INTERNAL FUNCTIONS -// -SCROLLWND *GetScrollWndFromHwnd(HWND hwnd); -#define InvertCOLORREF(col) ((~col) & 0x00ffffff) - -#define COOLSB_TIMERID1 65533 //initial timer -#define COOLSB_TIMERID2 65534 //scroll message timer -#define COOLSB_TIMERID3 -14 //mouse hover timer -#define COOLSB_TIMERINTERVAL1 300 -#define COOLSB_TIMERINTERVAL2 55 -#define COOLSB_TIMERINTERVAL3 20 //mouse hover time - - -// -// direction: 0 - same axis as scrollbar (i.e. width of a horizontal bar) -// 1 - perpendicular dimesion (i.e. height of a horizontal bar) -// -#define SM_CXVERTSB 1 -#define SM_CYVERTSB 0 -#define SM_CXHORZSB 0 -#define SM_CYHORZSB 1 -#define SM_SCROLL_WIDTH 1 -#define SM_SCROLL_LENGTH 0 - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/plugins/Clist_nicer/coolsb/coolsblib.cpp b/plugins/Clist_nicer/coolsb/coolsblib.cpp deleted file mode 100644 index 42f74c4ca0..0000000000 --- a/plugins/Clist_nicer/coolsb/coolsblib.cpp +++ /dev/null @@ -1,1003 +0,0 @@ -/* - - Cool Scrollbar Library Version 1.2 - - Module: coolsblib.c - Copyright (c) J Brown 2001 - - This code is freeware, however, you may not publish - this code elsewhere or charge any money for it. This code - is supplied as-is. I make no guarantees about the suitability - of this code - use at your own risk. - - It would be nice if you credited me, in the event - that you use this code in a product. - - VERSION HISTORY: - - V1.2: TreeView problem fixed by Diego Tartara - Small problem in thumbsize calculation also fixed (thanks Diego!) - - V1.1: Added support for Right-left windows - Changed calling convention of APIs to WINAPI (__stdcall) - Completely standalone (no need for c-runtime) - - V1.0: Apr 2001: Initial Version - -*/ - -#define _WIN32_WINNT 0x0501 -#define _WIN32_IE 0x0501 - -#include -#include "coolscroll.h" -#include "userdefs.h" -#include "coolsb_internal.h" - -static TCHAR szPropStr[] = _T("CoolSBSubclassPtr"); - -LRESULT CALLBACK CoolSBWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); - -SCROLLWND *GetScrollWndFromHwnd(HWND hwnd) -{ - return (SCROLLWND *)GetProp(hwnd, szPropStr); -} - -SCROLLBAR *GetScrollBarFromHwnd(HWND hwnd, UINT nBar) -{ - SCROLLWND *sw = GetScrollWndFromHwnd(hwnd); - - if (!sw) return 0; - - if(nBar == SB_HORZ) - return &sw->sbarHorz; - else if(nBar == SB_VERT) - return &sw->sbarVert; - else - return 0; -} - -BOOL WINAPI CoolSB_IsCoolScrollEnabled(HWND hwnd) -{ - if(GetScrollWndFromHwnd(hwnd)) - return TRUE; - else - return FALSE; -} - -BOOL GetScrollRect(SCROLLWND *sw, UINT nBar, HWND hwnd, RECT *rect); - -// -// Special support for USER32.DLL patching (using Detours library) -// The only place we call a real scrollbar API is in InitializeCoolSB, -// where we call EnableScrollbar. -// -// We HAVE to call the origial EnableScrollbar function, -// so we need to be able to set a pointer to this func when using -// using Detours (or any other LIB??) -// - -typedef BOOL (WINAPI *WPROC)(HWND, UINT, UINT); - -static WPROC pEnableScrollBar = 0; - -void WINAPI CoolSB_SetESBProc(WPROC proc) -{ - pEnableScrollBar = proc; -} -// -// - -static void RedrawNonClient(HWND hwnd, BOOL fFrameChanged) -{ - if(fFrameChanged == FALSE) - { - /* - RECT rect; - HRGN hrgn1, hrgn2; - - SCROLLWND *sw = GetScrollWndFromHwnd(hwnd); - - GetScrollRect(sw, SB_HORZ, hwnd, &rect); - hrgn1 = CreateRectRgnIndirect(&rect); - - GetScrollRect(sw, SB_VERT, hwnd, &rect); - hrgn2 = CreateRectRgnIndirect(&rect); - - CombineRgn(hrgn1, hrgn2, hrgn1, RGN_OR); - - SendMessage(hwnd, WM_NCPAINT, (WPARAM)hrgn1, 0); - - DeleteObject(hrgn1); - DeleteObject(hrgn2);*/ - - SendMessage(hwnd, WM_NCPAINT, (WPARAM)1, 0); - } - else - { - SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE - | SWP_FRAMECHANGED | SWP_DRAWFRAME); - } -} - -// -// return the default minimum size of a scrollbar thumb -// -int WINAPI CoolSB_GetDefaultMinThumbSize(void) -{ - DWORD dwVersion = GetVersion(); - - // set the minimum thumb size for a scrollbar. This - // differs between NT4 and 2000, so need to check to see - // which platform we are running under - if(dwVersion < 0x80000000) // Windows NT/2000 - { - if(LOBYTE(LOWORD(dwVersion)) >= 5) - return MINTHUMBSIZE_2000; - else - return MINTHUMBSIZE_NT4; - } - else - { - return MINTHUMBSIZE_NT4; - } -} - -static SCROLLINFO *GetScrollInfoFromHwnd(HWND hwnd, int fnBar) -{ - SCROLLBAR *sb = GetScrollBarFromHwnd(hwnd, fnBar); - - if(sb == 0) - return FALSE; - - if(fnBar == SB_HORZ) - { - return &sb->scrollInfo; - } - else if(fnBar == SB_VERT) - { - return &sb->scrollInfo; - } - else - return NULL; -} -// -// Initialize the cool scrollbars for a window by subclassing it -// and using the coolsb window procedure instead -// -BOOL WINAPI InitializeCoolSB(HWND hwnd) -{ - SCROLLWND *sw; - SCROLLINFO *si; - INITCOMMONCONTROLSEX ice; - TOOLINFO ti; - RECT rect; - DWORD dwCurStyle; - //BOOL fDisabled; - - if(pEnableScrollBar == 0) - pEnableScrollBar = EnableScrollBar; - - GetClientRect(hwnd, &rect); - - //if we have already initialized Cool Scrollbars for this window, - //then stop the user from doing it again - if(GetScrollWndFromHwnd(hwnd) != 0) - { - return FALSE; - } - - //allocate a private scrollbar structure which we - //will use to keep track of the scrollbar data - sw = (SCROLLWND *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SCROLLWND)); - - si = &sw->sbarHorz.scrollInfo; - si->cbSize = sizeof(SCROLLINFO); - si->fMask = SIF_ALL; - GetScrollInfo(hwnd, SB_HORZ, si); - - si = &sw->sbarVert.scrollInfo; - si->cbSize = sizeof(SCROLLINFO); - si->fMask = SIF_ALL; - GetScrollInfo(hwnd, SB_VERT, si); - - //check to see if the window has left-aligned scrollbars - if(GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_LEFTSCROLLBAR) - sw->fLeftScrollbar = TRUE; - else - sw->fLeftScrollbar = FALSE; - - dwCurStyle = GetWindowLongPtr(hwnd, GWL_STYLE); - - SetProp(hwnd, szPropStr, (HANDLE)sw); - - //try to enable the scrollbar arrows - if the return value is - //non-zero, then the scrollbars were previously disabled - //fDisabled = pEnableScrollBar(hwnd, SB_HORZ, ESB_ENABLE_BOTH); - - //scrollbars will automatically get enabled, even if - //they aren't to start with....sorry, but there isn't an - //easy alternative. - if(dwCurStyle & WS_HSCROLL) - sw->sbarHorz.fScrollFlags = CSBS_VISIBLE; - - if(dwCurStyle & WS_VSCROLL) - sw->sbarVert.fScrollFlags = CSBS_VISIBLE; - - //need to be able to distinguish between horizontal and vertical - //scrollbars in some instances - sw->sbarHorz.nBarType = SB_HORZ; - sw->sbarVert.nBarType = SB_VERT; - - sw->sbarHorz.fFlatScrollbar = CSBS_NORMAL; - sw->sbarVert.fFlatScrollbar = CSBS_NORMAL; - - //set the default arrow sizes for the scrollbars - sw->sbarHorz.nArrowLength = SYSTEM_METRIC; - sw->sbarHorz.nArrowWidth = SYSTEM_METRIC; - sw->sbarVert.nArrowLength = SYSTEM_METRIC; - sw->sbarVert.nArrowWidth = SYSTEM_METRIC; - - sw->bPreventStyleChange = FALSE; - - sw->oldproc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)CoolSBWndProc); - - CoolSB_SetMinThumbSize(hwnd, SB_BOTH, CoolSB_GetDefaultMinThumbSize()); - -#ifdef COOLSB_TOOLTIPS - ice.dwSize = sizeof(ice); - ice.dwICC = ICC_BAR_CLASSES; - InitCommonControlsEx(&ice); - - sw->hwndToolTip = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TOOLWINDOW, TOOLTIPS_CLASS, _T(""), - WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - hwnd, NULL, GetModuleHandle(0), - NULL); - - ti.cbSize = sizeof(TOOLINFO); - ti.uFlags = TTF_IDISHWND; - ti.hwnd = hwnd; - ti.uId = (UINT)hwnd; - ti.lpszText = LPSTR_TEXTCALLBACK; - ti.hinst = GetModuleHandle(0); - - SendMessage(sw->hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti); - -#else - - UNREFERENCED_PARAMETER(ice); - UNREFERENCED_PARAMETER(ti); - sw->hwndToolTip = 0; - -#endif - - //send the window a frame changed message to update the scrollbars - RedrawNonClient(hwnd, TRUE); - - return TRUE; -} - -BOOL WINAPI CoolSB_EnableScrollBar (HWND hwnd, int wSBflags, UINT wArrows) -{ - SCROLLBAR *sbar; - UINT oldstate; - BOOL bFailed = FALSE; - - if (!CoolSB_IsCoolScrollEnabled(hwnd)) - return EnableScrollBar(hwnd, wSBflags, wArrows); - - if ((wSBflags == SB_HORZ || wSBflags == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) - { - oldstate = sbar->fScrollFlags; - - //clear any existing state, and OR in the disabled flags - sbar->fScrollFlags = (sbar->fScrollFlags & ~ESB_DISABLE_BOTH) | wArrows; - - if(oldstate == sbar->fScrollFlags) - bFailed = TRUE; - - } - - if ((wSBflags == SB_VERT || wSBflags == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) - { - oldstate = sbar->fScrollFlags; - - //clear any existing state, and OR in the disabled flags - sbar->fScrollFlags = (sbar->fScrollFlags & ~ESB_DISABLE_BOTH) | wArrows; - - if(oldstate == sbar->fScrollFlags) - bFailed = TRUE; - } - - return !bFailed; -} - -BOOL WINAPI CoolSB_GetScrollBarInfo(HWND hwnd) -{ -// SCROLLBARINFO sbi; not defined in winuser.h - return FALSE; -} - -BOOL WINAPI CoolSB_GetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi) -{ - SCROLLINFO *mysi; - BOOL copied = FALSE; - - if (!lpsi) - return FALSE; - - if (!(mysi = GetScrollInfoFromHwnd(hwnd, fnBar))) - { - return GetScrollInfo(hwnd, fnBar, lpsi); - } - - if(lpsi->fMask & SIF_PAGE) - { - lpsi->nPage = mysi->nPage; - copied = TRUE; - } - - if(lpsi->fMask & SIF_POS) - { - lpsi->nPos = mysi->nPos; - copied = TRUE; - } - - if(lpsi->fMask & SIF_TRACKPOS) - { - lpsi->nTrackPos = mysi->nTrackPos; - copied = TRUE; - } - - if(lpsi->fMask & SIF_RANGE) - { - lpsi->nMin = mysi->nMin; - lpsi->nMax = mysi->nMax; - copied = TRUE; - } - - return copied; -} - -int WINAPI CoolSB_GetScrollPos (HWND hwnd, int nBar) -{ - SCROLLINFO *mysi; - - if (!(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) - return GetScrollPos(hwnd, nBar); - - return mysi->nPos; -} - -BOOL WINAPI CoolSB_GetScrollRange (HWND hwnd, int nBar, LPINT lpMinPos, LPINT lpMaxPos) -{ - SCROLLINFO *mysi; - - if (!lpMinPos || !lpMaxPos) - return FALSE; - - if (!(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) - return GetScrollRange(hwnd, nBar, lpMinPos, lpMaxPos); - - *lpMinPos = mysi->nMin; - *lpMaxPos = mysi->nMax; - - return TRUE; -} - -int WINAPI CoolSB_SetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL fRedraw) -{ - SCROLLINFO *mysi; - SCROLLBAR *sbar; - BOOL fRecalcFrame = FALSE; - - if (!lpsi) - return FALSE; - - if (!(mysi = GetScrollInfoFromHwnd(hwnd, fnBar))) - return SetScrollInfo(hwnd, fnBar, lpsi, fRedraw); - - //if(CoolSB_IsThumbTracking(hwnd)) - // return mysi->nPos; - - if(lpsi->fMask & SIF_RANGE) - { - mysi->nMin = lpsi->nMin; - mysi->nMax = lpsi->nMax; - } - - //The nPage member must specify a value from 0 to nMax - nMin +1. - if(lpsi->fMask & SIF_PAGE) - { - UINT t = (UINT)(mysi->nMax - mysi->nMin + 1); - mysi->nPage = min(max(0, lpsi->nPage), t); - } - - //The nPos member must specify a value between nMin and nMax - max(nPage - 1, 0). - if(lpsi->fMask & SIF_POS) - { - mysi->nPos = max(lpsi->nPos, mysi->nMin); - mysi->nPos = min((UINT)mysi->nPos, mysi->nMax - max(mysi->nPage - 1, 0)); - } - - sbar = GetScrollBarFromHwnd(hwnd, fnBar); - - if ((lpsi->fMask & SIF_DISABLENOSCROLL) || (sbar->fScrollFlags & CSBS_THUMBALWAYS)) - { - if (!sbar->fScrollVisible) - { - CoolSB_ShowScrollBar(hwnd, fnBar, TRUE); - fRecalcFrame = TRUE; - } - } - else - { - if ( mysi->nPage > (UINT)mysi->nMax - || mysi->nPage == (UINT)mysi->nMax && mysi->nMax == 0 - || mysi->nMax <= mysi->nMin) - { - if(sbar->fScrollVisible) - { - CoolSB_ShowScrollBar(hwnd, fnBar, FALSE); - fRecalcFrame = TRUE; - } - } - else - { - if (!sbar->fScrollVisible) - { - CoolSB_ShowScrollBar(hwnd, fnBar, TRUE); - fRecalcFrame = TRUE; - } - - } - - } - - if(fRedraw && !CoolSB_IsThumbTracking(hwnd)) - RedrawNonClient(hwnd, fRecalcFrame); - - return mysi->nPos; -} - - -int WINAPI CoolSB_SetScrollPos(HWND hwnd, int nBar, int nPos, BOOL fRedraw) -{ - SCROLLINFO *mysi; - int oldpos; - - if (!(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) - { - return SetScrollPos(hwnd, nBar, nPos, fRedraw); - } - - //this is what should happen, but real scrollbars don't work like this.. - //if(CoolSB_IsThumbTracking(hwnd)) - // return mysi->nPos; - - //validate and set the scollbar position - oldpos = mysi->nPos; - mysi->nPos = max(nPos, mysi->nMin); - mysi->nPos = min((UINT)mysi->nPos, mysi->nMax - max(mysi->nPage - 1, 0)); - - if(fRedraw && !CoolSB_IsThumbTracking(hwnd)) - RedrawNonClient(hwnd, FALSE); - - return oldpos; -} - -int WINAPI CoolSB_SetScrollRange (HWND hwnd, int nBar, int nMinPos, int nMaxPos, BOOL fRedraw) -{ - SCROLLINFO *mysi; - - if (!(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) - return SetScrollRange(hwnd, nBar, nMinPos, nMaxPos, fRedraw); - - if(CoolSB_IsThumbTracking(hwnd)) - return mysi->nPos; - - //hide the scrollbar if nMin == nMax - //nMax-nMin must not be greater than MAXLONG - mysi->nMin = nMinPos; - mysi->nMax = nMaxPos; - - if(fRedraw) - RedrawNonClient(hwnd, FALSE); - - return TRUE; -} - -// -// Show or hide the specified scrollbars -// -BOOL WINAPI CoolSB_ShowScrollBar (HWND hwnd, int wBar, BOOL fShow) -{ - SCROLLBAR *sbar; - BOOL bFailed = FALSE; - DWORD dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); - - if (!CoolSB_IsCoolScrollEnabled(hwnd)) - return ShowScrollBar(hwnd, wBar, fShow); - - if ((wBar == SB_HORZ || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) - { - sbar->fScrollFlags = sbar->fScrollFlags & ~CSBS_VISIBLE; - sbar->fScrollFlags |= (fShow == TRUE ? CSBS_VISIBLE : 0); - //bFailed = TRUE; - - if(fShow) SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle | WS_HSCROLL); - else SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle & ~WS_HSCROLL); - } - - if ((wBar == SB_VERT || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) - { - sbar->fScrollFlags = sbar->fScrollFlags & ~CSBS_VISIBLE; - sbar->fScrollFlags |= (fShow == TRUE ? CSBS_VISIBLE : 0); - //bFailed = TRUE; - - if(fShow) SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle | WS_VSCROLL); - else SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle & ~WS_VSCROLL); - } - - if(bFailed) - { - return FALSE; - } - else - { - //DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); - //style |= WS_VSCROLL; - - //if(s - //SetWindowLongPtr(hwnd, GWL_STYLE, style); - - SetWindowPos(hwnd, 0, 0, 0, 0, 0, - SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | - SWP_NOACTIVATE | SWP_FRAMECHANGED); - - return TRUE; - } -} - -// -// Remove cool scrollbars from the specified window. -// -HRESULT WINAPI UninitializeCoolSB(HWND hwnd) -{ - int i = 0; - SCROLLWND *sw = GetScrollWndFromHwnd(hwnd); - if (!sw) return E_FAIL; - - //restore the window procedure with the original one - SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)sw->oldproc); - - RemoveProp(hwnd, szPropStr); - //SetWindowLongPtr(hwnd, GWLP_USERDATA, 0); - - //finally, release the memory needed for the cool scrollbars - HeapFree(GetProcessHeap(), 0, sw); - - //Force WM_NCCALCSIZE and WM_NCPAINT so the original scrollbars can kick in - RedrawNonClient(hwnd, TRUE); - - return S_OK; -} - -#ifdef INCLUDE_BUTTONS - -// -// Cool scrollbar specific interface (BUTTON support) -// - -// -// Insert a button into the scrollbar area -// -// wSBflags - SB_HORZ / SB_VERT only -// uPos - position into which to insert. -// can be 0 to insert at the start, or -1 to insert -// at the end of previously inserted buttons -// - -BOOL WINAPI CoolSB_InsertButton(HWND hwnd, int wSBflags, UINT nPos, SCROLLBUT *psb) -{ - SCROLLBAR *sbar; - SCROLLBUT *sbut; - UINT i; - - if (!psb) return FALSE; - - if (!(sbar = GetScrollBarFromHwnd(hwnd, wSBflags))) - return FALSE; - - //check that we havn't reached the maximum allowed buttons yet - if(sbar->nButtons == MAX_COOLSB_BUTS) - return FALSE; - - //insert at end - if(nPos == -1) - { - sbut = &sbar->sbButtons[sbar->nButtons]; - } - //otherwise, need to make room - else if ((int)nPos < 0 || (int)nPos > (UINT)sbar->nButtons) - { - return FALSE; - } - else - { - //insert space for the button at the specified position - for (i = sbar->nButtons; i > nPos; i--) - { - sbar->sbButtons[i] = sbar->sbButtons[i-1]; - } - - sbut = &sbar->sbButtons[nPos]; - } - - //only set the button's properties if they are - //specified by the SCROLLBUT->fMask. - //Otherwise, use a default property value - - if(psb->fMask & SBBF_TYPE) - sbut->uButType = psb->uButType; - else - sbut->uButType = SBBT_PUSHBUTTON; - - if(psb->fMask & SBBF_STATE) - sbut->uState = psb->uState; - else - sbut->uState = 0; - - if(psb->fMask & SBBF_ID) - sbut->uCmdId = psb->uCmdId; - else - sbut->uCmdId = 0; - - if(psb->fMask & SBBF_SIZE) - sbut->nSize = psb->nSize; - else - sbut->nSize = -1; - - if(psb->fMask & SBBF_PLACEMENT) - sbut->uPlacement = psb->uPlacement; - else - sbut->uPlacement = SBBP_LEFT; - - if(psb->fMask & SBBF_BITMAP) - sbut->hBmp = psb->hBmp; - else - sbut->hBmp = 0; - - if(psb->fMask & SBBF_ENHMETAFILE) - sbut->hEmf = psb->hEmf; - else - sbut->hEmf = 0; - - if(psb->fMask & SBBF_CURSOR) - sbut->hCurs = psb->hCurs; - else - sbut->hCurs = 0; - - /* - We don't use the callback function anymore. The uButType - member must now specify SBBT_OWNERDRAW, and a WM_NOTIFY will - be sent when a button must be drawn - if ((psb->fMask & SBBF_OWNERDRAW) && ((psb->uButType & SBBT_MASK) == SBBT_OWNERDRAW)) - pDrawProc = psb->pDrawProc; - else - pDrawProc = 0;*/ - - sbar->nButtons++; - sbut->nSizeReserved = sbut->nSize; - - //MAKE SURE that any resizable buttons are only to the left / above - //a scrollbar. We don't support resize operations to the right of a scrollbar - if ((sbut->uButType & SBBM_RESIZABLE) && sbut->uPlacement == SBBP_RIGHT) - sbut->uButType &= ~SBBM_RESIZABLE; - - if(psb->fMask & SBBF_BUTMINMAX) - { - sbut->nMinSize = psb->nMinSize; - sbut->nMaxSize = psb->nMaxSize; - } - else - { - sbut->nMinSize = 0; - sbut->nMaxSize = -1; - } - - return TRUE; -} - -static SCROLLBUT *GetButtonFromId(SCROLLBAR *sbar, UINT uCmdId) -{ - int i; - for (i = 0; i < sbar->nButtons; i++) - { - if(sbar->sbButtons[i].uCmdId == uCmdId) - return &sbar->sbButtons[i]; - } - - return 0; -} - -// -// Modify the properties of the specified scrollbar button. -// wSBflags - SB_HORZ / SB_VERT only -// uItem - the command identifier specified when the button was created, -// or a non-negative position of the button, depending on if -// fByCmd is FALSE or TRUE, respectively -// -BOOL WINAPI CoolSB_ModifyButton (HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, SCROLLBUT *psb) -{ - SCROLLBAR *sbar; - SCROLLBUT *sbut; - - if (!psb) return FALSE; - - //find if this window is CoolScroll enabled - if (!(sbar = GetScrollBarFromHwnd(hwnd, wSBflags))) - return FALSE; - - //find the button to modify, depending on if we - //are modifying by position or command id - if(fByCmd == FALSE) - { - //button from position - if ((int)uItem < 0 || (int)uItem >= (UINT)sbar->nButtons) - return FALSE; - else - sbut = &sbar->sbButtons[uItem]; - } - else if(fByCmd == TRUE) - { - //button from command identifier - if (!(sbut = GetButtonFromId(sbar, uItem))) - return FALSE; - } - - if(psb->fMask & SBBF_TYPE) sbut->uButType = psb->uButType; - if(psb->fMask & SBBF_STATE) sbut->uState = psb->uState; - if(psb->fMask & SBBF_ID) sbut->uCmdId = psb->uCmdId; - if(psb->fMask & SBBF_SIZE) sbut->nSize = psb->nSize; - if(psb->fMask & SBBF_PLACEMENT) sbut->uPlacement = psb->uPlacement; - if(psb->fMask & SBBF_BITMAP) sbut->hBmp = psb->hBmp; - if(psb->fMask & SBBF_ENHMETAFILE) sbut->hEmf = psb->hEmf; - if(psb->fMask & SBBF_CURSOR) sbut->hCurs = psb->hCurs; - - if(psb->fMask & SBBF_BUTMINMAX) - { - sbut->nMinSize = psb->nMinSize; - sbut->nMaxSize = psb->nMaxSize; - } - - return TRUE; -} - -BOOL WINAPI CoolSB_RemoveButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd) -{ - int i; - SCROLLBAR *sbar; - - //find if this window is CoolScroll enabled - if (!(sbar = GetScrollBarFromHwnd(hwnd, wSBflags))) - return FALSE; - - //find the button to modify, depending on if we - //are modifying by position or command id - if(fByCmd == FALSE && ((int)uItem < 0 || (int)uItem >= (UINT)sbar->nButtons)) - { - return FALSE; - } - else if(fByCmd == TRUE) - { - //find the button with the specified command id - for (i = 0; i < sbar->nButtons; i++) - { - if(sbar->sbButtons[i].uCmdId == uItem) - { - //change the id to an index - uItem = i; - break; - } - } - - //if we failed to find the button... - if(i == sbar->nButtons) return FALSE; - } - - //remove the button! - for (i = uItem; i < sbar->nButtons - 1; i++) - { - sbar->sbButtons[i] = sbar->sbButtons[i+1]; - } - - sbar->nButtons--; - - RedrawNonClient(hwnd, TRUE); - - return TRUE; -} - -// -// fill in the supplied SCROLLBUT structure -// -BOOL WINAPI CoolSB_GetButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, SCROLLBUT *psb) -{ - SCROLLBAR *sbar; - SCROLLBUT *sbut; - - if (!psb) return FALSE; - - //find if this window is CoolScroll enabled - if (!(sbar = GetScrollBarFromHwnd(hwnd, wSBflags))) - return FALSE; - - //find the button to modify, depending on if we - //are modifying by position or command id - if(fByCmd == FALSE) - { - //button from position - if ((int)uItem < 0 || (int)uItem >= (UINT)sbar->nButtons) - return FALSE; - else - sbut = &sbar->sbButtons[uItem]; - } - else if(fByCmd == TRUE) - { - //button from command identifier - if (!(sbut = GetButtonFromId(sbar, uItem))) - return FALSE; - } - - //copy them across - *psb = *sbut; - - return FALSE; -} - -#else - -BOOL WINAPI CoolSB_InsertButton(HWND hwnd, int wSBflags, UINT nPos, SCROLLBUT *psb) { return FALSE; } -BOOL WINAPI CoolSB_ModifyButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, SCROLLBUT *psb) { return FALSE; } -BOOL WINAPI CoolSB_RemoveButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd) { return FALSE; } -BOOL WINAPI CoolSB_GetButton (HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, SCROLLBUT *psb) { return FALSE; } - -#endif //INCLUDE_BUTTONS - -// -// Set the size of the scrollbars -// -BOOL WINAPI CoolSB_SetSize (HWND hwnd, int wBar, int nLength, int nWidth) -{ - SCROLLBAR *sbar; - - if(nLength == 0 || nWidth == 0) - return FALSE; - - if(nLength < -8 || nWidth < -8) - return FALSE; - - if(nLength > 256 || nWidth > 256) - return FALSE; - - if (!GetScrollWndFromHwnd(hwnd)) - return FALSE; - - if ((wBar == SB_HORZ || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) - { - sbar->nArrowLength = nLength; - sbar->nArrowWidth = nWidth; - } - - if ((wBar == SB_VERT || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) - { - sbar->nArrowLength = nLength; - sbar->nArrowWidth = nWidth; - } - - RedrawNonClient(hwnd, TRUE); - - return TRUE; -} - - -// -// Alter the display mode of the scrollbars -// wBar - SB_HORZ / SB_VERT / SB_BOTH -// nStyle - CSBF_NORMAL / CSBF_FLAT / CSBF_HOTTRACKED -// -BOOL WINAPI CoolSB_SetStyle(HWND hwnd, int wBar, UINT nStyle) -{ - SCROLLBAR *sbar; - - if (!GetScrollWndFromHwnd(hwnd)) - return FALSE; - - if ((wBar == SB_HORZ || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) - { - sbar->fFlatScrollbar = nStyle; - } - - if ((wBar == SB_VERT || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) - { - sbar->fFlatScrollbar = nStyle; - } - - RedrawNonClient(hwnd, FALSE); - - return TRUE; -} - -// -// Set if the thumb is always visible, even if there is no data to -// scroll. Setting this keeps the scrollbar enabled, but the thumb -// covers the whole area -// -BOOL WINAPI CoolSB_SetThumbAlways(HWND hwnd, int wBar, BOOL fThumbAlways) -{ - SCROLLBAR *sbar; - - if (!GetScrollWndFromHwnd(hwnd)) - return FALSE; - - if ((wBar == SB_HORZ || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) - { - if(fThumbAlways) - sbar->fScrollFlags |= CSBS_THUMBALWAYS; - else - sbar->fScrollFlags &= ~CSBS_THUMBALWAYS; - } - - if ((wBar == SB_VERT || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) - { - if(fThumbAlways) - sbar->fScrollFlags |= CSBS_THUMBALWAYS; - else - sbar->fScrollFlags &= ~CSBS_THUMBALWAYS; - } - - RedrawNonClient(hwnd, FALSE); - - return TRUE; -} - -// -// Set the minimum size, in pixels, that the thumb box will shrink to. -// -BOOL WINAPI CoolSB_SetMinThumbSize(HWND hwnd, UINT wBar, UINT size) -{ - SCROLLBAR *sbar; - - if (!GetScrollWndFromHwnd(hwnd)) - return FALSE; - - if(size == -1) - size = CoolSB_GetDefaultMinThumbSize(); - - if ((wBar == SB_HORZ || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) - { - sbar->nMinThumbSize = size; - } - - if ((wBar == SB_VERT || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) - { - sbar->nMinThumbSize = size; - } - - return TRUE; -} diff --git a/plugins/Clist_nicer/coolsb/coolsblib.h b/plugins/Clist_nicer/coolsb/coolsblib.h deleted file mode 100644 index d9b1c711f3..0000000000 --- a/plugins/Clist_nicer/coolsb/coolsblib.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef _SUPERSCROLL_INCLUDED -#define _SUPERSCROLL_INCLUDED - -#ifdef __cplusplus -extern "C"{ -#endif - -#include - - -#ifdef __cplusplus -} -#endif - -#endif - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/Clist_nicer/coolsb/coolscroll.cpp b/plugins/Clist_nicer/coolsb/coolscroll.cpp deleted file mode 100644 index ac31f86c24..0000000000 --- a/plugins/Clist_nicer/coolsb/coolscroll.cpp +++ /dev/null @@ -1,3206 +0,0 @@ -/* - Cool Scrollbar Library Version 1.2 - - Module: coolscroll.c - Copyright (c) J Brown 2001 - - This code is freeware, however, you may not publish - this code elsewhere or charge any money for it. This code - is supplied as-is. I make no guarantees about the suitability - of this code - use at your own risk. - - It would be nice if you credited me, in the event - that you use this code in a product. - - VERSION HISTORY: - - V1.2: TreeView problem fixed by Diego Tartara - Small problem in thumbsize calculation also fixed (thanks Diego!) - - V1.1: Added support for Right-left windows - Changed calling convention of APIs to WINAPI (__stdcall) - Completely standalone (no need for c-runtime) - Now supports ALL windows with appropriate USER32.DLL patching - (you provide!!) - - V1.0: Apr 2001: Initial Version - - IMPORTANT: - This whole library is based around code for a horizontal scrollbar. - All "vertical" scrollbar drawing / mouse interaction uses the - horizontal scrollbar functions, but uses a trick to convert the vertical - scrollbar coordinates into horizontal equivelants. When I started this project, - I quickly realised that the code for horz/vert bars was IDENTICAL, apart - from the fact that horizontal code uses left/right coords, and vertical code - uses top/bottom coords. On entry to a "vertical" drawing function, for example, - the coordinates are "rotated" before the horizontal function is called, and - then rotated back once the function has completed. When something needs to - be drawn, the coords are converted back again before drawing. - - This trick greatly reduces the amount of code required, and makes - maintanence much simpler. This way, only one function is needed to draw - a scrollbar, but this can be used for both horizontal and vertical bars - with careful thought. -*/ - -#define _WIN32_WINNT 0x0501 -#define _WIN32_IE 0x0501 - -#include -#include "coolscroll.h" -#include "userdefs.h" -#include "coolsb_internal.h" - -//define some values if the new version of common controls -//is not available. -#ifndef NM_CUSTOMDRAW -#define NM_CUSTOMDRAW (NM_FIRST-12) -#define CDRF_DODEFAULT 0x0000 -#define CDRF_SKIPDEFAULT 0x0004 -#define CDDS_PREPAINT 0x0001 -#define CDDS_POSTPAINT 0x0002 -#endif - -// -// Special thumb-tracking variables -// -// -static UINT uCurrentScrollbar = COOLSB_NONE; //SB_HORZ / SB_VERT -static UINT uCurrentScrollPortion = HTSCROLL_NONE; -static UINT uCurrentButton = 0; - -static RECT rcThumbBounds; //area that the scroll thumb can travel in -static int nThumbSize; //(pixels) -static int nThumbPos; //(pixels) -static int nThumbMouseOffset; //(pixels) -static int nLastPos = -1; //(scrollbar units) -static int nThumbPos0; //(pixels) initial thumb position - -// -// Temporary state used to auto-generate timer messages -// -static UINT_PTR uMouseOverId = 0; -static UINT uMouseOverScrollbar = COOLSB_NONE; -static UINT uHitTestPortion = HTSCROLL_NONE; -static UINT uLastHitTestPortion = HTSCROLL_NONE; -static RECT MouseOverRect; - -static UINT uScrollTimerMsg = 0; -static UINT uScrollTimerPortion = HTSCROLL_NONE; -static UINT_PTR uScrollTimerId = 0; -static HWND hwndCurCoolSB = 0; - -extern int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd); - -// -// Provide this so there are NO dependencies on CRT -// -static void CoolSB_ZeroMemory(void *ptr, DWORD bytes) -{ - BYTE *bptr = (BYTE *)ptr; - - while(bytes--) *bptr++ = 0; -} - -BOOL WINAPI CoolSB_IsThumbTracking(HWND hwnd) -{ - SCROLLWND *sw; - - if ((sw = GetScrollWndFromHwnd(hwnd)) == NULL) - return FALSE; - else - return sw->fThumbTracking; -} - -// -// swap the rectangle's x coords with its y coords -// -static void __stdcall RotateRect(RECT *rect) -{ - int temp; - temp = rect->left; - rect->left = rect->top; - rect->top = temp; - - temp = rect->right; - rect->right = rect->bottom; - rect->bottom = temp; -} - -// -// swap the coords if the scrollbar is a SB_VERT -// -static void __stdcall RotateRect0(SCROLLBAR *sb, RECT *rect) -{ - if(sb->nBarType == SB_VERT) - RotateRect(rect); -} - -// -// Calculate if the SCROLLINFO members produce -// an enabled or disabled scrollbar -// -static BOOL IsScrollInfoActive(SCROLLINFO *si) -{ - if ((si->nPage > (UINT)si->nMax - || si->nMax <= si->nMin || si->nMax == 0)) - return FALSE; - else - return TRUE; -} - -// -// Return if the specified scrollbar is enabled or not -// -static BOOL IsScrollbarActive(SCROLLBAR *sb) -{ - SCROLLINFO *si = &sb->scrollInfo; - if (((sb->fScrollFlags & ESB_DISABLE_BOTH) == ESB_DISABLE_BOTH) || - !(sb->fScrollFlags & CSBS_THUMBALWAYS) && !IsScrollInfoActive(si)) - return FALSE; - else - return TRUE; -} - -// -// Draw a standard scrollbar arrow -// -static int DrawScrollArrow(SCROLLBAR *sbar, HDC hdc, RECT *rect, UINT arrow, BOOL fMouseDown, BOOL fMouseOver) -{ - UINT ret; - UINT flags = arrow; - - //HACKY bit so this routine can be called by vertical and horizontal code - if(sbar->nBarType == SB_VERT) - { - if(flags & DFCS_SCROLLLEFT) flags = flags & ~DFCS_SCROLLLEFT | DFCS_SCROLLUP; - if(flags & DFCS_SCROLLRIGHT) flags = flags & ~DFCS_SCROLLRIGHT | DFCS_SCROLLDOWN; - } - - if(fMouseDown) flags |= (DFCS_FLAT | DFCS_PUSHED); - -#ifdef FLAT_SCROLLBARS - if(sbar->fFlatScrollbar != CSBS_NORMAL) - { - HDC hdcmem1, hdcmem2; - HBITMAP hbm1, oldbm1; - HBITMAP hbm2, oldbm2; - RECT rc; - int width, height; - - rc = *rect; - width = rc.right-rc.left; - height = rc.bottom-rc.top; - SetRect(&rc, 0, 0, width, height); - - //MONOCHROME bitmap to convert the arrow to black/white mask - hdcmem1 = CreateCompatibleDC(hdc); - hbm1 = CreateBitmap(width, height, 1, 1, NULL); - UnrealizeObject(hbm1); - oldbm1 = reinterpret_cast(SelectObject(hdcmem1, hbm1)); - - - //NORMAL bitmap to draw the arrow into - hdcmem2 = CreateCompatibleDC(hdc); - hbm2 = CreateCompatibleBitmap(hdc, width, height); - UnrealizeObject(hbm2); - oldbm2 = reinterpret_cast(SelectObject(hdcmem2, hbm2)); - - - flags = flags & ~DFCS_PUSHED | DFCS_FLAT; //just in case - DrawFrameControl(hdcmem2, &rc, DFC_SCROLL, flags); - - -#ifndef HOT_TRACKING - if(fMouseDown) - { - //uncomment these to make the cool scrollbars - //look like the common controls flat scrollbars - //fMouseDown = FALSE; - //fMouseOver = TRUE; - } -#endif - //draw a flat monochrome version of a scrollbar arrow (dark) - if(fMouseDown) - { - SetBkColor(hdcmem2, GetSysColor(COLOR_BTNTEXT)); - BitBlt(hdcmem1, 0, 0, width, height, hdcmem2, 0, 0, SRCCOPY); - SetBkColor(hdc, 0x00ffffff); - SetTextColor(hdc, GetSysColor(COLOR_3DDKSHADOW)); - BitBlt(hdc, rect->left, rect->top, width, height, hdcmem1, 0, 0, SRCCOPY); - } - //draw a flat monochrome version of a scrollbar arrow (grey) - else if(fMouseOver) - { - SetBkColor(hdcmem2, GetSysColor(COLOR_BTNTEXT)); - FillRect(hdcmem1, &rc, reinterpret_cast(GetStockObject(WHITE_BRUSH))); - BitBlt(hdcmem1, 0, 0, width, height, hdcmem2, 0, 0, SRCINVERT); - - SetBkColor(hdc, GetSysColor(COLOR_3DSHADOW)); - SetTextColor(hdc, 0x00ffffff); - BitBlt(hdc, rect->left, rect->top, width, height, hdcmem1, 0, 0, SRCCOPY); - } - //draw the arrow normally - else - { - BitBlt(hdc, rect->left, rect->top, width, height, hdcmem2, 0, 0, SRCCOPY); - } - - SelectObject(hdcmem1, oldbm1); - SelectObject(hdcmem2, oldbm2); - DeleteObject(hbm1); - DeleteObject(hbm2); - DeleteDC(hdcmem1); - DeleteDC(hdcmem2); - - ret = 0; - } - else -#endif - ret = DrawFrameControl(hdc, rect, DFC_SCROLL, flags); - - return ret; -} - -// -// Return the size in pixels for the specified scrollbar metric, -// for the specified scrollbar -// -static int GetScrollMetric(SCROLLBAR *sbar, int metric) -{ - if(sbar->nBarType == SB_HORZ) - { - if(metric == SM_CXHORZSB) - { - if(sbar->nArrowLength < 0) - return -sbar->nArrowLength * GetSystemMetrics(SM_CXHSCROLL); - else - return sbar->nArrowLength; - } - else - { - if(sbar->nArrowWidth < 0) - return -sbar->nArrowWidth * GetSystemMetrics(SM_CYHSCROLL); - else - return sbar->nArrowWidth; - } - } - else if(sbar->nBarType == SB_VERT) - { - if(metric == SM_CYVERTSB) - { - if(sbar->nArrowLength < 0) - return -sbar->nArrowLength * GetSystemMetrics(SM_CYVSCROLL); - else - return sbar->nArrowLength; - } - else - { - if(sbar->nArrowWidth < 0) - return -sbar->nArrowWidth * GetSystemMetrics(SM_CXVSCROLL); - else - return sbar->nArrowWidth; - } - } - - return 0; -} - -// -// -// -static COLORREF GetSBForeColor(void) -{ - COLORREF c1 = GetSysColor(COLOR_3DHILIGHT); - COLORREF c2 = GetSysColor(COLOR_WINDOW); - - if(c1 != 0xffffff && c1 == c2) - { - return GetSysColor(COLOR_BTNFACE); - } - else - { - return GetSysColor(COLOR_3DHILIGHT); - } -} - -static COLORREF GetSBBackColor(void) -{ - return GetSysColor(COLOR_SCROLLBAR); -} - -// -// Paint a checkered rectangle, with each alternate -// pixel being assigned a different colour -// -static void DrawCheckedRect(HDC hdc, RECT *rect, COLORREF fg, COLORREF bg) -{ - static WORD wCheckPat[8] = - { - 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555 - }; - - HBITMAP hbmp; - HBRUSH hbr, hbrold; - COLORREF fgold, bgold; - - hbmp = CreateBitmap(8, 8, 1, 1, wCheckPat); - hbr = CreatePatternBrush(hbmp); - - UnrealizeObject(hbr); - SetBrushOrgEx(hdc, rect->left, rect->top, 0); - - hbrold = (HBRUSH)SelectObject(hdc, hbr); - - fgold = SetTextColor(hdc, fg); - bgold = SetBkColor(hdc, bg); - - PatBlt(hdc, rect->left, rect->top, - rect->right - rect->left, - rect->bottom - rect->top, - PATCOPY); - - SetBkColor(hdc, bgold); - SetTextColor(hdc, fgold); - - SelectObject(hdc, hbrold); - DeleteObject(hbr); - DeleteObject(hbmp); -} - -// -// Fill the specifed rectangle using a solid colour -// -static void PaintRect(HDC hdc, RECT *rect, COLORREF color) -{ - COLORREF oldcol = SetBkColor(hdc, color); - ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, rect, "", 0, NULL); - SetBkColor(hdc, oldcol); -} - -// -// Draw a simple blank scrollbar push-button. Can be used -// to draw a push button, or the scrollbar thumb -// drawflag - could set to BF_FLAT to make flat scrollbars -// -void DrawBlankButton(HDC hdc, const RECT *rect, UINT drawflag) -{ - RECT rc = *rect; - -#ifndef FLAT_SCROLLBARS - drawflag &= ~BF_FLAT; -#endif - - DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | drawflag | BF_ADJUST); - FillRect(hdc, &rc, GetSysColorBrush(COLOR_BTNFACE)); -} - -// -// Send a WM_VSCROLL or WM_HSCROLL message -// -static void SendScrollMessage(HWND hwnd, UINT scrMsg, UINT scrId, UINT pos) -{ - SendMessage(hwnd, scrMsg, MAKEWPARAM(scrId, pos), 0); -} - -// -// Calculate the screen coordinates of the area taken by -// the horizontal scrollbar. Take into account the size -// of the window borders -// -static BOOL GetHScrollRect(SCROLLWND *sw, HWND hwnd, RECT *rect) -{ - GetWindowRect(hwnd, rect); - - if(sw->fLeftScrollbar) - { - rect->left += sw->cxLeftEdge + (sw->sbarVert.fScrollVisible ? - GetScrollMetric(&sw->sbarVert, SM_CXVERTSB) : 0); - rect->right -= sw->cxRightEdge; - } - else - { - rect->left += sw->cxLeftEdge; //left window edge - - rect->right -= sw->cxRightEdge + //right window edge - (sw->sbarVert.fScrollVisible ? - GetScrollMetric(&sw->sbarVert, SM_CXVERTSB) : 0); - } - - rect->bottom -= sw->cyBottomEdge; //bottom window edge - - rect->top = rect->bottom - - (sw->sbarHorz.fScrollVisible ? - GetScrollMetric(&sw->sbarHorz, SM_CYHORZSB) : 0); - - return TRUE; -} - -// -// Calculate the screen coordinates of the area taken by the -// vertical scrollbar -// -static BOOL GetVScrollRect(SCROLLWND *sw, HWND hwnd, RECT *rect) -{ - GetWindowRect(hwnd, rect); - rect->top += sw->cyTopEdge; //top window edge - - rect->bottom -= sw->cyBottomEdge + - (sw->sbarHorz.fScrollVisible ? //bottom window edge - GetScrollMetric(&sw->sbarHorz, SM_CYHORZSB) : 0); - - if(sw->fLeftScrollbar) - { - rect->left += sw->cxLeftEdge; - rect->right = rect->left + (sw->sbarVert.fScrollVisible ? - GetScrollMetric(&sw->sbarVert, SM_CXVERTSB) : 0); - } - else - { - rect->right -= sw->cxRightEdge; - rect->left = rect->right - (sw->sbarVert.fScrollVisible ? - GetScrollMetric(&sw->sbarVert, SM_CXVERTSB) : 0); - } - - return TRUE; -} - -// Depending on what type of scrollbar nBar refers to, call the -// appropriate Get?ScrollRect function -// -BOOL GetScrollRect(SCROLLWND *sw, UINT nBar, HWND hwnd, RECT *rect) -{ - if(nBar == SB_HORZ) - return GetHScrollRect(sw, hwnd, rect); - else if(nBar == SB_VERT) - return GetVScrollRect(sw, hwnd, rect); - else - return FALSE; -} - -// -// This code is a prime candidate for splitting out into a separate -// file at some stage -// -#ifdef INCLUDE_BUTTONS - -// -// Calculate the size in pixels of the specified button -// -static int GetSingleButSize(SCROLLBAR *sbar, SCROLLBUT *sbut) -{ - //multiple of the system button size - //or a specific button size - if(sbut->nSize < 0) - { - if(sbar->nBarType == SB_HORZ) - return -sbut->nSize * GetSystemMetrics(SM_CXHSCROLL); - else - return -sbut->nSize * GetSystemMetrics(SM_CYVSCROLL); - } - else - return sbut->nSize; -} - -// -// Find the size in pixels of all the inserted buttons, -// either before or after the specified scrollbar -// -static int GetButtonSize(SCROLLBAR *sbar, HWND hwnd, UINT uBeforeAfter) -{ - int i; - int nPixels = 0; - - SCROLLBUT *sbut = sbar->sbButtons; - - for (i = 0; i < sbar->nButtons; i++) - { - //only consider those buttons on the same side as nTopBottom says - if(sbut[i].uPlacement == uBeforeAfter) - { - nPixels += GetSingleButSize(sbar, &sbut[i]); - } - } - - return nPixels; -} -#endif //INCLUDE_BUTTONS - -// -// Work out the scrollbar width/height for either type of scrollbar (SB_HORZ/SB_VERT) -// rect - coords of the scrollbar. -// store results into *thumbsize and *thumbpos -// -static int CalcThumbSize(SCROLLBAR *sbar, const RECT *rect, int *pthumbsize, int *pthumbpos) -{ - SCROLLINFO *si; - int scrollsize; //total size of the scrollbar including arrow buttons - int workingsize; //working area (where the thumb can slide) - int siMaxMin; - int butsize; - int startcoord; - int thumbpos = 0, thumbsize = 0; - - int adjust=0; - static int count=0; - - //work out the width (for a horizontal) or the height (for a vertical) - //of a standard scrollbar button - butsize = GetScrollMetric(sbar, SM_SCROLL_LENGTH); - - if(1) //sbar->nBarType == SB_HORZ) - { - scrollsize = rect->right - rect->left; - startcoord = rect->left; - } - /*else if(sbar->nBarType == SB_VERT) - { - scrollsize = rect->bottom - rect->top; - startcoord = rect->top; - } - else - { - return 0; - }*/ - - si = &sbar->scrollInfo; - siMaxMin = si->nMax - si->nMin + 1; - workingsize = scrollsize - butsize * 2; - - // - // Work out the scrollbar thumb SIZE - // - if(si->nPage == 0) - { - thumbsize = butsize; - } - else if(siMaxMin > 0) - { - thumbsize = MulDiv(si->nPage, workingsize, siMaxMin); - - if(thumbsize < sbar->nMinThumbSize) - thumbsize = sbar->nMinThumbSize; - } - - // - // Work out the scrollbar thumb position - // - if(siMaxMin > 0) - { - int pagesize = max(1, si->nPage); - thumbpos = MulDiv(si->nPos - si->nMin, workingsize-thumbsize, siMaxMin - pagesize); - - if(thumbpos < 0) - thumbpos = 0; - - if(thumbpos >= workingsize-thumbsize) - thumbpos = workingsize-thumbsize; - } - - thumbpos += startcoord + butsize; - - *pthumbpos = thumbpos; - *pthumbsize = thumbsize; - - return 1; -} - -// -// return a hit-test value for whatever part of the scrollbar x,y is located in -// rect, x, y: SCREEN coordinates -// the rectangle must not include space for any inserted buttons -// (i.e, JUST the scrollbar area) -// -static UINT GetHorzScrollPortion(SCROLLBAR *sbar, HWND hwnd, const RECT *rect, int x, int y) -{ - int thumbwidth, thumbpos; - int butwidth = GetScrollMetric(sbar, SM_SCROLL_LENGTH); - int scrollwidth = rect->right-rect->left; - int workingwidth = scrollwidth - butwidth*2; - - if(y < rect->top || y >= rect->bottom) - return HTSCROLL_NONE; - - CalcThumbSize(sbar, rect, &thumbwidth, &thumbpos); - - //if we have had to scale the buttons to fit in the rect, - //then adjust the button width accordingly - if(scrollwidth <= butwidth * 2) - { - butwidth = scrollwidth / 2; - } - - //check for left button click - if(x >= rect->left && x < rect->left + butwidth) - { - return HTSCROLL_LEFT; - } - //check for right button click - else if(x >= rect->right-butwidth && x < rect->right) - { - return HTSCROLL_RIGHT; - } - - //if the thumb is too big to fit (i.e. it isn't visible) - //then return a NULL scrollbar area - if(thumbwidth >= workingwidth) - return HTSCROLL_NONE; - - //check for point in the thumbbar - if(x >= thumbpos && x < thumbpos+thumbwidth) - { - return HTSCROLL_THUMB; - } - //check for left margin - else if(x >= rect->left+butwidth && x < thumbpos) - { - return HTSCROLL_PAGELEFT; - } - else if(x >= thumbpos+thumbwidth && x < rect->right-butwidth) - { - return HTSCROLL_PAGERIGHT; - } - - return HTSCROLL_NONE; -} - -// -// For vertical scrollbars, rotate all coordinates by -90 degrees -// so that we can use the horizontal version of this function -// -static UINT GetVertScrollPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) -{ - UINT r; - - RotateRect(rect); - r = GetHorzScrollPortion(sb, hwnd, rect, y, x); - RotateRect(rect); - return r; -} - -// -// CUSTOM DRAW support -// -static LRESULT PostCustomPrePostPaint(HWND hwnd, HDC hdc, SCROLLBAR *sb, UINT dwStage) -{ -#ifdef CUSTOM_DRAW - NMCSBCUSTOMDRAW nmcd; - - CoolSB_ZeroMemory(&nmcd, sizeof nmcd); - nmcd.hdr.hwndFrom = hwnd; - nmcd.hdr.idFrom = GetWindowLongPtr(hwnd, GWLP_ID); - nmcd.hdr.code = NM_COOLSB_CUSTOMDRAW; - nmcd.nBar = sb->nBarType; - nmcd.dwDrawStage = dwStage; - nmcd.hdc = hdc; - - hwnd = GetParent(hwnd); - return CustomDrawScrollBars(&nmcd); -#else - return 0; -#endif -} - -static LRESULT PostCustomDrawNotify(HWND hwnd, HDC hdc, UINT nBar, RECT *prect, UINT nItem, BOOL fMouseDown, BOOL fMouseOver, BOOL fInactive) -{ -#ifdef CUSTOM_DRAW - NMCSBCUSTOMDRAW nmcd; - - //fill in the standard header - nmcd.hdr.hwndFrom = hwnd; - nmcd.hdr.idFrom = GetWindowLongPtr(hwnd, GWLP_ID); - nmcd.hdr.code = NM_COOLSB_CUSTOMDRAW; - - nmcd.dwDrawStage = CDDS_ITEMPREPAINT; - nmcd.nBar = nBar; - nmcd.rect = *prect; - nmcd.uItem = nItem; - nmcd.hdc = hdc; - - if(fMouseDown) - nmcd.uState = CDIS_SELECTED; - else if(fMouseOver) - nmcd.uState = CDIS_HOT; - else if(fInactive) - nmcd.uState = CDIS_DISABLED; - else - nmcd.uState = CDIS_DEFAULT; - - hwnd = GetParent(hwnd); - return CustomDrawScrollBars(&nmcd); -#else - return 0; -#endif -} - -// Depending on if we are supporting custom draw, either define -// a macro to the function name, or to nothing at all. If custom draw -// is turned off, then we can save ALOT of code space by binning all -// calls to the custom draw support. - -/* -#ifdef CUSTOM_DRAW -#define PostCustomDrawNotify PostCustomDrawNotify0 -#define PostCustomPrePostPaint PostCustomPrePostPaint0 -#else -#define PostCustomDrawNotify 1 ? (void)0 : PostCustomDrawNotify0 -#define PostCustomPrePostPaint 1 ? (void)0 : PostCustomPrePostPaint0 -#endif -*/ - -static LRESULT PostMouseNotify0(HWND hwnd, UINT msg, UINT nBar, RECT *prect, UINT nCmdId, POINT pt) -{ -#ifdef NOTIFY_MOUSE - NMCOOLBUTMSG nmcb; - - //fill in the standard header - nmcb.hdr.hwndFrom = hwnd; - nmcb.hdr.idFrom = GetWindowLongPtr(hwnd, GWLP_ID); - nmcb.hdr.code = NM_CLICK; - - nmcb.nBar = nBar; - nmcb.uCmdId = nCmdId; - nmcb.uState = 0; - nmcb.rect = *prect; - nmcb.pt = pt; - - hwnd = GetParent(hwnd); - return SendMessage(hwnd, WM_NOTIFY, nmcb.hdr.idFrom, (LPARAM)&nmcb); -#else - return 0; -#endif -} - -#ifdef NOTIFY_MOUSE -#define PostMouseNotify PostMouseNotify0 -#else -#define PostMouseNotify 1 ? (void)0 : PostMouseNotify0 -#endif - - - -// -// Draw a complete HORIZONTAL scrollbar in the given rectangle -// Don't draw any inserted buttons in this procedure -// -// uDrawFlags - hittest code, to say if to draw the -// specified portion in an active state or not. -// -// -static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *rect, UINT uDrawFlags) -{ - SCROLLINFO *si; - RECT ctrl, thumb; - RECT sbm; - int butwidth = GetScrollMetric(sb, SM_SCROLL_LENGTH); - int scrollwidth = rect->right-rect->left; - int workingwidth = scrollwidth - butwidth*2; - int thumbwidth = 0, thumbpos = 0; - int siMaxMin; - - BOOL fCustomDraw = 0; - - BOOL fMouseDownL = 0, fMouseOverL = 0, fBarHot = 0; - BOOL fMouseDownR = 0, fMouseOverR = 0; - - COLORREF crCheck1 = GetSBForeColor(); - COLORREF crCheck2 = GetSBBackColor(); - COLORREF crInverse1 = InvertCOLORREF(crCheck1); - COLORREF crInverse2 = InvertCOLORREF(crCheck2); - - UINT uDFCFlat = sb->fFlatScrollbar ? DFCS_FLAT : 0; - UINT uDEFlat = sb->fFlatScrollbar ? BF_FLAT : 0; - - //drawing flags to modify the appearance of the scrollbar buttons - UINT uLeftButFlags = DFCS_SCROLLLEFT; - UINT uRightButFlags = DFCS_SCROLLRIGHT; - - if(scrollwidth <= 0) - return 0; - - si = &sb->scrollInfo; - siMaxMin = si->nMax - si->nMin; - - if(hwnd != hwndCurCoolSB) - uDrawFlags = HTSCROLL_NONE; - // - // work out the thumb size and position - // - CalcThumbSize(sb, rect, &thumbwidth, &thumbpos); - - if(sb->fScrollFlags & ESB_DISABLE_LEFT) uLeftButFlags |= DFCS_INACTIVE; - if(sb->fScrollFlags & ESB_DISABLE_RIGHT) uRightButFlags |= DFCS_INACTIVE; - - //if we need to grey the arrows because there is no data to scroll - if (!IsScrollInfoActive(si) && !(sb->fScrollFlags & CSBS_THUMBALWAYS)) - { - uLeftButFlags |= DFCS_INACTIVE; - uRightButFlags |= DFCS_INACTIVE; - } - - if(hwnd == hwndCurCoolSB) - { -#ifdef FLAT_SCROLLBARS - BOOL ldis = !(uLeftButFlags & DFCS_INACTIVE); - BOOL rdis = !(uRightButFlags & DFCS_INACTIVE); - - fBarHot = (sb->nBarType == (int)uMouseOverScrollbar && sb->fFlatScrollbar == CSBS_HOTTRACKED); - - fMouseOverL = uHitTestPortion == HTSCROLL_LEFT && fBarHot && ldis; - fMouseOverR = uHitTestPortion == HTSCROLL_RIGHT && fBarHot && rdis; -#endif - fMouseDownL = (uDrawFlags == HTSCROLL_LEFT); - fMouseDownR = (uDrawFlags == HTSCROLL_RIGHT); - } - - -//#ifdef CUSTOM_DRAW - fCustomDraw = ((PostCustomPrePostPaint(hwnd, hdc, sb, CDDS_PREPAINT)) == CDRF_SKIPDEFAULT); -//#endif - - // - // Draw the scrollbar now - // - if(scrollwidth > butwidth*2) - { - //LEFT ARROW - SetRect(&ctrl, rect->left, rect->top, rect->left + butwidth, rect->bottom); - - RotateRect0(sb, &ctrl); - - if(fCustomDraw) - PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_LINELEFT, fMouseDownL, fMouseOverL, uLeftButFlags & DFCS_INACTIVE); - else - DrawScrollArrow(sb, hdc, &ctrl, uLeftButFlags, fMouseDownL, fMouseOverL); - - RotateRect0(sb, &ctrl); - - //MIDDLE PORTION - //if we can fit the thumbbar in, then draw it - if(thumbwidth > 0 && thumbwidth <= workingwidth - && IsScrollInfoActive(si) && ((sb->fScrollFlags & ESB_DISABLE_BOTH) != ESB_DISABLE_BOTH)) - { - //Draw the scrollbar margin above the thumb - SetRect(&sbm, rect->left + butwidth, rect->top, thumbpos, rect->bottom); - - RotateRect0(sb, &sbm); - - if(fCustomDraw) - { - PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &sbm, SB_PAGELEFT, uDrawFlags == HTSCROLL_PAGELEFT, FALSE, FALSE); - } - else - { - if(uDrawFlags == HTSCROLL_PAGELEFT) - DrawCheckedRect(hdc, &sbm, crInverse1, crInverse2); - else - DrawCheckedRect(hdc, &sbm, crCheck1, crCheck2); - - } - - RotateRect0(sb, &sbm); - - //Draw the margin below the thumb - sbm.left = thumbpos+thumbwidth; - sbm.right = rect->right - butwidth; - - RotateRect0(sb, &sbm); - if(fCustomDraw) - { - PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &sbm, SB_PAGERIGHT, uDrawFlags == HTSCROLL_PAGERIGHT, 0, 0); - } - else - { - if(uDrawFlags == HTSCROLL_PAGERIGHT) - DrawCheckedRect(hdc, &sbm, crInverse1, crInverse2); - else - DrawCheckedRect(hdc, &sbm, crCheck1, crCheck2); - - } - RotateRect0(sb, &sbm); - - //Draw the THUMB finally - SetRect(&thumb, thumbpos, rect->top, thumbpos+thumbwidth, rect->bottom); - - RotateRect0(sb, &thumb); - - if(fCustomDraw) - { - PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &thumb, SB_THUMBTRACK, uDrawFlags==HTSCROLL_THUMB, uHitTestPortion == HTSCROLL_THUMB && fBarHot, FALSE); - } - else - { - -#ifdef FLAT_SCROLLBARS - if(hwnd == hwndCurCoolSB && sb->fFlatScrollbar && (uDrawFlags == HTSCROLL_THUMB || - (uHitTestPortion == HTSCROLL_THUMB && fBarHot))) - { - PaintRect(hdc, &thumb, GetSysColor(COLOR_3DSHADOW)); - } - else -#endif - { - DrawBlankButton(hdc, &thumb, uDEFlat); - } - } - RotateRect0(sb, &thumb); - - } - //otherwise, just leave that whole area blank - else - { - OffsetRect(&ctrl, butwidth, 0); - ctrl.right = rect->right - butwidth; - - //if we always show the thumb covering the whole scrollbar, - //then draw it that way - if (!IsScrollInfoActive(si) && (sb->fScrollFlags & CSBS_THUMBALWAYS) - && ctrl.right - ctrl.left > sb->nMinThumbSize) - { - //leave a 1-pixel gap between the thumb + right button - ctrl.right --; - RotateRect0(sb, &ctrl); - - if(fCustomDraw) - PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_THUMBTRACK, fMouseDownL, FALSE, FALSE); - else - { -#ifdef FLAT_SCROLLBARS - if(sb->fFlatScrollbar == CSBS_HOTTRACKED && uDrawFlags == HTSCROLL_THUMB) - PaintRect(hdc, &ctrl, GetSysColor(COLOR_3DSHADOW)); - else -#endif - DrawBlankButton(hdc, &ctrl, uDEFlat); - - } - RotateRect0(sb, &ctrl); - - //draw the single-line gap - ctrl.left = ctrl.right; - ctrl.right += 1; - - RotateRect0(sb, &ctrl); - - if(fCustomDraw) - PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_PAGERIGHT, 0, 0, 0); - else - PaintRect(hdc, &ctrl, GetSysColor(COLOR_SCROLLBAR)); - - RotateRect0(sb, &ctrl); - } - //otherwise, paint a blank if the thumb doesn't fit in - else - { - RotateRect0(sb, &ctrl); - - if(fCustomDraw) - PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_PAGERIGHT, 0, 0, 0); - else - DrawCheckedRect(hdc, &ctrl, crCheck1, crCheck2); - - RotateRect0(sb, &ctrl); - } - } - - //RIGHT ARROW - SetRect(&ctrl, rect->right - butwidth, rect->top, rect->right, rect->bottom); - - RotateRect0(sb, &ctrl); - - if(fCustomDraw) - PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_LINERIGHT, fMouseDownR, fMouseOverR, uRightButFlags & DFCS_INACTIVE); - else - DrawScrollArrow(sb, hdc, &ctrl, uRightButFlags, fMouseDownR, fMouseOverR); - - RotateRect0(sb, &ctrl); - } - //not enough room for the scrollbar, so just draw the buttons (scaled in size to fit) - else - { - butwidth = scrollwidth / 2; - - //LEFT ARROW - SetRect(&ctrl, rect->left, rect->top, rect->left + butwidth, rect->bottom); - - RotateRect0(sb, &ctrl); - if(fCustomDraw) - PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_LINELEFT, fMouseDownL, fMouseOverL, uLeftButFlags & DFCS_INACTIVE); - else - DrawScrollArrow(sb, hdc, &ctrl, uLeftButFlags, fMouseDownL, fMouseOverL); - RotateRect0(sb, &ctrl); - - //RIGHT ARROW - OffsetRect(&ctrl, scrollwidth - butwidth, 0); - - RotateRect0(sb, &ctrl); - if(fCustomDraw) - PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_LINERIGHT, fMouseDownR, fMouseOverR, uRightButFlags & DFCS_INACTIVE); - else - DrawScrollArrow(sb, hdc, &ctrl, uRightButFlags, fMouseDownR, fMouseOverR); - RotateRect0(sb, &ctrl); - - //if there is a gap between the buttons, fill it with a solid color - //if(butwidth & 0x0001) - if(ctrl.left != rect->left + butwidth) - { - ctrl.left --; - ctrl.right -= butwidth; - RotateRect0(sb, &ctrl); - - if(fCustomDraw) - PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_PAGERIGHT, 0, 0, 0); - else - DrawCheckedRect(hdc, &ctrl, crCheck1, crCheck2); - - RotateRect0(sb, &ctrl); - } - - } - -//#ifdef CUSTOM_DRAW - PostCustomPrePostPaint(hwnd, hdc, sb, CDDS_POSTPAINT); -//#endif - - return fCustomDraw; -} - -// -// Draw a vertical scrollbar using the horizontal draw routine, but -// with the coordinates adjusted accordingly -// -static LRESULT NCDrawVScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *rect, UINT uDrawFlags) -{ - LRESULT ret; - RECT rc; - - rc = *rect; - RotateRect(&rc); - ret = NCDrawHScrollbar(sb, hwnd, hdc, &rc, uDrawFlags); - RotateRect(&rc); - - return ret; -} - -// -// Generic wrapper function for the scrollbar drawing -// -static LRESULT NCDrawScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *rect, UINT uDrawFlags) -{ - if(sb->nBarType == SB_HORZ) - return NCDrawHScrollbar(sb, hwnd, hdc, rect, uDrawFlags); - else - return NCDrawVScrollbar(sb, hwnd, hdc, rect, uDrawFlags); -} - -#ifdef INCLUDE_BUTTONS - -// -// Draw the specified bitmap centered in the rectangle -// -static void DrawImage(HDC hdc, HBITMAP hBitmap, RECT *rc) -{ - BITMAP bm; - int cx; - int cy; - HDC memdc; - HBITMAP hOldBM; - RECT rcDest = *rc; - POINT p; - SIZE delta; - COLORREF colorOld; - - if(hBitmap == NULL) - return; - - // center bitmap in caller's rectangle - GetObject(hBitmap, sizeof bm, &bm); - - cx = bm.bmWidth; - cy = bm.bmHeight; - - delta.cx = (rc->right-rc->left - cx) / 2; - delta.cy = (rc->bottom-rc->top - cy) / 2; - - if(rc->right-rc->left > cx) - { - SetRect(&rcDest, rc->left+delta.cx, rc->top + delta.cy, 0, 0); - rcDest.right = rcDest.left + cx; - rcDest.bottom = rcDest.top + cy; - p.x = 0; - p.y = 0; - } - else - { - p.x = -delta.cx; - p.y = -delta.cy; - } - - // select checkmark into memory DC - memdc = CreateCompatibleDC(hdc); - hOldBM = (HBITMAP)SelectObject(memdc, hBitmap); - - // set BG color based on selected state - colorOld = SetBkColor(hdc, GetSysColor(COLOR_3DFACE)); - - BitBlt(hdc, rcDest.left, rcDest.top, rcDest.right-rcDest.left, rcDest.bottom-rcDest.top, memdc, p.x, p.y, SRCCOPY); - - // restore - SetBkColor(hdc, colorOld); - SelectObject(memdc, hOldBM); - DeleteDC(memdc); -} - -// -// Draw the specified metafile -// -static void DrawMetaFile(HDC hdc, HENHMETAFILE hemf, RECT *rect) -{ - RECT rc; - POINT pt; - - SetRect(&rc, 0, 0, rect->right-rect->left, rect->bottom-rect->top); - SetWindowOrgEx(hdc, -rect->left, -rect->top, &pt); - PlayEnhMetaFile(hdc, hemf, &rc); - SetWindowOrgEx(hdc, pt.x, pt.y, 0); -} - -// -// Draw a single scrollbar inserted button, in whatever style -// it has been defined to use. -// -static UINT DrawScrollButton(SCROLLBUT *sbut, HDC hdc, const RECT *pctrl, UINT flags) -{ - NMCSBCUSTOMDRAW nmcd; - HWND hwnd; - RECT rect = *pctrl; - UINT f; - - switch(sbut->uButType & SBBT_MASK) - { - case SBBT_OWNERDRAW: - - hwnd = WindowFromDC(hdc); - - //fill in the standard header - nmcd.hdr.hwndFrom = hwnd; - nmcd.hdr.idFrom = GetWindowLongPtr(hwnd, GWLP_ID); - nmcd.hdr.code = NM_COOLSB_CUSTOMDRAW; - - nmcd.dwDrawStage = CDDS_ITEMPREPAINT; - nmcd.nBar = SB_INSBUT; - nmcd.rect = *pctrl; - nmcd.uItem = sbut->uCmdId; - nmcd.hdc = hdc; - nmcd.uState = flags; - - IntersectClipRect(hdc, rect.left, rect.top, rect.right, rect.bottom); - SendMessage(GetParent(hwnd), WM_NOTIFY, nmcd.hdr.idFrom, (LPARAM)&nmcd); - SelectClipRgn(hdc, NULL); - - break; - - case SBBT_FIXED: - flags &= ~SBBS_PUSHED; - - case SBBT_TOGGLEBUTTON: - if(sbut->uState != SBBS_NORMAL) - flags |= SBBS_PUSHED; - - //intentionally fall through here... - - case SBBT_PUSHBUTTON: - - f = flags & SBBS_PUSHED ? DFCS_PUSHED | DFCS_FLAT : 0; - if(sbut->uButType & SBBM_LEFTARROW) - { - DrawFrameControl(hdc, &rect, DFC_SCROLL, DFCS_SCROLLLEFT | f); - } - else if(sbut->uButType & SBBM_RIGHTARROW) - { - DrawFrameControl(hdc, &rect, DFC_SCROLL, DFCS_SCROLLRIGHT | f); - } - else if(sbut->uButType & SBBM_UPARROW) - { - DrawFrameControl(hdc, &rect, DFC_SCROLL, DFCS_SCROLLUP | f); - } - else if(sbut->uButType & SBBM_DOWNARROW) - { - DrawFrameControl(hdc, &rect, DFC_SCROLL, DFCS_SCROLLDOWN | f); - } - else - { - // - if(flags & SBBS_PUSHED) - { - if(sbut->uButType & SBBM_RECESSED) - { - InflateRect(&rect, -1, -1); - DrawEdge(hdc, &rect, EDGE_SUNKEN, BF_RECT|BF_FLAT); - InflateRect(&rect, 1, 1); - - FrameRect(hdc, &rect, GetSysColorBrush(COLOR_3DDKSHADOW)); - InflateRect(&rect, -2, -2); - } - else - { - DrawEdge(hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_FLAT | BF_ADJUST); - InflateRect(&rect, 1, 1); - } - } - else - { - // draw the button borders - if(sbut->uButType & SBBM_TYPE2) - { - DrawFrameControl(hdc, &rect, DFC_BUTTON, DFCS_BUTTONPUSH); - InflateRect(&rect, -2, -2); - } - - else if(sbut->uButType & SBBM_TYPE3) - { - DrawFrameControl(hdc, &rect, DFC_BUTTON, DFCS_BUTTONPUSH); - InflateRect(&rect, -1, -1); - } - else - { - DrawEdge(hdc, &rect, EDGE_RAISED, BF_RECT | BF_ADJUST); - rect.bottom++; - rect.right++; - } - - OffsetRect(&rect, -1, -1); - rect.top++; rect.left++; - } - - if(sbut->hBmp) - { - PaintRect(hdc, &rect, GetSysColor(COLOR_3DFACE)); - - if(flags & SBBS_PUSHED) - { - rect.top++; rect.left++; - } - - IntersectClipRect(hdc, rect.left, rect.top, rect.right,rect.bottom); - DrawImage(hdc, sbut->hBmp, &rect); - SelectClipRgn(hdc, 0); - } - else if(sbut->hEmf) - { - PaintRect(hdc, &rect, GetSysColor(COLOR_3DFACE)); - InflateRect(&rect, -1, -1); - - if(flags & SBBS_PUSHED) - { - rect.top++; rect.left++; - } - - IntersectClipRect(hdc, rect.left, rect.top, rect.right,rect.bottom); - DrawMetaFile(hdc, sbut->hEmf, &rect); - SelectClipRgn(hdc, 0); - } - else - { - PaintRect(hdc, &rect, GetSysColor(COLOR_3DFACE)); - } - } - - - break; - - case SBBT_BLANK: - PaintRect(hdc, &rect, GetSysColor(COLOR_3DFACE)); - break; - - case SBBT_FLAT: - DrawBlankButton(hdc, &rect, BF_FLAT); - break; - - case SBBT_DARK: - PaintRect(hdc, &rect, GetSysColor(COLOR_3DDKSHADOW)); - break; - } - - return 0; -} - -// -// Draw any buttons inserted into the horizontal scrollbar -// assume that the button widths have already been calculated -// Note: RECT *rect is the rectangle of the scrollbar -// leftright: 1 = left, 2 = right, 3 = both -// -static LRESULT DrawHorzButtons(SCROLLBAR *sbar, HDC hdc, const RECT *rect, int leftright) -{ - int i; - int xposl, xposr; - RECT ctrl; - SCROLLBUT *sbut = sbar->sbButtons; - - xposl = rect->left - sbar->nButSizeBefore; - xposr = rect->right; - - for (i = 0; i < sbar->nButtons; i++) - { - if ((leftright & SBBP_LEFT) && sbut[i].uPlacement == SBBP_LEFT) - { - int butwidth = GetSingleButSize(sbar, &sbut[i]); - SetRect(&ctrl, xposl, rect->top, xposl + butwidth, rect->bottom); - RotateRect0(sbar, &ctrl); - DrawScrollButton(&sbut[i], hdc, &ctrl, SBBS_NORMAL); - - xposl += butwidth; - } - - if ((leftright & SBBP_RIGHT) && sbut[i].uPlacement == SBBP_RIGHT) - { - int butwidth = GetSingleButSize(sbar, &sbut[i]); - SetRect(&ctrl, xposr, rect->top, xposr + butwidth, rect->bottom); - RotateRect0(sbar, &ctrl); - DrawScrollButton(&sbut[i], hdc, &ctrl, SBBS_NORMAL); - xposr += butwidth; - } - } - return 0; -} - -static LRESULT DrawVertButtons(SCROLLBAR *sbar, HDC hdc, const RECT *rect, int leftright) -{ - RECT rc = *rect; - RotateRect(&rc); - DrawHorzButtons(sbar, hdc, &rc, leftright); - return 0; -} -#endif // INCLUDE_BUTTONS - -// -// Define these two for proper processing of NCPAINT -// NOT needed if we don't bother to mask the scrollbars we draw -// to prevent the old window procedure from accidently drawing over them -// -HDC CoolSB_GetDC(HWND hwnd, WPARAM wParam) -{ - // I just can't figure out GetDCEx, so I'll just use this: - return GetWindowDC(hwnd); - - /* - RECT rc; - DWORD flags = 0x10000; - HRGN hrgn = (HRGN)wParam; - - if(hrgn == (HRGN)1) - { - GetWindowRect(hwnd, &rc); - OffsetRect(&rc, -rc.left, -rc.top); - hrgn = CreateRectRgnIndirect(&rc); - } - - if(GetWindowLongPtr(hwnd, GWL_STYLE) & WS_CLIPCHILDREN) - flags |= DCX_CLIPCHILDREN; - - if(GetWindowLongPtr(hwnd, GWL_STYLE) & WS_CLIPSIBLINGS) - flags |= DCX_CLIPSIBLINGS; - - return GetDCEx(hwnd, hrgn, flags | DCX_CACHE|DCX_NORESETATTRS|DCX_WINDOW | DCX_INTERSECTUPDATE); - */ - //return GetDCEx(hwnd, NULL, flags | DCX_WINDOW| DCX_NORESETATTRS); -} - -static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) -{ - SCROLLBAR *sb; - HDC hdc; - HRGN hrgn; - RECT winrect, rect; - HRGN clip = 0; - BOOL fUpdateAll = ((LONG)wParam == 1); - BOOL fCustomDraw = FALSE; - LRESULT ret; - DWORD dwStyle; - - GetWindowRect(hwnd, &winrect); - - //if entire region needs painting, then make a region to cover the entire window - if(fUpdateAll) - hrgn = (HRGN)wParam; - else - hrgn = (HRGN)wParam; - - //hdc = GetWindowDC(hwnd); - hdc = CoolSB_GetDC(hwnd, wParam); - - // - // Only draw the horizontal scrollbar if the window is tall enough - // - sb = &sw->sbarHorz; - if(sb->fScrollVisible) - { - int hbarwidth = 0, leftright = 0; - - //get the screen coordinates of the whole horizontal scrollbar area - GetHScrollRect(sw, hwnd, &rect); - - //make the coordinates relative to the window for drawing - OffsetRect(&rect, -winrect.left, -winrect.top); - -#ifdef INCLUDE_BUTTONS - - //work out the size of any inserted buttons so we can dra them - sb->nButSizeBefore = GetButtonSize(sb, hwnd, SBBP_LEFT); - sb->nButSizeAfter = GetButtonSize(sb, hwnd, SBBP_RIGHT); - - //make sure there is room for the buttons - hbarwidth = rect.right - rect.left; - - //check that we can fit any left/right buttons in the available space - if(sb->nButSizeAfter < (hbarwidth - MIN_COOLSB_SIZE)) - { - //adjust the scrollbar rectangle to fit the buttons into - sb->fButVisibleAfter = TRUE; - rect.right -= sb->nButSizeAfter; - leftright |= SBBP_RIGHT; - - //check that there is enough space for the right buttons - if(sb->nButSizeBefore + sb->nButSizeAfter < (hbarwidth - MIN_COOLSB_SIZE)) - { - sb->fButVisibleBefore = TRUE; - rect.left += sb->nButSizeBefore; - leftright |= SBBP_LEFT; - } - else - sb->fButVisibleBefore = FALSE; - } - else - sb->fButVisibleAfter = FALSE; - - - DrawHorzButtons(sb, hdc, &rect, leftright); -#endif// INCLUDE_BUTTONS - - if(uCurrentScrollbar == SB_HORZ) - fCustomDraw |= NCDrawHScrollbar(sb, hwnd, hdc, &rect, uScrollTimerPortion); - else - fCustomDraw |= NCDrawHScrollbar(sb, hwnd, hdc, &rect, HTSCROLL_NONE); - } - - // - // Only draw the vertical scrollbar if the window is wide enough to accomodate it - // - sb = &sw->sbarVert; - if(sb->fScrollVisible) - { - int vbarheight = 0, updown = 0; - - //get the screen cooridinates of the whole horizontal scrollbar area - GetVScrollRect(sw, hwnd, &rect); - - //make the coordinates relative to the window for drawing - OffsetRect(&rect, -winrect.left, -winrect.top); - -#ifdef INCLUDE_BUTTONS - - //work out the size of any inserted buttons so we can dra them - sb->nButSizeBefore = GetButtonSize(sb, hwnd, SBBP_LEFT); - sb->nButSizeAfter = GetButtonSize(sb, hwnd, SBBP_RIGHT); - - //make sure there is room for the buttons - vbarheight = rect.bottom - rect.top; - - //check that we can fit any left/right buttons in the available space - if(sb->nButSizeAfter < (vbarheight - MIN_COOLSB_SIZE)) - { - //adjust the scrollbar rectangle to fit the buttons into - sb->fButVisibleAfter = TRUE; - rect.bottom -= sb->nButSizeAfter; - updown |= SBBP_BOTTOM; - - //check that there is enough space for the right buttons - if(sb->nButSizeBefore + sb->nButSizeAfter < (vbarheight - MIN_COOLSB_SIZE)) - { - sb->fButVisibleBefore = TRUE; - rect.top += sb->nButSizeBefore; - updown |= SBBP_TOP; - } - else - sb->fButVisibleBefore = FALSE; - } - else - sb->fButVisibleAfter = FALSE; - - - DrawVertButtons(sb, hdc, &rect, updown); -#endif // INCLUDE_BUTTONS - - if(uCurrentScrollbar == SB_VERT) - fCustomDraw |= NCDrawVScrollbar(sb, hwnd, hdc, &rect, uScrollTimerPortion); - else - fCustomDraw |= NCDrawVScrollbar(sb, hwnd, hdc, &rect, HTSCROLL_NONE); - } - - //Call the default window procedure for WM_NCPAINT, with the - //new window region. ** region must be in SCREEN coordinates ** - dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); - - // If the window has WS_(H-V)SCROLL bits set, we should reset them - // to avoid windows taking the scrollbars into account. - // We temporarily set a flag preventing the subsecuent - // WM_STYLECHANGING/WM_STYLECHANGED to be forwarded to - // the original window procedure - if ( dwStyle & (WS_VSCROLL|WS_HSCROLL)) - { - sw->bPreventStyleChange = TRUE; - SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle & ~(WS_VSCROLL|WS_HSCROLL)); - } - - ret = CallWindowProc(sw->oldproc, hwnd, WM_NCPAINT, (WPARAM)hrgn, lParam); - - if ( dwStyle & (WS_VSCROLL|WS_HSCROLL)) - { - SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle); - sw->bPreventStyleChange = FALSE; - } - - - // DRAW THE DEAD AREA - // only do this if the horizontal and vertical bars are visible - if(sw->sbarHorz.fScrollVisible && sw->sbarVert.fScrollVisible) - { - GetWindowRect(hwnd, &rect); - OffsetRect(&rect, -winrect.left, -winrect.top); - - rect.bottom -= sw->cyBottomEdge; - rect.top = rect.bottom - GetScrollMetric(&sw->sbarHorz, SM_CYHORZSB); - - if(sw->fLeftScrollbar) - { - rect.left += sw->cxLeftEdge; - rect.right = rect.left + GetScrollMetric(&sw->sbarVert, SM_CXVERTSB); - } - else - { - rect.right -= sw->cxRightEdge; - rect.left = rect.right - GetScrollMetric(&sw->sbarVert, SM_CXVERTSB); - } - - if(fCustomDraw) - PostCustomDrawNotify(hwnd, hdc, SB_BOTH, &rect, 32, 0, 0, 0); - else - { - //calculate the position of THIS window's dead area - //with the position of the PARENT window's client rectangle. - //if THIS window has been positioned such that its bottom-right - //corner sits in the parent's bottom-right corner, then we should - //show the sizing-grip. - //Otherwise, assume this window is not in the right place, and - //just draw a blank rectangle - RECT parent; - RECT rect2; - HWND hwndParent = GetParent(hwnd); - - GetClientRect(hwndParent, &parent); - MapWindowPoints(hwndParent, 0, (POINT *)&parent, 2); - - CopyRect(&rect2, &rect); - OffsetRect(&rect2, winrect.left, winrect.top); - - if (!sw->fLeftScrollbar && parent.right == rect2.right+sw->cxRightEdge && parent.bottom == rect2.bottom+sw->cyBottomEdge - || sw->fLeftScrollbar && parent.left == rect2.left -sw->cxLeftEdge && parent.bottom == rect2.bottom+sw->cyBottomEdge) - DrawFrameControl(hdc, &rect, DFC_SCROLL, sw->fLeftScrollbar ? DFCS_SCROLLSIZEGRIPRIGHT : DFCS_SCROLLSIZEGRIP ); - else - PaintRect(hdc, &rect, GetSysColor(COLOR_3DFACE)); - } - } - - UNREFERENCED_PARAMETER(clip); - ReleaseDC(hwnd, hdc); - return ret; -} - -// -// Need to detect if we have clicked in the scrollbar region or not -// -static LRESULT NCHitTest(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) -{ - RECT hrect; - RECT vrect; - POINT pt; - - pt.x = LOWORD(lParam); - pt.y = HIWORD(lParam); - - //work out exactly where the Horizontal and Vertical scrollbars are - GetHScrollRect(sw, hwnd, &hrect); - GetVScrollRect(sw, hwnd, &vrect); - - //Clicked in the horizontal scrollbar area - if(sw->sbarHorz.fScrollVisible && PtInRect(&hrect, pt)) - { - return HTHSCROLL; - } - //Clicked in the vertical scrollbar area - else if(sw->sbarVert.fScrollVisible && PtInRect(&vrect, pt)) - { - return HTVSCROLL; - } - //clicked somewhere else - else - { - return CallWindowProc(sw->oldproc, hwnd, WM_NCHITTEST, wParam, lParam); - } -} - -// -// Return a HT* value indicating what part of the scrollbar was clicked -// Rectangle is not adjusted -// -static UINT GetHorzPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) -{ - RECT rc = *rect; - - if(y < rc.top || y >= rc.bottom) return HTSCROLL_NONE; - -#ifdef INCLUDE_BUTTONS - - if(sb->fButVisibleBefore) - { - //clicked on the buttons to the left of the scrollbar - if(x >= rc.left && x < rc.left + sb->nButSizeBefore) - return HTSCROLL_INSERTED; - - //adjust the rectangle to exclude the left-side buttons, now that we - //know we havn't clicked on them - rc.left += sb->nButSizeBefore; - } - - if(sb->fButVisibleAfter) - { - //clicked on the buttons to the right of the scrollbar - if(x >= rc.right - sb->nButSizeAfter && x < rc.right) - return HTSCROLL_INSERTED; - - //adjust the rectangle to exclude the right-side buttons, now that we - //know we havn't clicked on them - rc.right -= sb->nButSizeAfter; - } - -#endif INCLUDE_BUTTONS - - //Now we have the rectangle for the scrollbar itself, so work out - //what part we clicked on. - return GetHorzScrollPortion(sb, hwnd, &rc, x, y); -} - -// -// Just call the horizontal version, with adjusted coordinates -// -static UINT GetVertPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) -{ - UINT ret; - RotateRect(rect); - ret = GetHorzPortion(sb, hwnd, rect, y, x); - RotateRect(rect); - return ret; -} - -// -// Wrapper function for GetHorzPortion and GetVertPortion -// -static UINT GetPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) -{ - if(sb->nBarType == SB_HORZ) - return GetHorzPortion(sb, hwnd, rect, x, y); - else if(sb->nBarType == SB_VERT) - return GetVertPortion(sb, hwnd, rect, x, y); - else - return HTSCROLL_NONE; -} - -// -// Input: rectangle of the total scrollbar area -// Output: adjusted to take the inserted buttons into account -// -static void GetRealHorzScrollRect(SCROLLBAR *sb, RECT *rect) -{ - if(sb->fButVisibleBefore) rect->left += sb->nButSizeBefore; - if(sb->fButVisibleAfter) rect->right -= sb->nButSizeAfter; -} - -// -// Input: rectangle of the total scrollbar area -// Output: adjusted to take the inserted buttons into account -// -static void GetRealVertScrollRect(SCROLLBAR *sb, RECT *rect) -{ - if(sb->fButVisibleBefore) rect->top += sb->nButSizeBefore; - if(sb->fButVisibleAfter) rect->bottom -= sb->nButSizeAfter; -} - -// -// Decide which type of scrollbar we have before calling -// the real function to do the job -// -static void GetRealScrollRect(SCROLLBAR *sb, RECT *rect) -{ - if(sb->nBarType == SB_HORZ) - { - GetRealHorzScrollRect(sb, rect); - } - else if(sb->nBarType == SB_VERT) - { - GetRealVertScrollRect(sb, rect); - } -} - -// -// All button code shoule be collected together -// -// -#ifdef INCLUDE_BUTTONS - -// -// Return the index of the button covering the specified point -// rect - rectangle of the whole scrollbar area -// pt - screen coords of the mouse -// fReturnRect - do/don't modify the rect to return the button's area -// -static UINT GetHorzButtonFromPt(SCROLLBAR *sb, RECT *rect, POINT pt, BOOL fReturnRect) -{ - int leftpos = rect->left, rightpos = rect->right; - int i; - int butwidth; - SCROLLBUT *sbut = sb->sbButtons; - - if (!PtInRect(rect, pt)) - return -1; - - if(sb->fButVisibleAfter) - rightpos -= sb->nButSizeAfter; - - for (i = 0; i < sb->nButtons; i++) - { - if(sb->fButVisibleBefore && sbut[i].uPlacement == SBBP_LEFT) - { - butwidth = GetSingleButSize(sb, &sbut[i]); - - //if the current button is under the specified point - if(pt.x >= leftpos && pt.x < leftpos + butwidth) - { - //if the caller wants us to return the rectangle of the button - if(fReturnRect) - { - rect->left = leftpos; - rect->right = leftpos + butwidth; - } - - return i; - } - - leftpos += butwidth; - } - else if(sb->fButVisibleAfter && sbut[i].uPlacement == SBBP_RIGHT) - { - butwidth = GetSingleButSize(sb, &sbut[i]); - - //if the current button is under the specified point - if(pt.x >= rightpos && pt.x < rightpos + butwidth) - { - //if the caller wants us to return the rectangle of the button - if(fReturnRect) - { - rect->left = rightpos; - rect->right = rightpos + butwidth; - } - return i; - } - - rightpos += butwidth; - } - } - - return -1; -} - - -static UINT GetVertButtonFromPt(SCROLLBAR *sb, RECT *rect, POINT pt, BOOL fReturnRect) -{ - UINT ret; - int temp; - - //swap the X/Y coords - temp = pt.x; - pt.x = pt.y; - pt.y = temp; - - //swap the rectangle - RotateRect(rect); - - ret = GetHorzButtonFromPt(sb, rect, pt, fReturnRect); - - RotateRect(rect); - return ret; -} - -// -// -// -static UINT GetButtonFromPt(SCROLLBAR *sb, RECT *rect, POINT pt, BOOL fReturnRect) -{ - if(sb->nBarType == SB_HORZ) - { - return GetHorzButtonFromPt(sb, rect, pt, fReturnRect); - } - else - { - return GetVertButtonFromPt(sb, rect, pt, fReturnRect); - } -} - -// -// Find the coordinates (in RECT format) of the specified button index -// -static UINT GetHorzButtonRectFromId(SCROLLBAR *sb, RECT *rect, UINT index) -{ - UINT i; - SCROLLBUT *sbut = sb->sbButtons; - int leftpos = rect->left, rightpos = rect->right; - - if(sb->fButVisibleAfter) - rightpos -= sb->nButSizeAfter; - - //find the particular button in question - for (i = 0; i < index; i++) - { - if(sb->fButVisibleBefore && sbut[i].uPlacement == SBBP_LEFT) - { - leftpos += GetSingleButSize(sb, &sbut[i]); - } - else if(sb->fButVisibleAfter && sbut[i].uPlacement == SBBP_RIGHT) - { - rightpos += GetSingleButSize(sb, &sbut[i]); - } - } - - //now return the rectangle - if(sbut[i].uPlacement == SBBP_LEFT) - { - rect->left = leftpos; - rect->right = leftpos + GetSingleButSize(sb, &sbut[i]); - } - else - { - rect->left = rightpos; - rect->right = rightpos + GetSingleButSize(sb, &sbut[i]); - } - - return 0; -} - -static UINT GetVertButtonRectFromId(SCROLLBAR *sb, RECT *rect, UINT index) -{ - UINT ret; - RotateRect(rect); - ret = GetHorzButtonRectFromId(sb, rect, index); - RotateRect(rect); - return ret; -} - -static UINT GetButtonRectFromId(SCROLLBAR *sb, RECT *rect, UINT index) -{ - if(sb->nBarType == SB_HORZ) - { - return GetHorzButtonRectFromId(sb, rect, index); - } - else - { - return GetVertButtonRectFromId(sb, rect, index); - } -} -#endif //INCLUDE_BUTTONS - -// -// Left button click in the non-client area -// -static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) -{ - RECT rect, winrect; - HDC hdc; - SCROLLBAR *sb; - SCROLLBUT *sbut = 0; - POINT pt; - - pt.x = LOWORD(lParam); - pt.y = HIWORD(lParam); - - hwndCurCoolSB = hwnd; - - // - // HORIZONTAL SCROLLBAR PROCESSING - // - if(wParam == HTHSCROLL) - { - uScrollTimerMsg = WM_HSCROLL; - uCurrentScrollbar = SB_HORZ; - sb = &sw->sbarHorz; - - //get the total area of the normal Horz scrollbar area - GetHScrollRect(sw, hwnd, &rect); - uCurrentScrollPortion = GetHorzPortion(sb, hwnd, &rect, LOWORD(lParam), HIWORD(lParam)); - } - // - // VERTICAL SCROLLBAR PROCESSING - // - else if(wParam == HTVSCROLL) - { - uScrollTimerMsg = WM_VSCROLL; - uCurrentScrollbar = SB_VERT; - sb = &sw->sbarVert; - - //get the total area of the normal Horz scrollbar area - GetVScrollRect(sw, hwnd, &rect); - uCurrentScrollPortion = GetVertPortion(sb, hwnd, &rect, LOWORD(lParam), HIWORD(lParam)); - } - // - // NORMAL PROCESSING - // - else - { - uCurrentScrollPortion = HTSCROLL_NONE; - return CallWindowProc(sw->oldproc, hwnd, WM_NCLBUTTONDOWN, wParam, lParam); - } - - // - // we can now share the same code for vertical - // and horizontal scrollbars - // - switch(uCurrentScrollPortion) - { - //inserted buttons to the left/right -#ifdef INCLUDE_BUTTONS - case HTSCROLL_INSERTED: - -#ifdef HOT_TRACKING - KillTimer(hwnd, uMouseOverId); - uMouseOverId = 0; - uMouseOverScrollbar = COOLSB_NONE; -#endif - - //find the index of the button that has been clicked - //adjust the rectangle to give the button's rectangle - uCurrentButton = GetButtonFromPt(sb, &rect, pt, TRUE); - - sbut = &sb->sbButtons[uCurrentButton]; - - //post a notification message - PostMouseNotify(hwnd, NM_CLICK, sb->nBarType, &rect, sbut->uCmdId, pt); - - GetWindowRect(hwnd, &winrect); - OffsetRect(&rect, -winrect.left, -winrect.top); - hdc = GetWindowDC(hwnd); - - DrawScrollButton(sbut, hdc, &rect, SBBS_PUSHED); - - ReleaseDC(hwnd, hdc); - - break; -#endif //INCLUDE_BUTTONS - - case HTSCROLL_THUMB: - - //if the scrollbar is disabled, then do no further processing - if (!IsScrollbarActive(sb)) - return 0; - - GetRealScrollRect(sb, &rect); - RotateRect0(sb, &rect); - CalcThumbSize(sb, &rect, &nThumbSize, &nThumbPos); - RotateRect0(sb, &rect); - - //remember the bounding rectangle of the scrollbar work area - rcThumbBounds = rect; - - sw->fThumbTracking = TRUE; - sb->scrollInfo.nTrackPos = sb->scrollInfo.nPos; - - if(wParam == HTVSCROLL) - nThumbMouseOffset = pt.y - nThumbPos; - else - nThumbMouseOffset = pt.x - nThumbPos; - - nLastPos = -sb->scrollInfo.nPos; - nThumbPos0 = nThumbPos; - - //if(sb->fFlatScrollbar) - //{ - GetWindowRect(hwnd, &winrect); - OffsetRect(&rect, -winrect.left, -winrect.top); - hdc = GetWindowDC(hwnd); - NCDrawScrollbar(sb, hwnd, hdc, &rect, HTSCROLL_THUMB); - ReleaseDC(hwnd, hdc); - //} - - break; - - //Any part of the scrollbar - case HTSCROLL_LEFT: - if(sb->fScrollFlags & ESB_DISABLE_LEFT) return 0; - else goto target1; - - case HTSCROLL_RIGHT: - if(sb->fScrollFlags & ESB_DISABLE_RIGHT) return 0; - else goto target1; - - goto target1; - - case HTSCROLL_PAGELEFT: case HTSCROLL_PAGERIGHT: - - target1: - - //if the scrollbar is disabled, then do no further processing - if (!IsScrollbarActive(sb)) - break; - - //ajust the horizontal rectangle to NOT include - //any inserted buttons - GetRealScrollRect(sb, &rect); - - SendScrollMessage(hwnd, uScrollTimerMsg, uCurrentScrollPortion, 0); - - // Check what area the mouse is now over : - // If the scroll thumb has moved under the mouse in response to - // a call to SetScrollPos etc, then we don't hilight the scrollbar margin - if(uCurrentScrollbar == SB_HORZ) - uScrollTimerPortion = GetHorzScrollPortion(sb, hwnd, &rect, pt.x, pt.y); - else - uScrollTimerPortion = GetVertScrollPortion(sb, hwnd, &rect, pt.x, pt.y); - - GetWindowRect(hwnd, &winrect); - OffsetRect(&rect, -winrect.left, -winrect.top); - hdc = GetWindowDC(hwnd); - -#ifndef HOT_TRACKING - //if we aren't hot-tracking, then don't highlight - //the scrollbar thumb unless we click on it - if(uScrollTimerPortion == HTSCROLL_THUMB) - uScrollTimerPortion = HTSCROLL_NONE; -#endif - NCDrawScrollbar(sb, hwnd, hdc, &rect, uScrollTimerPortion); - ReleaseDC(hwnd, hdc); - - //Post the scroll message!!!! - uScrollTimerPortion = uCurrentScrollPortion; - - //set a timer going on the first click. - //if this one expires, then we can start off a more regular timer - //to generate the auto-scroll behaviour - uScrollTimerId = SetTimer(hwnd, COOLSB_TIMERID1, COOLSB_TIMERINTERVAL1, 0); - break; - default: - return CallWindowProc(sw->oldproc, hwnd, WM_NCLBUTTONDOWN, wParam, lParam); - //return 0; - } - - SetCapture(hwnd); - return 0; -} - -// -// Left button released -// -static LRESULT LButtonUp(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) -{ - RECT rect; - //UINT thisportion; - HDC hdc; - POINT pt; - RECT winrect; - UINT buttonIdx = 0; - - //current scrollportion is the button that we clicked down on - if(uCurrentScrollPortion != HTSCROLL_NONE) - { - SCROLLBAR *sb = &sw->sbarHorz; - lParam = GetMessagePos(); - ReleaseCapture(); - - GetWindowRect(hwnd, &winrect); - pt.x = LOWORD(lParam); - pt.y = HIWORD(lParam); - - //emulate the mouse input on a scrollbar here... - if(uCurrentScrollbar == SB_HORZ) - { - //get the total area of the normal Horz scrollbar area - sb = &sw->sbarHorz; - GetHScrollRect(sw, hwnd, &rect); - } - else if(uCurrentScrollbar == SB_VERT) - { - //get the total area of the normal Horz scrollbar area - sb = &sw->sbarVert; - GetVScrollRect(sw, hwnd, &rect); - } - - //we need to do different things depending on if the - //user is activating the scrollbar itself, or one of - //the inserted buttons - switch(uCurrentScrollPortion) - { -#ifdef INCLUDE_BUTTONS - //inserted buttons are being clicked - case HTSCROLL_INSERTED: - - //get the rectangle of the ACTIVE button - buttonIdx = GetButtonFromPt(sb, &rect, pt, FALSE); - GetButtonRectFromId(sb, &rect, uCurrentButton); - - OffsetRect(&rect, -winrect.left, -winrect.top); - - //Send the notification BEFORE we redraw, so the - //bitmap can be changed smoothly by the user if they require - if(uCurrentButton == buttonIdx) - { - SCROLLBUT *sbut = &sb->sbButtons[buttonIdx]; - UINT cmdid = sbut->uCmdId; - - if ((sbut->uButType & SBBT_MASK) == SBBT_TOGGLEBUTTON) - sbut->uState ^= 1; - - //send a notify?? - //only post a message if the command id is valid - if(cmdid != -1 && cmdid > 0) - SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(cmdid, CSBN_CLICKED), 0); - - //user might have deleted this button, so redraw whole area - NCPaint(sw, hwnd, 1, 0); - } - else - { - //otherwise, just redraw the button in its new state - hdc = GetWindowDC(hwnd); - DrawScrollButton(&sb->sbButtons[uCurrentButton], hdc, &rect, SBBS_NORMAL); - ReleaseDC(hwnd, hdc); - } - - break; -#endif // INCLUDE_BUTTONS - - //The scrollbar is active - case HTSCROLL_LEFT: case HTSCROLL_RIGHT: - case HTSCROLL_PAGELEFT: case HTSCROLL_PAGERIGHT: - case HTSCROLL_NONE: - - KillTimer(hwnd, uScrollTimerId); - - case HTSCROLL_THUMB: - - //In case we were thumb tracking, make sure we stop NOW - if(sw->fThumbTracking == TRUE) - { - SendScrollMessage(hwnd, uScrollTimerMsg, SB_THUMBPOSITION, nLastPos); - sw->fThumbTracking = FALSE; - } - - //send the SB_ENDSCROLL message now that scrolling has finished - SendScrollMessage(hwnd, uScrollTimerMsg, SB_ENDSCROLL, 0); - - //adjust the total scroll area to become where the scrollbar - //really is (take into account the inserted buttons) - GetRealScrollRect(sb, &rect); - OffsetRect(&rect, -winrect.left, -winrect.top); - hdc = GetWindowDC(hwnd); - - //draw whichever scrollbar sb is - NCDrawScrollbar(sb, hwnd, hdc, &rect, HTSCROLL_NORMAL); - - ReleaseDC(hwnd, hdc); - break; - } - - //reset our state to default - uCurrentScrollPortion = HTSCROLL_NONE; - uScrollTimerPortion = HTSCROLL_NONE; - uScrollTimerId = 0; - - uScrollTimerMsg = 0; - uCurrentScrollbar = COOLSB_NONE; - - return 0; - } - else - { - /* - // Can't remember why I did this! - if(GetCapture() == hwnd) - { - ReleaseCapture(); - }*/ - } - - return CallWindowProc(sw->oldproc, hwnd, WM_LBUTTONUP, wParam, lParam); -} - -// -// This function is called whenever the mouse is moved and -// we are dragging the scrollbar thumb about. -// -static LRESULT ThumbTrackHorz(SCROLLBAR *sbar, HWND hwnd, int x, int y) -{ - POINT pt; - RECT rc, winrect, rc2; - COLORREF crCheck1 = GetSBForeColor(); - COLORREF crCheck2 = GetSBBackColor(); - HDC hdc; - int thumbpos = nThumbPos; - int pos; - int siMaxMin = 0; - UINT flatflag = sbar->fFlatScrollbar ? BF_FLAT : 0; - BOOL fCustomDraw = FALSE; - - SCROLLINFO *si; - si = &sbar->scrollInfo; - - pt.x = x; - pt.y = y; - - //draw the thumb at whatever position - rc = rcThumbBounds; - - SetRect(&rc2, rc.left - THUMBTRACK_SNAPDIST*2, rc.top - THUMBTRACK_SNAPDIST, - rc.right + THUMBTRACK_SNAPDIST*2, rc.bottom + THUMBTRACK_SNAPDIST); - - rc.left += GetScrollMetric(sbar, SM_CXHORZSB); - rc.right -= GetScrollMetric(sbar, SM_CXHORZSB); - - //if the mouse is not in a suitable distance of the scrollbar, - //then "snap" the thumb back to its initial position -#ifdef SNAP_THUMB_BACK - if (!PtInRect(&rc2, pt)) - { - thumbpos = nThumbPos0; - } - //otherwise, move the thumb to where the mouse is - else -#endif //SNAP_THUMB_BACK - { - //keep the thumb within the scrollbar limits - thumbpos = pt.x - nThumbMouseOffset; - if(thumbpos < rc.left) thumbpos = rc.left; - if(thumbpos > rc.right - nThumbSize) thumbpos = rc.right - nThumbSize; - } - - GetWindowRect(hwnd, &winrect); - - if(sbar->nBarType == SB_VERT) - RotateRect(&winrect); - - hdc = GetWindowDC(hwnd); - -//#ifdef CUSTOM_DRAW - fCustomDraw = PostCustomPrePostPaint(hwnd, hdc, sbar, CDDS_PREPAINT) == CDRF_SKIPDEFAULT; -//#endif - - OffsetRect(&rc, -winrect.left, -winrect.top); - thumbpos -= winrect.left; - - //draw the margin before the thumb - SetRect(&rc2, rc.left, rc.top, thumbpos, rc.bottom); - RotateRect0(sbar, &rc2); - - if(fCustomDraw) - PostCustomDrawNotify(hwnd, hdc, sbar->nBarType, &rc2, SB_PAGELEFT, 0, 0, 0); - else - DrawCheckedRect(hdc, &rc2, crCheck1, crCheck2); - - RotateRect0(sbar, &rc2); - - //draw the margin after the thumb - SetRect(&rc2, thumbpos+nThumbSize, rc.top, rc.right, rc.bottom); - - RotateRect0(sbar, &rc2); - - if(fCustomDraw) - PostCustomDrawNotify(hwnd, hdc, sbar->nBarType, &rc2, SB_PAGERIGHT, 0, 0, 0); - else - DrawCheckedRect(hdc, &rc2, crCheck1, crCheck2); - - RotateRect0(sbar, &rc2); - - //finally draw the thumb itelf. This is how it looks on win2000, anyway - SetRect(&rc2, thumbpos, rc.top, thumbpos+nThumbSize, rc.bottom); - - RotateRect0(sbar, &rc2); - - if(fCustomDraw) - PostCustomDrawNotify(hwnd, hdc, sbar->nBarType, &rc2, SB_THUMBTRACK, TRUE, TRUE, FALSE); - else - { - -#ifdef FLAT_SCROLLBARS - if(sbar->fFlatScrollbar) - PaintRect(hdc, &rc2, GetSysColor(COLOR_3DSHADOW)); - else -#endif - { - DrawBlankButton(hdc, &rc2, flatflag); - } - } - - RotateRect0(sbar, &rc2); - ReleaseDC(hwnd, hdc); - - //post a SB_TRACKPOS message!!! - siMaxMin = si->nMax - si->nMin; - - if(siMaxMin > 0) - pos = MulDiv(thumbpos-rc.left, siMaxMin-si->nPage + 1, rc.right-rc.left-nThumbSize); - else - pos = thumbpos - rc.left; - - if(pos != nLastPos) - { - si->nTrackPos = pos; - SendScrollMessage(hwnd, uScrollTimerMsg, SB_THUMBTRACK, pos); - } - - nLastPos = pos; - -//#ifdef CUSTOM_DRAW - PostCustomPrePostPaint(hwnd, hdc, sbar, CDDS_POSTPAINT); -//#endif - - return 0; -} - -// -// remember to rotate the thumb bounds rectangle!! -// -static LRESULT ThumbTrackVert(SCROLLBAR *sb, HWND hwnd, int x, int y) -{ - //sw->swapcoords = TRUE; - RotateRect(&rcThumbBounds); - ThumbTrackHorz(sb, hwnd, y, x); - RotateRect(&rcThumbBounds); - //sw->swapcoords = FALSE; - - return 0; -} - -// -// Called when we have set the capture from the NCLButtonDown(...) -// -static LRESULT MouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) -{ - RECT rect; - UINT thisportion; - HDC hdc; - static UINT lastportion = 0; - static UINT lastbutton = 0; - POINT pt; - RECT winrect; - UINT buttonIdx = 0; - - if(sw->fThumbTracking == TRUE) - { - int x, y; - lParam = GetMessagePos(); - x = LOWORD(lParam); - y = HIWORD(lParam); - - if(uCurrentScrollbar == SB_HORZ) - return ThumbTrackHorz(&sw->sbarHorz, hwnd, x,y); - - - else if(uCurrentScrollbar == SB_VERT) - return ThumbTrackVert(&sw->sbarVert, hwnd, x,y); - } - - if(uCurrentScrollPortion == HTSCROLL_NONE) - { - return CallWindowProc(sw->oldproc, hwnd, WM_MOUSEMOVE, wParam, lParam); - } - else - { - LPARAM nlParam; - SCROLLBAR *sb = &sw->sbarHorz; - SCROLLBUT *sbut = 0; - - nlParam = GetMessagePos(); - - GetWindowRect(hwnd, &winrect); - - pt.x = LOWORD(nlParam); - pt.y = HIWORD(nlParam); - - //emulate the mouse input on a scrollbar here... - if(uCurrentScrollbar == SB_HORZ) - { - sb = &sw->sbarHorz; - } - else if(uCurrentScrollbar == SB_VERT) - { - sb = &sw->sbarVert; - } - - //get the total area of the normal scrollbar area - GetScrollRect(sw, sb->nBarType, hwnd, &rect); - - //see if we clicked in the inserted buttons / normal scrollbar - //thisportion = GetPortion(sb, hwnd, &rect, LOWORD(lParam), HIWORD(lParam)); - thisportion = GetPortion(sb, hwnd, &rect, pt.x, pt.y); - - //we need to do different things depending on if the - //user is activating the scrollbar itself, or one of - //the inserted buttons - switch(uCurrentScrollPortion) - { -#ifdef INCLUDE_BUTTONS - //inserted buttons are being clicked - case HTSCROLL_INSERTED: - - //find the index of the button that has been clicked - //Don't adjust the rectangle though - buttonIdx = GetButtonFromPt(sb, &rect, pt, FALSE); - - //Get the rectangle of the active button - GetButtonRectFromId(sb, &rect, uCurrentButton); - - //if the button to the LEFT of the current - //button is resizable, then resize it -#ifdef RESIZABLE_BUTTONS - if(uCurrentButton > 0) - { - sbut = &sb->sbButtons[uCurrentButton - 1]; - - //only resize if BOTH buttons are on same side of scrollbar - if(sbut->uPlacement == (sbut+1)->uPlacement && (sbut->uButType & SBBM_RESIZABLE)) - { - int oldsize = sbut->nSize; - int butsize1, butsize2; - RECT rect2; - int scrollsize; - - if(uCurrentScrollbar == SB_HORZ) - { - rect.left -= GetSingleButSize(sb, sbut); - sbut->nSize = pt.x - rect.left; - } - else - { - rect.top -= GetSingleButSize(sb, sbut); - sbut->nSize = pt.y - rect.top; - } - - //if(sbut->nSize < 0) sbut->nSize = 0; - if(sbut->nSize < (int)sbut->nMinSize) - sbut->nSize = sbut->nMinSize; - - if ((UINT)sbut->nSize > (UINT)sbut->nMaxSize) - sbut->nSize = sbut->nMaxSize; - - GetScrollRect(sw, uCurrentScrollbar, hwnd, &rect2); - - if(uCurrentScrollbar == SB_HORZ) - scrollsize = rect2.right-rect2.left; - else - scrollsize = rect2.bottom-rect2.top; - - butsize1 = GetButtonSize(sb, hwnd, SBBP_LEFT); - butsize2 = GetButtonSize(sb, hwnd, SBBP_RIGHT); - - //adjust the button size if it gets too big - if(butsize1 + butsize2 > scrollsize - MINSCROLLSIZE) - { - sbut->nSize -= (butsize1+butsize2) - (scrollsize - MINSCROLLSIZE); - } - - //remember what size the USER set the button to - sbut->nSizeReserved = sbut->nSize; - NCPaint(sw, hwnd, (WPARAM)1, (LPARAM)0); - return 0; - } - } -#endif //RESIZABLE_BUTTONS - - OffsetRect(&rect, -winrect.left, -winrect.top); - - hdc = GetWindowDC(hwnd); - - //if the button under the mouse is not the active button, - //then display the active button in its normal state - if(buttonIdx != uCurrentButton - //include this if toggle buttons always stay depressed - //if they are being activated - && (sb->sbButtons[uCurrentButton].uButType & SBBT_MASK) != SBBT_TOGGLEBUTTON) - { - if(lastbutton != buttonIdx) - DrawScrollButton(&sb->sbButtons[uCurrentButton], hdc, &rect, SBBS_NORMAL); - } - //otherwise, depress the active button if the mouse is over - //it (just like a normal scroll button works) - else - { - if(lastbutton != buttonIdx) - DrawScrollButton(&sb->sbButtons[uCurrentButton], hdc, &rect, SBBS_PUSHED); - } - - ReleaseDC(hwnd, hdc); - return CallWindowProc(sw->oldproc, hwnd, WM_MOUSEMOVE, wParam, lParam); - //break; - -#endif //INCLUDE_BUTTONS - - //The scrollbar is active - case HTSCROLL_LEFT: case HTSCROLL_RIGHT:case HTSCROLL_THUMB: - case HTSCROLL_PAGELEFT: case HTSCROLL_PAGERIGHT: - case HTSCROLL_NONE: - - //adjust the total scroll area to become where the scrollbar - //really is (take into account the inserted buttons) - GetRealScrollRect(sb, &rect); - - OffsetRect(&rect, -winrect.left, -winrect.top); - hdc = GetWindowDC(hwnd); - - if(thisportion != uCurrentScrollPortion) - { - uScrollTimerPortion = HTSCROLL_NONE; - - if(lastportion != thisportion) - NCDrawScrollbar(sb, hwnd, hdc, &rect, HTSCROLL_NORMAL); - } - //otherwise, draw the button in its depressed / clicked state - else - { - uScrollTimerPortion = uCurrentScrollPortion; - - if(lastportion != thisportion) - NCDrawScrollbar(sb, hwnd, hdc, &rect, thisportion); - } - - ReleaseDC(hwnd, hdc); - - break; - } - - - lastportion = thisportion; - lastbutton = buttonIdx; - - //must return zero here, because we might get cursor anomilies - //CallWindowProc(sw->oldproc, hwnd, WM_MOUSEMOVE, wParam, lParam); - return 0; - - } -} - -#ifdef INCLUDE_BUTTONS -#ifdef RESIZABLE_BUTTONS -// -// Any resizable buttons must be shrunk to fit if the window is made too small -// -static void ResizeButtonsToFit(SCROLLWND *sw, SCROLLBAR *sbar, HWND hwnd) -{ - int butsize1, butsize2; - RECT rc; - int scrollsize; - int i; - SCROLLBUT *sbut; - - //make sure that the scrollbar can fit into space, by - //shrinking any resizable buttons - GetScrollRect(sw, sbar->nBarType, hwnd, &rc); - - if(sbar->nBarType == SB_HORZ) - scrollsize = rc.right-rc.left; - else - scrollsize = rc.bottom-rc.top; - - //restore any resizable buttons to their user-defined sizes, - //before shrinking them to fit. This means when we make the window - //bigger, the buttons will restore to their initial sizes - for (i = 0; i < sbar->nButtons; i++) - { - sbut = &sbar->sbButtons[i]; - if(sbut->uButType & SBBM_RESIZABLE) - { - sbut->nSize = sbut->nSizeReserved; - } - } - - butsize1 = GetButtonSize(sbar, hwnd, SBBP_LEFT); - butsize2 = GetButtonSize(sbar, hwnd, SBBP_RIGHT); - - if(butsize1 + butsize2 > scrollsize - MINSCROLLSIZE) - { - i = 0; - while(i < sbar->nButtons && - butsize1 + butsize2 > scrollsize - MINSCROLLSIZE) - { - sbut = &sbar->sbButtons[i++]; - if(sbut->uButType & SBBM_RESIZABLE) - { - int oldsize = sbut->nSize; - sbut->nSize -= (butsize1+butsize2) - (scrollsize-MINSCROLLSIZE); - - if(sbut->nSize < (int)sbut->nMinSize) - sbut->nSize = sbut->nMinSize; - - if ((UINT)sbut->nSize > (UINT)sbut->nMaxSize) - sbut->nSize = sbut->nMaxSize; - - - butsize1 -= (oldsize - sbut->nSize); - } - } - } - -} -#endif -#endif - -// -// We must allocate from in the non-client area for our scrollbars -// Call the default window procedure first, to get the borders (if any) -// allocated some space, then allocate the space for the scrollbars -// if they fit -// -static LRESULT NCCalcSize(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) -{ - NCCALCSIZE_PARAMS *nccsp; - RECT *rect; - RECT oldrect; - BOOL fCalcValidRects = (wParam == TRUE); - SCROLLBAR *sb; - LRESULT ret; - DWORD dwStyle; - - //Regardless of the value of fCalcValidRects, the first rectangle - //in the array specified by the rgrc structure member of the - //NCCALCSIZE_PARAMS structure contains the coordinates of the window, - //so we can use the exact same code to modify this rectangle, when - //wParam is TRUE and when it is FALSE. - nccsp = (NCCALCSIZE_PARAMS *)lParam; - rect = &nccsp->rgrc[0]; - oldrect = *rect; - - dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); - - // TURN OFF SCROLL-STYLES. - if ( dwStyle & (WS_VSCROLL|WS_HSCROLL)) - { - sw->bPreventStyleChange = TRUE; - SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle & ~(WS_VSCROLL|WS_HSCROLL)); - } - - //call the default procedure to get the borders allocated - ret = CallWindowProc(sw->oldproc, hwnd, WM_NCCALCSIZE, wParam, lParam); - - // RESTORE PREVIOUS STYLES (if present at all) - if ( dwStyle & (WS_VSCROLL|WS_HSCROLL)) - { - SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle); - sw->bPreventStyleChange = FALSE; - } - - // calculate what the size of each window border is, - sw->cxLeftEdge = rect->left - oldrect.left; - sw->cxRightEdge = oldrect.right - rect->right; - sw->cyTopEdge = rect->top - oldrect.top; - sw->cyBottomEdge = oldrect.bottom - rect->bottom; - - sb = &sw->sbarHorz; - - //if there is room, allocate some space for the horizontal scrollbar - //NOTE: Change the ">" to a ">=" to make the horz bar totally fill the - //window before disappearing - if ((sb->fScrollFlags & CSBS_VISIBLE) && -#ifdef COOLSB_FILLWINDOW - rect->bottom - rect->top >= GetScrollMetric(sb, SM_CYHORZSB)) -#else - rect->bottom - rect->top > GetScrollMetric(sb, SM_CYHORZSB)) -#endif - { - rect->bottom -= GetScrollMetric(sb, SM_CYHORZSB); - sb->fScrollVisible = TRUE; - } - else - sb->fScrollVisible = FALSE; - - sb = &sw->sbarVert; - - //if there is room, allocate some space for the vertical scrollbar - if ((sb->fScrollFlags & CSBS_VISIBLE) && - rect->right - rect->left >= GetScrollMetric(sb, SM_CXVERTSB)) - { - if(sw->fLeftScrollbar) - rect->left += GetScrollMetric(sb, SM_CXVERTSB); - else - rect->right -= GetScrollMetric(sb, SM_CXVERTSB); - - sb->fScrollVisible = TRUE; - } - else - sb->fScrollVisible = FALSE; - -#ifdef INCLUDE_BUTTONS -#ifdef RESIZABLE_BUTTONS - ResizeButtonsToFit(sw, &sw->sbarHorz, hwnd); - ResizeButtonsToFit(sw, &sw->sbarVert, hwnd); -#endif -#endif - - //don't return a value unless we actually modify the other rectangles - //in the NCCALCSIZE_PARAMS structure. In this case, we return 0 - //no matter what the value of fCalcValidRects is - return ret;//FALSE; -} - -// -// used for hot-tracking over the scroll buttons -// -static LRESULT NCMouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wHitTest, LPARAM lParam) -{ - //install a timer for the mouse-over events, if the mouse moves - //over one of the scrollbars -#ifdef HOT_TRACKING - hwndCurCoolSB = hwnd; - if(wHitTest == HTHSCROLL) - { - if(uMouseOverScrollbar == SB_HORZ) - return CallWindowProc(sw->oldproc, hwnd, WM_NCMOUSEMOVE, wHitTest, lParam); - - uLastHitTestPortion = HTSCROLL_NONE; - uHitTestPortion = HTSCROLL_NONE; - GetScrollRect(sw, SB_HORZ, hwnd, &MouseOverRect); - uMouseOverScrollbar = SB_HORZ; - uMouseOverId = SetTimer(hwnd, COOLSB_TIMERID3, COOLSB_TIMERINTERVAL3, 0); - - NCPaint(sw, hwnd, 1, 0); - } - else if(wHitTest == HTVSCROLL) - { - if(uMouseOverScrollbar == SB_VERT) - return CallWindowProc(sw->oldproc, hwnd, WM_NCMOUSEMOVE, wHitTest, lParam); - - uLastHitTestPortion = HTSCROLL_NONE; - uHitTestPortion = HTSCROLL_NONE; - GetScrollRect(sw, SB_VERT, hwnd, &MouseOverRect); - uMouseOverScrollbar = SB_VERT; - uMouseOverId = SetTimer(hwnd, COOLSB_TIMERID3, COOLSB_TIMERINTERVAL3, 0); - - NCPaint(sw, hwnd, 1, 0); - } - -#endif //HOT_TRACKING - return CallWindowProc(sw->oldproc, hwnd, WM_NCMOUSEMOVE, wHitTest, lParam); -} - -// -// Timer routine to generate scrollbar messages -// -static LRESULT CoolSB_Timer(SCROLLWND *swnd, HWND hwnd, WPARAM wTimerId, LPARAM lParam) -{ - //let all timer messages go past if we don't have a timer installed ourselves - if(uScrollTimerId == 0 && uMouseOverId == 0) - { - return CallWindowProc(swnd->oldproc, hwnd, WM_TIMER, wTimerId, lParam); - } - -#ifdef HOT_TRACKING - //mouse-over timer - if(wTimerId == COOLSB_TIMERID3) - { - POINT pt; - RECT rect, winrect; - HDC hdc; - SCROLLBAR *sbar; - - if(swnd->fThumbTracking) - return 0; - - //if the mouse moves outside the current scrollbar, - //then kill the timer.. - GetCursorPos(&pt); - - if (!PtInRect(&MouseOverRect, pt)) - { - KillTimer(hwnd, uMouseOverId); - uMouseOverId = 0; - uMouseOverScrollbar = COOLSB_NONE; - uLastHitTestPortion = HTSCROLL_NONE; - - uHitTestPortion = HTSCROLL_NONE; - NCPaint(swnd, hwnd, 1, 0); - } - else - { - if(uMouseOverScrollbar == SB_HORZ) - { - sbar = &swnd->sbarHorz; - uHitTestPortion = GetHorzPortion(sbar, hwnd, &MouseOverRect, pt.x, pt.y); - } - else - { - sbar = &swnd->sbarVert; - uHitTestPortion = GetVertPortion(sbar, hwnd, &MouseOverRect, pt.x, pt.y); - } - - if(uLastHitTestPortion != uHitTestPortion) - { - rect = MouseOverRect; - GetRealScrollRect(sbar, &rect); - - GetWindowRect(hwnd, &winrect); - OffsetRect(&rect, -winrect.left, -winrect.top); - - hdc = GetWindowDC(hwnd); - NCDrawScrollbar(sbar, hwnd, hdc, &rect, HTSCROLL_NONE); - ReleaseDC(hwnd, hdc); - } - - uLastHitTestPortion = uHitTestPortion; - } - - return 0; - } -#endif // HOT_TRACKING - - //if the first timer goes off, then we can start a more - //regular timer interval to auto-generate scroll messages - //this gives a slight pause between first pressing the scroll arrow, and the - //actual scroll starting - if(wTimerId == COOLSB_TIMERID1) - { - KillTimer(hwnd, uScrollTimerId); - uScrollTimerId = SetTimer(hwnd, COOLSB_TIMERID2, COOLSB_TIMERINTERVAL2, 0); - return 0; - } - //send the scrollbar message repeatedly - else if(wTimerId == COOLSB_TIMERID2) - { - //need to process a spoof WM_MOUSEMOVE, so that - //we know where the mouse is each time the scroll timer goes off. - //This is so we can stop sending scroll messages if the thumb moves - //under the mouse. - POINT pt; - GetCursorPos(&pt); - ScreenToClient(hwnd, &pt); - - MouseMove(swnd, hwnd, MK_LBUTTON, MAKELPARAM(pt.x, pt.y)); - - if(uScrollTimerPortion != HTSCROLL_NONE) - SendScrollMessage(hwnd, uScrollTimerMsg, uScrollTimerPortion, 0); - - return 0; - } - else - { - return CallWindowProc(swnd->oldproc, hwnd, WM_TIMER, wTimerId, lParam); - } -} - -// -// We must intercept any calls to SetWindowLongPtr, to check if -// left-scrollbars are taking effect or not -// -static LRESULT CoolSB_StyleChange(SCROLLWND *swnd, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - STYLESTRUCT *ss = (STYLESTRUCT *)lParam; - - if(wParam == GWL_EXSTYLE) - { - if(ss->styleNew & WS_EX_LEFTSCROLLBAR) - swnd->fLeftScrollbar = TRUE; - else - swnd->fLeftScrollbar = FALSE; - } - - return CallWindowProc(swnd->oldproc, hwnd, msg, wParam, lParam); -} - -static UINT curTool = -1; -static LRESULT CoolSB_Notify(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARAM lParam) -{ -#ifdef COOLSB_TOOLTIPS - - NMTTDISPINFO *nmdi = (NMTTDISPINFO *)lParam; - - if(nmdi->hdr.hwndFrom == swnd->hwndToolTip && - nmdi->hdr.code == TTN_GETDISPINFO) - { - //convert the tooltip notify from a "ISHWND" style - //request to an id-based request. - //We do this because our tooltip is a window-style - //tip, with no tools, and the GETDISPINFO request must - //indicate which button to retrieve the text for - //nmdi->hdr.idFrom = curTool; - nmdi->hdr.idFrom = curTool; - nmdi->hinst = GetModuleHandle(0); - nmdi->uFlags &= ~TTF_IDISHWND; - } -#endif //COOLSB_TOOLTIPS - - return CallWindowProc(swnd->oldproc, hwnd, WM_NOTIFY, wParam, lParam); -} - -static LRESULT SendToolTipMessage0(HWND hwndTT, UINT message, WPARAM wParam, LPARAM lParam) -{ - return SendMessage(hwndTT, message, wParam, lParam); -} - -#ifdef COOLSB_TOOLTIPS -#define SendToolTipMessage SendToolTipMessage0 -#else -#define SendToolTipMessage 1 ? (void)0 : SendToolTipMessage0 -#endif - - -// -// We must intercept any calls to SetWindowLongPtr, to make sure that -// the user does not set the WS_VSCROLL or WS_HSCROLL styles -// -static LRESULT CoolSB_SetCursor(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARAM lParam) -{ -#ifdef INCLUDE_BUTTONS - UINT lo = LOWORD(lParam); - UINT hi = HIWORD(lParam); - UINT xy; - RECT rect; - SCROLLBAR *sbar; - SCROLLBUT *sbut; - POINT pt; - UINT id; - static UINT lastid; - -#ifdef HIDE_CURSOR_AFTER_MOUSEUP - static UINT lastmsg; - if(lastmsg == WM_LBUTTONDOWN) - { - lastmsg = hi; - return CallWindowProc(swnd->oldproc, hwnd, WM_SETCURSOR, wParam, lParam); - } - else - lastmsg = hi; -#endif - - //if we are over either or our scrollbars - if(lo == HTHSCROLL || lo == HTVSCROLL) - { - xy = GetMessagePos(); - pt.x = LOWORD(xy); - pt.y = HIWORD(xy); - - if(lo == HTHSCROLL) - { - sbar = &swnd->sbarHorz; - GetScrollRect(swnd, SB_HORZ, hwnd, &rect); - id = GetHorzPortion(sbar, hwnd, &rect, pt.x, pt.y); - } - else - { - sbar = &swnd->sbarVert; - GetScrollRect(swnd, SB_VERT, hwnd, &rect); - id = GetVertPortion(sbar, hwnd, &rect, pt.x, pt.y); - } - - if(id != HTSCROLL_INSERTED) - { - if(swnd->hwndToolTip != 0) - { - SendToolTipMessage(swnd->hwndToolTip, TTM_ACTIVATE, FALSE, 0); - SendToolTipMessage(swnd->hwndToolTip, TTM_POP, 0, 0); - } - - return CallWindowProc(swnd->oldproc, hwnd, WM_SETCURSOR, wParam, lParam); - } - - if(swnd->hwndToolTip != 0) - { - SendToolTipMessage(swnd->hwndToolTip, TTM_ACTIVATE, TRUE, 0); - } - - //set the cursor if one has been specified - if ((id = GetButtonFromPt(sbar, &rect, pt, TRUE)) != -1) - { - sbut = &sbar->sbButtons[id]; - curTool = sbut->uCmdId; - - if(lastid != id && swnd->hwndToolTip != 0) - { - if(IsWindowVisible(swnd->hwndToolTip)) - SendToolTipMessage(swnd->hwndToolTip, TTM_UPDATE, TRUE, 0); - } - - lastid = id; - - if(sbut->hCurs != 0) - { - SetCursor(sbut->hCurs); - return 0; - } - } - else - { - curTool = -1; - lastid = -1; - } - } - else if(swnd->hwndToolTip != 0) - { - SendToolTipMessage(swnd->hwndToolTip, TTM_ACTIVATE, FALSE, 0); - SendToolTipMessage(swnd->hwndToolTip, TTM_POP, 0, 0); - } - -#endif //INCLUDE_BUTTONS - return CallWindowProc(swnd->oldproc, hwnd, WM_SETCURSOR, wParam, lParam); -} - - -// -// Send the specified message to the tooltip control -// -static void __stdcall RelayMouseEvent(HWND hwnd, HWND hwndToolTip, UINT event) -{ -#ifdef COOLSB_TOOLTIPS - MSG msg; - - CoolSB_ZeroMemory(&msg, sizeof(MSG)); - msg.hwnd = hwnd; - msg.message = event; - - SendMessage(hwndToolTip, TTM_RELAYEVENT, 0, (LONG)&msg); -#else - UNREFERENCED_PARAMETER(hwnd); - UNREFERENCED_PARAMETER(hwndToolTip); - UNREFERENCED_PARAMETER(event); -#endif -} - - -// -// CoolScrollbar subclass procedure. -// Handle all messages needed to mimick normal windows scrollbars -// -LRESULT CALLBACK CoolSBWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - WNDPROC oldproc; - SCROLLWND *swnd = GetScrollWndFromHwnd(hwnd); - static int count; - - switch(message) - { - case WM_NCDESTROY: - //this should NEVER be called, because the user - //should have called Uninitialize() themselves. - - //However, if the user tries to call Uninitialize().. - //after this window is destroyed, this window's entry in the lookup - //table will not be there, and the call will fail - oldproc = swnd->oldproc; - UninitializeCoolSB(hwnd); - - //we must call the original window procedure, otherwise it - //will never get the WM_NCDESTROY message, and it wouldn't - //be able to clean up etc. - return CallWindowProc(oldproc, hwnd, message, wParam, lParam); - - case WM_NCCALCSIZE: - return NCCalcSize(swnd, hwnd, wParam, lParam); - - case WM_NCPAINT: - return NCPaint(swnd, hwnd, wParam, lParam); - - case WM_NCHITTEST: - return NCHitTest(swnd, hwnd, wParam, lParam); - - case WM_NCRBUTTONDOWN: case WM_NCRBUTTONUP: - case WM_NCMBUTTONDOWN: case WM_NCMBUTTONUP: - RelayMouseEvent(hwnd, swnd->hwndToolTip, (WM_MOUSEMOVE-WM_NCMOUSEMOVE) + (message)); - if(wParam == HTHSCROLL || wParam == HTVSCROLL) - return 0; - else - break; - - case WM_NCLBUTTONDBLCLK: - //TRACE("WM_NCLBUTTONDBLCLK %d\n", count++); - if(wParam == HTHSCROLL || wParam == HTVSCROLL) - return NCLButtonDown(swnd, hwnd, wParam, lParam); - else - break; - - case WM_NCLBUTTONDOWN: - //TRACE("WM_NCLBUTTONDOWN%d\n", count++); - RelayMouseEvent(hwnd, swnd->hwndToolTip, WM_LBUTTONDOWN); - return NCLButtonDown(swnd, hwnd, wParam, lParam); - - - case WM_LBUTTONUP: - //TRACE("WM_LBUTTONUP %d\n", count++); - RelayMouseEvent(hwnd, swnd->hwndToolTip, WM_LBUTTONUP); - return LButtonUp(swnd, hwnd, wParam, lParam); - - case WM_NOTIFY: - return CoolSB_Notify(swnd, hwnd, wParam, lParam); - - //Mouse moves are received when we set the mouse capture, - //even when the mouse moves over the non-client area - case WM_MOUSEMOVE: - //TRACE("WM_MOUSEMOVE %d\n", count++); - return MouseMove(swnd, hwnd, wParam, lParam); - - case WM_TIMER: - return CoolSB_Timer(swnd, hwnd, wParam, lParam); - - //case WM_STYLECHANGING: - // return CoolSB_StyleChange(swnd, hwnd, WM_STYLECHANGING, wParam, lParam); - case WM_STYLECHANGED: - - if(swnd->bPreventStyleChange) - { - // the NCPAINT handler has told us to eat this message! - return 0; - } - else - { - if (message == WM_STYLECHANGED) - return CoolSB_StyleChange(swnd, hwnd, WM_STYLECHANGED, wParam, lParam); - else - break; - } - - case WM_NCMOUSEMOVE: - { - static LONG_PTR lastpos = -1; - - //TRACE("WM_NCMOUSEMOVE %d\n", count++); - - //The problem with NCMOUSEMOVE is that it is sent continuously - //even when the mouse is stationary (under win2000 / win98) - // - //Tooltips don't like being sent a continous stream of mouse-moves - //if the cursor isn't moving, because they will think that the mouse - //is moving position, and the internal timer will never expire - // - if(lastpos != lParam) - { - RelayMouseEvent(hwnd, swnd->hwndToolTip, WM_MOUSEMOVE); - lastpos = lParam; - } - } - - return NCMouseMove(swnd, hwnd, wParam, lParam); - - - case WM_SETCURSOR: - return CoolSB_SetCursor(swnd, hwnd, wParam, lParam); - - case WM_CAPTURECHANGED: - break; - - default: - break; - } - - return CallWindowProc(swnd->oldproc, hwnd, message, wParam, lParam); -} - diff --git a/plugins/Clist_nicer/coolsb/coolscroll.h b/plugins/Clist_nicer/coolsb/coolscroll.h deleted file mode 100644 index c5fe848a83..0000000000 --- a/plugins/Clist_nicer/coolsb/coolscroll.h +++ /dev/null @@ -1,232 +0,0 @@ -#ifndef _COOLSBLIB_INCLUDED -#define _COOLSBLIB_INCLUDED - -#ifdef __cplusplus -extern "C"{ -#endif - -#include -#include - -// To complement the exisiting SB_HORZ, SB_VERT, SB_BOTH -// scrollbar identifiers -#define COOLSB_NONE (-1) -#define SB_INSBUT (-2) - -// -// Arrow size defines -// -#define SYSTEM_METRIC (-1) - - -// -// general scrollbar styles -// -// use the standard ESB_DISABLE_xxx flags to represent the -// enabled / disabled states. (defined in winuser.h) -// -#define CSBS_THUMBALWAYS 4 -#define CSBS_VISIBLE 8 - -//cool scrollbar styles for Flat scrollbars -#define CSBS_NORMAL 0 -#define CSBS_FLAT 1 -#define CSBS_HOTTRACKED 2 - -// -// Button mask flags for indicating which members of SCROLLBUT -// to use during a button insertion / modification -// -#define SBBF_TYPE 0x0001 -#define SBBF_ID 0x0002 -#define SBBF_PLACEMENT 0x0004 -#define SBBF_SIZE 0x0008 -#define SBBF_BITMAP 0x0010 -#define SBBF_ENHMETAFILE 0x0020 -//#define SBBF_OWNERDRAW 0x0040 //unused at present -#define SBBF_CURSOR 0x0080 -#define SBBF_BUTMINMAX 0x0100 -#define SBBF_STATE 0x0200 - -//button styles (states) -#define SBBS_NORMAL 0 -#define SBBS_PUSHED 1 -#define SBBS_CHECKED SBBS_PUSHED - -// -// scrollbar button types -// -#define SBBT_PUSHBUTTON 1 //standard push button -#define SBBT_TOGGLEBUTTON 2 //toggle button -#define SBBT_FIXED 3 //fixed button (non-clickable) -#define SBBT_FLAT 4 //blank area (flat, with border) -#define SBBT_BLANK 5 //blank area (flat, no border) -#define SBBT_DARK 6 //dark blank area (flat) -#define SBBT_OWNERDRAW 7 //user draws the button via a WM_NOTIFY - -#define SBBT_MASK 0x1f //mask off low 5 bits - -//button type modifiers -#define SBBM_RECESSED 0x0020 //recessed when clicked (like Word 97) -#define SBBM_LEFTARROW 0x0040 -#define SBBM_RIGHTARROW 0x0080 -#define SBBM_UPARROW 0x0100 -#define SBBM_DOWNARROW 0x0200 -#define SBBM_RESIZABLE 0x0400 -#define SBBM_TYPE2 0x0800 -#define SBBM_TYPE3 0x1000 -#define SBBM_TOOLTIPS 0x2000 //currently unused (define COOLSB_TOOLTIPS in userdefs.h) - -//button placement flags -#define SBBP_LEFT 1 -#define SBBP_RIGHT 2 -#define SBBP_TOP 1 //3 -#define SBBP_BOTTOM 2 //4 - - -// -// Button command notification codes -// for sending with a WM_COMMAND message -// -#define CSBN_BASE 0 -#define CSBN_CLICKED (1 + CSBN_BASE) -#define CSBN_HILIGHT (2 + CSBN_BASE) - -// -// Minimum size in pixels of a scrollbar thumb -// -#define MINTHUMBSIZE_NT4 8 -#define MINTHUMBSIZE_2000 6 - -//define some more hittest values for our cool-scrollbar -#define HTSCROLL_LEFT (SB_LINELEFT) -#define HTSCROLL_RIGHT (SB_LINERIGHT) -#define HTSCROLL_UP (SB_LINEUP) -#define HTSCROLL_DOWN (SB_LINEDOWN) -#define HTSCROLL_THUMB (SB_THUMBTRACK) -#define HTSCROLL_PAGEGUP (SB_PAGEUP) -#define HTSCROLL_PAGEGDOWN (SB_PAGEDOWN) -#define HTSCROLL_PAGELEFT (SB_PAGELEFT) -#define HTSCROLL_PAGERIGHT (SB_PAGERIGHT) - -#define HTSCROLL_NONE (-1) -#define HTSCROLL_NORMAL (-1) - -#define HTSCROLL_INSERTED (128) -#define HTSCROLL_PRE (32 | HTSCROLL_INSERTED) -#define HTSCROLL_POST (64 | HTSCROLL_INSERTED) - -/* - - Public interface to the Cool Scrollbar library - - -*/ - -BOOL WINAPI InitializeCoolSB(HWND hwnd); -HRESULT WINAPI UninitializeCoolSB (HWND hwnd); - -BOOL WINAPI CoolSB_SetMinThumbSize(HWND hwnd, UINT wBar, UINT size); -BOOL WINAPI CoolSB_IsThumbTracking(HWND hwnd); -BOOL WINAPI CoolSB_IsCoolScrollEnabled(HWND hwnd); - -// -BOOL WINAPI CoolSB_EnableScrollBar (HWND hwnd, int wSBflags, UINT wArrows); -BOOL WINAPI CoolSB_GetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi); -int WINAPI CoolSB_GetScrollPos (HWND hwnd, int nBar); -BOOL WINAPI CoolSB_GetScrollRange (HWND hwnd, int nBar, LPINT lpMinPos, LPINT lpMaxPos); - -// -int WINAPI CoolSB_SetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL fRedraw); -int WINAPI CoolSB_SetScrollPos (HWND hwnd, int nBar, int nPos, BOOL fRedraw); -int WINAPI CoolSB_SetScrollRange (HWND hwnd, int nBar, int nMinPos, int nMaxPos, BOOL fRedraw); -BOOL WINAPI CoolSB_ShowScrollBar (HWND hwnd, int wBar, BOOL fShow); - -// -// Scrollbar dimension functions -// -BOOL WINAPI CoolSB_SetSize (HWND hwnd, int wBar, int nLength, int nWidth); - -// -// Set the visual nature of a scrollbar (flat, normal etc) -// -BOOL WINAPI CoolSB_SetStyle (HWND hwnd, int wBar, UINT nStyle); -BOOL WINAPI CoolSB_SetThumbAlways (HWND hwnd, int wBar, BOOL fThumbAlways); - -// -// Scrollbar button structure, for inserted buttons only -// -typedef struct -{ - UINT fMask; //which members are in use - UINT uPlacement; //is this button to the left/right (above/below) of the scrollbar?? - UINT uCmdId; //command identifier (WM_COMMAND value to send) - UINT uButType; // - UINT uState; //toggled etc - int nSize; //size in pixels. -1 for autosize - - HBITMAP hBmp; //handle to a bitmap to use as the button face - HENHMETAFILE hEmf; //handle to an enhanced metafile - - HCURSOR hCurs; //handle to a user-supplied mouse cursor to apply - //to this button - - int nSizeReserved; //internal variable used for resizing - int nMinSize; //min size - int nMaxSize; //max size - -} SCROLLBUT; - -BOOL WINAPI CoolSB_InsertButton(HWND hwnd, int wSBflags, UINT nPos, SCROLLBUT *psb); -BOOL WINAPI CoolSB_ModifyButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, SCROLLBUT *psb); -BOOL WINAPI CoolSB_RemoveButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd); -BOOL WINAPI CoolSB_GetButton (HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, SCROLLBUT *psb); - -void WINAPI CoolSB_SetESBProc(void *proc); - -typedef struct -{ - NMHDR hdr; - DWORD dwDrawStage; - HDC hdc; - RECT rect; - UINT uItem; - UINT uState; - UINT nBar; - -} NMCSBCUSTOMDRAW; - -typedef struct -{ - NMHDR hdr; - RECT rect; - POINT pt; - UINT uCmdId; - UINT uState; - int nBar; -} NMCOOLBUTMSG; - -/* -typedef struct -{ - NMHDR hdr; - DWORD dwDrawStage; - HDC hdc; - RECT rect; - UINT uCmdId; - UINT uState; - -} NMCOOLBUTTON_CUSTOMDRAW; -*/ - - -// -// Define the WM_NOTIFY code value for cool-scrollbar custom drawing -// -#define NM_COOLSB_CUSTOMDRAW (0-0xfffU) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/plugins/Clist_nicer/coolsb/userdefs.h b/plugins/Clist_nicer/coolsb/userdefs.h deleted file mode 100644 index ea7ea1fe92..0000000000 --- a/plugins/Clist_nicer/coolsb/userdefs.h +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef _USERDEFINES_INCLUDED -#define _USERDEFINES_INCLUDED - -/* - - Define these values to alter the various - features of the coolscroll library. If you don't want - a certain feature, then you might be able to reduce the - size of your app by a few kb... - -*/ - -/* allow inserted buttons. Without this, all button code will - be excluded, resulting in a smaller build (about 4kb less). This - may not seem much, but it is a 25% reduction! */ -//#define INCLUDE_BUTTONS - -/* Allow user-resizable buttons. Makes no difference if INCLUDE_BUTTONS - is not defined for the project */ -#define RESIZABLE_BUTTONS - -/* Include tooltip support for inserted buttons. Without this, no - tooltip requests (TTN_GETDISPINFO's) will be sent to the window */ -//#define COOLSB_TOOLTIPS - -/* Define this to include the custom-draw support */ -#define CUSTOM_DRAW - -/* Define to enable WM_NOTIFY messages to be sent for mouse event */ -#define NOTIFY_MOUSE - -/* Define this value to make the horizontal scrollbar stay visible even - if the window is sized to small vertically. Normal scrollbars always leave - a 1-pixel line of "client" area before hiding the horizontal scrollbar. This - value allows the window to be sized so the client area totally disappears if - sized too small */ -//#define COOLSB_FILLWINDOW - -/* minimum size of scrollbar before inserted buttons are - hidden to make room when the window is sized too small */ -#define MIN_COOLSB_SIZE 24 - -/* min size of scrollbar when resizing a button, before the - resize is stopped because the scrollbar has gotten too small */ -#define MINSCROLLSIZE 50 - -/* define this to display the default mouse arrow whenever the - the mouse is released over a button which has a user-defined cursor. - not really very useful, just provides a different type of feedback */ -#undef HIDE_CURSOR_AFTER_MOUSEUP - -/* enable HOT_TRACKING to provide visual feedback when the mouse - moves over a scrollbar area (like Flat Scrollbars) */ -#define HOT_TRACKING - -/* enable FLAT_SCROLLBARS to include support for flat scrollbars - note that they must be enabled by the user first of all */ -#define FLAT_SCROLLBARS - -/* a normal scrollbar "snaps" its scroll-thumb back into position if - you move the mouse too far away from the window, whilst you are - dragging the thumb, that is. #undeffing this results in the thumb - never snapping back into position, no matter how far away you move - the mouse */ -#define SNAP_THUMB_BACK - -/* distance (in pixels) the mouse must move away from the thumb - during tracking to cause the thumb bar to snap back to its - starting place. Has no effect unless SNAP_THUMB_BACK is defined */ -#define THUMBTRACK_SNAPDIST 24 - -/* maximum number of inserted buttons per bar */ -#define MAX_COOLSB_BUTS 16 - -/* maximum number of coolsb windows per application. - Set to lower if you don't need many. */ -#define MAX_COOLSB 4 - -#endif /* _USERDEFINES_INCLUDED */ \ No newline at end of file diff --git a/plugins/Clist_nicer/docs/clist_nicer-translation.txt b/plugins/Clist_nicer/docs/clist_nicer-translation.txt new file mode 100644 index 0000000000..0eb0d0e5ef --- /dev/null +++ b/plugins/Clist_nicer/docs/clist_nicer-translation.txt @@ -0,0 +1,498 @@ +; Common strings that belong to many files +;[&Delete Group] +;[&Hide Offline Users] +;[&Hide Offline Users in here] +;[&Hide/Show] +;[&New Group] +;[&Rename Group] +;[&Status] +;[Always] +;[Appearance] +;[Background] +;[Configure view modes] +;[Contact List] +;[Dialog] +;[Disable &Groups] +;[E&xit] +;[Event area] +;[General] +;[Groups] +;[Hide &Empty Groups] +;[Hide &Offline Users out here] +;[Icons] +;[Never] +;[Protocol] +;[Setup view modes] +;[Skin items] +;[Status Bar] +;[Status mode] +;[Sticky contacts] +;[Version] +;[Window] + +; ../../plugins/Clist_nicer/CLUIFrames/cluiframes.cpp +;[&Align] +;[&Border] +;[&Bottom] +;[&Client] +;[&Collapsed] +;[&Down] +;[&Floating Mode] +;[&FrameTitle] +;[&Locked] +;[&Position] +;[&Show TitleBar] +;[&Skinned frame] +;[&Top] +;[&Up] +;[&Visible] +;[Floating] +;[Frames] +;[Hide All Titlebars] +;[Lock Frame] +;[Show All Frames] +;[Show All Titlebars] +;[Show TitleBar] +;[Skinned frame] +;[Visible] + +; ../../plugins/Clist_nicer/CLUIFrames/groupmenu.cpp +;[&About the contact list...] +;[&Find/Add Contacts...] +;[&Main Menu] +;[&New SubGroup] +;[&Options...] + +; ../../plugins/Clist_nicer/CLUIFrames/movetogroup.cpp +;[&Floating Contact] + +; ../../plugins/Clist_nicer/SRC/Docking.cpp +;[Clist docking] +;[The clist cannot be docked when using the default title bar and border. Use a toolwindow or borderless style instead.] + +; ../../plugins/Clist_nicer/SRC/clcopts.cpp +;[] +;[Add New...] +;[Advanced] +;[Always Left] +;[Always Right] +;[Apply this profile] +;[Automatic (RTL)] +;[Contact list] +;[Contact rows] +;[Contacts] +;[Default] +;[Delete] +;[Far left] +;[Far right] +;[Floating contacts] +;[For RTL only] +;[Groups and layout] +;[Hottracked contact] +;[Last Message] +;[List layout] +;[Message Frequency] +;[Name] +;[Nothing] +;[Offline contact] +;[RTL TEXT only] +;[Rename...] +;[Selected contact] +;[Skins] +;[Status] +;[When needed] +;[When space allows it] +;[With Nickname - left] +;[With Nickname - right] + +; ../../plugins/Clist_nicer/SRC/clistmenus.cpp +;[&Contact list settings...] +;[Add permanently] +;[Contact list display and ignore options for %s] +;[Default (global setting)] +;[Hide always] +;[Revert to default] +;[Show always when available] +;[When needed by status message] +;[When space is available] + +; ../../plugins/Clist_nicer/SRC/clistopts.cpp +;[Global] + +; ../../plugins/Clist_nicer/SRC/clui.cpp +;[%s Connecting] +;[Accounts] +;[Built %s %s] +;[CList - Nicer/Connecting Icons] +;[CList - Nicer/Default] +;[CList - Nicer/Overlay Icons] +;[Chat room/IRC channel activity] +;[Clear view mode] +;[Contact list local time] +;[Contact on invisible list or blocked] +;[Contact on visible list] +;[Contacts which are 'not on list'] +;[Dividers] +;[Event Area] +;[Find and add contacts] +;[Frame titles] +;[Group member counts] +;[Hottrack Text] +;[Menu] +;[Minimize contact list] +;[My Contacts] +;[Offline] +;[Offline contacts] +;[Offline contacts to whom you have a different visibility] +;[Online contacts to whom you have a different visibility] +;[Open main menu] +;[Open preferences] +;[Quicksearch Text] +;[Reset view mode] +;[Select view mode] +;[Selected Text] +;[Set status modes] +;[Show / hide offline contacts] +;[Show menu] +;[Standard contacts] +;[Status menu] +;[Toggle group mode] +;[Toggle sounds] +;[tabSRMM Menu] +;[tabSRMM session list] + +; ../../plugins/Clist_nicer/SRC/cluiopts.cpp +;[No border] +;[Thin border] +;[Title bar] +;[Tool Window] + +; ../../plugins/Clist_nicer/SRC/extBackg.cpp +;[Load and apply] + +; ../../plugins/Clist_nicer/SRC/viewmodes.cpp +;[A view mode with this name does alredy exist] +;[And] +;[Clear current View Mode] +;[Clear view mode and return to default display] +;[Current view mode: %s] +;[Days] +;[Delete a view mode] +;[Duplicate name] +;[Filtering] +;[Hours] +;[Minutes] +;[Newer than] +;[No view mode] +;[Older than] +;[Or] +;[Really delete this view mode? This cannot be undone] +;[Select a view mode] +;[Setup View Modes...] +;[Ungrouped contacts] +;[View Modes] + +; ../../plugins/Clist_nicer/resource.rc +;[% of screen] +;[&Away\tCtrl+2] +;[&DND\tCtrl+5] +;[&Free for chat\tCtrl+6] +;[&Invisible\tCtrl+7] +;[&NA\tCtrl+3] +;[&New Subgroup] +;[&Offline\tCtrl+0] +;[< Reload] +;[About CList Nicer+] +;[Active] +;[Active opacity:] +;[Advanced #1] +;[Advanced #2] +;[Advanced #3] +;[Advanced #4] +;[Alignment] +;[Although the exception was caught and you may continue working with Miranda, you should restart the program as soon as possible. The exception may have damaged internal data structures and can have a serious impact on stability.] +;[Always Hide On Taskbar] +;[Always align icons and text for missing avatars] +;[Always on top] +;[Always show status in tooltip] +;[Appear always offline (block contact)] +;[Appear always online] +;[Apply] +;[Apply group indent values to background drawing] +;[Apply last active view mode ] +;[Apply skin now] +;[Are you sure you want to delete %s?] +;[Ask before deleting contacts] +;[Auto mode] +;[Auto-Hide Status Floater] +;[Automatically clear this view mode after] +;[Automatically fill background with wallpaper (tiled wallpaper only)] +;[Automatically resize window to height of list] +;[Available view modes] +;[Avatar alignment] +;[Avatars] +;[Background colour] +;[Behaviour] +;[Blend selection with background] +;[Border] +;[Cancel] +;[Center groupnames horizontally] +;[Centered when possible] +;[Clear all] +;[Client] +;[Client margins] +;[Clip border by] +;[Clist Nicer+] +;[Colour] +;[Contact List Background] +;[Contact List Sorting] +;[Contact list layout] +;[Contact list skin] +;[Continue] +;[Copy to clipboard] +;[Copyright © 2004-2010 by the Miranda IM project. More detailed copyright information can be found in the included README file.\n\nThis software is distributed and licensed under the terms of the GNU General Public License V2 or any later version.] +;[Corner radius] +;[Cycle icons every] +;[Delete Contact] +;[Dim idle contacts] +;[Disable drag and drop of items] +;[Disable groups] +;[Disable icon blinking] +;[Disable rename of items by clicking twice] +;[Display options] +;[Display status message when available] +;[Do not separate offline contacts] +;[Do not show system tray icon tooltips on mouse over] +;[Don't request avatars for offline contacts] +;[Double click on avatar opens userinfo] +;[Draw a border around avatars] +;[Draw a line alongside group names] +;[Draw background skin] +;[Draw overlay icon on avatar] +;[Draw sunken Frame] +;[Draw sunken edge] +;[E-Mail] +;[Easy move] +;[Embedded frames border] +;[Enable floating contacts (required restart)] +;[Exit Miranda] +;[Export to skin file] +;[Extra icon size] +;[Extra icons] +;[Extra icons (drag items to reorder them)] +;[Fade contact list in/out] +;[Fill with contact list background color] +;[Finally by] +;[First by] +;[Floating contacts appearance] +;[Frame titlebar height] +;[Fully transparent (like TweakUI)] +;[Gap between frames] +;[Grey out entire list when:] +;[Group] +;[Group row height] +;[Group top padding] +;[Height] +;[Hide Miranda] +;[Hide as offline] +;[Hide contact list after it has been idle for] +;[Hide empty groups] +;[Hide from list only, in order to keep their history and ignore/visibility settings] +;[Hide numbers when all offline] +;[Hide offline users] +;[Hide this contact from the list] +;[Hide vertical scroll bar] +;[Homepage] +;[Hot track items as mouse passes over] +;[Hover time] +;[If window is partially covered, bring to front instead of hiding] +;[If you enable this, the background settings will affect the entire contact list frame.] +;[Ignore all] +;[Ignore none] +;[Ignore selection for groups] +;[Ignore these events] +;[Inactive] +;[Inactive opacity:] +;[Include groups] +;[Include protocols] +;[Include status modes] +;[Incoming file transfers] +;[Indent groups by:] +;[Inner Row vertical padding] +;[Items] +;[Last message ] +;[Load from skin file] +;[Load this skin on startup] +;[Make sections equal width] +;[Make selection highlight translucent] +;[Make selection shape equal to selected item] +;[Margins (left/right)] +;[Margins and spacing] +;[Mark protocols locked from global status changes] +;[Messages] +;[Minimum row height:] +;[Move events to the top of list\nor group] +;[Move marked Contacts to this Group] +;[New] +;[No] +;[No expand/collapse icon] +;[Nowhere] +;[OK] +;[Occ&upied\tCtrl+4] +;[Ok] +;[On the &Phone\tCtrl+8] +;[On&line\tCtrl+1] +;[Only show contact floaters when contact list is hidden or minimized] +;[Only when statuses differ] +;[Only when timezone differs] +;[Opacity] +;[Other] +;[Out to &Lunch\tCtrl+9] +;[Padding] +;[Per contact skins:] +;[Pin to desktop] +;[Protocol skins override status text colors] +;[Quicksearch in open groups only] +;[Radius] +;[Replace status icons with xStatus] +;[Reserved] +;[Reserved #1] +;[Reserved #2] +;[Reset order and visibility to default] +;[Right align contacts] +;[Right click opens Miranda IM menu] +;[Right click opens status menu] +;[Rounded avatars] +;[Rounded border] +;[Rounded corners] +;[Row gap] +;[Scroll list smoothly] +;[Scroll with text] +;[Second text line] +;[Set all buttons to skinned mode] +;[Set base visiblity on the frames menu] +;[Show] +;[Show 2nd line:] +;[Show Avatar:] +;[Show Event Area in Floater] +;[Show ICQ extended status icons] +;[Show Metacontact proto Icons] +;[Show Status Icons] +;[Show Visibility Icons] +;[Show additional Buttons] +;[Show avatars] +;[Show bevels on panels] +;[Show contact with priority] +;[Show contacts local time] +;[Show divider between online and offline contacts] +;[Show drop shadow (restart required)] +;[Show extra icons] +;[Show icons] +;[Show local time] +;[Show menu and status buttons] +;[Show menu bar] +;[Show multiple icons] +;[Show number of contacts in a group] +;[Show protocol names] +;[Show resize grip indicator] +;[Show second text line] +;[Show second text line:] +;[Show selection even when list is not focused] +;[Show status bar] +;[Show status icons] +;[Show status text] +;[Show tooltips] +;[Show visibility icon] +;[Show visibility icons] +;[Simple layout] +;[Single click interface] +;[Size upwards] +;[Skin options] +;[Slider2] +;[Snap to edges (hold CTRL for snap between floaters)] +;[Sort groups alphabetically] +;[Spin1] +;[Spin5] +;[Statisch] +;[Stretch proportionally] +;[Stretch to height] +;[Stretch to width] +;[Support and latest version information] +;[Suppress added notifications] +;[Suppress auth requests] +;[Suppress online notifications] +;[Synchronzie floater visibility with contact list] +;[System tray icon] +;[System tray icon when using multiple protocols] +;[TabSRMM exception] +;[Telephone] +;[Then by] +;[This will erase all history and settings for this contact!] +;[Tile horizontally] +;[Tile vertically] +;[Time:] +;[Title bar text:] +;[To show a previously hidden contact, navigate to Options->Events->Ignore, search the contact in the list and tick the checkbox next to its name.] +;[Tooltips] +;[Translucency options (Windows 2000/XP only)] +;[Transparent contact list] +;[Tray] +;[URL events] +;[Unload skin] +;[Use Options->Ignore (expert mode) to unhide contacts.] +;[Use Overlay icons on avatars] +;[Use Status Floater] +;[Use Windows colours] +;[Use background image] +;[Use default] +;[Use fast gradient drawing] +;[Use full row for selection and hottracking] +;[Use metacontact protocol icons instead of subcontacts] +;[Use per protocol/contact skinning] +;[Use these settings to skin the entire background] +;[Using the contact list on the left side, you can select contacts which will be \"sticky\" for this view mode. These contacts will ignore the standard filter rules and only use the status mode filter below.] +;[View mode options] +;[Visibility] +;[Visual] +;[When possible, draw status icons in avatar space] +;[Width] +;[Yes] +;[build time] +;[icon when statuses differ] +;[maximum] +;[milliseconds] +;[ms] +;[seconds] +;[seconds, when statuses differ] + +; ../../plugins/Clist_nicer/skineditor/main.cpp +;[] +;[Bumped] +;[Etched] +;[Image items] +;[Raised] +;[Sunken] + +; ../../plugins/Clist_nicer/skineditor/skinedit.rc +;[3D border (bright / dark)] +;[Alpha (percent)] +;[Border style] +;[Bottom to top] +;[Bottom-Left] +;[Bottom-Right] +;[First color] +;[Gradient] +;[Item borders] +;[Item colors] +;[Item ignored] +;[Item margins] +;[Left to right] +;[Not yet supported] +;[Right to left] +;[Round corners] +;[Second color] +;[Textcolor] +;[Top to bottom] +;[Top-Left] +;[Top-Right] +;[Transparent] diff --git a/plugins/Clist_nicer/res/resource.rc b/plugins/Clist_nicer/res/resource.rc new file mode 100644 index 0000000000..23a2f2b569 --- /dev/null +++ b/plugins/Clist_nicer/res/resource.rc @@ -0,0 +1,773 @@ +// Microsoft Visual C++ generated resource script. +// +#include "..\src\include\resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include +#include +#include +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_EXCEPTION DIALOGEX 0, 0, 370, 131 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "TabSRMM exception" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + EDITTEXT IDC_EXCEPTION_DETAILS,7,18,356,60,ES_MULTILINE | ES_READONLY + DEFPUSHBUTTON "Copy to clipboard",IDC_COPY_EXCEPTION,108,114,80,14 + PUSHBUTTON "Continue",IDOK,196,114,80,14 + PUSHBUTTON "Exit Miranda",IDCANCEL,284,114,80,14 + LTEXT "",IDC_EX_REASON,7,5,354,9 + LTEXT "Although the exception was caught and you may continue working with Miranda, you should restart the program as soon as possible. The exception may have damaged internal data structures and can have a serious impact on stability.",IDC_STATIC,7,83,352,26 +END + +IDD_OPT_FLOATING DIALOGEX 0, 0, 313, 251 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "Floating contacts appearance",IDC_STATIC,3,4,307,131 + CONTROL "Simple layout",IDC_FLT_SIMPLELAYOUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,29,176,11 + CONTROL "Show avatars",IDC_FLT_AVATARS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,41,176,11 + CONTROL "Show second text line",IDC_FLT_DUALROWS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,53,176,11 + CONTROL "Show extra icons",IDC_FLT_EXTRAICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,65,176,11 + GROUPBOX "Behaviour",IDC_STATIC,3,192,307,52 + CONTROL "Synchronzie floater visibility with contact list",IDC_FLT_SYNCED, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,202,292,11 + CONTROL "Only show contact floaters when contact list is hidden or minimized",IDC_FLT_AUTOHIDE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,214,292,11 + EDITTEXT IDC_FLT_PADLEFT,211,93,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_FLT_PADLEFTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,205,90,11,14 + EDITTEXT IDC_FLT_PADRIGHT,274,93,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_FLT_PADRIGHTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,293,89,11,14 + EDITTEXT IDC_FLT_PADTOP,243,87,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_FLT_PADTOPSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,262,82,11,14 + EDITTEXT IDC_FLT_PADBOTTOM,243,98,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | ES_NUMBER + CONTROL "",IDC_FLT_PADBOTTOMSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK | WS_DISABLED,262,100,11,14 + CTEXT "Padding",IDC_STATIC,217,74,80,10 + CONTROL "Enable floating contacts (required restart)",IDC_FLT_ENABLED, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,17,176,11 + CONTROL "",IDC_FLT_OPACITY,"msctls_trackbar32",TBS_TOP | TBS_NOTICKS | WS_TABSTOP,231,43,45,12 + RTEXT "000%",IDC_FLT_OPACITYVALUE,277,44,20,8 + GROUPBOX "Opacity",IDC_STATIC,192,14,113,47 + EDITTEXT IDC_FLT_WIDTH,274,115,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_FLT_WIDTHSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,293,111,11,14 + RTEXT "Width",IDC_STATIC,212,118,53,8 + CONTROL "Snap to edges (hold CTRL for snap between floaters)",IDC_FLT_SNAP, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,226,292,11 + RTEXT "Inactive",IDC_STATIC,193,44,36,8 + CONTROL "",IDC_FLT_ACTIVEOPACITY,"msctls_trackbar32",TBS_TOP | TBS_NOTICKS | WS_TABSTOP,231,26,45,12 + RTEXT "000%",IDC_FLT_ACTIVEOPACITYVALUE,277,28,20,8 + RTEXT "Active",IDC_STATIC,193,28,36,8 + CONTROL "Border",IDC_FLT_BORDER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,101,71,10 + CONTROL "Rounded corners",IDC_FLT_ROUNDED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,116,71,10 + CONTROL "",IDC_FLT_BORDERCOLOUR,"ColourPicker",WS_TABSTOP,129,101,22,10 + RTEXT "Colour",IDC_STATIC,90,102,34,8 + EDITTEXT IDC_FLT_RADIUS,129,115,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_FLT_RADIUSSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,148,112,11,14 + RTEXT "Radius",IDC_STATIC,90,117,34,8 + CONTROL "Fill with contact list background color",IDC_FLT_FILLSTD, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,77,176,11 + GROUPBOX "Tooltips",IDC_STATIC,3,138,307,40 + CONTROL "Show tooltips",IDC_FLT_SHOWTOOLTIPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,150,90,10 + RTEXT "Hover time",IDC_STATIC,115,151,90,8 + EDITTEXT IDC_FLT_HOVERTIME,211,148,37,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_FLT_HOVERTIMESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,237,144,10,14 + CONTROL "Use default",IDC_FLT_DEFHOVERTIME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,211,164,96,10 + LTEXT "ms",IDC_STATIC,254,151,42,8 +END + +IDD_CLNABOUT DIALOGEX 0, 0, 228, 140 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_CONTROLPARENT +CAPTION "About CList Nicer+" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + LTEXT "",IDC_WHITERECT,0,0,228,116 + DEFPUSHBUTTON "OK",IDOK,168,123,55,14 + LTEXT "Clist Nicer+",IDC_CLNICER,5,7,150,15 + CTEXT "Copyright © 2004-2010 by the Miranda IM project. More detailed copyright information can be found in the included README file.\n\nThis software is distributed and licensed under the terms of the GNU General Public License V2 or any later version.",IDC_COPYRIGHT,5,39,217,47 + ICON 0,IDC_LOGO,201,2,20,20 + LTEXT "Version",IDC_VERSION,5,19,150,15 + CTEXT "build time",IDC_BUILDTIME,37,105,150,11 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,117,228,1 + CONTROL "Support and latest version information",IDC_SUPPORT, + "Hyperlink",WS_TABSTOP | 0x1,18,91,192,12 +END + +IDD_DELETECONTACT DIALOGEX 0, 0, 284, 90 +STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_CONTROLPARENT +CAPTION "Delete Contact" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "No",IDNO,162,38,65,14 + PUSHBUTTON "Yes",IDYES,54,38,65,14 + CONTROL "Hide from list only, in order to keep their history and ignore/visibility settings",IDC_HIDE, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,65,270,9 + LTEXT "Use Options->Ignore (expert mode) to unhide contacts.",IDC_STATIC,20,78,257,8 + CONTROL "Are you sure you want to delete %s?",IDC_TOPLINE,"Static",SS_SIMPLE | SS_NOPREFIX | WS_GROUP,7,7,270,8 + LTEXT "This will erase all history and settings for this contact!",IDC_STATIC,7,18,239,14 +END + +IDD_OPT_DSPPROFILES DIALOGEX 0, 0, 312, 247 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + LISTBOX IDC_PROFILELIST,5,11,68,92,LBS_SORT | LBS_NOINTEGRALHEIGHT | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP + CONTROL "",IDC_DSP_ADD,"MButtonClass",NOT WS_VISIBLE | WS_TABSTOP,5,109,68,15,WS_EX_NOACTIVATE | 0x10000000L + CONTROL "",IDC_DSP_DELETE,"MButtonClass",NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,5,128,68,15,WS_EX_NOACTIVATE | 0x10000000L + CONTROL "",IDC_DSP_RENAME,"MButtonClass",NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,5,147,68,15,WS_EX_NOACTIVATE | 0x10000000L + CONTROL "",IDC_OPTIONSTAB,"SysTabControl32",WS_TABSTOP,41,1,230,222 + CONTROL "",IDC_DSP_APPLY,"MButtonClass",NOT WS_VISIBLE | WS_TABSTOP,218,229,89,15,WS_EX_NOACTIVATE | 0x10000000L + LISTBOX IDC_CLASSLIST,5,184,68,55,LBS_SORT | LBS_NOINTEGRALHEIGHT | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP +END + +IDD_OPTIONSDIALOG DIALOGEX 0, 0, 312, 247 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + CONTROL "",IDC_OPTIONSTAB,"SysTabControl32",WS_TABSTOP,1,1,310,245,WS_EX_ACCEPTFILES +END + +IDD_OPT_CLIST DIALOGEX 0, 0, 305, 226 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "Contact List",IDC_STCLISTGROUP,1,0,163,91 + CONTROL "Hide offline users",IDC_HIDEOFFLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,12,147,10 + CONTROL "Hide empty groups",IDC_HIDEEMPTYGROUPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,25,147,10 + CONTROL "Disable groups",IDC_DISABLEGROUPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,38,147,10 + CONTROL "Ask before deleting contacts",IDC_CONFIRMDELETE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,51,147,10 + CONTROL "Disable icon blinking",IDC_ICONBLINK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,64,147,10 + CONTROL "Apply last active view mode ",IDC_APPLYLASTVIEWMODE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,77,147,10 + GROUPBOX "Contact list layout",IDC_STATIC,169,0,133,91 + CONTROL "Show menu and status buttons",IDC_SHOWBOTTOMBUTTONS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,176,25,121,10 + CONTROL "Draw sunken edge",IDC_CLISTSUNKEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,176,38,121,10 + GROUPBOX "System tray icon",IDC_STATIC,1,91,163,63 + CONTROL "Single click interface",IDC_ONECLK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,101,147,10 + CONTROL "Always show status in tooltip",IDC_ALWAYSSTATUS,"Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,10,113,147,10 + CONTROL "Disable icon blinking",IDC_DISABLEBLINK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,125,147,10 + EDITTEXT IDC_BLINKTIME,69,136,57,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin5",IDC_BLINKSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,114,137,11,16 + LTEXT "ms",IDC_STATIC,130,138,24,8 + GROUPBOX "Event area",IDC_STATIC,169,91,133,63 + LTEXT "Set base visiblity on the frames menu",IDC_STATIC,176,102,121,15 + CONTROL "Auto mode",IDC_EVENTAREAAUTOHIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,176,125,121,10 + CONTROL "Draw sunken edge",IDC_EVENTAREASUNKEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,176,136,121,10 + GROUPBOX "System tray icon when using multiple protocols",IDC_STATIC,1,154,302,71 + CONTROL "Show",IDC_DONTCYCLE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,10,166,92,10 + COMBOBOX IDC_PRIMARYSTATUS,107,165,78,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "icon when statuses differ",IDC_STATIC,189,167,108,8,NOT WS_GROUP + CONTROL "Cycle icons every",IDC_CYCLE,"Button",BS_AUTORADIOBUTTON,10,180,92,10 + EDITTEXT IDC_CYCLETIME,107,180,30,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_CYCLETIMESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,127,181,10,14 + LTEXT "seconds, when statuses differ",IDC_STATIC,145,182,150,8,NOT WS_GROUP + CONTROL "Show multiple icons",IDC_MULTITRAY,"Button",BS_AUTORADIOBUTTON,10,194,92,10 + CONTROL "Only when statuses differ",IDC_ALWAYSMULTI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,194,186,10 + CONTROL "Do not show system tray icon tooltips on mouse over",IDC_NOTRAYINFOTIPS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,208,284,12 +END + +IDD_OPT_DSPGROUPS DIALOGEX 0, 0, 227, 205 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "Groups",IDC_STATIC,1,0,224,109 + CONTROL "Draw a line alongside group names",IDC_LINEWITHGROUPS, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,8,200,12 + CONTROL "Show number of contacts in a group",IDC_SHOWGROUPCOUNTS, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,20,200,12 + CONTROL "Hide numbers when all offline",IDC_HIDECOUNTSWHENEMPTY, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,23,32,193,12 + CONTROL "Sort groups alphabetically",IDC_SORTGROUPSALPHA,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,44,200,12 + CONTROL "Quicksearch in open groups only",IDC_QUICKSEARCHVISONLY, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,56,200,12 + CONTROL "No expand/collapse icon",IDC_NOGROUPICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,68,200,12 + CONTROL "Center groupnames horizontally",IDC_CENTERGROUPNAMES, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,80,200,12 + LTEXT "Alignment",IDC_STATIC,11,95,53,10 + COMBOBOX IDC_GROUPALIGN,68,93,73,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Margins (left/right)",IDC_STATIC,11,121,113,8 + EDITTEXT IDC_LEFTMARGIN,139,119,31,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_LEFTMARGINSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,158,119,11,14 + EDITTEXT IDC_RIGHTMARGIN,176,119,31,12,ES_RIGHT | ES_NUMBER + CONTROL "",IDC_RIGHTMARGINSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,208,119,11,14 + LTEXT "Row gap",IDC_STATIC,11,135,156,11 + EDITTEXT IDC_ROWGAP,176,133,31,12,ES_RIGHT | ES_NUMBER + CONTROL "",IDC_ROWGAPSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,208,133,11,14 + LTEXT "Minimum row height:",IDC_STATIC,11,149,156,8 + EDITTEXT IDC_ROWHEIGHT,176,147,31,12,ES_RIGHT | ES_NUMBER + CONTROL "",IDC_ROWHEIGHTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,208,147,11,14 + LTEXT "Group row height",IDC_STATIC,11,161,156,8 + EDITTEXT IDC_GROUPROWHEIGHT,176,161,31,12,ES_RIGHT | ES_NUMBER + CONTROL "",IDC_GROUPROWHEIGHTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,208,161,11,14 + LTEXT "Indent groups by:",IDC_STATIC,11,175,156,8 + EDITTEXT IDC_GROUPINDENT,176,175,31,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_GROUPINDENTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,208,175,11,14 + LTEXT "Inner Row vertical padding",IDC_STATIC,11,189,156,9 + EDITTEXT IDC_AVATARPADDING,176,189,31,12,ES_RIGHT | ES_AUTOHSCROLL + CONTROL "",IDC_AVATARPADDINGSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,208,189,11,14 + GROUPBOX "Margins and spacing",IDC_STATIC,1,111,224,93 +END + +IDD_OPT_DSPITEMS DIALOGEX 0, 0, 227, 205 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "Contact List Sorting",IDC_STATIC,1,0,142,97,WS_GROUP + LTEXT "First by",IDC_STATIC,5,15,57,9 + COMBOBOX IDC_SORTPRIMARY,65,12,73,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Then by",IDC_STATIC,5,29,57,9 + COMBOBOX IDC_SORTTHEN,65,27,73,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Finally by",IDC_STATIC,5,43,57,9 + COMBOBOX IDC_SORTFINALLY,65,42,73,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Move events to the top of list\nor group",IDC_EVENTSONTOP, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,5,61,130,16 + CONTROL "Do not separate offline contacts",IDC_DONTSEPARATE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,80,132,10 + LTEXT "Hide as offline",IDC_STATIC,151,1,73,8 + CONTROL "Tree1",IDC_HIDEOFFLINEOPTS,"SysTreeView32",TVS_HASBUTTONS | TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | TVS_CHECKBOXES | TVS_NONEVENHEIGHT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,147,11,77,85 + LTEXT "Right align contacts",IDC_STATIC,5,104,130,10 + COMBOBOX IDC_CLISTALIGN,147,102,77,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP +END + +IDD_OPT_DSPADVANCED DIALOGEX 0, 0, 227, 205 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "Avatars",IDC_STATIC,1,0,224,109 + CONTROL "Show avatars",IDC_CLISTAVATARS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,11,125,10 + LTEXT "Height",IDC_STATIC,137,11,32,11 + EDITTEXT IDC_AVATARHEIGHT,180,9,31,12,ES_AUTOHSCROLL + CONTROL "",IDC_AVATARSIZESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,200,9,11,15 + CONTROL "Draw a border around avatars",IDC_AVATARSBORDER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,25,165,10 + CONTROL "",IDC_AVATARBORDERCLR,"ColourPicker",WS_TABSTOP,180,24,22,10 + CONTROL "Rounded avatars",IDC_AVATARSROUNDED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,39,125,10 + LTEXT "Radius",IDC_STATIC,137,39,32,9 + EDITTEXT IDC_RADIUS,180,37,31,12,ES_AUTOHSCROLL + CONTROL "",IDC_RADIUSSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,200,37,11,15 + CONTROL "Always align icons and text for missing avatars",IDC_ALWAYSALIGNNICK, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,65,213,10 + LTEXT "Avatar alignment",IDC_STATIC,8,80,103,11 + COMBOBOX IDC_ALIGNMENT,119,78,102,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Don't request avatars for offline contacts",IDC_NOAVATARSOFFLINE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,94,213,10 + GROUPBOX "Second text line",IDC_STATIC,1,110,224,94 + CONTROL "Display status message when available",IDC_SHOWSTATUSMSG, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,122,213,10 + LTEXT "Show second text line:",IDC_STATIC,8,137,103,9 + COMBOBOX IDC_DUALROWMODE,119,135,102,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Show contacts local time",IDC_SHOWLOCALTIME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,150,212,10 + CONTROL "Only when timezone differs",IDC_SHOWLOCALTIMEONLYWHENDIFFERENT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,164,201,10 +END + +IDD_OPT_XICONS DIALOGEX 0, 0, 227, 205 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "Extra icons (drag items to reorder them)",IDC_STATIC,1,100,224,87 + EDITTEXT IDC_EXICONSCALE,141,192,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_EXICONSCALESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,160,187,12,14 + LTEXT "Extra icon size",IDC_STATIC,51,193,87,11 + CONTROL "Show status icons",IDC_SHOWSTATUSICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,10,106,10 + GROUPBOX "Icons",IDC_STATIC,1,0,224,99 + CONTROL "Show visibility icons",IDC_SHOWVISIBILITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,22,214,10 + CONTROL "When possible, draw status icons in avatar space",IDC_SELECTIVEICONS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,34,214,10 + CONTROL "Centered when possible",IDC_STATUSICONSCENTERED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,10,100,11 + CONTROL "Use metacontact protocol icons instead of subcontacts",IDC_SHOWMETA, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,46,214,10 + CONTROL "Use Overlay icons on avatars",IDC_OVERLAYICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,58,214,10 + CONTROL "Dim idle contacts",IDC_IDLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,70,214,10 + CONTROL "Replace status icons with xStatus",IDC_XSTATUSASSTATUS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,82,214,10 + CONTROL "",IDC_EXTRAORDER,"SysTreeView32",TVS_NOTOOLTIPS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,22,111,182,56 + PUSHBUTTON "Reset order and visibility to default",IDC_RESETXICONS,5,169,216,15 +END + +IDD_OPT_CLUI DIALOGEX 0, 0, 305, 226 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "Window",IDC_STWINDOWGROUP,1,0,302,165 + CONTROL "Always on top",IDC_ONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,11,126,10 + CONTROL "Show menu bar",IDC_SHOWMAINMENU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,35,126,10 + CONTROL "Easy move",IDC_CLIENTDRAG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,47,126,10 + CONTROL "Rounded border",IDC_ROUNDEDBORDER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,59,126,10 + LTEXT "Border",IDC_STATIC,11,75,48,9 + COMBOBOX IDC_BORDERSTYLE,62,72,64,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + LTEXT "Title bar text:",IDC_STATIC,11,93,51,8 + EDITTEXT IDC_TITLETEXT,62,91,64,12,ES_AUTOHSCROLL + CONTROL "Show drop shadow (restart required)",IDC_DROPSHADOW, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,108,138,10 + CONTROL "Pin to desktop",IDC_ONDESKTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,120,128,10 + CONTROL "Hide contact list after it has been idle for",IDC_AUTOHIDE, + "Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,139,11,160,10 + EDITTEXT IDC_HIDETIME,150,21,38,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_HIDETIMESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,178,21,10,14 + LTEXT "seconds",IDC_STATIC01,190,23,56,8 + CONTROL "Automatically resize window to height of list",IDC_AUTOSIZE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,139,35,160,10 + LTEXT "maximum",IDC_STATIC21,150,47,42,8 + EDITTEXT IDC_MAXSIZEHEIGHT,194,45,37,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "Spin1",IDC_MAXSIZESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,221,45,10,14 + LTEXT "% of screen",IDC_STATIC22,233,47,64,8 + CONTROL "Size upwards",IDC_AUTOSIZEUPWARD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,59,149,10 + CONTROL "If window is partially covered, bring to front instead of hiding",IDC_BRINGTOFRONT, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,139,76,160,16 + LTEXT "Client margins",IDC_STATIC,11,144,50,10 + EDITTEXT IDC_CLEFT,64,142,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_CLEFTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,84,139,10,14 + EDITTEXT IDC_CTOP,95,136,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_CTOPSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,115,133,10,14 + EDITTEXT IDC_CBOTTOM,95,148,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_CBOTTOMSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,115,146,10,14 + EDITTEXT IDC_CRIGHT,127,142,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_CRIGHTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,149,139,10,14 + LTEXT "Embedded frames border",IDC_STATIC,174,121,84,12 + CONTROL "",IDC_CLUIFRAMESBDR,"ColourPicker",WS_TABSTOP,264,119,29,12 + LTEXT "Clip border by",IDC_STATIC,173,138,67,10 + EDITTEXT IDC_CLIPBORDER,264,135,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_CLIPBORDERSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,284,134,10,14 + LTEXT "Gap between frames",IDC_STATIC,173,151,87,11 + EDITTEXT IDC_FRAMEGAP,264,149,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_FRAMEGAPSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,284,148,10,14 + GROUPBOX "Translucency options (Windows 2000/XP only)",IDC_STATIC,1,168,302,56 + CONTROL "Transparent contact list",IDC_TRANSPARENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,181,149,9 + LTEXT "Inactive opacity:",IDC_STATIC11,11,191,75,8 + CONTROL "Slider2",IDC_TRANSINACTIVE,"msctls_trackbar32",TBS_TOP | TBS_NOTICKS | WS_TABSTOP,93,190,34,11 + LTEXT "000%",IDC_INACTIVEPERC,130,191,24,8,SS_NOPREFIX + LTEXT "Active opacity:",IDC_STATIC12,11,206,75,8 + CONTROL "Slider2",IDC_TRANSACTIVE,"msctls_trackbar32",TBS_TOP | TBS_NOTICKS | WS_TABSTOP,93,206,34,11 + LTEXT "000%",IDC_ACTIVEPERC,130,207,24,8,SS_NOPREFIX + CONTROL "Fade contact list in/out",IDC_FADEINOUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,190,139,10 + CONTROL "Fully transparent (like TweakUI)",IDC_FULLTRANSPARENT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,205,139,10 + CONTROL "Always Hide On Taskbar",IDC_ALWAYSHIDEONTASKBAR,"Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,139,94,158,10 +END + +IDD_OPT_CLC DIALOGEX 0, 0, 305, 226 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "Items",IDC_STATIC,1,0,302,110 + CONTROL "Show divider between online and offline contacts",IDC_DIVIDERONOFF, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,12,282,10 + CONTROL "Hot track items as mouse passes over",IDC_TRACKSELECT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,23,282,10 + CONTROL "Disable drag and drop of items",IDC_DISABLEDRAGDROP, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,34,282,10 + CONTROL "Disable rename of items by clicking twice",IDC_NOTEDITLABELS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,45,282,10 + CONTROL "Show selection even when list is not focused",IDC_SHOWSELALWAYS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,56,282,10 + CONTROL "Make selection highlight translucent",IDC_NOTNOTRANSLUCENTSEL, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,67,282,10 + CONTROL "Use full row for selection and hottracking",IDC_FULLROWSELECT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,78,282,10 + CONTROL "Double click on avatar opens userinfo",IDC_DBLCLKAVATARS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,98,282,10 + GROUPBOX "Visual",IDC_STATIC,0,111,303,113 + CONTROL "Scroll list smoothly",IDC_NOTNOSMOOTHSCROLLING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,123,282,10 + LTEXT "Time:",IDC_STATIC11,21,137,39,8 + EDITTEXT IDC_SMOOTHTIME,63,135,45,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_SMOOTHTIMESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,96,138,11,14 + LTEXT "milliseconds",IDC_STATIC12,114,137,73,8,SS_CENTERIMAGE + CONTROL "Hide vertical scroll bar",IDC_NOSCROLLBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,152,282,10 + CONTROL "Grey out entire list when:",IDC_GREYOUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,168,282,10 + CONTROL "Tree1",IDC_GREYOUTOPTS,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | TVS_NONEVENHEIGHT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,11,181,182,39 +END + +IDD_OPT_CLCBKG DIALOGEX 0, 0, 305, 226 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | DS_CENTER | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Contact List Background",IDC_STATIC,1,4,302,177 + CONTROL "Use Windows colours",IDC_WINCOLOUR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,20,282,10 + CONTROL "",IDC_BKGCOLOUR,"ColourPicker",WS_TABSTOP,22,34,22,10 + LTEXT "Background colour",IDC_STATIC,48,35,246,8,NOT WS_GROUP + CONTROL "Use background image",IDC_BITMAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,57,282,10 + EDITTEXT IDC_FILENAME,22,71,184,12,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_BROWSE,208,72,15,11 + CONTROL "Stretch to width",IDC_STRETCHH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,86,117,10 + CONTROL "Stretch to height",IDC_STRETCHV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,86,153,10 + CONTROL "Tile horizontally",IDC_TILEH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,100,118,10 + CONTROL "Tile vertically",IDC_TILEV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,143,100,156,10 + CONTROL "Scroll with text",IDC_SCROLL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,113,115,10 + CONTROL "Stretch proportionally",IDC_PROPORTIONAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,143,113,155,10 + CONTROL "Use these settings to skin the entire background",IDC_SKINMODE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,132,282,11 + LTEXT "If you enable this, the background settings will affect the entire contact list frame.",IDC_STATIC,23,145,270,28 +END + +IDD_OPT_SBAR DIALOGEX 0, 0, 303, 226 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | DS_CENTER | WS_CHILD +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Status Bar",IDC_STATIC,3,4,297,214 + CONTROL "Show status bar",IDC_SHOWSBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,17,275,10 + CONTROL "Show icons",IDC_SHOWICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,33,265,10 + CONTROL "Show protocol names",IDC_SHOWPROTO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,48,265,10 + CONTROL "Show status text",IDC_SHOWSTATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,63,265,10 + CONTROL "Right click opens status menu",IDC_RIGHTSTATUS,"Button",BS_AUTORADIOBUTTON,25,160,265,10 + CONTROL "Right click opens Miranda IM menu",IDC_RIGHTMIRANDA, + "Button",BS_AUTORADIOBUTTON,25,147,265,10 + CONTROL "Make sections equal width",IDC_EQUALSECTIONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,78,265,10 + CONTROL "Show bevels on panels",IDC_SBPANELBEVEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,93,265,10 + CONTROL "Show resize grip indicator",IDC_SHOWGRIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,108,265,10 + CONTROL "Draw background skin",IDC_SKINBACKGROUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,123,265,10 + CONTROL "Show ICQ extended status icons",IDC_SHOWXSTATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,186,275,9 + CONTROL "Mark protocols locked from global status changes",IDC_MARKLOCKED, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,200,275,9 +END + +IDD_OPT_VIEWMODES DIALOGEX 0, 0, 309, 295 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + CONTROL "",IDC_TAB,"SysTabControl32",0x0,4,4,301,264 + LTEXT "",IDC_STATIC7,6,22,297,244 + GROUPBOX "Available view modes",IDC_STATIC1,9,20,158,85 + LISTBOX IDC_VIEWMODES,12,30,123,55,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP,WS_EX_CLIENTEDGE + GROUPBOX "Include protocols",IDC_STATIC2,171,20,130,85 + CONTROL "",IDC_PROTOCOLS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,175,30,121,72 + PUSHBUTTON "+",IDC_ADDVIEWMODE,142,39,18,16 + PUSHBUTTON "-",IDC_DELETEVIEWMODE,142,60,18,16 + LTEXT "New",IDC_STATIC5,15,91,38,11,0,WS_EX_TRANSPARENT + EDITTEXT IDC_NEWVIEMODE,59,88,76,13,ES_AUTOHSCROLL + GROUPBOX "Include groups",IDC_STATIC3,8,105,159,89,0,WS_EX_TRANSPARENT + CONTROL "",IDC_GROUPS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,12,116,122,73 + GROUPBOX "Include status modes",IDC_STATIC4,171,105,130,89,0,WS_EX_TRANSPARENT + CONTROL "",IDC_STATUSMODES,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,175,116,121,73 + PUSHBUTTON "Ok",IDOK,106,275,62,16 + PUSHBUTTON "Cancel",IDCANCEL,172,275,62,16 + PUSHBUTTON "Apply",IDC_APPLY,242,275,62,16 + CONTROL "",IDC_CLIST,"CListControl",0x24a,12,31,286,199,WS_EX_CLIENTEDGE + GROUPBOX "Sticky contacts",IDC_STATIC9,8,20,293,215 + PUSHBUTTON "Clear all",IDC_CLEARALL,13,241,92,14 + LTEXT "Using the contact list on the left side, you can select contacts which will be ""sticky"" for this view mode. These contacts will ignore the standard filter rules and only use the status mode filter below.",IDC_STATIC10,174,50,124,72,NOT WS_VISIBLE + LTEXT "Protocol",IDC_STATIC12,31,204,49,12 + COMBOBOX IDC_PROTOGROUPOP,85,202,37,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CTEXT "Group",IDC_STATIC13,129,204,44,12 + COMBOBOX IDC_GROUPSTATUSOP,177,202,37,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + RTEXT "Status mode",IDC_STATIC14,221,204,54,12 + CONTROL "Automatically clear this view mode after",IDC_AUTOCLEAR, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,244,172,11 + EDITTEXT IDC_AUTOCLEARVAL,222,243,29,12,ES_AUTOHSCROLL + CONTROL "",IDC_AUTOCLEARSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,245,243,8,13 + LTEXT "seconds",IDC_STATIC15,262,244,28,12 + GROUPBOX "View mode options",IDC_STATIC16,8,195,293,68 + LTEXT "Editing view mode",IDC_CURVIEWMODE2,119,245,178,14,NOT WS_VISIBLE + CONTROL "Last message ",IDC_LASTMSG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,227,86,11 + COMBOBOX IDC_LASTMESSAGEOP,106,227,81,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_LASTMSGVALUE,193,227,31,13,ES_AUTOHSCROLL + COMBOBOX IDC_LASTMESSAGEUNIT,229,227,68,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP +END + +IDD_OPT_SKIN DIALOGEX 0, 0, 303, 200 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + LTEXT "Per contact skins:",IDC_STATIC,9,188,71,12,WS_DISABLED + EDITTEXT IDC_SKINFILE,70,186,135,13,ES_AUTOHSCROLL | WS_DISABLED + PUSHBUTTON "...",IDC_SKINFILESELECT,209,185,22,12,WS_DISABLED + PUSHBUTTON "< Reload",IDC_RELOAD,231,185,71,12,WS_DISABLED + GROUPBOX "Contact list skin",IDC_STATIC,3,6,297,68 + EDITTEXT IDC_SKINFILENAME,11,19,256,14,ES_AUTOHSCROLL | ES_READONLY + PUSHBUTTON "...",IDC_SELECTSKINFILE,271,19,25,13 + CONTROL "Load this skin on startup",IDC_USESKIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,40,188,10 + PUSHBUTTON "Apply skin now",IDC_RELOADSKIN,10,54,90,14 + PUSHBUTTON "Unload skin",IDC_UNLOAD,206,54,90,14 + CONTROL "Make selection shape equal to selected item",IDC_EQUALSELECTION, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,108,178,10 + CONTROL "Blend selection with background",IDC_SELBLEND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,119,177,10 + CONTROL "Automatically fill background with wallpaper (tiled wallpaper only)",IDC_FILLWALLPAPER, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,130,286,10 + CONTROL "Apply group indent values to background drawing",IDC_APPLYINDENTBG, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,141,286,10 + CONTROL "Use per protocol/contact skinning",IDC_USEPERPROTO, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,86,155,10 + CONTROL "Protocol skins override status text colors",IDC_OVERRIDEPERSTATUSCOLOR, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,97,155,10 + CONTROL "Set all buttons to skinned mode",IDC_SETALLBUTTONSKINNED, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,86,128,10 + CONTROL "Use fast gradient drawing",IDC_FASTGRADIENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,97,130,10 + EDITTEXT IDC_CORNERRAD,256,110,29,12,ES_AUTOHSCROLL + CONTROL "",IDC_CORNERSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,273,112,12,13 + LTEXT "Corner radius",IDC_STATIC,193,112,59,10 + GROUPBOX "Skin options",IDC_STATIC,3,77,297,105 + EDITTEXT IDC_GRPTOPPADDING,80,163,29,12,ES_AUTOHSCROLL + CONTROL "",IDC_GRPPADDINGSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,96,164,11,13 + LTEXT "Group top padding",IDC_STATIC,7,164,68,10 + EDITTEXT IDC_LASTITEMPADDING,258,163,29,12,ES_AUTOHSCROLL + CONTROL "",IDC_LASTITEMPADDINGSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,274,164,11,13 + LTEXT "Frame titlebar height",IDC_STATIC,149,164,85,10 + CONTROL "Ignore selection for groups",IDC_IGNORESELFORGROUPS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,152,286,10 +END + +IDD_OPT DIALOGEX 0, 0, 312, 247 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + CONTROL "",IDC_OPTIONSTAB,"SysTabControl32",WS_TABSTOP,1,1,310,226,WS_EX_ACCEPTFILES + PUSHBUTTON "Load from skin file",IDC_IMPORT,167,229,125,15 + PUSHBUTTON "Export to skin file",IDC_EXPORT,19,229,125,15 +END + +IDD_QUICKIGNORE DIALOGEX 0, 0, 357, 247 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Ignore these events",IDC_STATIC,7,3,197,85 + CONTROL "Messages",IDC_IGN_MSGEVENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,14,106,11 + CONTROL "Incoming file transfers",IDC_IGN_FILEEVENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,26,106,11 + CONTROL "URL events",IDC_IGN_URLEVENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,38,106,11 + CONTROL "Suppress auth requests",IDC_IGN_AUTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,50,182,11 + CONTROL "Suppress added notifications",IDC_IGN_ADD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,62,182,11 + CONTROL "Suppress online notifications",IDC_IGN_ONLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,74,182,11 + PUSHBUTTON "Ignore all",IDC_IGN_ALL,129,11,71,15 + PUSHBUTTON "Ignore none",IDC_IGN_NONE,129,33,71,15 + GROUPBOX "Visibility",IDC_STATIC,7,89,197,35 + CONTROL "Appear always online",IDC_IGN_ALWAYSONLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,98,182,11 + CONTROL "Appear always offline (block contact)",IDC_IGN_ALWAYSOFFLINE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,111,182,11 + GROUPBOX "Other",IDC_STATIC,7,125,197,96 + CONTROL "Hide this contact from the list",IDC_HIDECONTACT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,132,182,14 + LTEXT "To show a previously hidden contact, navigate to Options->Events->Ignore, search the contact in the list and tick the checkbox next to its name.",IDC_STATIC,18,146,182,34 + GROUPBOX "Display options",IDC_STATIC,209,3,143,218 + CONTROL "Show contact with priority",IDC_IGN_PRIORITY,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,219,13,127,11 + LTEXT "Show Avatar:",IDC_STATIC,225,28,94,11 + COMBOBOX IDC_AVATARDISPMODE,219,38,127,56,CBS_DROPDOWNLIST | CBS_SORT | WS_DISABLED | WS_VSCROLL | WS_TABSTOP + LTEXT "Show 2nd line:",IDC_STATIC,225,54,94,11 + COMBOBOX IDC_SECONDLINEMODE,219,64,127,56,CBS_DROPDOWNLIST | CBS_SORT | WS_DISABLED | WS_VSCROLL | WS_TABSTOP + CONTROL "",IDC_IGN_ADDPERMANENTLY,"MButtonClass",WS_TABSTOP,95,202,106,15,WS_EX_NOACTIVATE | 0x10000000L + PUSHBUTTON "Ok",IDOK,211,228,65,14 + PUSHBUTTON "Cancel",IDCANCEL,284,228,65,14 + CONTROL "Draw overlay icon on avatar",IDC_OVERLAYICON,"Button",BS_AUTO3STATE | WS_TABSTOP,219,82,127,10 + CONTROL "Show local time",IDC_SHOWLOCALTIME1,"Button",BS_AUTO3STATE | WS_TABSTOP,219,94,127,10 + GROUPBOX "Extra icons",IDC_STATIC,213,118,134,80 + CONTROL "Client",IDC_EXTRA_ICON_CLIENT,"Button",BS_AUTO3STATE | WS_TABSTOP,219,129,64,11 + CONTROL "E-Mail",IDC_EXTRA_ICON_EMAIL,"Button",BS_AUTO3STATE | WS_TABSTOP,219,140,64,11 + CONTROL "Homepage",IDC_EXTRA_ICON_WEB,"Button",BS_AUTO3STATE | WS_TABSTOP,219,151,64,11 + CONTROL "Telephone",IDC_EXTRA_ICON_SMS,"Button",BS_AUTO3STATE | WS_TABSTOP,219,162,64,11 + CONTROL "Reserved",IDC_EXTRA_ICON_RES0,"Button",BS_AUTO3STATE | WS_TABSTOP,219,173,64,11 + CONTROL "Advanced #1",IDC_EXTRA_ICON_ADV1,"Button",BS_AUTO3STATE | WS_TABSTOP,288,129,55,11 + CONTROL "Advanced #2",IDC_EXTRA_ICON_ADV2,"Button",BS_AUTO3STATE | WS_TABSTOP,288,140,55,11 + CONTROL "Advanced #3",IDC_EXTRA_ICON_ADV3,"Button",BS_AUTO3STATE | WS_TABSTOP,288,151,55,11 + CONTROL "Advanced #4",IDC_EXTRA_ICON_ADV4,"Button",BS_AUTO3STATE | WS_TABSTOP,288,162,55,11 + CONTROL "Reserved #1",IDC_EXTRA_ICON_RES1,"Button",BS_AUTO3STATE | WS_TABSTOP,288,173,55,11 + CONTROL "Reserved #2",IDC_EXTRA_ICON_RES2,"Button",BS_AUTO3STATE | WS_TABSTOP,288,184,55,11 + CONTROL "Show visibility icon",IDC_SHOWVISIBILITY,"Button",BS_AUTO3STATE | WS_TABSTOP,219,107,127,10 + CONTROL "",IDC_DSP_LOADDEFAULT,"MButtonClass",WS_TABSTOP,213,202,135,15,WS_EX_NOACTIVATE | 0x10000000L +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "..\\src\\include\\resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include \r\n" + "#include \r\n" + "#include \r\n" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_NOTICK ICON "notick.ico" +IDI_TICK ICON "notick1.ico" +IDI_RENAME ICON "rename.ico" +IDI_DELETE ICON "delete.ico" +IDI_CLVM_OPTIONS ICON "options_clvm.ico" +IDI_CLVM_SELECT ICON "arrow-down.ico" +IDI_BLANK ICON "blank.ico" +IDI_OVL_OFFLINE ICON "overlay/offline.ico" +IDI_OVL_ONLINE ICON "overlay/online.ico" +IDI_OVL_AWAY ICON "overlay/away.ico" +IDI_OVL_DND ICON "overlay/dnd.ico" +IDI_OVL_NA ICON "overlay/na.ico" +IDI_OVL_OCCUPIED ICON "overlay/occupied.ico" +IDI_OVL_FREEFORCHAT ICON "overlay/chat.ico" +IDI_OVL_INVISIBLE ICON "overlay/invisible.ico" +IDI_OVL_ONTHEPHONE ICON "overlay/phone.ico" +IDI_OVL_OUTTOLUNCH ICON "overlay/lunch.ico" +IDI_HIDEOFFLINE ICON "online.ico" +IDI_HIDEGROUPS ICON "groups.ico" +IDI_SOUNDSON ICON "sounds_on.ico" +IDI_FINDANDADD ICON "find.ico" +IDI_TBOPTIONS ICON "options.ico" +IDI_MINIMIZE ICON "minimize.ico" +IDI_SOUNDSOFF ICON "sounds_off.ico" +IDI_TABSRMMSESSIONLIST ICON "slist.ico" +IDI_TABSRMMMENU ICON "tabsrmm_menu.ico" +IDI_CLVISIBLE ICON "visible.ico" +IDI_CLINVISIBLE ICON "invisible.ico" +IDI_PROTOCONNECTING ICON "connecting.ico" +IDI_TBTOPMENU ICON "menu.ico" +IDI_TBACCOUNTS ICON "accounts.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Cursor +// + +IDC_HYPERLINKHAND CURSOR "hyperlin.cur" +IDC_DROP CURSOR "DRAGCOPY.CUR" +IDC_DROPUSER CURSOR "dropuser.cur" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_CLISTMENU MENU +BEGIN + POPUP "&¤" + BEGIN + MENUITEM SEPARATOR + MENUITEM "E&xit", ID_ICQ_EXIT + END + POPUP "&Status" + BEGIN + MENUITEM "&Offline\tCtrl+0", ID_STATUS_OFFLINE, CHECKED + MENUITEM "On&line\tCtrl+1", ID_STATUS_ONLINE + MENUITEM "&Away\tCtrl+2", ID_STATUS_AWAY + MENUITEM "&NA\tCtrl+3", ID_STATUS_NA + MENUITEM "Occ&upied\tCtrl+4", ID_STATUS_OCCUPIED + MENUITEM "&DND\tCtrl+5", ID_STATUS_DND + MENUITEM "&Free for chat\tCtrl+6", ID_STATUS_FREECHAT + MENUITEM "&Invisible\tCtrl+7", ID_STATUS_INVISIBLE + MENUITEM "On the &Phone\tCtrl+8", ID_STATUS_ONTHEPHONE + MENUITEM "Out to &Lunch\tCtrl+9", ID_STATUS_OUTTOLUNCH + END +END + +IDR_CONTEXT MENU +BEGIN + POPUP "Tray" + BEGIN + MENUITEM "&Hide/Show", 40038 + MENUITEM SEPARATOR + MENUITEM "E&xit", ID_TRAY_EXIT + END + POPUP "Nowhere" + BEGIN + MENUITEM "&New Group", POPUP_NEWGROUP + MENUITEM SEPARATOR + MENUITEM "&Hide Offline Users", POPUP_HIDEOFFLINE + MENUITEM "Hide &Offline Users out here", POPUP_HIDEOFFLINEROOT + MENUITEM "Hide &Empty Groups", POPUP_HIDEEMPTYGROUPS + MENUITEM "Disable &Groups", POPUP_DISABLEGROUPS + MENUITEM SEPARATOR + MENUITEM SEPARATOR + MENUITEM "Hide Miranda", POPUP_HIDEMIRANDA + END + POPUP "Group" + BEGIN + MENUITEM "&New Subgroup", POPUP_NEWSUBGROUP + MENUITEM "&Hide Offline Users in here", POPUP_GROUPHIDEOFFLINE + MENUITEM SEPARATOR + MENUITEM "&Rename Group", POPUP_RENAMEGROUP + MENUITEM "&Delete Group", POPUP_DELETEGROUP + MENUITEM SEPARATOR + MENUITEM "Move marked Contacts to this Group", POPUP_MOVEMARKEDHERE, GRAYED + END + POPUP "Appearance" + BEGIN + MENUITEM "Show Status Icons", POPUP_SHOWSTATUSICONS + MENUITEM "Show Visibility Icons", POPUP_VISIBILITY + MENUITEM "Show Metacontact proto Icons", POPUP_SHOWMETAICONS + MENUITEM SEPARATOR + MENUITEM "Show additional Buttons", POPUP_BUTTONS + MENUITEM "Draw sunken Frame", POPUP_FRAME + MENUITEM SEPARATOR + MENUITEM "Use Status Floater", POPUP_FLOATER + MENUITEM "Auto-Hide Status Floater", POPUP_FLOATER_AUTOHIDE + MENUITEM "Show Event Area in Floater", POPUP_FLOATER_EVENTS + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_OPT_XICONS, DIALOG + BEGIN + RIGHTMARGIN, 225 + END + + IDD_OPT_CLUI, DIALOG + BEGIN + HORZGUIDE, 127 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/plugins/Clist_nicer/res/version.rc b/plugins/Clist_nicer/res/version.rc new file mode 100644 index 0000000000..376db28abf --- /dev/null +++ b/plugins/Clist_nicer/res/version.rc @@ -0,0 +1,47 @@ +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + +#include "winres.h" + +#define VERSION_STRING "0.10.0.1" +#define VER_MAJOR 0 +#define VER_MINOR 10 +#define VER_REVISION 0 +#define VER_BUILD 1 + +#define RES_FILE_DESC "Clist_Nicer+" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VER_MAJOR,VER_MINOR,VER_REVISION,VER_BUILD + PRODUCTVERSION VER_MAJOR,VER_MINOR,VER_REVISION,VER_BUILD + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "CompanyName", "Miranda IM project" + VALUE "FileDescription", RES_FILE_DESC + VALUE "FileVersion", VERSION_STRING + VALUE "InternalName", "clist_nicer" + VALUE "LegalCopyright", "Copyright (C) 2004-2010" + VALUE "LegalTrademarks", "Licensed under the Gnu general public license V2 or any later version." + VALUE "OriginalFilename", "clist_nicer.dll" + VALUE "ProductName", "Contact list plugin for Miranda IM" + VALUE "ProductVersion", VERSION_STRING + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END diff --git a/plugins/Clist_nicer/resource.rc b/plugins/Clist_nicer/resource.rc deleted file mode 100644 index 5697605827..0000000000 --- a/plugins/Clist_nicer/resource.rc +++ /dev/null @@ -1,788 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "include\resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include -#include -#include -#include -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - - -///////////////////////////////////////////////////////////////////////////// -// English (United States) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_EXCEPTION DIALOGEX 0, 0, 370, 131 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "TabSRMM exception" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - EDITTEXT IDC_EXCEPTION_DETAILS,7,18,356,60,ES_MULTILINE | ES_READONLY - DEFPUSHBUTTON "Copy to clipboard",IDC_COPY_EXCEPTION,108,114,80,14 - PUSHBUTTON "Continue",IDOK,196,114,80,14 - PUSHBUTTON "Exit Miranda",IDCANCEL,284,114,80,14 - LTEXT "",IDC_EX_REASON,7,5,354,9 - LTEXT "Although the exception was caught and you may continue working with Miranda, you should restart the program as soon as possible. The exception may have damaged internal data structures and can have a serious impact on stability.",IDC_STATIC,7,83,352,26 -END - -IDD_OPT_FLOATING DIALOGEX 0, 0, 313, 251 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "Floating contacts appearance",IDC_STATIC,3,4,307,131 - CONTROL "Simple layout",IDC_FLT_SIMPLELAYOUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,29,176,11 - CONTROL "Show avatars",IDC_FLT_AVATARS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,41,176,11 - CONTROL "Show second text line",IDC_FLT_DUALROWS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,53,176,11 - CONTROL "Show extra icons",IDC_FLT_EXTRAICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,65,176,11 - GROUPBOX "Behaviour",IDC_STATIC,3,192,307,52 - CONTROL "Synchronzie floater visibility with contact list",IDC_FLT_SYNCED, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,202,292,11 - CONTROL "Only show contact floaters when contact list is hidden or minimized",IDC_FLT_AUTOHIDE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,214,292,11 - EDITTEXT IDC_FLT_PADLEFT,211,93,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_FLT_PADLEFTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,205,90,11,14 - EDITTEXT IDC_FLT_PADRIGHT,274,93,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_FLT_PADRIGHTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,293,89,11,14 - EDITTEXT IDC_FLT_PADTOP,243,87,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_FLT_PADTOPSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,262,82,11,14 - EDITTEXT IDC_FLT_PADBOTTOM,243,98,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | ES_NUMBER - CONTROL "",IDC_FLT_PADBOTTOMSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK | WS_DISABLED,262,100,11,14 - CTEXT "Padding",IDC_STATIC,217,74,80,10 - CONTROL "Enable floating contacts (required restart)",IDC_FLT_ENABLED, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,17,176,11 - CONTROL "",IDC_FLT_OPACITY,"msctls_trackbar32",TBS_TOP | TBS_NOTICKS | WS_TABSTOP,231,43,45,12 - RTEXT "000%",IDC_FLT_OPACITYVALUE,277,44,20,8 - GROUPBOX "Opacity",IDC_STATIC,192,14,113,47 - EDITTEXT IDC_FLT_WIDTH,274,115,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_FLT_WIDTHSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,293,111,11,14 - RTEXT "Width",IDC_STATIC,212,118,53,8 - CONTROL "Snap to edges (hold CTRL for snap between floaters)",IDC_FLT_SNAP, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,226,292,11 - RTEXT "Inactive",IDC_STATIC,193,44,36,8 - CONTROL "",IDC_FLT_ACTIVEOPACITY,"msctls_trackbar32",TBS_TOP | TBS_NOTICKS | WS_TABSTOP,231,26,45,12 - RTEXT "000%",IDC_FLT_ACTIVEOPACITYVALUE,277,28,20,8 - RTEXT "Active",IDC_STATIC,193,28,36,8 - CONTROL "Border",IDC_FLT_BORDER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,101,71,10 - CONTROL "Rounded corners",IDC_FLT_ROUNDED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,116,71,10 - CONTROL "",IDC_FLT_BORDERCOLOUR,"ColourPicker",WS_TABSTOP,129,101,22,10 - RTEXT "Colour",IDC_STATIC,90,102,34,8 - EDITTEXT IDC_FLT_RADIUS,129,115,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_FLT_RADIUSSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,148,112,11,14 - RTEXT "Radius",IDC_STATIC,90,117,34,8 - CONTROL "Fill with contact list background color",IDC_FLT_FILLSTD, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,77,176,11 - GROUPBOX "Tooltips",IDC_STATIC,3,138,307,40 - CONTROL "Show tooltips",IDC_FLT_SHOWTOOLTIPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,150,90,10 - RTEXT "Hover time",IDC_STATIC,115,151,90,8 - EDITTEXT IDC_FLT_HOVERTIME,211,148,37,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_FLT_HOVERTIMESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,237,144,10,14 - CONTROL "Use default",IDC_FLT_DEFHOVERTIME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,211,164,96,10 - LTEXT "ms",IDC_STATIC,254,151,42,8 -END - -IDD_CLNABOUT DIALOGEX 0, 0, 228, 140 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_CONTROLPARENT -CAPTION "About CList Nicer+" -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - LTEXT "",IDC_WHITERECT,0,0,228,116 - DEFPUSHBUTTON "OK",IDOK,168,123,55,14 - LTEXT "Clist Nicer+",IDC_CLNICER,5,7,150,15 - CTEXT "Copyright © 2004-2010 by the Miranda IM project. More detailed copyright information can be found in the included README file.\n\nThis software is distributed and licensed under the terms of the GNU General Public License V2 or any later version.",IDC_COPYRIGHT,5,39,217,47 - ICON 0,IDC_LOGO,201,2,20,20 - LTEXT "Version",IDC_VERSION,5,19,150,15 - CTEXT "build time",IDC_BUILDTIME,37,105,150,11 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,117,228,1 - CONTROL "Support and latest version information",IDC_SUPPORT, - "Hyperlink",WS_TABSTOP | 0x1,18,91,192,12 -END - -IDD_DELETECONTACT DIALOGEX 0, 0, 284, 90 -STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_CONTROLPARENT -CAPTION "Delete Contact" -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - DEFPUSHBUTTON "No",IDNO,162,38,65,14 - PUSHBUTTON "Yes",IDYES,54,38,65,14 - CONTROL "Hide from list only, in order to keep their history and ignore/visibility settings",IDC_HIDE, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,65,270,9 - LTEXT "Use Options->Ignore (expert mode) to unhide contacts.",IDC_STATIC,20,78,257,8 - CONTROL "Are you sure you want to delete %s?",IDC_TOPLINE,"Static",SS_SIMPLE | SS_NOPREFIX | WS_GROUP,7,7,270,8 - LTEXT "This will erase all history and settings for this contact!",IDC_STATIC,7,18,239,14 -END - -IDD_OPT_DSPPROFILES DIALOGEX 0, 0, 312, 247 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - LISTBOX IDC_PROFILELIST,5,11,68,92,LBS_SORT | LBS_NOINTEGRALHEIGHT | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP - CONTROL "",IDC_DSP_ADD,"MButtonClass",NOT WS_VISIBLE | WS_TABSTOP,5,109,68,15,WS_EX_NOACTIVATE | 0x10000000L - CONTROL "",IDC_DSP_DELETE,"MButtonClass",NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,5,128,68,15,WS_EX_NOACTIVATE | 0x10000000L - CONTROL "",IDC_DSP_RENAME,"MButtonClass",NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,5,147,68,15,WS_EX_NOACTIVATE | 0x10000000L - CONTROL "",IDC_OPTIONSTAB,"SysTabControl32",WS_TABSTOP,41,1,230,222 - CONTROL "",IDC_DSP_APPLY,"MButtonClass",NOT WS_VISIBLE | WS_TABSTOP,218,229,89,15,WS_EX_NOACTIVATE | 0x10000000L - LISTBOX IDC_CLASSLIST,5,184,68,55,LBS_SORT | LBS_NOINTEGRALHEIGHT | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP -END - -IDD_OPTIONSDIALOG DIALOGEX 0, 0, 312, 247 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - CONTROL "",IDC_OPTIONSTAB,"SysTabControl32",WS_TABSTOP,1,1,310,245,WS_EX_ACCEPTFILES -END - -IDD_OPT_CLIST DIALOGEX 0, 0, 305, 226 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "Contact List",IDC_STCLISTGROUP,1,0,163,91 - CONTROL "Hide offline users",IDC_HIDEOFFLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,12,147,10 - CONTROL "Hide empty groups",IDC_HIDEEMPTYGROUPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,25,147,10 - CONTROL "Disable groups",IDC_DISABLEGROUPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,38,147,10 - CONTROL "Ask before deleting contacts",IDC_CONFIRMDELETE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,51,147,10 - CONTROL "Disable icon blinking",IDC_ICONBLINK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,64,147,10 - CONTROL "Apply last active view mode ",IDC_APPLYLASTVIEWMODE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,77,147,10 - GROUPBOX "Contact list layout",IDC_STATIC,169,0,133,91 - CONTROL "Show menu and status buttons",IDC_SHOWBOTTOMBUTTONS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,176,25,121,10 - CONTROL "Draw sunken edge",IDC_CLISTSUNKEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,176,38,121,10 - GROUPBOX "System tray icon",IDC_STATIC,1,91,163,63 - CONTROL "Single click interface",IDC_ONECLK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,101,147,10 - CONTROL "Always show status in tooltip",IDC_ALWAYSSTATUS,"Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,10,113,147,10 - CONTROL "Disable icon blinking",IDC_DISABLEBLINK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,125,147,10 - EDITTEXT IDC_BLINKTIME,69,136,57,12,ES_RIGHT | ES_NUMBER - CONTROL "Spin5",IDC_BLINKSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,114,137,11,16 - LTEXT "ms",IDC_STATIC,130,138,24,8 - GROUPBOX "Event area",IDC_STATIC,169,91,133,63 - LTEXT "Set base visiblity on the frames menu",IDC_STATIC,176,102,121,15 - CONTROL "Auto mode",IDC_EVENTAREAAUTOHIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,176,125,121,10 - CONTROL "Draw sunken edge",IDC_EVENTAREASUNKEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,176,136,121,10 - GROUPBOX "System tray icon when using multiple protocols",IDC_STATIC,1,154,302,71 - CONTROL "Show",IDC_DONTCYCLE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,10,166,92,10 - COMBOBOX IDC_PRIMARYSTATUS,107,165,78,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "icon when statuses differ",IDC_STATIC,189,167,108,8,NOT WS_GROUP - CONTROL "Cycle icons every",IDC_CYCLE,"Button",BS_AUTORADIOBUTTON,10,180,92,10 - EDITTEXT IDC_CYCLETIME,107,180,30,12,ES_RIGHT | ES_NUMBER - CONTROL "Spin1",IDC_CYCLETIMESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,127,181,10,14 - LTEXT "seconds, when statuses differ",IDC_STATIC,145,182,150,8,NOT WS_GROUP - CONTROL "Show multiple icons",IDC_MULTITRAY,"Button",BS_AUTORADIOBUTTON,10,194,92,10 - CONTROL "Only when statuses differ",IDC_ALWAYSMULTI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,194,186,10 - CONTROL "Do not show system tray icon tooltips on mouse over",IDC_NOTRAYINFOTIPS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,208,284,12 -END - -IDD_OPT_DSPGROUPS DIALOGEX 0, 0, 227, 205 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "Groups",IDC_STATIC,1,0,224,109 - CONTROL "Draw a line alongside group names",IDC_LINEWITHGROUPS, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,8,200,12 - CONTROL "Show number of contacts in a group",IDC_SHOWGROUPCOUNTS, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,20,200,12 - CONTROL "Hide numbers when all offline",IDC_HIDECOUNTSWHENEMPTY, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,23,32,193,12 - CONTROL "Sort groups alphabetically",IDC_SORTGROUPSALPHA,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,44,200,12 - CONTROL "Quicksearch in open groups only",IDC_QUICKSEARCHVISONLY, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,56,200,12 - CONTROL "No expand/collapse icon",IDC_NOGROUPICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,68,200,12 - CONTROL "Center groupnames horizontally",IDC_CENTERGROUPNAMES, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,80,200,12 - LTEXT "Alignment",IDC_STATIC,11,95,53,10 - COMBOBOX IDC_GROUPALIGN,68,93,73,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Margins (left/right)",IDC_STATIC,11,121,113,8 - EDITTEXT IDC_LEFTMARGIN,139,119,31,12,ES_RIGHT | ES_NUMBER - CONTROL "Spin1",IDC_LEFTMARGINSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,158,119,11,14 - EDITTEXT IDC_RIGHTMARGIN,176,119,31,12,ES_RIGHT | ES_NUMBER - CONTROL "",IDC_RIGHTMARGINSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,208,119,11,14 - LTEXT "Row gap",IDC_STATIC,11,135,156,11 - EDITTEXT IDC_ROWGAP,176,133,31,12,ES_RIGHT | ES_NUMBER - CONTROL "",IDC_ROWGAPSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,208,133,11,14 - LTEXT "Minimum row height:",IDC_STATIC,11,149,156,8 - EDITTEXT IDC_ROWHEIGHT,176,147,31,12,ES_RIGHT | ES_NUMBER - CONTROL "",IDC_ROWHEIGHTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,208,147,11,14 - LTEXT "Group row height",IDC_STATIC,11,161,156,8 - EDITTEXT IDC_GROUPROWHEIGHT,176,161,31,12,ES_RIGHT | ES_NUMBER - CONTROL "",IDC_GROUPROWHEIGHTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,208,161,11,14 - LTEXT "Indent groups by:",IDC_STATIC,11,175,156,8 - EDITTEXT IDC_GROUPINDENT,176,175,31,12,ES_RIGHT | ES_NUMBER - CONTROL "Spin1",IDC_GROUPINDENTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,208,175,11,14 - LTEXT "Inner Row vertical padding",IDC_STATIC,11,189,156,9 - EDITTEXT IDC_AVATARPADDING,176,189,31,12,ES_RIGHT | ES_AUTOHSCROLL - CONTROL "",IDC_AVATARPADDINGSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,208,189,11,14 - GROUPBOX "Margins and spacing",IDC_STATIC,1,111,224,93 -END - -IDD_OPT_DSPITEMS DIALOGEX 0, 0, 227, 205 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "Contact List Sorting",IDC_STATIC,1,0,142,97,WS_GROUP - LTEXT "First by",IDC_STATIC,5,15,57,9 - COMBOBOX IDC_SORTPRIMARY,65,12,73,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Then by",IDC_STATIC,5,29,57,9 - COMBOBOX IDC_SORTTHEN,65,27,73,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Finally by",IDC_STATIC,5,43,57,9 - COMBOBOX IDC_SORTFINALLY,65,42,73,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Move events to the top of list\nor group",IDC_EVENTSONTOP, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,5,61,130,16 - CONTROL "Do not separate offline contacts",IDC_DONTSEPARATE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,80,132,10 - LTEXT "Hide as offline",IDC_STATIC,151,1,73,8 - CONTROL "Tree1",IDC_HIDEOFFLINEOPTS,"SysTreeView32",TVS_HASBUTTONS | TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | TVS_CHECKBOXES | TVS_NONEVENHEIGHT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,147,11,77,85 - LTEXT "Right align contacts",IDC_STATIC,5,104,130,10 - COMBOBOX IDC_CLISTALIGN,147,102,77,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP -END - -IDD_OPT_DSPADVANCED DIALOGEX 0, 0, 227, 205 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "Avatars",IDC_STATIC,1,0,224,109 - CONTROL "Show avatars",IDC_CLISTAVATARS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,11,125,10 - LTEXT "Height",IDC_STATIC,137,11,32,11 - EDITTEXT IDC_AVATARHEIGHT,180,9,31,12,ES_AUTOHSCROLL - CONTROL "",IDC_AVATARSIZESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,200,9,11,15 - CONTROL "Draw a border around avatars",IDC_AVATARSBORDER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,25,165,10 - CONTROL "",IDC_AVATARBORDERCLR,"ColourPicker",WS_TABSTOP,180,24,22,10 - CONTROL "Rounded avatars",IDC_AVATARSROUNDED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,39,125,10 - LTEXT "Radius",IDC_STATIC,137,39,32,9 - EDITTEXT IDC_RADIUS,180,37,31,12,ES_AUTOHSCROLL - CONTROL "",IDC_RADIUSSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,200,37,11,15 - CONTROL "Always align icons and text for missing avatars",IDC_ALWAYSALIGNNICK, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,65,213,10 - LTEXT "Avatar alignment",IDC_STATIC,8,80,103,11 - COMBOBOX IDC_ALIGNMENT,119,78,102,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Don't request avatars for offline contacts",IDC_NOAVATARSOFFLINE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,94,213,10 - GROUPBOX "Second text line",IDC_STATIC,1,110,224,94 - CONTROL "Display status message when available",IDC_SHOWSTATUSMSG, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,122,213,10 - LTEXT "Show second text line:",IDC_STATIC,8,137,103,9 - COMBOBOX IDC_DUALROWMODE,119,135,102,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Show contacts local time",IDC_SHOWLOCALTIME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,150,212,10 - CONTROL "Only when timezone differs",IDC_SHOWLOCALTIMEONLYWHENDIFFERENT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,164,201,10 -END - -IDD_OPT_XICONS DIALOGEX 0, 0, 227, 205 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "Extra icons (drag items to reorder them)",IDC_STATIC,1,100,224,87 - EDITTEXT IDC_EXICONSCALE,141,192,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_EXICONSCALESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,160,187,12,14 - LTEXT "Extra icon size",IDC_STATIC,51,193,87,11 - CONTROL "Show status icons",IDC_SHOWSTATUSICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,10,106,10 - GROUPBOX "Icons",IDC_STATIC,1,0,224,99 - CONTROL "Show visibility icons",IDC_SHOWVISIBILITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,22,214,10 - CONTROL "When possible, draw status icons in avatar space",IDC_SELECTIVEICONS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,34,214,10 - CONTROL "Centered when possible",IDC_STATUSICONSCENTERED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,10,100,11 - CONTROL "Use metacontact protocol icons instead of subcontacts",IDC_SHOWMETA, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,46,214,10 - CONTROL "Use Overlay icons on avatars",IDC_OVERLAYICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,58,214,10 - CONTROL "Dim idle contacts",IDC_IDLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,70,214,10 - CONTROL "Replace status icons with xStatus",IDC_XSTATUSASSTATUS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,82,214,10 - CONTROL "",IDC_EXTRAORDER,"SysTreeView32",TVS_NOTOOLTIPS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,22,111,182,56 - PUSHBUTTON "Reset order and visibility to default",IDC_RESETXICONS,5,169,216,15 -END - -IDD_OPT_CLUI DIALOGEX 0, 0, 305, 226 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "Window",IDC_STWINDOWGROUP,1,0,302,165 - CONTROL "Always on top",IDC_ONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,11,126,10 - CONTROL "Show menu bar",IDC_SHOWMAINMENU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,35,126,10 - CONTROL "Easy move",IDC_CLIENTDRAG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,47,126,10 - CONTROL "Rounded border",IDC_ROUNDEDBORDER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,59,126,10 - LTEXT "Border",IDC_STATIC,11,75,48,9 - COMBOBOX IDC_BORDERSTYLE,62,72,64,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Title bar text:",IDC_STATIC,11,93,51,8 - EDITTEXT IDC_TITLETEXT,62,91,64,12,ES_AUTOHSCROLL - CONTROL "Show drop shadow (restart required)",IDC_DROPSHADOW, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,108,138,10 - CONTROL "Pin to desktop",IDC_ONDESKTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,120,128,10 - CONTROL "Hide contact list after it has been idle for",IDC_AUTOHIDE, - "Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,139,11,160,10 - EDITTEXT IDC_HIDETIME,150,21,38,12,ES_RIGHT | ES_NUMBER - CONTROL "Spin1",IDC_HIDETIMESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,178,21,10,14 - LTEXT "seconds",IDC_STATIC01,190,23,56,8 - CONTROL "Automatically resize window to height of list",IDC_AUTOSIZE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,139,35,160,10 - LTEXT "maximum",IDC_STATIC21,150,47,42,8 - EDITTEXT IDC_MAXSIZEHEIGHT,194,45,37,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Spin1",IDC_MAXSIZESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,221,45,10,14 - LTEXT "% of screen",IDC_STATIC22,233,47,64,8 - CONTROL "Size upwards",IDC_AUTOSIZEUPWARD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,59,149,10 - CONTROL "If window is partially covered, bring to front instead of hiding",IDC_BRINGTOFRONT, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,139,76,160,16 - LTEXT "Client margins",IDC_STATIC,11,144,50,10 - EDITTEXT IDC_CLEFT,64,142,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_CLEFTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,84,139,10,14 - EDITTEXT IDC_CTOP,95,136,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_CTOPSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,115,133,10,14 - EDITTEXT IDC_CBOTTOM,95,148,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_CBOTTOMSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,115,146,10,14 - EDITTEXT IDC_CRIGHT,127,142,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_CRIGHTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,149,139,10,14 - LTEXT "Embedded frames border",IDC_STATIC,174,121,84,12 - CONTROL "",IDC_CLUIFRAMESBDR,"ColourPicker",WS_TABSTOP,264,119,29,12 - LTEXT "Clip border by",IDC_STATIC,173,138,67,10 - EDITTEXT IDC_CLIPBORDER,264,135,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_CLIPBORDERSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,284,134,10,14 - LTEXT "Gap between frames",IDC_STATIC,173,151,87,11 - EDITTEXT IDC_FRAMEGAP,264,149,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_FRAMEGAPSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,284,148,10,14 - GROUPBOX "Translucency options (Windows 2000/XP only)",IDC_STATIC,1,168,302,56 - CONTROL "Transparent contact list",IDC_TRANSPARENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,181,149,9 - LTEXT "Inactive opacity:",IDC_STATIC11,11,191,75,8 - CONTROL "Slider2",IDC_TRANSINACTIVE,"msctls_trackbar32",TBS_TOP | TBS_NOTICKS | WS_TABSTOP,93,190,34,11 - LTEXT "000%",IDC_INACTIVEPERC,130,191,24,8,SS_NOPREFIX - LTEXT "Active opacity:",IDC_STATIC12,11,206,75,8 - CONTROL "Slider2",IDC_TRANSACTIVE,"msctls_trackbar32",TBS_TOP | TBS_NOTICKS | WS_TABSTOP,93,206,34,11 - LTEXT "000%",IDC_ACTIVEPERC,130,207,24,8,SS_NOPREFIX - CONTROL "Fade contact list in/out",IDC_FADEINOUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,190,139,10 - CONTROL "Fully transparent (like TweakUI)",IDC_FULLTRANSPARENT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,205,139,10 - CONTROL "Always Hide On Taskbar",IDC_ALWAYSHIDEONTASKBAR,"Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,139,94,158,10 -END - -IDD_OPT_CLC DIALOGEX 0, 0, 305, 226 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "Items",IDC_STATIC,1,0,302,110 - CONTROL "Show divider between online and offline contacts",IDC_DIVIDERONOFF, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,12,282,10 - CONTROL "Hot track items as mouse passes over",IDC_TRACKSELECT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,23,282,10 - CONTROL "Disable drag and drop of items",IDC_DISABLEDRAGDROP, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,34,282,10 - CONTROL "Disable rename of items by clicking twice",IDC_NOTEDITLABELS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,45,282,10 - CONTROL "Show selection even when list is not focused",IDC_SHOWSELALWAYS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,56,282,10 - CONTROL "Make selection highlight translucent",IDC_NOTNOTRANSLUCENTSEL, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,67,282,10 - CONTROL "Use full row for selection and hottracking",IDC_FULLROWSELECT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,78,282,10 - CONTROL "Double click on avatar opens userinfo",IDC_DBLCLKAVATARS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,98,282,10 - GROUPBOX "Visual",IDC_STATIC,0,111,303,113 - CONTROL "Scroll list smoothly",IDC_NOTNOSMOOTHSCROLLING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,123,282,10 - LTEXT "Time:",IDC_STATIC11,21,137,39,8 - EDITTEXT IDC_SMOOTHTIME,63,135,45,12,ES_RIGHT | ES_NUMBER - CONTROL "Spin1",IDC_SMOOTHTIMESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,96,138,11,14 - LTEXT "milliseconds",IDC_STATIC12,114,137,73,8,SS_CENTERIMAGE - CONTROL "Hide vertical scroll bar",IDC_NOSCROLLBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,152,282,10 - CONTROL "Grey out entire list when:",IDC_GREYOUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,168,282,10 - CONTROL "Tree1",IDC_GREYOUTOPTS,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | TVS_NONEVENHEIGHT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,11,181,182,39 -END - -IDD_OPT_CLCBKG DIALOGEX 0, 0, 305, 226 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | DS_CENTER | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Contact List Background",IDC_STATIC,1,4,302,177 - CONTROL "Use Windows colours",IDC_WINCOLOUR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,20,282,10 - CONTROL "",IDC_BKGCOLOUR,"ColourPicker",WS_TABSTOP,22,34,22,10 - LTEXT "Background colour",IDC_STATIC,48,35,246,8,NOT WS_GROUP - CONTROL "Use background image",IDC_BITMAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,57,282,10 - EDITTEXT IDC_FILENAME,22,71,184,12,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_BROWSE,208,72,15,11 - CONTROL "Stretch to width",IDC_STRETCHH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,86,117,10 - CONTROL "Stretch to height",IDC_STRETCHV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,86,153,10 - CONTROL "Tile horizontally",IDC_TILEH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,100,118,10 - CONTROL "Tile vertically",IDC_TILEV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,143,100,156,10 - CONTROL "Scroll with text",IDC_SCROLL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,113,115,10 - CONTROL "Stretch proportionally",IDC_PROPORTIONAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,143,113,155,10 - CONTROL "Use these settings to skin the entire background",IDC_SKINMODE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,132,282,11 - LTEXT "If you enable this, the background settings will affect the entire contact list frame.",IDC_STATIC,23,145,270,28 -END - -IDD_OPT_SBAR DIALOGEX 0, 0, 303, 226 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | DS_CENTER | WS_CHILD -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Status Bar",IDC_STATIC,3,4,297,214 - CONTROL "Show status bar",IDC_SHOWSBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,17,275,10 - CONTROL "Show icons",IDC_SHOWICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,33,265,10 - CONTROL "Show protocol names",IDC_SHOWPROTO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,48,265,10 - CONTROL "Show status text",IDC_SHOWSTATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,63,265,10 - CONTROL "Right click opens status menu",IDC_RIGHTSTATUS,"Button",BS_AUTORADIOBUTTON,25,160,265,10 - CONTROL "Right click opens Miranda IM menu",IDC_RIGHTMIRANDA, - "Button",BS_AUTORADIOBUTTON,25,147,265,10 - CONTROL "Make sections equal width",IDC_EQUALSECTIONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,78,265,10 - CONTROL "Show bevels on panels",IDC_SBPANELBEVEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,93,265,10 - CONTROL "Show resize grip indicator",IDC_SHOWGRIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,108,265,10 - CONTROL "Draw background skin",IDC_SKINBACKGROUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,123,265,10 - CONTROL "Show ICQ extended status icons",IDC_SHOWXSTATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,186,275,9 - CONTROL "Mark protocols locked from global status changes",IDC_MARKLOCKED, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,200,275,9 -END - -IDD_OPT_VIEWMODES DIALOGEX 0, 0, 309, 295 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_CAPTION | WS_SYSMENU -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - CONTROL "",IDC_TAB,"SysTabControl32",0x0,4,4,301,264 - LTEXT "",IDC_STATIC7,6,22,297,244 - GROUPBOX "Available view modes",IDC_STATIC1,9,20,158,85 - LISTBOX IDC_VIEWMODES,12,30,123,55,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP,WS_EX_CLIENTEDGE - GROUPBOX "Include protocols",IDC_STATIC2,171,20,130,85 - CONTROL "",IDC_PROTOCOLS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,175,30,121,72 - PUSHBUTTON "+",IDC_ADDVIEWMODE,142,39,18,16 - PUSHBUTTON "-",IDC_DELETEVIEWMODE,142,60,18,16 - LTEXT "New",IDC_STATIC5,15,91,38,11,0,WS_EX_TRANSPARENT - EDITTEXT IDC_NEWVIEMODE,59,88,76,13,ES_AUTOHSCROLL - GROUPBOX "Include groups",IDC_STATIC3,8,105,159,89,0,WS_EX_TRANSPARENT - CONTROL "",IDC_GROUPS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,12,116,122,73 - GROUPBOX "Include status modes",IDC_STATIC4,171,105,130,89,0,WS_EX_TRANSPARENT - CONTROL "",IDC_STATUSMODES,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,175,116,121,73 - PUSHBUTTON "Ok",IDOK,106,275,62,16 - PUSHBUTTON "Cancel",IDCANCEL,172,275,62,16 - PUSHBUTTON "Apply",IDC_APPLY,242,275,62,16 - CONTROL "",IDC_CLIST,"CListControl",0x24a,12,31,286,199,WS_EX_CLIENTEDGE - GROUPBOX "Sticky contacts",IDC_STATIC9,8,20,293,215 - PUSHBUTTON "Clear all",IDC_CLEARALL,13,241,92,14 - LTEXT "Using the contact list on the left side, you can select contacts which will be ""sticky"" for this view mode. These contacts will ignore the standard filter rules and only use the status mode filter below.",IDC_STATIC10,174,50,124,72,NOT WS_VISIBLE - LTEXT "Protocol",IDC_STATIC12,31,204,49,12 - COMBOBOX IDC_PROTOGROUPOP,85,202,37,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CTEXT "Group",IDC_STATIC13,129,204,44,12 - COMBOBOX IDC_GROUPSTATUSOP,177,202,37,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - RTEXT "Status mode",IDC_STATIC14,221,204,54,12 - CONTROL "Automatically clear this view mode after",IDC_AUTOCLEAR, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,244,172,11 - EDITTEXT IDC_AUTOCLEARVAL,222,243,29,12,ES_AUTOHSCROLL - CONTROL "",IDC_AUTOCLEARSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,245,243,8,13 - LTEXT "seconds",IDC_STATIC15,262,244,28,12 - GROUPBOX "View mode options",IDC_STATIC16,8,195,293,68 - LTEXT "Editing view mode",IDC_CURVIEWMODE2,119,245,178,14,NOT WS_VISIBLE - CONTROL "Last message ",IDC_LASTMSG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,227,86,11 - COMBOBOX IDC_LASTMESSAGEOP,106,227,81,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_LASTMSGVALUE,193,227,31,13,ES_AUTOHSCROLL - COMBOBOX IDC_LASTMESSAGEUNIT,229,227,68,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP -END - -IDD_OPT_SKIN DIALOGEX 0, 0, 303, 200 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - LTEXT "Per contact skins:",IDC_STATIC,9,188,71,12,WS_DISABLED - EDITTEXT IDC_SKINFILE,70,186,135,13,ES_AUTOHSCROLL | WS_DISABLED - PUSHBUTTON "...",IDC_SKINFILESELECT,209,185,22,12,WS_DISABLED - PUSHBUTTON "< Reload",IDC_RELOAD,231,185,71,12,WS_DISABLED - GROUPBOX "Contact list skin",IDC_STATIC,3,6,297,68 - EDITTEXT IDC_SKINFILENAME,11,19,256,14,ES_AUTOHSCROLL | ES_READONLY - PUSHBUTTON "...",IDC_SELECTSKINFILE,271,19,25,13 - CONTROL "Load this skin on startup",IDC_USESKIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,40,188,10 - PUSHBUTTON "Apply skin now",IDC_RELOADSKIN,10,54,90,14 - PUSHBUTTON "Unload skin",IDC_UNLOAD,206,54,90,14 - CONTROL "Make selection shape equal to selected item",IDC_EQUALSELECTION, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,108,178,10 - CONTROL "Blend selection with background",IDC_SELBLEND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,119,177,10 - CONTROL "Automatically fill background with wallpaper (tiled wallpaper only)",IDC_FILLWALLPAPER, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,130,286,10 - CONTROL "Apply group indent values to background drawing",IDC_APPLYINDENTBG, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,141,286,10 - CONTROL "Use per protocol/contact skinning",IDC_USEPERPROTO, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,86,155,10 - CONTROL "Protocol skins override status text colors",IDC_OVERRIDEPERSTATUSCOLOR, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,97,155,10 - CONTROL "Set all buttons to skinned mode",IDC_SETALLBUTTONSKINNED, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,86,128,10 - CONTROL "Use fast gradient drawing",IDC_FASTGRADIENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,97,130,10 - EDITTEXT IDC_CORNERRAD,256,110,29,12,ES_AUTOHSCROLL - CONTROL "",IDC_CORNERSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,273,112,12,13 - LTEXT "Corner radius",IDC_STATIC,193,112,59,10 - GROUPBOX "Skin options",IDC_STATIC,3,77,297,105 - EDITTEXT IDC_GRPTOPPADDING,80,163,29,12,ES_AUTOHSCROLL - CONTROL "",IDC_GRPPADDINGSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,96,164,11,13 - LTEXT "Group top padding",IDC_STATIC,7,164,68,10 - EDITTEXT IDC_LASTITEMPADDING,258,163,29,12,ES_AUTOHSCROLL - CONTROL "",IDC_LASTITEMPADDINGSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,274,164,11,13 - LTEXT "Frame titlebar height",IDC_STATIC,149,164,85,10 - CONTROL "Ignore selection for groups",IDC_IGNORESELFORGROUPS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,152,286,10 -END - -IDD_OPT DIALOGEX 0, 0, 312, 247 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - CONTROL "",IDC_OPTIONSTAB,"SysTabControl32",WS_TABSTOP,1,1,310,226,WS_EX_ACCEPTFILES - PUSHBUTTON "Load from skin file",IDC_IMPORT,167,229,125,15 - PUSHBUTTON "Export to skin file",IDC_EXPORT,19,229,125,15 -END - -IDD_QUICKIGNORE DIALOGEX 0, 0, 357, 247 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Dialog" -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Ignore these events",IDC_STATIC,7,3,197,85 - CONTROL "Messages",IDC_IGN_MSGEVENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,14,106,11 - CONTROL "Incoming file transfers",IDC_IGN_FILEEVENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,26,106,11 - CONTROL "URL events",IDC_IGN_URLEVENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,38,106,11 - CONTROL "Suppress auth requests",IDC_IGN_AUTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,50,182,11 - CONTROL "Suppress added notifications",IDC_IGN_ADD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,62,182,11 - CONTROL "Suppress online notifications",IDC_IGN_ONLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,74,182,11 - PUSHBUTTON "Ignore all",IDC_IGN_ALL,129,11,71,15 - PUSHBUTTON "Ignore none",IDC_IGN_NONE,129,33,71,15 - GROUPBOX "Visibility",IDC_STATIC,7,89,197,35 - CONTROL "Appear always online",IDC_IGN_ALWAYSONLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,98,182,11 - CONTROL "Appear always offline (block contact)",IDC_IGN_ALWAYSOFFLINE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,111,182,11 - GROUPBOX "Other",IDC_STATIC,7,125,197,96 - CONTROL "Hide this contact from the list",IDC_HIDECONTACT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,132,182,14 - LTEXT "To show a previously hidden contact, navigate to Options->Events->Ignore, search the contact in the list and tick the checkbox next to its name.",IDC_STATIC,18,146,182,34 - GROUPBOX "Display options",IDC_STATIC,209,3,143,218 - CONTROL "Show contact with priority",IDC_IGN_PRIORITY,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,219,13,127,11 - LTEXT "Show Avatar:",IDC_STATIC,225,28,94,11 - COMBOBOX IDC_AVATARDISPMODE,219,38,127,56,CBS_DROPDOWNLIST | CBS_SORT | WS_DISABLED | WS_VSCROLL | WS_TABSTOP - LTEXT "Show 2nd line:",IDC_STATIC,225,54,94,11 - COMBOBOX IDC_SECONDLINEMODE,219,64,127,56,CBS_DROPDOWNLIST | CBS_SORT | WS_DISABLED | WS_VSCROLL | WS_TABSTOP - CONTROL "",IDC_IGN_ADDPERMANENTLY,"MButtonClass",WS_TABSTOP,95,202,106,15,WS_EX_NOACTIVATE | 0x10000000L - PUSHBUTTON "Ok",IDOK,211,228,65,14 - PUSHBUTTON "Cancel",IDCANCEL,284,228,65,14 - CONTROL "Draw overlay icon on avatar",IDC_OVERLAYICON,"Button",BS_AUTO3STATE | WS_TABSTOP,219,82,127,10 - CONTROL "Show local time",IDC_SHOWLOCALTIME1,"Button",BS_AUTO3STATE | WS_TABSTOP,219,94,127,10 - GROUPBOX "Extra icons",IDC_STATIC,213,118,134,80 - CONTROL "Client",IDC_EXTRA_ICON_CLIENT,"Button",BS_AUTO3STATE | WS_TABSTOP,219,129,64,11 - CONTROL "E-Mail",IDC_EXTRA_ICON_EMAIL,"Button",BS_AUTO3STATE | WS_TABSTOP,219,140,64,11 - CONTROL "Homepage",IDC_EXTRA_ICON_WEB,"Button",BS_AUTO3STATE | WS_TABSTOP,219,151,64,11 - CONTROL "Telephone",IDC_EXTRA_ICON_SMS,"Button",BS_AUTO3STATE | WS_TABSTOP,219,162,64,11 - CONTROL "Reserved",IDC_EXTRA_ICON_RES0,"Button",BS_AUTO3STATE | WS_TABSTOP,219,173,64,11 - CONTROL "Advanced #1",IDC_EXTRA_ICON_ADV1,"Button",BS_AUTO3STATE | WS_TABSTOP,288,129,55,11 - CONTROL "Advanced #2",IDC_EXTRA_ICON_ADV2,"Button",BS_AUTO3STATE | WS_TABSTOP,288,140,55,11 - CONTROL "Advanced #3",IDC_EXTRA_ICON_ADV3,"Button",BS_AUTO3STATE | WS_TABSTOP,288,151,55,11 - CONTROL "Advanced #4",IDC_EXTRA_ICON_ADV4,"Button",BS_AUTO3STATE | WS_TABSTOP,288,162,55,11 - CONTROL "Reserved #1",IDC_EXTRA_ICON_RES1,"Button",BS_AUTO3STATE | WS_TABSTOP,288,173,55,11 - CONTROL "Reserved #2",IDC_EXTRA_ICON_RES2,"Button",BS_AUTO3STATE | WS_TABSTOP,288,184,55,11 - CONTROL "Show visibility icon",IDC_SHOWVISIBILITY,"Button",BS_AUTO3STATE | WS_TABSTOP,219,107,127,10 - CONTROL "",IDC_DSP_LOADDEFAULT,"MButtonClass",WS_TABSTOP,213,202,135,15,WS_EX_NOACTIVATE | 0x10000000L -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "include\\resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include \r\n" - "#include \r\n" - "#include \r\n" - "#include \0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_NOTICK ICON "res/notick.ico" -IDI_TICK ICON "res/notick1.ico" -IDI_RENAME ICON "res/rename.ico" -IDI_DELETE ICON "res/delete.ico" -IDI_CLVM_OPTIONS ICON "res/options_clvm.ico" -IDI_CLVM_SELECT ICON "res/arrow-down.ico" -IDI_BLANK ICON "res/blank.ico" -IDI_OVL_OFFLINE ICON "res/overlay/offline.ico" -IDI_OVL_ONLINE ICON "res/overlay/online.ico" -IDI_OVL_AWAY ICON "res/overlay/away.ico" -IDI_OVL_DND ICON "res/overlay/dnd.ico" -IDI_OVL_NA ICON "res/overlay/na.ico" -IDI_OVL_OCCUPIED ICON "res/overlay/occupied.ico" -IDI_OVL_FREEFORCHAT ICON "res/overlay/chat.ico" -IDI_OVL_INVISIBLE ICON "res/overlay/invisible.ico" -IDI_OVL_ONTHEPHONE ICON "res/overlay/phone.ico" -IDI_OVL_OUTTOLUNCH ICON "res/overlay/lunch.ico" -IDI_HIDEOFFLINE ICON "res/online.ico" -IDI_HIDEGROUPS ICON "res/groups.ico" -IDI_SOUNDSON ICON "res/sounds_on.ico" -IDI_FINDANDADD ICON "res/find.ico" -IDI_TBOPTIONS ICON "res/options.ico" -IDI_MINIMIZE ICON "res/minimize.ico" -IDI_SOUNDSOFF ICON "res/sounds_off.ico" -IDI_TABSRMMSESSIONLIST ICON "res/slist.ico" -IDI_TABSRMMMENU ICON "res/tabsrmm_menu.ico" -IDI_CLVISIBLE ICON "res/visible.ico" -IDI_CLINVISIBLE ICON "res/invisible.ico" -IDI_PROTOCONNECTING ICON "res/connecting.ico" -IDI_TBTOPMENU ICON "res/menu.ico" -IDI_TBACCOUNTS ICON "res/accounts.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Cursor -// - -IDC_HYPERLINKHAND CURSOR "res/hyperlin.cur" -IDC_DROP CURSOR "res/DRAGCOPY.CUR" -IDC_DROPUSER CURSOR "res/dropuser.cur" - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_CLISTMENU MENU -BEGIN - POPUP "&¤" - BEGIN - MENUITEM SEPARATOR - MENUITEM "E&xit", ID_ICQ_EXIT - END - POPUP "&Status" - BEGIN - MENUITEM "&Offline\tCtrl+0", ID_STATUS_OFFLINE, CHECKED - MENUITEM "On&line\tCtrl+1", ID_STATUS_ONLINE - MENUITEM "&Away\tCtrl+2", ID_STATUS_AWAY - MENUITEM "&NA\tCtrl+3", ID_STATUS_NA - MENUITEM "Occ&upied\tCtrl+4", ID_STATUS_OCCUPIED - MENUITEM "&DND\tCtrl+5", ID_STATUS_DND - MENUITEM "&Free for chat\tCtrl+6", ID_STATUS_FREECHAT - MENUITEM "&Invisible\tCtrl+7", ID_STATUS_INVISIBLE - MENUITEM "On the &Phone\tCtrl+8", ID_STATUS_ONTHEPHONE - MENUITEM "Out to &Lunch\tCtrl+9", ID_STATUS_OUTTOLUNCH - END -END - -IDR_CONTEXT MENU -BEGIN - POPUP "Tray" - BEGIN - MENUITEM "&Hide/Show", 40038 - MENUITEM SEPARATOR - MENUITEM "E&xit", ID_TRAY_EXIT - END - POPUP "Nowhere" - BEGIN - MENUITEM "&New Group", POPUP_NEWGROUP - MENUITEM SEPARATOR - MENUITEM "&Hide Offline Users", POPUP_HIDEOFFLINE - MENUITEM "Hide &Offline Users out here", POPUP_HIDEOFFLINEROOT - MENUITEM "Hide &Empty Groups", POPUP_HIDEEMPTYGROUPS - MENUITEM "Disable &Groups", POPUP_DISABLEGROUPS - MENUITEM SEPARATOR - MENUITEM SEPARATOR - MENUITEM "Hide Miranda", POPUP_HIDEMIRANDA - END - POPUP "Group" - BEGIN - MENUITEM "&New Subgroup", POPUP_NEWSUBGROUP - MENUITEM "&Hide Offline Users in here", POPUP_GROUPHIDEOFFLINE - MENUITEM SEPARATOR - MENUITEM "&Rename Group", POPUP_RENAMEGROUP - MENUITEM "&Delete Group", POPUP_DELETEGROUP - MENUITEM SEPARATOR - MENUITEM "Move marked Contacts to this Group", POPUP_MOVEMARKEDHERE, GRAYED - END - POPUP "Appearance" - BEGIN - MENUITEM "Show Status Icons", POPUP_SHOWSTATUSICONS - MENUITEM "Show Visibility Icons", POPUP_VISIBILITY - MENUITEM "Show Metacontact proto Icons", POPUP_SHOWMETAICONS - MENUITEM SEPARATOR - MENUITEM "Show additional Buttons", POPUP_BUTTONS - MENUITEM "Draw sunken Frame", POPUP_FRAME - MENUITEM SEPARATOR - MENUITEM "Use Status Floater", POPUP_FLOATER - MENUITEM "Auto-Hide Status Floater", POPUP_FLOATER_AUTOHIDE - MENUITEM "Show Event Area in Floater", POPUP_FLOATER_EVENTS - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_OPT_DSPPROFILES, DIALOG - BEGIN - END - - IDD_OPT_DSPADVANCED, DIALOG - BEGIN - END - - IDD_OPT_XICONS, DIALOG - BEGIN - RIGHTMARGIN, 225 - END - - IDD_OPT_CLUI, DIALOG - BEGIN - HORZGUIDE, 127 - END - - IDD_OPT, DIALOG - BEGIN - END -END -#endif // APSTUDIO_INVOKED - -#endif // English (United States) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/plugins/Clist_nicer/skineditor/CHANGELOG b/plugins/Clist_nicer/skineditor/CHANGELOG deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/plugins/Clist_nicer/skineditor/README b/plugins/Clist_nicer/skineditor/README deleted file mode 100644 index 48f1084404..0000000000 --- a/plugins/Clist_nicer/skineditor/README +++ /dev/null @@ -1,27 +0,0 @@ - - - Skin Item Editor for clist_nicer+ - --------------------------------- - - This is basically the revamped UI which could previously be found as the - Background+ page in the contact list options. It has been outsourced into an - extra plugin (cln_skinedit.dll) - - The UI has been reworked and a few features have been added: - - * Ignored items appear in red color in the list box - - * A context menu has been added to the list box which allows to quick copy - settings from one items to all items which are currently selected in the - list box. - - * prettier UI, faster dialog updating, less flickering. - - - planned features: - ----------------- - - * Ability to edit image-based skin items. - * button editor (for skinnable contact list buttons) - - diff --git a/plugins/Clist_nicer/skineditor/commonheaders.h b/plugins/Clist_nicer/skineditor/commonheaders.h deleted file mode 100644 index 8717562195..0000000000 --- a/plugins/Clist_nicer/skineditor/commonheaders.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2004 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. -*/ - -#define _WIN32_WINNT 0x0501 - -#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/m_cln_skinedit.h" - -// shared vars -extern HINSTANCE g_hInst; diff --git a/plugins/Clist_nicer/skineditor/docs/CHANGELOG b/plugins/Clist_nicer/skineditor/docs/CHANGELOG new file mode 100644 index 0000000000..e69de29bb2 diff --git a/plugins/Clist_nicer/skineditor/docs/README b/plugins/Clist_nicer/skineditor/docs/README new file mode 100644 index 0000000000..48f1084404 --- /dev/null +++ b/plugins/Clist_nicer/skineditor/docs/README @@ -0,0 +1,27 @@ + + + Skin Item Editor for clist_nicer+ + --------------------------------- + + This is basically the revamped UI which could previously be found as the + Background+ page in the contact list options. It has been outsourced into an + extra plugin (cln_skinedit.dll) + + The UI has been reworked and a few features have been added: + + * Ignored items appear in red color in the list box + + * A context menu has been added to the list box which allows to quick copy + settings from one items to all items which are currently selected in the + list box. + + * prettier UI, faster dialog updating, less flickering. + + + planned features: + ----------------- + + * Ability to edit image-based skin items. + * button editor (for skinnable contact list buttons) + + diff --git a/plugins/Clist_nicer/skineditor/main.cpp b/plugins/Clist_nicer/skineditor/main.cpp deleted file mode 100644 index de1996f2f5..0000000000 --- a/plugins/Clist_nicer/skineditor/main.cpp +++ /dev/null @@ -1,970 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2004 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 "commonheaders.h" -#include "skineditres.h" - -#define ID_EXTBKSEPARATOR 40200 - -PLUGININFOEX pluginInfo = { - sizeof(PLUGININFOEX), - "Skin editor for clist_nicer+", - PLUGIN_MAKE_VERSION(0, 0, 0, 4), - "Allow inline skin item editing for clist nicer+.", - "Nightwish, Pixel", - "", - "Copyright 2000-2006 Miranda-IM project", - "http://www.miranda-im.org", - UNICODE_AWARE, - {0x21948c89, 0xb549, 0x4c9d, { 0x8b, 0x4f, 0x3f, 0x37, 0x26, 0xec, 0x6b, 0x4b }} -}; - -HINSTANCE g_hInst = 0; -int hLangpack; - -StatusItems_t *StatusItems; -ChangedSItems_t ChangedSItems = {0}; - -static int LastModifiedItem = -1; -static int last_selcount = 0; -static int last_indizes[64]; -static int ID_EXTBK_LAST = 0, ID_EXTBK_FIRST = 0; - -/* - * prototypes - */ - -static void ChangeControlItems(HWND hwndDlg, int status, int except); -static BOOL CheckItem(int item, HWND hwndDlg); - -static void ReActiveCombo(HWND hwndDlg) -{ - if (IsDlgButtonChecked(hwndDlg, IDC_IGNORE)) { - EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_LR), IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)); - EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_RL), IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)); - EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_TB), IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)); - EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_BT), IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)); - - EnableWindow(GetDlgItem(hwndDlg, IDC_BASECOLOUR2), !IsDlgButtonChecked(hwndDlg, IDC_COLOR2_TRANSPARENT)); - EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR2LABLE), !IsDlgButtonChecked(hwndDlg, IDC_COLOR2_TRANSPARENT)); - - EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_TL), IsDlgButtonChecked(hwndDlg, IDC_CORNER)); - EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_TR), IsDlgButtonChecked(hwndDlg, IDC_CORNER)); - EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_BR), IsDlgButtonChecked(hwndDlg, IDC_CORNER)); - EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_BL), IsDlgButtonChecked(hwndDlg, IDC_CORNER)); - ChangeControlItems(hwndDlg, !IsDlgButtonChecked(hwndDlg, IDC_IGNORE), IDC_IGNORE); - } else { - ChangeControlItems(hwndDlg, !IsDlgButtonChecked(hwndDlg, IDC_IGNORE), IDC_IGNORE); - EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_LR), IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)); - EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_RL), IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)); - EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_TB), IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)); - EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_BT), IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)); - - EnableWindow(GetDlgItem(hwndDlg, IDC_BASECOLOUR2), !IsDlgButtonChecked(hwndDlg, IDC_COLOR2_TRANSPARENT)); - EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR2LABLE), !IsDlgButtonChecked(hwndDlg, IDC_COLOR2_TRANSPARENT)); - - EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_TL), IsDlgButtonChecked(hwndDlg, IDC_CORNER)); - EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_TR), IsDlgButtonChecked(hwndDlg, IDC_CORNER)); - EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_BR), IsDlgButtonChecked(hwndDlg, IDC_CORNER)); - EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_BL), IsDlgButtonChecked(hwndDlg, IDC_CORNER)); - } -} - -// enabled or disabled the whole status controlitems group (with exceptional control) -static void ChangeControlItems(HWND hwndDlg, int status, int except) -{ - if (except != IDC_GRADIENT) - EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT), status); - if (except != IDC_GRADIENT_LR) - EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_LR), status); - if (except != IDC_GRADIENT_RL) - EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_RL), status); - if (except != IDC_GRADIENT_TB) - EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_TB), status); - if (except != IDC_GRADIENT_BT) - EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_BT), status); - if (except != IDC_CORNER) - EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER), status); - if (except != IDC_CORNER_TL) - EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_TL), status); - if (except != IDC_CORNER_TR) - EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_TR), status); - if (except != IDC_CORNER_BR) - EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_BR), status); - if (except != IDC_CORNER_BL) - EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_BL), status); - if (except != IDC_CORNER_TL) - EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_TL), status); - if (except != IDC_MARGINLABLE) - EnableWindow(GetDlgItem(hwndDlg, IDC_MARGINLABLE), status); - if (except != IDC_MRGN_TOP) - EnableWindow(GetDlgItem(hwndDlg, IDC_MRGN_TOP), status); - if (except != IDC_MRGN_RIGHT) - EnableWindow(GetDlgItem(hwndDlg, IDC_MRGN_RIGHT), status); - if (except != IDC_MRGN_BOTTOM) - EnableWindow(GetDlgItem(hwndDlg, IDC_MRGN_BOTTOM), status); - if (except != IDC_MRGN_LEFT) - EnableWindow(GetDlgItem(hwndDlg, IDC_MRGN_LEFT), status); - if (except != IDC_MRGN_TOP_SPIN) - EnableWindow(GetDlgItem(hwndDlg, IDC_MRGN_TOP_SPIN), status); - if (except != IDC_MRGN_RIGHT_SPIN) - EnableWindow(GetDlgItem(hwndDlg, IDC_MRGN_RIGHT_SPIN), status); - if (except != IDC_MRGN_BOTTOM_SPIN) - EnableWindow(GetDlgItem(hwndDlg, IDC_MRGN_BOTTOM_SPIN), status); - if (except != IDC_MRGN_LEFT_SPIN) - EnableWindow(GetDlgItem(hwndDlg, IDC_MRGN_LEFT_SPIN), status); - if (except != IDC_BASECOLOUR) - EnableWindow(GetDlgItem(hwndDlg, IDC_BASECOLOUR), status); - if (except != IDC_COLORLABLE) - EnableWindow(GetDlgItem(hwndDlg, IDC_COLORLABLE), status); - if (except != IDC_BASECOLOUR2) - EnableWindow(GetDlgItem(hwndDlg, IDC_BASECOLOUR2), status); - if (except != IDC_COLOR2LABLE) - EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR2LABLE), status); - if (except != IDC_COLOR2_TRANSPARENT) - EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR2_TRANSPARENT), status); - if (except != IDC_TEXTCOLOUR) - EnableWindow(GetDlgItem(hwndDlg, IDC_TEXTCOLOUR), status); - if (except != IDC_TEXTCOLOURLABLE) - EnableWindow(GetDlgItem(hwndDlg, IDC_TEXTCOLOURLABLE), status); - - if (except != IDC_ALPHA) - EnableWindow(GetDlgItem(hwndDlg, IDC_ALPHA), status); - if (except != IDC_ALPHASPIN) - EnableWindow(GetDlgItem(hwndDlg, IDC_ALPHASPIN), status); - if (except != IDC_ALPHALABLE) - EnableWindow(GetDlgItem(hwndDlg, IDC_ALPHALABLE), status); - if (except != IDC_IGNORE) - EnableWindow(GetDlgItem(hwndDlg, IDC_IGNORE), status); - - if (except != IDC_BORDERTYPE) - EnableWindow(GetDlgItem(hwndDlg, IDC_BORDERTYPE), status); - -} - -static void FillOptionDialogByStatusItem(HWND hwndDlg, StatusItems_t *item) -{ - char itoabuf[15]; - DWORD ret; - int index; - - CheckDlgButton(hwndDlg, IDC_IGNORE, (item->IGNORED) ? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hwndDlg, IDC_GRADIENT, (item->GRADIENT & GRADIENT_ACTIVE) ? BST_CHECKED : BST_UNCHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_LR), item->GRADIENT & GRADIENT_ACTIVE); - EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_RL), item->GRADIENT & GRADIENT_ACTIVE); - EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_TB), item->GRADIENT & GRADIENT_ACTIVE); - EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_BT), item->GRADIENT & GRADIENT_ACTIVE); - CheckDlgButton(hwndDlg, IDC_GRADIENT_LR, (item->GRADIENT & GRADIENT_LR) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_GRADIENT_RL, (item->GRADIENT & GRADIENT_RL) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_GRADIENT_TB, (item->GRADIENT & GRADIENT_TB) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_GRADIENT_BT, (item->GRADIENT & GRADIENT_BT) ? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hwndDlg, IDC_CORNER, (item->CORNER & CORNER_ACTIVE) ? BST_CHECKED : BST_UNCHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_TL), item->CORNER & CORNER_ACTIVE); - EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_TR), item->CORNER & CORNER_ACTIVE); - EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_BR), item->CORNER & CORNER_ACTIVE); - EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_BL), item->CORNER & CORNER_ACTIVE); - - CheckDlgButton(hwndDlg, IDC_CORNER_TL, (item->CORNER & CORNER_TL) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_CORNER_TR, (item->CORNER & CORNER_TR) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_CORNER_BR, (item->CORNER & CORNER_BR) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_CORNER_BL, (item->CORNER & CORNER_BL) ? BST_CHECKED : BST_UNCHECKED); - - ret = item->COLOR; - SendDlgItemMessage(hwndDlg, IDC_BASECOLOUR, CPM_SETDEFAULTCOLOUR, 0, CLCDEFAULT_COLOR); - SendDlgItemMessage(hwndDlg, IDC_BASECOLOUR, CPM_SETCOLOUR, 0, ret); - - ret = item->COLOR2; - SendDlgItemMessage(hwndDlg, IDC_BASECOLOUR2, CPM_SETDEFAULTCOLOUR, 0, CLCDEFAULT_COLOR2); - SendDlgItemMessage(hwndDlg, IDC_BASECOLOUR2, CPM_SETCOLOUR, 0, ret); - - CheckDlgButton(hwndDlg, IDC_COLOR2_TRANSPARENT, (item->COLOR2_TRANSPARENT) ? BST_CHECKED : BST_UNCHECKED); - - ret = item->TEXTCOLOR; - SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOUR, CPM_SETDEFAULTCOLOUR, 0, CLCDEFAULT_TEXTCOLOR); - SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOUR, CPM_SETCOLOUR, 0, ret); - - if (item->ALPHA == -1) { - SetDlgItemTextA(hwndDlg, IDC_ALPHA, ""); - } else { - ret = item->ALPHA; - _itoa(ret, itoabuf, 10); - SetDlgItemTextA(hwndDlg, IDC_ALPHA, itoabuf); - } - - if (item->MARGIN_LEFT == -1) - SetDlgItemTextA(hwndDlg, IDC_MRGN_LEFT, ""); - else { - ret = item->MARGIN_LEFT; - _itoa(ret, itoabuf, 10); - SetDlgItemTextA(hwndDlg, IDC_MRGN_LEFT, itoabuf); - } - - if (item->MARGIN_TOP == -1) - SetDlgItemTextA(hwndDlg, IDC_MRGN_TOP, ""); - else { - ret = item->MARGIN_TOP; - _itoa(ret, itoabuf, 10); - SetDlgItemTextA(hwndDlg, IDC_MRGN_TOP, itoabuf); - } - - if (item->MARGIN_RIGHT == -1) - SetDlgItemTextA(hwndDlg, IDC_MRGN_RIGHT, ""); - else { - ret = item->MARGIN_RIGHT; - _itoa(ret, itoabuf, 10); - SetDlgItemTextA(hwndDlg, IDC_MRGN_RIGHT, itoabuf); - } - - if (item->MARGIN_BOTTOM == -1) - SetDlgItemTextA(hwndDlg, IDC_MRGN_BOTTOM, ""); - else { - ret = item->MARGIN_BOTTOM; - _itoa(ret, itoabuf, 10); - SetDlgItemTextA(hwndDlg, IDC_MRGN_BOTTOM, itoabuf); - } - if(item->BORDERSTYLE == -1) - SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_SETCURSEL, 0, 0); - else { - index = 0; - switch(item->BORDERSTYLE) { - case 0: - case -1: - index = 0; - break; - case BDR_RAISEDOUTER: - index = 1; - break; - case BDR_SUNKENINNER: - index = 2; - break; - case EDGE_BUMP: - index = 3; - break; - case EDGE_ETCHED: - index = 4; - break; - } - SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_SETCURSEL, (WPARAM)index, 0); - } - ReActiveCombo(hwndDlg); -} -// update dlg with selected item -static void FillOptionDialogByCurrentSel(HWND hwndDlg) -{ - int index = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETCURSEL, 0, 0); - int itemData = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETITEMDATA, index, 0); - if(itemData != ID_EXTBKSEPARATOR) { - LastModifiedItem = itemData - ID_EXTBK_FIRST; - - if (CheckItem(itemData - ID_EXTBK_FIRST, hwndDlg)) { - FillOptionDialogByStatusItem(hwndDlg, &StatusItems[itemData - ID_EXTBK_FIRST]); - } - } -} - - -// enabled all status controls if the selected item is a separator -static BOOL CheckItem(int item, HWND hwndDlg) -{ - if (StatusItems[item].statusID == ID_EXTBKSEPARATOR) { - ChangeControlItems(hwndDlg, 0, 0); - return FALSE; - } else { - ChangeControlItems(hwndDlg, 1, 0); - return TRUE; - } -} - -static void SetChangedStatusItemFlag(WPARAM wParam, HWND hwndDlg) -{ - if (LOWORD(wParam) != IDC_ITEMS - && (GetDlgItem(hwndDlg, LOWORD(wParam)) == GetFocus() || HIWORD(wParam) == CPN_COLOURCHANGED) - && (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE || HIWORD(wParam) == CPN_COLOURCHANGED)) { - switch (LOWORD(wParam)) { - case IDC_IGNORE: - ChangedSItems.bIGNORED = TRUE; break; - case IDC_GRADIENT: - ChangedSItems.bGRADIENT = TRUE; break; - case IDC_GRADIENT_LR: - ChangedSItems.bGRADIENT = TRUE;break; - case IDC_GRADIENT_RL: - ChangedSItems.bGRADIENT = TRUE; break; - case IDC_GRADIENT_BT: - ChangedSItems.bGRADIENT = TRUE; break; - case IDC_GRADIENT_TB: - ChangedSItems.bGRADIENT = TRUE; break; - - case IDC_CORNER: - ChangedSItems.bCORNER = TRUE; break; - case IDC_CORNER_TL: - ChangedSItems.bCORNER = TRUE; break; - case IDC_CORNER_TR: - ChangedSItems.bCORNER = TRUE; break; - case IDC_CORNER_BR: - ChangedSItems.bCORNER = TRUE; break; - case IDC_CORNER_BL: - ChangedSItems.bCORNER = TRUE; break; - - case IDC_BASECOLOUR: - ChangedSItems.bCOLOR = TRUE; break; - case IDC_BASECOLOUR2: - ChangedSItems.bCOLOR2 = TRUE; break; - case IDC_COLOR2_TRANSPARENT: - ChangedSItems.bCOLOR2_TRANSPARENT = TRUE; break; - case IDC_TEXTCOLOUR: - ChangedSItems.bTEXTCOLOR = TRUE; break; - - case IDC_ALPHA: - ChangedSItems.bALPHA = TRUE; break; - case IDC_ALPHASPIN: - ChangedSItems.bALPHA = TRUE; break; - - case IDC_MRGN_LEFT: - ChangedSItems.bMARGIN_LEFT = TRUE; break; - case IDC_MRGN_LEFT_SPIN: - ChangedSItems.bMARGIN_LEFT = TRUE; break; - - case IDC_MRGN_TOP: - ChangedSItems.bMARGIN_TOP = TRUE; break; - case IDC_MRGN_TOP_SPIN: - ChangedSItems.bMARGIN_TOP = TRUE; break; - - case IDC_MRGN_RIGHT: - ChangedSItems.bMARGIN_RIGHT = TRUE; break; - case IDC_MRGN_RIGHT_SPIN: - ChangedSItems.bMARGIN_RIGHT = TRUE; break; - - case IDC_MRGN_BOTTOM: - ChangedSItems.bMARGIN_BOTTOM = TRUE; break; - case IDC_MRGN_BOTTOM_SPIN: - ChangedSItems.bMARGIN_BOTTOM = TRUE; break; - - case IDC_BORDERTYPE: - ChangedSItems.bBORDERSTYLE = TRUE; break; - } - } -} - -static BOOL isValidItem(void) -{ - if (StatusItems[LastModifiedItem].statusID == ID_EXTBKSEPARATOR) - return FALSE; - - return TRUE; -} - -// updates the struct with the changed dlg item -static void UpdateStatusStructSettingsFromOptDlg(HWND hwndDlg, int index) -{ - char buf[15]; - ULONG bdrtype; - - if (ChangedSItems.bIGNORED) - StatusItems[index]. IGNORED = IsDlgButtonChecked(hwndDlg, IDC_IGNORE); - - if (ChangedSItems.bGRADIENT) { - StatusItems[index]. GRADIENT = GRADIENT_NONE; - if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)) - StatusItems[index].GRADIENT |= GRADIENT_ACTIVE; - if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT_LR)) - StatusItems[index].GRADIENT |= GRADIENT_LR; - if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT_RL)) - StatusItems[index].GRADIENT |= GRADIENT_RL; - if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT_TB)) - StatusItems[index].GRADIENT |= GRADIENT_TB; - if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT_BT)) - StatusItems[index].GRADIENT |= GRADIENT_BT; - } - if (ChangedSItems.bCORNER) { - StatusItems[index]. CORNER = CORNER_NONE; - if (IsDlgButtonChecked(hwndDlg, IDC_CORNER)) - StatusItems[index].CORNER |= CORNER_ACTIVE ; - if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_TL)) - StatusItems[index].CORNER |= CORNER_TL ; - if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_TR)) - StatusItems[index].CORNER |= CORNER_TR; - if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_BR)) - StatusItems[index].CORNER |= CORNER_BR; - if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_BL)) - StatusItems[index].CORNER |= CORNER_BL; - } - - if (ChangedSItems.bCOLOR) - StatusItems[index]. COLOR = SendDlgItemMessage(hwndDlg, IDC_BASECOLOUR, CPM_GETCOLOUR, 0, 0); - - if (ChangedSItems.bCOLOR2) - StatusItems[index]. COLOR2 = SendDlgItemMessage(hwndDlg, IDC_BASECOLOUR2, CPM_GETCOLOUR, 0, 0); - - if (ChangedSItems.bCOLOR2_TRANSPARENT) - StatusItems[index]. COLOR2_TRANSPARENT = IsDlgButtonChecked(hwndDlg, IDC_COLOR2_TRANSPARENT); - - if (ChangedSItems.bTEXTCOLOR) - StatusItems[index]. TEXTCOLOR = SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOUR, CPM_GETCOLOUR, 0, 0); - - if (ChangedSItems.bALPHA) { - GetWindowTextA(GetDlgItem(hwndDlg, IDC_ALPHA), buf, 10); // can be removed now - if (lstrlenA(buf) > 0) - StatusItems[index]. ALPHA = (BYTE) SendDlgItemMessage(hwndDlg, IDC_ALPHASPIN, UDM_GETPOS, 0, 0); - } - - if (ChangedSItems.bMARGIN_LEFT) { - GetWindowTextA(GetDlgItem(hwndDlg, IDC_MRGN_LEFT), buf, 10); - if (lstrlenA(buf) > 0) - StatusItems[index]. MARGIN_LEFT = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_LEFT_SPIN, UDM_GETPOS, 0, 0); - } - - if (ChangedSItems.bMARGIN_TOP) { - GetWindowTextA(GetDlgItem(hwndDlg, IDC_MRGN_TOP), buf, 10); - if (lstrlenA(buf) > 0) - StatusItems[index]. MARGIN_TOP = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_TOP_SPIN, UDM_GETPOS, 0, 0); - } - - if (ChangedSItems.bMARGIN_RIGHT) { - GetWindowTextA(GetDlgItem(hwndDlg, IDC_MRGN_RIGHT), buf, 10); - if (lstrlenA(buf) > 0) - StatusItems[index]. MARGIN_RIGHT = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_RIGHT_SPIN, UDM_GETPOS, 0, 0); - } - - if (ChangedSItems.bMARGIN_BOTTOM) { - GetWindowTextA(GetDlgItem(hwndDlg, IDC_MRGN_BOTTOM), buf, 10); - if (lstrlenA(buf) > 0) - StatusItems[index]. MARGIN_BOTTOM = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_BOTTOM_SPIN, UDM_GETPOS, 0, 0); - } - if (ChangedSItems.bBORDERSTYLE) { - bdrtype = SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_GETCURSEL, 0, 0); - if(bdrtype == CB_ERR) - StatusItems[index].BORDERSTYLE = 0; - else { - switch(bdrtype) { - case 0: - StatusItems[index].BORDERSTYLE = 0; - break; - case 1: - StatusItems[index].BORDERSTYLE = BDR_RAISEDOUTER; - break; - case 2: - StatusItems[index].BORDERSTYLE = BDR_SUNKENINNER; - break; - case 3: - StatusItems[index].BORDERSTYLE = EDGE_BUMP; - break; - case 4: - StatusItems[index].BORDERSTYLE = EDGE_ETCHED; - break; - default: - StatusItems[index].BORDERSTYLE = 0; - break; - } - } - } -} - -static void SaveLatestChanges(HWND hwndDlg) -{ - int n, itemData; - // process old selection - if (last_selcount > 0) { - for (n = 0; n < last_selcount; n++) { - itemData = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETITEMDATA, last_indizes[n], 0); - if (itemData != ID_EXTBKSEPARATOR) { - UpdateStatusStructSettingsFromOptDlg(hwndDlg, itemData - ID_EXTBK_FIRST); - } - } - } - - // reset bChange - ChangedSItems.bALPHA = FALSE; - ChangedSItems.bGRADIENT = FALSE; - ChangedSItems.bCORNER = FALSE; - ChangedSItems.bCOLOR = FALSE; - ChangedSItems.bCOLOR2 = FALSE; - ChangedSItems.bCOLOR2_TRANSPARENT = FALSE; - ChangedSItems.bTEXTCOLOR = FALSE; - ChangedSItems.bALPHA = FALSE; - ChangedSItems.bMARGIN_LEFT = FALSE; - ChangedSItems.bMARGIN_TOP = FALSE; - ChangedSItems.bMARGIN_RIGHT = FALSE; - ChangedSItems.bMARGIN_BOTTOM = FALSE; - ChangedSItems.bIGNORED = FALSE; - ChangedSItems.bBORDERSTYLE = FALSE; -} - -static UINT _controls_to_refresh[] = { - IDC_BORDERTYPE, - IDC_3DDARKCOLOR, - IDC_3DLIGHTCOLOR, - IDC_MRGN_BOTTOM, - IDC_MRGN_LEFT, - IDC_ALPHASPIN, - IDC_CORNER, - IDC_MRGN_TOP_SPIN, - IDC_MRGN_RIGHT_SPIN, - IDC_MRGN_BOTTOM_SPIN, - IDC_MRGN_LEFT_SPIN, - IDC_GRADIENT, - IDC_GRADIENT_LR, - IDC_GRADIENT_RL, - IDC_GRADIENT_TB, - IDC_BASECOLOUR, - IDC_ALPHA, - IDC_MRGN_TOP, - IDC_MRGN_RIGHT, - IDC_GRADIENT_BT, - IDC_BASECOLOUR2, - IDC_TEXTCOLOUR, - IDC_CORNER_TL, - IDC_CORNER_TR, - IDC_CORNER_BR, - IDC_CORNER_BL, - IDC_IGNORE, - IDC_ALPHALABLE, - IDC_COLOR2LABLE, - IDC_COLORLABLE, - IDC_TEXTCOLOURLABLE, - IDC_COLOR2_TRANSPARENT, - 0 -}; - -static void RefreshControls(HWND hwnd) -{ - for(int i = 0; _controls_to_refresh[i]; i++) - InvalidateRect(GetDlgItem(hwnd, _controls_to_refresh[i]), NULL, FALSE); -} - -// wenn die listbox geändert wurde -static void OnListItemsChange(HWND hwndDlg) -{ - SendMessage(hwndDlg, WM_SETREDRAW, FALSE, 0); - SaveLatestChanges(hwndDlg); - - // set new selection - last_selcount = SendMessage(GetDlgItem(hwndDlg, IDC_ITEMS), LB_GETSELCOUNT, 0, 0); - if (last_selcount > 0) { - int n, real_index, itemData, first_item; - StatusItems_t DialogSettingForMultiSel; - - // get selected indizes - SendMessage(GetDlgItem(hwndDlg, IDC_ITEMS), LB_GETSELITEMS, 64, (LPARAM) last_indizes); - - // initialize with first items value - - first_item = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETITEMDATA, last_indizes[0], 0) - ID_EXTBK_FIRST; - DialogSettingForMultiSel = StatusItems[first_item]; - for (n = 0; n < last_selcount; n++) { - itemData = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETITEMDATA, last_indizes[n], 0); - if (itemData != ID_EXTBKSEPARATOR) { - real_index = itemData - ID_EXTBK_FIRST; - if (StatusItems[real_index].ALPHA != StatusItems[first_item].ALPHA) - DialogSettingForMultiSel.ALPHA = -1; - if (StatusItems[real_index].COLOR != StatusItems[first_item].COLOR) - DialogSettingForMultiSel.COLOR = CLCDEFAULT_COLOR; - if (StatusItems[real_index].COLOR2 != StatusItems[first_item].COLOR2) - DialogSettingForMultiSel.COLOR2 = CLCDEFAULT_COLOR2; - if (StatusItems[real_index].COLOR2_TRANSPARENT != StatusItems[first_item].COLOR2_TRANSPARENT) - DialogSettingForMultiSel.COLOR2_TRANSPARENT = CLCDEFAULT_COLOR2_TRANSPARENT; - if (StatusItems[real_index].TEXTCOLOR != StatusItems[first_item].TEXTCOLOR) - DialogSettingForMultiSel.TEXTCOLOR = CLCDEFAULT_TEXTCOLOR; - if (StatusItems[real_index].CORNER != StatusItems[first_item].CORNER) - DialogSettingForMultiSel.CORNER = CLCDEFAULT_CORNER; - if (StatusItems[real_index].GRADIENT != StatusItems[first_item].GRADIENT) - DialogSettingForMultiSel.GRADIENT = CLCDEFAULT_GRADIENT; - if (StatusItems[real_index].IGNORED != StatusItems[first_item].IGNORED) - DialogSettingForMultiSel.IGNORED = CLCDEFAULT_IGNORE; - if (StatusItems[real_index].MARGIN_BOTTOM != StatusItems[first_item].MARGIN_BOTTOM) - DialogSettingForMultiSel.MARGIN_BOTTOM = -1; - if (StatusItems[real_index].MARGIN_LEFT != StatusItems[first_item].MARGIN_LEFT) - DialogSettingForMultiSel.MARGIN_LEFT = -1; - if (StatusItems[real_index].MARGIN_RIGHT != StatusItems[first_item].MARGIN_RIGHT) - DialogSettingForMultiSel.MARGIN_RIGHT = -1; - if (StatusItems[real_index].MARGIN_TOP != StatusItems[first_item].MARGIN_TOP) - DialogSettingForMultiSel.MARGIN_TOP = -1; - if (StatusItems[real_index].BORDERSTYLE != StatusItems[first_item].BORDERSTYLE) - DialogSettingForMultiSel.BORDERSTYLE = -1; - } - } - - if (last_selcount == 1 && StatusItems[first_item].statusID == ID_EXTBKSEPARATOR) { - ChangeControlItems(hwndDlg, 0, 0); - last_selcount = 0; - } else - ChangeControlItems(hwndDlg, 1, 0); - FillOptionDialogByStatusItem(hwndDlg, &DialogSettingForMultiSel); - InvalidateRect(GetDlgItem(hwndDlg, IDC_ITEMS), NULL, FALSE); - } - SendMessage(hwndDlg, WM_SETREDRAW, TRUE, 0); - RefreshControls(hwndDlg); -} - -// fills the combobox of the options dlg for the first time -static void FillItemList(HWND hwndDlg) -{ - int n, iOff; - UINT item; - - for (n = 0; n <= ID_EXTBK_LAST - ID_EXTBK_FIRST; n++) { - iOff = 0; - if(strstr(StatusItems[n].szName, "{-}")) { - item = SendDlgItemMessageA(hwndDlg, IDC_ITEMS, LB_ADDSTRING, 0, (LPARAM)"------------------------"); - SendDlgItemMessageA(hwndDlg, IDC_ITEMS, LB_SETITEMDATA, item, ID_EXTBKSEPARATOR); - iOff = 3; - } - item = SendDlgItemMessageA(hwndDlg, IDC_ITEMS, LB_ADDSTRING, 0, (LPARAM)&StatusItems[n].szName[iOff]); - SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_SETITEMDATA, item, ID_EXTBK_FIRST + n); - } -} - -static BOOL CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - SKINDESCRIPTION *psd = (SKINDESCRIPTION *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - - if(psd) { - ID_EXTBK_FIRST = psd->firstItem; - ID_EXTBK_LAST = psd->lastItem; - StatusItems = psd->StatusItems; - } - switch (msg) { - case WM_INITDIALOG: - psd = (SKINDESCRIPTION *)malloc(sizeof(SKINDESCRIPTION)); - ZeroMemory(psd, sizeof(SKINDESCRIPTION)); - CopyMemory(psd, (void *)lParam, sizeof(SKINDESCRIPTION)); - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)psd); - - if(psd) { - ID_EXTBK_FIRST = psd->firstItem; - ID_EXTBK_LAST = psd->lastItem; - StatusItems = psd->StatusItems; - } - - TranslateDialogDefault(hwndDlg); - FillItemList(hwndDlg); - SendMessage(hwndDlg, WM_USER + 101, 0, 0); - - psd->hMenuItems = CreatePopupMenu(); - AppendMenu(psd->hMenuItems, MF_STRING | MF_DISABLED, (UINT_PTR)0, _T("Copy from")); - AppendMenuA(psd->hMenuItems, MF_SEPARATOR, (UINT_PTR)0, NULL); - - { - int i; - - for(i = ID_EXTBK_FIRST; i <= ID_EXTBK_LAST; i++) { - int iOff = StatusItems[i - ID_EXTBK_FIRST].szName[0] == '{' ? 3 : 0; - if(iOff) - AppendMenuA(psd->hMenuItems, MF_SEPARATOR, (UINT_PTR)0, NULL); - AppendMenuA(psd->hMenuItems, MF_STRING, (UINT_PTR)i, &StatusItems[i - ID_EXTBK_FIRST].szName[iOff]); - } - } - return TRUE; - case WM_USER + 101: - { - DBVARIANT dbv = {0}; - - SendDlgItemMessage(hwndDlg, IDC_MRGN_LEFT_SPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); - SendDlgItemMessage(hwndDlg, IDC_MRGN_TOP_SPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); - SendDlgItemMessage(hwndDlg, IDC_MRGN_RIGHT_SPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); - SendDlgItemMessage(hwndDlg, IDC_MRGN_BOTTOM_SPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); - SendDlgItemMessage(hwndDlg, IDC_ALPHASPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); - - SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("")); - SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Raised")); - SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Sunken")); - SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Bumped")); - SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Etched")); - - SendDlgItemMessage(hwndDlg, IDC_3DDARKCOLOR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "CLCExt", "3ddark", RGB(224,224,224))); - SendDlgItemMessage(hwndDlg, IDC_3DLIGHTCOLOR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "CLCExt", "3dbright", RGB(224,224,224))); - return 0; - } - - case WM_DRAWITEM: - { - DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam; - int iItem = dis->itemData; - StatusItems_t *item = 0; - - SetBkMode(dis->hDC, TRANSPARENT); - FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_WINDOW)); - - if(iItem >= ID_EXTBK_FIRST && iItem <= ID_EXTBK_LAST) - item = &StatusItems[iItem - ID_EXTBK_FIRST]; - - if (dis->itemState & ODS_SELECTED && iItem != ID_EXTBKSEPARATOR) { - FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_HIGHLIGHT)); - SetTextColor(dis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); - } - else { - FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_WINDOW)); - if(item && item->IGNORED) - SetTextColor(dis->hDC, RGB(255, 0, 0)); - else - SetTextColor(dis->hDC, GetSysColor(COLOR_WINDOWTEXT)); - } - if(iItem == ID_EXTBKSEPARATOR) { - HPEN hPen, hPenOld; - POINT pt; - - hPen = CreatePen(PS_SOLID, 2, GetSysColor(COLOR_WINDOWTEXT)); - hPenOld = (HPEN)SelectObject(dis->hDC, hPen); - - MoveToEx(dis->hDC, dis->rcItem.left, (dis->rcItem.top + dis->rcItem.bottom) / 2, &pt); - LineTo(dis->hDC, dis->rcItem.right, (dis->rcItem.top + dis->rcItem.bottom) / 2); - SelectObject(dis->hDC, hPenOld); - DeleteObject((HGDIOBJ)hPen); - } - else if(dis->itemID >= 0 && item) { - char *szName = item->szName[0] == '{' ? &item->szName[3] : item->szName; - - TextOutA(dis->hDC, dis->rcItem.left, dis->rcItem.top, szName, lstrlenA(szName)); - } - return TRUE; - } - - case WM_CONTEXTMENU: - { - POINT pt; - RECT rc; - HWND hwndList = GetDlgItem(hwndDlg, IDC_ITEMS); - - GetCursorPos(&pt); - GetWindowRect(hwndList, &rc); - if(PtInRect(&rc, pt)) { - int iSelection = (int)TrackPopupMenu(psd->hMenuItems, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); - - if(iSelection >= ID_EXTBK_FIRST && iSelection <= ID_EXTBK_LAST) { - iSelection -= ID_EXTBK_FIRST; - - for(int i = ID_EXTBK_FIRST; i <= ID_EXTBK_LAST; i++) { - if(SendMessage(hwndList, LB_GETSEL, i - ID_EXTBK_FIRST, 0) > 0) { - int iIndex = SendMessage(hwndList, LB_GETITEMDATA, i - ID_EXTBK_FIRST, 0); - iIndex -= ID_EXTBK_FIRST; - - if(iIndex >= 0) { - StatusItems[iIndex].ALPHA = StatusItems[iSelection].ALPHA; - StatusItems[iIndex].BORDERSTYLE = StatusItems[iSelection].BORDERSTYLE; - StatusItems[iIndex].COLOR = StatusItems[iSelection].COLOR; - StatusItems[iIndex].COLOR2 = StatusItems[iSelection].COLOR2; - StatusItems[iIndex].COLOR2_TRANSPARENT = StatusItems[iSelection].COLOR2_TRANSPARENT; - StatusItems[iIndex].CORNER = StatusItems[iSelection].CORNER; - StatusItems[iIndex].GRADIENT = StatusItems[iSelection].GRADIENT; - StatusItems[iIndex].IGNORED = StatusItems[iSelection].IGNORED; - StatusItems[iIndex].imageItem = StatusItems[iSelection].imageItem; - StatusItems[iIndex].MARGIN_BOTTOM = StatusItems[iSelection].MARGIN_BOTTOM; - StatusItems[iIndex].MARGIN_LEFT = StatusItems[iSelection].MARGIN_LEFT; - StatusItems[iIndex].MARGIN_RIGHT = StatusItems[iSelection].MARGIN_RIGHT; - StatusItems[iIndex].MARGIN_TOP = StatusItems[iSelection].MARGIN_TOP; - StatusItems[iIndex].TEXTCOLOR = StatusItems[iSelection].TEXTCOLOR; - } - } - } - OnListItemsChange(hwndDlg); - } - } - break; - } - case WM_COMMAND: - // this will check if the user changed some actual statusitems values - // if yes the flag bChanged will be set to TRUE - SetChangedStatusItemFlag(wParam, hwndDlg); - switch(LOWORD(wParam)) { - case IDC_ITEMS: - if (HIWORD(wParam) != LBN_SELCHANGE) - return FALSE; - { - int iItem = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETCURSEL, 0, 0), 0); - if(iItem == ID_EXTBKSEPARATOR) - return FALSE; - } - OnListItemsChange(hwndDlg); - if(psd->pfnClcOptionsChanged) - psd->pfnClcOptionsChanged(); - break; - case IDC_GRADIENT: - ReActiveCombo(hwndDlg); - break; - case IDC_CORNER: - ReActiveCombo(hwndDlg); - break; - case IDC_IGNORE: - ReActiveCombo(hwndDlg); - break; - case IDC_COLOR2_TRANSPARENT: - ReActiveCombo(hwndDlg); - break; - case IDC_BORDERTYPE: - break; - } - if ((LOWORD(wParam) == IDC_ALPHA || LOWORD(wParam) == IDC_MRGN_LEFT || LOWORD(wParam) == IDC_MRGN_BOTTOM || LOWORD(wParam) == IDC_MRGN_TOP || LOWORD(wParam) == IDC_MRGN_RIGHT) && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())) - return 0; - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - - case WM_NOTIFY: - switch (((LPNMHDR) lParam)->idFrom) { - case 0: - switch (((LPNMHDR) lParam)->code) { - case PSN_APPLY: - // save user made changes - SaveLatestChanges(hwndDlg); - // save struct to DB - if(psd->pfnSaveCompleteStruct) - psd->pfnSaveCompleteStruct(); - DBWriteContactSettingDword(NULL, "CLCExt", "3dbright", SendDlgItemMessage(hwndDlg, IDC_3DLIGHTCOLOR, CPM_GETCOLOUR, 0, 0)); - DBWriteContactSettingDword(NULL, "CLCExt", "3ddark", SendDlgItemMessage(hwndDlg, IDC_3DDARKCOLOR, CPM_GETCOLOUR, 0, 0)); - - if(psd->pfnClcOptionsChanged) - psd->pfnClcOptionsChanged(); - if(psd->hwndCLUI) { - SendMessage(psd->hwndCLUI, WM_SIZE, 0, 0); - PostMessage(psd->hwndCLUI, WM_USER+100, 0, 0); // CLUIINTM_REDRAW - } - break; - } - } - break; - case WM_DESTROY: - DestroyMenu(psd->hMenuItems); - break; - case WM_NCDESTROY: - free(psd); - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)0); - break; - } - return FALSE; -} - -/* - * unimplemented -*/ - -static BOOL CALLBACK SkinEdit_ImageItemEditProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - return FALSE; -} - -static INT_PTR SkinEdit_FillByCurrentSel(WPARAM wParam, LPARAM lParam) -{ - if(wParam) - FillOptionDialogByCurrentSel((HWND)wParam); - return 0; -} - -/* - * service function - * creates additional tab pages under the given parent window handle - * expects a SKINDESCRIPTON * in lParam -*/ - -static INT_PTR SkinEdit_Invoke(WPARAM wParam, LPARAM lParam) -{ - SKINDESCRIPTION *psd = (SKINDESCRIPTION *)lParam; - TCITEM tci = {0}; - RECT rcClient; - int iTabs; - - if(psd->cbSize != sizeof(SKINDESCRIPTION)) - return 0; - - iTabs = TabCtrl_GetItemCount(psd->hWndTab); - GetClientRect(psd->hWndParent, &rcClient); - - tci.mask = TCIF_PARAM|TCIF_TEXT; - tci.lParam = (LPARAM)CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SKINITEMEDIT), psd->hWndParent, (DLGPROC)SkinEdit_ExtBkDlgProc, (LPARAM)psd); - - tci.pszText = TranslateT("Skin items"); - TabCtrl_InsertItem(psd->hWndTab, iTabs++, &tci); - MoveWindow((HWND)tci.lParam, 5, 25, rcClient.right - 9, rcClient.bottom - 60, 1); - psd->hwndSkinEdit = (HWND)tci.lParam; - - /* - tci.lParam = (LPARAM)CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_IMAGEITEMEDIT), psd->hWndParent, (DLGPROC)SkinEdit_ImageItemEditProc, (LPARAM)psd); - tci.pszText = TranslateT("Image items"); - TabCtrl_InsertItem(psd->hWndTab, iTabs++, &tci); - MoveWindow((HWND)tci.lParam, 5, 25, rcClient.right - 9, rcClient.bottom - 60, 1); - psd->hwndImageEdit = (HWND)tci.lParam; - */ - - return (INT_PTR)psd->hwndSkinEdit; -} - -static HANDLE hSvc_invoke = 0, hSvc_fillby = 0; - -static int LoadModule() -{ - hSvc_invoke = CreateServiceFunction(MS_CLNSE_INVOKE, (MIRANDASERVICE)SkinEdit_Invoke); - hSvc_fillby = CreateServiceFunction(MS_CLNSE_FILLBYCURRENTSEL, (MIRANDASERVICE)SkinEdit_FillByCurrentSel); - return 0; -} - -extern "C" __declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD mirandaVersion) -{ - return &pluginInfo; -} - -/* - * define our own MUUID, since this is a special plugin... - */ -extern "C" static const MUUID interfaces[] = {MIID_TESTPLUGIN, { 0x70ff4eef, 0xcb7b, 0x4d88, { 0x85, 0x60, 0x7d, 0xe3, 0xa6, 0x68, 0x5c, 0xe3 }}, MIID_LAST}; -extern "C" __declspec(dllexport) const MUUID * MirandaPluginInterfaces(void) -{ - return interfaces; -} - -static int ModulesLoaded(WPARAM wParam, LPARAM lParam) -{ - return 0; -} - -static int systemModulesLoaded(WPARAM wParam, LPARAM lParam) -{ - ModulesLoaded(wParam, lParam); - return 0; -} - -extern "C" int __declspec(dllexport) Load(void) -{ - mir_getLP(&pluginInfo); - return(LoadModule()); -} - -static int ShutdownProc(WPARAM wParam, LPARAM lParam) -{ - if(hSvc_invoke) - DestroyServiceFunction(hSvc_invoke); - if(hSvc_fillby) - DestroyServiceFunction(hSvc_fillby); - return 0; -} - -extern "C" int __declspec(dllexport) Unload(void) -{ - return ShutdownProc(0, 0); -} - -BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD dwReason, LPVOID reserved) -{ - g_hInst = hInstDLL; - DisableThreadLibraryCalls(g_hInst); - return TRUE; -} - diff --git a/plugins/Clist_nicer/skineditor/res/skinedit.rc b/plugins/Clist_nicer/skineditor/res/skinedit.rc new file mode 100644 index 0000000000..c5d8875b20 --- /dev/null +++ b/plugins/Clist_nicer/skineditor/res/skinedit.rc @@ -0,0 +1,177 @@ +// Microsoft Visual C++ generated resource script. +// +#include "..\src\skineditres.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include +#include +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Neutral resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) +#ifdef _WIN32 +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_SKINITEMEDIT DIALOGEX 0, 0, 303, 209 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Skin items",IDC_STATIC,2,0,119,205 + LISTBOX IDC_ITEMS,7,10,109,178,LBS_OWNERDRAWFIXED | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL | WS_TABSTOP + GROUPBOX "General",IDC_STATIC,125,0,174,61 + CONTROL "Gradient",IDC_GRADIENT,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_GROUP | WS_TABSTOP,129,9,85,10 + CONTROL "Left to right",IDC_GRADIENT_LR,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,139,19,75,10 + CONTROL "Right to left",IDC_GRADIENT_RL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,139,29,75,10 + CONTROL "Top to bottom",IDC_GRADIENT_TB,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,139,39,75,10 + CONTROL "Bottom to top",IDC_GRADIENT_BT,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,139,49,75,10 + CONTROL "Round corners",IDC_CORNER,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_GROUP | WS_TABSTOP,218,9,75,10 + CONTROL "Top-Left",IDC_CORNER_TL,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,228,19,65,10 + CONTROL "Top-Right",IDC_CORNER_TR,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,228,29,65,10 + CONTROL "Bottom-Right",IDC_CORNER_BR,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,228,39,65,10 + CONTROL "Bottom-Left",IDC_CORNER_BL,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,228,49,65,10 + GROUPBOX "Item colors",IDC_STATIC,126,62,174,53 + LTEXT "First color",IDC_COLORLABLE,130,73,53,8,WS_DISABLED + CONTROL "",IDC_BASECOLOUR,"ColourPicker",WS_DISABLED | WS_TABSTOP,186,72,22,10 + LTEXT "Textcolor",IDC_TEXTCOLOURLABLE,221,72,48,8,WS_DISABLED + CONTROL "",IDC_TEXTCOLOUR,"ColourPicker",WS_DISABLED | WS_TABSTOP,271,72,22,10 + LTEXT "Second color",IDC_COLOR2LABLE,130,86,53,8,WS_DISABLED + CONTROL "",IDC_BASECOLOUR2,"ColourPicker",WS_DISABLED | WS_TABSTOP,186,85,22,10 + CONTROL "Transparent",IDC_COLOR2_TRANSPARENT,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,221,85,72,10 + LTEXT "Alpha (percent)",IDC_ALPHALABLE,130,100,120,8,WS_DISABLED + EDITTEXT IDC_ALPHA,250,97,33,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED + CONTROL "",IDC_ALPHASPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_DISABLED,280,97,12,14 + GROUPBOX "Item margins",IDC_STATIC,125,117,174,44 + EDITTEXT IDC_MRGN_LEFT,144,135,26,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED + CONTROL "",IDC_MRGN_LEFT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_DISABLED,171,131,10,14 + EDITTEXT IDC_MRGN_TOP,198,125,26,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED + CONTROL "",IDC_MRGN_TOP_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_DISABLED,229,119,10,14 + EDITTEXT IDC_MRGN_RIGHT,254,135,26,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED + CONTROL "",IDC_MRGN_RIGHT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_DISABLED,279,131,10,14 + EDITTEXT IDC_MRGN_BOTTOM,198,143,26,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED + CONTROL "",IDC_MRGN_BOTTOM_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_DISABLED,214,139,10,14 + GROUPBOX "Item borders",IDC_STATIC,125,164,174,40 + LTEXT "Border style",IDC_STATIC,130,175,57,10 + COMBOBOX IDC_BORDERTYPE,192,173,102,54,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + LTEXT "3D border (bright / dark)",IDC_STATIC,130,190,89,11 + CONTROL "",IDC_3DLIGHTCOLOR,"ColourPicker",WS_TABSTOP,227,188,29,12 + CONTROL "",IDC_3DDARKCOLOR,"ColourPicker",WS_TABSTOP,265,188,29,12 + CONTROL "Item ignored",IDC_IGNORE,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,9,191,103,10 +END + +IDD_IMAGEITEMEDIT DIALOGEX 0, 0, 303, 209 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CAPTION +CAPTION "Dialog" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + CTEXT "Not yet supported",IDC_STATIC,69,76,158,17 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +#ifndef APSTUDIO_INVOKED +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,0,0,1 + PRODUCTVERSION 0,0,0,1 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + + BEGIN + BLOCK "0c0704b0" + BEGIN + VALUE "FileDescription", "Skin Editor" + VALUE "FileVersion", "0, 0, 0, 2" + VALUE "InternalName", "CLN SkinEdit" + VALUE "LegalCopyright", "Copyright (C) 2006" + VALUE "LegalTrademarks", "GPL" + VALUE "OriginalFilename", "cln_skinedit.dll" + VALUE "ProductName", "Clist Nicer+ skin editor" + VALUE "ProductVersion", "0, 0, 0, 2" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0xc07, 1200 + END +END +#endif + +#endif // Neutral resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "..\src\skineditres.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include \r\n" + "#include \0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" +END + +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/plugins/Clist_nicer/skineditor/skinedit.rc b/plugins/Clist_nicer/skineditor/skinedit.rc deleted file mode 100644 index 760d20b00d..0000000000 --- a/plugins/Clist_nicer/skineditor/skinedit.rc +++ /dev/null @@ -1,177 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "skineditres.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include -#include -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Neutral resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) -#ifdef _WIN32 -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_SKINITEMEDIT DIALOGEX 0, 0, 303, 209 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Skin items",IDC_STATIC,2,0,119,205 - LISTBOX IDC_ITEMS,7,10,109,178,LBS_OWNERDRAWFIXED | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL | WS_TABSTOP - GROUPBOX "General",IDC_STATIC,125,0,174,61 - CONTROL "Gradient",IDC_GRADIENT,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_GROUP | WS_TABSTOP,129,9,85,10 - CONTROL "Left to right",IDC_GRADIENT_LR,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,139,19,75,10 - CONTROL "Right to left",IDC_GRADIENT_RL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,139,29,75,10 - CONTROL "Top to bottom",IDC_GRADIENT_TB,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,139,39,75,10 - CONTROL "Bottom to top",IDC_GRADIENT_BT,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,139,49,75,10 - CONTROL "Round corners",IDC_CORNER,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_GROUP | WS_TABSTOP,218,9,75,10 - CONTROL "Top-Left",IDC_CORNER_TL,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,228,19,65,10 - CONTROL "Top-Right",IDC_CORNER_TR,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,228,29,65,10 - CONTROL "Bottom-Right",IDC_CORNER_BR,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,228,39,65,10 - CONTROL "Bottom-Left",IDC_CORNER_BL,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,228,49,65,10 - GROUPBOX "Item colors",IDC_STATIC,126,62,174,53 - LTEXT "First color",IDC_COLORLABLE,130,73,53,8,WS_DISABLED - CONTROL "",IDC_BASECOLOUR,"ColourPicker",WS_DISABLED | WS_TABSTOP,186,72,22,10 - LTEXT "Textcolor",IDC_TEXTCOLOURLABLE,221,72,48,8,WS_DISABLED - CONTROL "",IDC_TEXTCOLOUR,"ColourPicker",WS_DISABLED | WS_TABSTOP,271,72,22,10 - LTEXT "Second color",IDC_COLOR2LABLE,130,86,53,8,WS_DISABLED - CONTROL "",IDC_BASECOLOUR2,"ColourPicker",WS_DISABLED | WS_TABSTOP,186,85,22,10 - CONTROL "Transparent",IDC_COLOR2_TRANSPARENT,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,221,85,72,10 - LTEXT "Alpha (percent)",IDC_ALPHALABLE,130,100,120,8,WS_DISABLED - EDITTEXT IDC_ALPHA,250,97,33,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED - CONTROL "",IDC_ALPHASPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_DISABLED,280,97,12,14 - GROUPBOX "Item margins",IDC_STATIC,125,117,174,44 - EDITTEXT IDC_MRGN_LEFT,144,135,26,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED - CONTROL "",IDC_MRGN_LEFT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_DISABLED,171,131,10,14 - EDITTEXT IDC_MRGN_TOP,198,125,26,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED - CONTROL "",IDC_MRGN_TOP_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_DISABLED,229,119,10,14 - EDITTEXT IDC_MRGN_RIGHT,254,135,26,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED - CONTROL "",IDC_MRGN_RIGHT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_DISABLED,279,131,10,14 - EDITTEXT IDC_MRGN_BOTTOM,198,143,26,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED - CONTROL "",IDC_MRGN_BOTTOM_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_DISABLED,214,139,10,14 - GROUPBOX "Item borders",IDC_STATIC,125,164,174,40 - LTEXT "Border style",IDC_STATIC,130,175,57,10 - COMBOBOX IDC_BORDERTYPE,192,173,102,54,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "3D border (bright / dark)",IDC_STATIC,130,190,89,11 - CONTROL "",IDC_3DLIGHTCOLOR,"ColourPicker",WS_TABSTOP,227,188,29,12 - CONTROL "",IDC_3DDARKCOLOR,"ColourPicker",WS_TABSTOP,265,188,29,12 - CONTROL "Item ignored",IDC_IGNORE,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,9,191,103,10 -END - -IDD_IMAGEITEMEDIT DIALOGEX 0, 0, 303, 209 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CAPTION -CAPTION "Dialog" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - CTEXT "Not yet supported",IDC_STATIC,69,76,158,17 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -#ifndef APSTUDIO_INVOKED -VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,0,0,1 - PRODUCTVERSION 0,0,0,1 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - - BEGIN - BLOCK "0c0704b0" - BEGIN - VALUE "FileDescription", "Skin Editor (UNICODE)" - VALUE "FileVersion", "0, 0, 0, 2" - VALUE "InternalName", "CLN SkinEdit (UNICODE)" - VALUE "LegalCopyright", "Copyright (C) 2006" - VALUE "LegalTrademarks", "GPL" - VALUE "OriginalFilename", "cln_skinedit.dll" - VALUE "ProductName", "Clist Nicer+ skin editor" - VALUE "ProductVersion", "0, 0, 0, 2" - END - END - - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0xc07, 1200 - END -END -#endif - -#endif // Neutral resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "skineditres.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include \r\n" - "#include \0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" -END - -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/plugins/Clist_nicer/skineditor/skinedit_10.vcxproj b/plugins/Clist_nicer/skineditor/skinedit_10.vcxproj index 721b578247..6bfbbe4c98 100644 --- a/plugins/Clist_nicer/skineditor/skinedit_10.vcxproj +++ b/plugins/Clist_nicer/skineditor/skinedit_10.vcxproj @@ -75,17 +75,16 @@ OnlyExplicitInline Size ..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;_UNICODE;UNICODE;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) true true Level3 - 4996;%(DisableSpecificWarnings) false Fast false - NDEBUG;_UNICODE;UNICODE;%(PreprocessorDefinitions) + NDEBUG;%(PreprocessorDefinitions) ..\..\..\include\msapi;%(AdditionalIncludeDirectories) @@ -103,15 +102,14 @@ Disabled ..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;UNICODE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL Level3 EditAndContinue - 4996;%(DisableSpecificWarnings) - _DEBUG;_UNICODE;UNICODE;%(PreprocessorDefinitions) + _DEBUG;%(PreprocessorDefinitions) ..\..\..\include\msapi;%(AdditionalIncludeDirectories) @@ -129,17 +127,16 @@ OnlyExplicitInline Size ..\..\..\include\;%(AdditionalIncludeDirectories) - WIN64;NDEBUG;_WINDOWS;_USRDLL;_UNICODE;UNICODE;%(PreprocessorDefinitions) + WIN64;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) true true Level3 - 4996;%(DisableSpecificWarnings) false Fast false - NDEBUG;_UNICODE;UNICODE;%(PreprocessorDefinitions) + NDEBUG;%(PreprocessorDefinitions) ..\..\..\include\msapi;%(AdditionalIncludeDirectories) @@ -157,14 +154,13 @@ Disabled ..\..\..\include;%(AdditionalIncludeDirectories) - WIN64;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;UNICODE;%(PreprocessorDefinitions) + WIN64;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL Level3 - 4996;%(DisableSpecificWarnings) - _DEBUG;_UNICODE;UNICODE;%(PreprocessorDefinitions) + _DEBUG;%(PreprocessorDefinitions) ..\..\..\include\msapi;%(AdditionalIncludeDirectories) @@ -177,14 +173,14 @@ - + - + - - + + diff --git a/plugins/Clist_nicer/skineditor/skinedit_10.vcxproj.filters b/plugins/Clist_nicer/skineditor/skinedit_10.vcxproj.filters index db3db0a81f..9527aaed45 100644 --- a/plugins/Clist_nicer/skineditor/skinedit_10.vcxproj.filters +++ b/plugins/Clist_nicer/skineditor/skinedit_10.vcxproj.filters @@ -13,25 +13,22 @@ {3527c0e6-563d-4d23-9b58-2087fa7f94b0} ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe - - {7ee02dac-0457-4fee-92e9-6e8387ff910f} - - + Source Files - - Source Files + + Resource Files - + Header Files - + Header Files diff --git a/plugins/Clist_nicer/skineditor/skineditres.h b/plugins/Clist_nicer/skineditor/skineditres.h deleted file mode 100644 index 33183de397..0000000000 --- a/plugins/Clist_nicer/skineditor/skineditres.h +++ /dev/null @@ -1,51 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by skinedit.rc -// -#define IDD_SKINITEMEDIT 101 -#define IDD_IMAGEITEMEDIT 102 -#define IDC_BORDERTYPE 1017 -#define IDC_3DDARKCOLOR 1018 -#define IDC_3DLIGHTCOLOR 1019 -#define IDC_MRGN_BOTTOM 1670 -#define IDC_MRGN_LEFT 1671 -#define IDC_ALPHASPIN 1682 -#define IDC_ITEMS 1688 -#define IDC_CORNER 1689 -#define IDC_MRGN_TOP_SPIN 1693 -#define IDC_MRGN_RIGHT_SPIN 1694 -#define IDC_MRGN_BOTTOM_SPIN 1695 -#define IDC_MRGN_LEFT_SPIN 1696 -#define IDC_GRADIENT 1699 -#define IDC_GRADIENT_LR 1700 -#define IDC_GRADIENT_RL 1701 -#define IDC_GRADIENT_TB 1702 -#define IDC_BASECOLOUR 1703 -#define IDC_ALPHA 1704 -#define IDC_MRGN_TOP 1705 -#define IDC_MRGN_RIGHT 1706 -#define IDC_GRADIENT_BT 1707 -#define IDC_BASECOLOUR2 1708 -#define IDC_TEXTCOLOUR 1709 -#define IDC_CORNER_TL 1710 -#define IDC_CORNER_TR 1711 -#define IDC_CORNER_BR 1712 -#define IDC_CORNER_BL 1713 -#define IDC_COLORLABLE 1714 -#define IDC_MARGINLABLE 1715 -#define IDC_ALPHALABLE 1716 -#define IDC_IGNORE 1717 -#define IDC_COLOR2LABLE 1718 -#define IDC_COLOR2_TRANSPARENT 1719 -#define IDC_TEXTCOLOURLABLE 1720 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/plugins/Clist_nicer/skineditor/src/commonheaders.h b/plugins/Clist_nicer/skineditor/src/commonheaders.h new file mode 100644 index 0000000000..1d6d88b245 --- /dev/null +++ b/plugins/Clist_nicer/skineditor/src/commonheaders.h @@ -0,0 +1,61 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2004 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. +*/ + +#define _CRT_SECURE_NO_WARNINGS +#define _WIN32_WINNT 0x0501 + +#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 "../../src/include/m_cln_skinedit.h" + +// shared vars +extern HINSTANCE g_hInst; diff --git a/plugins/Clist_nicer/skineditor/src/main.cpp b/plugins/Clist_nicer/skineditor/src/main.cpp new file mode 100644 index 0000000000..de1996f2f5 --- /dev/null +++ b/plugins/Clist_nicer/skineditor/src/main.cpp @@ -0,0 +1,970 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2004 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 "commonheaders.h" +#include "skineditres.h" + +#define ID_EXTBKSEPARATOR 40200 + +PLUGININFOEX pluginInfo = { + sizeof(PLUGININFOEX), + "Skin editor for clist_nicer+", + PLUGIN_MAKE_VERSION(0, 0, 0, 4), + "Allow inline skin item editing for clist nicer+.", + "Nightwish, Pixel", + "", + "Copyright 2000-2006 Miranda-IM project", + "http://www.miranda-im.org", + UNICODE_AWARE, + {0x21948c89, 0xb549, 0x4c9d, { 0x8b, 0x4f, 0x3f, 0x37, 0x26, 0xec, 0x6b, 0x4b }} +}; + +HINSTANCE g_hInst = 0; +int hLangpack; + +StatusItems_t *StatusItems; +ChangedSItems_t ChangedSItems = {0}; + +static int LastModifiedItem = -1; +static int last_selcount = 0; +static int last_indizes[64]; +static int ID_EXTBK_LAST = 0, ID_EXTBK_FIRST = 0; + +/* + * prototypes + */ + +static void ChangeControlItems(HWND hwndDlg, int status, int except); +static BOOL CheckItem(int item, HWND hwndDlg); + +static void ReActiveCombo(HWND hwndDlg) +{ + if (IsDlgButtonChecked(hwndDlg, IDC_IGNORE)) { + EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_LR), IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)); + EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_RL), IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)); + EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_TB), IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)); + EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_BT), IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)); + + EnableWindow(GetDlgItem(hwndDlg, IDC_BASECOLOUR2), !IsDlgButtonChecked(hwndDlg, IDC_COLOR2_TRANSPARENT)); + EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR2LABLE), !IsDlgButtonChecked(hwndDlg, IDC_COLOR2_TRANSPARENT)); + + EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_TL), IsDlgButtonChecked(hwndDlg, IDC_CORNER)); + EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_TR), IsDlgButtonChecked(hwndDlg, IDC_CORNER)); + EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_BR), IsDlgButtonChecked(hwndDlg, IDC_CORNER)); + EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_BL), IsDlgButtonChecked(hwndDlg, IDC_CORNER)); + ChangeControlItems(hwndDlg, !IsDlgButtonChecked(hwndDlg, IDC_IGNORE), IDC_IGNORE); + } else { + ChangeControlItems(hwndDlg, !IsDlgButtonChecked(hwndDlg, IDC_IGNORE), IDC_IGNORE); + EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_LR), IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)); + EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_RL), IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)); + EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_TB), IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)); + EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_BT), IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)); + + EnableWindow(GetDlgItem(hwndDlg, IDC_BASECOLOUR2), !IsDlgButtonChecked(hwndDlg, IDC_COLOR2_TRANSPARENT)); + EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR2LABLE), !IsDlgButtonChecked(hwndDlg, IDC_COLOR2_TRANSPARENT)); + + EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_TL), IsDlgButtonChecked(hwndDlg, IDC_CORNER)); + EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_TR), IsDlgButtonChecked(hwndDlg, IDC_CORNER)); + EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_BR), IsDlgButtonChecked(hwndDlg, IDC_CORNER)); + EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_BL), IsDlgButtonChecked(hwndDlg, IDC_CORNER)); + } +} + +// enabled or disabled the whole status controlitems group (with exceptional control) +static void ChangeControlItems(HWND hwndDlg, int status, int except) +{ + if (except != IDC_GRADIENT) + EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT), status); + if (except != IDC_GRADIENT_LR) + EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_LR), status); + if (except != IDC_GRADIENT_RL) + EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_RL), status); + if (except != IDC_GRADIENT_TB) + EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_TB), status); + if (except != IDC_GRADIENT_BT) + EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_BT), status); + if (except != IDC_CORNER) + EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER), status); + if (except != IDC_CORNER_TL) + EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_TL), status); + if (except != IDC_CORNER_TR) + EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_TR), status); + if (except != IDC_CORNER_BR) + EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_BR), status); + if (except != IDC_CORNER_BL) + EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_BL), status); + if (except != IDC_CORNER_TL) + EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_TL), status); + if (except != IDC_MARGINLABLE) + EnableWindow(GetDlgItem(hwndDlg, IDC_MARGINLABLE), status); + if (except != IDC_MRGN_TOP) + EnableWindow(GetDlgItem(hwndDlg, IDC_MRGN_TOP), status); + if (except != IDC_MRGN_RIGHT) + EnableWindow(GetDlgItem(hwndDlg, IDC_MRGN_RIGHT), status); + if (except != IDC_MRGN_BOTTOM) + EnableWindow(GetDlgItem(hwndDlg, IDC_MRGN_BOTTOM), status); + if (except != IDC_MRGN_LEFT) + EnableWindow(GetDlgItem(hwndDlg, IDC_MRGN_LEFT), status); + if (except != IDC_MRGN_TOP_SPIN) + EnableWindow(GetDlgItem(hwndDlg, IDC_MRGN_TOP_SPIN), status); + if (except != IDC_MRGN_RIGHT_SPIN) + EnableWindow(GetDlgItem(hwndDlg, IDC_MRGN_RIGHT_SPIN), status); + if (except != IDC_MRGN_BOTTOM_SPIN) + EnableWindow(GetDlgItem(hwndDlg, IDC_MRGN_BOTTOM_SPIN), status); + if (except != IDC_MRGN_LEFT_SPIN) + EnableWindow(GetDlgItem(hwndDlg, IDC_MRGN_LEFT_SPIN), status); + if (except != IDC_BASECOLOUR) + EnableWindow(GetDlgItem(hwndDlg, IDC_BASECOLOUR), status); + if (except != IDC_COLORLABLE) + EnableWindow(GetDlgItem(hwndDlg, IDC_COLORLABLE), status); + if (except != IDC_BASECOLOUR2) + EnableWindow(GetDlgItem(hwndDlg, IDC_BASECOLOUR2), status); + if (except != IDC_COLOR2LABLE) + EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR2LABLE), status); + if (except != IDC_COLOR2_TRANSPARENT) + EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR2_TRANSPARENT), status); + if (except != IDC_TEXTCOLOUR) + EnableWindow(GetDlgItem(hwndDlg, IDC_TEXTCOLOUR), status); + if (except != IDC_TEXTCOLOURLABLE) + EnableWindow(GetDlgItem(hwndDlg, IDC_TEXTCOLOURLABLE), status); + + if (except != IDC_ALPHA) + EnableWindow(GetDlgItem(hwndDlg, IDC_ALPHA), status); + if (except != IDC_ALPHASPIN) + EnableWindow(GetDlgItem(hwndDlg, IDC_ALPHASPIN), status); + if (except != IDC_ALPHALABLE) + EnableWindow(GetDlgItem(hwndDlg, IDC_ALPHALABLE), status); + if (except != IDC_IGNORE) + EnableWindow(GetDlgItem(hwndDlg, IDC_IGNORE), status); + + if (except != IDC_BORDERTYPE) + EnableWindow(GetDlgItem(hwndDlg, IDC_BORDERTYPE), status); + +} + +static void FillOptionDialogByStatusItem(HWND hwndDlg, StatusItems_t *item) +{ + char itoabuf[15]; + DWORD ret; + int index; + + CheckDlgButton(hwndDlg, IDC_IGNORE, (item->IGNORED) ? BST_CHECKED : BST_UNCHECKED); + + CheckDlgButton(hwndDlg, IDC_GRADIENT, (item->GRADIENT & GRADIENT_ACTIVE) ? BST_CHECKED : BST_UNCHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_LR), item->GRADIENT & GRADIENT_ACTIVE); + EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_RL), item->GRADIENT & GRADIENT_ACTIVE); + EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_TB), item->GRADIENT & GRADIENT_ACTIVE); + EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_BT), item->GRADIENT & GRADIENT_ACTIVE); + CheckDlgButton(hwndDlg, IDC_GRADIENT_LR, (item->GRADIENT & GRADIENT_LR) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_GRADIENT_RL, (item->GRADIENT & GRADIENT_RL) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_GRADIENT_TB, (item->GRADIENT & GRADIENT_TB) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_GRADIENT_BT, (item->GRADIENT & GRADIENT_BT) ? BST_CHECKED : BST_UNCHECKED); + + CheckDlgButton(hwndDlg, IDC_CORNER, (item->CORNER & CORNER_ACTIVE) ? BST_CHECKED : BST_UNCHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_TL), item->CORNER & CORNER_ACTIVE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_TR), item->CORNER & CORNER_ACTIVE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_BR), item->CORNER & CORNER_ACTIVE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_BL), item->CORNER & CORNER_ACTIVE); + + CheckDlgButton(hwndDlg, IDC_CORNER_TL, (item->CORNER & CORNER_TL) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CORNER_TR, (item->CORNER & CORNER_TR) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CORNER_BR, (item->CORNER & CORNER_BR) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CORNER_BL, (item->CORNER & CORNER_BL) ? BST_CHECKED : BST_UNCHECKED); + + ret = item->COLOR; + SendDlgItemMessage(hwndDlg, IDC_BASECOLOUR, CPM_SETDEFAULTCOLOUR, 0, CLCDEFAULT_COLOR); + SendDlgItemMessage(hwndDlg, IDC_BASECOLOUR, CPM_SETCOLOUR, 0, ret); + + ret = item->COLOR2; + SendDlgItemMessage(hwndDlg, IDC_BASECOLOUR2, CPM_SETDEFAULTCOLOUR, 0, CLCDEFAULT_COLOR2); + SendDlgItemMessage(hwndDlg, IDC_BASECOLOUR2, CPM_SETCOLOUR, 0, ret); + + CheckDlgButton(hwndDlg, IDC_COLOR2_TRANSPARENT, (item->COLOR2_TRANSPARENT) ? BST_CHECKED : BST_UNCHECKED); + + ret = item->TEXTCOLOR; + SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOUR, CPM_SETDEFAULTCOLOUR, 0, CLCDEFAULT_TEXTCOLOR); + SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOUR, CPM_SETCOLOUR, 0, ret); + + if (item->ALPHA == -1) { + SetDlgItemTextA(hwndDlg, IDC_ALPHA, ""); + } else { + ret = item->ALPHA; + _itoa(ret, itoabuf, 10); + SetDlgItemTextA(hwndDlg, IDC_ALPHA, itoabuf); + } + + if (item->MARGIN_LEFT == -1) + SetDlgItemTextA(hwndDlg, IDC_MRGN_LEFT, ""); + else { + ret = item->MARGIN_LEFT; + _itoa(ret, itoabuf, 10); + SetDlgItemTextA(hwndDlg, IDC_MRGN_LEFT, itoabuf); + } + + if (item->MARGIN_TOP == -1) + SetDlgItemTextA(hwndDlg, IDC_MRGN_TOP, ""); + else { + ret = item->MARGIN_TOP; + _itoa(ret, itoabuf, 10); + SetDlgItemTextA(hwndDlg, IDC_MRGN_TOP, itoabuf); + } + + if (item->MARGIN_RIGHT == -1) + SetDlgItemTextA(hwndDlg, IDC_MRGN_RIGHT, ""); + else { + ret = item->MARGIN_RIGHT; + _itoa(ret, itoabuf, 10); + SetDlgItemTextA(hwndDlg, IDC_MRGN_RIGHT, itoabuf); + } + + if (item->MARGIN_BOTTOM == -1) + SetDlgItemTextA(hwndDlg, IDC_MRGN_BOTTOM, ""); + else { + ret = item->MARGIN_BOTTOM; + _itoa(ret, itoabuf, 10); + SetDlgItemTextA(hwndDlg, IDC_MRGN_BOTTOM, itoabuf); + } + if(item->BORDERSTYLE == -1) + SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_SETCURSEL, 0, 0); + else { + index = 0; + switch(item->BORDERSTYLE) { + case 0: + case -1: + index = 0; + break; + case BDR_RAISEDOUTER: + index = 1; + break; + case BDR_SUNKENINNER: + index = 2; + break; + case EDGE_BUMP: + index = 3; + break; + case EDGE_ETCHED: + index = 4; + break; + } + SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_SETCURSEL, (WPARAM)index, 0); + } + ReActiveCombo(hwndDlg); +} +// update dlg with selected item +static void FillOptionDialogByCurrentSel(HWND hwndDlg) +{ + int index = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETCURSEL, 0, 0); + int itemData = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETITEMDATA, index, 0); + if(itemData != ID_EXTBKSEPARATOR) { + LastModifiedItem = itemData - ID_EXTBK_FIRST; + + if (CheckItem(itemData - ID_EXTBK_FIRST, hwndDlg)) { + FillOptionDialogByStatusItem(hwndDlg, &StatusItems[itemData - ID_EXTBK_FIRST]); + } + } +} + + +// enabled all status controls if the selected item is a separator +static BOOL CheckItem(int item, HWND hwndDlg) +{ + if (StatusItems[item].statusID == ID_EXTBKSEPARATOR) { + ChangeControlItems(hwndDlg, 0, 0); + return FALSE; + } else { + ChangeControlItems(hwndDlg, 1, 0); + return TRUE; + } +} + +static void SetChangedStatusItemFlag(WPARAM wParam, HWND hwndDlg) +{ + if (LOWORD(wParam) != IDC_ITEMS + && (GetDlgItem(hwndDlg, LOWORD(wParam)) == GetFocus() || HIWORD(wParam) == CPN_COLOURCHANGED) + && (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE || HIWORD(wParam) == CPN_COLOURCHANGED)) { + switch (LOWORD(wParam)) { + case IDC_IGNORE: + ChangedSItems.bIGNORED = TRUE; break; + case IDC_GRADIENT: + ChangedSItems.bGRADIENT = TRUE; break; + case IDC_GRADIENT_LR: + ChangedSItems.bGRADIENT = TRUE;break; + case IDC_GRADIENT_RL: + ChangedSItems.bGRADIENT = TRUE; break; + case IDC_GRADIENT_BT: + ChangedSItems.bGRADIENT = TRUE; break; + case IDC_GRADIENT_TB: + ChangedSItems.bGRADIENT = TRUE; break; + + case IDC_CORNER: + ChangedSItems.bCORNER = TRUE; break; + case IDC_CORNER_TL: + ChangedSItems.bCORNER = TRUE; break; + case IDC_CORNER_TR: + ChangedSItems.bCORNER = TRUE; break; + case IDC_CORNER_BR: + ChangedSItems.bCORNER = TRUE; break; + case IDC_CORNER_BL: + ChangedSItems.bCORNER = TRUE; break; + + case IDC_BASECOLOUR: + ChangedSItems.bCOLOR = TRUE; break; + case IDC_BASECOLOUR2: + ChangedSItems.bCOLOR2 = TRUE; break; + case IDC_COLOR2_TRANSPARENT: + ChangedSItems.bCOLOR2_TRANSPARENT = TRUE; break; + case IDC_TEXTCOLOUR: + ChangedSItems.bTEXTCOLOR = TRUE; break; + + case IDC_ALPHA: + ChangedSItems.bALPHA = TRUE; break; + case IDC_ALPHASPIN: + ChangedSItems.bALPHA = TRUE; break; + + case IDC_MRGN_LEFT: + ChangedSItems.bMARGIN_LEFT = TRUE; break; + case IDC_MRGN_LEFT_SPIN: + ChangedSItems.bMARGIN_LEFT = TRUE; break; + + case IDC_MRGN_TOP: + ChangedSItems.bMARGIN_TOP = TRUE; break; + case IDC_MRGN_TOP_SPIN: + ChangedSItems.bMARGIN_TOP = TRUE; break; + + case IDC_MRGN_RIGHT: + ChangedSItems.bMARGIN_RIGHT = TRUE; break; + case IDC_MRGN_RIGHT_SPIN: + ChangedSItems.bMARGIN_RIGHT = TRUE; break; + + case IDC_MRGN_BOTTOM: + ChangedSItems.bMARGIN_BOTTOM = TRUE; break; + case IDC_MRGN_BOTTOM_SPIN: + ChangedSItems.bMARGIN_BOTTOM = TRUE; break; + + case IDC_BORDERTYPE: + ChangedSItems.bBORDERSTYLE = TRUE; break; + } + } +} + +static BOOL isValidItem(void) +{ + if (StatusItems[LastModifiedItem].statusID == ID_EXTBKSEPARATOR) + return FALSE; + + return TRUE; +} + +// updates the struct with the changed dlg item +static void UpdateStatusStructSettingsFromOptDlg(HWND hwndDlg, int index) +{ + char buf[15]; + ULONG bdrtype; + + if (ChangedSItems.bIGNORED) + StatusItems[index]. IGNORED = IsDlgButtonChecked(hwndDlg, IDC_IGNORE); + + if (ChangedSItems.bGRADIENT) { + StatusItems[index]. GRADIENT = GRADIENT_NONE; + if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)) + StatusItems[index].GRADIENT |= GRADIENT_ACTIVE; + if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT_LR)) + StatusItems[index].GRADIENT |= GRADIENT_LR; + if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT_RL)) + StatusItems[index].GRADIENT |= GRADIENT_RL; + if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT_TB)) + StatusItems[index].GRADIENT |= GRADIENT_TB; + if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT_BT)) + StatusItems[index].GRADIENT |= GRADIENT_BT; + } + if (ChangedSItems.bCORNER) { + StatusItems[index]. CORNER = CORNER_NONE; + if (IsDlgButtonChecked(hwndDlg, IDC_CORNER)) + StatusItems[index].CORNER |= CORNER_ACTIVE ; + if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_TL)) + StatusItems[index].CORNER |= CORNER_TL ; + if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_TR)) + StatusItems[index].CORNER |= CORNER_TR; + if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_BR)) + StatusItems[index].CORNER |= CORNER_BR; + if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_BL)) + StatusItems[index].CORNER |= CORNER_BL; + } + + if (ChangedSItems.bCOLOR) + StatusItems[index]. COLOR = SendDlgItemMessage(hwndDlg, IDC_BASECOLOUR, CPM_GETCOLOUR, 0, 0); + + if (ChangedSItems.bCOLOR2) + StatusItems[index]. COLOR2 = SendDlgItemMessage(hwndDlg, IDC_BASECOLOUR2, CPM_GETCOLOUR, 0, 0); + + if (ChangedSItems.bCOLOR2_TRANSPARENT) + StatusItems[index]. COLOR2_TRANSPARENT = IsDlgButtonChecked(hwndDlg, IDC_COLOR2_TRANSPARENT); + + if (ChangedSItems.bTEXTCOLOR) + StatusItems[index]. TEXTCOLOR = SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOUR, CPM_GETCOLOUR, 0, 0); + + if (ChangedSItems.bALPHA) { + GetWindowTextA(GetDlgItem(hwndDlg, IDC_ALPHA), buf, 10); // can be removed now + if (lstrlenA(buf) > 0) + StatusItems[index]. ALPHA = (BYTE) SendDlgItemMessage(hwndDlg, IDC_ALPHASPIN, UDM_GETPOS, 0, 0); + } + + if (ChangedSItems.bMARGIN_LEFT) { + GetWindowTextA(GetDlgItem(hwndDlg, IDC_MRGN_LEFT), buf, 10); + if (lstrlenA(buf) > 0) + StatusItems[index]. MARGIN_LEFT = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_LEFT_SPIN, UDM_GETPOS, 0, 0); + } + + if (ChangedSItems.bMARGIN_TOP) { + GetWindowTextA(GetDlgItem(hwndDlg, IDC_MRGN_TOP), buf, 10); + if (lstrlenA(buf) > 0) + StatusItems[index]. MARGIN_TOP = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_TOP_SPIN, UDM_GETPOS, 0, 0); + } + + if (ChangedSItems.bMARGIN_RIGHT) { + GetWindowTextA(GetDlgItem(hwndDlg, IDC_MRGN_RIGHT), buf, 10); + if (lstrlenA(buf) > 0) + StatusItems[index]. MARGIN_RIGHT = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_RIGHT_SPIN, UDM_GETPOS, 0, 0); + } + + if (ChangedSItems.bMARGIN_BOTTOM) { + GetWindowTextA(GetDlgItem(hwndDlg, IDC_MRGN_BOTTOM), buf, 10); + if (lstrlenA(buf) > 0) + StatusItems[index]. MARGIN_BOTTOM = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_BOTTOM_SPIN, UDM_GETPOS, 0, 0); + } + if (ChangedSItems.bBORDERSTYLE) { + bdrtype = SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_GETCURSEL, 0, 0); + if(bdrtype == CB_ERR) + StatusItems[index].BORDERSTYLE = 0; + else { + switch(bdrtype) { + case 0: + StatusItems[index].BORDERSTYLE = 0; + break; + case 1: + StatusItems[index].BORDERSTYLE = BDR_RAISEDOUTER; + break; + case 2: + StatusItems[index].BORDERSTYLE = BDR_SUNKENINNER; + break; + case 3: + StatusItems[index].BORDERSTYLE = EDGE_BUMP; + break; + case 4: + StatusItems[index].BORDERSTYLE = EDGE_ETCHED; + break; + default: + StatusItems[index].BORDERSTYLE = 0; + break; + } + } + } +} + +static void SaveLatestChanges(HWND hwndDlg) +{ + int n, itemData; + // process old selection + if (last_selcount > 0) { + for (n = 0; n < last_selcount; n++) { + itemData = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETITEMDATA, last_indizes[n], 0); + if (itemData != ID_EXTBKSEPARATOR) { + UpdateStatusStructSettingsFromOptDlg(hwndDlg, itemData - ID_EXTBK_FIRST); + } + } + } + + // reset bChange + ChangedSItems.bALPHA = FALSE; + ChangedSItems.bGRADIENT = FALSE; + ChangedSItems.bCORNER = FALSE; + ChangedSItems.bCOLOR = FALSE; + ChangedSItems.bCOLOR2 = FALSE; + ChangedSItems.bCOLOR2_TRANSPARENT = FALSE; + ChangedSItems.bTEXTCOLOR = FALSE; + ChangedSItems.bALPHA = FALSE; + ChangedSItems.bMARGIN_LEFT = FALSE; + ChangedSItems.bMARGIN_TOP = FALSE; + ChangedSItems.bMARGIN_RIGHT = FALSE; + ChangedSItems.bMARGIN_BOTTOM = FALSE; + ChangedSItems.bIGNORED = FALSE; + ChangedSItems.bBORDERSTYLE = FALSE; +} + +static UINT _controls_to_refresh[] = { + IDC_BORDERTYPE, + IDC_3DDARKCOLOR, + IDC_3DLIGHTCOLOR, + IDC_MRGN_BOTTOM, + IDC_MRGN_LEFT, + IDC_ALPHASPIN, + IDC_CORNER, + IDC_MRGN_TOP_SPIN, + IDC_MRGN_RIGHT_SPIN, + IDC_MRGN_BOTTOM_SPIN, + IDC_MRGN_LEFT_SPIN, + IDC_GRADIENT, + IDC_GRADIENT_LR, + IDC_GRADIENT_RL, + IDC_GRADIENT_TB, + IDC_BASECOLOUR, + IDC_ALPHA, + IDC_MRGN_TOP, + IDC_MRGN_RIGHT, + IDC_GRADIENT_BT, + IDC_BASECOLOUR2, + IDC_TEXTCOLOUR, + IDC_CORNER_TL, + IDC_CORNER_TR, + IDC_CORNER_BR, + IDC_CORNER_BL, + IDC_IGNORE, + IDC_ALPHALABLE, + IDC_COLOR2LABLE, + IDC_COLORLABLE, + IDC_TEXTCOLOURLABLE, + IDC_COLOR2_TRANSPARENT, + 0 +}; + +static void RefreshControls(HWND hwnd) +{ + for(int i = 0; _controls_to_refresh[i]; i++) + InvalidateRect(GetDlgItem(hwnd, _controls_to_refresh[i]), NULL, FALSE); +} + +// wenn die listbox geändert wurde +static void OnListItemsChange(HWND hwndDlg) +{ + SendMessage(hwndDlg, WM_SETREDRAW, FALSE, 0); + SaveLatestChanges(hwndDlg); + + // set new selection + last_selcount = SendMessage(GetDlgItem(hwndDlg, IDC_ITEMS), LB_GETSELCOUNT, 0, 0); + if (last_selcount > 0) { + int n, real_index, itemData, first_item; + StatusItems_t DialogSettingForMultiSel; + + // get selected indizes + SendMessage(GetDlgItem(hwndDlg, IDC_ITEMS), LB_GETSELITEMS, 64, (LPARAM) last_indizes); + + // initialize with first items value + + first_item = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETITEMDATA, last_indizes[0], 0) - ID_EXTBK_FIRST; + DialogSettingForMultiSel = StatusItems[first_item]; + for (n = 0; n < last_selcount; n++) { + itemData = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETITEMDATA, last_indizes[n], 0); + if (itemData != ID_EXTBKSEPARATOR) { + real_index = itemData - ID_EXTBK_FIRST; + if (StatusItems[real_index].ALPHA != StatusItems[first_item].ALPHA) + DialogSettingForMultiSel.ALPHA = -1; + if (StatusItems[real_index].COLOR != StatusItems[first_item].COLOR) + DialogSettingForMultiSel.COLOR = CLCDEFAULT_COLOR; + if (StatusItems[real_index].COLOR2 != StatusItems[first_item].COLOR2) + DialogSettingForMultiSel.COLOR2 = CLCDEFAULT_COLOR2; + if (StatusItems[real_index].COLOR2_TRANSPARENT != StatusItems[first_item].COLOR2_TRANSPARENT) + DialogSettingForMultiSel.COLOR2_TRANSPARENT = CLCDEFAULT_COLOR2_TRANSPARENT; + if (StatusItems[real_index].TEXTCOLOR != StatusItems[first_item].TEXTCOLOR) + DialogSettingForMultiSel.TEXTCOLOR = CLCDEFAULT_TEXTCOLOR; + if (StatusItems[real_index].CORNER != StatusItems[first_item].CORNER) + DialogSettingForMultiSel.CORNER = CLCDEFAULT_CORNER; + if (StatusItems[real_index].GRADIENT != StatusItems[first_item].GRADIENT) + DialogSettingForMultiSel.GRADIENT = CLCDEFAULT_GRADIENT; + if (StatusItems[real_index].IGNORED != StatusItems[first_item].IGNORED) + DialogSettingForMultiSel.IGNORED = CLCDEFAULT_IGNORE; + if (StatusItems[real_index].MARGIN_BOTTOM != StatusItems[first_item].MARGIN_BOTTOM) + DialogSettingForMultiSel.MARGIN_BOTTOM = -1; + if (StatusItems[real_index].MARGIN_LEFT != StatusItems[first_item].MARGIN_LEFT) + DialogSettingForMultiSel.MARGIN_LEFT = -1; + if (StatusItems[real_index].MARGIN_RIGHT != StatusItems[first_item].MARGIN_RIGHT) + DialogSettingForMultiSel.MARGIN_RIGHT = -1; + if (StatusItems[real_index].MARGIN_TOP != StatusItems[first_item].MARGIN_TOP) + DialogSettingForMultiSel.MARGIN_TOP = -1; + if (StatusItems[real_index].BORDERSTYLE != StatusItems[first_item].BORDERSTYLE) + DialogSettingForMultiSel.BORDERSTYLE = -1; + } + } + + if (last_selcount == 1 && StatusItems[first_item].statusID == ID_EXTBKSEPARATOR) { + ChangeControlItems(hwndDlg, 0, 0); + last_selcount = 0; + } else + ChangeControlItems(hwndDlg, 1, 0); + FillOptionDialogByStatusItem(hwndDlg, &DialogSettingForMultiSel); + InvalidateRect(GetDlgItem(hwndDlg, IDC_ITEMS), NULL, FALSE); + } + SendMessage(hwndDlg, WM_SETREDRAW, TRUE, 0); + RefreshControls(hwndDlg); +} + +// fills the combobox of the options dlg for the first time +static void FillItemList(HWND hwndDlg) +{ + int n, iOff; + UINT item; + + for (n = 0; n <= ID_EXTBK_LAST - ID_EXTBK_FIRST; n++) { + iOff = 0; + if(strstr(StatusItems[n].szName, "{-}")) { + item = SendDlgItemMessageA(hwndDlg, IDC_ITEMS, LB_ADDSTRING, 0, (LPARAM)"------------------------"); + SendDlgItemMessageA(hwndDlg, IDC_ITEMS, LB_SETITEMDATA, item, ID_EXTBKSEPARATOR); + iOff = 3; + } + item = SendDlgItemMessageA(hwndDlg, IDC_ITEMS, LB_ADDSTRING, 0, (LPARAM)&StatusItems[n].szName[iOff]); + SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_SETITEMDATA, item, ID_EXTBK_FIRST + n); + } +} + +static BOOL CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + SKINDESCRIPTION *psd = (SKINDESCRIPTION *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + + if(psd) { + ID_EXTBK_FIRST = psd->firstItem; + ID_EXTBK_LAST = psd->lastItem; + StatusItems = psd->StatusItems; + } + switch (msg) { + case WM_INITDIALOG: + psd = (SKINDESCRIPTION *)malloc(sizeof(SKINDESCRIPTION)); + ZeroMemory(psd, sizeof(SKINDESCRIPTION)); + CopyMemory(psd, (void *)lParam, sizeof(SKINDESCRIPTION)); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)psd); + + if(psd) { + ID_EXTBK_FIRST = psd->firstItem; + ID_EXTBK_LAST = psd->lastItem; + StatusItems = psd->StatusItems; + } + + TranslateDialogDefault(hwndDlg); + FillItemList(hwndDlg); + SendMessage(hwndDlg, WM_USER + 101, 0, 0); + + psd->hMenuItems = CreatePopupMenu(); + AppendMenu(psd->hMenuItems, MF_STRING | MF_DISABLED, (UINT_PTR)0, _T("Copy from")); + AppendMenuA(psd->hMenuItems, MF_SEPARATOR, (UINT_PTR)0, NULL); + + { + int i; + + for(i = ID_EXTBK_FIRST; i <= ID_EXTBK_LAST; i++) { + int iOff = StatusItems[i - ID_EXTBK_FIRST].szName[0] == '{' ? 3 : 0; + if(iOff) + AppendMenuA(psd->hMenuItems, MF_SEPARATOR, (UINT_PTR)0, NULL); + AppendMenuA(psd->hMenuItems, MF_STRING, (UINT_PTR)i, &StatusItems[i - ID_EXTBK_FIRST].szName[iOff]); + } + } + return TRUE; + case WM_USER + 101: + { + DBVARIANT dbv = {0}; + + SendDlgItemMessage(hwndDlg, IDC_MRGN_LEFT_SPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); + SendDlgItemMessage(hwndDlg, IDC_MRGN_TOP_SPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); + SendDlgItemMessage(hwndDlg, IDC_MRGN_RIGHT_SPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); + SendDlgItemMessage(hwndDlg, IDC_MRGN_BOTTOM_SPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); + SendDlgItemMessage(hwndDlg, IDC_ALPHASPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); + + SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("")); + SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Raised")); + SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Sunken")); + SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Bumped")); + SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Etched")); + + SendDlgItemMessage(hwndDlg, IDC_3DDARKCOLOR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "CLCExt", "3ddark", RGB(224,224,224))); + SendDlgItemMessage(hwndDlg, IDC_3DLIGHTCOLOR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "CLCExt", "3dbright", RGB(224,224,224))); + return 0; + } + + case WM_DRAWITEM: + { + DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam; + int iItem = dis->itemData; + StatusItems_t *item = 0; + + SetBkMode(dis->hDC, TRANSPARENT); + FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_WINDOW)); + + if(iItem >= ID_EXTBK_FIRST && iItem <= ID_EXTBK_LAST) + item = &StatusItems[iItem - ID_EXTBK_FIRST]; + + if (dis->itemState & ODS_SELECTED && iItem != ID_EXTBKSEPARATOR) { + FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_HIGHLIGHT)); + SetTextColor(dis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); + } + else { + FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_WINDOW)); + if(item && item->IGNORED) + SetTextColor(dis->hDC, RGB(255, 0, 0)); + else + SetTextColor(dis->hDC, GetSysColor(COLOR_WINDOWTEXT)); + } + if(iItem == ID_EXTBKSEPARATOR) { + HPEN hPen, hPenOld; + POINT pt; + + hPen = CreatePen(PS_SOLID, 2, GetSysColor(COLOR_WINDOWTEXT)); + hPenOld = (HPEN)SelectObject(dis->hDC, hPen); + + MoveToEx(dis->hDC, dis->rcItem.left, (dis->rcItem.top + dis->rcItem.bottom) / 2, &pt); + LineTo(dis->hDC, dis->rcItem.right, (dis->rcItem.top + dis->rcItem.bottom) / 2); + SelectObject(dis->hDC, hPenOld); + DeleteObject((HGDIOBJ)hPen); + } + else if(dis->itemID >= 0 && item) { + char *szName = item->szName[0] == '{' ? &item->szName[3] : item->szName; + + TextOutA(dis->hDC, dis->rcItem.left, dis->rcItem.top, szName, lstrlenA(szName)); + } + return TRUE; + } + + case WM_CONTEXTMENU: + { + POINT pt; + RECT rc; + HWND hwndList = GetDlgItem(hwndDlg, IDC_ITEMS); + + GetCursorPos(&pt); + GetWindowRect(hwndList, &rc); + if(PtInRect(&rc, pt)) { + int iSelection = (int)TrackPopupMenu(psd->hMenuItems, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); + + if(iSelection >= ID_EXTBK_FIRST && iSelection <= ID_EXTBK_LAST) { + iSelection -= ID_EXTBK_FIRST; + + for(int i = ID_EXTBK_FIRST; i <= ID_EXTBK_LAST; i++) { + if(SendMessage(hwndList, LB_GETSEL, i - ID_EXTBK_FIRST, 0) > 0) { + int iIndex = SendMessage(hwndList, LB_GETITEMDATA, i - ID_EXTBK_FIRST, 0); + iIndex -= ID_EXTBK_FIRST; + + if(iIndex >= 0) { + StatusItems[iIndex].ALPHA = StatusItems[iSelection].ALPHA; + StatusItems[iIndex].BORDERSTYLE = StatusItems[iSelection].BORDERSTYLE; + StatusItems[iIndex].COLOR = StatusItems[iSelection].COLOR; + StatusItems[iIndex].COLOR2 = StatusItems[iSelection].COLOR2; + StatusItems[iIndex].COLOR2_TRANSPARENT = StatusItems[iSelection].COLOR2_TRANSPARENT; + StatusItems[iIndex].CORNER = StatusItems[iSelection].CORNER; + StatusItems[iIndex].GRADIENT = StatusItems[iSelection].GRADIENT; + StatusItems[iIndex].IGNORED = StatusItems[iSelection].IGNORED; + StatusItems[iIndex].imageItem = StatusItems[iSelection].imageItem; + StatusItems[iIndex].MARGIN_BOTTOM = StatusItems[iSelection].MARGIN_BOTTOM; + StatusItems[iIndex].MARGIN_LEFT = StatusItems[iSelection].MARGIN_LEFT; + StatusItems[iIndex].MARGIN_RIGHT = StatusItems[iSelection].MARGIN_RIGHT; + StatusItems[iIndex].MARGIN_TOP = StatusItems[iSelection].MARGIN_TOP; + StatusItems[iIndex].TEXTCOLOR = StatusItems[iSelection].TEXTCOLOR; + } + } + } + OnListItemsChange(hwndDlg); + } + } + break; + } + case WM_COMMAND: + // this will check if the user changed some actual statusitems values + // if yes the flag bChanged will be set to TRUE + SetChangedStatusItemFlag(wParam, hwndDlg); + switch(LOWORD(wParam)) { + case IDC_ITEMS: + if (HIWORD(wParam) != LBN_SELCHANGE) + return FALSE; + { + int iItem = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETCURSEL, 0, 0), 0); + if(iItem == ID_EXTBKSEPARATOR) + return FALSE; + } + OnListItemsChange(hwndDlg); + if(psd->pfnClcOptionsChanged) + psd->pfnClcOptionsChanged(); + break; + case IDC_GRADIENT: + ReActiveCombo(hwndDlg); + break; + case IDC_CORNER: + ReActiveCombo(hwndDlg); + break; + case IDC_IGNORE: + ReActiveCombo(hwndDlg); + break; + case IDC_COLOR2_TRANSPARENT: + ReActiveCombo(hwndDlg); + break; + case IDC_BORDERTYPE: + break; + } + if ((LOWORD(wParam) == IDC_ALPHA || LOWORD(wParam) == IDC_MRGN_LEFT || LOWORD(wParam) == IDC_MRGN_BOTTOM || LOWORD(wParam) == IDC_MRGN_TOP || LOWORD(wParam) == IDC_MRGN_RIGHT) && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())) + return 0; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + + case WM_NOTIFY: + switch (((LPNMHDR) lParam)->idFrom) { + case 0: + switch (((LPNMHDR) lParam)->code) { + case PSN_APPLY: + // save user made changes + SaveLatestChanges(hwndDlg); + // save struct to DB + if(psd->pfnSaveCompleteStruct) + psd->pfnSaveCompleteStruct(); + DBWriteContactSettingDword(NULL, "CLCExt", "3dbright", SendDlgItemMessage(hwndDlg, IDC_3DLIGHTCOLOR, CPM_GETCOLOUR, 0, 0)); + DBWriteContactSettingDword(NULL, "CLCExt", "3ddark", SendDlgItemMessage(hwndDlg, IDC_3DDARKCOLOR, CPM_GETCOLOUR, 0, 0)); + + if(psd->pfnClcOptionsChanged) + psd->pfnClcOptionsChanged(); + if(psd->hwndCLUI) { + SendMessage(psd->hwndCLUI, WM_SIZE, 0, 0); + PostMessage(psd->hwndCLUI, WM_USER+100, 0, 0); // CLUIINTM_REDRAW + } + break; + } + } + break; + case WM_DESTROY: + DestroyMenu(psd->hMenuItems); + break; + case WM_NCDESTROY: + free(psd); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)0); + break; + } + return FALSE; +} + +/* + * unimplemented +*/ + +static BOOL CALLBACK SkinEdit_ImageItemEditProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + return FALSE; +} + +static INT_PTR SkinEdit_FillByCurrentSel(WPARAM wParam, LPARAM lParam) +{ + if(wParam) + FillOptionDialogByCurrentSel((HWND)wParam); + return 0; +} + +/* + * service function + * creates additional tab pages under the given parent window handle + * expects a SKINDESCRIPTON * in lParam +*/ + +static INT_PTR SkinEdit_Invoke(WPARAM wParam, LPARAM lParam) +{ + SKINDESCRIPTION *psd = (SKINDESCRIPTION *)lParam; + TCITEM tci = {0}; + RECT rcClient; + int iTabs; + + if(psd->cbSize != sizeof(SKINDESCRIPTION)) + return 0; + + iTabs = TabCtrl_GetItemCount(psd->hWndTab); + GetClientRect(psd->hWndParent, &rcClient); + + tci.mask = TCIF_PARAM|TCIF_TEXT; + tci.lParam = (LPARAM)CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SKINITEMEDIT), psd->hWndParent, (DLGPROC)SkinEdit_ExtBkDlgProc, (LPARAM)psd); + + tci.pszText = TranslateT("Skin items"); + TabCtrl_InsertItem(psd->hWndTab, iTabs++, &tci); + MoveWindow((HWND)tci.lParam, 5, 25, rcClient.right - 9, rcClient.bottom - 60, 1); + psd->hwndSkinEdit = (HWND)tci.lParam; + + /* + tci.lParam = (LPARAM)CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_IMAGEITEMEDIT), psd->hWndParent, (DLGPROC)SkinEdit_ImageItemEditProc, (LPARAM)psd); + tci.pszText = TranslateT("Image items"); + TabCtrl_InsertItem(psd->hWndTab, iTabs++, &tci); + MoveWindow((HWND)tci.lParam, 5, 25, rcClient.right - 9, rcClient.bottom - 60, 1); + psd->hwndImageEdit = (HWND)tci.lParam; + */ + + return (INT_PTR)psd->hwndSkinEdit; +} + +static HANDLE hSvc_invoke = 0, hSvc_fillby = 0; + +static int LoadModule() +{ + hSvc_invoke = CreateServiceFunction(MS_CLNSE_INVOKE, (MIRANDASERVICE)SkinEdit_Invoke); + hSvc_fillby = CreateServiceFunction(MS_CLNSE_FILLBYCURRENTSEL, (MIRANDASERVICE)SkinEdit_FillByCurrentSel); + return 0; +} + +extern "C" __declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD mirandaVersion) +{ + return &pluginInfo; +} + +/* + * define our own MUUID, since this is a special plugin... + */ +extern "C" static const MUUID interfaces[] = {MIID_TESTPLUGIN, { 0x70ff4eef, 0xcb7b, 0x4d88, { 0x85, 0x60, 0x7d, 0xe3, 0xa6, 0x68, 0x5c, 0xe3 }}, MIID_LAST}; +extern "C" __declspec(dllexport) const MUUID * MirandaPluginInterfaces(void) +{ + return interfaces; +} + +static int ModulesLoaded(WPARAM wParam, LPARAM lParam) +{ + return 0; +} + +static int systemModulesLoaded(WPARAM wParam, LPARAM lParam) +{ + ModulesLoaded(wParam, lParam); + return 0; +} + +extern "C" int __declspec(dllexport) Load(void) +{ + mir_getLP(&pluginInfo); + return(LoadModule()); +} + +static int ShutdownProc(WPARAM wParam, LPARAM lParam) +{ + if(hSvc_invoke) + DestroyServiceFunction(hSvc_invoke); + if(hSvc_fillby) + DestroyServiceFunction(hSvc_fillby); + return 0; +} + +extern "C" int __declspec(dllexport) Unload(void) +{ + return ShutdownProc(0, 0); +} + +BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD dwReason, LPVOID reserved) +{ + g_hInst = hInstDLL; + DisableThreadLibraryCalls(g_hInst); + return TRUE; +} + diff --git a/plugins/Clist_nicer/skineditor/src/skineditres.h b/plugins/Clist_nicer/skineditor/src/skineditres.h new file mode 100644 index 0000000000..33183de397 --- /dev/null +++ b/plugins/Clist_nicer/skineditor/src/skineditres.h @@ -0,0 +1,51 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by skinedit.rc +// +#define IDD_SKINITEMEDIT 101 +#define IDD_IMAGEITEMEDIT 102 +#define IDC_BORDERTYPE 1017 +#define IDC_3DDARKCOLOR 1018 +#define IDC_3DLIGHTCOLOR 1019 +#define IDC_MRGN_BOTTOM 1670 +#define IDC_MRGN_LEFT 1671 +#define IDC_ALPHASPIN 1682 +#define IDC_ITEMS 1688 +#define IDC_CORNER 1689 +#define IDC_MRGN_TOP_SPIN 1693 +#define IDC_MRGN_RIGHT_SPIN 1694 +#define IDC_MRGN_BOTTOM_SPIN 1695 +#define IDC_MRGN_LEFT_SPIN 1696 +#define IDC_GRADIENT 1699 +#define IDC_GRADIENT_LR 1700 +#define IDC_GRADIENT_RL 1701 +#define IDC_GRADIENT_TB 1702 +#define IDC_BASECOLOUR 1703 +#define IDC_ALPHA 1704 +#define IDC_MRGN_TOP 1705 +#define IDC_MRGN_RIGHT 1706 +#define IDC_GRADIENT_BT 1707 +#define IDC_BASECOLOUR2 1708 +#define IDC_TEXTCOLOUR 1709 +#define IDC_CORNER_TL 1710 +#define IDC_CORNER_TR 1711 +#define IDC_CORNER_BR 1712 +#define IDC_CORNER_BL 1713 +#define IDC_COLORLABLE 1714 +#define IDC_MARGINLABLE 1715 +#define IDC_ALPHALABLE 1716 +#define IDC_IGNORE 1717 +#define IDC_COLOR2LABLE 1718 +#define IDC_COLOR2_TRANSPARENT 1719 +#define IDC_TEXTCOLOURLABLE 1720 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/plugins/Clist_nicer/version.rc b/plugins/Clist_nicer/version.rc deleted file mode 100644 index 4dfc03b5bf..0000000000 --- a/plugins/Clist_nicer/version.rc +++ /dev/null @@ -1,54 +0,0 @@ -#ifdef APSTUDIO_INVOKED -#error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - -#define VERSION_STRING "0.10.0.1" -#define VER_MAJOR 0 -#define VER_MINOR 10 -#define VER_REVISION 0 -#define VER_BUILD 1 - - -#if defined(UNICODE) - #if defined(_WIN64) - #define RES_FILE_DESC "Clist_Nicer+ (Unicode) x86_amd64" - #else - #define RES_FILE_DESC "Clist_Nicer+ (Unicode) x86" - #endif -#else - #define RES_FILE_DESC "Clist_Nicer+ (Ansi)" -#endif - -VS_VERSION_INFO VERSIONINFO - FILEVERSION VER_MAJOR,VER_MINOR,VER_REVISION,VER_BUILD - PRODUCTVERSION VER_MAJOR,VER_MINOR,VER_REVISION,VER_BUILD - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "000004b0" - BEGIN - VALUE "CompanyName", "Miranda IM project" - VALUE "FileDescription", RES_FILE_DESC - VALUE "FileVersion", VERSION_STRING - VALUE "InternalName", "clist_nicer" - VALUE "LegalCopyright", "Copyright (C) 2004-2010" - VALUE "LegalTrademarks", "Licensed under the Gnu general public license V2 or any later version." - VALUE "OriginalFilename", "clist_nicer.dll" - VALUE "ProductName", "Contact list plugin for Miranda IM" - VALUE "ProductVersion", VERSION_STRING - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0, 1200 - END -END diff --git a/plugins/CmdLine/CmdLine.cpp b/plugins/CmdLine/CmdLine.cpp deleted file mode 100644 index 4d19c19ccc..0000000000 --- a/plugins/CmdLine/CmdLine.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 "commonheaders.h" - -char ModuleName[] = "CmdLine"; -HINSTANCE hInstance; -int hLangpack; - -PLUGININFOEX pluginInfo = { - sizeof(PLUGININFOEX), - __PLUGIN_DISPLAY_NAME, - VERSION, - __DESC, - __AUTHOR, - __AUTHOREMAIL, - __COPYRIGHT, - __AUTHORWEB, - UNICODE_AWARE, //unicode aware - {0x2f1a117c, 0x3c1b, 0x4c01, {0x89, 0xea, 0x6d, 0x8f, 0xd8, 0x5a, 0x9b, 0x4c}} //{2f1a117c-3c1b-4c01-89ea-6d8fd85a9b4c} -}; //not used - -extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion) -{ - return &pluginInfo; -} - -static const MUUID interfaces[] = {MIID_CMDLINE, MIID_LAST}; - -extern "C" __declspec(dllexport) const MUUID *MirandaPluginInterfaces() -{ - return interfaces; -} - -extern "C" int __declspec(dllexport) Load(void) -{ - mir_getLP(&pluginInfo); - -// InitServices(); - if (InitServer()) - { - MessageBox(0, "Could not initialize CmdLine plugin property", "Error", MB_ICONEXCLAMATION | MB_OK); - } - - HookEvents(); - - return 0; -} - -extern "C" int __declspec(dllexport) Unload() -{ - bWaitForUnload = 0; - - UnhookEvents(); - - DestroyServer(); - - return 0; -} - -bool WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - hInstance = hinstDLL; - if (fdwReason == DLL_PROCESS_ATTACH) - { - DisableThreadLibraryCalls(hinstDLL); - } - - return TRUE; -} \ No newline at end of file diff --git a/plugins/CmdLine/CmdLine.rc b/plugins/CmdLine/CmdLine.rc deleted file mode 100644 index 1b7522b7a4..0000000000 --- a/plugins/CmdLine/CmdLine.rc +++ /dev/null @@ -1,63 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/plugins/CmdLine/CmdLine.vcxproj b/plugins/CmdLine/CmdLine.vcxproj index eb36f4cebf..03a5c978ee 100644 --- a/plugins/CmdLine/CmdLine.vcxproj +++ b/plugins/CmdLine/CmdLine.vcxproj @@ -175,30 +175,29 @@ - + Create - - - - - - + + + + + + - - - - - - - - - + + + + + + + + + - - + diff --git a/plugins/CmdLine/CmdLine.vcxproj.filters b/plugins/CmdLine/CmdLine.vcxproj.filters index 28af4c7c70..6ba388ddf3 100644 --- a/plugins/CmdLine/CmdLine.vcxproj.filters +++ b/plugins/CmdLine/CmdLine.vcxproj.filters @@ -15,62 +15,59 @@ - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - - Resource Files - - + Resource Files diff --git a/plugins/CmdLine/MimCmd/MimCmd.cpp b/plugins/CmdLine/MimCmd/MimCmd.cpp deleted file mode 100644 index cfd0e9b835..0000000000 --- a/plugins/CmdLine/MimCmd/MimCmd.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 "common.h" -#include "..\utils.h" -#include "..\version.h" - -int hLangpack = 0; - -int lpprintf(const char *format, ...) -{ - va_list va; - va_start(va, format); - const int MAX_SIZE = 16192; - char buffer[MAX_SIZE] = {0}; - int len = _vsnprintf(buffer, MAX_SIZE - 1, format, va); - buffer[MAX_SIZE - 1] = 0; - va_end(va); - CharToOemBuff(buffer, buffer, len); - printf("%s", buffer); - - return len; -} - -char *GetProgramName(char *programName, int size) -{ - char name[512]; - GetModuleFileName(GetModuleHandle(NULL), name, sizeof(name)); - char *p = strrchr(name, '\\'); - if (p) - { - STRNCPY(programName, p + 1, size); - } - else{ - STRNCPY(programName, name, size); - } - - return programName; -} - -void PrintUsage() -{ - char name[128]; - GetProgramName(name, sizeof(name)); - - lpprintf(Translate("%s usage:\n"), name); - lpprintf(Translate("%s [ [, ..]]\n"), name); - lpprintf(Translate("This will tell Miranda to run the specified command. The commands can have zero, one or more parameters. Use '%s help' to get a list of possible commands.\n"), name); - lpprintf(Translate("No command can have more than %d parameters\n"), MAX_ARGUMENTS - 1); -} - -void ShowVersion() -{ - char name[128]; - char message[1024]; - GetProgramName(name, sizeof(name)); - mir_snprintf(message, sizeof(message), Translate("%s version %s"), name, __VERSION_STRING); - - lpprintf("%s\n", message); -} - -int main(int argc, char *argv[]) -{ - int error = 0; - if ((argc == 2) && (strcmp(argv[1], "-v") == 0)) - { - ShowVersion(); - - return 0; - } - - if ((InitClient()) || (ConnectToMiranda()) || (GetKnownCommands()) || (LoadLangPackModule())) - { - lpprintf("Could not create connection with Miranda or could not retrieve list of known commands.\n"); - error = MIMRES_NOMIRANDA; - } - else{ - if ((argc <= 1) || (argc > MAX_ARGUMENTS)) - { - PrintUsage(); - } - else{ - PReply reply = ParseCommand(argv, argc); - if (reply) - { - error = reply->code; - lpprintf("%s\n", reply->message); - } - else{ - lpprintf(Translate("Unknown command '%s'.\n"), argv[1]); - } - - DestroyKnownCommands(); - DisconnectFromMiranda(); - DestroyClient(); - } - } - - return error; -} diff --git a/plugins/CmdLine/MimCmd/MimCmd.vcxproj b/plugins/CmdLine/MimCmd/MimCmd.vcxproj index 00e04c32c2..439370c027 100644 --- a/plugins/CmdLine/MimCmd/MimCmd.vcxproj +++ b/plugins/CmdLine/MimCmd/MimCmd.vcxproj @@ -166,21 +166,21 @@ - - + + Create - + NotUsing - - - + + + - + diff --git a/plugins/CmdLine/MimCmd/MimCmd.vcxproj.filters b/plugins/CmdLine/MimCmd/MimCmd.vcxproj.filters index 11c62edbef..4352e86988 100644 --- a/plugins/CmdLine/MimCmd/MimCmd.vcxproj.filters +++ b/plugins/CmdLine/MimCmd/MimCmd.vcxproj.filters @@ -15,29 +15,29 @@ - + Source Files - + Source Files - + Source Files - + Header Files - + Header Files - + Header Files - + Resource Files diff --git a/plugins/CmdLine/MimCmd/commands.cpp b/plugins/CmdLine/MimCmd/commands.cpp deleted file mode 100644 index bae47b089c..0000000000 --- a/plugins/CmdLine/MimCmd/commands.cpp +++ /dev/null @@ -1,239 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 "common.h" - -inline char *STRNCPY(char *output, const char *input, size_t size) -{ - char *res = strncpy(output, input, size); - output[size - 1] = 0; - - return res; -} - -LISTCOMMANDS ListCommands = NULL; - -PCommand knownCommands = NULL; -int cKnownCommands = 0; - -HMODULE hCmdLineDLL = NULL; - -char *GetMirandaFolder(char *mimFolder, int size) -{ - STRNCPY(mimFolder, sdCmdLine->mimFolder, size); - mimFolder[size - 1] = 0; - - return mimFolder; -} - - -int ConnectToMiranda() -{ - char pluginPath[1024]; - GetMirandaFolder(pluginPath, sizeof(pluginPath)); - strcat(pluginPath, "\\plugins\\cmdline.dll"); - - ListCommands = NULL; - - hCmdLineDLL = LoadLibrary(pluginPath); - - int failure = 1; - if (hCmdLineDLL) - { - ListCommands = (LISTCOMMANDS) GetProcAddress(hCmdLineDLL, "ListCommands"); - } - - if (ListCommands) - { - failure = 0; - } - - return failure; -} - -int DisconnectFromMiranda() -{ - return FreeLibrary(hCmdLineDLL); -} - -int GetKnownCommands() -{ - ListCommands(&knownCommands, &cKnownCommands); - - return (knownCommands == NULL); -} - -int DestroyKnownCommands() -{ - - - return 0; -} - -PCommand GetCommand(char *command) -{ - int i; - char lower[512]; - STRNCPY(lower, command, sizeof(lower)); - _strlwr(lower); - - for (i = 0; i < cKnownCommands; i++) - { - if (strcmp(knownCommands[i].command, lower) == 0) - { - return &knownCommands[i]; - } - } - - //allow more parameters to trigger the help command - /h -h /? --help - if ((strcmp(lower, "/h") == 0) || (strcmp(lower, "-h") == 0) || (strcmp(lower, "/?") == 0) || (strcmp(lower, "--help") == 0)) - { - for (i = 0; i < cKnownCommands; i++) - { - if (knownCommands[i].ID == MIMCMD_HELP) - { - return &knownCommands[i]; - } - } - } - - return NULL; -} - -void HandleHelpCommand(PCommand helpCommand, char *argv[], int argc, PReply reply) -{ - const int size = REPLY_SIZE; - if (argc >= 3) - { - PCommand command = GetCommand(argv[2]); - - if (command) - { - reply->code = MIMRES_SUCCESS; - STRNCPY(reply->message, Translate(command->help), size); - } - else{ - reply->code = MIMRES_NOTFOUND; - _snprintf(reply->message, size, Translate("No help for '%s'."), argv[2]); - reply->message[size -1 ] = 0; - } - } - else{ - reply->code = MIMRES_SUCCESS; - STRNCPY(reply->message, Translate("Available commands: "), size); - - int i; - for (i = 0; i < cKnownCommands - 1; i++) - { - strncat(reply->message, knownCommands[i].command, size); - strncat(reply->message, ", ", size); - } - strncat(reply->message, knownCommands[cKnownCommands - 1].command, size); - strncat(reply->message, ".", size); - } -} - -PReply ParseCommand(char *argv[], int argc) -{ - PCommand command = GetCommand(argv[1]); - if (command) - { - PReply reply = &sdCmdLine->reply; - if (command->ID == MIMCMD_HELP) - { - HandleHelpCommand(command, argv, argc, reply); - } - else{ - ProcessConsoleCommand(command, argv, argc, reply); - } - - return reply; - } - else{ - return NULL; - } -} - -void FillSharedDataStruct(PCommand command, char *arguments[], int count) -{ - int i; - for (i = 0; i < count; i++) - { - STRNCPY(sdCmdLine->arguments[i], arguments[i], ARGUMENT_SIZE); - } - - sdCmdLine->cArguments = count; - sdCmdLine->command = *command; - *sdCmdLine->reply.message = 0; - sdCmdLine->reply.code =-1; -} - -void ProcessConsoleCommand(PCommand command, char *arguments[], int count, PReply reply) -{ - const HANDLE events[] = {heServerDone, heServerClose, heServerBufferFull}; - const int cEvents = sizeof(events) / sizeof(events[0]); - - if (WaitForSingleObject(hmClient, INFINITE) == WAIT_OBJECT_0) - {//got the mutex, we're the only one who can talk to miranda now - FillSharedDataStruct(command, arguments, count); - SetEvent(heServerExec); //tell Miranda to process the request - - int done = FALSE; - while (!done) - { - switch (WaitForMultipleObjects(cEvents, events, FALSE, INFINITE)) //wait until server either finished processing or miranda was closed - { - case WAIT_OBJECT_0: //done event - { - done = TRUE; - - break; //nothing to do - } - - case WAIT_OBJECT_0 + 1: //close event - default: - { - strcpy(sdCmdLine->reply.message, Translate("Miranda has been closed or an error has occured while waiting for the result, could not process request.")); - done = TRUE; - - break; - } - - case WAIT_OBJECT_0 + 2: //buffer full event - { - lpprintf("%s", reply->message); - - break; - } - } - } - - reply->code = sdCmdLine->reply.code; - STRNCPY(reply->message, sdCmdLine->reply.message, REPLY_SIZE); - - ReleaseMutex(hmClient); //let other possible clients talk to the server - } - else{ - int err = GetLastError(); - reply->code = -1; - *reply->message = 0; - } - -} \ No newline at end of file diff --git a/plugins/CmdLine/MimCmd/commands.h b/plugins/CmdLine/MimCmd/commands.h deleted file mode 100644 index 4c60b49565..0000000000 --- a/plugins/CmdLine/MimCmd/commands.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 M_MIMCMD_COMMANDS_H -#define M_MIMCMD_COMMANDS_H - -extern PCommand knownCommands; -extern int cKnownCommands; - -typedef void (* LISTCOMMANDS)(PCommand *commands, int *count); - -extern LISTCOMMANDS ListCommands; - -char *GetMirandaFolder(); - -int ConnectToMiranda(); -int DisconnectFromMiranda(); -int GetKnownCommands(); -int DestroyKnownCommands(); - -PCommand GetCommand(char *command); -PReply ParseCommand(char *argv[], int argc); -void ProcessConsoleCommand(PCommand command, char *arguments[], int count, PReply reply); - -#endif \ No newline at end of file diff --git a/plugins/CmdLine/MimCmd/common.h b/plugins/CmdLine/MimCmd/common.h deleted file mode 100644 index a733743e07..0000000000 --- a/plugins/CmdLine/MimCmd/common.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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. -*/ - -#define _CRT_SECURE_NO_WARNINGS - -#include -#include -#include - -#define NO_MIMCMD_COMMANDS - -#include -#include -#include - -#include "..\mimcmd_ipc.h" -#include "commands.h" - -int lpprintf(const char *format, ...); diff --git a/plugins/CmdLine/MimCmd/res/version.rc b/plugins/CmdLine/MimCmd/res/version.rc new file mode 100644 index 0000000000..b5257e17ef --- /dev/null +++ b/plugins/CmdLine/MimCmd/res/version.rc @@ -0,0 +1,103 @@ +// Microsoft Visual C++ generated resource script. +// +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + +#include "..\..\src\version.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION __PLUGINVERSION_STRING + PRODUCTVERSION __PLUGINVERSION_STRING + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Author", __AUTHOR + VALUE "FileDescription", __DESC + VALUE "FileVersion", __VERSION_STRING + VALUE "InternalName", __PLUGIN_DISPLAY_NAME + VALUE "LegalCopyright", __COPYRIGHT + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/plugins/CmdLine/MimCmd/resource.h b/plugins/CmdLine/MimCmd/resource.h deleted file mode 100644 index c3bc570152..0000000000 --- a/plugins/CmdLine/MimCmd/resource.h +++ /dev/null @@ -1,14 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by version.rc - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/plugins/CmdLine/MimCmd/src/MimCmd.cpp b/plugins/CmdLine/MimCmd/src/MimCmd.cpp new file mode 100644 index 0000000000..07daf85a0c --- /dev/null +++ b/plugins/CmdLine/MimCmd/src/MimCmd.cpp @@ -0,0 +1,117 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 "common.h" +#include "..\..\src\utils.h" +#include "..\..\src\version.h" + +int hLangpack = 0; + +int lpprintf(const char *format, ...) +{ + va_list va; + va_start(va, format); + const int MAX_SIZE = 16192; + char buffer[MAX_SIZE] = {0}; + int len = _vsnprintf(buffer, MAX_SIZE - 1, format, va); + buffer[MAX_SIZE - 1] = 0; + va_end(va); + CharToOemBuff(buffer, buffer, len); + printf("%s", buffer); + + return len; +} + +char *GetProgramName(char *programName, int size) +{ + char name[512]; + GetModuleFileName(GetModuleHandle(NULL), name, sizeof(name)); + char *p = strrchr(name, '\\'); + if (p) + { + STRNCPY(programName, p + 1, size); + } + else{ + STRNCPY(programName, name, size); + } + + return programName; +} + +void PrintUsage() +{ + char name[128]; + GetProgramName(name, sizeof(name)); + + lpprintf(Translate("%s usage:\n"), name); + lpprintf(Translate("%s [ [, ..]]\n"), name); + lpprintf(Translate("This will tell Miranda to run the specified command. The commands can have zero, one or more parameters. Use '%s help' to get a list of possible commands.\n"), name); + lpprintf(Translate("No command can have more than %d parameters\n"), MAX_ARGUMENTS - 1); +} + +void ShowVersion() +{ + char name[128]; + char message[1024]; + GetProgramName(name, sizeof(name)); + mir_snprintf(message, sizeof(message), Translate("%s version %s"), name, __VERSION_STRING); + + lpprintf("%s\n", message); +} + +int main(int argc, char *argv[]) +{ + int error = 0; + if ((argc == 2) && (strcmp(argv[1], "-v") == 0)) + { + ShowVersion(); + + return 0; + } + + if ((InitClient()) || (ConnectToMiranda()) || (GetKnownCommands()) || (LoadLangPackModule())) + { + lpprintf("Could not create connection with Miranda or could not retrieve list of known commands.\n"); + error = MIMRES_NOMIRANDA; + } + else{ + if ((argc <= 1) || (argc > MAX_ARGUMENTS)) + { + PrintUsage(); + } + else{ + PReply reply = ParseCommand(argv, argc); + if (reply) + { + error = reply->code; + lpprintf("%s\n", reply->message); + } + else{ + lpprintf(Translate("Unknown command '%s'.\n"), argv[1]); + } + + DestroyKnownCommands(); + DisconnectFromMiranda(); + DestroyClient(); + } + } + + return error; +} diff --git a/plugins/CmdLine/MimCmd/src/commands.cpp b/plugins/CmdLine/MimCmd/src/commands.cpp new file mode 100644 index 0000000000..bae47b089c --- /dev/null +++ b/plugins/CmdLine/MimCmd/src/commands.cpp @@ -0,0 +1,239 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 "common.h" + +inline char *STRNCPY(char *output, const char *input, size_t size) +{ + char *res = strncpy(output, input, size); + output[size - 1] = 0; + + return res; +} + +LISTCOMMANDS ListCommands = NULL; + +PCommand knownCommands = NULL; +int cKnownCommands = 0; + +HMODULE hCmdLineDLL = NULL; + +char *GetMirandaFolder(char *mimFolder, int size) +{ + STRNCPY(mimFolder, sdCmdLine->mimFolder, size); + mimFolder[size - 1] = 0; + + return mimFolder; +} + + +int ConnectToMiranda() +{ + char pluginPath[1024]; + GetMirandaFolder(pluginPath, sizeof(pluginPath)); + strcat(pluginPath, "\\plugins\\cmdline.dll"); + + ListCommands = NULL; + + hCmdLineDLL = LoadLibrary(pluginPath); + + int failure = 1; + if (hCmdLineDLL) + { + ListCommands = (LISTCOMMANDS) GetProcAddress(hCmdLineDLL, "ListCommands"); + } + + if (ListCommands) + { + failure = 0; + } + + return failure; +} + +int DisconnectFromMiranda() +{ + return FreeLibrary(hCmdLineDLL); +} + +int GetKnownCommands() +{ + ListCommands(&knownCommands, &cKnownCommands); + + return (knownCommands == NULL); +} + +int DestroyKnownCommands() +{ + + + return 0; +} + +PCommand GetCommand(char *command) +{ + int i; + char lower[512]; + STRNCPY(lower, command, sizeof(lower)); + _strlwr(lower); + + for (i = 0; i < cKnownCommands; i++) + { + if (strcmp(knownCommands[i].command, lower) == 0) + { + return &knownCommands[i]; + } + } + + //allow more parameters to trigger the help command - /h -h /? --help + if ((strcmp(lower, "/h") == 0) || (strcmp(lower, "-h") == 0) || (strcmp(lower, "/?") == 0) || (strcmp(lower, "--help") == 0)) + { + for (i = 0; i < cKnownCommands; i++) + { + if (knownCommands[i].ID == MIMCMD_HELP) + { + return &knownCommands[i]; + } + } + } + + return NULL; +} + +void HandleHelpCommand(PCommand helpCommand, char *argv[], int argc, PReply reply) +{ + const int size = REPLY_SIZE; + if (argc >= 3) + { + PCommand command = GetCommand(argv[2]); + + if (command) + { + reply->code = MIMRES_SUCCESS; + STRNCPY(reply->message, Translate(command->help), size); + } + else{ + reply->code = MIMRES_NOTFOUND; + _snprintf(reply->message, size, Translate("No help for '%s'."), argv[2]); + reply->message[size -1 ] = 0; + } + } + else{ + reply->code = MIMRES_SUCCESS; + STRNCPY(reply->message, Translate("Available commands: "), size); + + int i; + for (i = 0; i < cKnownCommands - 1; i++) + { + strncat(reply->message, knownCommands[i].command, size); + strncat(reply->message, ", ", size); + } + strncat(reply->message, knownCommands[cKnownCommands - 1].command, size); + strncat(reply->message, ".", size); + } +} + +PReply ParseCommand(char *argv[], int argc) +{ + PCommand command = GetCommand(argv[1]); + if (command) + { + PReply reply = &sdCmdLine->reply; + if (command->ID == MIMCMD_HELP) + { + HandleHelpCommand(command, argv, argc, reply); + } + else{ + ProcessConsoleCommand(command, argv, argc, reply); + } + + return reply; + } + else{ + return NULL; + } +} + +void FillSharedDataStruct(PCommand command, char *arguments[], int count) +{ + int i; + for (i = 0; i < count; i++) + { + STRNCPY(sdCmdLine->arguments[i], arguments[i], ARGUMENT_SIZE); + } + + sdCmdLine->cArguments = count; + sdCmdLine->command = *command; + *sdCmdLine->reply.message = 0; + sdCmdLine->reply.code =-1; +} + +void ProcessConsoleCommand(PCommand command, char *arguments[], int count, PReply reply) +{ + const HANDLE events[] = {heServerDone, heServerClose, heServerBufferFull}; + const int cEvents = sizeof(events) / sizeof(events[0]); + + if (WaitForSingleObject(hmClient, INFINITE) == WAIT_OBJECT_0) + {//got the mutex, we're the only one who can talk to miranda now + FillSharedDataStruct(command, arguments, count); + SetEvent(heServerExec); //tell Miranda to process the request + + int done = FALSE; + while (!done) + { + switch (WaitForMultipleObjects(cEvents, events, FALSE, INFINITE)) //wait until server either finished processing or miranda was closed + { + case WAIT_OBJECT_0: //done event + { + done = TRUE; + + break; //nothing to do + } + + case WAIT_OBJECT_0 + 1: //close event + default: + { + strcpy(sdCmdLine->reply.message, Translate("Miranda has been closed or an error has occured while waiting for the result, could not process request.")); + done = TRUE; + + break; + } + + case WAIT_OBJECT_0 + 2: //buffer full event + { + lpprintf("%s", reply->message); + + break; + } + } + } + + reply->code = sdCmdLine->reply.code; + STRNCPY(reply->message, sdCmdLine->reply.message, REPLY_SIZE); + + ReleaseMutex(hmClient); //let other possible clients talk to the server + } + else{ + int err = GetLastError(); + reply->code = -1; + *reply->message = 0; + } + +} \ No newline at end of file diff --git a/plugins/CmdLine/MimCmd/src/commands.h b/plugins/CmdLine/MimCmd/src/commands.h new file mode 100644 index 0000000000..4c60b49565 --- /dev/null +++ b/plugins/CmdLine/MimCmd/src/commands.h @@ -0,0 +1,42 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 M_MIMCMD_COMMANDS_H +#define M_MIMCMD_COMMANDS_H + +extern PCommand knownCommands; +extern int cKnownCommands; + +typedef void (* LISTCOMMANDS)(PCommand *commands, int *count); + +extern LISTCOMMANDS ListCommands; + +char *GetMirandaFolder(); + +int ConnectToMiranda(); +int DisconnectFromMiranda(); +int GetKnownCommands(); +int DestroyKnownCommands(); + +PCommand GetCommand(char *command); +PReply ParseCommand(char *argv[], int argc); +void ProcessConsoleCommand(PCommand command, char *arguments[], int count, PReply reply); + +#endif \ No newline at end of file diff --git a/plugins/CmdLine/MimCmd/src/common.h b/plugins/CmdLine/MimCmd/src/common.h new file mode 100644 index 0000000000..0086237671 --- /dev/null +++ b/plugins/CmdLine/MimCmd/src/common.h @@ -0,0 +1,36 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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. +*/ + +#define _CRT_SECURE_NO_WARNINGS + +#include +#include +#include + +#define NO_MIMCMD_COMMANDS + +#include +#include +#include + +#include "..\..\src\mimcmd_ipc.h" +#include "commands.h" + +int lpprintf(const char *format, ...); diff --git a/plugins/CmdLine/MimCmd/src/resource.h b/plugins/CmdLine/MimCmd/src/resource.h new file mode 100644 index 0000000000..c3bc570152 --- /dev/null +++ b/plugins/CmdLine/MimCmd/src/resource.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by version.rc + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/plugins/CmdLine/MimCmd/version.rc b/plugins/CmdLine/MimCmd/version.rc deleted file mode 100644 index 36d39c3d33..0000000000 --- a/plugins/CmdLine/MimCmd/version.rc +++ /dev/null @@ -1,104 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#ifdef APSTUDIO_INVOKED -#error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - -#include "resource.h" -#include "..\..\CmdLine\version.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION __PLUGINVERSION_STRING - PRODUCTVERSION __PLUGINVERSION_STRING - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Author", __AUTHOR - VALUE "FileDescription", __DESC - VALUE "FileVersion", __VERSION_STRING - VALUE "InternalName", __PLUGIN_DISPLAY_NAME - VALUE "LegalCopyright", __COPYRIGHT - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/plugins/CmdLine/commonheaders.h b/plugins/CmdLine/commonheaders.h deleted file mode 100644 index b7a332c9d6..0000000000 --- a/plugins/CmdLine/commonheaders.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 M_CMDLINE_COMMONHEADERS_H -#define M_CMDLINE_COMMONHEADERS_H - -#define MIRANDA_VER 0x0A00 -#define _CRT_SECURE_NO_WARNINGS - -#define MIID_CMDLINE {0xcf8d9633, 0x7744, 0x4a5c, {0xb4, 0x8c, 0x2b, 0xd6, 0x36, 0xa4, 0x6c, 0xde}} - -#include -#include -#include -#include -#include - -#include "newpluginapi.h" -#include "m_database.h" -#include "m_system.h" -#include "m_clist.h" -#include "m_clui.h" -#include "m_contacts.h" -#include "m_langpack.h" -#include "m_options.h" -#include "m_protosvc.h" -#include "m_protocols.h" -#include "m_popup.h" -#include "m_utils.h" -#include "m_message.h" -#include "m_ignore.h" - -#include "m_versioninfo.h" -#include "m_statusplugins.h" - -#include "version.h" -#include "utils.h" -#include "resource.h" -#include "hooked_events.h" -#include "utils.h" -#include "mimcmd_ipc.h" -#include "services.h" -#include "mimcmd_handlers.h" -#include "mimcmd_data.h" - -extern char ModuleName[]; -extern HINSTANCE hInstance; - -//extern PLUGINLINK *pluginLink; - -extern int bUseANSIStrings; - -extern int bWaitForUnload; - -#define ID_ICQ_EXIT 40001 - -static __inline int mir_old_snprintf(char *buffer, size_t count, const char* fmt, ...) { - va_list va; - int len; - - va_start(va, fmt); - len = _vsnprintf(buffer, count-1, fmt, va); - va_end(va); - buffer[count-1] = 0; - return len; -} - -static __inline int mir_old_sntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, ...) { - va_list va; - int len; - - va_start(va, fmt); - len = _vsntprintf(buffer, count-1, fmt, va); - va_end(va); - buffer[count-1] = 0; - return len; -} - -static __inline int mir_old_vsnprintf(char *buffer, size_t count, const char* fmt, va_list va) { - int len; - - len = _vsnprintf(buffer, count-1, fmt, va); - buffer[count-1] = 0; - return len; -} - -static __inline int mir_old_vsntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, va_list va) { - int len; - - len = _vsntprintf(buffer, count-1, fmt, va); - buffer[count-1] = 0; - return len; -} - -#endif //M_CMDLINE_COMMONHEADERS_H \ No newline at end of file diff --git a/plugins/CmdLine/hooked_events.cpp b/plugins/CmdLine/hooked_events.cpp deleted file mode 100644 index 6ccac9080a..0000000000 --- a/plugins/CmdLine/hooked_events.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 "commonheaders.h" - -HANDLE hModulesLoaded; -HANDLE hOptionsInitialize; -HANDLE hShutdown; -HANDLE hProtoAck; - -int bShouldProcessAcks = FALSE; - -ACKDATA acks[50] = {0}; -int cAcks = sizeof(acks) / sizeof(acks[0]); - -int HookEvents() -{ - hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); - hShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown); - hProtoAck = HookEvent(ME_PROTO_ACK, OnProtoAck); -// hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OnOptionsInitialise); - - return 0; -} - -int UnhookEvents() -{ - UnhookEvent(hModulesLoaded); - UnhookEvent(hShutdown); - UnhookEvent(OnProtoAck); -// UnhookEvent(hOptionsInitialize); - - return 0; -} - -int OnModulesLoaded(WPARAM wParam, LPARAM lParam) -{ - StartServer(); - - return 0; -} - -int OnShutdown(WPARAM wParam, LPARAM lParam) -{ - SetEvent(heServerClose); //tell the listening server to stop - - return 0; -} - -int QueueAck(ACKDATA *ack) -{ - int i; - for (i = cAcks - 1; i > 0; i--) - { - acks[i] = acks[i - 1]; - } - - acks[0] = *ack; - - return 0; -} - -int ClearAckQueue() -{ - memset(acks, 0, cAcks * sizeof(ACKDATA)); - - return 0; -} - -ACKDATA *GetAck(HANDLE hProcess) -{ - int i; - for (i = 0; i < cAcks; i++) - { - if (acks[i].hProcess == hProcess) - { - return &acks[i]; - } - } - - return NULL; -} - -int OnProtoAck(WPARAM wParam, LPARAM lParam) -{ - if (bShouldProcessAcks) - { - ACKDATA *ack = (ACKDATA *) lParam; - if ((ack) && (ack->type == ACKTYPE_MESSAGE)) //if it's a message ack - { - QueueAck(ack); - } - } - - return 0; -} \ No newline at end of file diff --git a/plugins/CmdLine/hooked_events.h b/plugins/CmdLine/hooked_events.h deleted file mode 100644 index 11b9fea363..0000000000 --- a/plugins/CmdLine/hooked_events.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 M_CMDLINE_HOOKED_EVENTS_H -#define M_CMDLINE_HOOKED_EVENTS_H - -extern HANDLE hModulesLoaded; -extern HANDLE hOptionsInitialise; -extern HANDLE hShutdown; -extern HANDLE hProtoAck; - -extern int bShouldProcessAcks; - -int HookEvents(); -int UnhookEvents(); - -int ClearQueue(); -ACKDATA *GetAck(HANDLE hProcess); - -int OnModulesLoaded(WPARAM wParam, LPARAM lParam); -int OnOptionsInitialise(WPARAM wParam, LPARAM lParam); -int OnShutdown(WPARAM wParam, LPARAM lParam); -int OnProtoAck(WPARAM wParam, LPARAM lParam); - -#endif \ No newline at end of file diff --git a/plugins/CmdLine/mimcmd_data.cpp b/plugins/CmdLine/mimcmd_data.cpp deleted file mode 100644 index 95550ed778..0000000000 --- a/plugins/CmdLine/mimcmd_data.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 "commonheaders.h" - -TCommand mimCommands[] = {{MIMCMD_STATUS, "status", MIMCMD_HELP_STATUS}, - {MIMCMD_AWAYMSG, "awaymsg", MIMCMD_HELP_AWAYMSG}, - {MIMCMD_XSTATUS, "xstatus", MIMCMD_HELP_XSTATUS}, - {MIMCMD_POPUPS, "popups", MIMCMD_HELP_POPUPS}, - {MIMCMD_SOUNDS, "sounds", MIMCMD_HELP_SOUNDS}, - {MIMCMD_CLIST, "clist", MIMCMD_HELP_CLIST}, - {MIMCMD_QUIT, "quit", MIMCMD_HELP_QUIT}, - {MIMCMD_HELP, "help", MIMCMD_HELP_HELP}, - {MIMCMD_EXCHANGE, "exchange", MIMCMD_HELP_EXCHANGE}, - {MIMCMD_YAMN, "yamn", MIMCMD_HELP_YAMN}, - {MIMCMD_CALLSERVICE, "callservice", MIMCMD_HELP_CALLSERVICE}, - {MIMCMD_MESSAGE, "message", MIMCMD_HELP_MESSAGE}, - {MIMCMD_DATABASE, "db", MIMCMD_HELP_DATABASE}, - {MIMCMD_PROXY, "proxy", MIMCMD_HELP_PROXY}, - {MIMCMD_CONTACTS, "contacts", MIMCMD_HELP_CONTACTS}, - {MIMCMD_HISTORY, "history", MIMCMD_HELP_HISTORY}, - {MIMCMD_VERSION, "version", MIMCMD_HELP_VERSION}, - {MIMCMD_SETNICKNAME, "setnickname", MIMCMD_HELP_SETNICKNAME}, - {MIMCMD_IGNORE, "ignore", MIMCMD_HELP_IGNORE}, - }; -int cMimCommands = sizeof(mimCommands) / sizeof(mimCommands[0]); \ No newline at end of file diff --git a/plugins/CmdLine/mimcmd_data.h b/plugins/CmdLine/mimcmd_data.h deleted file mode 100644 index 2ef39bc4dd..0000000000 --- a/plugins/CmdLine/mimcmd_data.h +++ /dev/null @@ -1,120 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 M_MIMCMD_DATA_H -#define M_MIMCMD_DATA_H - -#define COMMAND_SIZE 64 -#define HELP_SIZE 1024 -#define REPLY_SIZE 8096 - -#define MIMFOLDER_SIZE 300 - -#define MAX_ARGUMENTS 20 -#define ARGUMENT_SIZE 512 - -typedef char TArgument[ARGUMENT_SIZE]; - -struct TReply{ - int code; - char message[REPLY_SIZE]; - static const int cMessage = REPLY_SIZE; -}; - -typedef TReply *PReply; - -struct TCommand{ - long ID; - char command[COMMAND_SIZE]; - char help[HELP_SIZE]; -}; - -typedef TCommand *PCommand; - -struct TSharedData{ - char mimFolder[MIMFOLDER_SIZE]; - TCommand command; - TArgument arguments[MAX_ARGUMENTS]; - int cArguments; - TReply reply; - int instances; -}; - -typedef TSharedData *PSharedData; - -//return codes -#define MIMRES_SUCCESS 0 //command was successful -#define MIMRES_FAILURE 1 //command was not successful -#define MIMRES_NOTFOUND 2 //command not found -#define MIMRES_UNKNOWNPARAM 3 //command parameter is unknown -#define MIMRES_NOMIRANDA 4 //could not link to Miranda -#define MIMRES_WRONGPARAMSCOUNT 5 //wrong number of parameters - - -#define MIMCMD_UNKNOWN -1 //unknown command -#define MIMCMD_STATUS 1 -#define MIMCMD_AWAYMSG 2 -#define MIMCMD_XSTATUS 3 -#define MIMCMD_POPUPS 4 -#define MIMCMD_SOUNDS 5 -#define MIMCMD_CLIST 6 -#define MIMCMD_QUIT 7 -#define MIMCMD_HELP 8 -#define MIMCMD_EXCHANGE 9 -#define MIMCMD_YAMN 10 -#define MIMCMD_CALLSERVICE 11 -#define MIMCMD_MESSAGE 12 -#define MIMCMD_DATABASE 13 -#define MIMCMD_PROXY 14 -#define MIMCMD_CONTACTS 15 -#define MIMCMD_HISTORY 16 -#define MIMCMD_VERSION 17 -#define MIMCMD_SETNICKNAME 18 -#define MIMCMD_IGNORE 19 - -#define MIMCMD_HELP_STATUS "Change account status either globally or per account.\nUsage: status [].\nPossible values for are: offline, online, away, dnd, na, occupied, freechat, invisible, onthephone, outtolunch.\n is the name of the account. If it's not specified then the command will issue a global status change." -#define MIMCMD_HELP_AWAYMSG "Change away message either globally or per account.\nUsage: awaymsg [].\n is the new away message.\n is an optional parameter specifying the account to set the away message for. If not specified then the away message will be set globally." -#define MIMCMD_HELP_XSTATUS "Change extended status either globally or per account.\nUsage xstatus [].\n is the new extended status to set. Possible values are:...\n is an optional parameter specifying the account for which extended status is set. If not specified then extended status for all accounts will be changed.\nNOTE: Not all accounts/protocols support extended status." -#define MIMCMD_HELP_POPUPS "Disables or enables popups display.\nUsage popups (disable | enable | toggle).\nThe command will either enable or disable popups display." -#define MIMCMD_HELP_SOUNDS "Disables or enables sounds.\nUsage: sounds (disable | enable | toggle).\nThe command will either disable or enable sounds." -#define MIMCMD_HELP_CLIST "Hides or shows the contact list window.\nUsage: clist (show | hide | toggle).\nThe command will either show or hide the contact list window." -#define MIMCMD_HELP_QUIT "Closes Miranda.\nUsage: quit [wait]. If wait is used then the command will return only when CmdLine plugin has been unloaded by Miranda." -#define MIMCMD_HELP_HELP "Provides help on other commands.\nUsage: help [].\nThe command will print help information for other commands. If run without any parameters it will print available commands." -#define MIMCMD_HELP_EXCHANGE "Notifies Exchange plugin to check for email.\nUsage: exchange check" -#define MIMCMD_HELP_YAMN "Notifies YAMN plugin to check for email.\nUsage: yamn check." -#define MIMCMD_HELP_CALLSERVICE "Calls a Miranda service.\nUsage: callservice (d|s) (d|s). The command will call Miranda service using wParam and lParam as arguments; the first letter of the paramater must be either 'd' if the parameter is a decimal number or 's' if the parameter is a string. Be careful when you use this function as you can only pass numbers and strings as data.\nNOTE:If you pass invalid data to a service Miranda might crash." -#define MIMCMD_HELP_MESSAGE "Sends a message to the specified contact(s).\nUsage: message [ [ [...]]] . The command will send to the specified contact(s) - at least one contact must be specified - all parameters except the last one are considered recipients.\n has the following format:[:]. is the contact display name or unique ID and is an optional parameter representing the account of the contact (useful in case there is more than one contact with the same name).\nNOTE:The message string cannot exceed 512 characters." -#define MIMCMD_HELP_DATABASE "Allows you to manage database settings.\nUsage:\n db set (b|i|d|s|w)\n db delete \n db get .\nThe command can set a database entry to the specified value (if the entry does not exist it will be created) as well as read or delete a specified database entry. is the name of the module where the key should be located, is the name of the key and is the value to be written. A character must be placed before in order to specify what kind of data to write: b - byte, i - integer (word), d - double word, s - string, w - wide string." -#define MIMCMD_HELP_PROXY "Configures proxy settings either globally or per account.\nUsage: proxy (global|) [].\n is one of the following settings:\n status (disable | enable | toggle).\n server " -#define MIMCMD_HELP_CONTACTS "Allows you to search/list contacts or open a message windows for specified contacts.\nUsage:\n contacts list [ [account:] [id:] [status:] [ [...]]]. The command will search all contacts and display the ones matching the search criteria. To search for a specific account use the keyword 'account:'. To search for contacts that have a certain id use the keyword 'id:'. To search for contacts that have a certain status use 'status:'.\n contacts open [ [account:] [id:] [status:] [ [...]]]. The command will open a message window for all contacts that match the search criteria. To search for a specific account use the keyword 'account:'. To search for contacts that have a certain id use the keyword 'id:'. To search for contacts that have a certain status use 'status:'. If no keyword is specified the command will open a message window for all contacts that have unread messages." -#define MIMCMD_HELP_HISTORY "Shows history or unread messages for a contact.\nUsage:\n history .\n is one of the following commands:\n unread - show unread messages for that contact.\n show - show history from event number to . If any number is negative it is interpreted as a relative index from the last event number + 1 (so the last event for a contact is -1)." -#define MIMCMD_HELP_VERSION "Shows version information for Miranda and CmdLine plugin. If VersionInfo plugin is installed it will use its report instead.\nUsage:\n version. The command will print Miranda's and CmdLine's version numbers or, if VersionInfo plugin is installed, it will show VersionInfo's report." -#define MIMCMD_HELP_SETNICKNAME "Changes the user's nickname on the given protocol to the new name.\nUsage:\n setnickname new_nickname" -#define MIMCMD_HELP_IGNORE "Ignores or removes ignore flags for specific contacts.\nUsage:\n ignore (block | unblock) [ [ [..]]]. Ignores or removes ignore flags for the specified contacts." - -#define MIMMEM_REPLY 1 //data is a PReply structure - -extern TCommand mimCommands[]; -extern int cMimCommands; - -void InitCommandData(); -void DestroyCommandData(); - -#endif //M_MIMCMD_DATA_H \ No newline at end of file diff --git a/plugins/CmdLine/mimcmd_handlers.cpp b/plugins/CmdLine/mimcmd_handlers.cpp deleted file mode 100644 index 9b2d89b696..0000000000 --- a/plugins/CmdLine/mimcmd_handlers.cpp +++ /dev/null @@ -1,2307 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 "commonheaders.h" - -#define STATE_UNKNOWN -1 -#define STATE_OFF 0 -#define STATE_ON 1 -#define STATE_TOGGLE 2 - -#define PROXY_SOCKS4 1 -#define PROXY_SOCKS5 2 -#define PROXY_HTTP 3 -#define PROXY_HTTPS 4 - -#define VALUE_UNKNOWN -1 -#define VALUE_ERROR 0 -#define VALUE_BYTE 1 -#define VALUE_WORD 2 -#define VALUE_DWORD 3 -#define VALUE_STRING 4 -#define VALUE_WIDE 5 - -__inline static int matches(char *command, char *lower) -{ - return ((strcmp(lower, command) == 0) || (strcmp(lower, Translate(command)) == 0)); -} - -int Get2StateValue(char *state) -{ - char lower[512]; - STRNCPY(lower, state, sizeof(lower)); - _strlwr(lower); - - //if ((strcmp(lower, "enable") == 0) || (strcmp(lower, "show") == 0) || (strcmp(lower, "on") == 0)) - if ((matches("enable", lower)) || (matches("show", lower)) || (matches("on", lower))) - { - return STATE_ON; - } - - //if ((strcmp(lower, "disable") == 0) || (strcmp(lower, "hide") == 0) || (strcmp(lower, "off") == 0)) - if ((matches("disable", lower)) || (matches("hide", lower)) || (matches("off", lower))) - { - return STATE_OFF; - } - - //if (strcmp(lower, "toggle") == 0) - if (matches("toggle", lower)) - { - return STATE_TOGGLE; - } - - return STATE_UNKNOWN; -} - -int AccountName2Protocol(const char *accountName, OUT char *uniqueProtocolName, size_t length) -{ - int count; - PROTOACCOUNT **accounts = NULL; - - ProtoEnumAccounts(&count, &accounts); - - STRNCPY(uniqueProtocolName, accountName, length); - - for (int i = 0; i < count; i++) - { - if (accounts[i]->bIsEnabled) - { - if (_stricmp(accountName, accounts[i]->tszAccountName) == 0) - { - STRNCPY(uniqueProtocolName, accounts[i]->szModuleName, length); - - return 0; - } - - //the account name may be unicode, try comparing with an unicode string too - char *account = mir_u2a((wchar_t *) accounts[i]->tszAccountName); - if (_stricmp(accountName, account) == 0) - { - STRNCPY(uniqueProtocolName, accounts[i]->szModuleName, length); - - mir_free(account); - return 0; - } - - mir_free(account); - } - } - - return 1; -} - -void HandleCommand(PCommand command, TArgument *argv, int argc, PReply reply) -{ - switch (command->ID) - { - case MIMCMD_STATUS: - { - HandleStatusCommand(command, argv, argc, reply); - - break; - } - - case MIMCMD_AWAYMSG: - { - HandleAwayMsgCommand(command, argv, argc, reply); - - break; - } - // - //case MIMCMD_XSTATUS: - //{ - // - // break; - //} - - case MIMCMD_POPUPS: - { - HandlePopupsCommand(command, argv, argc, reply); - - break; - } - - case MIMCMD_SOUNDS: - { - HandleSoundsCommand(command, argv, argc, reply); - - break; - } - - case MIMCMD_CLIST: - { - HandleClistCommand(command, argv, argc, reply); - - break; - } - - case MIMCMD_QUIT: - { - HandleQuitCommand(command, argv, argc, reply); - - break; - } - - case MIMCMD_EXCHANGE: - { - HandleExchangeCommand(command, argv, argc, reply); - - break; - } - - case MIMCMD_YAMN: - { - HandleYAMNCommand(command, argv, argc, reply); - - break; - } - - case MIMCMD_CALLSERVICE: - { - HandleCallServiceCommand(command, argv, argc, reply); - - break; - } - - case MIMCMD_MESSAGE: - { - HandleMessageCommand(command, argv, argc, reply); - - break; - } - - case MIMCMD_DATABASE: - { - HandleDatabaseCommand(command, argv, argc, reply); - - break; - } - - case MIMCMD_PROXY: - { - HandleProxyCommand(command, argv, argc, reply); - - break; - } - - case MIMCMD_CONTACTS: - { - HandleContactsCommand(command, argv, argc, reply); - - break; - } - - case MIMCMD_HISTORY: - { - HandleHistoryCommand(command, argv, argc, reply); - - break; - } - - case MIMCMD_VERSION: - { - HandleVersionCommand(command, argv, argc, reply); - - break; - } - - case MIMCMD_SETNICKNAME: - { - HandleSetNicknameCommand(command, argv, argc, reply); - - break; - } - - case MIMCMD_IGNORE: - { - HandleIgnoreCommand(command, argv, argc, reply); - - break; - } - - default: - { - reply->code = MIMRES_NOTFOUND; - mir_snprintf(reply->message, reply->cMessage, Translate("Command '%s' is not currently supported."), command->command); - - break; - } - } -} - -void HandleWrongParametersCount(PCommand command, PReply reply) -{ - reply->code = MIMRES_WRONGPARAMSCOUNT; - mir_snprintf(reply->message, reply->cMessage, Translate("Wrong number of parameters for command '%s'."), command->command); -} - -void HandleUnknownParameter(PCommand command, char *param, PReply reply) -{ - reply->code = MIMRES_UNKNOWNPARAM; - mir_snprintf(reply->message, reply->cMessage, Translate("Unknown parameter '%s' for command '%s'."), param, command->command); -} - -int ParseValueParam(char *param, void *&result) -{ - int ok = VALUE_UNKNOWN; - if (strlen(param) > 0) - { - switch (*param) - { - case 's': - { - size_t len = strlen(param); //- 1 + 1 - result = (char *) malloc(len * sizeof(char)); - STRNCPY((char *) result, param + 1, len); - ((char *) result)[len - 1] = 0; - - ok = VALUE_STRING; - - break; - } - - case 'w': - { - size_t len = strlen(param); - result = (WCHAR *) malloc(len * sizeof(WCHAR)); - char *buffer = (char *) malloc(len * sizeof(WCHAR)); - STRNCPY(buffer, param + 1, len); - - MultiByteToWideChar(CP_ACP, 0, buffer, -1, (WCHAR *) result, (int) len); - - free(buffer); - - ok = VALUE_WIDE; - - break; - } - - case 'b': - { - result = (char *) malloc(sizeof(char)); - long tmp; - char *stop; - - tmp = strtol(param + 1, &stop, 10); - * ((char *) result) = tmp; - - ok = (*stop == 0) ? VALUE_BYTE : VALUE_ERROR; - - break; - } - - case 'i': - { - result = (int *) malloc(sizeof(int)); - long tmp; - char *stop; - - tmp = strtol(param + 1, &stop, 10); - * ((int *) result) = tmp; - - ok = (*stop == 0) ? VALUE_WORD : VALUE_ERROR; - - break; - } - - case 'd': - { - result = (long *) malloc(sizeof(long)); - char *stop; - * ((long *) result) = strtol(param + 1, &stop, 10); - - ok = (*stop == 0) ? VALUE_DWORD : VALUE_ERROR; - - break; - } - } - } - - return ok; -} - -int ParseStatusParam(char *status) -{ - int res = 0; - char lower[256]; - STRNCPY(lower, status, sizeof(lower)); - - if (strcmp(lower, "offline") == 0) - { - res = ID_STATUS_OFFLINE; - } - else{ - if (strcmp(lower, "online") == 0) - { - res = ID_STATUS_ONLINE; - } - else{ - if (strcmp(lower, "away") == 0) - { - res = ID_STATUS_AWAY; - } - else{ - if (strcmp(lower, "dnd") == 0) - { - res = ID_STATUS_DND; - } - else{ - if (strcmp(lower, "na") == 0) - { - res = ID_STATUS_NA; - } - else{ - if (strcmp(lower, "occupied") == 0) - { - res = ID_STATUS_OCCUPIED; - } - else{ - if (strcmp(lower, "freechat") == 0) - { - res = ID_STATUS_FREECHAT; - } - else{ - if (strcmp(lower, "invisible") == 0) - { - res = ID_STATUS_INVISIBLE; - } - else{ - if (strcmp(lower, "onthephone") == 0) - { - res = ID_STATUS_ONTHEPHONE; - } - else{ - if (strcmp(lower, "outtolunch") == 0) - { - res = ID_STATUS_OUTTOLUNCH; - }//outtolunch - }//onthephone - }//invisible - }//freechat - }//occupied - }//na - } //dnd - } //away - } //online - } //offline - - return res; -} - -char *PrettyStatusMode(int status, char *buffer, int size) -{ - *buffer = 0; - char *data = (char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, status, 0); - if (data) - { - STRNCPY(buffer, data, size); - } - - return buffer; -} - -void HandleStatusCommand(PCommand command, TArgument *argv, int argc, PReply reply) -{ - switch (argc) - { - case 2: - { - INT_PTR status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0); - char pretty[128]; - PrettyStatusMode(status, pretty, sizeof(pretty)); - - const int cPerAccountStatus = 1024 * 5; - char *perAccountStatus = (char *) malloc(cPerAccountStatus); - - perAccountStatus[0] = 0; - - int count; - PROTOACCOUNT **accounts = NULL; - - char pn[128]; - - ProtoEnumAccounts(&count, &accounts); - - for (int i = 0; i < count; i++) - { - if (accounts[i]->bIsEnabled) - { - INT_PTR status = CallProtoService(accounts[i]->szModuleName, PS_GETSTATUS, 0, 0); - PrettyStatusMode(status, pn, sizeof(pn)); - - strncat(perAccountStatus, "\n", cPerAccountStatus); - - char *account = mir_u2a((wchar_t *) accounts[i]->tszAccountName); - strncat(perAccountStatus, account, cPerAccountStatus); - mir_free(account); - - strncat(perAccountStatus, ": ", cPerAccountStatus); - strncat(perAccountStatus, pn, cPerAccountStatus); - } - } - - reply->code = MIMRES_SUCCESS; - mir_snprintf(reply->message, reply->cMessage, Translate("Current global status: %s.%s"), pretty, perAccountStatus); - - free(perAccountStatus); - - break; - } - - case 3: - { - int status = ParseStatusParam(argv[2]); - if (status) - { - INT_PTR old = CallService(MS_CLIST_GETSTATUSMODE, 0, 0); - char po[128]; - if (ServiceExists(MS_KS_ANNOUNCESTATUSCHANGE)) - { - announce_status_change(NULL, status, NULL); - } - - PrettyStatusMode(old, po, sizeof(po)); - CallService(MS_CLIST_SETSTATUSMODE, status, 0); - char pn[128]; - PrettyStatusMode(status, pn, sizeof(pn)); - - reply->code = MIMRES_SUCCESS; - mir_snprintf(reply->message, reply->cMessage, Translate("Changed global status to '%s' (previous status was '%s')."), pn, po); - } - else{ - HandleUnknownParameter(command, argv[2], reply); - } - - break; - } - - case 4: - { - int status = ParseStatusParam(argv[2]); - if (status) - { - char protocol[128]; - char *account = argv[3]; - AccountName2Protocol(account, protocol, sizeof(protocol)); - - INT_PTR old = CallProtoService(protocol, PS_GETSTATUS, 0, 0); - char po[128]; - if (ServiceExists(MS_KS_ANNOUNCESTATUSCHANGE)) - { - announce_status_change(protocol, status, NULL); - } - - PrettyStatusMode(old, po, sizeof(po)); - INT_PTR res = CallProtoService(protocol, PS_SETSTATUS, status, 0); - char pn[128]; - PrettyStatusMode(status, pn, sizeof(pn)); - - switch (res) - { - case 0: - { - reply->code = MIMRES_SUCCESS; - mir_snprintf(reply->message, reply->cMessage, Translate("Changed '%s' status to '%s' (previous status was '%s')."), account, pn, po); - - break; - } - - case CALLSERVICE_NOTFOUND: - { - reply->code = MIMRES_FAILURE; - mir_snprintf(reply->message, reply->cMessage, Translate("'%s' doesn't seem to be a valid account."), account); - - break; - } - - default: - { - reply->code = MIMRES_FAILURE; - mir_snprintf(reply->message, reply->cMessage, Translate("Failed to change status for account '%s' to '%s'."), account, pn); - - break; - } - } - } - else{ - HandleUnknownParameter(command, argv[2], reply); - } - - break; - } - - default: - { - HandleWrongParametersCount(command, reply); - - break; - } - } -} - -void GetProtocols(int *count, PROTOCOLDESCRIPTOR ***protocols) -{ - CallService(MS_PROTO_ENUMPROTOCOLS, (WPARAM) count, (LPARAM) protocols); -} - -void HandleAwayMsgCommand(PCommand command, TArgument *argv, int argc, PReply reply) -{ - switch (argc) - { - case 3: - { - char *awayMsg = argv[2]; - int count = 0; - PROTOACCOUNT **accounts = NULL; - ProtoEnumAccounts(&count, &accounts); - - int i; - INT_PTR status; - INT_PTR res = 0; - char *protocol; - char buffer[1024]; - char pn[128]; - for (i = 0; i < count; i++) - { - if (accounts[i]->bIsEnabled) - { - protocol = accounts[i]->szModuleName; - if ((CallProtoService(protocol, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) != 0) //if the protocol supports away messages - { - status = CallProtoService(protocol, PS_GETSTATUS, 0, 0); - res = CallProtoService(protocol, PS_SETAWAYMSG, status, (LPARAM) awayMsg); - PrettyStatusMode(status, pn, sizeof(pn)); - if (res) - { - mir_snprintf(buffer, sizeof(buffer), Translate("Failed to set '%S' status message to '%s' (status is '%s')."), accounts[i]->tszAccountName , awayMsg, pn); - } - else{ - mir_snprintf(buffer, sizeof(buffer), Translate("Successfully set '%S' status message to '%s' (status is '%s')."), accounts[i]->tszAccountName, awayMsg, pn); - } - } - else{ - mir_snprintf(buffer, sizeof(buffer), Translate("Account '%S' does not support away messages, skipping."), accounts[i]->tszAccountName); - } - - if (i != 0) - { - strncat(reply->message, "\n", reply->cMessage); - strncat(reply->message, buffer, reply->cMessage); - } - else{ - STRNCPY(reply->message, buffer, reply->cMessage); - } - } - } - reply->code = MIMRES_SUCCESS; - - break; - } - - case 4: - { - char *awayMsg = argv[2]; - char protocol[128]; - char *account = argv[3]; - AccountName2Protocol(account, protocol, sizeof(protocol)); - - INT_PTR res = 0; - char pn[128]; - if ((res = CallProtoService(protocol, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) != 0) //if the protocol supports away messages - { - INT_PTR status = CallProtoService(protocol, PS_GETSTATUS, 0, 0); - res = CallProtoService(protocol, PS_SETAWAYMSG, status, (LPARAM) awayMsg); - - PrettyStatusMode(status, pn, sizeof(pn)); - } - else{ - if (CallProtoService(protocol, PS_GETSTATUS, 0, 0) == CALLSERVICE_NOTFOUND) - { - res = CALLSERVICE_NOTFOUND; - } - else { - res = -2; - } - } - - switch (res) - { - case 0: - { - reply->code = MIMRES_SUCCESS; - mir_snprintf(reply->message, reply->cMessage, Translate("Changed '%s' status message to '%s' (status is '%s')."), account, awayMsg, pn); - - break; - } - - case CALLSERVICE_NOTFOUND: - { - reply->code = MIMRES_FAILURE; - mir_snprintf(reply->message, reply->cMessage, Translate("'%s' doesn't seem to be a valid account."), account); - - break; - } - - case -2: - { - reply->code = MIMRES_FAILURE; - mir_snprintf(reply->message, reply->cMessage, Translate("Account '%s' does not support away messages, skipping."), account); - - break; - } - - default: - { - reply->code = MIMRES_FAILURE; - mir_snprintf(reply->message, reply->cMessage, Translate("Failed to change status message for account '%s' to '%s' (status is '%s')."), account, awayMsg, pn); - - break; - } - } - - break; - } - - default: - { - HandleWrongParametersCount(command, reply); - - break; - } - } -} - -void Set2StateReply(PReply reply, int state, int failure, char *successTrue, char *failureTrue, char *successFalse, char *failureFalse) -{ - if (state) - { - if (failure) - { - reply->code = MIMRES_FAILURE; - mir_snprintf(reply->message, reply->cMessage, Translate(failureTrue)); - } - else{ - reply->code = MIMRES_SUCCESS; - mir_snprintf(reply->message, reply->cMessage, Translate(successTrue)); - } - } - else{ - if (failure) - { - reply->code = MIMRES_FAILURE; - mir_snprintf(reply->message, reply->cMessage, Translate(failureFalse)); - } - else{ - reply->code = MIMRES_SUCCESS; - mir_snprintf(reply->message, reply->cMessage, Translate(successFalse)); - } - } -} - -void HandlePopupsCommand(PCommand command, TArgument *argv, int argc, PReply reply) -{ - switch (argc) - { - case 2: - { - int state = CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0); - Set2StateReply(reply, state, 0, "Popups are currently enabled.", "", "Popups are currently disabled.", ""); - - break; - } - - case 3: - { - int failure; - int state = 0; - int error = 0; - - switch (Get2StateValue(argv[2])) - { - case STATE_ON: - { - failure = CallService(MS_POPUP_QUERY, PUQS_ENABLEPOPUPS, 0); - state = TRUE; - - break; - } - - case STATE_OFF: - { - failure = CallService(MS_POPUP_QUERY, PUQS_DISABLEPOPUPS, 0); - state = FALSE; - - break; - } - - case STATE_TOGGLE: - { - int state = CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0); - failure = CallService(MS_POPUP_QUERY, (state) ? PUQS_DISABLEPOPUPS : PUQS_ENABLEPOPUPS, 0); - state = 1 - state; - - break; - } - - default: - { - HandleUnknownParameter(command, argv[2], reply); - error = 1; - - break; - } - } - if (!error) - { - Set2StateReply(reply, state, failure, "Popups were enabled successfully.", "Popups could not be enabled.", "Popups were disabled successfully.", "Popups could not be disabled."); - } - - break; - } - - default: - { - HandleWrongParametersCount(command, reply); - - break; - } - - } -} - -void HandleSoundsCommand(PCommand command, TArgument *argv, int argc, PReply reply) -{ - switch (argc) - { - case 2: - { - int state = CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0); - Set2StateReply(reply, state, 0, "Sounds are currently enabled.", "", "Sounds are currently disabled.", ""); - - break; - } - - case 3: - { - int failure; - int state = 0; - int error = 0; - - switch (Get2StateValue(argv[2])) - { - case STATE_ON: - { - failure = 0; - DBWriteContactSettingByte(NULL, "Skin", "UseSound", 1); - state = TRUE; - - break; - } - - case STATE_OFF: - { - failure = 0; - DBWriteContactSettingByte(NULL, "Skin", "UseSound", 0); - state = FALSE; - - break; - } - - case STATE_TOGGLE: - { - state = DBGetContactSettingByte(NULL, "Skin", "UseSound", 1); - - failure = 0; - state = 1 - state; - DBWriteContactSettingByte(NULL, "Skin", "UseSound", state); - - break; - } - - default: - { - HandleUnknownParameter(command, argv[2], reply); - error = 1; - - break; - } - } - if (!error) - { - Set2StateReply(reply, state, failure, "Sounds were enabled successfully.", "Sounds could not be enabled.", "Sounds were disabled successfully.", "Sounds could not be disabled."); - } - - break; - } - - default: - { - HandleWrongParametersCount(command, reply); - - break; - } - } -} - -void HandleClistCommand(PCommand command, TArgument *argv, int argc, PReply reply) -{ - switch (argc) - { - case 2: - { - HWND hClist = (HWND) CallService(MS_CLUI_GETHWND, 0, 0); - int state = IsWindowVisible(hClist); - Set2StateReply(reply, state, 0, "Contact list is currectly shown.", "", "Contact list is currently hidden.", ""); - - break; - } - - case 3: - { - int failure; - int state = 0; - int error = 0; - HWND hClist = (HWND) CallService(MS_CLUI_GETHWND, 0, 0); - - switch (Get2StateValue(argv[2])) - { - case STATE_ON: - { - failure = 0; - ShowWindow(hClist, SW_SHOW); - - state = TRUE; - - break; - } - - case STATE_OFF: - { - failure = 0; - ShowWindow(hClist, SW_HIDE); - state = FALSE; - - break; - } - - case STATE_TOGGLE: - { - state = IsWindowVisible(hClist); - - failure = 0; - state = 1 - state; - ShowWindow(hClist, (state) ? SW_SHOW : SW_HIDE); - - break; - } - - default: - { - HandleUnknownParameter(command, argv[2], reply); - error = 1; - - break; - } - } - if (!error) - { - Set2StateReply(reply, state, failure, "Contact list was shown successfully.", "Contact list could not be shown.", "Contact list was hidden successfully.", "Contact list could not be hidden."); - } - - break; - } - - default: - { - HandleWrongParametersCount(command, reply); - - break; - } - } -} - -void HandleQuitCommand(PCommand command, TArgument *argv, int argc, PReply reply) -{ - switch (argc) - { - case 2: - { - CallService("CloseAction", 0, 0); - - //try another quit method - HWND hWndMiranda = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); - PostMessage(hWndMiranda, WM_COMMAND, ID_ICQ_EXIT, 0); - - reply->code = MIMRES_SUCCESS; - mir_snprintf(reply->message, reply->cMessage, "Issued a quit command."); - - break; - } - - case 3: - { - char lower[128]; - STRNCPY(lower, argv[2], sizeof(lower)); - _strlwr(lower); - - if (strcmp(lower, "wait") == 0) - { - CallService("CloseAction", 0, 0); - - //try another quit method - HWND hWndMiranda = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); - PostMessage(hWndMiranda, WM_COMMAND, ID_ICQ_EXIT, 0); - - reply->code = MIMRES_SUCCESS; - mir_snprintf(reply->message, reply->cMessage, "Issued a quit and wait command."); - - SetEvent(heServerBufferFull); - - bWaitForUnload = 1; - - while (bWaitForUnload) - { - Sleep(250); //wait for Miranda to quit. - } - } - else{ - HandleUnknownParameter(command, argv[2], reply); - } - - break; - } - - default: - { - HandleWrongParametersCount(command, reply); - - break; - } - } -} - -void HandleExchangeCommand(PCommand command, TArgument *argv, int argc, PReply reply) -{ - switch (argc) - { - case 3: - { - char lower[128]; - STRNCPY(lower, argv[2], sizeof(lower)); - _strlwr(lower); - if (strcmp(lower, "check") == 0) - { - if (ServiceExists(MS_EXCHANGE_CHECKEMAIL)) - { - CallService(MS_EXCHANGE_CHECKEMAIL, 0, 0); - - reply->code = MIMRES_SUCCESS; - mir_snprintf(reply->message, reply->cMessage, Translate("Issued check email command to Exchange plugin.")); - } - else{ - reply->code = MIMRES_FAILURE; - mir_snprintf(reply->message, reply->cMessage, Translate("Exchange plugin is not running.")); - } - } - else{ - HandleUnknownParameter(command, argv[2], reply); - } - - break; - } - - default: - { - HandleWrongParametersCount(command, reply); - - break; - } - - } -} - -void HandleYAMNCommand(PCommand command, TArgument *argv, int argc, PReply reply) -{ - switch (argc) - { - case 3: - { - char lower[128]; - STRNCPY(lower, argv[2], sizeof(lower)); - _strlwr(lower); - if (strcmp(lower, "check") == 0) - { - if (ServiceExists(MS_YAMN_FORCECHECK)) - { - CallService(MS_YAMN_FORCECHECK, 0, 0); - - reply->code = MIMRES_SUCCESS; - mir_snprintf(reply->message, reply->cMessage, Translate("Issued check email command to YAMN plugin.")); - } - else{ - reply->code = MIMRES_FAILURE; - mir_snprintf(reply->message, reply->cMessage, Translate("YAMN plugin is not running.")); - } - } - else{ - HandleUnknownParameter(command, argv[2], reply); - } - - break; - } - - default: - { - HandleWrongParametersCount(command, reply); - - break; - } - - } -} - -void HandleCallServiceCommand(PCommand command, TArgument *argv, int argc, PReply reply) -{ - switch (argc) - { - case 5: - { - char *service = argv[2]; - if (ServiceExists(service)) - { - void *wParam = NULL; - void *lParam = NULL; - INT_PTR res1 = ParseValueParam(argv[3], wParam); - INT_PTR res2 = ParseValueParam(argv[4], lParam); - if ((res1 != 0) && (res2 != 0)) - { - //very dangerous but the user asked - INT_PTR res = CallService(service, ((res1 == 1) ? *((long *) wParam) : (WPARAM) wParam), (LPARAM) ((res2 == 1) ? *((long *) lParam) : (LPARAM) lParam)); - - reply->code = MIMRES_SUCCESS; - mir_snprintf(reply->message, reply->cMessage, Translate("CallService call successful: service '%s' returned %p."), service, res); - } - else{ - reply->code = MIMRES_FAILURE; - mir_snprintf(reply->message, reply->cMessage, Translate("Invalid parameter '%s' passed to CallService command."), (wParam) ? argv[4] : argv[3]); - } - - if (wParam) { free(wParam); } - if (lParam) { free(lParam); } - - } - else{ - reply->code = MIMRES_FAILURE; - mir_snprintf(reply->message, reply->cMessage, Translate("Service '%s' does not exist."), service); - } - - break; - } - - default: - { - HandleWrongParametersCount(command, reply); - } - } -} - - -HANDLE ParseContactParam(char *contact) -{ - char name[512]; - char account[128]; - char protocol[128]; - char *p = strrchr(contact, ':'); - HANDLE hContact = NULL; - if (p) - { - *p = 0; - STRNCPY(name, contact, p - contact + 1); - STRNCPY(account, p + 1, sizeof(account)); - *p = ':'; - AccountName2Protocol(account, protocol, sizeof(protocol)); - - hContact = GetContactFromID(name, protocol); - - } - else{ - hContact = GetContactFromID(contact, (char *) NULL); - } - - return hContact; -} - -void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply reply) -{ - if (argc >= 4) - { - char *message = argv[argc - 1]; //get the message - int i; - char *contact; - char buffer[1024]; - HANDLE hContact; - HANDLE hProcess = NULL; - ACKDATA *ack = NULL; - for (i = 2; i < argc - 1; i++) - { - contact = argv[i]; - hContact = ParseContactParam(contact); - - if (hContact) - { - bShouldProcessAcks = TRUE; - hProcess = (HANDLE) CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM) message); - const int MAX_COUNT = 60; - int counter = 0; - while (((ack = GetAck(hProcess)) == NULL) && (counter < MAX_COUNT)) - { - SleepEx(250, TRUE); - counter++; - } - bShouldProcessAcks = FALSE; - - if (counter < MAX_COUNT) - { - if (ack->result == ACKRESULT_SUCCESS) - { - if (ack->szModule) - { - mir_snprintf(buffer, sizeof(buffer), Translate("Message sent to '%s'."), contact); - - DBEVENTINFO e = {0}; - char module[128]; - e.cbSize = sizeof(DBEVENTINFO); - e.eventType = EVENTTYPE_MESSAGE; - e.flags = DBEF_SENT; - - e.pBlob = (PBYTE) message; - e.cbBlob = (DWORD) strlen((char *) message) + 1; - - STRNCPY(module, ack->szModule, sizeof(module)); - e.szModule = module; - e.timestamp = (DWORD) time(NULL); - - CallService(MS_DB_EVENT_ADD, (WPARAM) ack->hContact, (LPARAM) &e); - } - else{ - mir_snprintf(buffer, sizeof(buffer), Translate("Message to '%s' was marked as sent but the account seems to be offline"), contact); - } - } - else{ - mir_snprintf(buffer, sizeof(buffer), Translate("Could not send message to '%s'."), contact); - } - } - else{ - mir_snprintf(buffer, sizeof(buffer), Translate("Timed out while waiting for acknowledgement for contact '%s'."), contact); - } - } - else{ - mir_snprintf(buffer, sizeof(buffer), Translate("Could not find contact handle for contact '%s'."), contact); - } - - if (i == 3) - { - STRNCPY(reply->message, buffer, reply->cMessage); - } - else{ - strncat(reply->message, "\n", reply->cMessage); - strncat(reply->message, buffer, reply->cMessage); - } - } - } - else{ - HandleWrongParametersCount(command, reply); - } -} - -int ParseDatabaseData(DBVARIANT *var, char *buffer, int size, int free) -{ - int ok = 1; - switch (var->type) - { - case DBVT_BYTE: - { - mir_snprintf(buffer, size, "byte:%d", var->bVal); - - break; - } - - case DBVT_WORD: - { - mir_snprintf(buffer, size, "word:%d", var->wVal); - - break; - } - - case DBVT_DWORD: - { - mir_snprintf(buffer, size, "dword:%ld", var->dVal); - - break; - } - - case DBVT_ASCIIZ: - { - mir_snprintf(buffer, size, "string:'%s'", var->pszVal); - if (free) { mir_free(var->pszVal); } - - break; - } - - case DBVT_WCHAR: - { - mir_snprintf(buffer, size, "wide string:'%S'", var->pwszVal); - if (free) { mir_free(var->pwszVal); } - - break; - } - - case DBVT_UTF8: - { - mir_snprintf(buffer, size, "utf8:'%s'", var->pszVal); - if (free) { mir_free(var->pszVal); } - } - - case DBVT_BLOB: - { - mir_snprintf(buffer, size, "blob:N/A"); - if (free) { mir_free(var->pbVal); } - - break; - } - - - default: - { - ok = 0; - mir_snprintf(buffer, size, "unknown value"); - - break; - } - } - - return ok; -} - -void HandleDatabaseCommand(PCommand command, TArgument *argv, int argc, PReply reply) -{ - if (argc >= 3) //we have something to parse - { - char dbcmd[128]; - STRNCPY(dbcmd, argv[2], sizeof(dbcmd)); - dbcmd[sizeof(dbcmd) - 1] = 0; - _strlwr(dbcmd); - if (strcmp(dbcmd, "delete") == 0) - { - if (argc == 5) - { - char *module = argv[3]; - char *key = argv[4]; - - DBDeleteContactSetting(NULL, module, key); - - reply->code = MIMRES_SUCCESS; - mir_snprintf(reply->message, reply->cMessage, Translate("Setting '%s/%s' deleted."), module, key); - } - else{ - HandleWrongParametersCount(command, reply); - } - } - else{ - if (strcmp(dbcmd, "set") == 0) - { - if (argc == 6) - { - char *module = argv[3]; - char *key = argv[4]; - - int ok = 1; - - void *value = NULL; - char *wrote = NULL; - int type = ParseValueParam(argv[5], value); - - - switch (type) - { - case VALUE_STRING: - { - DBWriteContactSettingString(NULL, module, key, (char *) value); - wrote = "string"; - - break; - } - - case VALUE_BYTE: - { - DBWriteContactSettingByte(NULL, module, key, (* (char *) value)); - wrote = "byte"; - - break; - } - - case VALUE_WORD: - { - DBWriteContactSettingWord(NULL, module, key, (* (WORD *) value)); - wrote = "word"; - - break; - } - - case VALUE_DWORD: - { - DBWriteContactSettingDword(NULL, module, key, (* (DWORD *) value)); - wrote = "dword"; - - break; - } - - case VALUE_WIDE: - { - DBWriteContactSettingWString(NULL, module, key, (WCHAR *) value); - wrote = "wide string"; - - break; - } - - default: - { - HandleUnknownParameter(command, argv[5], reply); - ok = 0; - - break; - } - } - - if (ok) - { - reply->code = MIMRES_SUCCESS; - mir_snprintf(reply->message, reply->cMessage, Translate("Wrote '%s:%s' to database entry '%s/%s'."), wrote, argv[5] + 1, module, key); - } - - if (value) - { - free(value); - } - } - else{ - HandleWrongParametersCount(command, reply); - } - } - else{ - if (strcmp(dbcmd, "get") == 0) - { - if (argc == 5) - { - char *module = argv[3]; - char *key = argv[4]; - - DBVARIANT var = {0}; - - int res = DBGetContactSetting(NULL, module, key, &var); - if (!res) - { - char buffer[1024]; - - if (ParseDatabaseData(&var, buffer, sizeof(buffer), TRUE)) - { - reply->code = MIMRES_SUCCESS; - mir_snprintf(reply->message, reply->cMessage, Translate("'%s/%s' - %s."), module, key, buffer); - } - else{ - reply->code = MIMRES_FAILURE; - mir_snprintf(reply->message, reply->cMessage, Translate("Could not retrieve setting '%s/%s': %s."), module, key, buffer); - } - } - else{ - reply->code = MIMRES_FAILURE; - mir_snprintf(reply->message, reply->cMessage, Translate("Setting '%s/%s' was not found."), module, key); - } - - } - else{ - HandleWrongParametersCount(command, reply); - } - } - else{ - HandleUnknownParameter(command, dbcmd, reply); - } - } - - } - - } - else{ - HandleWrongParametersCount(command, reply); - } -} - -int ParseProxyType(char *type) -{ - char lower[128]; - STRNCPY(lower, type, sizeof(lower)); - lower[sizeof(lower) - 1] = 0; - _strlwr(lower); - int proxy = 0; - - if (strcmp(lower, "socks4") == 0) - { - proxy = PROXY_SOCKS4; - } - else{ - if (strcmp(lower, "socks5") == 0) - { - proxy = PROXY_SOCKS5; - } - else{ - if (strcmp(lower, "http") == 0) - { - proxy = PROXY_HTTP; - } - else{ - if (strcmp(lower, "https") == 0) - { - proxy = PROXY_HTTPS; - } - } - } - } - - return proxy; -} - -char *PrettyProxyType(int type, char *buffer, int size) -{ - char *pretty = ""; - switch (type) - { - case PROXY_SOCKS4: - { - pretty = "SOCKS4"; - - break; - } - - case PROXY_SOCKS5: - { - pretty = "SOCKS5"; - - break; - } - - case PROXY_HTTP: - { - pretty = "HTTP"; - - break; - } - - case PROXY_HTTPS: - { - pretty = "HTTPS"; - - break; - } - - default: - { - pretty = "Unknown"; - - break; - } - } - - STRNCPY(buffer, pretty, size); - - return buffer; -} - -void HandleProtocolProxyCommand(PCommand command, TArgument *argv, int argc, PReply reply, char *module, char *protocol) -{ - char proxycmd[128]; - STRNCPY(proxycmd, argv[3], sizeof(proxycmd)); - proxycmd[sizeof(proxycmd) - 1] = 0; - _strlwr(proxycmd); - - char buffer[1024]; - int ok = 1; - - - if (strcmp(proxycmd, "status") == 0) - {//status command - switch (argc) - { - case 4: - { - int value = DBGetContactSettingByte(NULL, module, "NLUseProxy", 0); - - reply->code = MIMRES_SUCCESS; - mir_snprintf(buffer, sizeof(buffer), "%s proxy status is %s", protocol, (value) ? "enabled" : "disabled"); - - break; - } - - case 5: - { - int state = Get2StateValue(argv[4]); - switch (state) - { - case STATE_OFF: - { - DBWriteContactSettingByte(NULL, module, "NLUseProxy", 0); - - reply->code = MIMRES_SUCCESS; - mir_snprintf(buffer, sizeof(buffer), Translate("'%s' proxy was disabled."), protocol); - - break; - } - - case STATE_ON: - { - DBWriteContactSettingByte(NULL, module, "NLUseProxy", 1); - - reply->code = MIMRES_SUCCESS; - mir_snprintf(buffer, sizeof(buffer), Translate("'%s' proxy was enabled."), protocol); - - break; - } - - case STATE_TOGGLE: - { - int value = DBGetContactSettingByte(NULL, module, "NLUseProxy", 0); - value = 1 - value; - DBWriteContactSettingByte(NULL, module, "NLUseProxy", value); - - reply->code = MIMRES_SUCCESS; - mir_snprintf(buffer, sizeof(buffer), (value) ? Translate("'%s' proxy was enabled.") : Translate("'%s' proxy was disabled.")); - - break; - } - - default: - { - HandleUnknownParameter(command, argv[4], reply); - - break; - } - } - - break; - } - - default: - { - HandleWrongParametersCount(command, reply); - ok = 0; - - break; - } - } - } - else{ - if (strcmp(proxycmd, "server") == 0) - { - switch (argc) - { - case 4: - { - char host[256]; - int port; - char type[256]; - GetStringFromDatabase(NULL, module, "NLProxyServer", "", host, sizeof(host)); - port = DBGetContactSettingWord(NULL, module, "NLProxyPort", 0); - PrettyProxyType(DBGetContactSettingByte(NULL, module, "NLProxyType", 0), type, sizeof(type)); - - reply->code = MIMRES_SUCCESS; - mir_snprintf(buffer, sizeof(buffer), Translate("%s proxy server: %s %s:%d."), protocol, type, host, port); - - break; - } - - case 7: - { - int type = ParseProxyType(argv[4]); - char *host = argv[5]; - long port; - char *stop = NULL; - port = strtol(argv[6], &stop, 10); - - if ((*stop == 0) && (type > 0)) - { - DBWriteContactSettingString(NULL, module, "NLProxyServer", host); - DBWriteContactSettingWord(NULL, module, "NLProxyPort", port); - DBWriteContactSettingByte(NULL, module, "NLProxyType", type); - - reply->code = MIMRES_SUCCESS; - mir_snprintf(buffer, sizeof(buffer), Translate("%s proxy set to %s %s:%d."), protocol, argv[4], host, port); - } - else { - reply->code = MIMRES_FAILURE; - mir_snprintf(buffer, sizeof(buffer), Translate("%s The port or the proxy type parameter is invalid."), protocol); - } - - break; - } - - default: - { - HandleWrongParametersCount(command, reply); - ok = 0; - - break; - } - } - } - else{ - ok = 0; - HandleUnknownParameter(command, proxycmd, reply); - } - } - - - if (ok) - { - if (strlen(reply->message) > 0) - { - strncat(reply->message, "\n", reply->cMessage); - strncat(reply->message, buffer, reply->cMessage); - reply->message[reply->cMessage - 1] = 0; - } - else{ - mir_snprintf(reply->message, reply->cMessage, buffer); - } - } -} - -void HandleProxyCommand(PCommand command, TArgument *argv, int argc, PReply reply) -{ - if (argc >= 4) - { - char account[128]; - char protocol[128]; - STRNCPY(account, argv[2], sizeof(account)); - account[sizeof(account) - 1] = 0; - - AccountName2Protocol(account, protocol, sizeof(protocol)); - - int count = 0; - PROTOACCOUNT **accounts = NULL; - ProtoEnumAccounts(&count, &accounts); - - int i; - int global = (strcmp(protocol, "GLOBAL") == 0); - - reply->message[0] = 0; - - int found = 0; - if (global) - { - HandleProtocolProxyCommand(command, argv, argc, reply, "Netlib", protocol); - found = 1; - } - - char *match; - - for (i = 0; i < count; i++) - { - if (accounts[i]->bIsEnabled) - { - match = accounts[i]->szModuleName; - if ((global) || (strcmp(protocol, match) == 0)) - { - HandleProtocolProxyCommand(command, argv, argc, reply, match, match); - found = 1; - } - } - } - - if (!found) - { - reply->code = MIMRES_FAILURE; - mir_snprintf(reply->message, reply->cMessage, Translate("'%s' doesn't seem to be a valid account."), account); - } - } - else{ - HandleWrongParametersCount(command, reply); - } -} - -int ContactMatchSearch(HANDLE hContact, char *contact, char *id, char *account, TArgument *argv, int argc) -{ - int matches = 1; - int i; - - char lwrName[2048] = "\0"; - char lwrAccount[128] = "\0"; - char lwrKeyword[512] = "\0"; - char lwrID[512] = "\0"; - char *pos; - - STRNCPY(lwrName, contact, sizeof(lwrName)); - STRNCPY(lwrAccount, account, sizeof(lwrAccount)); - - if (id) { STRNCPY(lwrID, id, sizeof(lwrID)); } - - _strlwr(lwrName); - _strlwr(lwrAccount); - _strlwr(lwrID); - - for (i = 0; i < argc; i++) - { - STRNCPY(lwrKeyword, argv[i], sizeof(lwrKeyword)); - _strlwr(lwrKeyword); - - pos = strstr(lwrKeyword, "account:"); - if (pos) - { - pos += 8; - if (strstr(lwrAccount, pos) == NULL) - { - matches = 0; - - break; - } - } - else{ - pos = strstr(lwrKeyword, "status:"); - if (pos) - { - int searchStatus = ParseStatusParam(pos + 7); - char protocol[128]; - - AccountName2Protocol(account, protocol, sizeof(protocol)); - WORD contactStatus = DBGetContactSettingWord(hContact, protocol, "Status", ID_STATUS_ONLINE); - - if (searchStatus != contactStatus) - { - matches = 0; - - break; - } - } - else{ - pos = strstr(lwrKeyword, "id:"); - if (pos) - { - pos += 3; - if (strstr(lwrID, pos) == NULL) - { - matches = 0; - - break; - } - } - else{ - if ((strstr(lwrName, lwrKeyword) == NULL)) - { - matches = 0; - - break; - } - } - } - } - } - - return matches; -} - -DWORD WINAPI OpenMessageWindowThread(void *data) -{ - HANDLE hContact = (HANDLE) data; - if (hContact) - { - CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM) hContact, 0); - CallServiceSync("SRMsg/LaunchMessageWindow", (WPARAM) hContact, 0); - } - - return 0; -} - - -void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply reply) -{ - if (argc >= 3) - { - if (_stricmp(argv[2], "list") == 0) - { - HANDLE hContact = NULL; - char buffer[1024]; - char protocol[128]; - - hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); - int count = 0; - - reply->code = MIMRES_SUCCESS; - while (hContact) - { - - GetContactProtocol(hContact, protocol, sizeof(protocol)); - - char *contact = GetContactName(hContact, protocol); - char *id = GetContactID(hContact, protocol); - if (ContactMatchSearch(hContact, contact, id, protocol, &argv[3], argc - 3)) - { - mir_snprintf(buffer, sizeof(buffer), "%s:[%s]:%s (%08d)", contact, id, protocol, hContact); - if (count) - { - strncat(reply->message, "\n", reply->cMessage); - strncat(reply->message, buffer, reply->cMessage); - } - else{ - STRNCPY(reply->message, buffer, reply->cMessage); - } - - if (strlen(reply->message) > 4096) - { - SetEvent(heServerBufferFull); - Sleep(750); //wait a few milliseconds for the event to be processed - count = 0; - *reply->message = 0; - } - - count++; - } - - free(contact); - free(id); - - hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); - } - } - else{ - if (_stricmp(argv[2], "open") == 0) - { - if (argc > 3) - { - HANDLE hContact = NULL; - char protocol[128]; - hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); - - reply->code = MIMRES_SUCCESS; - *reply->message = 0; - while (hContact) - { - GetContactProtocol(hContact, protocol, sizeof(protocol)); - - char *contact = GetContactName(hContact, protocol); - char *id = GetContactID(hContact, protocol); - if (ContactMatchSearch(hContact, contact, id, protocol, &argv[3], argc - 3)) - { - DWORD threadID; - HANDLE thread = CreateThread(NULL, NULL, OpenMessageWindowThread, hContact, NULL, &threadID); - } - - free(contact); - free(id); - - hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); - } - } - else{ - if (argc == 3) - { - HANDLE hContact = NULL; - hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); - - reply->code = MIMRES_SUCCESS; - *reply->message = 0; - - while (hContact) - { - HANDLE hUnreadEvent = (HANDLE) CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM) hContact, 0); - if (hUnreadEvent != NULL) - { - DWORD threadID; - HANDLE thread = CreateThread(NULL, NULL, OpenMessageWindowThread, hContact, NULL, &threadID); - } - - hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); - } - } - else { - HandleWrongParametersCount(command, reply); - } - } - } - else{ - HandleUnknownParameter(command, argv[2], reply); - } - } - } - else{ - HandleWrongParametersCount(command, reply); - } -} - -void AddHistoryEvent(DBEVENTINFO *dbEvent, char *contact, PReply reply) -{ - struct tm * tEvent = localtime((time_t *) &dbEvent->timestamp); - char timestamp[256]; - - strftime(timestamp, sizeof(timestamp), "%H:%M:%S %d/%b/%Y", tEvent); - - static char buffer[6144]; - char *sender = (dbEvent->flags & DBEF_SENT) ? Translate("[me]") : contact; - - char message[4096] = {0}; - STRNCPY(message, (char *) dbEvent->pBlob, sizeof(message)); - message[dbEvent->cbBlob] = message[strlen(message)] = 0; - - //if ((strlen(message) <= 0) && (dbEvent->cbBlob > 0)) - //{ - // WCHAR *tmp = (WCHAR *) dbEvent->pBlob[dbEvent->cbBlob + 1]; - // WideCharToMultiByte(CP_ACP, 0, tmp, -1, message, sizeof(message), NULL, NULL); - //} - - mir_snprintf(buffer, sizeof(buffer), "[%s] %15s: %s", timestamp, sender, message); - - - if (strlen(reply->message) > 0) - { - strncat(reply->message, "\n", reply->cMessage); - strncat(reply->message, buffer, reply->cMessage); - } - else{ - STRNCPY(reply->message, buffer, reply->cMessage); - } - - if (strlen(reply->message) > (reply->cMessage / 2)) - { - SetEvent(heServerBufferFull); - - Sleep(750); - strcpy(reply->message, "\n"); - } -} - -void HandleHistoryCommand(PCommand command, TArgument *argv, int argc, PReply reply) -{ - if (argc >= 3) - { - char *cmd = argv[2]; - switch (argc) - { - case 3: - { - if (_stricmp(cmd, "unread") == 0) - { - HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); - char buffer[4096]; - int count; - int contacts = 0; - DBEVENTINFO dbEvent = {0}; - dbEvent.cbSize = sizeof(DBEVENTINFO); - - reply->code = MIMRES_SUCCESS; - mir_snprintf(reply->message, reply->cMessage, Translate("No unread messages found.")); - - while (hContact) - { - HANDLE hEvent = (HANDLE) CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM) hContact, 0); - if (hEvent != NULL) - { - char *contact; - char protocol[128]; - - count = 0; - while (hEvent != NULL) - { - if (!CallService(MS_DB_EVENT_GET, (WPARAM) hEvent, (LPARAM) &dbEvent)) - { - if (!(dbEvent.flags & DBEF_READ)) - { - count++; - } - } - - hEvent = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, (WPARAM) hEvent, 0); - } - - GetContactProtocol(hContact, protocol, sizeof(protocol)); - contact = GetContactName(hContact, protocol); - mir_snprintf(buffer, sizeof(buffer), Translate("%s:%s - %d unread events."), contact, protocol, count); - - if (contacts > 0) - { - strncat(reply->message, "\n", reply->cMessage); - strncat(reply->message, buffer, reply->cMessage); - } - else{ - STRNCPY(reply->message, buffer, reply->cMessage); - } - contacts++; - - free(contact); - } - - hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); - } - } - else{ - if (_stricmp(cmd, "show") == 0) - { - HandleWrongParametersCount(command, reply); - } - else{ - HandleUnknownParameter(command, cmd, reply); - } - } - - break; - } - - case 4: - { - char *contact = argv[3]; - HANDLE hContact = ParseContactParam(contact); - if (hContact) - { - if (_stricmp(cmd, "unread") == 0) - { - HANDLE hEvent = (HANDLE) CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM) hContact, 0); - DBEVENTINFO dbEvent = {0}; - dbEvent.cbSize = sizeof(DBEVENTINFO); - - char *message[4096]; - dbEvent.pBlob = (PBYTE) message; - - reply->code = MIMRES_SUCCESS; - - while (hEvent) - { - dbEvent.cbBlob = sizeof(message); - if (!CallService(MS_DB_EVENT_GET, (WPARAM) hEvent, (LPARAM) &dbEvent)) //if successful call - { - if (!(dbEvent.flags & DBEF_READ)) - { - AddHistoryEvent(&dbEvent, contact, reply); - } - } - - hEvent = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, (WPARAM) hEvent, 0); - } - } - else{ - if (_stricmp(cmd, "show") == 0) - { - int count = CallService(MS_DB_EVENT_GETCOUNT, (WPARAM) hContact, 0); - - reply->code = MIMRES_SUCCESS; - mir_snprintf(reply->message, reply->cMessage, Translate("Contact '%s' has '%d' events in history."), contact, count); - } - else{ - HandleUnknownParameter(command, cmd, reply); - } - } - } - else{ - reply->code = MIMRES_FAILURE; - mir_snprintf(reply->message, reply->cMessage, Translate("Could not find contact handle for contact '%s'."), contact); - } - - break; - } - - case 6: - { - char *contact = argv[3]; - HANDLE hContact = ParseContactParam(contact); - - if (hContact) - { - if (_stricmp(cmd, "show") == 0) - { - char *stop1 = NULL; - char *stop2 = NULL; - long start = strtol(argv[4], &stop1, 10); - long stop = strtol(argv[5], &stop2, 10); - if (!(*stop1) && !(*stop2)) - { - int size = CallService(MS_DB_EVENT_GETCOUNT, (WPARAM) hContact, 0); - if (start < 0) { start = size + start + 1; } - if (stop < 0) { stop = size + stop + 1; } - - reply->code = MIMRES_SUCCESS; - - int count = stop - start + 1; - if (count > 0) - { - int index = 0; - HANDLE hEvent = (HANDLE) CallService(MS_DB_EVENT_FINDFIRST, (WPARAM) hContact, 0); - DBEVENTINFO dbEvent = {0}; - dbEvent.cbSize = sizeof(DBEVENTINFO); - char message[4096]; - dbEvent.pBlob = (PBYTE) message; - - while (hEvent) - { - dbEvent.cbBlob = sizeof(message); - if (!CallService(MS_DB_EVENT_GET, (WPARAM) hEvent, (LPARAM) &dbEvent)) // if successful call - { - dbEvent.pBlob[dbEvent.cbBlob] = 0; - if ((index >= start) && (index <= stop)) - { - AddHistoryEvent(&dbEvent, contact, reply); - } - } - - if (index > stop) - { - break; - } - - hEvent = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, (WPARAM) hEvent, 0); - index++; - } - } - } - else{ - HandleUnknownParameter(command, (*stop1) ? argv[4] : argv[5], reply); - } - } - else{ - if (_stricmp(cmd, "unread") == 0) - { - HandleWrongParametersCount(command, reply); - } - else{ - HandleUnknownParameter(command, cmd, reply); - } - } - } - else{ - reply->code = MIMRES_FAILURE; - mir_snprintf(reply->message, reply->cMessage, Translate("Could not find contact handle for contact '%s'."), contact); - } - - break; - } - - default: - { - HandleWrongParametersCount(command, reply); - - break; - } - } - } - else{ - HandleWrongParametersCount(command, reply); - } -} - -void HandleVersionCommand(PCommand command, TArgument *argv, int argc, PReply reply) -{ - if (argc == 2) - { - reply->code = MIMRES_SUCCESS; - if (ServiceExists(MS_VERSIONINFO_GETINFO)) - { - char *data; - CallService(MS_VERSIONINFO_GETINFO, (WPARAM) FALSE, (LPARAM) &data); - mir_snprintf(reply->message, reply->cMessage, data); - mir_free(data); - } - else{ - char miranda[512]; - char cmdline[512]; - DWORD v = pluginInfo.version; - CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM) sizeof(miranda), (LPARAM) miranda); - mir_snprintf(cmdline, sizeof(cmdline), "%d.%d.%d.%d", ((v >> 24) & 0xFF), ((v >> 16) & 0xFF), ((v >> 8) & 0xFF), (v & 0xFF)); - mir_snprintf(reply->message, reply->cMessage, "Miranda %s\nCmdLine v.%s", miranda, cmdline); - } - } - else{ - HandleWrongParametersCount(command, reply); - } -} -void HandleSetNicknameCommand(PCommand command, TArgument *argv, int argc, PReply reply) -{ - if (argc == 4) - { - char protocol[512]; - char nickname[512]; - strcpy(protocol, argv[2]); - strcpy(nickname, argv[3]); - - int res = CallProtoService(protocol, PS_SETMYNICKNAME, SMNN_TCHAR, (LPARAM) nickname); - - if (res == 0) - { - reply->code = MIMRES_SUCCESS; - *reply->message = 0; - } - else { - reply->code = MIMRES_FAILURE; - mir_snprintf(reply->message, reply->cMessage, Translate("Error setting nickname to '%s' for protocol '%s'"), nickname, protocol); - } - } - else { - HandleWrongParametersCount(command, reply); - } -} - -void HandleIgnoreCommand(PCommand command, TArgument *argv, int argc, PReply reply) -{ - if (argc >= 4) - { - BOOL block = FALSE; - BOOL goodCommand = FALSE; - if (_stricmp(argv[2], "block") == 0) - { - block = TRUE; - goodCommand = TRUE; - } - - if (_stricmp(argv[2], "unblock") == 0) - { - block = FALSE; - goodCommand = TRUE; - } - - if (!goodCommand) - { - HandleUnknownParameter(command, argv[2], reply); - - return; - } - - HANDLE hContact = NULL; - char *contact; - - for (int i = 3; i < argc; i++) - { - contact = argv[i]; - hContact = ParseContactParam(contact); - - if (hContact) - { - CallService(block ? MS_IGNORE_IGNORE : MS_IGNORE_UNIGNORE, (WPARAM) hContact, IGNOREEVENT_ALL); - } - } - - reply->code = MIMRES_SUCCESS; - *reply->message = 0; - } - else { - HandleWrongParametersCount(command, reply); - } -} \ No newline at end of file diff --git a/plugins/CmdLine/mimcmd_handlers.h b/plugins/CmdLine/mimcmd_handlers.h deleted file mode 100644 index 565c7e3ec5..0000000000 --- a/plugins/CmdLine/mimcmd_handlers.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 M_MIMCMD_HANDLERS_H -#define M_MIMCMD_HANDLERS_H - -#include "mimcmd_data.h" - -//aditional services -#define MS_EXCHANGE_CHECKEMAIL "Exchange/CheckEmail" -#define MS_YAMN_FORCECHECK "YAMN/Service/ForceCheck" - -extern PCommand GetCommand(char *command); - -extern HANDLE heServerBufferFull; -extern PLUGININFOEX pluginInfo; - -void HandleCommand(PCommand command, TArgument *argv, int argc, PReply reply); - -void HandleStatusCommand(PCommand command, TArgument *argv, int argc, PReply reply); -void HandleAwayMsgCommand(PCommand command, TArgument *argv, int argc, PReply reply); -void HandlePopupsCommand(PCommand command, TArgument *argv, int argc, PReply reply); -void HandleSoundsCommand(PCommand command, TArgument *argv, int argc, PReply reply); -void HandleClistCommand(PCommand command, TArgument *argv, int argc, PReply reply); -void HandleQuitCommand(PCommand command, TArgument *argv, int argc, PReply reply); -void HandleExchangeCommand(PCommand command, TArgument *argv, int argc, PReply reply); -void HandleYAMNCommand(PCommand command, TArgument *argv, int argc, PReply reply); -void HandleCallServiceCommand(PCommand command, TArgument *argv, int argc, PReply reply); -void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply reply); -void HandleDatabaseCommand(PCommand command, TArgument *argv, int argc, PReply reply); -void HandleProxyCommand(PCommand command, TArgument *argv, int argc, PReply reply); -void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply reply); -void HandleHistoryCommand(PCommand command, TArgument *argv, int argc, PReply reply); -void HandleVersionCommand(PCommand command, TArgument *argv, int argc, PReply reply); -void HandleSetNicknameCommand(PCommand command, TArgument *argv, int argc, PReply reply); -void HandleIgnoreCommand(PCommand command, TArgument *argv, int argc, PReply reply); - -#endif //M_MIMCMD_HANDLERS_H \ No newline at end of file diff --git a/plugins/CmdLine/mimcmd_ipc.cpp b/plugins/CmdLine/mimcmd_ipc.cpp deleted file mode 100644 index d16de2e7a8..0000000000 --- a/plugins/CmdLine/mimcmd_ipc.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 "commonheaders.h" - -HANDLE hsmCmdLine = NULL; -HANDLE hmClient = NULL; -HANDLE heServerExec = NULL; -HANDLE heServerDone = NULL; -HANDLE heServerClose = NULL; -HANDLE heServerBufferFull = NULL; - -PSharedData sdCmdLine = NULL; - - -int InitClient() -{ - int res = (CreateSystemEvents() || CreateMutexes() || CreateSharedMem()); - - return res; -} - -int InitServer() -{ - int res = (CreateSystemEvents() || CreateSharedMem()); - - return res; -} - -int DestroyClient() -{ - int res = (DestroySystemEvents() || DestroyMutexes() || DestroySharedMem()); - - return res; -} - -int DestroyServer() -{ - int res = (DestroySystemEvents() || DestroySharedMem()); - - return res; -} - -int CreateSystemEvents() -{ - heServerExec = CreateEvent(NULL, FALSE, FALSE, EVENT_SERVER_EXEC); - heServerDone = CreateEvent(NULL, FALSE, FALSE, EVENT_SERVER_DONE); - heServerClose = CreateEvent(NULL, FALSE, FALSE, EVENT_SERVER_CLOSE); - heServerBufferFull = CreateEvent(NULL, FALSE, FALSE, EVENT_SERVER_BUFFERFULL); - - return ((heServerExec == NULL) || (heServerDone == NULL) || (heServerClose == NULL) || (heServerBufferFull == NULL)); -} - -int CreateMutexes() -{ - hmClient = CreateMutex(NULL, FALSE, MUTEX_CLIENT_NAME); - - return (hmClient == NULL); -} - -int CreateSharedMem() -{ - hsmCmdLine = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(TSharedData), SHAREDMEM_NAME); - sdCmdLine = (PSharedData) MapViewOfFile(hsmCmdLine, FILE_MAP_WRITE, 0, 0, sizeof(TSharedData)); - - return ((hsmCmdLine == NULL) || (sdCmdLine == NULL)); -} - -int DestroySystemEvents() -{ - int res = (!CloseHandle(heServerExec)) || (!CloseHandle(heServerDone)) || (!CloseHandle(heServerClose) || (!CloseHandle(heServerBufferFull))); - - return res; -} - -int DestroyMutexes() -{ - int res = !CloseHandle(hmClient); - - return res; -} - -int DestroySharedMem() -{ - int res = (!UnmapViewOfFile(sdCmdLine)) || (!CloseHandle(hsmCmdLine)); - - return res; -} \ No newline at end of file diff --git a/plugins/CmdLine/mimcmd_ipc.h b/plugins/CmdLine/mimcmd_ipc.h deleted file mode 100644 index d12a4a993f..0000000000 --- a/plugins/CmdLine/mimcmd_ipc.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 M_MIMCMD_IPC_H -#define M_MIMCMD_IPC_H - -#include "mimcmd_data.h" - -#define SHAREDMEM_NAME "MirandaCmdLine|SharedMem" -#define MUTEX_CLIENT_NAME "MirandaCmdLine|Mutex|Client" -#define EVENT_SERVER_EXEC "MirandaCmdLine|Event|Exec" -#define EVENT_SERVER_DONE "MirandaCmdLine|Event|Done" -#define EVENT_SERVER_CLOSE "MirandaCmdLine|Event|Close" -#define EVENT_SERVER_BUFFERFULL "MirandaCmdLine|Buffer|Full" - -extern HANDLE hsmCmdLine; -extern HANDLE hmClient; -extern HANDLE heServerExec; -extern HANDLE heServerDone; -extern HANDLE heServerClose; -extern HANDLE heServerBufferFull; - -extern PSharedData sdCmdLine; - -int InitClient(); -int InitServer(); - -int DestroyClient(); -int DestroyServer(); - -int CreateSystemEvents(); -int CreateMutexes(); -int CreateSharedMem(); - -int DestroySystemEvents(); -int DestroyMutexes(); -int DestroySharedMem(); - -#endif \ No newline at end of file diff --git a/plugins/CmdLine/res/version.rc b/plugins/CmdLine/res/version.rc new file mode 100644 index 0000000000..057f549377 --- /dev/null +++ b/plugins/CmdLine/res/version.rc @@ -0,0 +1,103 @@ +// Microsoft Visual C++ generated resource script. +// +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + +#include "..\src\version.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION __PLUGINVERSION_STRING + PRODUCTVERSION __PLUGINVERSION_STRING + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Author", __AUTHOR + VALUE "FileDescription", __DESC + VALUE "FileVersion", __VERSION_STRING + VALUE "InternalName", __PLUGIN_DISPLAY_NAME + VALUE "LegalCopyright", __COPYRIGHT + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/plugins/CmdLine/resource.h b/plugins/CmdLine/resource.h deleted file mode 100644 index 0268ce4765..0000000000 --- a/plugins/CmdLine/resource.h +++ /dev/null @@ -1,15 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by CmdLine.rc -// - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/plugins/CmdLine/services.cpp b/plugins/CmdLine/services.cpp deleted file mode 100644 index 9e006a0046..0000000000 --- a/plugins/CmdLine/services.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 "commonheaders.h" - -int bWaitForUnload = 0; - -int InitServices() -{ - return 0; -} - -int DestroyServices() -{ - return 0; -} - -extern "C" __declspec(dllexport) void ProcessConsoleCommand(PCommand command, TArgument *arguments, int count, PReply reply) -{ - HandleCommand(command, arguments, count, reply); -} - -DWORD WINAPI ServerWorkerThread(void *data) -{ - int done = FALSE; - const HANDLE events[] = {heServerExec, heServerClose}; - const int cEvents = sizeof(events) / sizeof(events[0]); - - while (!done) - { - switch (WaitForMultipleObjects(cEvents, events, FALSE, INFINITE)) - { - case WAIT_OBJECT_0: //need to process something - { - ProcessConsoleCommand(&sdCmdLine->command, sdCmdLine->arguments, sdCmdLine->cArguments, &sdCmdLine->reply); - SetEvent(heServerDone); //notify the client we've finished - - break; - } - - case WAIT_OBJECT_0 + 1: //server is closing - { - done = TRUE; //stop the thread - - break; - } - } - } - - return 0; -} - -int StartServer() -{ - int failure = 1; - if (sdCmdLine) - { - if (sdCmdLine->instances == 0) - { - DWORD threadID; - HANDLE server = CreateThread(NULL, NULL, ServerWorkerThread, NULL, 0, &threadID); - if (server) - { - char path[MIMFOLDER_SIZE]; - GetModuleFileName(GetModuleHandle(NULL), path, sizeof(path)); - char *p = strrchr(path, '\\'); - if (p) { *p = 0; } - STRNCPY(sdCmdLine->mimFolder, path, MIMFOLDER_SIZE); - sdCmdLine->instances++; - - failure = 0; - } - else{ - PUShowMessage(Translate("Could not create CommandLine listening server!"), SM_WARNING); - } - } - else{ - MessageBox(NULL, Translate("You can only run one instance of CmdLine plugin."), Translate("Error"), MB_ICONERROR | MB_OK); - } - } - - return failure; -} - -extern "C" __declspec(dllexport) void ListCommands(PCommand * commands, int *count) -{ - *commands = mimCommands; - *count = cMimCommands; -} \ No newline at end of file diff --git a/plugins/CmdLine/services.h b/plugins/CmdLine/services.h deleted file mode 100644 index b4beb1d44b..0000000000 --- a/plugins/CmdLine/services.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 M_CMDLINE_SERVICES_H -#define M_CMDLINE_SERVICES_H - -#include "mimcmd_handlers.h" - -int InitServices(); -int DestroyServices(); - -int StartServer(); - -extern "C" __declspec(dllexport) void ProcessConsoleCommand(PCommand command, TArgument *arguments, int count, PReply reply); -extern "C" __declspec(dllexport) void ListCommands(PCommand * commands, int *count); - -#endif //M_CMDLINE_SERVICES_H diff --git a/plugins/CmdLine/src/CmdLine.cpp b/plugins/CmdLine/src/CmdLine.cpp new file mode 100644 index 0000000000..4d19c19ccc --- /dev/null +++ b/plugins/CmdLine/src/CmdLine.cpp @@ -0,0 +1,87 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 "commonheaders.h" + +char ModuleName[] = "CmdLine"; +HINSTANCE hInstance; +int hLangpack; + +PLUGININFOEX pluginInfo = { + sizeof(PLUGININFOEX), + __PLUGIN_DISPLAY_NAME, + VERSION, + __DESC, + __AUTHOR, + __AUTHOREMAIL, + __COPYRIGHT, + __AUTHORWEB, + UNICODE_AWARE, //unicode aware + {0x2f1a117c, 0x3c1b, 0x4c01, {0x89, 0xea, 0x6d, 0x8f, 0xd8, 0x5a, 0x9b, 0x4c}} //{2f1a117c-3c1b-4c01-89ea-6d8fd85a9b4c} +}; //not used + +extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion) +{ + return &pluginInfo; +} + +static const MUUID interfaces[] = {MIID_CMDLINE, MIID_LAST}; + +extern "C" __declspec(dllexport) const MUUID *MirandaPluginInterfaces() +{ + return interfaces; +} + +extern "C" int __declspec(dllexport) Load(void) +{ + mir_getLP(&pluginInfo); + +// InitServices(); + if (InitServer()) + { + MessageBox(0, "Could not initialize CmdLine plugin property", "Error", MB_ICONEXCLAMATION | MB_OK); + } + + HookEvents(); + + return 0; +} + +extern "C" int __declspec(dllexport) Unload() +{ + bWaitForUnload = 0; + + UnhookEvents(); + + DestroyServer(); + + return 0; +} + +bool WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + hInstance = hinstDLL; + if (fdwReason == DLL_PROCESS_ATTACH) + { + DisableThreadLibraryCalls(hinstDLL); + } + + return TRUE; +} \ No newline at end of file diff --git a/plugins/CmdLine/src/commonheaders.h b/plugins/CmdLine/src/commonheaders.h new file mode 100644 index 0000000000..b7a332c9d6 --- /dev/null +++ b/plugins/CmdLine/src/commonheaders.h @@ -0,0 +1,112 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 M_CMDLINE_COMMONHEADERS_H +#define M_CMDLINE_COMMONHEADERS_H + +#define MIRANDA_VER 0x0A00 +#define _CRT_SECURE_NO_WARNINGS + +#define MIID_CMDLINE {0xcf8d9633, 0x7744, 0x4a5c, {0xb4, 0x8c, 0x2b, 0xd6, 0x36, 0xa4, 0x6c, 0xde}} + +#include +#include +#include +#include +#include + +#include "newpluginapi.h" +#include "m_database.h" +#include "m_system.h" +#include "m_clist.h" +#include "m_clui.h" +#include "m_contacts.h" +#include "m_langpack.h" +#include "m_options.h" +#include "m_protosvc.h" +#include "m_protocols.h" +#include "m_popup.h" +#include "m_utils.h" +#include "m_message.h" +#include "m_ignore.h" + +#include "m_versioninfo.h" +#include "m_statusplugins.h" + +#include "version.h" +#include "utils.h" +#include "resource.h" +#include "hooked_events.h" +#include "utils.h" +#include "mimcmd_ipc.h" +#include "services.h" +#include "mimcmd_handlers.h" +#include "mimcmd_data.h" + +extern char ModuleName[]; +extern HINSTANCE hInstance; + +//extern PLUGINLINK *pluginLink; + +extern int bUseANSIStrings; + +extern int bWaitForUnload; + +#define ID_ICQ_EXIT 40001 + +static __inline int mir_old_snprintf(char *buffer, size_t count, const char* fmt, ...) { + va_list va; + int len; + + va_start(va, fmt); + len = _vsnprintf(buffer, count-1, fmt, va); + va_end(va); + buffer[count-1] = 0; + return len; +} + +static __inline int mir_old_sntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, ...) { + va_list va; + int len; + + va_start(va, fmt); + len = _vsntprintf(buffer, count-1, fmt, va); + va_end(va); + buffer[count-1] = 0; + return len; +} + +static __inline int mir_old_vsnprintf(char *buffer, size_t count, const char* fmt, va_list va) { + int len; + + len = _vsnprintf(buffer, count-1, fmt, va); + buffer[count-1] = 0; + return len; +} + +static __inline int mir_old_vsntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, va_list va) { + int len; + + len = _vsntprintf(buffer, count-1, fmt, va); + buffer[count-1] = 0; + return len; +} + +#endif //M_CMDLINE_COMMONHEADERS_H \ No newline at end of file diff --git a/plugins/CmdLine/src/hooked_events.cpp b/plugins/CmdLine/src/hooked_events.cpp new file mode 100644 index 0000000000..6ccac9080a --- /dev/null +++ b/plugins/CmdLine/src/hooked_events.cpp @@ -0,0 +1,113 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 "commonheaders.h" + +HANDLE hModulesLoaded; +HANDLE hOptionsInitialize; +HANDLE hShutdown; +HANDLE hProtoAck; + +int bShouldProcessAcks = FALSE; + +ACKDATA acks[50] = {0}; +int cAcks = sizeof(acks) / sizeof(acks[0]); + +int HookEvents() +{ + hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + hShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown); + hProtoAck = HookEvent(ME_PROTO_ACK, OnProtoAck); +// hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OnOptionsInitialise); + + return 0; +} + +int UnhookEvents() +{ + UnhookEvent(hModulesLoaded); + UnhookEvent(hShutdown); + UnhookEvent(OnProtoAck); +// UnhookEvent(hOptionsInitialize); + + return 0; +} + +int OnModulesLoaded(WPARAM wParam, LPARAM lParam) +{ + StartServer(); + + return 0; +} + +int OnShutdown(WPARAM wParam, LPARAM lParam) +{ + SetEvent(heServerClose); //tell the listening server to stop + + return 0; +} + +int QueueAck(ACKDATA *ack) +{ + int i; + for (i = cAcks - 1; i > 0; i--) + { + acks[i] = acks[i - 1]; + } + + acks[0] = *ack; + + return 0; +} + +int ClearAckQueue() +{ + memset(acks, 0, cAcks * sizeof(ACKDATA)); + + return 0; +} + +ACKDATA *GetAck(HANDLE hProcess) +{ + int i; + for (i = 0; i < cAcks; i++) + { + if (acks[i].hProcess == hProcess) + { + return &acks[i]; + } + } + + return NULL; +} + +int OnProtoAck(WPARAM wParam, LPARAM lParam) +{ + if (bShouldProcessAcks) + { + ACKDATA *ack = (ACKDATA *) lParam; + if ((ack) && (ack->type == ACKTYPE_MESSAGE)) //if it's a message ack + { + QueueAck(ack); + } + } + + return 0; +} \ No newline at end of file diff --git a/plugins/CmdLine/src/hooked_events.h b/plugins/CmdLine/src/hooked_events.h new file mode 100644 index 0000000000..11b9fea363 --- /dev/null +++ b/plugins/CmdLine/src/hooked_events.h @@ -0,0 +1,43 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 M_CMDLINE_HOOKED_EVENTS_H +#define M_CMDLINE_HOOKED_EVENTS_H + +extern HANDLE hModulesLoaded; +extern HANDLE hOptionsInitialise; +extern HANDLE hShutdown; +extern HANDLE hProtoAck; + +extern int bShouldProcessAcks; + +int HookEvents(); +int UnhookEvents(); + +int ClearQueue(); +ACKDATA *GetAck(HANDLE hProcess); + +int OnModulesLoaded(WPARAM wParam, LPARAM lParam); +int OnOptionsInitialise(WPARAM wParam, LPARAM lParam); +int OnShutdown(WPARAM wParam, LPARAM lParam); +int OnProtoAck(WPARAM wParam, LPARAM lParam); + +#endif \ No newline at end of file diff --git a/plugins/CmdLine/src/mimcmd_data.cpp b/plugins/CmdLine/src/mimcmd_data.cpp new file mode 100644 index 0000000000..95550ed778 --- /dev/null +++ b/plugins/CmdLine/src/mimcmd_data.cpp @@ -0,0 +1,43 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 "commonheaders.h" + +TCommand mimCommands[] = {{MIMCMD_STATUS, "status", MIMCMD_HELP_STATUS}, + {MIMCMD_AWAYMSG, "awaymsg", MIMCMD_HELP_AWAYMSG}, + {MIMCMD_XSTATUS, "xstatus", MIMCMD_HELP_XSTATUS}, + {MIMCMD_POPUPS, "popups", MIMCMD_HELP_POPUPS}, + {MIMCMD_SOUNDS, "sounds", MIMCMD_HELP_SOUNDS}, + {MIMCMD_CLIST, "clist", MIMCMD_HELP_CLIST}, + {MIMCMD_QUIT, "quit", MIMCMD_HELP_QUIT}, + {MIMCMD_HELP, "help", MIMCMD_HELP_HELP}, + {MIMCMD_EXCHANGE, "exchange", MIMCMD_HELP_EXCHANGE}, + {MIMCMD_YAMN, "yamn", MIMCMD_HELP_YAMN}, + {MIMCMD_CALLSERVICE, "callservice", MIMCMD_HELP_CALLSERVICE}, + {MIMCMD_MESSAGE, "message", MIMCMD_HELP_MESSAGE}, + {MIMCMD_DATABASE, "db", MIMCMD_HELP_DATABASE}, + {MIMCMD_PROXY, "proxy", MIMCMD_HELP_PROXY}, + {MIMCMD_CONTACTS, "contacts", MIMCMD_HELP_CONTACTS}, + {MIMCMD_HISTORY, "history", MIMCMD_HELP_HISTORY}, + {MIMCMD_VERSION, "version", MIMCMD_HELP_VERSION}, + {MIMCMD_SETNICKNAME, "setnickname", MIMCMD_HELP_SETNICKNAME}, + {MIMCMD_IGNORE, "ignore", MIMCMD_HELP_IGNORE}, + }; +int cMimCommands = sizeof(mimCommands) / sizeof(mimCommands[0]); \ No newline at end of file diff --git a/plugins/CmdLine/src/mimcmd_data.h b/plugins/CmdLine/src/mimcmd_data.h new file mode 100644 index 0000000000..2ef39bc4dd --- /dev/null +++ b/plugins/CmdLine/src/mimcmd_data.h @@ -0,0 +1,120 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 M_MIMCMD_DATA_H +#define M_MIMCMD_DATA_H + +#define COMMAND_SIZE 64 +#define HELP_SIZE 1024 +#define REPLY_SIZE 8096 + +#define MIMFOLDER_SIZE 300 + +#define MAX_ARGUMENTS 20 +#define ARGUMENT_SIZE 512 + +typedef char TArgument[ARGUMENT_SIZE]; + +struct TReply{ + int code; + char message[REPLY_SIZE]; + static const int cMessage = REPLY_SIZE; +}; + +typedef TReply *PReply; + +struct TCommand{ + long ID; + char command[COMMAND_SIZE]; + char help[HELP_SIZE]; +}; + +typedef TCommand *PCommand; + +struct TSharedData{ + char mimFolder[MIMFOLDER_SIZE]; + TCommand command; + TArgument arguments[MAX_ARGUMENTS]; + int cArguments; + TReply reply; + int instances; +}; + +typedef TSharedData *PSharedData; + +//return codes +#define MIMRES_SUCCESS 0 //command was successful +#define MIMRES_FAILURE 1 //command was not successful +#define MIMRES_NOTFOUND 2 //command not found +#define MIMRES_UNKNOWNPARAM 3 //command parameter is unknown +#define MIMRES_NOMIRANDA 4 //could not link to Miranda +#define MIMRES_WRONGPARAMSCOUNT 5 //wrong number of parameters + + +#define MIMCMD_UNKNOWN -1 //unknown command +#define MIMCMD_STATUS 1 +#define MIMCMD_AWAYMSG 2 +#define MIMCMD_XSTATUS 3 +#define MIMCMD_POPUPS 4 +#define MIMCMD_SOUNDS 5 +#define MIMCMD_CLIST 6 +#define MIMCMD_QUIT 7 +#define MIMCMD_HELP 8 +#define MIMCMD_EXCHANGE 9 +#define MIMCMD_YAMN 10 +#define MIMCMD_CALLSERVICE 11 +#define MIMCMD_MESSAGE 12 +#define MIMCMD_DATABASE 13 +#define MIMCMD_PROXY 14 +#define MIMCMD_CONTACTS 15 +#define MIMCMD_HISTORY 16 +#define MIMCMD_VERSION 17 +#define MIMCMD_SETNICKNAME 18 +#define MIMCMD_IGNORE 19 + +#define MIMCMD_HELP_STATUS "Change account status either globally or per account.\nUsage: status [].\nPossible values for are: offline, online, away, dnd, na, occupied, freechat, invisible, onthephone, outtolunch.\n is the name of the account. If it's not specified then the command will issue a global status change." +#define MIMCMD_HELP_AWAYMSG "Change away message either globally or per account.\nUsage: awaymsg [].\n is the new away message.\n is an optional parameter specifying the account to set the away message for. If not specified then the away message will be set globally." +#define MIMCMD_HELP_XSTATUS "Change extended status either globally or per account.\nUsage xstatus [].\n is the new extended status to set. Possible values are:...\n is an optional parameter specifying the account for which extended status is set. If not specified then extended status for all accounts will be changed.\nNOTE: Not all accounts/protocols support extended status." +#define MIMCMD_HELP_POPUPS "Disables or enables popups display.\nUsage popups (disable | enable | toggle).\nThe command will either enable or disable popups display." +#define MIMCMD_HELP_SOUNDS "Disables or enables sounds.\nUsage: sounds (disable | enable | toggle).\nThe command will either disable or enable sounds." +#define MIMCMD_HELP_CLIST "Hides or shows the contact list window.\nUsage: clist (show | hide | toggle).\nThe command will either show or hide the contact list window." +#define MIMCMD_HELP_QUIT "Closes Miranda.\nUsage: quit [wait]. If wait is used then the command will return only when CmdLine plugin has been unloaded by Miranda." +#define MIMCMD_HELP_HELP "Provides help on other commands.\nUsage: help [].\nThe command will print help information for other commands. If run without any parameters it will print available commands." +#define MIMCMD_HELP_EXCHANGE "Notifies Exchange plugin to check for email.\nUsage: exchange check" +#define MIMCMD_HELP_YAMN "Notifies YAMN plugin to check for email.\nUsage: yamn check." +#define MIMCMD_HELP_CALLSERVICE "Calls a Miranda service.\nUsage: callservice (d|s) (d|s). The command will call Miranda service using wParam and lParam as arguments; the first letter of the paramater must be either 'd' if the parameter is a decimal number or 's' if the parameter is a string. Be careful when you use this function as you can only pass numbers and strings as data.\nNOTE:If you pass invalid data to a service Miranda might crash." +#define MIMCMD_HELP_MESSAGE "Sends a message to the specified contact(s).\nUsage: message [ [ [...]]] . The command will send to the specified contact(s) - at least one contact must be specified - all parameters except the last one are considered recipients.\n has the following format:[:]. is the contact display name or unique ID and is an optional parameter representing the account of the contact (useful in case there is more than one contact with the same name).\nNOTE:The message string cannot exceed 512 characters." +#define MIMCMD_HELP_DATABASE "Allows you to manage database settings.\nUsage:\n db set (b|i|d|s|w)\n db delete \n db get .\nThe command can set a database entry to the specified value (if the entry does not exist it will be created) as well as read or delete a specified database entry. is the name of the module where the key should be located, is the name of the key and is the value to be written. A character must be placed before in order to specify what kind of data to write: b - byte, i - integer (word), d - double word, s - string, w - wide string." +#define MIMCMD_HELP_PROXY "Configures proxy settings either globally or per account.\nUsage: proxy (global|) [].\n is one of the following settings:\n status (disable | enable | toggle).\n server " +#define MIMCMD_HELP_CONTACTS "Allows you to search/list contacts or open a message windows for specified contacts.\nUsage:\n contacts list [ [account:] [id:] [status:] [ [...]]]. The command will search all contacts and display the ones matching the search criteria. To search for a specific account use the keyword 'account:'. To search for contacts that have a certain id use the keyword 'id:'. To search for contacts that have a certain status use 'status:'.\n contacts open [ [account:] [id:] [status:] [ [...]]]. The command will open a message window for all contacts that match the search criteria. To search for a specific account use the keyword 'account:'. To search for contacts that have a certain id use the keyword 'id:'. To search for contacts that have a certain status use 'status:'. If no keyword is specified the command will open a message window for all contacts that have unread messages." +#define MIMCMD_HELP_HISTORY "Shows history or unread messages for a contact.\nUsage:\n history .\n is one of the following commands:\n unread - show unread messages for that contact.\n show - show history from event number to . If any number is negative it is interpreted as a relative index from the last event number + 1 (so the last event for a contact is -1)." +#define MIMCMD_HELP_VERSION "Shows version information for Miranda and CmdLine plugin. If VersionInfo plugin is installed it will use its report instead.\nUsage:\n version. The command will print Miranda's and CmdLine's version numbers or, if VersionInfo plugin is installed, it will show VersionInfo's report." +#define MIMCMD_HELP_SETNICKNAME "Changes the user's nickname on the given protocol to the new name.\nUsage:\n setnickname new_nickname" +#define MIMCMD_HELP_IGNORE "Ignores or removes ignore flags for specific contacts.\nUsage:\n ignore (block | unblock) [ [ [..]]]. Ignores or removes ignore flags for the specified contacts." + +#define MIMMEM_REPLY 1 //data is a PReply structure + +extern TCommand mimCommands[]; +extern int cMimCommands; + +void InitCommandData(); +void DestroyCommandData(); + +#endif //M_MIMCMD_DATA_H \ No newline at end of file diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp new file mode 100644 index 0000000000..9b2d89b696 --- /dev/null +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -0,0 +1,2307 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 "commonheaders.h" + +#define STATE_UNKNOWN -1 +#define STATE_OFF 0 +#define STATE_ON 1 +#define STATE_TOGGLE 2 + +#define PROXY_SOCKS4 1 +#define PROXY_SOCKS5 2 +#define PROXY_HTTP 3 +#define PROXY_HTTPS 4 + +#define VALUE_UNKNOWN -1 +#define VALUE_ERROR 0 +#define VALUE_BYTE 1 +#define VALUE_WORD 2 +#define VALUE_DWORD 3 +#define VALUE_STRING 4 +#define VALUE_WIDE 5 + +__inline static int matches(char *command, char *lower) +{ + return ((strcmp(lower, command) == 0) || (strcmp(lower, Translate(command)) == 0)); +} + +int Get2StateValue(char *state) +{ + char lower[512]; + STRNCPY(lower, state, sizeof(lower)); + _strlwr(lower); + + //if ((strcmp(lower, "enable") == 0) || (strcmp(lower, "show") == 0) || (strcmp(lower, "on") == 0)) + if ((matches("enable", lower)) || (matches("show", lower)) || (matches("on", lower))) + { + return STATE_ON; + } + + //if ((strcmp(lower, "disable") == 0) || (strcmp(lower, "hide") == 0) || (strcmp(lower, "off") == 0)) + if ((matches("disable", lower)) || (matches("hide", lower)) || (matches("off", lower))) + { + return STATE_OFF; + } + + //if (strcmp(lower, "toggle") == 0) + if (matches("toggle", lower)) + { + return STATE_TOGGLE; + } + + return STATE_UNKNOWN; +} + +int AccountName2Protocol(const char *accountName, OUT char *uniqueProtocolName, size_t length) +{ + int count; + PROTOACCOUNT **accounts = NULL; + + ProtoEnumAccounts(&count, &accounts); + + STRNCPY(uniqueProtocolName, accountName, length); + + for (int i = 0; i < count; i++) + { + if (accounts[i]->bIsEnabled) + { + if (_stricmp(accountName, accounts[i]->tszAccountName) == 0) + { + STRNCPY(uniqueProtocolName, accounts[i]->szModuleName, length); + + return 0; + } + + //the account name may be unicode, try comparing with an unicode string too + char *account = mir_u2a((wchar_t *) accounts[i]->tszAccountName); + if (_stricmp(accountName, account) == 0) + { + STRNCPY(uniqueProtocolName, accounts[i]->szModuleName, length); + + mir_free(account); + return 0; + } + + mir_free(account); + } + } + + return 1; +} + +void HandleCommand(PCommand command, TArgument *argv, int argc, PReply reply) +{ + switch (command->ID) + { + case MIMCMD_STATUS: + { + HandleStatusCommand(command, argv, argc, reply); + + break; + } + + case MIMCMD_AWAYMSG: + { + HandleAwayMsgCommand(command, argv, argc, reply); + + break; + } + // + //case MIMCMD_XSTATUS: + //{ + // + // break; + //} + + case MIMCMD_POPUPS: + { + HandlePopupsCommand(command, argv, argc, reply); + + break; + } + + case MIMCMD_SOUNDS: + { + HandleSoundsCommand(command, argv, argc, reply); + + break; + } + + case MIMCMD_CLIST: + { + HandleClistCommand(command, argv, argc, reply); + + break; + } + + case MIMCMD_QUIT: + { + HandleQuitCommand(command, argv, argc, reply); + + break; + } + + case MIMCMD_EXCHANGE: + { + HandleExchangeCommand(command, argv, argc, reply); + + break; + } + + case MIMCMD_YAMN: + { + HandleYAMNCommand(command, argv, argc, reply); + + break; + } + + case MIMCMD_CALLSERVICE: + { + HandleCallServiceCommand(command, argv, argc, reply); + + break; + } + + case MIMCMD_MESSAGE: + { + HandleMessageCommand(command, argv, argc, reply); + + break; + } + + case MIMCMD_DATABASE: + { + HandleDatabaseCommand(command, argv, argc, reply); + + break; + } + + case MIMCMD_PROXY: + { + HandleProxyCommand(command, argv, argc, reply); + + break; + } + + case MIMCMD_CONTACTS: + { + HandleContactsCommand(command, argv, argc, reply); + + break; + } + + case MIMCMD_HISTORY: + { + HandleHistoryCommand(command, argv, argc, reply); + + break; + } + + case MIMCMD_VERSION: + { + HandleVersionCommand(command, argv, argc, reply); + + break; + } + + case MIMCMD_SETNICKNAME: + { + HandleSetNicknameCommand(command, argv, argc, reply); + + break; + } + + case MIMCMD_IGNORE: + { + HandleIgnoreCommand(command, argv, argc, reply); + + break; + } + + default: + { + reply->code = MIMRES_NOTFOUND; + mir_snprintf(reply->message, reply->cMessage, Translate("Command '%s' is not currently supported."), command->command); + + break; + } + } +} + +void HandleWrongParametersCount(PCommand command, PReply reply) +{ + reply->code = MIMRES_WRONGPARAMSCOUNT; + mir_snprintf(reply->message, reply->cMessage, Translate("Wrong number of parameters for command '%s'."), command->command); +} + +void HandleUnknownParameter(PCommand command, char *param, PReply reply) +{ + reply->code = MIMRES_UNKNOWNPARAM; + mir_snprintf(reply->message, reply->cMessage, Translate("Unknown parameter '%s' for command '%s'."), param, command->command); +} + +int ParseValueParam(char *param, void *&result) +{ + int ok = VALUE_UNKNOWN; + if (strlen(param) > 0) + { + switch (*param) + { + case 's': + { + size_t len = strlen(param); //- 1 + 1 + result = (char *) malloc(len * sizeof(char)); + STRNCPY((char *) result, param + 1, len); + ((char *) result)[len - 1] = 0; + + ok = VALUE_STRING; + + break; + } + + case 'w': + { + size_t len = strlen(param); + result = (WCHAR *) malloc(len * sizeof(WCHAR)); + char *buffer = (char *) malloc(len * sizeof(WCHAR)); + STRNCPY(buffer, param + 1, len); + + MultiByteToWideChar(CP_ACP, 0, buffer, -1, (WCHAR *) result, (int) len); + + free(buffer); + + ok = VALUE_WIDE; + + break; + } + + case 'b': + { + result = (char *) malloc(sizeof(char)); + long tmp; + char *stop; + + tmp = strtol(param + 1, &stop, 10); + * ((char *) result) = tmp; + + ok = (*stop == 0) ? VALUE_BYTE : VALUE_ERROR; + + break; + } + + case 'i': + { + result = (int *) malloc(sizeof(int)); + long tmp; + char *stop; + + tmp = strtol(param + 1, &stop, 10); + * ((int *) result) = tmp; + + ok = (*stop == 0) ? VALUE_WORD : VALUE_ERROR; + + break; + } + + case 'd': + { + result = (long *) malloc(sizeof(long)); + char *stop; + * ((long *) result) = strtol(param + 1, &stop, 10); + + ok = (*stop == 0) ? VALUE_DWORD : VALUE_ERROR; + + break; + } + } + } + + return ok; +} + +int ParseStatusParam(char *status) +{ + int res = 0; + char lower[256]; + STRNCPY(lower, status, sizeof(lower)); + + if (strcmp(lower, "offline") == 0) + { + res = ID_STATUS_OFFLINE; + } + else{ + if (strcmp(lower, "online") == 0) + { + res = ID_STATUS_ONLINE; + } + else{ + if (strcmp(lower, "away") == 0) + { + res = ID_STATUS_AWAY; + } + else{ + if (strcmp(lower, "dnd") == 0) + { + res = ID_STATUS_DND; + } + else{ + if (strcmp(lower, "na") == 0) + { + res = ID_STATUS_NA; + } + else{ + if (strcmp(lower, "occupied") == 0) + { + res = ID_STATUS_OCCUPIED; + } + else{ + if (strcmp(lower, "freechat") == 0) + { + res = ID_STATUS_FREECHAT; + } + else{ + if (strcmp(lower, "invisible") == 0) + { + res = ID_STATUS_INVISIBLE; + } + else{ + if (strcmp(lower, "onthephone") == 0) + { + res = ID_STATUS_ONTHEPHONE; + } + else{ + if (strcmp(lower, "outtolunch") == 0) + { + res = ID_STATUS_OUTTOLUNCH; + }//outtolunch + }//onthephone + }//invisible + }//freechat + }//occupied + }//na + } //dnd + } //away + } //online + } //offline + + return res; +} + +char *PrettyStatusMode(int status, char *buffer, int size) +{ + *buffer = 0; + char *data = (char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, status, 0); + if (data) + { + STRNCPY(buffer, data, size); + } + + return buffer; +} + +void HandleStatusCommand(PCommand command, TArgument *argv, int argc, PReply reply) +{ + switch (argc) + { + case 2: + { + INT_PTR status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0); + char pretty[128]; + PrettyStatusMode(status, pretty, sizeof(pretty)); + + const int cPerAccountStatus = 1024 * 5; + char *perAccountStatus = (char *) malloc(cPerAccountStatus); + + perAccountStatus[0] = 0; + + int count; + PROTOACCOUNT **accounts = NULL; + + char pn[128]; + + ProtoEnumAccounts(&count, &accounts); + + for (int i = 0; i < count; i++) + { + if (accounts[i]->bIsEnabled) + { + INT_PTR status = CallProtoService(accounts[i]->szModuleName, PS_GETSTATUS, 0, 0); + PrettyStatusMode(status, pn, sizeof(pn)); + + strncat(perAccountStatus, "\n", cPerAccountStatus); + + char *account = mir_u2a((wchar_t *) accounts[i]->tszAccountName); + strncat(perAccountStatus, account, cPerAccountStatus); + mir_free(account); + + strncat(perAccountStatus, ": ", cPerAccountStatus); + strncat(perAccountStatus, pn, cPerAccountStatus); + } + } + + reply->code = MIMRES_SUCCESS; + mir_snprintf(reply->message, reply->cMessage, Translate("Current global status: %s.%s"), pretty, perAccountStatus); + + free(perAccountStatus); + + break; + } + + case 3: + { + int status = ParseStatusParam(argv[2]); + if (status) + { + INT_PTR old = CallService(MS_CLIST_GETSTATUSMODE, 0, 0); + char po[128]; + if (ServiceExists(MS_KS_ANNOUNCESTATUSCHANGE)) + { + announce_status_change(NULL, status, NULL); + } + + PrettyStatusMode(old, po, sizeof(po)); + CallService(MS_CLIST_SETSTATUSMODE, status, 0); + char pn[128]; + PrettyStatusMode(status, pn, sizeof(pn)); + + reply->code = MIMRES_SUCCESS; + mir_snprintf(reply->message, reply->cMessage, Translate("Changed global status to '%s' (previous status was '%s')."), pn, po); + } + else{ + HandleUnknownParameter(command, argv[2], reply); + } + + break; + } + + case 4: + { + int status = ParseStatusParam(argv[2]); + if (status) + { + char protocol[128]; + char *account = argv[3]; + AccountName2Protocol(account, protocol, sizeof(protocol)); + + INT_PTR old = CallProtoService(protocol, PS_GETSTATUS, 0, 0); + char po[128]; + if (ServiceExists(MS_KS_ANNOUNCESTATUSCHANGE)) + { + announce_status_change(protocol, status, NULL); + } + + PrettyStatusMode(old, po, sizeof(po)); + INT_PTR res = CallProtoService(protocol, PS_SETSTATUS, status, 0); + char pn[128]; + PrettyStatusMode(status, pn, sizeof(pn)); + + switch (res) + { + case 0: + { + reply->code = MIMRES_SUCCESS; + mir_snprintf(reply->message, reply->cMessage, Translate("Changed '%s' status to '%s' (previous status was '%s')."), account, pn, po); + + break; + } + + case CALLSERVICE_NOTFOUND: + { + reply->code = MIMRES_FAILURE; + mir_snprintf(reply->message, reply->cMessage, Translate("'%s' doesn't seem to be a valid account."), account); + + break; + } + + default: + { + reply->code = MIMRES_FAILURE; + mir_snprintf(reply->message, reply->cMessage, Translate("Failed to change status for account '%s' to '%s'."), account, pn); + + break; + } + } + } + else{ + HandleUnknownParameter(command, argv[2], reply); + } + + break; + } + + default: + { + HandleWrongParametersCount(command, reply); + + break; + } + } +} + +void GetProtocols(int *count, PROTOCOLDESCRIPTOR ***protocols) +{ + CallService(MS_PROTO_ENUMPROTOCOLS, (WPARAM) count, (LPARAM) protocols); +} + +void HandleAwayMsgCommand(PCommand command, TArgument *argv, int argc, PReply reply) +{ + switch (argc) + { + case 3: + { + char *awayMsg = argv[2]; + int count = 0; + PROTOACCOUNT **accounts = NULL; + ProtoEnumAccounts(&count, &accounts); + + int i; + INT_PTR status; + INT_PTR res = 0; + char *protocol; + char buffer[1024]; + char pn[128]; + for (i = 0; i < count; i++) + { + if (accounts[i]->bIsEnabled) + { + protocol = accounts[i]->szModuleName; + if ((CallProtoService(protocol, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) != 0) //if the protocol supports away messages + { + status = CallProtoService(protocol, PS_GETSTATUS, 0, 0); + res = CallProtoService(protocol, PS_SETAWAYMSG, status, (LPARAM) awayMsg); + PrettyStatusMode(status, pn, sizeof(pn)); + if (res) + { + mir_snprintf(buffer, sizeof(buffer), Translate("Failed to set '%S' status message to '%s' (status is '%s')."), accounts[i]->tszAccountName , awayMsg, pn); + } + else{ + mir_snprintf(buffer, sizeof(buffer), Translate("Successfully set '%S' status message to '%s' (status is '%s')."), accounts[i]->tszAccountName, awayMsg, pn); + } + } + else{ + mir_snprintf(buffer, sizeof(buffer), Translate("Account '%S' does not support away messages, skipping."), accounts[i]->tszAccountName); + } + + if (i != 0) + { + strncat(reply->message, "\n", reply->cMessage); + strncat(reply->message, buffer, reply->cMessage); + } + else{ + STRNCPY(reply->message, buffer, reply->cMessage); + } + } + } + reply->code = MIMRES_SUCCESS; + + break; + } + + case 4: + { + char *awayMsg = argv[2]; + char protocol[128]; + char *account = argv[3]; + AccountName2Protocol(account, protocol, sizeof(protocol)); + + INT_PTR res = 0; + char pn[128]; + if ((res = CallProtoService(protocol, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) != 0) //if the protocol supports away messages + { + INT_PTR status = CallProtoService(protocol, PS_GETSTATUS, 0, 0); + res = CallProtoService(protocol, PS_SETAWAYMSG, status, (LPARAM) awayMsg); + + PrettyStatusMode(status, pn, sizeof(pn)); + } + else{ + if (CallProtoService(protocol, PS_GETSTATUS, 0, 0) == CALLSERVICE_NOTFOUND) + { + res = CALLSERVICE_NOTFOUND; + } + else { + res = -2; + } + } + + switch (res) + { + case 0: + { + reply->code = MIMRES_SUCCESS; + mir_snprintf(reply->message, reply->cMessage, Translate("Changed '%s' status message to '%s' (status is '%s')."), account, awayMsg, pn); + + break; + } + + case CALLSERVICE_NOTFOUND: + { + reply->code = MIMRES_FAILURE; + mir_snprintf(reply->message, reply->cMessage, Translate("'%s' doesn't seem to be a valid account."), account); + + break; + } + + case -2: + { + reply->code = MIMRES_FAILURE; + mir_snprintf(reply->message, reply->cMessage, Translate("Account '%s' does not support away messages, skipping."), account); + + break; + } + + default: + { + reply->code = MIMRES_FAILURE; + mir_snprintf(reply->message, reply->cMessage, Translate("Failed to change status message for account '%s' to '%s' (status is '%s')."), account, awayMsg, pn); + + break; + } + } + + break; + } + + default: + { + HandleWrongParametersCount(command, reply); + + break; + } + } +} + +void Set2StateReply(PReply reply, int state, int failure, char *successTrue, char *failureTrue, char *successFalse, char *failureFalse) +{ + if (state) + { + if (failure) + { + reply->code = MIMRES_FAILURE; + mir_snprintf(reply->message, reply->cMessage, Translate(failureTrue)); + } + else{ + reply->code = MIMRES_SUCCESS; + mir_snprintf(reply->message, reply->cMessage, Translate(successTrue)); + } + } + else{ + if (failure) + { + reply->code = MIMRES_FAILURE; + mir_snprintf(reply->message, reply->cMessage, Translate(failureFalse)); + } + else{ + reply->code = MIMRES_SUCCESS; + mir_snprintf(reply->message, reply->cMessage, Translate(successFalse)); + } + } +} + +void HandlePopupsCommand(PCommand command, TArgument *argv, int argc, PReply reply) +{ + switch (argc) + { + case 2: + { + int state = CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0); + Set2StateReply(reply, state, 0, "Popups are currently enabled.", "", "Popups are currently disabled.", ""); + + break; + } + + case 3: + { + int failure; + int state = 0; + int error = 0; + + switch (Get2StateValue(argv[2])) + { + case STATE_ON: + { + failure = CallService(MS_POPUP_QUERY, PUQS_ENABLEPOPUPS, 0); + state = TRUE; + + break; + } + + case STATE_OFF: + { + failure = CallService(MS_POPUP_QUERY, PUQS_DISABLEPOPUPS, 0); + state = FALSE; + + break; + } + + case STATE_TOGGLE: + { + int state = CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0); + failure = CallService(MS_POPUP_QUERY, (state) ? PUQS_DISABLEPOPUPS : PUQS_ENABLEPOPUPS, 0); + state = 1 - state; + + break; + } + + default: + { + HandleUnknownParameter(command, argv[2], reply); + error = 1; + + break; + } + } + if (!error) + { + Set2StateReply(reply, state, failure, "Popups were enabled successfully.", "Popups could not be enabled.", "Popups were disabled successfully.", "Popups could not be disabled."); + } + + break; + } + + default: + { + HandleWrongParametersCount(command, reply); + + break; + } + + } +} + +void HandleSoundsCommand(PCommand command, TArgument *argv, int argc, PReply reply) +{ + switch (argc) + { + case 2: + { + int state = CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0); + Set2StateReply(reply, state, 0, "Sounds are currently enabled.", "", "Sounds are currently disabled.", ""); + + break; + } + + case 3: + { + int failure; + int state = 0; + int error = 0; + + switch (Get2StateValue(argv[2])) + { + case STATE_ON: + { + failure = 0; + DBWriteContactSettingByte(NULL, "Skin", "UseSound", 1); + state = TRUE; + + break; + } + + case STATE_OFF: + { + failure = 0; + DBWriteContactSettingByte(NULL, "Skin", "UseSound", 0); + state = FALSE; + + break; + } + + case STATE_TOGGLE: + { + state = DBGetContactSettingByte(NULL, "Skin", "UseSound", 1); + + failure = 0; + state = 1 - state; + DBWriteContactSettingByte(NULL, "Skin", "UseSound", state); + + break; + } + + default: + { + HandleUnknownParameter(command, argv[2], reply); + error = 1; + + break; + } + } + if (!error) + { + Set2StateReply(reply, state, failure, "Sounds were enabled successfully.", "Sounds could not be enabled.", "Sounds were disabled successfully.", "Sounds could not be disabled."); + } + + break; + } + + default: + { + HandleWrongParametersCount(command, reply); + + break; + } + } +} + +void HandleClistCommand(PCommand command, TArgument *argv, int argc, PReply reply) +{ + switch (argc) + { + case 2: + { + HWND hClist = (HWND) CallService(MS_CLUI_GETHWND, 0, 0); + int state = IsWindowVisible(hClist); + Set2StateReply(reply, state, 0, "Contact list is currectly shown.", "", "Contact list is currently hidden.", ""); + + break; + } + + case 3: + { + int failure; + int state = 0; + int error = 0; + HWND hClist = (HWND) CallService(MS_CLUI_GETHWND, 0, 0); + + switch (Get2StateValue(argv[2])) + { + case STATE_ON: + { + failure = 0; + ShowWindow(hClist, SW_SHOW); + + state = TRUE; + + break; + } + + case STATE_OFF: + { + failure = 0; + ShowWindow(hClist, SW_HIDE); + state = FALSE; + + break; + } + + case STATE_TOGGLE: + { + state = IsWindowVisible(hClist); + + failure = 0; + state = 1 - state; + ShowWindow(hClist, (state) ? SW_SHOW : SW_HIDE); + + break; + } + + default: + { + HandleUnknownParameter(command, argv[2], reply); + error = 1; + + break; + } + } + if (!error) + { + Set2StateReply(reply, state, failure, "Contact list was shown successfully.", "Contact list could not be shown.", "Contact list was hidden successfully.", "Contact list could not be hidden."); + } + + break; + } + + default: + { + HandleWrongParametersCount(command, reply); + + break; + } + } +} + +void HandleQuitCommand(PCommand command, TArgument *argv, int argc, PReply reply) +{ + switch (argc) + { + case 2: + { + CallService("CloseAction", 0, 0); + + //try another quit method + HWND hWndMiranda = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); + PostMessage(hWndMiranda, WM_COMMAND, ID_ICQ_EXIT, 0); + + reply->code = MIMRES_SUCCESS; + mir_snprintf(reply->message, reply->cMessage, "Issued a quit command."); + + break; + } + + case 3: + { + char lower[128]; + STRNCPY(lower, argv[2], sizeof(lower)); + _strlwr(lower); + + if (strcmp(lower, "wait") == 0) + { + CallService("CloseAction", 0, 0); + + //try another quit method + HWND hWndMiranda = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); + PostMessage(hWndMiranda, WM_COMMAND, ID_ICQ_EXIT, 0); + + reply->code = MIMRES_SUCCESS; + mir_snprintf(reply->message, reply->cMessage, "Issued a quit and wait command."); + + SetEvent(heServerBufferFull); + + bWaitForUnload = 1; + + while (bWaitForUnload) + { + Sleep(250); //wait for Miranda to quit. + } + } + else{ + HandleUnknownParameter(command, argv[2], reply); + } + + break; + } + + default: + { + HandleWrongParametersCount(command, reply); + + break; + } + } +} + +void HandleExchangeCommand(PCommand command, TArgument *argv, int argc, PReply reply) +{ + switch (argc) + { + case 3: + { + char lower[128]; + STRNCPY(lower, argv[2], sizeof(lower)); + _strlwr(lower); + if (strcmp(lower, "check") == 0) + { + if (ServiceExists(MS_EXCHANGE_CHECKEMAIL)) + { + CallService(MS_EXCHANGE_CHECKEMAIL, 0, 0); + + reply->code = MIMRES_SUCCESS; + mir_snprintf(reply->message, reply->cMessage, Translate("Issued check email command to Exchange plugin.")); + } + else{ + reply->code = MIMRES_FAILURE; + mir_snprintf(reply->message, reply->cMessage, Translate("Exchange plugin is not running.")); + } + } + else{ + HandleUnknownParameter(command, argv[2], reply); + } + + break; + } + + default: + { + HandleWrongParametersCount(command, reply); + + break; + } + + } +} + +void HandleYAMNCommand(PCommand command, TArgument *argv, int argc, PReply reply) +{ + switch (argc) + { + case 3: + { + char lower[128]; + STRNCPY(lower, argv[2], sizeof(lower)); + _strlwr(lower); + if (strcmp(lower, "check") == 0) + { + if (ServiceExists(MS_YAMN_FORCECHECK)) + { + CallService(MS_YAMN_FORCECHECK, 0, 0); + + reply->code = MIMRES_SUCCESS; + mir_snprintf(reply->message, reply->cMessage, Translate("Issued check email command to YAMN plugin.")); + } + else{ + reply->code = MIMRES_FAILURE; + mir_snprintf(reply->message, reply->cMessage, Translate("YAMN plugin is not running.")); + } + } + else{ + HandleUnknownParameter(command, argv[2], reply); + } + + break; + } + + default: + { + HandleWrongParametersCount(command, reply); + + break; + } + + } +} + +void HandleCallServiceCommand(PCommand command, TArgument *argv, int argc, PReply reply) +{ + switch (argc) + { + case 5: + { + char *service = argv[2]; + if (ServiceExists(service)) + { + void *wParam = NULL; + void *lParam = NULL; + INT_PTR res1 = ParseValueParam(argv[3], wParam); + INT_PTR res2 = ParseValueParam(argv[4], lParam); + if ((res1 != 0) && (res2 != 0)) + { + //very dangerous but the user asked + INT_PTR res = CallService(service, ((res1 == 1) ? *((long *) wParam) : (WPARAM) wParam), (LPARAM) ((res2 == 1) ? *((long *) lParam) : (LPARAM) lParam)); + + reply->code = MIMRES_SUCCESS; + mir_snprintf(reply->message, reply->cMessage, Translate("CallService call successful: service '%s' returned %p."), service, res); + } + else{ + reply->code = MIMRES_FAILURE; + mir_snprintf(reply->message, reply->cMessage, Translate("Invalid parameter '%s' passed to CallService command."), (wParam) ? argv[4] : argv[3]); + } + + if (wParam) { free(wParam); } + if (lParam) { free(lParam); } + + } + else{ + reply->code = MIMRES_FAILURE; + mir_snprintf(reply->message, reply->cMessage, Translate("Service '%s' does not exist."), service); + } + + break; + } + + default: + { + HandleWrongParametersCount(command, reply); + } + } +} + + +HANDLE ParseContactParam(char *contact) +{ + char name[512]; + char account[128]; + char protocol[128]; + char *p = strrchr(contact, ':'); + HANDLE hContact = NULL; + if (p) + { + *p = 0; + STRNCPY(name, contact, p - contact + 1); + STRNCPY(account, p + 1, sizeof(account)); + *p = ':'; + AccountName2Protocol(account, protocol, sizeof(protocol)); + + hContact = GetContactFromID(name, protocol); + + } + else{ + hContact = GetContactFromID(contact, (char *) NULL); + } + + return hContact; +} + +void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply reply) +{ + if (argc >= 4) + { + char *message = argv[argc - 1]; //get the message + int i; + char *contact; + char buffer[1024]; + HANDLE hContact; + HANDLE hProcess = NULL; + ACKDATA *ack = NULL; + for (i = 2; i < argc - 1; i++) + { + contact = argv[i]; + hContact = ParseContactParam(contact); + + if (hContact) + { + bShouldProcessAcks = TRUE; + hProcess = (HANDLE) CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM) message); + const int MAX_COUNT = 60; + int counter = 0; + while (((ack = GetAck(hProcess)) == NULL) && (counter < MAX_COUNT)) + { + SleepEx(250, TRUE); + counter++; + } + bShouldProcessAcks = FALSE; + + if (counter < MAX_COUNT) + { + if (ack->result == ACKRESULT_SUCCESS) + { + if (ack->szModule) + { + mir_snprintf(buffer, sizeof(buffer), Translate("Message sent to '%s'."), contact); + + DBEVENTINFO e = {0}; + char module[128]; + e.cbSize = sizeof(DBEVENTINFO); + e.eventType = EVENTTYPE_MESSAGE; + e.flags = DBEF_SENT; + + e.pBlob = (PBYTE) message; + e.cbBlob = (DWORD) strlen((char *) message) + 1; + + STRNCPY(module, ack->szModule, sizeof(module)); + e.szModule = module; + e.timestamp = (DWORD) time(NULL); + + CallService(MS_DB_EVENT_ADD, (WPARAM) ack->hContact, (LPARAM) &e); + } + else{ + mir_snprintf(buffer, sizeof(buffer), Translate("Message to '%s' was marked as sent but the account seems to be offline"), contact); + } + } + else{ + mir_snprintf(buffer, sizeof(buffer), Translate("Could not send message to '%s'."), contact); + } + } + else{ + mir_snprintf(buffer, sizeof(buffer), Translate("Timed out while waiting for acknowledgement for contact '%s'."), contact); + } + } + else{ + mir_snprintf(buffer, sizeof(buffer), Translate("Could not find contact handle for contact '%s'."), contact); + } + + if (i == 3) + { + STRNCPY(reply->message, buffer, reply->cMessage); + } + else{ + strncat(reply->message, "\n", reply->cMessage); + strncat(reply->message, buffer, reply->cMessage); + } + } + } + else{ + HandleWrongParametersCount(command, reply); + } +} + +int ParseDatabaseData(DBVARIANT *var, char *buffer, int size, int free) +{ + int ok = 1; + switch (var->type) + { + case DBVT_BYTE: + { + mir_snprintf(buffer, size, "byte:%d", var->bVal); + + break; + } + + case DBVT_WORD: + { + mir_snprintf(buffer, size, "word:%d", var->wVal); + + break; + } + + case DBVT_DWORD: + { + mir_snprintf(buffer, size, "dword:%ld", var->dVal); + + break; + } + + case DBVT_ASCIIZ: + { + mir_snprintf(buffer, size, "string:'%s'", var->pszVal); + if (free) { mir_free(var->pszVal); } + + break; + } + + case DBVT_WCHAR: + { + mir_snprintf(buffer, size, "wide string:'%S'", var->pwszVal); + if (free) { mir_free(var->pwszVal); } + + break; + } + + case DBVT_UTF8: + { + mir_snprintf(buffer, size, "utf8:'%s'", var->pszVal); + if (free) { mir_free(var->pszVal); } + } + + case DBVT_BLOB: + { + mir_snprintf(buffer, size, "blob:N/A"); + if (free) { mir_free(var->pbVal); } + + break; + } + + + default: + { + ok = 0; + mir_snprintf(buffer, size, "unknown value"); + + break; + } + } + + return ok; +} + +void HandleDatabaseCommand(PCommand command, TArgument *argv, int argc, PReply reply) +{ + if (argc >= 3) //we have something to parse + { + char dbcmd[128]; + STRNCPY(dbcmd, argv[2], sizeof(dbcmd)); + dbcmd[sizeof(dbcmd) - 1] = 0; + _strlwr(dbcmd); + if (strcmp(dbcmd, "delete") == 0) + { + if (argc == 5) + { + char *module = argv[3]; + char *key = argv[4]; + + DBDeleteContactSetting(NULL, module, key); + + reply->code = MIMRES_SUCCESS; + mir_snprintf(reply->message, reply->cMessage, Translate("Setting '%s/%s' deleted."), module, key); + } + else{ + HandleWrongParametersCount(command, reply); + } + } + else{ + if (strcmp(dbcmd, "set") == 0) + { + if (argc == 6) + { + char *module = argv[3]; + char *key = argv[4]; + + int ok = 1; + + void *value = NULL; + char *wrote = NULL; + int type = ParseValueParam(argv[5], value); + + + switch (type) + { + case VALUE_STRING: + { + DBWriteContactSettingString(NULL, module, key, (char *) value); + wrote = "string"; + + break; + } + + case VALUE_BYTE: + { + DBWriteContactSettingByte(NULL, module, key, (* (char *) value)); + wrote = "byte"; + + break; + } + + case VALUE_WORD: + { + DBWriteContactSettingWord(NULL, module, key, (* (WORD *) value)); + wrote = "word"; + + break; + } + + case VALUE_DWORD: + { + DBWriteContactSettingDword(NULL, module, key, (* (DWORD *) value)); + wrote = "dword"; + + break; + } + + case VALUE_WIDE: + { + DBWriteContactSettingWString(NULL, module, key, (WCHAR *) value); + wrote = "wide string"; + + break; + } + + default: + { + HandleUnknownParameter(command, argv[5], reply); + ok = 0; + + break; + } + } + + if (ok) + { + reply->code = MIMRES_SUCCESS; + mir_snprintf(reply->message, reply->cMessage, Translate("Wrote '%s:%s' to database entry '%s/%s'."), wrote, argv[5] + 1, module, key); + } + + if (value) + { + free(value); + } + } + else{ + HandleWrongParametersCount(command, reply); + } + } + else{ + if (strcmp(dbcmd, "get") == 0) + { + if (argc == 5) + { + char *module = argv[3]; + char *key = argv[4]; + + DBVARIANT var = {0}; + + int res = DBGetContactSetting(NULL, module, key, &var); + if (!res) + { + char buffer[1024]; + + if (ParseDatabaseData(&var, buffer, sizeof(buffer), TRUE)) + { + reply->code = MIMRES_SUCCESS; + mir_snprintf(reply->message, reply->cMessage, Translate("'%s/%s' - %s."), module, key, buffer); + } + else{ + reply->code = MIMRES_FAILURE; + mir_snprintf(reply->message, reply->cMessage, Translate("Could not retrieve setting '%s/%s': %s."), module, key, buffer); + } + } + else{ + reply->code = MIMRES_FAILURE; + mir_snprintf(reply->message, reply->cMessage, Translate("Setting '%s/%s' was not found."), module, key); + } + + } + else{ + HandleWrongParametersCount(command, reply); + } + } + else{ + HandleUnknownParameter(command, dbcmd, reply); + } + } + + } + + } + else{ + HandleWrongParametersCount(command, reply); + } +} + +int ParseProxyType(char *type) +{ + char lower[128]; + STRNCPY(lower, type, sizeof(lower)); + lower[sizeof(lower) - 1] = 0; + _strlwr(lower); + int proxy = 0; + + if (strcmp(lower, "socks4") == 0) + { + proxy = PROXY_SOCKS4; + } + else{ + if (strcmp(lower, "socks5") == 0) + { + proxy = PROXY_SOCKS5; + } + else{ + if (strcmp(lower, "http") == 0) + { + proxy = PROXY_HTTP; + } + else{ + if (strcmp(lower, "https") == 0) + { + proxy = PROXY_HTTPS; + } + } + } + } + + return proxy; +} + +char *PrettyProxyType(int type, char *buffer, int size) +{ + char *pretty = ""; + switch (type) + { + case PROXY_SOCKS4: + { + pretty = "SOCKS4"; + + break; + } + + case PROXY_SOCKS5: + { + pretty = "SOCKS5"; + + break; + } + + case PROXY_HTTP: + { + pretty = "HTTP"; + + break; + } + + case PROXY_HTTPS: + { + pretty = "HTTPS"; + + break; + } + + default: + { + pretty = "Unknown"; + + break; + } + } + + STRNCPY(buffer, pretty, size); + + return buffer; +} + +void HandleProtocolProxyCommand(PCommand command, TArgument *argv, int argc, PReply reply, char *module, char *protocol) +{ + char proxycmd[128]; + STRNCPY(proxycmd, argv[3], sizeof(proxycmd)); + proxycmd[sizeof(proxycmd) - 1] = 0; + _strlwr(proxycmd); + + char buffer[1024]; + int ok = 1; + + + if (strcmp(proxycmd, "status") == 0) + {//status command + switch (argc) + { + case 4: + { + int value = DBGetContactSettingByte(NULL, module, "NLUseProxy", 0); + + reply->code = MIMRES_SUCCESS; + mir_snprintf(buffer, sizeof(buffer), "%s proxy status is %s", protocol, (value) ? "enabled" : "disabled"); + + break; + } + + case 5: + { + int state = Get2StateValue(argv[4]); + switch (state) + { + case STATE_OFF: + { + DBWriteContactSettingByte(NULL, module, "NLUseProxy", 0); + + reply->code = MIMRES_SUCCESS; + mir_snprintf(buffer, sizeof(buffer), Translate("'%s' proxy was disabled."), protocol); + + break; + } + + case STATE_ON: + { + DBWriteContactSettingByte(NULL, module, "NLUseProxy", 1); + + reply->code = MIMRES_SUCCESS; + mir_snprintf(buffer, sizeof(buffer), Translate("'%s' proxy was enabled."), protocol); + + break; + } + + case STATE_TOGGLE: + { + int value = DBGetContactSettingByte(NULL, module, "NLUseProxy", 0); + value = 1 - value; + DBWriteContactSettingByte(NULL, module, "NLUseProxy", value); + + reply->code = MIMRES_SUCCESS; + mir_snprintf(buffer, sizeof(buffer), (value) ? Translate("'%s' proxy was enabled.") : Translate("'%s' proxy was disabled.")); + + break; + } + + default: + { + HandleUnknownParameter(command, argv[4], reply); + + break; + } + } + + break; + } + + default: + { + HandleWrongParametersCount(command, reply); + ok = 0; + + break; + } + } + } + else{ + if (strcmp(proxycmd, "server") == 0) + { + switch (argc) + { + case 4: + { + char host[256]; + int port; + char type[256]; + GetStringFromDatabase(NULL, module, "NLProxyServer", "", host, sizeof(host)); + port = DBGetContactSettingWord(NULL, module, "NLProxyPort", 0); + PrettyProxyType(DBGetContactSettingByte(NULL, module, "NLProxyType", 0), type, sizeof(type)); + + reply->code = MIMRES_SUCCESS; + mir_snprintf(buffer, sizeof(buffer), Translate("%s proxy server: %s %s:%d."), protocol, type, host, port); + + break; + } + + case 7: + { + int type = ParseProxyType(argv[4]); + char *host = argv[5]; + long port; + char *stop = NULL; + port = strtol(argv[6], &stop, 10); + + if ((*stop == 0) && (type > 0)) + { + DBWriteContactSettingString(NULL, module, "NLProxyServer", host); + DBWriteContactSettingWord(NULL, module, "NLProxyPort", port); + DBWriteContactSettingByte(NULL, module, "NLProxyType", type); + + reply->code = MIMRES_SUCCESS; + mir_snprintf(buffer, sizeof(buffer), Translate("%s proxy set to %s %s:%d."), protocol, argv[4], host, port); + } + else { + reply->code = MIMRES_FAILURE; + mir_snprintf(buffer, sizeof(buffer), Translate("%s The port or the proxy type parameter is invalid."), protocol); + } + + break; + } + + default: + { + HandleWrongParametersCount(command, reply); + ok = 0; + + break; + } + } + } + else{ + ok = 0; + HandleUnknownParameter(command, proxycmd, reply); + } + } + + + if (ok) + { + if (strlen(reply->message) > 0) + { + strncat(reply->message, "\n", reply->cMessage); + strncat(reply->message, buffer, reply->cMessage); + reply->message[reply->cMessage - 1] = 0; + } + else{ + mir_snprintf(reply->message, reply->cMessage, buffer); + } + } +} + +void HandleProxyCommand(PCommand command, TArgument *argv, int argc, PReply reply) +{ + if (argc >= 4) + { + char account[128]; + char protocol[128]; + STRNCPY(account, argv[2], sizeof(account)); + account[sizeof(account) - 1] = 0; + + AccountName2Protocol(account, protocol, sizeof(protocol)); + + int count = 0; + PROTOACCOUNT **accounts = NULL; + ProtoEnumAccounts(&count, &accounts); + + int i; + int global = (strcmp(protocol, "GLOBAL") == 0); + + reply->message[0] = 0; + + int found = 0; + if (global) + { + HandleProtocolProxyCommand(command, argv, argc, reply, "Netlib", protocol); + found = 1; + } + + char *match; + + for (i = 0; i < count; i++) + { + if (accounts[i]->bIsEnabled) + { + match = accounts[i]->szModuleName; + if ((global) || (strcmp(protocol, match) == 0)) + { + HandleProtocolProxyCommand(command, argv, argc, reply, match, match); + found = 1; + } + } + } + + if (!found) + { + reply->code = MIMRES_FAILURE; + mir_snprintf(reply->message, reply->cMessage, Translate("'%s' doesn't seem to be a valid account."), account); + } + } + else{ + HandleWrongParametersCount(command, reply); + } +} + +int ContactMatchSearch(HANDLE hContact, char *contact, char *id, char *account, TArgument *argv, int argc) +{ + int matches = 1; + int i; + + char lwrName[2048] = "\0"; + char lwrAccount[128] = "\0"; + char lwrKeyword[512] = "\0"; + char lwrID[512] = "\0"; + char *pos; + + STRNCPY(lwrName, contact, sizeof(lwrName)); + STRNCPY(lwrAccount, account, sizeof(lwrAccount)); + + if (id) { STRNCPY(lwrID, id, sizeof(lwrID)); } + + _strlwr(lwrName); + _strlwr(lwrAccount); + _strlwr(lwrID); + + for (i = 0; i < argc; i++) + { + STRNCPY(lwrKeyword, argv[i], sizeof(lwrKeyword)); + _strlwr(lwrKeyword); + + pos = strstr(lwrKeyword, "account:"); + if (pos) + { + pos += 8; + if (strstr(lwrAccount, pos) == NULL) + { + matches = 0; + + break; + } + } + else{ + pos = strstr(lwrKeyword, "status:"); + if (pos) + { + int searchStatus = ParseStatusParam(pos + 7); + char protocol[128]; + + AccountName2Protocol(account, protocol, sizeof(protocol)); + WORD contactStatus = DBGetContactSettingWord(hContact, protocol, "Status", ID_STATUS_ONLINE); + + if (searchStatus != contactStatus) + { + matches = 0; + + break; + } + } + else{ + pos = strstr(lwrKeyword, "id:"); + if (pos) + { + pos += 3; + if (strstr(lwrID, pos) == NULL) + { + matches = 0; + + break; + } + } + else{ + if ((strstr(lwrName, lwrKeyword) == NULL)) + { + matches = 0; + + break; + } + } + } + } + } + + return matches; +} + +DWORD WINAPI OpenMessageWindowThread(void *data) +{ + HANDLE hContact = (HANDLE) data; + if (hContact) + { + CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM) hContact, 0); + CallServiceSync("SRMsg/LaunchMessageWindow", (WPARAM) hContact, 0); + } + + return 0; +} + + +void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply reply) +{ + if (argc >= 3) + { + if (_stricmp(argv[2], "list") == 0) + { + HANDLE hContact = NULL; + char buffer[1024]; + char protocol[128]; + + hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); + int count = 0; + + reply->code = MIMRES_SUCCESS; + while (hContact) + { + + GetContactProtocol(hContact, protocol, sizeof(protocol)); + + char *contact = GetContactName(hContact, protocol); + char *id = GetContactID(hContact, protocol); + if (ContactMatchSearch(hContact, contact, id, protocol, &argv[3], argc - 3)) + { + mir_snprintf(buffer, sizeof(buffer), "%s:[%s]:%s (%08d)", contact, id, protocol, hContact); + if (count) + { + strncat(reply->message, "\n", reply->cMessage); + strncat(reply->message, buffer, reply->cMessage); + } + else{ + STRNCPY(reply->message, buffer, reply->cMessage); + } + + if (strlen(reply->message) > 4096) + { + SetEvent(heServerBufferFull); + Sleep(750); //wait a few milliseconds for the event to be processed + count = 0; + *reply->message = 0; + } + + count++; + } + + free(contact); + free(id); + + hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); + } + } + else{ + if (_stricmp(argv[2], "open") == 0) + { + if (argc > 3) + { + HANDLE hContact = NULL; + char protocol[128]; + hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); + + reply->code = MIMRES_SUCCESS; + *reply->message = 0; + while (hContact) + { + GetContactProtocol(hContact, protocol, sizeof(protocol)); + + char *contact = GetContactName(hContact, protocol); + char *id = GetContactID(hContact, protocol); + if (ContactMatchSearch(hContact, contact, id, protocol, &argv[3], argc - 3)) + { + DWORD threadID; + HANDLE thread = CreateThread(NULL, NULL, OpenMessageWindowThread, hContact, NULL, &threadID); + } + + free(contact); + free(id); + + hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); + } + } + else{ + if (argc == 3) + { + HANDLE hContact = NULL; + hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); + + reply->code = MIMRES_SUCCESS; + *reply->message = 0; + + while (hContact) + { + HANDLE hUnreadEvent = (HANDLE) CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM) hContact, 0); + if (hUnreadEvent != NULL) + { + DWORD threadID; + HANDLE thread = CreateThread(NULL, NULL, OpenMessageWindowThread, hContact, NULL, &threadID); + } + + hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); + } + } + else { + HandleWrongParametersCount(command, reply); + } + } + } + else{ + HandleUnknownParameter(command, argv[2], reply); + } + } + } + else{ + HandleWrongParametersCount(command, reply); + } +} + +void AddHistoryEvent(DBEVENTINFO *dbEvent, char *contact, PReply reply) +{ + struct tm * tEvent = localtime((time_t *) &dbEvent->timestamp); + char timestamp[256]; + + strftime(timestamp, sizeof(timestamp), "%H:%M:%S %d/%b/%Y", tEvent); + + static char buffer[6144]; + char *sender = (dbEvent->flags & DBEF_SENT) ? Translate("[me]") : contact; + + char message[4096] = {0}; + STRNCPY(message, (char *) dbEvent->pBlob, sizeof(message)); + message[dbEvent->cbBlob] = message[strlen(message)] = 0; + + //if ((strlen(message) <= 0) && (dbEvent->cbBlob > 0)) + //{ + // WCHAR *tmp = (WCHAR *) dbEvent->pBlob[dbEvent->cbBlob + 1]; + // WideCharToMultiByte(CP_ACP, 0, tmp, -1, message, sizeof(message), NULL, NULL); + //} + + mir_snprintf(buffer, sizeof(buffer), "[%s] %15s: %s", timestamp, sender, message); + + + if (strlen(reply->message) > 0) + { + strncat(reply->message, "\n", reply->cMessage); + strncat(reply->message, buffer, reply->cMessage); + } + else{ + STRNCPY(reply->message, buffer, reply->cMessage); + } + + if (strlen(reply->message) > (reply->cMessage / 2)) + { + SetEvent(heServerBufferFull); + + Sleep(750); + strcpy(reply->message, "\n"); + } +} + +void HandleHistoryCommand(PCommand command, TArgument *argv, int argc, PReply reply) +{ + if (argc >= 3) + { + char *cmd = argv[2]; + switch (argc) + { + case 3: + { + if (_stricmp(cmd, "unread") == 0) + { + HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); + char buffer[4096]; + int count; + int contacts = 0; + DBEVENTINFO dbEvent = {0}; + dbEvent.cbSize = sizeof(DBEVENTINFO); + + reply->code = MIMRES_SUCCESS; + mir_snprintf(reply->message, reply->cMessage, Translate("No unread messages found.")); + + while (hContact) + { + HANDLE hEvent = (HANDLE) CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM) hContact, 0); + if (hEvent != NULL) + { + char *contact; + char protocol[128]; + + count = 0; + while (hEvent != NULL) + { + if (!CallService(MS_DB_EVENT_GET, (WPARAM) hEvent, (LPARAM) &dbEvent)) + { + if (!(dbEvent.flags & DBEF_READ)) + { + count++; + } + } + + hEvent = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, (WPARAM) hEvent, 0); + } + + GetContactProtocol(hContact, protocol, sizeof(protocol)); + contact = GetContactName(hContact, protocol); + mir_snprintf(buffer, sizeof(buffer), Translate("%s:%s - %d unread events."), contact, protocol, count); + + if (contacts > 0) + { + strncat(reply->message, "\n", reply->cMessage); + strncat(reply->message, buffer, reply->cMessage); + } + else{ + STRNCPY(reply->message, buffer, reply->cMessage); + } + contacts++; + + free(contact); + } + + hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); + } + } + else{ + if (_stricmp(cmd, "show") == 0) + { + HandleWrongParametersCount(command, reply); + } + else{ + HandleUnknownParameter(command, cmd, reply); + } + } + + break; + } + + case 4: + { + char *contact = argv[3]; + HANDLE hContact = ParseContactParam(contact); + if (hContact) + { + if (_stricmp(cmd, "unread") == 0) + { + HANDLE hEvent = (HANDLE) CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM) hContact, 0); + DBEVENTINFO dbEvent = {0}; + dbEvent.cbSize = sizeof(DBEVENTINFO); + + char *message[4096]; + dbEvent.pBlob = (PBYTE) message; + + reply->code = MIMRES_SUCCESS; + + while (hEvent) + { + dbEvent.cbBlob = sizeof(message); + if (!CallService(MS_DB_EVENT_GET, (WPARAM) hEvent, (LPARAM) &dbEvent)) //if successful call + { + if (!(dbEvent.flags & DBEF_READ)) + { + AddHistoryEvent(&dbEvent, contact, reply); + } + } + + hEvent = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, (WPARAM) hEvent, 0); + } + } + else{ + if (_stricmp(cmd, "show") == 0) + { + int count = CallService(MS_DB_EVENT_GETCOUNT, (WPARAM) hContact, 0); + + reply->code = MIMRES_SUCCESS; + mir_snprintf(reply->message, reply->cMessage, Translate("Contact '%s' has '%d' events in history."), contact, count); + } + else{ + HandleUnknownParameter(command, cmd, reply); + } + } + } + else{ + reply->code = MIMRES_FAILURE; + mir_snprintf(reply->message, reply->cMessage, Translate("Could not find contact handle for contact '%s'."), contact); + } + + break; + } + + case 6: + { + char *contact = argv[3]; + HANDLE hContact = ParseContactParam(contact); + + if (hContact) + { + if (_stricmp(cmd, "show") == 0) + { + char *stop1 = NULL; + char *stop2 = NULL; + long start = strtol(argv[4], &stop1, 10); + long stop = strtol(argv[5], &stop2, 10); + if (!(*stop1) && !(*stop2)) + { + int size = CallService(MS_DB_EVENT_GETCOUNT, (WPARAM) hContact, 0); + if (start < 0) { start = size + start + 1; } + if (stop < 0) { stop = size + stop + 1; } + + reply->code = MIMRES_SUCCESS; + + int count = stop - start + 1; + if (count > 0) + { + int index = 0; + HANDLE hEvent = (HANDLE) CallService(MS_DB_EVENT_FINDFIRST, (WPARAM) hContact, 0); + DBEVENTINFO dbEvent = {0}; + dbEvent.cbSize = sizeof(DBEVENTINFO); + char message[4096]; + dbEvent.pBlob = (PBYTE) message; + + while (hEvent) + { + dbEvent.cbBlob = sizeof(message); + if (!CallService(MS_DB_EVENT_GET, (WPARAM) hEvent, (LPARAM) &dbEvent)) // if successful call + { + dbEvent.pBlob[dbEvent.cbBlob] = 0; + if ((index >= start) && (index <= stop)) + { + AddHistoryEvent(&dbEvent, contact, reply); + } + } + + if (index > stop) + { + break; + } + + hEvent = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, (WPARAM) hEvent, 0); + index++; + } + } + } + else{ + HandleUnknownParameter(command, (*stop1) ? argv[4] : argv[5], reply); + } + } + else{ + if (_stricmp(cmd, "unread") == 0) + { + HandleWrongParametersCount(command, reply); + } + else{ + HandleUnknownParameter(command, cmd, reply); + } + } + } + else{ + reply->code = MIMRES_FAILURE; + mir_snprintf(reply->message, reply->cMessage, Translate("Could not find contact handle for contact '%s'."), contact); + } + + break; + } + + default: + { + HandleWrongParametersCount(command, reply); + + break; + } + } + } + else{ + HandleWrongParametersCount(command, reply); + } +} + +void HandleVersionCommand(PCommand command, TArgument *argv, int argc, PReply reply) +{ + if (argc == 2) + { + reply->code = MIMRES_SUCCESS; + if (ServiceExists(MS_VERSIONINFO_GETINFO)) + { + char *data; + CallService(MS_VERSIONINFO_GETINFO, (WPARAM) FALSE, (LPARAM) &data); + mir_snprintf(reply->message, reply->cMessage, data); + mir_free(data); + } + else{ + char miranda[512]; + char cmdline[512]; + DWORD v = pluginInfo.version; + CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM) sizeof(miranda), (LPARAM) miranda); + mir_snprintf(cmdline, sizeof(cmdline), "%d.%d.%d.%d", ((v >> 24) & 0xFF), ((v >> 16) & 0xFF), ((v >> 8) & 0xFF), (v & 0xFF)); + mir_snprintf(reply->message, reply->cMessage, "Miranda %s\nCmdLine v.%s", miranda, cmdline); + } + } + else{ + HandleWrongParametersCount(command, reply); + } +} +void HandleSetNicknameCommand(PCommand command, TArgument *argv, int argc, PReply reply) +{ + if (argc == 4) + { + char protocol[512]; + char nickname[512]; + strcpy(protocol, argv[2]); + strcpy(nickname, argv[3]); + + int res = CallProtoService(protocol, PS_SETMYNICKNAME, SMNN_TCHAR, (LPARAM) nickname); + + if (res == 0) + { + reply->code = MIMRES_SUCCESS; + *reply->message = 0; + } + else { + reply->code = MIMRES_FAILURE; + mir_snprintf(reply->message, reply->cMessage, Translate("Error setting nickname to '%s' for protocol '%s'"), nickname, protocol); + } + } + else { + HandleWrongParametersCount(command, reply); + } +} + +void HandleIgnoreCommand(PCommand command, TArgument *argv, int argc, PReply reply) +{ + if (argc >= 4) + { + BOOL block = FALSE; + BOOL goodCommand = FALSE; + if (_stricmp(argv[2], "block") == 0) + { + block = TRUE; + goodCommand = TRUE; + } + + if (_stricmp(argv[2], "unblock") == 0) + { + block = FALSE; + goodCommand = TRUE; + } + + if (!goodCommand) + { + HandleUnknownParameter(command, argv[2], reply); + + return; + } + + HANDLE hContact = NULL; + char *contact; + + for (int i = 3; i < argc; i++) + { + contact = argv[i]; + hContact = ParseContactParam(contact); + + if (hContact) + { + CallService(block ? MS_IGNORE_IGNORE : MS_IGNORE_UNIGNORE, (WPARAM) hContact, IGNOREEVENT_ALL); + } + } + + reply->code = MIMRES_SUCCESS; + *reply->message = 0; + } + else { + HandleWrongParametersCount(command, reply); + } +} \ No newline at end of file diff --git a/plugins/CmdLine/src/mimcmd_handlers.h b/plugins/CmdLine/src/mimcmd_handlers.h new file mode 100644 index 0000000000..565c7e3ec5 --- /dev/null +++ b/plugins/CmdLine/src/mimcmd_handlers.h @@ -0,0 +1,55 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 M_MIMCMD_HANDLERS_H +#define M_MIMCMD_HANDLERS_H + +#include "mimcmd_data.h" + +//aditional services +#define MS_EXCHANGE_CHECKEMAIL "Exchange/CheckEmail" +#define MS_YAMN_FORCECHECK "YAMN/Service/ForceCheck" + +extern PCommand GetCommand(char *command); + +extern HANDLE heServerBufferFull; +extern PLUGININFOEX pluginInfo; + +void HandleCommand(PCommand command, TArgument *argv, int argc, PReply reply); + +void HandleStatusCommand(PCommand command, TArgument *argv, int argc, PReply reply); +void HandleAwayMsgCommand(PCommand command, TArgument *argv, int argc, PReply reply); +void HandlePopupsCommand(PCommand command, TArgument *argv, int argc, PReply reply); +void HandleSoundsCommand(PCommand command, TArgument *argv, int argc, PReply reply); +void HandleClistCommand(PCommand command, TArgument *argv, int argc, PReply reply); +void HandleQuitCommand(PCommand command, TArgument *argv, int argc, PReply reply); +void HandleExchangeCommand(PCommand command, TArgument *argv, int argc, PReply reply); +void HandleYAMNCommand(PCommand command, TArgument *argv, int argc, PReply reply); +void HandleCallServiceCommand(PCommand command, TArgument *argv, int argc, PReply reply); +void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply reply); +void HandleDatabaseCommand(PCommand command, TArgument *argv, int argc, PReply reply); +void HandleProxyCommand(PCommand command, TArgument *argv, int argc, PReply reply); +void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply reply); +void HandleHistoryCommand(PCommand command, TArgument *argv, int argc, PReply reply); +void HandleVersionCommand(PCommand command, TArgument *argv, int argc, PReply reply); +void HandleSetNicknameCommand(PCommand command, TArgument *argv, int argc, PReply reply); +void HandleIgnoreCommand(PCommand command, TArgument *argv, int argc, PReply reply); + +#endif //M_MIMCMD_HANDLERS_H \ No newline at end of file diff --git a/plugins/CmdLine/src/mimcmd_ipc.cpp b/plugins/CmdLine/src/mimcmd_ipc.cpp new file mode 100644 index 0000000000..d16de2e7a8 --- /dev/null +++ b/plugins/CmdLine/src/mimcmd_ipc.cpp @@ -0,0 +1,105 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 "commonheaders.h" + +HANDLE hsmCmdLine = NULL; +HANDLE hmClient = NULL; +HANDLE heServerExec = NULL; +HANDLE heServerDone = NULL; +HANDLE heServerClose = NULL; +HANDLE heServerBufferFull = NULL; + +PSharedData sdCmdLine = NULL; + + +int InitClient() +{ + int res = (CreateSystemEvents() || CreateMutexes() || CreateSharedMem()); + + return res; +} + +int InitServer() +{ + int res = (CreateSystemEvents() || CreateSharedMem()); + + return res; +} + +int DestroyClient() +{ + int res = (DestroySystemEvents() || DestroyMutexes() || DestroySharedMem()); + + return res; +} + +int DestroyServer() +{ + int res = (DestroySystemEvents() || DestroySharedMem()); + + return res; +} + +int CreateSystemEvents() +{ + heServerExec = CreateEvent(NULL, FALSE, FALSE, EVENT_SERVER_EXEC); + heServerDone = CreateEvent(NULL, FALSE, FALSE, EVENT_SERVER_DONE); + heServerClose = CreateEvent(NULL, FALSE, FALSE, EVENT_SERVER_CLOSE); + heServerBufferFull = CreateEvent(NULL, FALSE, FALSE, EVENT_SERVER_BUFFERFULL); + + return ((heServerExec == NULL) || (heServerDone == NULL) || (heServerClose == NULL) || (heServerBufferFull == NULL)); +} + +int CreateMutexes() +{ + hmClient = CreateMutex(NULL, FALSE, MUTEX_CLIENT_NAME); + + return (hmClient == NULL); +} + +int CreateSharedMem() +{ + hsmCmdLine = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(TSharedData), SHAREDMEM_NAME); + sdCmdLine = (PSharedData) MapViewOfFile(hsmCmdLine, FILE_MAP_WRITE, 0, 0, sizeof(TSharedData)); + + return ((hsmCmdLine == NULL) || (sdCmdLine == NULL)); +} + +int DestroySystemEvents() +{ + int res = (!CloseHandle(heServerExec)) || (!CloseHandle(heServerDone)) || (!CloseHandle(heServerClose) || (!CloseHandle(heServerBufferFull))); + + return res; +} + +int DestroyMutexes() +{ + int res = !CloseHandle(hmClient); + + return res; +} + +int DestroySharedMem() +{ + int res = (!UnmapViewOfFile(sdCmdLine)) || (!CloseHandle(hsmCmdLine)); + + return res; +} \ No newline at end of file diff --git a/plugins/CmdLine/src/mimcmd_ipc.h b/plugins/CmdLine/src/mimcmd_ipc.h new file mode 100644 index 0000000000..d12a4a993f --- /dev/null +++ b/plugins/CmdLine/src/mimcmd_ipc.h @@ -0,0 +1,56 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 M_MIMCMD_IPC_H +#define M_MIMCMD_IPC_H + +#include "mimcmd_data.h" + +#define SHAREDMEM_NAME "MirandaCmdLine|SharedMem" +#define MUTEX_CLIENT_NAME "MirandaCmdLine|Mutex|Client" +#define EVENT_SERVER_EXEC "MirandaCmdLine|Event|Exec" +#define EVENT_SERVER_DONE "MirandaCmdLine|Event|Done" +#define EVENT_SERVER_CLOSE "MirandaCmdLine|Event|Close" +#define EVENT_SERVER_BUFFERFULL "MirandaCmdLine|Buffer|Full" + +extern HANDLE hsmCmdLine; +extern HANDLE hmClient; +extern HANDLE heServerExec; +extern HANDLE heServerDone; +extern HANDLE heServerClose; +extern HANDLE heServerBufferFull; + +extern PSharedData sdCmdLine; + +int InitClient(); +int InitServer(); + +int DestroyClient(); +int DestroyServer(); + +int CreateSystemEvents(); +int CreateMutexes(); +int CreateSharedMem(); + +int DestroySystemEvents(); +int DestroyMutexes(); +int DestroySharedMem(); + +#endif \ No newline at end of file diff --git a/plugins/CmdLine/src/resource.h b/plugins/CmdLine/src/resource.h new file mode 100644 index 0000000000..0268ce4765 --- /dev/null +++ b/plugins/CmdLine/src/resource.h @@ -0,0 +1,15 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by CmdLine.rc +// + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/plugins/CmdLine/src/services.cpp b/plugins/CmdLine/src/services.cpp new file mode 100644 index 0000000000..9e006a0046 --- /dev/null +++ b/plugins/CmdLine/src/services.cpp @@ -0,0 +1,106 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 "commonheaders.h" + +int bWaitForUnload = 0; + +int InitServices() +{ + return 0; +} + +int DestroyServices() +{ + return 0; +} + +extern "C" __declspec(dllexport) void ProcessConsoleCommand(PCommand command, TArgument *arguments, int count, PReply reply) +{ + HandleCommand(command, arguments, count, reply); +} + +DWORD WINAPI ServerWorkerThread(void *data) +{ + int done = FALSE; + const HANDLE events[] = {heServerExec, heServerClose}; + const int cEvents = sizeof(events) / sizeof(events[0]); + + while (!done) + { + switch (WaitForMultipleObjects(cEvents, events, FALSE, INFINITE)) + { + case WAIT_OBJECT_0: //need to process something + { + ProcessConsoleCommand(&sdCmdLine->command, sdCmdLine->arguments, sdCmdLine->cArguments, &sdCmdLine->reply); + SetEvent(heServerDone); //notify the client we've finished + + break; + } + + case WAIT_OBJECT_0 + 1: //server is closing + { + done = TRUE; //stop the thread + + break; + } + } + } + + return 0; +} + +int StartServer() +{ + int failure = 1; + if (sdCmdLine) + { + if (sdCmdLine->instances == 0) + { + DWORD threadID; + HANDLE server = CreateThread(NULL, NULL, ServerWorkerThread, NULL, 0, &threadID); + if (server) + { + char path[MIMFOLDER_SIZE]; + GetModuleFileName(GetModuleHandle(NULL), path, sizeof(path)); + char *p = strrchr(path, '\\'); + if (p) { *p = 0; } + STRNCPY(sdCmdLine->mimFolder, path, MIMFOLDER_SIZE); + sdCmdLine->instances++; + + failure = 0; + } + else{ + PUShowMessage(Translate("Could not create CommandLine listening server!"), SM_WARNING); + } + } + else{ + MessageBox(NULL, Translate("You can only run one instance of CmdLine plugin."), Translate("Error"), MB_ICONERROR | MB_OK); + } + } + + return failure; +} + +extern "C" __declspec(dllexport) void ListCommands(PCommand * commands, int *count) +{ + *commands = mimCommands; + *count = cMimCommands; +} \ No newline at end of file diff --git a/plugins/CmdLine/src/services.h b/plugins/CmdLine/src/services.h new file mode 100644 index 0000000000..b4beb1d44b --- /dev/null +++ b/plugins/CmdLine/src/services.h @@ -0,0 +1,34 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 M_CMDLINE_SERVICES_H +#define M_CMDLINE_SERVICES_H + +#include "mimcmd_handlers.h" + +int InitServices(); +int DestroyServices(); + +int StartServer(); + +extern "C" __declspec(dllexport) void ProcessConsoleCommand(PCommand command, TArgument *arguments, int count, PReply reply); +extern "C" __declspec(dllexport) void ListCommands(PCommand * commands, int *count); + +#endif //M_CMDLINE_SERVICES_H diff --git a/plugins/CmdLine/src/utils.cpp b/plugins/CmdLine/src/utils.cpp new file mode 100644 index 0000000000..7d1136602f --- /dev/null +++ b/plugins/CmdLine/src/utils.cpp @@ -0,0 +1,461 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 "commonheaders.h" + +int LogInit() +{ +#ifdef USE_LOG + //FILE *fout = fopen(LOG_FILE, "wt"); + //fclose(fout); + Log("********************** Miranda started **********************"); +#endif + return 0; +} + +int Log(char *format, ...) +{ +#ifdef USE_LOG + char str[4096]; + va_list vararg; + int tBytes; + FILE *fout = fopen(LOG_FILE, "at"); + if (!fout) + { +// MessageBox(0, "can't open file", NULL, MB_OK); + return -1; + } + time_t tNow = time(NULL); + struct tm *now = localtime(&tNow); + strftime(str, sizeof(str), "%d %b %Y @ %H:%M:%S: ", now); + fputs(str, fout); + va_start(vararg, format); + + tBytes = _vsnprintf(str, sizeof(str), format, vararg); + if (tBytes > 0) + { + str[tBytes] = 0; + } + + va_end(vararg); + if (str[strlen(str) - 1] != '\n') + { + strcat(str, "\n"); + } + fputs(str, fout); + fclose(fout); +#endif + return 0; +} + +int Info(char *title, char *format, ...) +{ + char str[4096]; + va_list vararg; + int tBytes; + va_start(vararg, format); + tBytes = _vsnprintf(str, sizeof(str), format, vararg); + if (tBytes > 0) + { + str[tBytes] = 0; + } + va_end(vararg); + return MessageBoxA(0, str, title, MB_OK | MB_ICONINFORMATION); +} + +int MyPUShowMessage(char *lpzText, BYTE kind) +{ + if (ServiceExists(MS_POPUP_SHOWMESSAGE)) + { + return PUShowMessage(lpzText, kind); + } + else{ + char *title = (kind == SM_NOTIFY) ? Translate("Notify") : Translate("Warning"); + + return MessageBox(NULL, lpzText, title, MB_OK | (kind == SM_NOTIFY) ? MB_ICONINFORMATION : MB_ICONEXCLAMATION); + } +} + +#define HEX_SIZE 8 + +char *BinToHex(int size, PBYTE data) +{ + char *szresult = NULL; + char buffer[32] = {0}; //should be more than enough + int maxSize = size * 2 + HEX_SIZE + 1; + szresult = (char *) new char[ maxSize ]; + memset(szresult, 0, maxSize); + sprintf(buffer, "%0*X", HEX_SIZE, size); + strcpy(szresult, buffer); + int i; + for (i = 0; i < size; i++) + { + sprintf(buffer, "%02X", data[i]); + strcpy(szresult + (HEX_SIZE + i * 2), buffer); + } + return szresult; +} + +void HexToBin(char *inData, ULONG &size, LPBYTE &outData) +{ + char buffer[32] = {0}; + strcpy(buffer, "0x"); + STRNCPY(buffer + 2, inData, HEX_SIZE); + sscanf(buffer, "%x", &size); + outData = (unsigned char*)new char[size*2]; + UINT i; + //size = i; + char *tmp = inData + HEX_SIZE; + buffer[4] = '\0'; //mark the end of the string + for (i = 0; i < size; i++) + { + STRNCPY(buffer + 2, &tmp[i * 2], 2); + sscanf(buffer, "%x", &outData[i]); + } + i = size; +} + +int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, char *szError, char *szResult, size_t size) +{ + DBVARIANT dbv = {0}; + int res = 1; + size_t len; + dbv.type = DBVT_ASCIIZ; + if (DBGetContactSetting(hContact, szModule, szSettingName, &dbv) == 0) + { + res = 0; + size_t tmp = strlen(dbv.pszVal); + len = (tmp < size - 1) ? tmp : size - 1; + strncpy(szResult, dbv.pszVal, len); + szResult[len] = '\0'; + mir_free(dbv.pszVal); + } + else{ + res = 1; + if (szError) + { + size_t tmp = strlen(szError); + len = (tmp < size - 1) ? tmp : size - 1; + strncpy(szResult, szError, len); + szResult[len] = '\0'; + } + else{ + szResult[0] = '\0'; + } + } + return res; +} + +int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, WCHAR *szError, WCHAR *szResult, size_t count) +{ + DBVARIANT dbv = {0}; + int res = 1; + size_t len; + dbv.type = DBVT_WCHAR; + if (DBGetContactSettingWString(hContact, szModule, szSettingName, &dbv) == 0) + { + res = 0; + if (dbv.type != DBVT_WCHAR) + { + MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, szResult, (int) count); + } + else{ + size_t tmp = wcslen(dbv.pwszVal); + len = (tmp < count - 1) ? tmp : count - 1; + wcsncpy(szResult, dbv.pwszVal, len); + szResult[len] = L'\0'; + } + mir_free(dbv.pwszVal); + } + else{ + res = 1; + if (szError) + { + size_t tmp = wcslen(szError); + len = (tmp < count - 1) ? tmp : count - 1; + wcsncpy(szResult, szError, len); + szResult[len] = L'\0'; + } + else{ + szResult[0] = L'\0'; + } + } + return res; +} + +int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, size_t size) +{ + return GetStringFromDatabase(NULL, ModuleName, szSettingName, szError, szResult, size); +} + +int GetStringFromDatabase(char *szSettingName, WCHAR *szError, WCHAR *szResult, size_t count) +{ + return GetStringFromDatabase(NULL, ModuleName, szSettingName, szError, szResult, count); +} + +#pragma warning (disable: 4312) +TCHAR *GetContactName(HANDLE hContact, char *szProto) +{ + CONTACTINFO ctInfo; + INT_PTR ret; + char proto[200]; + + ZeroMemory((void *) &ctInfo, sizeof(ctInfo)); + ctInfo.cbSize = sizeof(ctInfo); + if (szProto) + { + ctInfo.szProto = szProto; + } + else{ + GetContactProtocol(hContact, proto, sizeof(proto)); + ctInfo.szProto = proto; + } + ctInfo.dwFlag = CNF_DISPLAY; +#ifdef _UNICODE + ctInfo.dwFlag += CNF_UNICODE; +#endif + ctInfo.hContact = hContact; + //_debug_message("retrieving contact name for %d", hContact); + ret = CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) &ctInfo); + //_debug_message(" contact name %s", ctInfo.pszVal); + TCHAR *buffer; + if (!ret) + { + buffer = _tcsdup(ctInfo.pszVal); + } + mir_free(ctInfo.pszVal); + if (!ret) + { + return buffer; + } + else{ + return NULL; + } + return buffer; +} +#pragma warning (default: 4312) + +#pragma warning (disable: 4312) +void GetContactProtocol(HANDLE hContact, char *szProto, size_t size) +{ + GetStringFromDatabase(hContact, "Protocol", "p", NULL, szProto, size); +} +#pragma warning (default: 4312) + +#pragma warning (disable: 4312) +TCHAR *GetContactID(HANDLE hContact) +{ + char protocol[256]; + GetContactProtocol(hContact, protocol, sizeof(protocol)); + + return GetContactID(hContact, protocol); +} + +TCHAR *GetContactID(HANDLE hContact, char *szProto) +{ + CONTACTINFO ctInfo; + INT_PTR ret; + + ZeroMemory((void *) &ctInfo, sizeof(ctInfo)); + ctInfo.cbSize = sizeof(ctInfo); + ctInfo.szProto = szProto; + ctInfo.dwFlag = CNF_UNIQUEID; +#ifdef _UNICODE + ctInfo.dwFlag |= CNF_UNICODE; +#endif + ctInfo.hContact = hContact; + ret = CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) &ctInfo); + TCHAR *buffer; + if (!ret) + { + TCHAR tmp[16]; + switch (ctInfo.type) + { + case CNFT_BYTE: + { + _stprintf(tmp, _T("%d"), ctInfo.bVal); + buffer = _tcsdup(tmp); + + break; + } + + case CNFT_WORD: + { + _stprintf(tmp, _T("%d"), ctInfo.wVal); + buffer = _tcsdup(tmp); + + break; + } + + case CNFT_DWORD: + { + _stprintf(tmp, _T("%ld"), ctInfo.dVal); + buffer = _tcsdup(tmp); + + break; + } + + case CNFT_ASCIIZ: + default: + { + buffer = _tcsdup(ctInfo.pszVal); + + break; + } + } + + + } + mir_free(ctInfo.pszVal); + if (!ret) + { + return buffer; + } + else{ + return NULL; + } +} +#pragma warning (default: 4312) + +#pragma warning (disable: 4312) +HANDLE GetContactFromID(TCHAR *szID, char *szProto) +{ + HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); + TCHAR *szHandle; + TCHAR dispName[1024]; + char cProtocol[256]; + char *tmp; + + int found = 0; + while (hContact) + { + GetContactProtocol(hContact, cProtocol, sizeof(cProtocol)); + szHandle = GetContactID(hContact, cProtocol); + + tmp = (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0); + STRNCPY(dispName, tmp, sizeof(dispName)); + + if ((szHandle) && ((_tcsicmp(szHandle, szID) == 0) || (_tcsicmp(dispName, szID) == 0)) && ((szProto == NULL) || (_stricmp(szProto, cProtocol) == 0))) + { + found = 1; + } + if (szHandle) { free(szHandle); } + + if (found) { break; } + hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); + } + + return hContact; +} +#pragma warning (default: 4312) + +#pragma warning (disable: 4312) +HANDLE GetContactFromID(TCHAR *szID, wchar_t *szProto) +{ + char protocol[1024]; + WideCharToMultiByte(CP_ACP, 0, szProto, -1, protocol, sizeof(protocol), NULL, NULL); + return GetContactFromID(szID, protocol); +} +#pragma warning (default: 4312) + +void ScreenToClient(HWND hWnd, LPRECT rect) +{ + POINT pt; + int cx = rect->right - rect->left; + int cy = rect->bottom - rect->top; + pt.x = rect->left; + pt.y = rect->top; + ScreenToClient(hWnd, &pt); + rect->left = pt.x; + rect->top = pt.y; + rect->right = pt.x + cx; + rect->bottom = pt.y + cy; +} + +void AnchorMoveWindow(HWND window, const WINDOWPOS *parentPos, int anchors) +{ + RECT rParent; + RECT rChild; + + if (parentPos->flags & SWP_NOSIZE) + { + return; + } + GetWindowRect(parentPos->hwnd, &rParent); + rChild = AnchorCalcPos(window, &rParent, parentPos, anchors); + MoveWindow(window, rChild.left, rChild.top, rChild.right - rChild.left, rChild.bottom - rChild.top, FALSE); +} + +RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, int anchors) +{ + RECT rChild; + RECT rTmp; + + GetWindowRect(window, &rChild); + ScreenToClient(parentPos->hwnd, &rChild); + + int cx = rParent->right - rParent->left; + int cy = rParent->bottom - rParent->top; + if ((cx == parentPos->cx) && (cy == parentPos->cy)) + { + return rChild; + } + if (parentPos->flags & SWP_NOSIZE) + { + return rChild; + } + + rTmp.left = parentPos->x - rParent->left; + rTmp.right = (parentPos->x + parentPos->cx) - rParent->right; + rTmp.bottom = (parentPos->y + parentPos->cy) - rParent->bottom; + rTmp.top = parentPos->y - rParent->top; + + cx = (rTmp.left) ? -rTmp.left : rTmp.right; + cy = (rTmp.top) ? -rTmp.top : rTmp.bottom; + + rChild.right += cx; + rChild.bottom += cy; + //expanded the window accordingly, now we need to enforce the anchors + if ((anchors & ANCHOR_LEFT) && (!(anchors & ANCHOR_RIGHT))) + { + rChild.right -= cx; + } + if ((anchors & ANCHOR_TOP) && (!(anchors & ANCHOR_BOTTOM))) + { + rChild.bottom -= cy; + } + if ((anchors & ANCHOR_RIGHT) && (!(anchors & ANCHOR_LEFT))) + { + rChild.left += cx; + } + if ((anchors & ANCHOR_BOTTOM) && (!(anchors & ANCHOR_TOP))) + { + rChild.top += cy; + } + return rChild; +} + +inline char *STRNCPY(char *output, const char *input, size_t size) +{ + char *res = strncpy(output, input, size); + output[size - 1] = 0; + + return res; +} \ No newline at end of file diff --git a/plugins/CmdLine/src/utils.h b/plugins/CmdLine/src/utils.h new file mode 100644 index 0000000000..22b4721cfa --- /dev/null +++ b/plugins/CmdLine/src/utils.h @@ -0,0 +1,62 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 M_CMDLINE_UTILS_H +#define M_CMDLINE_UTILS_H + +#include + +//#define USE_LOG +#define LOG_FILE "cmdline.log" + +#define ANCHOR_LEFT 0x000001 +#define ANCHOR_RIGHT 0x000002 +#define ANCHOR_TOP 0x000004 +#define ANCHOR_BOTTOM 0x000008 +#define ANCHOR_ALL ANCHOR_LEFT | ANCHOR_RIGHT | ANCHOR_TOP | ANCHOR_BOTTOM + +int LogInit(); +int Log(char *format, ...); +int Info(char *title, char *format, ...); + +char *BinToHex(int size, PBYTE data); +void HexToBin(char *inData, ULONG &size, PBYTE &outData); + +void ScreenToClient(HWND hWnd, LPRECT rect); +void AnchorMoveWindow(HWND window, const WINDOWPOS *parentPos, int anchors); +RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, int anchors); + +int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, char *szError, char *szResult, size_t size); +int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, WCHAR *szError, WCHAR *szResult, size_t count); +int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, size_t size); +int GetStringFromDatabase(char *szSettingName, WCHAR *szError, WCHAR *szResult, size_t count); + +TCHAR *GetContactName(HANDLE hContact, char *szProto); +TCHAR *GetContactID(HANDLE hContact); +TCHAR *GetContactID(HANDLE hContact, char *szProto); +HANDLE GetContactFromID(TCHAR *szID, char *szProto); +HANDLE GetContactFromID(TCHAR *szID, wchar_t *szProto); +void GetContactProtocol(HANDLE hContact, char *szProto, size_t size); + +int MyPUShowMessage(char *lpzText, BYTE kind); + +inline char *STRNCPY(char *output, const char *input, size_t size); + +#endif \ No newline at end of file diff --git a/plugins/CmdLine/src/version.h b/plugins/CmdLine/src/version.h new file mode 100644 index 0000000000..03656ae51d --- /dev/null +++ b/plugins/CmdLine/src/version.h @@ -0,0 +1,49 @@ +/* +CmdLine plugin for Miranda IM + +Copyright © 2007-2010 Cristian Libotean + +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 M_CMDLINE_VERSION_H +#define M_CMDLINE_VERSION_H + +#define __MAJOR_VERSION 0 +#define __MINOR_VERSION 0 +#define __RELEASE_NUM 4 +#define __BUILD_NUM 1 + +#define VERSION PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM) + +#define __PLUGINVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM +#define __PLUGINVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM +#define __STRINGIFY_(x) #x +#define __STRINGIFY(x) __STRINGIFY_(x) +#define __VERSION_STRING __STRINGIFY(__PLUGINVERSION_STRING_DOTS) + +#define __DESC "This plugin lets you control Miranda from the command line." +#define __AUTHOR "Cristian Libotean" +#define __AUTHOREMAIL "eblis102@yahoo.com" +#define __COPYRIGHT "© 2007-2011 Cristian Libotean" +#define __AUTHORWEB "http://www.miranda-im.org/" + +#if defined(WIN64) || defined(_WIN64) +#define __PLUGIN_DISPLAY_NAME "Command Line (x64)" +#else +#define __PLUGIN_DISPLAY_NAME "Command Line" +#endif + +#endif //M_CMDLINE_VERSION_H diff --git a/plugins/CmdLine/utils.cpp b/plugins/CmdLine/utils.cpp deleted file mode 100644 index 7d1136602f..0000000000 --- a/plugins/CmdLine/utils.cpp +++ /dev/null @@ -1,461 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 "commonheaders.h" - -int LogInit() -{ -#ifdef USE_LOG - //FILE *fout = fopen(LOG_FILE, "wt"); - //fclose(fout); - Log("********************** Miranda started **********************"); -#endif - return 0; -} - -int Log(char *format, ...) -{ -#ifdef USE_LOG - char str[4096]; - va_list vararg; - int tBytes; - FILE *fout = fopen(LOG_FILE, "at"); - if (!fout) - { -// MessageBox(0, "can't open file", NULL, MB_OK); - return -1; - } - time_t tNow = time(NULL); - struct tm *now = localtime(&tNow); - strftime(str, sizeof(str), "%d %b %Y @ %H:%M:%S: ", now); - fputs(str, fout); - va_start(vararg, format); - - tBytes = _vsnprintf(str, sizeof(str), format, vararg); - if (tBytes > 0) - { - str[tBytes] = 0; - } - - va_end(vararg); - if (str[strlen(str) - 1] != '\n') - { - strcat(str, "\n"); - } - fputs(str, fout); - fclose(fout); -#endif - return 0; -} - -int Info(char *title, char *format, ...) -{ - char str[4096]; - va_list vararg; - int tBytes; - va_start(vararg, format); - tBytes = _vsnprintf(str, sizeof(str), format, vararg); - if (tBytes > 0) - { - str[tBytes] = 0; - } - va_end(vararg); - return MessageBoxA(0, str, title, MB_OK | MB_ICONINFORMATION); -} - -int MyPUShowMessage(char *lpzText, BYTE kind) -{ - if (ServiceExists(MS_POPUP_SHOWMESSAGE)) - { - return PUShowMessage(lpzText, kind); - } - else{ - char *title = (kind == SM_NOTIFY) ? Translate("Notify") : Translate("Warning"); - - return MessageBox(NULL, lpzText, title, MB_OK | (kind == SM_NOTIFY) ? MB_ICONINFORMATION : MB_ICONEXCLAMATION); - } -} - -#define HEX_SIZE 8 - -char *BinToHex(int size, PBYTE data) -{ - char *szresult = NULL; - char buffer[32] = {0}; //should be more than enough - int maxSize = size * 2 + HEX_SIZE + 1; - szresult = (char *) new char[ maxSize ]; - memset(szresult, 0, maxSize); - sprintf(buffer, "%0*X", HEX_SIZE, size); - strcpy(szresult, buffer); - int i; - for (i = 0; i < size; i++) - { - sprintf(buffer, "%02X", data[i]); - strcpy(szresult + (HEX_SIZE + i * 2), buffer); - } - return szresult; -} - -void HexToBin(char *inData, ULONG &size, LPBYTE &outData) -{ - char buffer[32] = {0}; - strcpy(buffer, "0x"); - STRNCPY(buffer + 2, inData, HEX_SIZE); - sscanf(buffer, "%x", &size); - outData = (unsigned char*)new char[size*2]; - UINT i; - //size = i; - char *tmp = inData + HEX_SIZE; - buffer[4] = '\0'; //mark the end of the string - for (i = 0; i < size; i++) - { - STRNCPY(buffer + 2, &tmp[i * 2], 2); - sscanf(buffer, "%x", &outData[i]); - } - i = size; -} - -int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, char *szError, char *szResult, size_t size) -{ - DBVARIANT dbv = {0}; - int res = 1; - size_t len; - dbv.type = DBVT_ASCIIZ; - if (DBGetContactSetting(hContact, szModule, szSettingName, &dbv) == 0) - { - res = 0; - size_t tmp = strlen(dbv.pszVal); - len = (tmp < size - 1) ? tmp : size - 1; - strncpy(szResult, dbv.pszVal, len); - szResult[len] = '\0'; - mir_free(dbv.pszVal); - } - else{ - res = 1; - if (szError) - { - size_t tmp = strlen(szError); - len = (tmp < size - 1) ? tmp : size - 1; - strncpy(szResult, szError, len); - szResult[len] = '\0'; - } - else{ - szResult[0] = '\0'; - } - } - return res; -} - -int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, WCHAR *szError, WCHAR *szResult, size_t count) -{ - DBVARIANT dbv = {0}; - int res = 1; - size_t len; - dbv.type = DBVT_WCHAR; - if (DBGetContactSettingWString(hContact, szModule, szSettingName, &dbv) == 0) - { - res = 0; - if (dbv.type != DBVT_WCHAR) - { - MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, szResult, (int) count); - } - else{ - size_t tmp = wcslen(dbv.pwszVal); - len = (tmp < count - 1) ? tmp : count - 1; - wcsncpy(szResult, dbv.pwszVal, len); - szResult[len] = L'\0'; - } - mir_free(dbv.pwszVal); - } - else{ - res = 1; - if (szError) - { - size_t tmp = wcslen(szError); - len = (tmp < count - 1) ? tmp : count - 1; - wcsncpy(szResult, szError, len); - szResult[len] = L'\0'; - } - else{ - szResult[0] = L'\0'; - } - } - return res; -} - -int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, size_t size) -{ - return GetStringFromDatabase(NULL, ModuleName, szSettingName, szError, szResult, size); -} - -int GetStringFromDatabase(char *szSettingName, WCHAR *szError, WCHAR *szResult, size_t count) -{ - return GetStringFromDatabase(NULL, ModuleName, szSettingName, szError, szResult, count); -} - -#pragma warning (disable: 4312) -TCHAR *GetContactName(HANDLE hContact, char *szProto) -{ - CONTACTINFO ctInfo; - INT_PTR ret; - char proto[200]; - - ZeroMemory((void *) &ctInfo, sizeof(ctInfo)); - ctInfo.cbSize = sizeof(ctInfo); - if (szProto) - { - ctInfo.szProto = szProto; - } - else{ - GetContactProtocol(hContact, proto, sizeof(proto)); - ctInfo.szProto = proto; - } - ctInfo.dwFlag = CNF_DISPLAY; -#ifdef _UNICODE - ctInfo.dwFlag += CNF_UNICODE; -#endif - ctInfo.hContact = hContact; - //_debug_message("retrieving contact name for %d", hContact); - ret = CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) &ctInfo); - //_debug_message(" contact name %s", ctInfo.pszVal); - TCHAR *buffer; - if (!ret) - { - buffer = _tcsdup(ctInfo.pszVal); - } - mir_free(ctInfo.pszVal); - if (!ret) - { - return buffer; - } - else{ - return NULL; - } - return buffer; -} -#pragma warning (default: 4312) - -#pragma warning (disable: 4312) -void GetContactProtocol(HANDLE hContact, char *szProto, size_t size) -{ - GetStringFromDatabase(hContact, "Protocol", "p", NULL, szProto, size); -} -#pragma warning (default: 4312) - -#pragma warning (disable: 4312) -TCHAR *GetContactID(HANDLE hContact) -{ - char protocol[256]; - GetContactProtocol(hContact, protocol, sizeof(protocol)); - - return GetContactID(hContact, protocol); -} - -TCHAR *GetContactID(HANDLE hContact, char *szProto) -{ - CONTACTINFO ctInfo; - INT_PTR ret; - - ZeroMemory((void *) &ctInfo, sizeof(ctInfo)); - ctInfo.cbSize = sizeof(ctInfo); - ctInfo.szProto = szProto; - ctInfo.dwFlag = CNF_UNIQUEID; -#ifdef _UNICODE - ctInfo.dwFlag |= CNF_UNICODE; -#endif - ctInfo.hContact = hContact; - ret = CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) &ctInfo); - TCHAR *buffer; - if (!ret) - { - TCHAR tmp[16]; - switch (ctInfo.type) - { - case CNFT_BYTE: - { - _stprintf(tmp, _T("%d"), ctInfo.bVal); - buffer = _tcsdup(tmp); - - break; - } - - case CNFT_WORD: - { - _stprintf(tmp, _T("%d"), ctInfo.wVal); - buffer = _tcsdup(tmp); - - break; - } - - case CNFT_DWORD: - { - _stprintf(tmp, _T("%ld"), ctInfo.dVal); - buffer = _tcsdup(tmp); - - break; - } - - case CNFT_ASCIIZ: - default: - { - buffer = _tcsdup(ctInfo.pszVal); - - break; - } - } - - - } - mir_free(ctInfo.pszVal); - if (!ret) - { - return buffer; - } - else{ - return NULL; - } -} -#pragma warning (default: 4312) - -#pragma warning (disable: 4312) -HANDLE GetContactFromID(TCHAR *szID, char *szProto) -{ - HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); - TCHAR *szHandle; - TCHAR dispName[1024]; - char cProtocol[256]; - char *tmp; - - int found = 0; - while (hContact) - { - GetContactProtocol(hContact, cProtocol, sizeof(cProtocol)); - szHandle = GetContactID(hContact, cProtocol); - - tmp = (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0); - STRNCPY(dispName, tmp, sizeof(dispName)); - - if ((szHandle) && ((_tcsicmp(szHandle, szID) == 0) || (_tcsicmp(dispName, szID) == 0)) && ((szProto == NULL) || (_stricmp(szProto, cProtocol) == 0))) - { - found = 1; - } - if (szHandle) { free(szHandle); } - - if (found) { break; } - hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); - } - - return hContact; -} -#pragma warning (default: 4312) - -#pragma warning (disable: 4312) -HANDLE GetContactFromID(TCHAR *szID, wchar_t *szProto) -{ - char protocol[1024]; - WideCharToMultiByte(CP_ACP, 0, szProto, -1, protocol, sizeof(protocol), NULL, NULL); - return GetContactFromID(szID, protocol); -} -#pragma warning (default: 4312) - -void ScreenToClient(HWND hWnd, LPRECT rect) -{ - POINT pt; - int cx = rect->right - rect->left; - int cy = rect->bottom - rect->top; - pt.x = rect->left; - pt.y = rect->top; - ScreenToClient(hWnd, &pt); - rect->left = pt.x; - rect->top = pt.y; - rect->right = pt.x + cx; - rect->bottom = pt.y + cy; -} - -void AnchorMoveWindow(HWND window, const WINDOWPOS *parentPos, int anchors) -{ - RECT rParent; - RECT rChild; - - if (parentPos->flags & SWP_NOSIZE) - { - return; - } - GetWindowRect(parentPos->hwnd, &rParent); - rChild = AnchorCalcPos(window, &rParent, parentPos, anchors); - MoveWindow(window, rChild.left, rChild.top, rChild.right - rChild.left, rChild.bottom - rChild.top, FALSE); -} - -RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, int anchors) -{ - RECT rChild; - RECT rTmp; - - GetWindowRect(window, &rChild); - ScreenToClient(parentPos->hwnd, &rChild); - - int cx = rParent->right - rParent->left; - int cy = rParent->bottom - rParent->top; - if ((cx == parentPos->cx) && (cy == parentPos->cy)) - { - return rChild; - } - if (parentPos->flags & SWP_NOSIZE) - { - return rChild; - } - - rTmp.left = parentPos->x - rParent->left; - rTmp.right = (parentPos->x + parentPos->cx) - rParent->right; - rTmp.bottom = (parentPos->y + parentPos->cy) - rParent->bottom; - rTmp.top = parentPos->y - rParent->top; - - cx = (rTmp.left) ? -rTmp.left : rTmp.right; - cy = (rTmp.top) ? -rTmp.top : rTmp.bottom; - - rChild.right += cx; - rChild.bottom += cy; - //expanded the window accordingly, now we need to enforce the anchors - if ((anchors & ANCHOR_LEFT) && (!(anchors & ANCHOR_RIGHT))) - { - rChild.right -= cx; - } - if ((anchors & ANCHOR_TOP) && (!(anchors & ANCHOR_BOTTOM))) - { - rChild.bottom -= cy; - } - if ((anchors & ANCHOR_RIGHT) && (!(anchors & ANCHOR_LEFT))) - { - rChild.left += cx; - } - if ((anchors & ANCHOR_BOTTOM) && (!(anchors & ANCHOR_TOP))) - { - rChild.top += cy; - } - return rChild; -} - -inline char *STRNCPY(char *output, const char *input, size_t size) -{ - char *res = strncpy(output, input, size); - output[size - 1] = 0; - - return res; -} \ No newline at end of file diff --git a/plugins/CmdLine/utils.h b/plugins/CmdLine/utils.h deleted file mode 100644 index 22b4721cfa..0000000000 --- a/plugins/CmdLine/utils.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 M_CMDLINE_UTILS_H -#define M_CMDLINE_UTILS_H - -#include - -//#define USE_LOG -#define LOG_FILE "cmdline.log" - -#define ANCHOR_LEFT 0x000001 -#define ANCHOR_RIGHT 0x000002 -#define ANCHOR_TOP 0x000004 -#define ANCHOR_BOTTOM 0x000008 -#define ANCHOR_ALL ANCHOR_LEFT | ANCHOR_RIGHT | ANCHOR_TOP | ANCHOR_BOTTOM - -int LogInit(); -int Log(char *format, ...); -int Info(char *title, char *format, ...); - -char *BinToHex(int size, PBYTE data); -void HexToBin(char *inData, ULONG &size, PBYTE &outData); - -void ScreenToClient(HWND hWnd, LPRECT rect); -void AnchorMoveWindow(HWND window, const WINDOWPOS *parentPos, int anchors); -RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, int anchors); - -int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, char *szError, char *szResult, size_t size); -int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, WCHAR *szError, WCHAR *szResult, size_t count); -int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, size_t size); -int GetStringFromDatabase(char *szSettingName, WCHAR *szError, WCHAR *szResult, size_t count); - -TCHAR *GetContactName(HANDLE hContact, char *szProto); -TCHAR *GetContactID(HANDLE hContact); -TCHAR *GetContactID(HANDLE hContact, char *szProto); -HANDLE GetContactFromID(TCHAR *szID, char *szProto); -HANDLE GetContactFromID(TCHAR *szID, wchar_t *szProto); -void GetContactProtocol(HANDLE hContact, char *szProto, size_t size); - -int MyPUShowMessage(char *lpzText, BYTE kind); - -inline char *STRNCPY(char *output, const char *input, size_t size); - -#endif \ No newline at end of file diff --git a/plugins/CmdLine/version.h b/plugins/CmdLine/version.h deleted file mode 100644 index 03656ae51d..0000000000 --- a/plugins/CmdLine/version.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -CmdLine plugin for Miranda IM - -Copyright © 2007-2010 Cristian Libotean - -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 M_CMDLINE_VERSION_H -#define M_CMDLINE_VERSION_H - -#define __MAJOR_VERSION 0 -#define __MINOR_VERSION 0 -#define __RELEASE_NUM 4 -#define __BUILD_NUM 1 - -#define VERSION PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM) - -#define __PLUGINVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM -#define __PLUGINVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM -#define __STRINGIFY_(x) #x -#define __STRINGIFY(x) __STRINGIFY_(x) -#define __VERSION_STRING __STRINGIFY(__PLUGINVERSION_STRING_DOTS) - -#define __DESC "This plugin lets you control Miranda from the command line." -#define __AUTHOR "Cristian Libotean" -#define __AUTHOREMAIL "eblis102@yahoo.com" -#define __COPYRIGHT "© 2007-2011 Cristian Libotean" -#define __AUTHORWEB "http://www.miranda-im.org/" - -#if defined(WIN64) || defined(_WIN64) -#define __PLUGIN_DISPLAY_NAME "Command Line (x64)" -#else -#define __PLUGIN_DISPLAY_NAME "Command Line" -#endif - -#endif //M_CMDLINE_VERSION_H diff --git a/plugins/CmdLine/version.rc b/plugins/CmdLine/version.rc deleted file mode 100644 index 737644cfab..0000000000 --- a/plugins/CmdLine/version.rc +++ /dev/null @@ -1,104 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#ifdef APSTUDIO_INVOKED -#error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - -#include "resource.h" -#include "version.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION __PLUGINVERSION_STRING - PRODUCTVERSION __PLUGINVERSION_STRING - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Author", __AUTHOR - VALUE "FileDescription", __DESC - VALUE "FileVersion", __VERSION_STRING - VALUE "InternalName", __PLUGIN_DISPLAY_NAME - VALUE "LegalCopyright", __COPYRIGHT - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/plugins/Console/Console.cpp b/plugins/Console/Console.cpp deleted file mode 100644 index b04be4dc39..0000000000 --- a/plugins/Console/Console.cpp +++ /dev/null @@ -1,1430 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2008 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 "commonheaders.h" - -#define MS_CONSOLE_SHOW_HIDE "Console/Show/Hide" - -#define DEFAULT_WRAPLEN 90 -#define MIN_WRAPLEN 25 -#define MAX_WRAPLEN 255 - -#define MIN_LIMIT 1000 -#define MAX_LIMIT 1000000 - -#define IMG_EMPTY 0 -#define IMG_ARROW 1 -#define IMG_IN 2 -#define IMG_OUT 3 -#define IMG_INFO 4 - -#define LOGICONX_SIZE 10 -#define LOGICONY_SIZE 10 - -#define ICON_FIRST 3 - -#define ICON_NOSCROLL 1 -#define ICON_PAUSED 2 -#define ICON_SCROLL 3 -#define ICON_STARTED 4 - -#define HM_DUMP (WM_USER+10) -#define HM_ADD (WM_USER+11) -#define HM_REMOVE (WM_USER+12) -#define HM_SETFONT (WM_USER+13) -#define HM_SETCOLOR (WM_USER+14) -#define HM_PAUSEALL (WM_USER+15) -#define HM_RESTART (WM_USER+16) - - -typedef struct { - const char* pszHead; - const char* pszMsg; -} LOGMSG; - - -typedef struct { - char szModule[128]; - TCHAR szMsg[1]; -} DUMPMSG; - - -typedef struct { - HWND hwnd; - HWND hList; - char *Module; - int Scroll; - int Paused; - int newline; -} LOGWIN; - - - -static SortedList lModules = {0}; - -static LOGWIN *pActive = NULL; -static int tabCount = 0; -static RECT rcTabs = {0}; -static HWND hTabs = NULL; -static HWND hwndConsole = NULL; - -static HIMAGELIST gImg = NULL; -static HFONT hfLogFont = NULL; - -static int gIcons = 0; -static int gVisible = 0; -static int gSingleMode = 0; -static int gLimit = 0; -static int gSeparator = 0; - -static DWORD gWrapLen = DEFAULT_WRAPLEN; - -static DWORD OutMsgs = 0; -static DWORD InMsgs = 0; - -static HICON hIcons[15] = {0}; -static HANDLE hMenu = NULL; - -static void LoadSettings(); -static void ShowConsole(int show); -static INT_PTR ShowHideConsole(WPARAM wParam, LPARAM lParam); -static int Openfile(TCHAR *outputFile, int selection); - -//////////////////////////////////////////////////////////////////////////////// - -static HANDLE hTTBButt = 0; - -static INT_PTR HideConsoleButt(WPARAM wParam,LPARAM lParam) -{ - ShowConsole(0); - return 0; -} - -static INT_PTR ShowConsoleButt(WPARAM wParam,LPARAM lParam) -{ - ShowConsole(1); - return 0; -} - -static int OnTTBLoaded(WPARAM wParam,LPARAM lParam) -{ - if ( !IsWindow(hwndConsole)) - return 0; - - int state = IsWindowVisible(hwndConsole); - - CreateServiceFunction("Console/Hide", HideConsoleButt); - CreateServiceFunction("Console/Show", ShowConsoleButt); - - TTBButton ttbb = {0}; - ttbb.cbSize = sizeof(ttbb); - - TCHAR szModuleFileName[MAX_PATH]={0}; - GetModuleFileName(hInst, szModuleFileName, SIZEOF(szModuleFileName)); - - SKINICONDESC sid={0}; - sid.cbSize = sizeof(sid); - sid.pszSection = "Console"; - sid.ptszDefaultFile = szModuleFileName; - sid.flags = SIDF_PATH_TCHAR; - sid.pszDescription = "Show"; - sid.pszName = "Console_Up"; - sid.iDefaultIndex = -IDI_BTN_UP; - ttbb.hIconHandleUp = Skin_AddIcon(&sid); - - sid.pszDescription = "Hide"; - sid.pszName = "Console_Down"; - sid.iDefaultIndex = -IDI_BTN_DN; - ttbb.hIconHandleDn = Skin_AddIcon(&sid); - - ttbb.dwFlags = (state ? TTBBF_PUSHED : 0) | TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; - ttbb.pszService = "Console/Hide"; - ttbb.name = LPGEN("Show/Hide Console"); - ttbb.pszTooltipDn = LPGEN("Hide Console"); - ttbb.pszTooltipUp = LPGEN("Show Console"); - hTTBButt = TopToolbar_AddButton(&ttbb); - if (hTTBButt) - CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, (LPARAM)(state?TTBST_PUSHED:TTBST_RELEASED)); - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// - -void ScrollDown(LOGWIN * dat) { - if (dat->Scroll) - ListView_EnsureVisible(dat->hList, ListView_GetItemCount(dat->hList) - 1, FALSE); -} - -//////////////////////////////////////////////////////////////////////////////// - -static void ShowConsole(int show) -{ - HWND hwnd = NULL; - - if (!hwndConsole || !pActive) return; - - gVisible = show; - - if (show) { - hwnd = GetForegroundWindow(); - if ( InMsgs == OutMsgs ) - ScrollDown( pActive ); - } - ShowWindow(hwndConsole, (show)?SW_SHOW:SW_HIDE); - DBWriteContactSettingByte(NULL,"Console","Show",(BYTE)((show)?1:0)); - - if (hwnd) - SetForegroundWindow(hwnd); - - if (show) - RedrawWindow(pActive->hList, NULL, NULL, RDW_INVALIDATE | RDW_FRAME |RDW_UPDATENOW | RDW_ERASE); - - if (hMenu) - { - CLISTMENUITEM mi = {0}; - - mi.cbSize = sizeof(mi); - mi.ptszName=(show)?TranslateT("Hide Console"):TranslateT("Show Console"); - mi.flags = CMIM_NAME | CMIF_TCHAR; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenu, (LPARAM)&mi); - } - - if (hTTBButt) - CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, (show)?TTBST_PUSHED:TTBST_RELEASED); -} - -//////////////////////////////////////////////////////////////////////////////// - -static INT_PTR ShowHideConsole(WPARAM wParam, LPARAM lParam) -{ - if (hwndConsole) - ShowConsole(!IsWindowVisible(hwndConsole)); - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// - -int LogResize(HWND hwnd,LPARAM lParam,UTILRESIZECONTROL *urc) -{ - switch(urc->wId) { - case IDC_LIST: - ListView_SetColumnWidth(GetDlgItem(hwnd, IDC_LIST), 0, urc->dlgNewSize.cx - 25); - return RD_ANCHORX_WIDTH|RD_ANCHORY_HEIGHT; - case IDC_STARTALL: - case IDC_PAUSEALL: - case IDC_CLOSE: - return RD_ANCHORX_RIGHT|RD_ANCHORY_TOP; - default: - return RD_ANCHORX_LEFT|RD_ANCHORY_TOP; - } -} - -//////////////////////////////////////////////////////////////////////////////// - -typedef struct -{ - UINT control; - UINT icon; - int type; - TCHAR *tooltip; -} controlinfo; - - -static controlinfo ctrls[] = -{ - // IDC_SCROLL & IDC_PAUSE must be first - {IDC_SCROLL, IDI_SCROLL, BUTTONSETASFLATBTN, _T("Scrolling (Ctrl+Q)")}, - {IDC_PAUSE, IDI_STARTED, BUTTONSETASFLATBTN, _T("Pause logging(Ctrl+P)")}, - {IDC_SAVE, IDI_SAVE, BUTTONSETASFLATBTN, _T("Save log to file (Ctrl+S)")}, - {IDC_COPY, IDI_COPY, BUTTONSETASFLATBTN, _T("Copy selected log (Ctrl+C)")}, - {IDC_DELETE, IDI_DELETE, BUTTONSETASFLATBTN, _T("Delete selected (Del)")}, - {IDC_OPTIONS, IDI_OPTIONS, BUTTONSETASFLATBTN, _T("Log options (Ctrl+O)")}, - {IDC_STARTALL, IDI_START, BUTTONSETASFLATBTN, _T("Start logging in all tabs")}, - {IDC_PAUSEALL, IDI_PAUSE, BUTTONSETASFLATBTN, _T("Pause logging in all tabs")}, - {IDC_CLOSE, IDI_CLOSE, BUTTONSETASFLATBTN, _T("Close tab (Ctrl+W)")}, -}; - -//////////////////////////////////////////////////////////////////////////////// - -static LRESULT CALLBACK SubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) -{ - int ctrl = GetKeyState(VK_CONTROL)&0x8000; - - switch (msg) { - - case WM_KEYDOWN: - if ( wParam == VK_DELETE && !ctrl) { - SendMessage(GetParent(hwnd), WM_COMMAND, IDC_DELETE, 0); - break; - } - - if (wParam == VK_LEFT && ctrl) - { - NMHDR nmhdr = {0}; - int tab = TabCtrl_GetCurSel(hTabs); - - if (tab == 0) - tab = TabCtrl_GetItemCount(hTabs)-1; - else - tab--; - - TabCtrl_SetCurSel(hTabs, tab); - nmhdr.code = TCN_SELCHANGE; - SendMessage(hwndConsole, WM_NOTIFY, IDC_TABS, (LPARAM)&nmhdr); - break; - } - - if (wParam == VK_RIGHT && ctrl) - { - NMHDR nmhdr = {0}; - int tab = TabCtrl_GetCurSel(hTabs); - int count = TabCtrl_GetItemCount(hTabs); - tab = (tab + 1) % count; - - TabCtrl_SetCurSel(hTabs, tab); - nmhdr.code = TCN_SELCHANGE; - SendMessage(hwndConsole, WM_NOTIFY, IDC_TABS, (LPARAM)&nmhdr); - break; - } - - break; - - case WM_CHAR: -/* - { - char t[32]; - sprintf(t,"%u\n",wParam); - OutputDebugStringA(t); - } -*/ - // CTRL - if ( !(GetKeyState(VK_CONTROL)&0x8000)) - break; - - switch(wParam) { - - case 1: // Ctrl+A - if ( ListView_GetSelectedCount(hwnd) != (UINT)ListView_GetItemCount(hwnd)) - ListView_SetItemState(hwnd, -1, LVIS_SELECTED, LVIS_SELECTED); - return 0; - - case 3: // Ctrl+D - SendMessage(GetParent(hwnd), WM_COMMAND, IDC_COPY, 0); - return 0; - - case 15: // Ctrl+O - SendMessage(GetParent(hwnd), WM_COMMAND, IDC_OPTIONS, 0); - return 0; - - case 16: // Ctrl+P - SendMessage(GetParent(hwnd), WM_COMMAND, IDC_PAUSE, 0); - return 0; - - case 17: // Ctrl+Q - SendMessage(GetParent(hwnd), WM_COMMAND, IDC_SCROLL, 0); - return 0; - - case 19: // Ctrl+S - SendMessage(GetParent(hwnd), WM_COMMAND, IDC_SAVE, 0); - return 0; - - case 23: // Ctrl+W - SendMessage(GetParent(hwnd), WM_COMMAND, IDC_CLOSE, 0); - return 0; - } - break; - } - return CallWindowProc((WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA),hwnd,msg,wParam,lParam); -} - -//////////////////////////////////////////////////////////////////////////////// - -static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) -{ - - LOGWIN *dat = (LOGWIN*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - - switch(message) { - case WM_INITDIALOG: - { - dat = (LOGWIN*)lParam; - - dat->hwnd = hwndDlg; - dat->Scroll = 1; - dat->Paused = 0; - dat->hList = GetDlgItem(hwndDlg, IDC_LIST); - - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG)dat); - SetWindowLongPtr(dat->hList, GWLP_USERDATA, SetWindowLongPtr(dat->hList, GWLP_WNDPROC, (LONG)SubclassProc)); - - // init buttons - { - int i; - HWND hwnd; - for(i = 0; i < SIZEOF(ctrls); i++) { - hwnd = GetDlgItem(hwndDlg,ctrls[i].control); - SendMessage(hwnd, ctrls[i].type, 0, 0); - SendMessage(hwnd, BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[i+ICON_FIRST]); - SendMessage(hwnd, BUTTONADDTOOLTIP,(WPARAM)TranslateTS(ctrls[i].tooltip), BATF_TCHAR); - } - } - - CheckDlgButton(hwndDlg,IDC_SCROLL,dat->Scroll?BST_CHECKED:BST_UNCHECKED); - SendDlgItemMessage(hwndDlg,IDC_SCROLL,BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[(dat->Scroll?ICON_SCROLL:ICON_NOSCROLL)]); - - if (gSingleMode) - { - ShowWindow(GetDlgItem(hwndDlg, IDC_PAUSEALL), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_STARTALL), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_CLOSE), SW_HIDE); - } - - // init listview - { - LVITEM lvi = {0}; - LVCOLUMN sLC; - //ListView_SetUnicodeFormat(dat->hList, TRUE); - ListView_SetImageList(dat->hList, gImg, LVSIL_SMALL); - sLC.mask = LVCF_FMT | LVCF_WIDTH; - sLC.fmt = LVCFMT_LEFT; - sLC.cx = 630; - ListView_InsertColumn(dat->hList, 0, &sLC); - ListView_SetExtendedListViewStyle(dat->hList, LVS_EX_FULLROWSELECT); - - lvi.mask = LVIF_TEXT; - if (gIcons) - { - lvi.mask |= LVIF_IMAGE; - lvi.iImage = IMG_INFO; - } - - lvi.pszText = TranslateT("*** Console started ***"); - ListView_InsertItem(dat->hList, &lvi); - } - - SendMessage(hwndDlg, WM_SIZE, 0, 0); - break; - } - case HM_DUMP: - { - // lParam = DUMPMSG - if (!lParam) break; - if (dat && !dat->Paused) - { - LVITEM lvi = {0}; - int last = 0x7fffffff; - TCHAR szBreak; - DWORD len, tmplen; - DWORD wraplen = gWrapLen; - TCHAR *str = ((DUMPMSG*)lParam)->szMsg; - - lvi.iItem = 0x7fffffff; - - str = _tcstok(str, _T("\n")); - - if (gIcons && str != NULL) - { - lvi.mask = LVIF_TEXT | LVIF_IMAGE; - - if (_tcsstr(str, _T("Data received"))) - { - if (gSeparator) ListView_InsertItem(dat->hList, &lvi); - lvi.iImage = IMG_IN; - } - else - if (_tcsstr(str, _T("Data sent"))) - { - if (gSeparator) ListView_InsertItem(dat->hList, &lvi); - lvi.iImage = IMG_OUT; - } - else - { - if (gSeparator && dat->newline) - { - ListView_InsertItem(dat->hList, &lvi); - dat->newline = 0; - } - lvi.iImage = IMG_INFO; - } - } else - lvi.mask = LVIF_TEXT; - - while (str != NULL) - { - lvi.pszText = &str[0]; - tmplen = len = (DWORD)_tcslen(lvi.pszText); - - while(len > wraplen) - { - szBreak = lvi.pszText[wraplen]; - lvi.pszText[wraplen] = 0; - last = ListView_InsertItem(dat->hList, &lvi); - lvi.pszText[wraplen] = szBreak; - len -= wraplen; - lvi.pszText = &str[0] + tmplen - len; - - dat->newline = 1; - lvi.iImage = IMG_EMPTY; - } - - if (len && lvi.pszText[len-1] == '\r') - lvi.pszText[len-1] = 0; - - last = ListView_InsertItem(dat->hList, &lvi); - - str = _tcstok(NULL, _T("\n")); - - if (str) dat->newline = 1; - lvi.iImage = IMG_EMPTY; - } - - - if ( gVisible && dat == pActive && dat->Scroll == 1 ) - ListView_EnsureVisible(dat->hList, last, FALSE); - - if (last > gLimit) - { - int idx = last - gLimit + gLimit/4; // leave only 75% of LIMIT - - while (idx >= 0) - { - ListView_DeleteItem(dat->hList, idx); - idx--; - } - } - } - - mir_free((DUMPMSG*)lParam); - return TRUE; - } - case WM_SIZE: - { - UTILRESIZEDIALOG urd={0}; - urd.cbSize=sizeof(urd); - urd.hInstance=hInst; - urd.hwndDlg=hwndDlg; - urd.lpTemplate=MAKEINTRESOURCEA(IDD_LOG); - urd.pfnResizer=LogResize; - SetWindowPos(hwndDlg, HWND_TOP, rcTabs.left, rcTabs.top, rcTabs.right - rcTabs.left, rcTabs.bottom - rcTabs.top, SWP_SHOWWINDOW); - CallService(MS_UTILS_RESIZEDIALOG,0,(LPARAM)&urd); - break; - } - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - if (!dat) break; - - case IDC_PAUSE: - { - LVITEM lvi = {0}; - dat->Paused = !(dat->Paused); - lvi.mask = LVIF_TEXT | LVIF_IMAGE; - lvi.iImage = IMG_INFO; - lvi.iItem = 0x7FFFFFFF; - lvi.pszText = (dat->Paused) ? TranslateT("*** Console paused ***") : TranslateT("*** Console resumed ***"); - ListView_InsertItem(dat->hList, &lvi); - CheckDlgButton(hwndDlg,IDC_PAUSE,(dat->Paused)?BST_CHECKED:BST_UNCHECKED); - SendDlgItemMessage(hwndDlg,IDC_PAUSE,BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[((dat->Paused)?ICON_PAUSED:ICON_STARTED)]); - break; - } - case IDC_SCROLL: - { - dat->Scroll = !(dat->Scroll); - CheckDlgButton(hwndDlg,IDC_SCROLL,(dat->Scroll)?BST_CHECKED:BST_UNCHECKED); - SendDlgItemMessage(hwndDlg,IDC_SCROLL,BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[((dat->Scroll)?ICON_SCROLL:ICON_NOSCROLL)]); - break; - } - case IDC_COPY: - { - int idx = 0; - TCHAR szText[128]; - TCHAR *src, *dst, *buf; - int flags = LVNI_BELOW; - int count = ListView_GetSelectedCount(dat->hList); - - if (count) - flags |= LVNI_SELECTED; - else - count = ListView_GetItemCount(dat->hList); - - dst = buf = (TCHAR*)malloc((count*(sizeof(szText)+1)+1)*sizeof(TCHAR)); - if (!buf) break; - - while ((idx = ListView_GetNextItem(dat->hList, idx, flags)) > 0) - { - ListView_GetItemText(dat->hList, idx, 0, szText, sizeof(szText)-1); - src = szText; - while (*dst++ = *src++); - dst--; - *dst++ = '\r'; - *dst++ = '\n'; - *dst = 0; - } - - if (dst - buf > 0 && OpenClipboard(hwndDlg)) { - HGLOBAL hClipboardData; - TCHAR* pchData; - EmptyClipboard(); - if (hClipboardData = GlobalAlloc(GMEM_DDESHARE, (dst-buf+1)*sizeof(TCHAR))) { - pchData = (TCHAR*)GlobalLock(hClipboardData); - _tcscpy(pchData, buf); - GlobalUnlock(hClipboardData); - SetClipboardData(CF_UNICODETEXT,hClipboardData); - } - CloseClipboard(); - } - free(buf); - break; - } - case IDC_DELETE: - { - int idx = 0; - int count = ListView_GetSelectedCount(dat->hList); - - if ( !count ) break; - - if ( count == ListView_GetItemCount(dat->hList)) { - LVITEM lvi = {0}; - ListView_DeleteAllItems(dat->hList); - lvi.mask = LVIF_TEXT | LVIF_IMAGE; - lvi.iImage = IMG_INFO; - lvi.pszText = TranslateT("*** Console cleared ***"); - ListView_InsertItem(dat->hList, &lvi); - dat->newline = 0; - break; - } - - while ((idx = ListView_GetNextItem(dat->hList, idx, LVNI_BELOW|LVNI_SELECTED)) > 0) - { - ListView_DeleteItem(dat->hList, idx); - idx--; - } - break; - } - case IDC_SAVE: - { - FILE *fp; - TCHAR szFile[MAX_PATH]; - - if (!Openfile(szFile, ListView_GetSelectedCount(dat->hList))) break; - - fp = _tfopen(szFile, _T("wt")); - if (fp) { - int idx = 0; - TCHAR szText[128]; - int flags = LVNI_BELOW; - if (ListView_GetSelectedCount(dat->hList)) - flags |= LVNI_SELECTED; - - while ((idx = ListView_GetNextItem(dat->hList, idx, flags)) > 0) - { - ListView_GetItemText(dat->hList, idx, 0, szText, SIZEOF(szText)-1); - _ftprintf(fp, _T("%s\n"), szText); - } - fclose(fp); - } - break; - } - case IDC_OPTIONS: - CallServiceSync(MS_NETLIB_LOGWIN,0,0); - break; - case IDC_STARTALL: - SendMessage(hwndConsole, HM_PAUSEALL, 0, 0); - break; - case IDC_PAUSEALL: - SendMessage(hwndConsole, HM_PAUSEALL, 0, 1); - break; - case IDC_CLOSE: - if (tabCount > 1) - SendMessage(hwndDlg, WM_CLOSE, 0, 0); - break; - default: - break; - } - break; - } - case WM_CLOSE: - DestroyWindow(hwndDlg); - break; - case WM_DESTROY: - SetWindowLongPtr(dat->hList, GWLP_WNDPROC, GetWindowLongPtr(dat->hList, GWLP_USERDATA)); - SendMessage(hwndConsole, HM_REMOVE, 0, (LPARAM)dat); - break; - } - - return FALSE; -} - - -//////////////////////////////////////////////////////////////////////////////// - -int ConsoleResize(HWND hwnd,LPARAM lParam,UTILRESIZECONTROL *urc) -{ - switch(urc->wId) { - case IDC_TABS: - return RD_ANCHORX_WIDTH|RD_ANCHORY_HEIGHT; - default: - return RD_ANCHORX_LEFT|RD_ANCHORY_TOP; - } -} - - -static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) -{ - switch(message) { - case WM_INITDIALOG: - { - TCHAR title[MAX_PATH]; - TCHAR name[MAX_PATH] = {0}; - TCHAR path[MAX_PATH] = {0}; - - hTabs = GetDlgItem(hwndDlg, IDC_TABS); - - //TabCtrl_SetMinTabWidth(hTabs, 100); - - // restore position - { - SAVEWINDOWPOS swp; - swp.hwnd=hwndDlg; swp.hContact=NULL; swp.szModule="Console"; swp.szNamePrefix="Console"; - CallService(MS_UTILS_RESTOREWINDOWPOSITION, RWPF_HIDDEN, (LPARAM)&swp); - } - - CallService(MS_DB_GETPROFILENAMET,(WPARAM)MAX_PATH,(LPARAM)name); - - CallService(MS_DB_GETPROFILEPATHT,(WPARAM)MAX_PATH,(LPARAM)path); - - mir_sntprintf(title, MAX_PATH, _T("%s - %s\\%s"), TranslateT("Miranda Console"), path, name); - - SetWindowText(hwndDlg, title); - SendMessage(hwndDlg,WM_SETICON,ICON_BIG,(LPARAM)hIcons[0]); - - hwndConsole = hwndDlg; - SendMessage(hwndDlg, HM_ADD, 0, 0); - PostMessage(hwndDlg, WM_SIZE, 0, 0); - break; - } - case HM_DUMP: - { - // lParam = DUMPMSG - int idx; - LOGWIN *lw; - LOGWIN lw2; - DUMPMSG *dumpMsg = (DUMPMSG*)lParam; - - if (!pActive) { - mir_free(dumpMsg); - break; - } - - if (!gSingleMode) - { - lw2.Module = dumpMsg->szModule; - if (!List_GetIndex(&lModules, &lw2, &idx)) - SendMessage(hwndDlg, HM_ADD, (WPARAM)idx, (LPARAM)dumpMsg->szModule); - - lw = (LOGWIN*)lModules.items[idx]; - } - else - lw = pActive; - - if (lw->hwnd) - SendMessage(lw->hwnd, HM_DUMP, wParam, lParam); - else - PostMessage(hwndDlg, HM_DUMP, wParam, lParam); // loop msg until window will be ready - - return TRUE; - } - case HM_ADD: - { - // wParam = index, lParam = module name - LOGWIN *lw; - COLORREF col; - TCITEM tci = {0}; - int idx = (int)wParam; - char *str = (char*)lParam; - - if (!str) str = ""; // startup window - - lw = (LOGWIN*)mir_calloc( sizeof(LOGWIN)); - lw->Module = (char*)mir_strdup(str); - List_Insert(&lModules, lw, idx); - - if (!gSingleMode && lParam) - { - tci.mask = TCIF_PARAM | TCIF_TEXT; - tci.lParam = (LPARAM)lw; - - tci.pszText = mir_a2u(lw->Module); - idx = TabCtrl_InsertItem(hTabs, tabCount, &tci); - mir_free(tci.pszText); - - tabCount++; - } - - GetClientRect(hTabs, &rcTabs); - TabCtrl_AdjustRect(hTabs, FALSE, &rcTabs); - - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_LOG), hwndDlg, LogDlgProc, (LPARAM)lw); - ShowWindow(lw->hwnd, (tabCount > 1)?SW_HIDE:SW_SHOWNOACTIVATE); - - if (pActive) - { - col = ListView_GetBkColor(pActive->hList); - ListView_SetBkColor(lw->hList, col); - ListView_SetTextBkColor(lw->hList, col); - - col = ListView_GetTextColor(pActive->hList); - ListView_SetTextColor(lw->hList, col); - - if (hfLogFont) - SendMessage(lw->hList, WM_SETFONT, (WPARAM)hfLogFont, (LPARAM)TRUE); - } - - // hide startup window - if (tabCount == 1) - { - ShowWindow(pActive->hwnd, SW_HIDE); - PostMessage(pActive->hwnd, WM_CLOSE, 0, 0); - pActive = lw; - } - - if (!pActive) - pActive = lw; - - return TRUE; - } - case HM_REMOVE: - { - // lParam = LOGWIN - LOGWIN *lw = (LOGWIN*)lParam; - - if (!lw) break; - - if (lw == pActive) - { - int tab = TabCtrl_GetCurSel(hTabs); - if (tab >= 0) - { - TCITEM tci={0}; - - TabCtrl_DeleteItem(hTabs, tab); - tabCount--; - if (tabCount) - { - tab--; - if (tab < 0 ) tab = 0; - TabCtrl_SetCurSel(hTabs, tab); - - tci.mask = TCIF_PARAM; - TabCtrl_GetItem(hTabs, tab, &tci); - pActive = (LOGWIN*)tci.lParam; - SendMessage(pActive->hwnd, WM_SIZE, 0, 0); - ScrollDown(pActive); - ShowWindow(pActive->hwnd, SW_SHOWNOACTIVATE); - SetFocus(pActive->hList); - } - else - pActive = NULL; - } - } - - List_RemovePtr(&lModules, lw); - mir_free(lw->Module); - mir_free(lw); - return TRUE; - } - case HM_SETFONT: - { - // wParam = font, lParam = font color - int i; - LOGWIN *lw; - for ( i = 0; i < lModules.realCount; i++ ) - { - lw = (LOGWIN*)lModules.items[i]; - ListView_SetTextColor(lw->hList, (COLORREF)lParam); - if (wParam) - SendMessage(lw->hList, WM_SETFONT, wParam, (LPARAM)TRUE); - } - return TRUE; - } - case HM_SETCOLOR: - { - // wParam = font, lParam = background color - int i; - LOGWIN *lw; - for ( i = 0; i < lModules.realCount; i++ ) - { - lw = (LOGWIN*)lModules.items[i]; - ListView_SetBkColor(lw->hList, (COLORREF)lParam); - ListView_SetTextBkColor(lw->hList, (COLORREF)lParam); - if (wParam) - SendMessage(lw->hList, WM_SETFONT, wParam, (LPARAM)TRUE); - } - return TRUE; - } - case HM_PAUSEALL: - { - // lParam = 1 to pause, 0 to start - int i; - LOGWIN *lw; - for ( i = 0; i < lModules.realCount; i++ ) - { - lw = (LOGWIN*)lModules.items[i]; - if (lw->Paused != (int)lParam) - SendMessage(lw->hwnd, WM_COMMAND, IDC_PAUSE, 0); - } - return TRUE; - } - case HM_RESTART: - { - if (pActive) - { - pActive = NULL; - PostMessage(hwndDlg, HM_RESTART, 0, 0); - return TRUE; - } - // close all tabs - if (!lParam) - { - LOGWIN *lw; - TabCtrl_DeleteAllItems(hTabs); - while ( lModules.realCount ) - { - lw = (LOGWIN*)lModules.items[0]; - SendMessage(lw->hwnd, WM_CLOSE, 0, 0); - } - tabCount = 0; - PostMessage(hwndDlg, HM_RESTART, 0, 1); - return TRUE; - } - - LoadSettings(); - SendMessage(hwndDlg, HM_ADD, 0, 0); - PostMessage(hwndDlg, WM_SIZE, 0, 0); - return TRUE; - } - case WM_SETFOCUS: - if (pActive) { - SetFocus(pActive->hList); - } - return TRUE; - case WM_NOTIFY: - switch(wParam) { - case IDC_TABS: - { - LPNMHDR lpnmhdr = (LPNMHDR)lParam; - if (lpnmhdr->code == TCN_SELCHANGE) - { - int newTab = TabCtrl_GetCurSel(hTabs); - if (newTab >= 0 ) - { - TCITEM tci={0}; - HWND hOld = pActive->hwnd; - - tci.mask = TCIF_PARAM; - - if (!TabCtrl_GetItem(hTabs, newTab, &tci)) break; - - pActive = (LOGWIN*)tci.lParam; - - SendMessage(pActive->hwnd, WM_SIZE, 0, 0); - ScrollDown(pActive); - ShowWindow(hOld, SW_HIDE); - ShowWindow(pActive->hwnd, SW_SHOWNOACTIVATE); - SetFocus(pActive->hList); - } else - SendMessage(pActive->hwnd, WM_SIZE, 0, 0); - } - break; - } - } - break; - case WM_SIZE: - { - UTILRESIZEDIALOG urd={0}; - urd.cbSize=sizeof(urd); - urd.hInstance=hInst; - urd.hwndDlg=hwndDlg; - urd.lpTemplate=MAKEINTRESOURCEA(IDD_CONSOLE); - urd.pfnResizer=ConsoleResize; - CallService(MS_UTILS_RESIZEDIALOG,0,(LPARAM)&urd); - - GetClientRect(hTabs, &rcTabs); - TabCtrl_AdjustRect(hTabs, FALSE, &rcTabs); - - if ( pActive ) - SendMessage(pActive->hwnd, WM_SIZE, 0, 0); - break; - } - case WM_GETMINMAXINFO: - { - MINMAXINFO *mmi=(MINMAXINFO*)lParam; - mmi->ptMinTrackSize.x=400; - mmi->ptMinTrackSize.y=200; - break; - } - case WM_CLOSE: - if ( lParam != 1 ) { - Utils_SaveWindowPosition(hwndDlg,NULL,"Console","Console"); - ShowConsole(0); - return TRUE; - } else - DestroyWindow(hwndDlg); - break; - case WM_DESTROY: - pActive = NULL; - if (hfLogFont) DeleteObject(hfLogFont); - PostQuitMessage(0); - break; - } - - return FALSE; -} - - -//////////////////////////////////////////////////////////////////////////////// - - -void __cdecl ConsoleThread(void* arg) -{ - MSG msg; - HWND hwnd; - - hwnd = CreateDialog(hInst,MAKEINTRESOURCE(IDD_CONSOLE),NULL,ConsoleDlgProc); - - if (!hwnd) return; - - while( GetMessage(&msg, NULL, 0, 0) > 0 ) - { - switch(msg.message) { - case HM_DUMP: - OutMsgs++; - break; - } - - if ( IsDialogMessage(hwnd, &msg)) - continue; - - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - hwndConsole = NULL; -} - -/////////////////////////////////////////////////////////////////////////////// - -static int OnFastDump(WPARAM wParam,LPARAM lParam) -{ - if ( pActive ) - { - LOGMSG *logMsg = (LOGMSG*)lParam; - DWORD headlen = (DWORD)strlen(logMsg->pszHead); - DWORD msglen = (DWORD)strlen(logMsg->pszMsg); - DWORD len = (headlen + msglen + 1) * sizeof(TCHAR) + sizeof(DUMPMSG); - DUMPMSG *dumpMsg = (DUMPMSG*)mir_alloc( len ); - TCHAR *str = dumpMsg->szMsg; - - strncpy(dumpMsg->szModule, ((NETLIBUSER*)wParam)->szDescriptiveName, sizeof(dumpMsg->szModule))[ sizeof(dumpMsg->szModule)-1 ] = 0; - - { - wchar_t *ucs2; - - ucs2 = mir_a2u( logMsg->pszHead ); - wcscpy(str, ucs2); - mir_free(ucs2); - - // try to detect utf8 - ucs2 = mir_utf8decodeW( logMsg->pszMsg ); - if ( !ucs2 ) - ucs2 = mir_a2u( logMsg->pszMsg ); - - wcscat( str, ucs2 ); - mir_free( ucs2 ); - } - - InMsgs++; - PostMessage(hwndConsole, HM_DUMP, 0, (LPARAM)dumpMsg); - } - return 0; -} - -/////////////////////////////////////////////////////////////////////////////// - -static void LoadSettings() -{ - gIcons = DBGetContactSettingByte(NULL, "Console", "ShowIcons", 1); - gSeparator = DBGetContactSettingByte(NULL, "Console", "Separator", 1); - gSingleMode = DBGetContactSettingByte(NULL, "Console", "SingleMode", 0); - - gWrapLen = DBGetContactSettingByte(NULL, "Console", "Wrap", DEFAULT_WRAPLEN); - if ( gWrapLen < MIN_WRAPLEN ) gWrapLen = DEFAULT_WRAPLEN; - - gLimit = DBGetContactSettingDword(NULL, "Console", "Limit", MAX_LIMIT); - if (gLimit > MAX_LIMIT) gLimit = MAX_LIMIT; - if (gLimit < MIN_LIMIT) gLimit = MIN_LIMIT; -} - - -static void SaveSettings(HWND hwndDlg) -{ - int len = GetDlgItemInt(hwndDlg, IDC_WRAP, NULL, FALSE); - if (len < MIN_WRAPLEN ) - len = MIN_WRAPLEN; - else - if (len > MAX_WRAPLEN) - len = MAX_WRAPLEN; - - gWrapLen = len; - SetDlgItemInt(hwndDlg, IDC_WRAP, gWrapLen, FALSE); - DBWriteContactSettingByte(NULL, "Console", "Wrap", (BYTE)len); - - len = GetDlgItemInt(hwndDlg, IDC_LIMIT, NULL, FALSE); - if (len < MIN_LIMIT ) - len = MIN_LIMIT; - else - if (len > MAX_LIMIT) - len = MAX_LIMIT; - - gLimit = len; - SetDlgItemInt(hwndDlg, IDC_LIMIT, gLimit, FALSE); - DBWriteContactSettingDword(NULL, "Console", "Limit", len); - - DBWriteContactSettingByte(NULL, "Console", "SingleMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SINGLE)); - DBWriteContactSettingByte(NULL, "Console", "Separator", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SEPARATOR)); - DBWriteContactSettingByte(NULL, "Console", "ShowIcons", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWICONS)); - - DBWriteContactSettingByte(NULL, "Console", "ShowAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_START)); -} - - -static INT_PTR CALLBACK OptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch(msg) { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_START, DBGetContactSettingByte(NULL, "Console", "ShowAtStart", 0)); - CheckDlgButton(hwndDlg, IDC_SINGLE, gSingleMode); - CheckDlgButton(hwndDlg, IDC_SHOWICONS, gIcons); - CheckDlgButton(hwndDlg, IDC_SEPARATOR, gSeparator); - SetDlgItemInt(hwndDlg, IDC_WRAP, gWrapLen, FALSE); - SetDlgItemInt(hwndDlg, IDC_LIMIT, gLimit, FALSE); - break; - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_RESTART: - { - if (!pActive) break; - SaveSettings(hwndDlg); - PostMessage(hwndConsole, HM_RESTART, 0, 0); - break; - } - case IDC_LIMIT: - case IDC_WRAP: - if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()) - return FALSE; - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - case IDC_START: - case IDC_SEPARATOR: - case IDC_SHOWICONS: - case IDC_SINGLE: - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - } - break; - case WM_NOTIFY: - switch(((LPNMHDR)lParam)->idFrom) - { - case 0: - switch (((LPNMHDR)lParam)->code) - { - case PSN_APPLY: - { - SaveSettings(hwndDlg); - break; - } - } - break; - } - break; - } - return FALSE; -} - - -static int OptInit(WPARAM wParam,LPARAM lParam) -{ - OPTIONSDIALOGPAGE odp={0}; - odp.cbSize = sizeof(odp); - odp.hInstance = hInst; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); - odp.pszGroup = LPGEN("Network"); - odp.pszTitle = LPGEN("Console"); - odp.pfnDlgProc = OptDlgProc; - odp.flags = ODPF_BOLDGROUPS; - odp.expertOnlyControls = NULL; - Options_AddPage(wParam, &odp); - return 0; -} - -/////////////////////////////////////////////////////////////////////////////// - -static int OnColourChange(WPARAM wParam,LPARAM lParam) -{ - if (hwndConsole) - { - ColourID cid = {0}; - COLORREF col; - - cid.cbSize=sizeof(cid); - strcpy(cid.group,"Console"); - strcpy(cid.name,"Background"); - strcpy(cid.dbSettingsGroup,"Console"); - strcpy(cid.setting,"BgColor"); - - col = (COLORREF)CallService(MS_COLOUR_GET,(WPARAM)&cid,0); - if (col != -1) - SendMessage(hwndConsole, HM_SETCOLOR, (WPARAM)hfLogFont, (LPARAM)col); - } - return 0; -} - - -static int OnFontChange(WPARAM wParam,LPARAM lParam) -{ - if (hwndConsole) - { - COLORREF col; - HFONT hf = NULL; - LOGFONT LogFont={0}; - FontIDT fid={0}; - fid.cbSize=sizeof(fid); - - _tcscpy(fid.group,_T("Console")); - _tcscpy(fid.name,TranslateT("Text")); - - col = (COLORREF)CallService(MS_FONT_GETT,(WPARAM)&fid,(LPARAM)&LogFont); - - if (LogFont.lfHeight != 0) - { - hf=CreateFontIndirect(&LogFont); - - SendMessage(hwndConsole, HM_SETFONT, (WPARAM)hf, (LPARAM)col); - - if (hfLogFont) - DeleteObject(hfLogFont); - hfLogFont = hf; - } - } - return 0; -} - -static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) -{ - HookEvent( ME_NETLIB_FASTDUMP, OnFastDump ); - - CreateServiceFunction(MS_CONSOLE_SHOW_HIDE, ShowHideConsole); - - FontIDT fid = {0}; - fid.cbSize = sizeof(fid); - _tcscpy(fid.group,_T("Console")); - _tcscpy(fid.name,TranslateT("Text")); - strcpy(fid.dbSettingsGroup,"Console"); - strcpy(fid.prefix,"ConsoleFont"); - _tcscpy(fid.backgroundGroup,_T("Console")); - _tcscpy(fid.backgroundName,_T("Background")); - fid.flags = FIDF_DEFAULTVALID; - fid.deffontsettings.charset = DEFAULT_CHARSET; - fid.deffontsettings.colour = RGB(0, 0, 0); - fid.deffontsettings.size = 10; - fid.deffontsettings.style = 0; - _tcsncpy(fid.deffontsettings.szFace, _T("Courier"), LF_FACESIZE); - FontRegisterT(&fid); - - HookEvent(ME_FONT_RELOAD,OnFontChange); - - ColourIDT cid = {0}; - cid.cbSize=sizeof(cid); - _tcscpy(cid.group,_T("Console")); - _tcscpy(cid.name,_T("Background")); - strcpy(cid.dbSettingsGroup,"Console"); - strcpy(cid.setting,"BgColor"); - cid.defcolour = RGB(255,255,255); - ColourRegisterT(&cid); - - HookEvent(ME_COLOUR_RELOAD, OnColourChange); - - HOTKEYDESC hkd = {0}; - hkd.cbSize = sizeof(hkd); - hkd.pszName = "Console_Show_Hide"; - hkd.pszDescription = LPGEN("Show/Hide Console"); - hkd.pszSection = "Main"; - hkd.pszService = MS_CONSOLE_SHOW_HIDE; - hkd.DefHotKey = HOTKEYCODE(HOTKEYF_EXT, 'C'); - Hotkey_Register(&hkd); - - if (hwndConsole && IsWindow(hwndConsole)) - { - CLISTMENUITEM mi={0}; - HookEvent(ME_TTB_MODULELOADED, OnTTBLoaded); - mi.cbSize=sizeof(mi); - mi.flags=CMIF_TCHAR; - mi.hIcon=hIcons[0]; - mi.ptszPopupName=TranslateT("&Help"); - mi.popupPosition=2000090000; - mi.position=1000000000; - mi.ptszName=(IsWindowVisible(hwndConsole))?TranslateT("Hide Console"):TranslateT("Show Console"); - mi.pszService=MS_CONSOLE_SHOW_HIDE; - hMenu = Menu_AddMainMenuItem(&mi); - - OnFontChange(0,0); - OnColourChange(0,0); - - if (DBGetContactSettingByte(NULL,"Console","ShowAtStart",0) || DBGetContactSettingByte(NULL,"Console","Show",1)) - ShowConsole(1); - else - ShowConsole(0); - } - - return 0; -} - -static int PreshutdownConsole(WPARAM wParam,LPARAM lParam) -{ - if (hwndConsole) - PostMessage(hwndConsole, WM_CLOSE, 0, 1 ); - - return 0; -} - -/////////////////////////////////////////////////////////////////////////////// - -static int stringCompare( LOGWIN *lw1, LOGWIN *lw2 ) -{ - return strcmp( lw1->Module, lw2->Module ); -} - -/////////////////////////////////////////////////////////////////////////////// - -static UINT logicons[] = {IDI_EMPTY, IDI_ARROW, IDI_IN, IDI_OUT, IDI_INFO}; - - -void InitConsole() -{ - int i; - HICON hi; - - lModules.sortFunc = (FSortFunc)stringCompare; - lModules.increment = 5; - - hIcons[0] = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONSOLE)); - hIcons[1] = (HICON)LoadImage(hInst,MAKEINTRESOURCE(IDI_NOSCROLL),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0); - hIcons[2] = (HICON)LoadImage(hInst,MAKEINTRESOURCE(IDI_PAUSED),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0); - - for(i = 0; i < SIZEOF(ctrls); i++) { - hIcons[i+ICON_FIRST] = (HICON)LoadImage(hInst,MAKEINTRESOURCE(ctrls[i].icon),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0); - } - - gImg = ImageList_Create(LOGICONX_SIZE, LOGICONY_SIZE, ILC_COLOR24 | ILC_MASK, SIZEOF(logicons), 0); - - for(i = 0; i < SIZEOF(logicons); i++) - { - hi = (HICON)LoadImage(hInst,MAKEINTRESOURCE(logicons[i]),IMAGE_ICON,LOGICONX_SIZE,LOGICONY_SIZE,0); - if (hi) - { - ImageList_AddIcon(gImg, hi); - DestroyIcon(hi); - } - } - - LoadSettings(); - - mir_forkthread(ConsoleThread, 0); - - HookEvent(ME_SYSTEM_PRESHUTDOWN, PreshutdownConsole); - HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded); - HookEvent(ME_OPT_INITIALISE, OptInit); - HookEvent(ME_NETLIB_FASTDUMP, OnFastDump); -} - -void ShutdownConsole(void) -{ - int i; - - List_Destroy(&lModules); - - if (gImg) ImageList_Destroy(gImg); - - for(i = 0; i < SIZEOF(hIcons); i++) { - if (hIcons[i]) DestroyIcon(hIcons[i]); - } -} - -//////////////////////////////////////////////////////////////////////////////// - -TCHAR *addstring(TCHAR *str, TCHAR *add) { - _tcscpy(str,add); - return str + _tcslen(add) + 1; -} - - -static int Openfile(TCHAR *outputFile, int selection) -{ - OPENFILENAME ofn = {0}; - TCHAR filename[MAX_PATH+2] = _T(""); - TCHAR *title; - - TCHAR *filter, *tmp, *tmp1, *tmp2; - tmp1 = TranslateT("Text Files (*.txt)"); - tmp2 = TranslateT("All Files"); - filter = tmp = (TCHAR*)_alloca((_tcslen(tmp1)+_tcslen(tmp2)+11)*sizeof(TCHAR)); - tmp = addstring(tmp, tmp1); - tmp = addstring(tmp, _T("*.TXT")); - tmp = addstring(tmp, tmp2); - tmp = addstring(tmp, _T("*")); - *tmp = 0; - - if (selection) - title = TranslateT("Save selection to file"); - else - title = TranslateT("Save log to file"); - - ofn.lStructSize = sizeof(ofn); - ofn.lpstrFile = filename; - ofn.lpstrFilter = filter; - ofn.Flags = OFN_HIDEREADONLY | OFN_SHAREAWARE | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT; - ofn.lpstrTitle = title; - ofn.nMaxFile = MAX_PATH; - ofn.lpstrDefExt = _T("txt"); - - if (!GetSaveFileName(&ofn)) - return 0; - _tcscpy(outputFile, filename); - return 1; -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Console/Console.vcxproj b/plugins/Console/Console.vcxproj index 821004cc92..578ba3c195 100644 --- a/plugins/Console/Console.vcxproj +++ b/plugins/Console/Console.vcxproj @@ -73,7 +73,7 @@ Disabled ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL Use @@ -97,7 +97,7 @@ Disabled ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN64;_DEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + WIN64;_DEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL Use @@ -121,7 +121,7 @@ Full AnySuitable ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;%(PreprocessorDefinitions) true true Use @@ -148,7 +148,7 @@ Full AnySuitable ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN64;NDEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + WIN64;NDEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;%(PreprocessorDefinitions) true true Use @@ -171,38 +171,20 @@ - + Create - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - + + diff --git a/plugins/Console/Console.vcxproj.filters b/plugins/Console/Console.vcxproj.filters index 7cb1fc485a..ddbba4e23a 100644 --- a/plugins/Console/Console.vcxproj.filters +++ b/plugins/Console/Console.vcxproj.filters @@ -15,82 +15,32 @@ - + Source Files - + Source Files - + Source Files - + Header Files - + Header Files - + Header Files - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - - + Resource Files - + Resource Files diff --git a/plugins/Console/Console_history.txt b/plugins/Console/Console_history.txt deleted file mode 100644 index 337cf95b0c..0000000000 --- a/plugins/Console/Console_history.txt +++ /dev/null @@ -1,179 +0,0 @@ -PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND... -ONLY MORAL SUPPORT IN SPECIAL CASES CAN BE PROVIDED 8-) --------------------------------------------------------------------------------- - -v7.3 - -[-] bug fixes - - -v7.2 - -[+] console hot restart (to apply new options) -[+] always show at start option -[*] other small changes - - -v7.1 - -[+] switch tabs with CTRL+Left/Right -[+] log size limitation -[+] icons in log -[+] event separation with empty line -[-] create "(NULL)" tab only on demand -[*] dumping optimization -[*] small changes to compile in VC6 - - -v7.0 - -[+] tabbed mode support (tab for every NETLIB user) -[+] toolbar button for clist modern -[+] options page -[*] other small changes - - -v6.6 - -[+] logging pause button -[*] log scrolling hotkey was changed to Ctrl+Q -[*] more translatable strings -[-] fixed tooltips on buttons - - -v6.5 - -[+] global hotkey to show/hide console (Win+C by default) -[+] common shortcuts in console (Ctrl+C/S/D/A/O, Del) -[*] trying to hook netlib log on load -[*] hi-res console icon - - -v6.4 - -[-] some bugfixes (unicode version only) - - -v6.3 - -[!] NETLIB was removed. using netlib log hook. -[+] unicode support -[+] ansi / utf8 autodetection and conversion -[+] faster startup/shutdown/dumping -[+] variable line wrap length - - -v6.0 - 6.2 - -[!] internal builds - - -v5.4 - -[-] workaround for "\r" in console window -[*] small speed improvements in netlib log dump -[*] merge with SVN (netlib module) - - -v5.3 - -[*] PluginInfoEx was added, some code was replaced with core services (thanx Jazzy$) -[*] merge with SVN (netlib module) - - -v5.2 - -[*] merge with SVN (netlib module) -[*] fix for crash on exit (miranda 0.7 core issue) -[+] save and restore console window position - - -v5.1 - -[-] filter settings were not saved - - -v5.0 - -[+] buttons to copy/delete/save log, open options -[+] ability to select colors and font (fontservice needed) -[*] long lines (>90 chars) are wraped -[+] list-view auto width -[*] destoying all services before unload to prevent crashes - - -v4.0 - -[*] merged with lastest netlib - - -v3.3 - -[-] packet dumps still were not shown in some cases -[+] small optimizations - - -v3.2 - -[-] fixed huge memory leak -[-] packet dumps were not shown if logging to file was off - - -v3.1 - -[!] listview control console window. richedit is too slow - - -v3.0 - -[!] richedit control console window! - -v2.0 - -[?] - -v1.9 - -[+] abitity to remember last console state - -v1.8 - -[+] profile path is shown in console title - -v1.7 - -[?] - - -v1.6 - -[-] fixed AV on msg from NULL (thanx sh8an) -[*] attempt to fix windows shutdown issues with opened miranda - -v1.5 - -[+] ability to log only custom protocols (netlibusers) -[-] console window startup workaround to prevent crashes and other bugs - -v1.4 - -[+] console window writes log even in hidden state (if Log to Console is checked) -[+] ability to hide/show console from main menu and toptoolbar button -[+] open outgoing connections with delay is now optional -[*] console startup code was rewritten -[-] pressing Ctrl+C or Ctrl+Break in console window do not close Miranda any more -[-] now console window always appears on top - -v1.3 - -[+] console window from 0.3x netlib -[+] console buffer is 100 times larger -[+] console text convertion to OEM codepage -[-] close button now always disabled -[*] some changes to unloading - --------------------------------------------------------------------------------- -[!] important note -[+] added feature -[*] improved/changed feature -[-] bug fixed diff --git a/plugins/Console/Console_readme.txt b/plugins/Console/Console_readme.txt deleted file mode 100644 index 6d66f9b061..0000000000 --- a/plugins/Console/Console_readme.txt +++ /dev/null @@ -1,21 +0,0 @@ -Console window plugin for Netlib logging. - -It is designed for Miranda developers & advanced users! 8-) - - -v7 introduced tabs support. Single window mode is also avaliable. -It can be switched in options. Icons and other stuff is avaliable. - -v6 is based on the code of v5 but without NETLIB. it uses new netlib log hook instead. -Netlib filters are still in Log Options but they are not part of console any more :). - -Also: -+ faster startup/shutdown/dumping -+ unicode support -+ ansi / utf8 autodetection and conversion -+ variable line wrap length - -Console window can be opened/closed with: - - (Top)ToolBar button - - MainMenu->Help->Show/Hide Console - - Hotkey using service "Console/Show/Hide" \ No newline at end of file diff --git a/plugins/Console/commonheaders.cpp b/plugins/Console/commonheaders.cpp deleted file mode 100644 index cbfb79d624..0000000000 --- a/plugins/Console/commonheaders.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2008 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 "commonheaders.h" \ No newline at end of file diff --git a/plugins/Console/commonheaders.h b/plugins/Console/commonheaders.h deleted file mode 100644 index 63f5a61622..0000000000 --- a/plugins/Console/commonheaders.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2008 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. -*/ - - -#define _WIN32_WINNT 0x0501 - -#pragma comment( lib, "comctl32.lib") - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define MIRANDA_VER 0x0A00 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" - -#include "version.h" - -extern HINSTANCE hInst; - -void InitConsole(); -void ShutdownConsole(); - -#define MS_NETLIB_LOGWIN "Netlib/Log/Win" diff --git a/plugins/Console/console-translation.txt b/plugins/Console/console-translation.txt deleted file mode 100644 index b590fbda35..0000000000 --- a/plugins/Console/console-translation.txt +++ /dev/null @@ -1,38 +0,0 @@ -; Common strings that belong to many files -;[] - -; ../../plugins/Console/Console.cpp -;[&Help] -;[*** Console cleared ***] -;[*** Console paused ***] -;[*** Console resumed ***] -;[*** Console started ***] -;[All Files] -;[Console] -;[Hide Console] -;[Miranda Console] -;[Network] -;[Save log to file] -;[Save selection to file] -;[Show Console] -;[Show/Hide Console] -;[Text] -;[Text Files (*.txt)] - -; ../../plugins/Console/resource.rc -;[&C] -;[&D] -;[&O] -;[&P] -;[&Q] -;[&S] -;[&W] -;[* Restart needed] -;[Always show at start] -;[Console ] -;[Lines wrap length [25-255]] -;[Log size limit [1 000 - 1 000 000 lines]] -;[New lines between events*] -;[Save settings and restart console] -;[Show icons in log*] -;[Single window mode*] diff --git a/plugins/Console/docs/Console_history.txt b/plugins/Console/docs/Console_history.txt new file mode 100644 index 0000000000..337cf95b0c --- /dev/null +++ b/plugins/Console/docs/Console_history.txt @@ -0,0 +1,179 @@ +PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND... +ONLY MORAL SUPPORT IN SPECIAL CASES CAN BE PROVIDED 8-) +-------------------------------------------------------------------------------- + +v7.3 + +[-] bug fixes + + +v7.2 + +[+] console hot restart (to apply new options) +[+] always show at start option +[*] other small changes + + +v7.1 + +[+] switch tabs with CTRL+Left/Right +[+] log size limitation +[+] icons in log +[+] event separation with empty line +[-] create "(NULL)" tab only on demand +[*] dumping optimization +[*] small changes to compile in VC6 + + +v7.0 + +[+] tabbed mode support (tab for every NETLIB user) +[+] toolbar button for clist modern +[+] options page +[*] other small changes + + +v6.6 + +[+] logging pause button +[*] log scrolling hotkey was changed to Ctrl+Q +[*] more translatable strings +[-] fixed tooltips on buttons + + +v6.5 + +[+] global hotkey to show/hide console (Win+C by default) +[+] common shortcuts in console (Ctrl+C/S/D/A/O, Del) +[*] trying to hook netlib log on load +[*] hi-res console icon + + +v6.4 + +[-] some bugfixes (unicode version only) + + +v6.3 + +[!] NETLIB was removed. using netlib log hook. +[+] unicode support +[+] ansi / utf8 autodetection and conversion +[+] faster startup/shutdown/dumping +[+] variable line wrap length + + +v6.0 - 6.2 + +[!] internal builds + + +v5.4 + +[-] workaround for "\r" in console window +[*] small speed improvements in netlib log dump +[*] merge with SVN (netlib module) + + +v5.3 + +[*] PluginInfoEx was added, some code was replaced with core services (thanx Jazzy$) +[*] merge with SVN (netlib module) + + +v5.2 + +[*] merge with SVN (netlib module) +[*] fix for crash on exit (miranda 0.7 core issue) +[+] save and restore console window position + + +v5.1 + +[-] filter settings were not saved + + +v5.0 + +[+] buttons to copy/delete/save log, open options +[+] ability to select colors and font (fontservice needed) +[*] long lines (>90 chars) are wraped +[+] list-view auto width +[*] destoying all services before unload to prevent crashes + + +v4.0 + +[*] merged with lastest netlib + + +v3.3 + +[-] packet dumps still were not shown in some cases +[+] small optimizations + + +v3.2 + +[-] fixed huge memory leak +[-] packet dumps were not shown if logging to file was off + + +v3.1 + +[!] listview control console window. richedit is too slow + + +v3.0 + +[!] richedit control console window! + +v2.0 + +[?] + +v1.9 + +[+] abitity to remember last console state + +v1.8 + +[+] profile path is shown in console title + +v1.7 + +[?] + + +v1.6 + +[-] fixed AV on msg from NULL (thanx sh8an) +[*] attempt to fix windows shutdown issues with opened miranda + +v1.5 + +[+] ability to log only custom protocols (netlibusers) +[-] console window startup workaround to prevent crashes and other bugs + +v1.4 + +[+] console window writes log even in hidden state (if Log to Console is checked) +[+] ability to hide/show console from main menu and toptoolbar button +[+] open outgoing connections with delay is now optional +[*] console startup code was rewritten +[-] pressing Ctrl+C or Ctrl+Break in console window do not close Miranda any more +[-] now console window always appears on top + +v1.3 + +[+] console window from 0.3x netlib +[+] console buffer is 100 times larger +[+] console text convertion to OEM codepage +[-] close button now always disabled +[*] some changes to unloading + +-------------------------------------------------------------------------------- +[!] important note +[+] added feature +[*] improved/changed feature +[-] bug fixed diff --git a/plugins/Console/docs/Console_readme.txt b/plugins/Console/docs/Console_readme.txt new file mode 100644 index 0000000000..6d66f9b061 --- /dev/null +++ b/plugins/Console/docs/Console_readme.txt @@ -0,0 +1,21 @@ +Console window plugin for Netlib logging. + +It is designed for Miranda developers & advanced users! 8-) + + +v7 introduced tabs support. Single window mode is also avaliable. +It can be switched in options. Icons and other stuff is avaliable. + +v6 is based on the code of v5 but without NETLIB. it uses new netlib log hook instead. +Netlib filters are still in Log Options but they are not part of console any more :). + +Also: ++ faster startup/shutdown/dumping ++ unicode support ++ ansi / utf8 autodetection and conversion ++ variable line wrap length + +Console window can be opened/closed with: + - (Top)ToolBar button + - MainMenu->Help->Show/Hide Console + - Hotkey using service "Console/Show/Hide" \ No newline at end of file diff --git a/plugins/Console/docs/console-translation.txt b/plugins/Console/docs/console-translation.txt new file mode 100644 index 0000000000..b590fbda35 --- /dev/null +++ b/plugins/Console/docs/console-translation.txt @@ -0,0 +1,38 @@ +; Common strings that belong to many files +;[] + +; ../../plugins/Console/Console.cpp +;[&Help] +;[*** Console cleared ***] +;[*** Console paused ***] +;[*** Console resumed ***] +;[*** Console started ***] +;[All Files] +;[Console] +;[Hide Console] +;[Miranda Console] +;[Network] +;[Save log to file] +;[Save selection to file] +;[Show Console] +;[Show/Hide Console] +;[Text] +;[Text Files (*.txt)] + +; ../../plugins/Console/resource.rc +;[&C] +;[&D] +;[&O] +;[&P] +;[&Q] +;[&S] +;[&W] +;[* Restart needed] +;[Always show at start] +;[Console ] +;[Lines wrap length [25-255]] +;[Log size limit [1 000 - 1 000 000 lines]] +;[New lines between events*] +;[Save settings and restart console] +;[Show icons in log*] +;[Single window mode*] diff --git a/plugins/Console/docs/gpl.txt b/plugins/Console/docs/gpl.txt new file mode 100644 index 0000000000..45645b4b53 --- /dev/null +++ b/plugins/Console/docs/gpl.txt @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/plugins/Console/gpl.txt b/plugins/Console/gpl.txt deleted file mode 100644 index 45645b4b53..0000000000 --- a/plugins/Console/gpl.txt +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/plugins/Console/init.cpp b/plugins/Console/init.cpp deleted file mode 100644 index 58943d2c6a..0000000000 --- a/plugins/Console/init.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2008 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 "commonheaders.h" - -DWORD mirandaVer; -int hLangpack; -HINSTANCE hInst; - -PLUGININFOEX pluginInfoEx={ - sizeof(PLUGININFOEX), - __PLUGIN_NAME, - __VERSION_DWORD, - __PLUGIN_LONGDESC, - __PLUGIN_AUTHOR, - __PLUGIN_EMAIL, - __PLUGIN_RIGHTS, - __PLUGIN_URL, - UNICODE_AWARE, - MIID_CONSOLE -}; - -BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) -{ - hInst = hinstDLL; - return TRUE; -} - -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) -{ - return &pluginInfoEx; -} - -// we implement service mode interface -static const MUUID interfaces[] = {MIID_LOGWINDOW, MIID_LAST}; -extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) -{ - return interfaces; -} - -extern "C" __declspec(dllexport) int Load(void) -{ - mir_getLP(&pluginInfoEx); - - InitCommonControls(); - InitConsole(); - return 0; -} - -extern "C" __declspec(dllexport) int Unload(void) -{ - ShutdownConsole(); - return 0; -} \ No newline at end of file diff --git a/plugins/Console/res/resource.rc b/plugins/Console/res/resource.rc new file mode 100644 index 0000000000..c6c2718250 --- /dev/null +++ b/plugins/Console/res/resource.rc @@ -0,0 +1,171 @@ +// Microsoft Visual C++ generated resource script. +// +#include "..\src\resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_CONSOLE DIALOGEX 0, 0, 335, 257 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | + WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +CAPTION "Console " +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + CONTROL "",IDC_TABS,"SysTabControl32",TCS_FOCUSNEVER | + WS_CLIPSIBLINGS | WS_TABSTOP,0,0,335,257 +END + +IDD_LOG DIALOGEX 0, 0, 335, 257 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN +FONT 10, "Courier", 0, 0, 0x1 +BEGIN + CONTROL "List1",IDC_LIST,"SysListView32",LVS_REPORT | + LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER | + LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,0,18,335,239 + CONTROL "",IDC_SAVE,"MButtonClass",WS_TABSTOP,0,1,14,16, + 0x18000000L + CONTROL "",IDC_PAUSE,"MButtonClass",WS_TABSTOP,16,1,14,16, + 0x18000000L + CONTROL "",IDC_SCROLL,"MButtonClass",WS_TABSTOP,32,1,14,16, + 0x18000000L + CONTROL "",IDC_COPY,"MButtonClass",WS_TABSTOP,48,1,14,16, + 0x18000000L + CONTROL "",IDC_DELETE,"MButtonClass",WS_TABSTOP,64,1,14,16, + 0x18000000L + CONTROL "",IDC_OPTIONS,"MButtonClass",WS_TABSTOP,80,1,14,16, + 0x18000000L + CONTROL "",IDC_STARTALL,"MButtonClass",WS_TABSTOP,278,1,14,16, + 0x18000000L + CONTROL "",IDC_PAUSEALL,"MButtonClass",WS_TABSTOP,294,1,14,16, + 0x18000000L + CONTROL "",IDC_CLOSE,"MButtonClass",WS_TABSTOP,320,1,14,16, + 0x18000000L +END + +IDD_OPTIONS DIALOGEX 0, 0, 314, 239 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + CONTROL "Single window mode*",IDC_SINGLE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,8,9,297,10 + CONTROL "Show icons in log*",IDC_SHOWICONS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,8,24,297,10 + CONTROL "New lines between events*",IDC_SEPARATOR,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,8,39,297,10 + CONTROL "Always show at start",IDC_START,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,8,54,297,10 + EDITTEXT IDC_WRAP,8,69,23,11,ES_RIGHT | ES_NUMBER + EDITTEXT IDC_LIMIT,8,86,59,11,ES_RIGHT | ES_NUMBER + LTEXT "Lines wrap length [25-255]",IDC_STATIC,35,70,272,10 + LTEXT "Log size limit [1 000 - 1 000 000 lines]",IDC_STATIC,71, + 86,236,10 + LTEXT "* Restart needed",IDC_STATIC,8,106,296,10 + PUSHBUTTON "Save settings and restart console",IDC_RESTART,12,129, + 287,17 +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include \r\n" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_COPY ICON "copy.ico" +IDI_CONSOLE ICON "console.ico" +IDI_NOSCROLL ICON "noscroll.ico" +IDI_SCROLL ICON "scroll.ico" +IDI_SAVE ICON "save.ico" +IDI_DELETE ICON "delete.ico" +IDI_OPTIONS ICON "options.ico" +IDI_PAUSED ICON "paused.ico" +IDI_STARTED ICON "started.ico" +IDI_BTN_UP ICON "btn_up.ico" +IDI_BTN_DN ICON "btn_dn.ico" +IDI_CLOSE ICON "close.ico" +IDI_PAUSE ICON "pause.ico" +IDI_START ICON "start.ico" +IDI_IN ICON "in.ico" +IDI_OUT ICON "out.ico" +IDI_ARROW ICON "arrow.ico" +IDI_INFO ICON "info.ico" +IDI_EMPTY ICON "empty.ico" +IDI_CONSOLE_UP ICON "console_up.ico" +IDI_CONSOLE_DOWN ICON "console_dn.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_CONSOLE, DIALOG + BEGIN + BOTTOMMARGIN, 256 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/plugins/Console/res/version.rc b/plugins/Console/res/version.rc new file mode 100644 index 0000000000..d095fdddac --- /dev/null +++ b/plugins/Console/res/version.rc @@ -0,0 +1,63 @@ +// Microsoft Visual C++ generated resource script. +// +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include +#include <..\src\version.h> +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION __FILEVERSION_STRING + PRODUCTVERSION __FILEVERSION_STRING + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "FileDescription", __PLUGIN_DESC + VALUE "FileVersion", __VERSION_STRING + VALUE "InternalName", __PLUGIN_SHORTNAME + VALUE "LegalCopyright", __PLUGIN_RIGHTS + VALUE "OriginalFilename", __PLUGIN_FILE + VALUE "ProductName", __PLUGIN_SHORTNAME + VALUE "ProductVersion", __VERSION_STRING + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END + +#endif diff --git a/plugins/Console/resource.h b/plugins/Console/resource.h deleted file mode 100644 index a8947819a4..0000000000 --- a/plugins/Console/resource.h +++ /dev/null @@ -1,58 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by resource.rc -// -#define IDI_CONSOLE_UP 100 -#define IDI_CONSOLE_DOWN 101 -#define IDD_MSG 111 -#define IDD_CONSOLE 112 -#define IDD_LOG 113 -#define IDD_OPTIONS 114 -#define IDI_COPY 402 -#define IDI_NOSCROLL 403 -#define IDI_SCROLL 404 -#define IDI_SAVE 405 -#define IDI_DELETE 406 -#define IDI_OPTIONS 407 -#define IDI_PAUSED 408 -#define IDI_STARTED 409 -#define IDI_BTN_UP 410 -#define IDI_BTN_DN 411 -#define IDI_CLOSE 412 -#define IDI_START 413 -#define IDI_PAUSE 414 -#define IDI_IN 415 -#define IDI_OUT 416 -#define IDI_ARROW 417 -#define IDI_INFO 418 -#define IDI_EMPTY 419 -#define IDC_TABS 1000 -#define IDC_LIST 1001 -#define IDC_SAVE 1002 -#define IDC_PAUSE 1003 -#define IDC_SCROLL 1004 -#define IDC_COPY 1005 -#define IDC_DELETE 1006 -#define IDC_OPTIONS 1007 -#define IDI_CONSOLE 1008 -#define IDC_CLOSE 1009 -#define IDC_PAUSEALL 1010 -#define IDC_STARTALL 1011 -#define IDC_SINGLE 1012 -#define IDC_WRAP 1013 -#define IDC_SHOWICONS 1014 -#define IDC_SEPARATOR 1015 -#define IDC_LIMIT 1016 -#define IDC_START 1017 -#define IDC_RESTART 1018 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 115 -#define _APS_NEXT_COMMAND_VALUE 40000 -#define _APS_NEXT_CONTROL_VALUE 1019 -#define _APS_NEXT_SYMED_VALUE 102 -#endif -#endif diff --git a/plugins/Console/resource.rc b/plugins/Console/resource.rc deleted file mode 100644 index 77507e3c77..0000000000 --- a/plugins/Console/resource.rc +++ /dev/null @@ -1,176 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include -#include -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_CONSOLE DIALOGEX 0, 0, 335, 257 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | - WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME -CAPTION "Console " -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - CONTROL "",IDC_TABS,"SysTabControl32",TCS_FOCUSNEVER | - WS_CLIPSIBLINGS | WS_TABSTOP,0,0,335,257 -END - -IDD_LOG DIALOGEX 0, 0, 335, 257 -STYLE DS_SETFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN -FONT 10, "Courier", 0, 0, 0x1 -BEGIN - CONTROL "List1",IDC_LIST,"SysListView32",LVS_REPORT | - LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER | - LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,0,18,335,239 - CONTROL "",IDC_SAVE,"MButtonClass",WS_TABSTOP,0,1,14,16, - 0x18000000L - CONTROL "",IDC_PAUSE,"MButtonClass",WS_TABSTOP,16,1,14,16, - 0x18000000L - CONTROL "",IDC_SCROLL,"MButtonClass",WS_TABSTOP,32,1,14,16, - 0x18000000L - CONTROL "",IDC_COPY,"MButtonClass",WS_TABSTOP,48,1,14,16, - 0x18000000L - CONTROL "",IDC_DELETE,"MButtonClass",WS_TABSTOP,64,1,14,16, - 0x18000000L - CONTROL "",IDC_OPTIONS,"MButtonClass",WS_TABSTOP,80,1,14,16, - 0x18000000L - CONTROL "",IDC_STARTALL,"MButtonClass",WS_TABSTOP,278,1,14,16, - 0x18000000L - CONTROL "",IDC_PAUSEALL,"MButtonClass",WS_TABSTOP,294,1,14,16, - 0x18000000L - CONTROL "",IDC_CLOSE,"MButtonClass",WS_TABSTOP,320,1,14,16, - 0x18000000L -END - -IDD_OPTIONS DIALOGEX 0, 0, 314, 239 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - CONTROL "Single window mode*",IDC_SINGLE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8,9,297,10 - CONTROL "Show icons in log*",IDC_SHOWICONS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8,24,297,10 - CONTROL "New lines between events*",IDC_SEPARATOR,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8,39,297,10 - CONTROL "Always show at start",IDC_START,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8,54,297,10 - EDITTEXT IDC_WRAP,8,69,23,11,ES_RIGHT | ES_NUMBER - EDITTEXT IDC_LIMIT,8,86,59,11,ES_RIGHT | ES_NUMBER - LTEXT "Lines wrap length [25-255]",IDC_STATIC,35,70,272,10 - LTEXT "Log size limit [1 000 - 1 000 000 lines]",IDC_STATIC,71, - 86,236,10 - LTEXT "* Restart needed",IDC_STATIC,8,106,296,10 - PUSHBUTTON "Save settings and restart console",IDC_RESTART,12,129, - 287,17 -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include \r\n" - "#include \r\n" - "#include \r\n" - "#include \r\n" - "#include \0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_COPY ICON "Res\\copy.ico" -IDI_CONSOLE ICON "res\\console.ico" -IDI_NOSCROLL ICON "Res\\noscroll.ico" -IDI_SCROLL ICON "Res\\scroll.ico" -IDI_SAVE ICON "Res\\save.ico" -IDI_DELETE ICON "Res\\delete.ico" -IDI_OPTIONS ICON "Res\\options.ico" -IDI_PAUSED ICON "Res\\paused.ico" -IDI_STARTED ICON "Res\\started.ico" -IDI_BTN_UP ICON "Res\\btn_up.ico" -IDI_BTN_DN ICON "Res\\btn_dn.ico" -IDI_CLOSE ICON "Res\\close.ico" -IDI_PAUSE ICON "Res\\pause.ico" -IDI_START ICON "Res\\start.ico" -IDI_IN ICON "Res\\in.ico" -IDI_OUT ICON "Res\\out.ico" -IDI_ARROW ICON "Res\\arrow.ico" -IDI_INFO ICON "Res\\info.ico" -IDI_EMPTY ICON "Res\\empty.ico" -IDI_CONSOLE_UP ICON "Res\\console_up.ico" -IDI_CONSOLE_DOWN ICON "Res\\console_dn.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_CONSOLE, DIALOG - BEGIN - BOTTOMMARGIN, 256 - END -END -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp new file mode 100644 index 0000000000..b04be4dc39 --- /dev/null +++ b/plugins/Console/src/Console.cpp @@ -0,0 +1,1430 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2008 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 "commonheaders.h" + +#define MS_CONSOLE_SHOW_HIDE "Console/Show/Hide" + +#define DEFAULT_WRAPLEN 90 +#define MIN_WRAPLEN 25 +#define MAX_WRAPLEN 255 + +#define MIN_LIMIT 1000 +#define MAX_LIMIT 1000000 + +#define IMG_EMPTY 0 +#define IMG_ARROW 1 +#define IMG_IN 2 +#define IMG_OUT 3 +#define IMG_INFO 4 + +#define LOGICONX_SIZE 10 +#define LOGICONY_SIZE 10 + +#define ICON_FIRST 3 + +#define ICON_NOSCROLL 1 +#define ICON_PAUSED 2 +#define ICON_SCROLL 3 +#define ICON_STARTED 4 + +#define HM_DUMP (WM_USER+10) +#define HM_ADD (WM_USER+11) +#define HM_REMOVE (WM_USER+12) +#define HM_SETFONT (WM_USER+13) +#define HM_SETCOLOR (WM_USER+14) +#define HM_PAUSEALL (WM_USER+15) +#define HM_RESTART (WM_USER+16) + + +typedef struct { + const char* pszHead; + const char* pszMsg; +} LOGMSG; + + +typedef struct { + char szModule[128]; + TCHAR szMsg[1]; +} DUMPMSG; + + +typedef struct { + HWND hwnd; + HWND hList; + char *Module; + int Scroll; + int Paused; + int newline; +} LOGWIN; + + + +static SortedList lModules = {0}; + +static LOGWIN *pActive = NULL; +static int tabCount = 0; +static RECT rcTabs = {0}; +static HWND hTabs = NULL; +static HWND hwndConsole = NULL; + +static HIMAGELIST gImg = NULL; +static HFONT hfLogFont = NULL; + +static int gIcons = 0; +static int gVisible = 0; +static int gSingleMode = 0; +static int gLimit = 0; +static int gSeparator = 0; + +static DWORD gWrapLen = DEFAULT_WRAPLEN; + +static DWORD OutMsgs = 0; +static DWORD InMsgs = 0; + +static HICON hIcons[15] = {0}; +static HANDLE hMenu = NULL; + +static void LoadSettings(); +static void ShowConsole(int show); +static INT_PTR ShowHideConsole(WPARAM wParam, LPARAM lParam); +static int Openfile(TCHAR *outputFile, int selection); + +//////////////////////////////////////////////////////////////////////////////// + +static HANDLE hTTBButt = 0; + +static INT_PTR HideConsoleButt(WPARAM wParam,LPARAM lParam) +{ + ShowConsole(0); + return 0; +} + +static INT_PTR ShowConsoleButt(WPARAM wParam,LPARAM lParam) +{ + ShowConsole(1); + return 0; +} + +static int OnTTBLoaded(WPARAM wParam,LPARAM lParam) +{ + if ( !IsWindow(hwndConsole)) + return 0; + + int state = IsWindowVisible(hwndConsole); + + CreateServiceFunction("Console/Hide", HideConsoleButt); + CreateServiceFunction("Console/Show", ShowConsoleButt); + + TTBButton ttbb = {0}; + ttbb.cbSize = sizeof(ttbb); + + TCHAR szModuleFileName[MAX_PATH]={0}; + GetModuleFileName(hInst, szModuleFileName, SIZEOF(szModuleFileName)); + + SKINICONDESC sid={0}; + sid.cbSize = sizeof(sid); + sid.pszSection = "Console"; + sid.ptszDefaultFile = szModuleFileName; + sid.flags = SIDF_PATH_TCHAR; + sid.pszDescription = "Show"; + sid.pszName = "Console_Up"; + sid.iDefaultIndex = -IDI_BTN_UP; + ttbb.hIconHandleUp = Skin_AddIcon(&sid); + + sid.pszDescription = "Hide"; + sid.pszName = "Console_Down"; + sid.iDefaultIndex = -IDI_BTN_DN; + ttbb.hIconHandleDn = Skin_AddIcon(&sid); + + ttbb.dwFlags = (state ? TTBBF_PUSHED : 0) | TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; + ttbb.pszService = "Console/Hide"; + ttbb.name = LPGEN("Show/Hide Console"); + ttbb.pszTooltipDn = LPGEN("Hide Console"); + ttbb.pszTooltipUp = LPGEN("Show Console"); + hTTBButt = TopToolbar_AddButton(&ttbb); + if (hTTBButt) + CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, (LPARAM)(state?TTBST_PUSHED:TTBST_RELEASED)); + + return 0; +} + +//////////////////////////////////////////////////////////////////////////////// + +void ScrollDown(LOGWIN * dat) { + if (dat->Scroll) + ListView_EnsureVisible(dat->hList, ListView_GetItemCount(dat->hList) - 1, FALSE); +} + +//////////////////////////////////////////////////////////////////////////////// + +static void ShowConsole(int show) +{ + HWND hwnd = NULL; + + if (!hwndConsole || !pActive) return; + + gVisible = show; + + if (show) { + hwnd = GetForegroundWindow(); + if ( InMsgs == OutMsgs ) + ScrollDown( pActive ); + } + ShowWindow(hwndConsole, (show)?SW_SHOW:SW_HIDE); + DBWriteContactSettingByte(NULL,"Console","Show",(BYTE)((show)?1:0)); + + if (hwnd) + SetForegroundWindow(hwnd); + + if (show) + RedrawWindow(pActive->hList, NULL, NULL, RDW_INVALIDATE | RDW_FRAME |RDW_UPDATENOW | RDW_ERASE); + + if (hMenu) + { + CLISTMENUITEM mi = {0}; + + mi.cbSize = sizeof(mi); + mi.ptszName=(show)?TranslateT("Hide Console"):TranslateT("Show Console"); + mi.flags = CMIM_NAME | CMIF_TCHAR; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenu, (LPARAM)&mi); + } + + if (hTTBButt) + CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, (show)?TTBST_PUSHED:TTBST_RELEASED); +} + +//////////////////////////////////////////////////////////////////////////////// + +static INT_PTR ShowHideConsole(WPARAM wParam, LPARAM lParam) +{ + if (hwndConsole) + ShowConsole(!IsWindowVisible(hwndConsole)); + + return 0; +} + +//////////////////////////////////////////////////////////////////////////////// + +int LogResize(HWND hwnd,LPARAM lParam,UTILRESIZECONTROL *urc) +{ + switch(urc->wId) { + case IDC_LIST: + ListView_SetColumnWidth(GetDlgItem(hwnd, IDC_LIST), 0, urc->dlgNewSize.cx - 25); + return RD_ANCHORX_WIDTH|RD_ANCHORY_HEIGHT; + case IDC_STARTALL: + case IDC_PAUSEALL: + case IDC_CLOSE: + return RD_ANCHORX_RIGHT|RD_ANCHORY_TOP; + default: + return RD_ANCHORX_LEFT|RD_ANCHORY_TOP; + } +} + +//////////////////////////////////////////////////////////////////////////////// + +typedef struct +{ + UINT control; + UINT icon; + int type; + TCHAR *tooltip; +} controlinfo; + + +static controlinfo ctrls[] = +{ + // IDC_SCROLL & IDC_PAUSE must be first + {IDC_SCROLL, IDI_SCROLL, BUTTONSETASFLATBTN, _T("Scrolling (Ctrl+Q)")}, + {IDC_PAUSE, IDI_STARTED, BUTTONSETASFLATBTN, _T("Pause logging(Ctrl+P)")}, + {IDC_SAVE, IDI_SAVE, BUTTONSETASFLATBTN, _T("Save log to file (Ctrl+S)")}, + {IDC_COPY, IDI_COPY, BUTTONSETASFLATBTN, _T("Copy selected log (Ctrl+C)")}, + {IDC_DELETE, IDI_DELETE, BUTTONSETASFLATBTN, _T("Delete selected (Del)")}, + {IDC_OPTIONS, IDI_OPTIONS, BUTTONSETASFLATBTN, _T("Log options (Ctrl+O)")}, + {IDC_STARTALL, IDI_START, BUTTONSETASFLATBTN, _T("Start logging in all tabs")}, + {IDC_PAUSEALL, IDI_PAUSE, BUTTONSETASFLATBTN, _T("Pause logging in all tabs")}, + {IDC_CLOSE, IDI_CLOSE, BUTTONSETASFLATBTN, _T("Close tab (Ctrl+W)")}, +}; + +//////////////////////////////////////////////////////////////////////////////// + +static LRESULT CALLBACK SubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) +{ + int ctrl = GetKeyState(VK_CONTROL)&0x8000; + + switch (msg) { + + case WM_KEYDOWN: + if ( wParam == VK_DELETE && !ctrl) { + SendMessage(GetParent(hwnd), WM_COMMAND, IDC_DELETE, 0); + break; + } + + if (wParam == VK_LEFT && ctrl) + { + NMHDR nmhdr = {0}; + int tab = TabCtrl_GetCurSel(hTabs); + + if (tab == 0) + tab = TabCtrl_GetItemCount(hTabs)-1; + else + tab--; + + TabCtrl_SetCurSel(hTabs, tab); + nmhdr.code = TCN_SELCHANGE; + SendMessage(hwndConsole, WM_NOTIFY, IDC_TABS, (LPARAM)&nmhdr); + break; + } + + if (wParam == VK_RIGHT && ctrl) + { + NMHDR nmhdr = {0}; + int tab = TabCtrl_GetCurSel(hTabs); + int count = TabCtrl_GetItemCount(hTabs); + tab = (tab + 1) % count; + + TabCtrl_SetCurSel(hTabs, tab); + nmhdr.code = TCN_SELCHANGE; + SendMessage(hwndConsole, WM_NOTIFY, IDC_TABS, (LPARAM)&nmhdr); + break; + } + + break; + + case WM_CHAR: +/* + { + char t[32]; + sprintf(t,"%u\n",wParam); + OutputDebugStringA(t); + } +*/ + // CTRL + if ( !(GetKeyState(VK_CONTROL)&0x8000)) + break; + + switch(wParam) { + + case 1: // Ctrl+A + if ( ListView_GetSelectedCount(hwnd) != (UINT)ListView_GetItemCount(hwnd)) + ListView_SetItemState(hwnd, -1, LVIS_SELECTED, LVIS_SELECTED); + return 0; + + case 3: // Ctrl+D + SendMessage(GetParent(hwnd), WM_COMMAND, IDC_COPY, 0); + return 0; + + case 15: // Ctrl+O + SendMessage(GetParent(hwnd), WM_COMMAND, IDC_OPTIONS, 0); + return 0; + + case 16: // Ctrl+P + SendMessage(GetParent(hwnd), WM_COMMAND, IDC_PAUSE, 0); + return 0; + + case 17: // Ctrl+Q + SendMessage(GetParent(hwnd), WM_COMMAND, IDC_SCROLL, 0); + return 0; + + case 19: // Ctrl+S + SendMessage(GetParent(hwnd), WM_COMMAND, IDC_SAVE, 0); + return 0; + + case 23: // Ctrl+W + SendMessage(GetParent(hwnd), WM_COMMAND, IDC_CLOSE, 0); + return 0; + } + break; + } + return CallWindowProc((WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA),hwnd,msg,wParam,lParam); +} + +//////////////////////////////////////////////////////////////////////////////// + +static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) +{ + + LOGWIN *dat = (LOGWIN*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + + switch(message) { + case WM_INITDIALOG: + { + dat = (LOGWIN*)lParam; + + dat->hwnd = hwndDlg; + dat->Scroll = 1; + dat->Paused = 0; + dat->hList = GetDlgItem(hwndDlg, IDC_LIST); + + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG)dat); + SetWindowLongPtr(dat->hList, GWLP_USERDATA, SetWindowLongPtr(dat->hList, GWLP_WNDPROC, (LONG)SubclassProc)); + + // init buttons + { + int i; + HWND hwnd; + for(i = 0; i < SIZEOF(ctrls); i++) { + hwnd = GetDlgItem(hwndDlg,ctrls[i].control); + SendMessage(hwnd, ctrls[i].type, 0, 0); + SendMessage(hwnd, BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[i+ICON_FIRST]); + SendMessage(hwnd, BUTTONADDTOOLTIP,(WPARAM)TranslateTS(ctrls[i].tooltip), BATF_TCHAR); + } + } + + CheckDlgButton(hwndDlg,IDC_SCROLL,dat->Scroll?BST_CHECKED:BST_UNCHECKED); + SendDlgItemMessage(hwndDlg,IDC_SCROLL,BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[(dat->Scroll?ICON_SCROLL:ICON_NOSCROLL)]); + + if (gSingleMode) + { + ShowWindow(GetDlgItem(hwndDlg, IDC_PAUSEALL), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_STARTALL), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_CLOSE), SW_HIDE); + } + + // init listview + { + LVITEM lvi = {0}; + LVCOLUMN sLC; + //ListView_SetUnicodeFormat(dat->hList, TRUE); + ListView_SetImageList(dat->hList, gImg, LVSIL_SMALL); + sLC.mask = LVCF_FMT | LVCF_WIDTH; + sLC.fmt = LVCFMT_LEFT; + sLC.cx = 630; + ListView_InsertColumn(dat->hList, 0, &sLC); + ListView_SetExtendedListViewStyle(dat->hList, LVS_EX_FULLROWSELECT); + + lvi.mask = LVIF_TEXT; + if (gIcons) + { + lvi.mask |= LVIF_IMAGE; + lvi.iImage = IMG_INFO; + } + + lvi.pszText = TranslateT("*** Console started ***"); + ListView_InsertItem(dat->hList, &lvi); + } + + SendMessage(hwndDlg, WM_SIZE, 0, 0); + break; + } + case HM_DUMP: + { + // lParam = DUMPMSG + if (!lParam) break; + if (dat && !dat->Paused) + { + LVITEM lvi = {0}; + int last = 0x7fffffff; + TCHAR szBreak; + DWORD len, tmplen; + DWORD wraplen = gWrapLen; + TCHAR *str = ((DUMPMSG*)lParam)->szMsg; + + lvi.iItem = 0x7fffffff; + + str = _tcstok(str, _T("\n")); + + if (gIcons && str != NULL) + { + lvi.mask = LVIF_TEXT | LVIF_IMAGE; + + if (_tcsstr(str, _T("Data received"))) + { + if (gSeparator) ListView_InsertItem(dat->hList, &lvi); + lvi.iImage = IMG_IN; + } + else + if (_tcsstr(str, _T("Data sent"))) + { + if (gSeparator) ListView_InsertItem(dat->hList, &lvi); + lvi.iImage = IMG_OUT; + } + else + { + if (gSeparator && dat->newline) + { + ListView_InsertItem(dat->hList, &lvi); + dat->newline = 0; + } + lvi.iImage = IMG_INFO; + } + } else + lvi.mask = LVIF_TEXT; + + while (str != NULL) + { + lvi.pszText = &str[0]; + tmplen = len = (DWORD)_tcslen(lvi.pszText); + + while(len > wraplen) + { + szBreak = lvi.pszText[wraplen]; + lvi.pszText[wraplen] = 0; + last = ListView_InsertItem(dat->hList, &lvi); + lvi.pszText[wraplen] = szBreak; + len -= wraplen; + lvi.pszText = &str[0] + tmplen - len; + + dat->newline = 1; + lvi.iImage = IMG_EMPTY; + } + + if (len && lvi.pszText[len-1] == '\r') + lvi.pszText[len-1] = 0; + + last = ListView_InsertItem(dat->hList, &lvi); + + str = _tcstok(NULL, _T("\n")); + + if (str) dat->newline = 1; + lvi.iImage = IMG_EMPTY; + } + + + if ( gVisible && dat == pActive && dat->Scroll == 1 ) + ListView_EnsureVisible(dat->hList, last, FALSE); + + if (last > gLimit) + { + int idx = last - gLimit + gLimit/4; // leave only 75% of LIMIT + + while (idx >= 0) + { + ListView_DeleteItem(dat->hList, idx); + idx--; + } + } + } + + mir_free((DUMPMSG*)lParam); + return TRUE; + } + case WM_SIZE: + { + UTILRESIZEDIALOG urd={0}; + urd.cbSize=sizeof(urd); + urd.hInstance=hInst; + urd.hwndDlg=hwndDlg; + urd.lpTemplate=MAKEINTRESOURCEA(IDD_LOG); + urd.pfnResizer=LogResize; + SetWindowPos(hwndDlg, HWND_TOP, rcTabs.left, rcTabs.top, rcTabs.right - rcTabs.left, rcTabs.bottom - rcTabs.top, SWP_SHOWWINDOW); + CallService(MS_UTILS_RESIZEDIALOG,0,(LPARAM)&urd); + break; + } + case WM_COMMAND: + { + switch(LOWORD(wParam)) + { + if (!dat) break; + + case IDC_PAUSE: + { + LVITEM lvi = {0}; + dat->Paused = !(dat->Paused); + lvi.mask = LVIF_TEXT | LVIF_IMAGE; + lvi.iImage = IMG_INFO; + lvi.iItem = 0x7FFFFFFF; + lvi.pszText = (dat->Paused) ? TranslateT("*** Console paused ***") : TranslateT("*** Console resumed ***"); + ListView_InsertItem(dat->hList, &lvi); + CheckDlgButton(hwndDlg,IDC_PAUSE,(dat->Paused)?BST_CHECKED:BST_UNCHECKED); + SendDlgItemMessage(hwndDlg,IDC_PAUSE,BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[((dat->Paused)?ICON_PAUSED:ICON_STARTED)]); + break; + } + case IDC_SCROLL: + { + dat->Scroll = !(dat->Scroll); + CheckDlgButton(hwndDlg,IDC_SCROLL,(dat->Scroll)?BST_CHECKED:BST_UNCHECKED); + SendDlgItemMessage(hwndDlg,IDC_SCROLL,BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[((dat->Scroll)?ICON_SCROLL:ICON_NOSCROLL)]); + break; + } + case IDC_COPY: + { + int idx = 0; + TCHAR szText[128]; + TCHAR *src, *dst, *buf; + int flags = LVNI_BELOW; + int count = ListView_GetSelectedCount(dat->hList); + + if (count) + flags |= LVNI_SELECTED; + else + count = ListView_GetItemCount(dat->hList); + + dst = buf = (TCHAR*)malloc((count*(sizeof(szText)+1)+1)*sizeof(TCHAR)); + if (!buf) break; + + while ((idx = ListView_GetNextItem(dat->hList, idx, flags)) > 0) + { + ListView_GetItemText(dat->hList, idx, 0, szText, sizeof(szText)-1); + src = szText; + while (*dst++ = *src++); + dst--; + *dst++ = '\r'; + *dst++ = '\n'; + *dst = 0; + } + + if (dst - buf > 0 && OpenClipboard(hwndDlg)) { + HGLOBAL hClipboardData; + TCHAR* pchData; + EmptyClipboard(); + if (hClipboardData = GlobalAlloc(GMEM_DDESHARE, (dst-buf+1)*sizeof(TCHAR))) { + pchData = (TCHAR*)GlobalLock(hClipboardData); + _tcscpy(pchData, buf); + GlobalUnlock(hClipboardData); + SetClipboardData(CF_UNICODETEXT,hClipboardData); + } + CloseClipboard(); + } + free(buf); + break; + } + case IDC_DELETE: + { + int idx = 0; + int count = ListView_GetSelectedCount(dat->hList); + + if ( !count ) break; + + if ( count == ListView_GetItemCount(dat->hList)) { + LVITEM lvi = {0}; + ListView_DeleteAllItems(dat->hList); + lvi.mask = LVIF_TEXT | LVIF_IMAGE; + lvi.iImage = IMG_INFO; + lvi.pszText = TranslateT("*** Console cleared ***"); + ListView_InsertItem(dat->hList, &lvi); + dat->newline = 0; + break; + } + + while ((idx = ListView_GetNextItem(dat->hList, idx, LVNI_BELOW|LVNI_SELECTED)) > 0) + { + ListView_DeleteItem(dat->hList, idx); + idx--; + } + break; + } + case IDC_SAVE: + { + FILE *fp; + TCHAR szFile[MAX_PATH]; + + if (!Openfile(szFile, ListView_GetSelectedCount(dat->hList))) break; + + fp = _tfopen(szFile, _T("wt")); + if (fp) { + int idx = 0; + TCHAR szText[128]; + int flags = LVNI_BELOW; + if (ListView_GetSelectedCount(dat->hList)) + flags |= LVNI_SELECTED; + + while ((idx = ListView_GetNextItem(dat->hList, idx, flags)) > 0) + { + ListView_GetItemText(dat->hList, idx, 0, szText, SIZEOF(szText)-1); + _ftprintf(fp, _T("%s\n"), szText); + } + fclose(fp); + } + break; + } + case IDC_OPTIONS: + CallServiceSync(MS_NETLIB_LOGWIN,0,0); + break; + case IDC_STARTALL: + SendMessage(hwndConsole, HM_PAUSEALL, 0, 0); + break; + case IDC_PAUSEALL: + SendMessage(hwndConsole, HM_PAUSEALL, 0, 1); + break; + case IDC_CLOSE: + if (tabCount > 1) + SendMessage(hwndDlg, WM_CLOSE, 0, 0); + break; + default: + break; + } + break; + } + case WM_CLOSE: + DestroyWindow(hwndDlg); + break; + case WM_DESTROY: + SetWindowLongPtr(dat->hList, GWLP_WNDPROC, GetWindowLongPtr(dat->hList, GWLP_USERDATA)); + SendMessage(hwndConsole, HM_REMOVE, 0, (LPARAM)dat); + break; + } + + return FALSE; +} + + +//////////////////////////////////////////////////////////////////////////////// + +int ConsoleResize(HWND hwnd,LPARAM lParam,UTILRESIZECONTROL *urc) +{ + switch(urc->wId) { + case IDC_TABS: + return RD_ANCHORX_WIDTH|RD_ANCHORY_HEIGHT; + default: + return RD_ANCHORX_LEFT|RD_ANCHORY_TOP; + } +} + + +static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) +{ + switch(message) { + case WM_INITDIALOG: + { + TCHAR title[MAX_PATH]; + TCHAR name[MAX_PATH] = {0}; + TCHAR path[MAX_PATH] = {0}; + + hTabs = GetDlgItem(hwndDlg, IDC_TABS); + + //TabCtrl_SetMinTabWidth(hTabs, 100); + + // restore position + { + SAVEWINDOWPOS swp; + swp.hwnd=hwndDlg; swp.hContact=NULL; swp.szModule="Console"; swp.szNamePrefix="Console"; + CallService(MS_UTILS_RESTOREWINDOWPOSITION, RWPF_HIDDEN, (LPARAM)&swp); + } + + CallService(MS_DB_GETPROFILENAMET,(WPARAM)MAX_PATH,(LPARAM)name); + + CallService(MS_DB_GETPROFILEPATHT,(WPARAM)MAX_PATH,(LPARAM)path); + + mir_sntprintf(title, MAX_PATH, _T("%s - %s\\%s"), TranslateT("Miranda Console"), path, name); + + SetWindowText(hwndDlg, title); + SendMessage(hwndDlg,WM_SETICON,ICON_BIG,(LPARAM)hIcons[0]); + + hwndConsole = hwndDlg; + SendMessage(hwndDlg, HM_ADD, 0, 0); + PostMessage(hwndDlg, WM_SIZE, 0, 0); + break; + } + case HM_DUMP: + { + // lParam = DUMPMSG + int idx; + LOGWIN *lw; + LOGWIN lw2; + DUMPMSG *dumpMsg = (DUMPMSG*)lParam; + + if (!pActive) { + mir_free(dumpMsg); + break; + } + + if (!gSingleMode) + { + lw2.Module = dumpMsg->szModule; + if (!List_GetIndex(&lModules, &lw2, &idx)) + SendMessage(hwndDlg, HM_ADD, (WPARAM)idx, (LPARAM)dumpMsg->szModule); + + lw = (LOGWIN*)lModules.items[idx]; + } + else + lw = pActive; + + if (lw->hwnd) + SendMessage(lw->hwnd, HM_DUMP, wParam, lParam); + else + PostMessage(hwndDlg, HM_DUMP, wParam, lParam); // loop msg until window will be ready + + return TRUE; + } + case HM_ADD: + { + // wParam = index, lParam = module name + LOGWIN *lw; + COLORREF col; + TCITEM tci = {0}; + int idx = (int)wParam; + char *str = (char*)lParam; + + if (!str) str = ""; // startup window + + lw = (LOGWIN*)mir_calloc( sizeof(LOGWIN)); + lw->Module = (char*)mir_strdup(str); + List_Insert(&lModules, lw, idx); + + if (!gSingleMode && lParam) + { + tci.mask = TCIF_PARAM | TCIF_TEXT; + tci.lParam = (LPARAM)lw; + + tci.pszText = mir_a2u(lw->Module); + idx = TabCtrl_InsertItem(hTabs, tabCount, &tci); + mir_free(tci.pszText); + + tabCount++; + } + + GetClientRect(hTabs, &rcTabs); + TabCtrl_AdjustRect(hTabs, FALSE, &rcTabs); + + CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_LOG), hwndDlg, LogDlgProc, (LPARAM)lw); + ShowWindow(lw->hwnd, (tabCount > 1)?SW_HIDE:SW_SHOWNOACTIVATE); + + if (pActive) + { + col = ListView_GetBkColor(pActive->hList); + ListView_SetBkColor(lw->hList, col); + ListView_SetTextBkColor(lw->hList, col); + + col = ListView_GetTextColor(pActive->hList); + ListView_SetTextColor(lw->hList, col); + + if (hfLogFont) + SendMessage(lw->hList, WM_SETFONT, (WPARAM)hfLogFont, (LPARAM)TRUE); + } + + // hide startup window + if (tabCount == 1) + { + ShowWindow(pActive->hwnd, SW_HIDE); + PostMessage(pActive->hwnd, WM_CLOSE, 0, 0); + pActive = lw; + } + + if (!pActive) + pActive = lw; + + return TRUE; + } + case HM_REMOVE: + { + // lParam = LOGWIN + LOGWIN *lw = (LOGWIN*)lParam; + + if (!lw) break; + + if (lw == pActive) + { + int tab = TabCtrl_GetCurSel(hTabs); + if (tab >= 0) + { + TCITEM tci={0}; + + TabCtrl_DeleteItem(hTabs, tab); + tabCount--; + if (tabCount) + { + tab--; + if (tab < 0 ) tab = 0; + TabCtrl_SetCurSel(hTabs, tab); + + tci.mask = TCIF_PARAM; + TabCtrl_GetItem(hTabs, tab, &tci); + pActive = (LOGWIN*)tci.lParam; + SendMessage(pActive->hwnd, WM_SIZE, 0, 0); + ScrollDown(pActive); + ShowWindow(pActive->hwnd, SW_SHOWNOACTIVATE); + SetFocus(pActive->hList); + } + else + pActive = NULL; + } + } + + List_RemovePtr(&lModules, lw); + mir_free(lw->Module); + mir_free(lw); + return TRUE; + } + case HM_SETFONT: + { + // wParam = font, lParam = font color + int i; + LOGWIN *lw; + for ( i = 0; i < lModules.realCount; i++ ) + { + lw = (LOGWIN*)lModules.items[i]; + ListView_SetTextColor(lw->hList, (COLORREF)lParam); + if (wParam) + SendMessage(lw->hList, WM_SETFONT, wParam, (LPARAM)TRUE); + } + return TRUE; + } + case HM_SETCOLOR: + { + // wParam = font, lParam = background color + int i; + LOGWIN *lw; + for ( i = 0; i < lModules.realCount; i++ ) + { + lw = (LOGWIN*)lModules.items[i]; + ListView_SetBkColor(lw->hList, (COLORREF)lParam); + ListView_SetTextBkColor(lw->hList, (COLORREF)lParam); + if (wParam) + SendMessage(lw->hList, WM_SETFONT, wParam, (LPARAM)TRUE); + } + return TRUE; + } + case HM_PAUSEALL: + { + // lParam = 1 to pause, 0 to start + int i; + LOGWIN *lw; + for ( i = 0; i < lModules.realCount; i++ ) + { + lw = (LOGWIN*)lModules.items[i]; + if (lw->Paused != (int)lParam) + SendMessage(lw->hwnd, WM_COMMAND, IDC_PAUSE, 0); + } + return TRUE; + } + case HM_RESTART: + { + if (pActive) + { + pActive = NULL; + PostMessage(hwndDlg, HM_RESTART, 0, 0); + return TRUE; + } + // close all tabs + if (!lParam) + { + LOGWIN *lw; + TabCtrl_DeleteAllItems(hTabs); + while ( lModules.realCount ) + { + lw = (LOGWIN*)lModules.items[0]; + SendMessage(lw->hwnd, WM_CLOSE, 0, 0); + } + tabCount = 0; + PostMessage(hwndDlg, HM_RESTART, 0, 1); + return TRUE; + } + + LoadSettings(); + SendMessage(hwndDlg, HM_ADD, 0, 0); + PostMessage(hwndDlg, WM_SIZE, 0, 0); + return TRUE; + } + case WM_SETFOCUS: + if (pActive) { + SetFocus(pActive->hList); + } + return TRUE; + case WM_NOTIFY: + switch(wParam) { + case IDC_TABS: + { + LPNMHDR lpnmhdr = (LPNMHDR)lParam; + if (lpnmhdr->code == TCN_SELCHANGE) + { + int newTab = TabCtrl_GetCurSel(hTabs); + if (newTab >= 0 ) + { + TCITEM tci={0}; + HWND hOld = pActive->hwnd; + + tci.mask = TCIF_PARAM; + + if (!TabCtrl_GetItem(hTabs, newTab, &tci)) break; + + pActive = (LOGWIN*)tci.lParam; + + SendMessage(pActive->hwnd, WM_SIZE, 0, 0); + ScrollDown(pActive); + ShowWindow(hOld, SW_HIDE); + ShowWindow(pActive->hwnd, SW_SHOWNOACTIVATE); + SetFocus(pActive->hList); + } else + SendMessage(pActive->hwnd, WM_SIZE, 0, 0); + } + break; + } + } + break; + case WM_SIZE: + { + UTILRESIZEDIALOG urd={0}; + urd.cbSize=sizeof(urd); + urd.hInstance=hInst; + urd.hwndDlg=hwndDlg; + urd.lpTemplate=MAKEINTRESOURCEA(IDD_CONSOLE); + urd.pfnResizer=ConsoleResize; + CallService(MS_UTILS_RESIZEDIALOG,0,(LPARAM)&urd); + + GetClientRect(hTabs, &rcTabs); + TabCtrl_AdjustRect(hTabs, FALSE, &rcTabs); + + if ( pActive ) + SendMessage(pActive->hwnd, WM_SIZE, 0, 0); + break; + } + case WM_GETMINMAXINFO: + { + MINMAXINFO *mmi=(MINMAXINFO*)lParam; + mmi->ptMinTrackSize.x=400; + mmi->ptMinTrackSize.y=200; + break; + } + case WM_CLOSE: + if ( lParam != 1 ) { + Utils_SaveWindowPosition(hwndDlg,NULL,"Console","Console"); + ShowConsole(0); + return TRUE; + } else + DestroyWindow(hwndDlg); + break; + case WM_DESTROY: + pActive = NULL; + if (hfLogFont) DeleteObject(hfLogFont); + PostQuitMessage(0); + break; + } + + return FALSE; +} + + +//////////////////////////////////////////////////////////////////////////////// + + +void __cdecl ConsoleThread(void* arg) +{ + MSG msg; + HWND hwnd; + + hwnd = CreateDialog(hInst,MAKEINTRESOURCE(IDD_CONSOLE),NULL,ConsoleDlgProc); + + if (!hwnd) return; + + while( GetMessage(&msg, NULL, 0, 0) > 0 ) + { + switch(msg.message) { + case HM_DUMP: + OutMsgs++; + break; + } + + if ( IsDialogMessage(hwnd, &msg)) + continue; + + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + hwndConsole = NULL; +} + +/////////////////////////////////////////////////////////////////////////////// + +static int OnFastDump(WPARAM wParam,LPARAM lParam) +{ + if ( pActive ) + { + LOGMSG *logMsg = (LOGMSG*)lParam; + DWORD headlen = (DWORD)strlen(logMsg->pszHead); + DWORD msglen = (DWORD)strlen(logMsg->pszMsg); + DWORD len = (headlen + msglen + 1) * sizeof(TCHAR) + sizeof(DUMPMSG); + DUMPMSG *dumpMsg = (DUMPMSG*)mir_alloc( len ); + TCHAR *str = dumpMsg->szMsg; + + strncpy(dumpMsg->szModule, ((NETLIBUSER*)wParam)->szDescriptiveName, sizeof(dumpMsg->szModule))[ sizeof(dumpMsg->szModule)-1 ] = 0; + + { + wchar_t *ucs2; + + ucs2 = mir_a2u( logMsg->pszHead ); + wcscpy(str, ucs2); + mir_free(ucs2); + + // try to detect utf8 + ucs2 = mir_utf8decodeW( logMsg->pszMsg ); + if ( !ucs2 ) + ucs2 = mir_a2u( logMsg->pszMsg ); + + wcscat( str, ucs2 ); + mir_free( ucs2 ); + } + + InMsgs++; + PostMessage(hwndConsole, HM_DUMP, 0, (LPARAM)dumpMsg); + } + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +static void LoadSettings() +{ + gIcons = DBGetContactSettingByte(NULL, "Console", "ShowIcons", 1); + gSeparator = DBGetContactSettingByte(NULL, "Console", "Separator", 1); + gSingleMode = DBGetContactSettingByte(NULL, "Console", "SingleMode", 0); + + gWrapLen = DBGetContactSettingByte(NULL, "Console", "Wrap", DEFAULT_WRAPLEN); + if ( gWrapLen < MIN_WRAPLEN ) gWrapLen = DEFAULT_WRAPLEN; + + gLimit = DBGetContactSettingDword(NULL, "Console", "Limit", MAX_LIMIT); + if (gLimit > MAX_LIMIT) gLimit = MAX_LIMIT; + if (gLimit < MIN_LIMIT) gLimit = MIN_LIMIT; +} + + +static void SaveSettings(HWND hwndDlg) +{ + int len = GetDlgItemInt(hwndDlg, IDC_WRAP, NULL, FALSE); + if (len < MIN_WRAPLEN ) + len = MIN_WRAPLEN; + else + if (len > MAX_WRAPLEN) + len = MAX_WRAPLEN; + + gWrapLen = len; + SetDlgItemInt(hwndDlg, IDC_WRAP, gWrapLen, FALSE); + DBWriteContactSettingByte(NULL, "Console", "Wrap", (BYTE)len); + + len = GetDlgItemInt(hwndDlg, IDC_LIMIT, NULL, FALSE); + if (len < MIN_LIMIT ) + len = MIN_LIMIT; + else + if (len > MAX_LIMIT) + len = MAX_LIMIT; + + gLimit = len; + SetDlgItemInt(hwndDlg, IDC_LIMIT, gLimit, FALSE); + DBWriteContactSettingDword(NULL, "Console", "Limit", len); + + DBWriteContactSettingByte(NULL, "Console", "SingleMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SINGLE)); + DBWriteContactSettingByte(NULL, "Console", "Separator", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SEPARATOR)); + DBWriteContactSettingByte(NULL, "Console", "ShowIcons", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWICONS)); + + DBWriteContactSettingByte(NULL, "Console", "ShowAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_START)); +} + + +static INT_PTR CALLBACK OptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + CheckDlgButton(hwndDlg, IDC_START, DBGetContactSettingByte(NULL, "Console", "ShowAtStart", 0)); + CheckDlgButton(hwndDlg, IDC_SINGLE, gSingleMode); + CheckDlgButton(hwndDlg, IDC_SHOWICONS, gIcons); + CheckDlgButton(hwndDlg, IDC_SEPARATOR, gSeparator); + SetDlgItemInt(hwndDlg, IDC_WRAP, gWrapLen, FALSE); + SetDlgItemInt(hwndDlg, IDC_LIMIT, gLimit, FALSE); + break; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_RESTART: + { + if (!pActive) break; + SaveSettings(hwndDlg); + PostMessage(hwndConsole, HM_RESTART, 0, 0); + break; + } + case IDC_LIMIT: + case IDC_WRAP: + if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()) + return FALSE; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case IDC_START: + case IDC_SEPARATOR: + case IDC_SHOWICONS: + case IDC_SINGLE: + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + } + break; + case WM_NOTIFY: + switch(((LPNMHDR)lParam)->idFrom) + { + case 0: + switch (((LPNMHDR)lParam)->code) + { + case PSN_APPLY: + { + SaveSettings(hwndDlg); + break; + } + } + break; + } + break; + } + return FALSE; +} + + +static int OptInit(WPARAM wParam,LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp={0}; + odp.cbSize = sizeof(odp); + odp.hInstance = hInst; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); + odp.pszGroup = LPGEN("Network"); + odp.pszTitle = LPGEN("Console"); + odp.pfnDlgProc = OptDlgProc; + odp.flags = ODPF_BOLDGROUPS; + odp.expertOnlyControls = NULL; + Options_AddPage(wParam, &odp); + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +static int OnColourChange(WPARAM wParam,LPARAM lParam) +{ + if (hwndConsole) + { + ColourID cid = {0}; + COLORREF col; + + cid.cbSize=sizeof(cid); + strcpy(cid.group,"Console"); + strcpy(cid.name,"Background"); + strcpy(cid.dbSettingsGroup,"Console"); + strcpy(cid.setting,"BgColor"); + + col = (COLORREF)CallService(MS_COLOUR_GET,(WPARAM)&cid,0); + if (col != -1) + SendMessage(hwndConsole, HM_SETCOLOR, (WPARAM)hfLogFont, (LPARAM)col); + } + return 0; +} + + +static int OnFontChange(WPARAM wParam,LPARAM lParam) +{ + if (hwndConsole) + { + COLORREF col; + HFONT hf = NULL; + LOGFONT LogFont={0}; + FontIDT fid={0}; + fid.cbSize=sizeof(fid); + + _tcscpy(fid.group,_T("Console")); + _tcscpy(fid.name,TranslateT("Text")); + + col = (COLORREF)CallService(MS_FONT_GETT,(WPARAM)&fid,(LPARAM)&LogFont); + + if (LogFont.lfHeight != 0) + { + hf=CreateFontIndirect(&LogFont); + + SendMessage(hwndConsole, HM_SETFONT, (WPARAM)hf, (LPARAM)col); + + if (hfLogFont) + DeleteObject(hfLogFont); + hfLogFont = hf; + } + } + return 0; +} + +static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) +{ + HookEvent( ME_NETLIB_FASTDUMP, OnFastDump ); + + CreateServiceFunction(MS_CONSOLE_SHOW_HIDE, ShowHideConsole); + + FontIDT fid = {0}; + fid.cbSize = sizeof(fid); + _tcscpy(fid.group,_T("Console")); + _tcscpy(fid.name,TranslateT("Text")); + strcpy(fid.dbSettingsGroup,"Console"); + strcpy(fid.prefix,"ConsoleFont"); + _tcscpy(fid.backgroundGroup,_T("Console")); + _tcscpy(fid.backgroundName,_T("Background")); + fid.flags = FIDF_DEFAULTVALID; + fid.deffontsettings.charset = DEFAULT_CHARSET; + fid.deffontsettings.colour = RGB(0, 0, 0); + fid.deffontsettings.size = 10; + fid.deffontsettings.style = 0; + _tcsncpy(fid.deffontsettings.szFace, _T("Courier"), LF_FACESIZE); + FontRegisterT(&fid); + + HookEvent(ME_FONT_RELOAD,OnFontChange); + + ColourIDT cid = {0}; + cid.cbSize=sizeof(cid); + _tcscpy(cid.group,_T("Console")); + _tcscpy(cid.name,_T("Background")); + strcpy(cid.dbSettingsGroup,"Console"); + strcpy(cid.setting,"BgColor"); + cid.defcolour = RGB(255,255,255); + ColourRegisterT(&cid); + + HookEvent(ME_COLOUR_RELOAD, OnColourChange); + + HOTKEYDESC hkd = {0}; + hkd.cbSize = sizeof(hkd); + hkd.pszName = "Console_Show_Hide"; + hkd.pszDescription = LPGEN("Show/Hide Console"); + hkd.pszSection = "Main"; + hkd.pszService = MS_CONSOLE_SHOW_HIDE; + hkd.DefHotKey = HOTKEYCODE(HOTKEYF_EXT, 'C'); + Hotkey_Register(&hkd); + + if (hwndConsole && IsWindow(hwndConsole)) + { + CLISTMENUITEM mi={0}; + HookEvent(ME_TTB_MODULELOADED, OnTTBLoaded); + mi.cbSize=sizeof(mi); + mi.flags=CMIF_TCHAR; + mi.hIcon=hIcons[0]; + mi.ptszPopupName=TranslateT("&Help"); + mi.popupPosition=2000090000; + mi.position=1000000000; + mi.ptszName=(IsWindowVisible(hwndConsole))?TranslateT("Hide Console"):TranslateT("Show Console"); + mi.pszService=MS_CONSOLE_SHOW_HIDE; + hMenu = Menu_AddMainMenuItem(&mi); + + OnFontChange(0,0); + OnColourChange(0,0); + + if (DBGetContactSettingByte(NULL,"Console","ShowAtStart",0) || DBGetContactSettingByte(NULL,"Console","Show",1)) + ShowConsole(1); + else + ShowConsole(0); + } + + return 0; +} + +static int PreshutdownConsole(WPARAM wParam,LPARAM lParam) +{ + if (hwndConsole) + PostMessage(hwndConsole, WM_CLOSE, 0, 1 ); + + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +static int stringCompare( LOGWIN *lw1, LOGWIN *lw2 ) +{ + return strcmp( lw1->Module, lw2->Module ); +} + +/////////////////////////////////////////////////////////////////////////////// + +static UINT logicons[] = {IDI_EMPTY, IDI_ARROW, IDI_IN, IDI_OUT, IDI_INFO}; + + +void InitConsole() +{ + int i; + HICON hi; + + lModules.sortFunc = (FSortFunc)stringCompare; + lModules.increment = 5; + + hIcons[0] = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONSOLE)); + hIcons[1] = (HICON)LoadImage(hInst,MAKEINTRESOURCE(IDI_NOSCROLL),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0); + hIcons[2] = (HICON)LoadImage(hInst,MAKEINTRESOURCE(IDI_PAUSED),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0); + + for(i = 0; i < SIZEOF(ctrls); i++) { + hIcons[i+ICON_FIRST] = (HICON)LoadImage(hInst,MAKEINTRESOURCE(ctrls[i].icon),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0); + } + + gImg = ImageList_Create(LOGICONX_SIZE, LOGICONY_SIZE, ILC_COLOR24 | ILC_MASK, SIZEOF(logicons), 0); + + for(i = 0; i < SIZEOF(logicons); i++) + { + hi = (HICON)LoadImage(hInst,MAKEINTRESOURCE(logicons[i]),IMAGE_ICON,LOGICONX_SIZE,LOGICONY_SIZE,0); + if (hi) + { + ImageList_AddIcon(gImg, hi); + DestroyIcon(hi); + } + } + + LoadSettings(); + + mir_forkthread(ConsoleThread, 0); + + HookEvent(ME_SYSTEM_PRESHUTDOWN, PreshutdownConsole); + HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded); + HookEvent(ME_OPT_INITIALISE, OptInit); + HookEvent(ME_NETLIB_FASTDUMP, OnFastDump); +} + +void ShutdownConsole(void) +{ + int i; + + List_Destroy(&lModules); + + if (gImg) ImageList_Destroy(gImg); + + for(i = 0; i < SIZEOF(hIcons); i++) { + if (hIcons[i]) DestroyIcon(hIcons[i]); + } +} + +//////////////////////////////////////////////////////////////////////////////// + +TCHAR *addstring(TCHAR *str, TCHAR *add) { + _tcscpy(str,add); + return str + _tcslen(add) + 1; +} + + +static int Openfile(TCHAR *outputFile, int selection) +{ + OPENFILENAME ofn = {0}; + TCHAR filename[MAX_PATH+2] = _T(""); + TCHAR *title; + + TCHAR *filter, *tmp, *tmp1, *tmp2; + tmp1 = TranslateT("Text Files (*.txt)"); + tmp2 = TranslateT("All Files"); + filter = tmp = (TCHAR*)_alloca((_tcslen(tmp1)+_tcslen(tmp2)+11)*sizeof(TCHAR)); + tmp = addstring(tmp, tmp1); + tmp = addstring(tmp, _T("*.TXT")); + tmp = addstring(tmp, tmp2); + tmp = addstring(tmp, _T("*")); + *tmp = 0; + + if (selection) + title = TranslateT("Save selection to file"); + else + title = TranslateT("Save log to file"); + + ofn.lStructSize = sizeof(ofn); + ofn.lpstrFile = filename; + ofn.lpstrFilter = filter; + ofn.Flags = OFN_HIDEREADONLY | OFN_SHAREAWARE | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT; + ofn.lpstrTitle = title; + ofn.nMaxFile = MAX_PATH; + ofn.lpstrDefExt = _T("txt"); + + if (!GetSaveFileName(&ofn)) + return 0; + _tcscpy(outputFile, filename); + return 1; +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Console/src/commonheaders.cpp b/plugins/Console/src/commonheaders.cpp new file mode 100644 index 0000000000..cbfb79d624 --- /dev/null +++ b/plugins/Console/src/commonheaders.cpp @@ -0,0 +1,24 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2008 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 "commonheaders.h" \ No newline at end of file diff --git a/plugins/Console/src/commonheaders.h b/plugins/Console/src/commonheaders.h new file mode 100644 index 0000000000..7689c7dce2 --- /dev/null +++ b/plugins/Console/src/commonheaders.h @@ -0,0 +1,68 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2008 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. +*/ + +#define _CRT_SECURE_NO_WARNINGS +#define _WIN32_WINNT 0x0501 + +#pragma comment( lib, "comctl32.lib") + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MIRANDA_VER 0x0A00 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "resource.h" + +#include "version.h" + +extern HINSTANCE hInst; + +void InitConsole(); +void ShutdownConsole(); + +#define MS_NETLIB_LOGWIN "Netlib/Log/Win" diff --git a/plugins/Console/src/init.cpp b/plugins/Console/src/init.cpp new file mode 100644 index 0000000000..58943d2c6a --- /dev/null +++ b/plugins/Console/src/init.cpp @@ -0,0 +1,74 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2008 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 "commonheaders.h" + +DWORD mirandaVer; +int hLangpack; +HINSTANCE hInst; + +PLUGININFOEX pluginInfoEx={ + sizeof(PLUGININFOEX), + __PLUGIN_NAME, + __VERSION_DWORD, + __PLUGIN_LONGDESC, + __PLUGIN_AUTHOR, + __PLUGIN_EMAIL, + __PLUGIN_RIGHTS, + __PLUGIN_URL, + UNICODE_AWARE, + MIID_CONSOLE +}; + +BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) +{ + hInst = hinstDLL; + return TRUE; +} + +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +{ + return &pluginInfoEx; +} + +// we implement service mode interface +static const MUUID interfaces[] = {MIID_LOGWINDOW, MIID_LAST}; +extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) +{ + return interfaces; +} + +extern "C" __declspec(dllexport) int Load(void) +{ + mir_getLP(&pluginInfoEx); + + InitCommonControls(); + InitConsole(); + return 0; +} + +extern "C" __declspec(dllexport) int Unload(void) +{ + ShutdownConsole(); + return 0; +} \ No newline at end of file diff --git a/plugins/Console/src/resource.h b/plugins/Console/src/resource.h new file mode 100644 index 0000000000..a8947819a4 --- /dev/null +++ b/plugins/Console/src/resource.h @@ -0,0 +1,58 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by resource.rc +// +#define IDI_CONSOLE_UP 100 +#define IDI_CONSOLE_DOWN 101 +#define IDD_MSG 111 +#define IDD_CONSOLE 112 +#define IDD_LOG 113 +#define IDD_OPTIONS 114 +#define IDI_COPY 402 +#define IDI_NOSCROLL 403 +#define IDI_SCROLL 404 +#define IDI_SAVE 405 +#define IDI_DELETE 406 +#define IDI_OPTIONS 407 +#define IDI_PAUSED 408 +#define IDI_STARTED 409 +#define IDI_BTN_UP 410 +#define IDI_BTN_DN 411 +#define IDI_CLOSE 412 +#define IDI_START 413 +#define IDI_PAUSE 414 +#define IDI_IN 415 +#define IDI_OUT 416 +#define IDI_ARROW 417 +#define IDI_INFO 418 +#define IDI_EMPTY 419 +#define IDC_TABS 1000 +#define IDC_LIST 1001 +#define IDC_SAVE 1002 +#define IDC_PAUSE 1003 +#define IDC_SCROLL 1004 +#define IDC_COPY 1005 +#define IDC_DELETE 1006 +#define IDC_OPTIONS 1007 +#define IDI_CONSOLE 1008 +#define IDC_CLOSE 1009 +#define IDC_PAUSEALL 1010 +#define IDC_STARTALL 1011 +#define IDC_SINGLE 1012 +#define IDC_WRAP 1013 +#define IDC_SHOWICONS 1014 +#define IDC_SEPARATOR 1015 +#define IDC_LIMIT 1016 +#define IDC_START 1017 +#define IDC_RESTART 1018 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 115 +#define _APS_NEXT_COMMAND_VALUE 40000 +#define _APS_NEXT_CONTROL_VALUE 1019 +#define _APS_NEXT_SYMED_VALUE 102 +#endif +#endif diff --git a/plugins/Console/src/version.h b/plugins/Console/src/version.h new file mode 100644 index 0000000000..c91b5628e0 --- /dev/null +++ b/plugins/Console/src/version.h @@ -0,0 +1,41 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2008 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. +*/ + + +#define __FILEVERSION_STRING 0,0,7,3 +#define __VERSION_STRING "0.0.7.3" +#define __VERSION_DWORD 0x00000703 + + +#define __PLUGIN_DESC "Console log window for Miranda" +#define __PLUGIN_LONGDESC __PLUGIN_DESC ". ["__DATE__" "__TIME__"]" +#define __PLUGIN_AUTHOR "Bio" +#define __PLUGIN_EMAIL "bio@ktaspb.ru" +#define __PLUGIN_RIGHTS "© 2005-2012 Bio" +#define __PLUGIN_FILE "Console.dll" +#define __PLUGIN_SHORTNAME "Console" + +#define MIID_CONSOLE { 0x23d4f302, 0xd513, 0x45b7, { 0x90, 0x27, 0x44, 0x5f, 0x29, 0x55, 0x73, 0x11 }} // {23D4F302-D513-45b7-9027-445F29557311} + +#define __PLUGIN_NAME __PLUGIN_SHORTNAME +#define __PLUGIN_URL "http://addons.miranda-im.org/details.php?action=viewfile&id=3791" diff --git a/plugins/Console/version.h b/plugins/Console/version.h deleted file mode 100644 index c91b5628e0..0000000000 --- a/plugins/Console/version.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2008 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. -*/ - - -#define __FILEVERSION_STRING 0,0,7,3 -#define __VERSION_STRING "0.0.7.3" -#define __VERSION_DWORD 0x00000703 - - -#define __PLUGIN_DESC "Console log window for Miranda" -#define __PLUGIN_LONGDESC __PLUGIN_DESC ". ["__DATE__" "__TIME__"]" -#define __PLUGIN_AUTHOR "Bio" -#define __PLUGIN_EMAIL "bio@ktaspb.ru" -#define __PLUGIN_RIGHTS "© 2005-2012 Bio" -#define __PLUGIN_FILE "Console.dll" -#define __PLUGIN_SHORTNAME "Console" - -#define MIID_CONSOLE { 0x23d4f302, 0xd513, 0x45b7, { 0x90, 0x27, 0x44, 0x5f, 0x29, 0x55, 0x73, 0x11 }} // {23D4F302-D513-45b7-9027-445F29557311} - -#define __PLUGIN_NAME __PLUGIN_SHORTNAME -#define __PLUGIN_URL "http://addons.miranda-im.org/details.php?action=viewfile&id=3791" diff --git a/plugins/Console/version.rc b/plugins/Console/version.rc deleted file mode 100644 index 9981077b9f..0000000000 --- a/plugins/Console/version.rc +++ /dev/null @@ -1,65 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#ifdef APSTUDIO_INVOKED -#error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include -#include -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION __FILEVERSION_STRING - PRODUCTVERSION __FILEVERSION_STRING - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "000004b0" - BEGIN - VALUE "FileDescription", __PLUGIN_DESC - VALUE "FileVersion", __VERSION_STRING - VALUE "InternalName", __PLUGIN_SHORTNAME - VALUE "LegalCopyright", __PLUGIN_RIGHTS - VALUE "OriginalFilename", __PLUGIN_FILE - VALUE "ProductName", __PLUGIN_SHORTNAME - VALUE "ProductVersion", __VERSION_STRING - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0, 1200 - END -END - -#endif -- cgit v1.2.3