From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/Plugins/Library/ml_fanzone/CMakeLists.txt | 77 ++++ Src/Plugins/Library/ml_fanzone/api__ml_fanzone.h | 15 + .../Library/ml_fanzone/compatibility.manifest | 20 + Src/Plugins/Library/ml_fanzone/listview.cpp | 128 ++++++ Src/Plugins/Library/ml_fanzone/listview.h | 144 +++++++ Src/Plugins/Library/ml_fanzone/main.cpp | 110 +++++ Src/Plugins/Library/ml_fanzone/main.h | 24 ++ .../Library/ml_fanzone/ml_fanzone.dll.manifest | 20 + Src/Plugins/Library/ml_fanzone/ml_fanzone.rc | 142 +++++++ Src/Plugins/Library/ml_fanzone/ml_fanzone.vcxproj | 354 ++++++++++++++++ .../Library/ml_fanzone/ml_fanzone.vcxproj.filters | 97 +++++ Src/Plugins/Library/ml_fanzone/myCefApp.cpp | 49 +++ Src/Plugins/Library/ml_fanzone/resource.h | 23 ++ .../Library/ml_fanzone/resources/FANZONE_16x16.bmp | Bin 0 -> 822 bytes .../Library/ml_fanzone/resources/cefsimple.ico | Bin 0 -> 23558 bytes Src/Plugins/Library/ml_fanzone/resources/small.ico | Bin 0 -> 23558 bytes Src/Plugins/Library/ml_fanzone/version.rc2 | 39 ++ Src/Plugins/Library/ml_fanzone/view.cpp | 444 +++++++++++++++++++++ 18 files changed, 1686 insertions(+) create mode 100644 Src/Plugins/Library/ml_fanzone/CMakeLists.txt create mode 100644 Src/Plugins/Library/ml_fanzone/api__ml_fanzone.h create mode 100644 Src/Plugins/Library/ml_fanzone/compatibility.manifest create mode 100644 Src/Plugins/Library/ml_fanzone/listview.cpp create mode 100644 Src/Plugins/Library/ml_fanzone/listview.h create mode 100644 Src/Plugins/Library/ml_fanzone/main.cpp create mode 100644 Src/Plugins/Library/ml_fanzone/main.h create mode 100644 Src/Plugins/Library/ml_fanzone/ml_fanzone.dll.manifest create mode 100644 Src/Plugins/Library/ml_fanzone/ml_fanzone.rc create mode 100644 Src/Plugins/Library/ml_fanzone/ml_fanzone.vcxproj create mode 100644 Src/Plugins/Library/ml_fanzone/ml_fanzone.vcxproj.filters create mode 100644 Src/Plugins/Library/ml_fanzone/myCefApp.cpp create mode 100644 Src/Plugins/Library/ml_fanzone/resource.h create mode 100644 Src/Plugins/Library/ml_fanzone/resources/FANZONE_16x16.bmp create mode 100644 Src/Plugins/Library/ml_fanzone/resources/cefsimple.ico create mode 100644 Src/Plugins/Library/ml_fanzone/resources/small.ico create mode 100644 Src/Plugins/Library/ml_fanzone/version.rc2 create mode 100644 Src/Plugins/Library/ml_fanzone/view.cpp (limited to 'Src/Plugins/Library/ml_fanzone') diff --git a/Src/Plugins/Library/ml_fanzone/CMakeLists.txt b/Src/Plugins/Library/ml_fanzone/CMakeLists.txt new file mode 100644 index 00000000..2fe08d33 --- /dev/null +++ b/Src/Plugins/Library/ml_fanzone/CMakeLists.txt @@ -0,0 +1,77 @@ +# Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +# +# Source files. +# + +# ml_fanzone sources. +set(CEFSIMPLE_SRCS + cef_app.cc + cef_app.h + cef_handler.cc + cef_handler.h + ) +set(CEFSIMPLE_SRCS_WINDOWS + ml_fanzone.rc + main.cpp + resource.h + cef_handler_win.cc + ) +APPEND_PLATFORM_SOURCES(CEFSIMPLE_SRCS) +source_group(ml_fanzone FILES ${CEFSIMPLE_SRCS}) + +set(CEFSIMPLE_SRCS + ${CEFSIMPLE_SRCS} + ) + +# ml_fanzone helper sources. +APPEND_PLATFORM_SOURCES(CEFSIMPLE_HELPER_SRCS) +source_group(ml_fanzone FILES ${CEFSIMPLE_HELPER_SRCS}) + +# ml_fanzone resources. + + +# +# Shared configuration. +# + +# Target executable names. +set(CEF_TARGET "ml_fanzone") +if(OS_MAC) + set(CEF_HELPER_TARGET "ml_fanzone_Helper") + set(CEF_HELPER_OUTPUT_NAME "ml_fanzone Helper") +else() + # Logical target used to link the libcef library. + ADD_LOGICAL_TARGET("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}") +endif() + +# Determine the target output directory. +SET_CEF_TARGET_OUT_DIR() + + +# +# Windows configuration. +# + +if(OS_WINDOWS) + # Executable target. + add_executable(${CEF_TARGET} WIN32 ${CEFSIMPLE_SRCS}) + add_dependencies(${CEF_TARGET} libcef_dll_wrapper) + SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET}) + target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS}) + + if(USE_SANDBOX) + # Logical target used to link the cef_sandbox library. + ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}") + target_link_libraries(${CEF_TARGET} cef_sandbox_lib ${CEF_SANDBOX_STANDARD_LIBS}) + endif() + + # Add the custom manifest files to the executable. + ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_TARGET}" "dll") + + # Copy binary and resource files to the target output directory. + COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}") + COPY_FILES("${CEF_TARGET}" "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "${CEF_TARGET_OUT_DIR}") +endif() diff --git a/Src/Plugins/Library/ml_fanzone/api__ml_fanzone.h b/Src/Plugins/Library/ml_fanzone/api__ml_fanzone.h new file mode 100644 index 00000000..038ed0c8 --- /dev/null +++ b/Src/Plugins/Library/ml_fanzone/api__ml_fanzone.h @@ -0,0 +1,15 @@ +#ifndef NULLSOFT_API_ML_FANZONE_H +#define NULLSOFT_API_ML_FANZONE_H + +#include + +#include "../Agave/Language/api_language.h" + +#include "../Winamp/api_stats.h" +extern api_stats *statsApi; +#define AGAVE_API_STATS statsApi + +#include +#define WASABI_API_APP applicationApi + +#endif // !NULLSOFT_API_ML_FANZONE_H \ No newline at end of file diff --git a/Src/Plugins/Library/ml_fanzone/compatibility.manifest b/Src/Plugins/Library/ml_fanzone/compatibility.manifest new file mode 100644 index 00000000..755c272c --- /dev/null +++ b/Src/Plugins/Library/ml_fanzone/compatibility.manifest @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/Src/Plugins/Library/ml_fanzone/listview.cpp b/Src/Plugins/Library/ml_fanzone/listview.cpp new file mode 100644 index 00000000..a3ceb22c --- /dev/null +++ b/Src/Plugins/Library/ml_fanzone/listview.cpp @@ -0,0 +1,128 @@ +/* +** Copyright (C) 2003 Nullsoft, Inc. +** +** This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held +** liable for any damages arising from the use of this software. +** +** Permission is granted to anyone to use this software for any purpose, including commercial applications, and to +** alter it and redistribute it freely, subject to the following restrictions: +** +** 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. +** If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +** +** 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +** +** 3. This notice may not be removed or altered from any source distribution. +** +*/ + +#include +#include +#include "listview.h" + +#ifdef GEN_ML_EXPORTS +#include "main.h" // for getting the font +#include "config.h" +#endif +// bp Comment: all the calls beginning "ListView_" are +// MACROs defined in commctrl.h + +void W_ListView :: AddCol (char *text, int w) +{ + LVCOLUMN lvc={0,}; + lvc.mask = LVCF_TEXT|LVCF_WIDTH; + lvc.pszText = text; + if (w) lvc.cx=w; + ListView_InsertColumn (m_hwnd, m_col, &lvc); + m_col++; +} + +int W_ListView::GetColumnWidth (int col) +{ + if (col < 0 || col >= m_col) return 0; + return ListView_GetColumnWidth (m_hwnd, col); +} + + +int W_ListView::GetParam (int p) +{ + LVITEM lvi={0,}; + lvi.mask = LVIF_PARAM; + lvi.iItem = p; + ListView_GetItem (m_hwnd, &lvi); + return lvi.lParam; +} + +int W_ListView::InsertItem (int p, char *text, int param) +{ + LVITEM lvi={0,}; + lvi.mask = LVIF_TEXT | LVIF_PARAM; + lvi.iItem = p; + lvi.pszText = text; + lvi.cchTextMax=strlen (text); + lvi.lParam = param; + return ListView_InsertItem (m_hwnd, &lvi); +} + + +void W_ListView::SetItemText (int p, int si, char *text) +{ + LVITEM lvi={0,}; + lvi.iItem = p; + lvi.iSubItem = si; + lvi.mask = LVIF_TEXT; + lvi.pszText = text; + lvi.cchTextMax = strlen (text); + ListView_SetItem (m_hwnd, &lvi); +} + +void W_ListView::SetItemParam (int p, int param) +{ + LVITEM lvi={0,}; + lvi.iItem = p; + lvi.mask=LVIF_PARAM; + lvi.lParam=param; + ListView_SetItem (m_hwnd, &lvi); +} + +void W_ListView::refreshFont () +{ + if (m_font) + { + DeleteFont (m_font); + SetWindowFont (m_hwnd, NULL, FALSE); + } + m_font = NULL; + + HWND h; +#ifdef GEN_ML_EXPORTS + h=g_hwnd; +#else + h=m_libraryparent; +#endif + if (h && m_allowfonts) + { + int a=SendMessage (h, WM_USER+0x1000 /*WM_ML_IPC*/,66, 0x0600 /*ML_IPC_SKIN_WADLG_GETFUNC*/); + if (a) + { + m_font= (HFONT)a; + SetWindowFont (m_hwnd, m_font, FALSE); + } + } + InvalidateRect (m_hwnd, NULL, TRUE); +} + +void W_ListView::setallowfonts (int allow) +{ + m_allowfonts=allow; +} + +void W_ListView::setwnd (HWND hwnd) +{ + m_hwnd = hwnd; + if (hwnd) + { + ListView_SetExtendedListViewStyle (hwnd, LVS_EX_FULLROWSELECT|LVS_EX_UNDERLINEHOT ); + refreshFont (); + } +} diff --git a/Src/Plugins/Library/ml_fanzone/listview.h b/Src/Plugins/Library/ml_fanzone/listview.h new file mode 100644 index 00000000..5938a4dc --- /dev/null +++ b/Src/Plugins/Library/ml_fanzone/listview.h @@ -0,0 +1,144 @@ +/* +** Copyright (C) 2003 Nullsoft, Inc. +** +** This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held +** liable for any damages arising from the use of this software. +** +** Permission is granted to anyone to use this software for any purpose, including commercial applications, and to +** alter it and redistribute it freely, subject to the following restrictions: +** +** 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. +** If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +** +** 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +** +** 3. This notice may not be removed or altered from any source distribution. +** +*/ +#if 0 +#ifndef _LISTVIEW_H_ +#define _LISTVIEW_H_ + +#include +#include +#include + +class W_ListView +{ +public: + W_ListView() + { + m_hwnd=NULL; + m_col=0; + m_allowfonts=1; + m_font=NULL; +#ifndef GEN_ML_EXPORTS + m_libraryparent=NULL; +#endif + } + W_ListView(HWND hwnd) + { + m_hwnd=NULL; + m_col=0; + m_allowfonts=1; + m_font=NULL; +#ifndef GEN_ML_EXPORTS + m_libraryparent=NULL; +#endif + setwnd(hwnd); + } + ~W_ListView() + { + if (m_font) DeleteFont(m_font); + m_font=0; + } + + void refreshFont(); + +#ifndef GEN_ML_EXPORTS + void setLibraryParentWnd(HWND hwndParent) + { + m_libraryparent=hwndParent; + }// for Winamp Font getting stuff +#endif + void setallowfonts(int allow=1); + void setwnd(HWND hwnd); + void AddCol(char *text, int w); + int GetCount(void) + { + return ListView_GetItemCount(m_hwnd); + } + int GetParam(int p); + void DeleteItem(int n) + { + ListView_DeleteItem(m_hwnd,n); + } + void Clear(void) + { + ListView_DeleteAllItems(m_hwnd); + } + int GetSelected(int x) + { + return(ListView_GetItemState(m_hwnd, x, LVIS_SELECTED) & LVIS_SELECTED)?1:0; + } + + int GetSelectedCount() + { + return ListView_GetSelectedCount(m_hwnd); + } + + int GetSelectionMark() + { + return ListView_GetSelectionMark(m_hwnd); + } + void SetSelected(int x) + { + ListView_SetItemState(m_hwnd,x,LVIS_SELECTED,LVIS_SELECTED); + } + int InsertItem(int p, char *text, int param); + void GetItemRect(int i, RECT *r) + { + ListView_GetItemRect(m_hwnd, i, r, LVIR_BOUNDS); + } + void SetItemText(int p, int si, char *text); + void SetItemParam(int p, int param); + + void GetText(int p, int si, char *text, int maxlen) + { + ListView_GetItemText(m_hwnd, p, si, text, maxlen); + } + int FindItemByParam(int param) + { + LVFINDINFO fi={LVFI_PARAM,0,param}; + return ListView_FindItem(m_hwnd,-1,&fi); + } + int FindItemByPoint(int x, int y) + { + int l=GetCount(); + for (int i=0;i=x && r.top<=y && r.bottom>=y) return i; + } + return -1; + } + int GetColumnWidth(int col); + HWND getwnd(void) + { + return m_hwnd; + } + +protected: + HWND m_hwnd; + HFONT m_font; + int m_col; + int m_allowfonts; +#ifndef GEN_ML_EXPORTS + HWND m_libraryparent; +#endif +}; + +#endif//_LISTVIEW_H_ + +#endif \ No newline at end of file diff --git a/Src/Plugins/Library/ml_fanzone/main.cpp b/Src/Plugins/Library/ml_fanzone/main.cpp new file mode 100644 index 00000000..f94e0e08 --- /dev/null +++ b/Src/Plugins/Library/ml_fanzone/main.cpp @@ -0,0 +1,110 @@ +#define PLUGIN_VERSION L"0.1" + +#include "main.h" + +#include "../nu/AutoWide.h" + +#include "../../General/gen_ml/menu.h" +#include "../../General/gen_ml/ml_ipc_0313.h" + +#include "../WAT/WAT.h" + +static int Init(); +static void Quit(); + +extern "C" winampMediaLibraryPlugin plugin = +{ + MLHDR_VER, + "nullsoft(ml_fanzone.dll)", + Init, + Quit, + fanzone_pluginMessageProc, + 0, + 0, + 0, +}; + +int fanzone_treeItem = 0; + +HCURSOR hDragNDropCursor; +C_Config *g_config = 0; +WNDPROC waProc = 0; + +// wasabi based services for localisation support +api_language *WASABI_API_LNG = 0; +HINSTANCE WASABI_API_LNG_HINST = 0; +HINSTANCE WASABI_API_ORIG_HINST = 0; +api_stats *AGAVE_API_STATS = 0; +api_application *WASABI_API_APP = 0; + +static DWORD WINAPI wa_newWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) +{ + if ( waProc ) + return (DWORD)CallWindowProcW( waProc, hwnd, msg, wParam, lParam ); + else + return (DWORD)DefWindowProc( hwnd, msg, wParam, lParam ); +} + +int Init() +{ + waProc = (WNDPROC)SetWindowLongPtrW( plugin.hwndWinampParent, GWLP_WNDPROC, (LONG_PTR)wa_newWndProc ); + + mediaLibrary.library = plugin.hwndLibraryParent; + mediaLibrary.winamp = plugin.hwndWinampParent; + mediaLibrary.instance = plugin.hDllInstance; + + waServiceFactory *sf = plugin.service->service_getServiceByGuid( languageApiGUID ); + if ( sf ) + WASABI_API_LNG = reinterpret_cast( sf->getInterface() ); + + sf = plugin.service->service_getServiceByGuid( AnonymousStatsGUID ); + if ( sf ) + AGAVE_API_STATS = reinterpret_cast( sf->getInterface() ); + + sf = plugin.service->service_getServiceByGuid( applicationApiServiceGuid ); + if ( sf ) + WASABI_API_APP = reinterpret_cast( sf->getInterface() ); + + // need to have this initialised before we try to do anything with localisation features + WASABI_API_START_LANG( plugin.hDllInstance, MlFanZoneLangGUID ); + + static wchar_t szDescription[ 256 ]; + StringCchPrintfW( szDescription, ARRAYSIZE( szDescription ), WASABI_API_LNGSTRINGW( IDS_NULLSOFT_FANZONE ), PLUGIN_VERSION ); + plugin.description = (char *)szDescription; + + wchar_t inifile[ MAX_PATH ] = { 0 }; + mediaLibrary.BuildPath( L"Plugins", inifile, MAX_PATH ); + CreateDirectoryW( inifile, NULL ); + + mediaLibrary.BuildPath( L"Plugins\\gen_ml.ini", inifile, MAX_PATH ); + g_config = new C_Config( inifile ); + + hDragNDropCursor = LoadCursor( GetModuleHandle( L"gen_ml.dll" ), MAKEINTRESOURCE( ML_IDC_DRAGDROP ) ); + + NAVINSERTSTRUCT nis = { 0 }; + nis.item.cbSize = sizeof( NAVITEM ); + nis.item.pszText = WASABI_API_LNGSTRINGW( IDS_FANZONE ); + nis.item.pszInvariant = L"Fanzone Library"; + nis.item.mask = NIMF_TEXT | NIMF_TEXTINVARIANT | NIMF_IMAGE | NIMF_IMAGESEL; + nis.item.iSelectedImage = nis.item.iImage = mediaLibrary.AddTreeImageBmp( IDB_TREEITEM_FANZONE ); + + // map to item id (will probably have to change but is a quick port to support invariant item naming) + NAVITEM nvItem = { sizeof( NAVITEM ),0,NIMF_ITEMID, }; + nvItem.hItem = MLNavCtrl_InsertItem( plugin.hwndLibraryParent, &nis ); + MLNavItem_GetInfo( plugin.hwndLibraryParent, &nvItem ); + fanzone_treeItem = nvItem.id; + + + return 0; +} + +void Quit() +{ + if ( g_config != 0 ) + delete g_config; +} + +extern "C" __declspec(dllexport) winampMediaLibraryPlugin *winampGetMediaLibraryPlugin() +{ + return &plugin; +} diff --git a/Src/Plugins/Library/ml_fanzone/main.h b/Src/Plugins/Library/ml_fanzone/main.h new file mode 100644 index 00000000..23dcf870 --- /dev/null +++ b/Src/Plugins/Library/ml_fanzone/main.h @@ -0,0 +1,24 @@ +#ifndef NULLSOFT_FANZONE_MAIN_H +#define NULLSOFT_FANZONE_MAIN_H + +#include +#include +#include + +#include "api__ml_fanzone.h" +#include "resource.h" +#include +#include "../Plugins/General/gen_ml/ml.h" +#include "../nu/MediaLibraryInterface.h" + +#include "../winamp/wa_ipc.h" +#include "../Plugins/General/gen_ml/ml.h" +#include "../Plugins/General/gen_ml/config.h" + +static HWND m_hwnd; + +extern winampMediaLibraryPlugin plugin; +INT_PTR fanzone_pluginMessageProc( int message_type, INT_PTR param1, INT_PTR param2, INT_PTR param3 ); +extern int fanzone_treeItem; + +#endif // !NULLSOFT_FANZONE_MAIN_H \ No newline at end of file diff --git a/Src/Plugins/Library/ml_fanzone/ml_fanzone.dll.manifest b/Src/Plugins/Library/ml_fanzone/ml_fanzone.dll.manifest new file mode 100644 index 00000000..d36f084b --- /dev/null +++ b/Src/Plugins/Library/ml_fanzone/ml_fanzone.dll.manifest @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/Src/Plugins/Library/ml_fanzone/ml_fanzone.rc b/Src/Plugins/Library/ml_fanzone/ml_fanzone.rc new file mode 100644 index 00000000..a537e8c9 --- /dev/null +++ b/Src/Plugins/Library/ml_fanzone/ml_fanzone.rc @@ -0,0 +1,142 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#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) + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_CEFSIMPLE ICON "resources\\cefsimple.ico" + +IDI_SMALL ICON "resources\\small.ico" + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_VIEW_FANZONE DIALOGEX 0, 0, 259, 168 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + CONTROL "",IDC_LIST_FANZONE,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_TABSTOP,7,11,184,79 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_TREEITEM_FANZONE BITMAP "resources\\fanzone_16x16.bmp" + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_VIEW_FANZONE, DIALOG + BEGIN + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// AFX_DIALOG_LAYOUT +// + +IDD_VIEW_FANZONE AFX_DIALOG_LAYOUT +BEGIN + 0 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_NULLSOFT_FANZONE "Nullsoft Fanzone Library v%s" + 65535 "{DBF92DD3-766E-42E8-A4D2-AE1AC88CF2D1}" +END + +STRINGTABLE +BEGIN + IDS_FANZONE "Fanzone" +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Src/Plugins/Library/ml_fanzone/ml_fanzone.vcxproj b/Src/Plugins/Library/ml_fanzone/ml_fanzone.vcxproj new file mode 100644 index 00000000..182aeca0 --- /dev/null +++ b/Src/Plugins/Library/ml_fanzone/ml_fanzone.vcxproj @@ -0,0 +1,354 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {DBF92DD3-766E-42E8-A4D2-AE1AC88CF2D1} + ml_fanzone + 10.0.19041.0 + + + + DynamicLibrary + v142 + Unicode + x86 + + + DynamicLibrary + v142 + Unicode + + + DynamicLibrary + v142 + Unicode + + + DynamicLibrary + v142 + Unicode + + + + + + + + + + + + + + + + + + + false + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + $(IncludePath) + $(LibraryPath) + true + false + + + false + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + true + + + false + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + $(IncludePath) + $(LibraryPath) + true + true + + + false + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + true + + + false + true + + + + + false + Debug + + + + + false + + + + + false + Debug + + + + + false + + + + Disabled + ..\..\..\;..\..\..\Wasabi;..\..\..\replicant;%(AdditionalIncludeDirectories) + %(PreprocessorDefinitions);WIN32;_WINDOWS;_DEBUG;_USRDLL;ML_FANZONE_LIB;__STDC_CONSTANT_MACROS;__STDC_FORMAT_MACROS;_WIN32;UNICODE;_UNICODE;WINVER=0x0601;_WIN32_WINNT=0x601;NOMINMAX;WIN32_LEAN_AND_MEAN;_HAS_EXCEPTIONS=0;CEF_USE_ATL;CMAKE_INTDIR="Debug" + false + true + EnableFastChecks + MultiThreadedDebugDLL + Level3 + ProgramDatabase + true + $(IntDir)$(TargetName).pdb + 4100;4127;4244;4324;4481;4512;4701;4702;4996 + stdcpp14 + Disabled + + + comctl32.lib;gdi32.lib;rpcrt4.lib;shlwapi.lib;ws2_32.lib;kernel32.lib;user32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + true + $(IntDir)$(TargetName).pdb + Windows + true + $(IntDir)$(TargetName).lib + MachineX86 + true + %(AdditionalLibraryDirectories) + + + %(IgnoreSpecificDefaultLibraries) + 0x8000 + true + + + + + true + + + xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ +xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ + + Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\' + + + %(PreprocessorDefinitions);WIN32;_DEBUG;_WINDOWS;__STDC_CONSTANT_MACROS;__STDC_FORMAT_MACROS;_WIN32;UNICODE;_UNICODE;WINVER=0x0601;_WIN32_WINNT=0x601;NOMINMAX;WIN32_LEAN_AND_MEAN;_HAS_EXCEPTIONS=0;CEF_USE_ATL;CMAKE_INTDIR=\"Debug\" + ..\..\..\external_dependencies\CEF\;%(AdditionalIncludeDirectories) + + + + + + + + + + + Disabled + .;..\..\..\Wasabi;%(AdditionalIncludeDirectories) + _WIN32_WINNT=0x0601;WINVER=0x0601;WIN64;_DEBUG;_WINDOWS;_USRDLL;ML_FANZONE_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + true + EnableFastChecks + MultiThreadedDebugDLL + Level3 + ProgramDatabase + 4302;4311;%(DisableSpecificWarnings) + true + $(IntDir)$(TargetName).pdb + + + comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + true + $(IntDir)$(TargetName).pdb + Windows + false + $(IntDir)$(TargetName).lib + false + %(AdditionalLibraryDirectories) + 0x8000 + true + + + xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ +xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ + Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\' + + + _WIN32_WINNT=0x0601;WINVER=0x0601;_UNICODE;UNICODE;%(PreprocessorDefinitions) + + + $(IntDir)$(TargetName)$(TargetExt).intermediate.manifest + + + + + MinSpace + Size + ..\..\..\;..\..\..\Wasabi;..\..\..\replicant;%(AdditionalIncludeDirectories) + WIN32;_WINDOWS;NDEBUG;_USRDLL;ML_FANZONE_LIB;__STDC_CONSTANT_MACROS;__STDC_FORMAT_MACROS;_WIN32;UNICODE;_UNICODE;WINVER=0x0601;_WIN32_WINNT=0x601;NOMINMAX;WIN32_LEAN_AND_MEAN;_HAS_EXCEPTIONS=0;PSAPI_VERSION=1;CEF_USE_ATL;_NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions) + true + true + MultiThreadedDLL + true + Level3 + ProgramDatabase + $(IntDir)$(TargetName).pdb + 4100;4127;4244;4324;4481;4512;4701;4702;4996 + stdcpp14 + + + comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + false + $(IntDir)$(TargetName).pdb + Windows + true + true + false + $(IntDir)$(TargetName).lib + MachineX86 + false + %(AdditionalLibraryDirectories) + + + %(IgnoreSpecificDefaultLibraries) + 0x8000 + true + %(AdditionalManifestDependencies) + true + + + xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ + + Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\' + + + _WIN32_WINNT=0x0601;WINVER=0x0601;_UNICODE;UNICODE;%(PreprocessorDefinitions) + + + $(IntDir)$(TargetName)$(TargetExt).intermediate.manifest + ml_fanzone.dll.manifest;compatibility.manifest + + + + + + + + + MinSpace + Size + .;..\..\..\Wasabi;%(AdditionalIncludeDirectories) + _WIN32_WINNT=0x0601;WINVER=0x0601;WIN64;NDEBUG;_WINDOWS;_USRDLL;ML_FANZONE_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + true + MultiThreadedDLL + true + Level3 + None + 4302;4311;%(DisableSpecificWarnings) + $(IntDir)$(TargetName).pdb + + + comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + false + $(IntDir)$(TargetName).pdb + Windows + true + true + false + $(IntDir)$(TargetName).lib + false + %(AdditionalLibraryDirectories) + + + 0x8000 + true + + + xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ + Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\' + + + _WIN32_WINNT=0x0601;WINVER=0x0601;_UNICODE;UNICODE;%(PreprocessorDefinitions) + + + $(IntDir)$(TargetName)$(TargetExt).intermediate.manifest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {3e0bfa8a-b86a-42e9-a33f-ec294f823f7f} + + + {c5714908-a71f-4644-bd95-aad8ee7914da} + + + + + + + + + \ No newline at end of file diff --git a/Src/Plugins/Library/ml_fanzone/ml_fanzone.vcxproj.filters b/Src/Plugins/Library/ml_fanzone/ml_fanzone.vcxproj.filters new file mode 100644 index 00000000..0134715e --- /dev/null +++ b/Src/Plugins/Library/ml_fanzone/ml_fanzone.vcxproj.filters @@ -0,0 +1,97 @@ + + + + + Source Files + + + Source Files + + + Source Files\gen_ml + + + Source Files\nu + + + Source Files\nu + + + Source Files\nu + + + Source Files\gen_ml + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files\gen_ml + + + Header Files\nu + + + Header Files\nu + + + Header Files\gen_ml + + + Header Files\nu + + + + + {b09f9553-f445-44f8-9a72-cb758d5286cf} + + + {be47cb42-3d48-4f47-83c8-6b797a58b3b5} + + + {e2ca50af-70fe-46f4-86cf-1ca4d35f7af3} + + + {ba64025b-123f-434f-b5cd-9f578be68b35} + + + {a842431b-0ab9-48d1-afdd-2492128c0577} + + + {88f1ad0f-1bde-4677-b4ef-149786474b02} + + + {fc3b229a-9ed1-4937-bc2d-726130e69bbf} + + + {46374174-4599-4ca0-b088-999738b14566} + + + + + Ressource Files + + + + + Image Files + + + Ressource Files + + + Ressource Files + + + + + + \ No newline at end of file diff --git a/Src/Plugins/Library/ml_fanzone/myCefApp.cpp b/Src/Plugins/Library/ml_fanzone/myCefApp.cpp new file mode 100644 index 00000000..a93eb43d --- /dev/null +++ b/Src/Plugins/Library/ml_fanzone/myCefApp.cpp @@ -0,0 +1,49 @@ +//#include "main.h" +// +//BOOL MyDialogExProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) +//{ +// static CefRefPtr cef_client; +// +// switch ( msg ) +// { +// case WM_INITDIALOG: +// { +// CefMainArgs main_args( GetModuleHandle( nullptr ) ); +// CefSettings settings; +// CefRefPtr app; +// CefInitialize( main_args, settings, app, nullptr ); +// +// HWND cef_container_handle = GetDlgItem( hwnd, IDC_CEF_CONTAINER ); +// +// RECT rect; +// GetClientRect( cef_container_handle, &rect ); +// CefRect cef_rect( rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top ); +// +// CefWindowInfo window_info; +// window_info.SetAsChild( cef_container_handle, cef_rect ); +// +// cef_client = new MyCefClient( cef_container_handle ); +// +// // Create the browser window in the container control. +// CefBrowserSettings browser_settings; +// CefRefPtr request_context; +// CefRefPtr extra_info; +// +// CefRefPtr browser = CefBrowserHost::CreateBrowserSync( window_info, cef_client.get(), FANZONE_BASE_URL, browser_settings, extra_info, request_context ); +// +// +// return TRUE; +// } +// +// case WM_DESTROY: +// { +// CefShutdown(); +// break; +// } +// +// default: +// break; +// } +// +// return FALSE; +//} diff --git a/Src/Plugins/Library/ml_fanzone/resource.h b/Src/Plugins/Library/ml_fanzone/resource.h new file mode 100644 index 00000000..d9b2da8d --- /dev/null +++ b/Src/Plugins/Library/ml_fanzone/resource.h @@ -0,0 +1,23 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by ml_fanzone.rc +// +#define IDS_FANZONE 1 +#define IDI_CEFSIMPLE 100 +#define IDD_VIEW_FANZONE 102 +#define IDI_SMALL 103 +#define IDC_LIST_NFT 1001 +#define IDC_LIST_FANZONE 1001 +#define IDB_TREEITEM_FANZONE 1003 +#define IDS_NULLSOFT_FANZONE 65534 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 105 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Src/Plugins/Library/ml_fanzone/resources/FANZONE_16x16.bmp b/Src/Plugins/Library/ml_fanzone/resources/FANZONE_16x16.bmp new file mode 100644 index 00000000..04905290 Binary files /dev/null and b/Src/Plugins/Library/ml_fanzone/resources/FANZONE_16x16.bmp differ diff --git a/Src/Plugins/Library/ml_fanzone/resources/cefsimple.ico b/Src/Plugins/Library/ml_fanzone/resources/cefsimple.ico new file mode 100644 index 00000000..d551aa3a Binary files /dev/null and b/Src/Plugins/Library/ml_fanzone/resources/cefsimple.ico differ diff --git a/Src/Plugins/Library/ml_fanzone/resources/small.ico b/Src/Plugins/Library/ml_fanzone/resources/small.ico new file mode 100644 index 00000000..d551aa3a Binary files /dev/null and b/Src/Plugins/Library/ml_fanzone/resources/small.ico differ diff --git a/Src/Plugins/Library/ml_fanzone/version.rc2 b/Src/Plugins/Library/ml_fanzone/version.rc2 new file mode 100644 index 00000000..b0271335 --- /dev/null +++ b/Src/Plugins/Library/ml_fanzone/version.rc2 @@ -0,0 +1,39 @@ + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// +#include "../../../Winamp/buildType.h" +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,1,0,0 + PRODUCTVERSION WINAMP_PRODUCTVER + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Winamp SA" + VALUE "FileDescription", "Winamp Media Library Plug-in" + VALUE "FileVersion", "0,1,0,0" + VALUE "InternalName", "Nullsoft Fanzone Library" + VALUE "LegalCopyright", "Copyright © 2003-2023 Winamp SA" + VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA" + VALUE "OriginalFilename", "ml_fanzone.dll" + VALUE "ProductName", "Winamp" + VALUE "ProductVersion", STR_WINAMP_PRODUCTVER + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/Src/Plugins/Library/ml_fanzone/view.cpp b/Src/Plugins/Library/ml_fanzone/view.cpp new file mode 100644 index 00000000..b223c2df --- /dev/null +++ b/Src/Plugins/Library/ml_fanzone/view.cpp @@ -0,0 +1,444 @@ +#include +#include "main.h" +#include + +#include "../nu/DialogSkinner.h" +#include "../nu/ListView.h" + +#include "../../General/gen_ml/ml_ipc.h" +#include "../../General/gen_ml/menu.h" + +#include "../WAT/WAT.h" + + +#ifdef _DEBUG +constexpr auto FANZONE_BASE_URL = L"https://player-stg.winamp.com/fanzone/music?mtm_campaign=legendary_player"; +#else +constexpr auto FANZONE_BASE_URL = L"https://player.winamp.com/fanzone/music?mtm_campaign=legendary_player"; +#endif // _DEBUG + +INT_PTR CALLBACK view_FANZONEDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam); +static W_ListView m_fanzone_node; +static HWND m_headerhwnd; +extern C_Config *g_config; +extern char *g_ext_list; +static int customAllowed; +static viewButtons view; + +C_Config *g_wa_config = 0; +char *g_ext_list = 0; + +// used for the send-to menu bits +static INT_PTR IPC_LIBRARY_SENDTOMENU; +static librarySendToMenuStruct s; +BOOL myMenu = FALSE; + +extern HMENU g_context_menus, g_context_menus2; +extern HCURSOR hDragNDropCursor; + +static int FANZONE_contextMenu( INT_PTR param1, HWND hHost, POINTS pts ) +{ + return TRUE; +} + +static int pluginHandleIpcMessage(int msg, int param) +{ + return (int)SendMessage( plugin.hwndLibraryParent, WM_ML_IPC, param, msg ); +} + +INT_PTR fanzone_pluginMessageProc( int message_type, INT_PTR param1, INT_PTR param2, INT_PTR param3 ) +{ + if ( message_type == ML_MSG_NO_CONFIG ) + { + return TRUE; + } + else if ( message_type == ML_MSG_TREE_ONCREATEVIEW && param1 == fanzone_treeItem ) + { + return (INT_PTR)WASABI_API_CREATEDIALOGW( IDD_VIEW_FANZONE, (HWND)param2, view_FANZONEDialogProc ); + } + else if ( message_type == ML_MSG_NAVIGATION_CONTEXTMENU ) + { + return FANZONE_contextMenu( param1, (HWND)param2, MAKEPOINTS( param3 ) ); + } + else if ( message_type == ML_MSG_ONSENDTOSELECT || message_type == ML_MSG_TREE_ONDROPTARGET ) + { + // set with droptarget defaults =) + UINT_PTR type = 0, data = 0; + + if ( message_type == ML_MSG_ONSENDTOSELECT ) + { + if ( param3 != (INT_PTR)fanzone_pluginMessageProc ) return 0; + + type = (int)param1; + data = (int)param2; + } + else + { + if ( param1 != fanzone_treeItem ) return 0; + + type = (int)param2; + data = (int)param3; + + if ( !data ) + { + return ( type == ML_TYPE_ITEMRECORDLISTW || type == ML_TYPE_ITEMRECORDLIST || + type == ML_TYPE_FILENAMES || type == ML_TYPE_STREAMNAMES || + type == ML_TYPE_FILENAMESW || type == ML_TYPE_STREAMNAMESW || + type == ML_TYPE_CDTRACKS || + type == ML_TYPE_PLAYLIST || type == ML_TYPE_PLAYLISTS ) ? 1 : -1; + } + } + } + else if ( message_type == WM_WA_IPC ) + { + + int l_toto = 0; + } + else if ( message_type == IPC_SETVOLUME ) + { + int curvol = IPC_GETVOLUME( plugin.hwndWinampParent ); + + + int l_toto = 0; + } + else if ( message_type == WINAMP_VOLUMEDOWN ) + { + + + int l_toto = 0; + } + else if ( message_type == WINAMP_VOLUMEUP ) + { + + + int l_toto = 0; + } + + + return 0; +} + + +static HRGN g_rgnUpdate = NULL; +static int offsetX = 0, offsetY = 0; + +typedef struct _LAYOUT +{ + INT id; + HWND hwnd; + INT x; + INT y; + INT cx; + INT cy; + DWORD flags; + HRGN rgn; +} +LAYOUT, PLAYOUT; + +#define SETLAYOUTPOS(_layout, _x, _y, _cx, _cy) { _layout->x=_x; _layout->y=_y;_layout->cx=_cx;_layout->cy=_cy;_layout->rgn=NULL; } +#define SETLAYOUTFLAGS(_layout, _r) \ + { \ + BOOL fVis; \ + fVis = (WS_VISIBLE & (LONG)GetWindowLongPtr(_layout->hwnd, GWL_STYLE)); \ + if (_layout->x == _r.left && _layout->y == _r.top) _layout->flags |= SWP_NOMOVE; \ + if (_layout->cx == (_r.right - _r.left) && _layout->cy == (_r.bottom - _r.top)) _layout->flags |= SWP_NOSIZE; \ + if ((SWP_HIDEWINDOW & _layout->flags) && !fVis) _layout->flags &= ~SWP_HIDEWINDOW; \ + if ((SWP_SHOWWINDOW & _layout->flags) && fVis) _layout->flags &= ~SWP_SHOWWINDOW; \ + } + +#define LAYOUTNEEEDUPDATE(_layout) ((SWP_NOMOVE | SWP_NOSIZE) != ((SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW | SWP_SHOWWINDOW) & _layout->flags)) + +#define GROUP_MIN 0x1 +#define GROUP_MAX 0x2 +#define GROUP_STATUSBAR 0x1 +#define GROUP_MAIN 0x2 + +static void LayoutWindows(HWND hwnd, BOOL fRedraw, BOOL fUpdateAll = FALSE) +{ + static INT controls[] = + { + GROUP_STATUSBAR, GROUP_MAIN, IDC_LIST_FANZONE + }; + + INT index; + RECT rc, rg, ri; + LAYOUT layout[ sizeof( controls ) / sizeof( controls[ 0 ] ) ], *pl; + BOOL skipgroup; + HRGN rgn = NULL; + + GetClientRect(hwnd, &rc); + if ( rc.right == rc.left || rc.bottom == rc.top ) + return; + + if ( rc.right > WASABI_API_APP->getScaleX( 4 ) ) + rc.right -= WASABI_API_APP->getScaleX( 4 ); + + SetRect(&rg, rc.left, rc.top, rc.right, rc.top); + + pl = layout; + skipgroup = FALSE; + + InvalidateRect(hwnd, NULL, TRUE); + + for ( index = 0; index < sizeof( controls ) / sizeof( *controls ); index++ ) + { + if ( controls[ index ] >= GROUP_MIN && controls[ index ] <= GROUP_MAX ) // group id + { + skipgroup = FALSE; + switch ( controls[ index ] ) + { + case GROUP_MAIN: + SetRect( &rg, rc.left + WASABI_API_APP->getScaleX( 1 ), rc.top, rc.right, rc.bottom ); + break; + } + continue; + } + + if (skipgroup) + continue; + + pl->id = controls[ index ]; + pl->hwnd = GetDlgItem( hwnd, pl->id ); + if ( !pl->hwnd ) + continue; + + GetWindowRect( pl->hwnd, &ri ); + MapWindowPoints( HWND_DESKTOP, hwnd, (LPPOINT)&ri, 2 ); + pl->flags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS; + + switch (pl->id) + { + case IDC_LIST_FANZONE: + pl->flags |= (rg.top < rg.bottom) ? SWP_SHOWWINDOW : SWP_HIDEWINDOW; + SETLAYOUTPOS(pl, rg.left, rg.top + WASABI_API_APP->getScaleY(1), + rg.right - rg.left + WASABI_API_APP->getScaleY(1), + (rg.bottom - rg.top) - WASABI_API_APP->getScaleY(2)); + break; + } + + SETLAYOUTFLAGS( pl, ri ); + if ( LAYOUTNEEEDUPDATE( pl ) ) + { + if ( SWP_NOSIZE == ( ( SWP_HIDEWINDOW | SWP_SHOWWINDOW | SWP_NOSIZE ) & pl->flags ) && ri.left == ( pl->x + offsetX ) && ri.top == ( pl->y + offsetY ) && IsWindowVisible( pl->hwnd ) ) + { + SetRect( &ri, pl->x, pl->y, pl->cx + pl->x, pl->y + pl->cy ); + ValidateRect( hwnd, &ri ); + } + pl++; + } + else if ((fRedraw || (!offsetX && !offsetY)) && IsWindowVisible(pl->hwnd)) + { + ValidateRect(hwnd, &ri); + if ( GetUpdateRect( pl->hwnd, NULL, FALSE ) ) + { + if ( !rgn ) + rgn = CreateRectRgn( 0, 0, 0, 0 ); + + GetUpdateRgn( pl->hwnd, rgn, FALSE ); + OffsetRgn( rgn, pl->x, pl->y ); + InvalidateRgn( hwnd, rgn, FALSE ); + } + } + } + + if (pl != layout) + { + LAYOUT *pc; + HDWP hdwp = BeginDeferWindowPos( (INT)( pl - layout ) ); + for ( pc = layout; pc < pl && hdwp; pc++ ) + { + hdwp = DeferWindowPos( hdwp, pc->hwnd, NULL, pc->x, pc->y, pc->cx, pc->cy, pc->flags ); + } + + if ( hdwp ) + EndDeferWindowPos( hdwp ); + + if ( !rgn ) + rgn = CreateRectRgn( 0, 0, 0, 0 ); + + if ( fRedraw ) + { + GetUpdateRgn( hwnd, rgn, FALSE ); + for ( pc = layout; pc < pl && hdwp; pc++ ) + { + if ( pc->rgn ) + { + OffsetRgn( pc->rgn, pc->x, pc->y ); + CombineRgn( rgn, rgn, pc->rgn, RGN_OR ); + } + } + + RedrawWindow( hwnd, NULL, rgn, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASENOW | RDW_ALLCHILDREN ); + } + + if ( g_rgnUpdate ) + { + GetUpdateRgn( hwnd, g_rgnUpdate, FALSE ); + for ( pc = layout; pc < pl && hdwp; pc++ ) + { + if ( pc->rgn ) + { + OffsetRgn( pc->rgn, pc->x, pc->y ); + CombineRgn( g_rgnUpdate, g_rgnUpdate, pc->rgn, RGN_OR ); + } + } + } + + for ( pc = layout; pc < pl && hdwp; pc++ ) + if ( pc->rgn ) + DeleteObject( pc->rgn ); + } + + if ( rgn ) + DeleteObject( rgn ); + + ValidateRgn( hwnd, NULL ); +} + +static BOOL FANZONE_OnDisplayChange() +{ + ListView_SetTextColor( m_fanzone_node.getwnd(), dialogSkinner.Color( WADLG_ITEMFG ) ); + ListView_SetBkColor( m_fanzone_node.getwnd(), dialogSkinner.Color( WADLG_ITEMBG ) ); + ListView_SetTextBkColor( m_fanzone_node.getwnd(), dialogSkinner.Color( WADLG_ITEMBG ) ); + + m_fanzone_node.SetFont( dialogSkinner.GetFont() ); + + LayoutWindows( m_hwnd, TRUE ); + + // Display the modal windows + ShowWindow( m_fanzone_node.getwnd(), SW_SHOW ); + UpdateWindow( m_fanzone_node.getwnd() ); + + return 0; +} + + +enum +{ + BPM_ECHO_WM_COMMAND = 0x1, // send WM_COMMAND and return value + BPM_WM_COMMAND = 0x2, // just send WM_COMMAND +}; + +static BOOL FANZONE_OnCommand( HWND hwnd, int id, HWND hwndCtl, UINT codeNotify ) +{ + return FALSE; +} + +static BOOL FANZONE_OnDestroy(HWND hwnd) +{ + m_hwnd = 0; + + return FALSE; +} + +static BOOL FANZONE_OnNotify(HWND hwnd, NMHDR *notification) +{ + if (notification->idFrom == IDC_LIST_FANZONE) + { + if (notification->code == LVN_BEGINDRAG) + { + SetCapture(hwnd); + } + } + return FALSE; +} + +static BOOL FANZONE_OnInitDialog(HWND hwndDlg, HWND hwndFocus, LPARAM lParam) +{ + m_hwnd = hwndDlg; + + m_fanzone_node.setwnd(GetDlgItem(hwndDlg, IDC_LIST_FANZONE)); + + + if (!view.play) + { + SENDMLIPC(plugin.hwndLibraryParent, ML_IPC_GET_VIEW_BUTTON_TEXT, (WPARAM)&view); + } + + + FANZONE_OnDisplayChange(); + + m_headerhwnd = ListView_GetHeader( m_fanzone_node.getwnd() ); + + // v5.66+ - re-use the old predixis parts so the button can be used functionally via ml_enqplay + // pass the hwnd, button id and plug-in id so the ml plug-in can check things as needed + customAllowed = FALSE; + + MLSKINWINDOW l_ml_skin_window = {0}; + l_ml_skin_window.skinType = SKINNEDWND_TYPE_DIALOG; + l_ml_skin_window.style = SWS_USESKINCOLORS | SWS_USESKINCURSORS | SWS_USESKINFONT; + l_ml_skin_window.hwndToSkin = m_hwnd; + MLSkinWindow( plugin.hwndLibraryParent, &l_ml_skin_window ); + + //l_ml_skin_window.skinType = SKINNEDWND_TYPE_STATIC; + //l_ml_skin_window.style = SWS_USESKINCOLORS | SWS_USESKINCURSORS | SWS_USESKINFONT; + //l_ml_skin_window.hwndToSkin = m_hwnd; + //MLSkinWindow( mediaLibrary.library, &l_ml_skin_window ); + + ShellExecuteW(NULL, L"open", FANZONE_BASE_URL, NULL, NULL, SW_SHOWNORMAL); + + delete g_wa_config; + + SetTimer( m_hwnd, 100, 15, NULL ); + + + return TRUE; +} + + + +INT_PTR CALLBACK view_FANZONEDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + INT_PTR a = dialogSkinner.Handle(hwndDlg, uMsg, wParam, lParam); + if (a) return a; + + switch(uMsg) + { + HANDLE_MSG(hwndDlg, WM_INITDIALOG, FANZONE_OnInitDialog); + HANDLE_MSG(hwndDlg, WM_COMMAND, FANZONE_OnCommand); + HANDLE_MSG(hwndDlg, WM_DESTROY, FANZONE_OnDestroy); + + case WM_WINDOWPOSCHANGED: + if ((SWP_NOSIZE | SWP_NOMOVE) != ((SWP_NOSIZE | SWP_NOMOVE) & ((WINDOWPOS*)lParam)->flags) || + (SWP_FRAMECHANGED & ((WINDOWPOS*)lParam)->flags)) + { + LayoutWindows(hwndDlg, !(SWP_NOREDRAW & ((WINDOWPOS*)lParam)->flags)); + } + return 0; + + case WM_USER + 0x200: + SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, 1); // yes, we support no - redraw resize + return TRUE; + + case WM_USER + 0x201: + offsetX = (short)LOWORD(wParam); + offsetY = (short)HIWORD(wParam); + g_rgnUpdate = (HRGN)lParam; + return TRUE; + + case WM_PAINT: + { + int tab[] = { IDC_LIST_FANZONE | DCW_SUNKENBORDER }; + dialogSkinner.Draw(hwndDlg, tab, sizeof(tab) / sizeof(tab[0])); + } + return 0; + + case WM_INITMENUPOPUP: + if (wParam && (HMENU)wParam == s.build_hMenu && s.mode==1) + { + myMenu = TRUE; + if(SendMessage(plugin.hwndWinampParent, WM_WA_IPC, (WPARAM)&s, IPC_LIBRARY_SENDTOMENU)==0xffffffff) + s.mode=2; + myMenu = FALSE; + } + return 0; + + case WM_DISPLAYCHANGE: + return FANZONE_OnDisplayChange(); + + case WM_NOTIFY: + return FANZONE_OnNotify(hwndDlg, (LPNMHDR)lParam); + } + + return FALSE; +} \ No newline at end of file -- cgit