diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2015-07-25 14:25:13 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2015-07-25 14:25:13 +0000 |
commit | fb8b0186a7bdc11ac111542b4b7a77b5054a7014 (patch) | |
tree | cfa4d31696425e252e23c4e4b85cdbd58a424b83 /plugins/Cln_skinedit | |
parent | d60c72ac3b459dfb419bd53a6c485916b6ea7510 (diff) |
Cln_skinedit: common project
git-svn-id: http://svn.miranda-ng.org/main/trunk@14687 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Cln_skinedit')
-rw-r--r-- | plugins/Cln_skinedit/docs/CHANGELOG | 0 | ||||
-rw-r--r-- | plugins/Cln_skinedit/docs/README | 27 | ||||
-rw-r--r-- | plugins/Cln_skinedit/res/Version.rc | 38 | ||||
-rw-r--r-- | plugins/Cln_skinedit/res/skinedit.rc | 121 | ||||
-rw-r--r-- | plugins/Cln_skinedit/skinedit.vcxproj | 28 | ||||
-rw-r--r-- | plugins/Cln_skinedit/skinedit.vcxproj.filters | 4 | ||||
-rw-r--r-- | plugins/Cln_skinedit/src/Version.h | 14 | ||||
-rw-r--r-- | plugins/Cln_skinedit/src/main.cpp | 961 | ||||
-rw-r--r-- | plugins/Cln_skinedit/src/skineditres.h | 51 | ||||
-rw-r--r-- | plugins/Cln_skinedit/src/stdafx.cxx | 18 | ||||
-rw-r--r-- | plugins/Cln_skinedit/src/stdafx.h | 36 |
11 files changed, 1298 insertions, 0 deletions
diff --git a/plugins/Cln_skinedit/docs/CHANGELOG b/plugins/Cln_skinedit/docs/CHANGELOG new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/plugins/Cln_skinedit/docs/CHANGELOG diff --git a/plugins/Cln_skinedit/docs/README b/plugins/Cln_skinedit/docs/README new file mode 100644 index 0000000000..48f1084404 --- /dev/null +++ b/plugins/Cln_skinedit/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/Cln_skinedit/res/Version.rc b/plugins/Cln_skinedit/res/Version.rc new file mode 100644 index 0000000000..5bfbab4754 --- /dev/null +++ b/plugins/Cln_skinedit/res/Version.rc @@ -0,0 +1,38 @@ +// Microsoft Visual C++ generated resource script.
+//
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+#include "afxres.h"
+#include "..\src\version.h"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION __FILEVERSION_STRING
+ PRODUCTVERSION __FILEVERSION_STRING
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x0L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "000004b0"
+ BEGIN
+ VALUE "FileDescription", __DESCRIPTION
+ VALUE "InternalName", __PLUGIN_NAME
+ VALUE "LegalCopyright", __COPYRIGHT
+ VALUE "OriginalFilename", __FILENAME
+ VALUE "ProductName", __PLUGIN_NAME
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0, 1200
+ END
+END
diff --git a/plugins/Cln_skinedit/res/skinedit.rc b/plugins/Cln_skinedit/res/skinedit.rc new file mode 100644 index 0000000000..b7f0719c9d --- /dev/null +++ b/plugins/Cln_skinedit/res/skinedit.rc @@ -0,0 +1,121 @@ +// Microsoft Visual C++ generated resource script.
+//
+#include "..\src\skineditres.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include <winres.h>
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Русский (Россия) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
+LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
+#pragma code_page(1251)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// 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 "Text color",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
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "..\\src\\skineditres.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include <winres.h>\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // Русский (Россия) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/plugins/Cln_skinedit/skinedit.vcxproj b/plugins/Cln_skinedit/skinedit.vcxproj new file mode 100644 index 0000000000..38a526e72b --- /dev/null +++ b/plugins/Cln_skinedit/skinedit.vcxproj @@ -0,0 +1,28 @@ +п»ї<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>Cln_skinedit</ProjectName>
+ <ProjectGuid>{987F026D-EB1F-4013-ADA8-2406ACCDA526}</ProjectGuid>
+ </PropertyGroup>
+ <ImportGroup Label="PropertySheets">
+ <Import Project="$(ProjectDir)..\..\build\vc.common\plugin.props" />
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/Cln_skinedit/skinedit.vcxproj.filters b/plugins/Cln_skinedit/skinedit.vcxproj.filters new file mode 100644 index 0000000000..de5ad9f66c --- /dev/null +++ b/plugins/Cln_skinedit/skinedit.vcxproj.filters @@ -0,0 +1,4 @@ +п»ї<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(ProjectDir)..\..\build\vc.common\common.filters" />
+</Project>
\ No newline at end of file diff --git a/plugins/Cln_skinedit/src/Version.h b/plugins/Cln_skinedit/src/Version.h new file mode 100644 index 0000000000..f0403e6a1e --- /dev/null +++ b/plugins/Cln_skinedit/src/Version.h @@ -0,0 +1,14 @@ +#define __MAJOR_VERSION 0
+#define __MINOR_VERSION 0
+#define __RELEASE_NUM 0
+#define __BUILD_NUM 4
+
+#include <stdver.h>
+
+#define __PLUGIN_NAME "Skin editor for clist nicer"
+#define __FILENAME "Cln_skinedit.dll"
+#define __DESCRIPTION "Allows inline skin item editing for clist nicer."
+#define __AUTHOR "Nightwish, Pixel"
+#define __AUTHOREMAIL ""
+#define __AUTHORWEB "http://miranda-ng.org/p/Cln_skinedit/"
+#define __COPYRIGHT "Copyright 2000-2006 Miranda-IM project"
diff --git a/plugins/Cln_skinedit/src/main.cpp b/plugins/Cln_skinedit/src/main.cpp new file mode 100644 index 0000000000..f52dc0814b --- /dev/null +++ b/plugins/Cln_skinedit/src/main.cpp @@ -0,0 +1,961 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (с) 2012-15 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-04 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "stdafx.h" + +#define ID_EXTBKSEPARATOR 40200 + +PLUGININFOEX pluginInfo = { + sizeof(PLUGININFOEX), + __PLUGIN_NAME, + PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), + __DESCRIPTION, + __AUTHOR, + __AUTHOREMAIL, + __COPYRIGHT, + __AUTHORWEB, + UNICODE_AWARE, + // {21948C89-B549-4C9D-8B4F-3F3726EC6B4B} + {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), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_COLOR2_TRANSPARENT)); + EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR2LABLE), BST_UNCHECKED == 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, BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_IGNORE), IDC_IGNORE); + } else { + ChangeControlItems(hwndDlg, BST_UNCHECKED == 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), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_COLOR2_TRANSPARENT)); + EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR2LABLE), BST_UNCHECKED == 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; + StatusItems_t *p = StatusItems[index]; + + if (ChangedSItems.bIGNORED) + p->IGNORED = IsDlgButtonChecked(hwndDlg, IDC_IGNORE); + + if (ChangedSItems.bGRADIENT) { + p->GRADIENT = GRADIENT_NONE; + if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT)) + p->GRADIENT |= GRADIENT_ACTIVE; + if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT_LR)) + p->GRADIENT |= GRADIENT_LR; + if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT_RL)) + p->GRADIENT |= GRADIENT_RL; + if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT_TB)) + p->GRADIENT |= GRADIENT_TB; + if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT_BT)) + p->GRADIENT |= GRADIENT_BT; + } + if (ChangedSItems.bCORNER) { + p->CORNER = CORNER_NONE; + if (IsDlgButtonChecked(hwndDlg, IDC_CORNER)) + p->CORNER |= CORNER_ACTIVE ; + if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_TL)) + p->CORNER |= CORNER_TL ; + if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_TR)) + p->CORNER |= CORNER_TR; + if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_BR)) + p->CORNER |= CORNER_BR; + if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_BL)) + p->CORNER |= CORNER_BL; + } + + if (ChangedSItems.bCOLOR) + p->COLOR = SendDlgItemMessage(hwndDlg, IDC_BASECOLOUR, CPM_GETCOLOUR, 0, 0); + + if (ChangedSItems.bCOLOR2) + p->COLOR2 = SendDlgItemMessage(hwndDlg, IDC_BASECOLOUR2, CPM_GETCOLOUR, 0, 0); + + if (ChangedSItems.bCOLOR2_TRANSPARENT) + p->COLOR2_TRANSPARENT = IsDlgButtonChecked(hwndDlg, IDC_COLOR2_TRANSPARENT); + + if (ChangedSItems.bTEXTCOLOR) + p->TEXTCOLOR = SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOUR, CPM_GETCOLOUR, 0, 0); + + if (ChangedSItems.bALPHA) { + GetDlgItemTextA(hwndDlg, IDC_ALPHA, buf, 10); // can be removed now + if (buf[0] != 0) + p->ALPHA = (BYTE) SendDlgItemMessage(hwndDlg, IDC_ALPHASPIN, UDM_GETPOS, 0, 0); + } + + if (ChangedSItems.bMARGIN_LEFT) { + GetDlgItemTextA(hwndDlg, IDC_MRGN_LEFT, buf, 10); + if (buf[0] != 0) + p->MARGIN_LEFT = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_LEFT_SPIN, UDM_GETPOS, 0, 0); + } + + if (ChangedSItems.bMARGIN_TOP) { + GetDlgItemTextA(hwndDlg, IDC_MRGN_TOP, buf, 10); + if (buf[0] != 0) + p->MARGIN_TOP = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_TOP_SPIN, UDM_GETPOS, 0, 0); + } + + if (ChangedSItems.bMARGIN_RIGHT) { + GetDlgItemTextA(hwndDlg, IDC_MRGN_RIGHT, buf, 10); + if (buf[0] != 0) + p->MARGIN_RIGHT = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_RIGHT_SPIN, UDM_GETPOS, 0, 0); + } + + if (ChangedSItems.bMARGIN_BOTTOM) { + GetDlgItemTextA(hwndDlg, IDC_MRGN_BOTTOM, buf, 10); + if (buf[0] != 0) + p->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) + p->BORDERSTYLE = 0; + else { + switch(bdrtype) { + case 0: + p->BORDERSTYLE = 0; + break; + case 1: + p->BORDERSTYLE = BDR_RAISEDOUTER; + break; + case 2: + p->BORDERSTYLE = BDR_SUNKENINNER; + break; + case 3: + p->BORDERSTYLE = EDGE_BUMP; + break; + case 4: + p->BORDERSTYLE = EDGE_ETCHED; + break; + default: + p->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 = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETSELCOUNT, 0, 0); + if (last_selcount > 0) { + int n, itemData, first_item; + + // get selected indizes + SendDlgItemMessage(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; + StatusItems_t *pFirst = StatusItems[first_item]; + StatusItems_t 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) + continue; + + StatusItems_t *p = StatusItems[itemData - ID_EXTBK_FIRST]; + if (p->ALPHA != pFirst->ALPHA) + DialogSettingForMultiSel.ALPHA = -1; + if (p->COLOR != pFirst->COLOR) + DialogSettingForMultiSel.COLOR = CLCDEFAULT_COLOR; + if (p->COLOR2 != pFirst->COLOR2) + DialogSettingForMultiSel.COLOR2 = CLCDEFAULT_COLOR2; + if (p->COLOR2_TRANSPARENT != pFirst->COLOR2_TRANSPARENT) + DialogSettingForMultiSel.COLOR2_TRANSPARENT = CLCDEFAULT_COLOR2_TRANSPARENT; + if (p->TEXTCOLOR != pFirst->TEXTCOLOR) + DialogSettingForMultiSel.TEXTCOLOR = CLCDEFAULT_TEXTCOLOR; + if (p->CORNER != pFirst->CORNER) + DialogSettingForMultiSel.CORNER = CLCDEFAULT_CORNER; + if (p->GRADIENT != pFirst->GRADIENT) + DialogSettingForMultiSel.GRADIENT = CLCDEFAULT_GRADIENT; + if (p->IGNORED != pFirst->IGNORED) + DialogSettingForMultiSel.IGNORED = CLCDEFAULT_IGNORE; + if (p->MARGIN_BOTTOM != pFirst->MARGIN_BOTTOM) + DialogSettingForMultiSel.MARGIN_BOTTOM = -1; + if (p->MARGIN_LEFT != pFirst->MARGIN_LEFT) + DialogSettingForMultiSel.MARGIN_LEFT = -1; + if (p->MARGIN_RIGHT != pFirst->MARGIN_RIGHT) + DialogSettingForMultiSel.MARGIN_RIGHT = -1; + if (p->MARGIN_TOP != pFirst->MARGIN_TOP) + DialogSettingForMultiSel.MARGIN_TOP = -1; + if (p->BORDERSTYLE != pFirst->BORDERSTYLE) + DialogSettingForMultiSel.BORDERSTYLE = -1; + } + + if (last_selcount == 1 && pFirst->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 INT_PTR 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)); + if (psd == NULL) + return FALSE; + memset(psd, 0, sizeof(SKINDESCRIPTION)); + memcpy(psd, (void *)lParam, sizeof(SKINDESCRIPTION)); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)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, LPGENT("Copy from")); + AppendMenuA(psd->hMenuItems, MF_SEPARATOR, (UINT_PTR)0, NULL); + + { + for (int 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: + 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("<None>")); + 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, db_get_dw(NULL, "CLCExt", "3ddark", RGB(224,224,224))); + SendDlgItemMessage(hwndDlg, IDC_3DLIGHTCOLOR, CPM_SETCOLOUR, 0, db_get_dw(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 (item) { + char *szName = item->szName[0] == '{' ? &item->szName[3] : item->szName; + TextOutA(dis->hDC, dis->rcItem.left, dis->rcItem.top, szName, (int)mir_strlen(szName)); + } + return TRUE; + } + + case WM_CONTEXTMENU: + { + HWND hwndList = GetDlgItem(hwndDlg, IDC_ITEMS); + + POINT pt; + GetCursorPos(&pt); + + RECT rc; + 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; + StatusItems_t *pSel = StatusItems[iSelection]; + + for(int i = ID_EXTBK_FIRST; i < ID_EXTBK_LAST; i++) { + if ( SendMessage(hwndList, LB_GETSEL, i - ID_EXTBK_FIRST, 0) <= 0) + continue; + + int iIndex = SendMessage(hwndList, LB_GETITEMDATA, i - ID_EXTBK_FIRST, 0); + iIndex -= ID_EXTBK_FIRST; + if (iIndex < 0) + continue; + + StatusItems_t *p = StatusItems[iIndex]; + p->ALPHA = pSel->ALPHA; + p->BORDERSTYLE = pSel->BORDERSTYLE; + p->COLOR = pSel->COLOR; + p->COLOR2 = pSel->COLOR2; + p->COLOR2_TRANSPARENT = pSel->COLOR2_TRANSPARENT; + p->CORNER = pSel->CORNER; + p->GRADIENT = pSel->GRADIENT; + p->IGNORED = pSel->IGNORED; + p->imageItem = pSel->imageItem; + p->MARGIN_BOTTOM = pSel->MARGIN_BOTTOM; + p->MARGIN_LEFT = pSel->MARGIN_LEFT; + p->MARGIN_RIGHT = pSel->MARGIN_RIGHT; + p->MARGIN_TOP = pSel->MARGIN_TOP; + p->TEXTCOLOR = pSel->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(); + db_set_dw(NULL, "CLCExt", "3dbright", SendDlgItemMessage(hwndDlg, IDC_3DLIGHTCOLOR, CPM_GETCOLOUR, 0, 0)); + db_set_dw(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, 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, 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, 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, SkinEdit_Invoke); + hSvc_fillby = CreateServiceFunction(MS_CLNSE_FILLBYCURRENTSEL, SkinEdit_FillByCurrentSel); + return 0; +} + +extern "C" __declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD mirandaVersion) +{ + return &pluginInfo; +} + +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/Cln_skinedit/src/skineditres.h b/plugins/Cln_skinedit/src/skineditres.h new file mode 100644 index 0000000000..ec4da1453d --- /dev/null +++ b/plugins/Cln_skinedit/src/skineditres.h @@ -0,0 +1,51 @@ +//{{NO_DEPENDENCIES}}
+// Включаемый файл, созданный в Microsoft Visual C++.
+// Используется d:\MNG_orig\plugins\Clist_nicer\skineditor\res\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/Cln_skinedit/src/stdafx.cxx b/plugins/Cln_skinedit/src/stdafx.cxx new file mode 100644 index 0000000000..6fb37564b7 --- /dev/null +++ b/plugins/Cln_skinedit/src/stdafx.cxx @@ -0,0 +1,18 @@ +/*
+Copyright (C) 2012-15 Miranda NG project (http://miranda-ng.org)
+
+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 version 2
+of the License.
+
+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, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "stdafx.h"
\ No newline at end of file diff --git a/plugins/Cln_skinedit/src/stdafx.h b/plugins/Cln_skinedit/src/stdafx.h new file mode 100644 index 0000000000..56c95b5c43 --- /dev/null +++ b/plugins/Cln_skinedit/src/stdafx.h @@ -0,0 +1,36 @@ +/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (с) 2012-15 Miranda NG project (http://miranda-ng.org),
+Copyright (c) 2000-04 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 <windows.h>
+#include <commctrl.h>
+#include <time.h>
+
+#include <newpluginapi.h>
+#include <m_database.h>
+#include <m_langpack.h>
+#include <m_protosvc.h>
+#include <m_cln_skinedit.h>
+
+#include "Version.h"
+#include "skineditres.h"
|