From 53f5ceb6743ef8c0127ec602ebb3c439d993ab37 Mon Sep 17 00:00:00 2001 From: spx Date: Wed, 27 Feb 2013 20:00:26 +0900 Subject: [PATCH] Updated plugin API - Added new option to RmGet(): RMG_SKINNAME, RMG_SKINWINDOWHANDLE --- Library/Export.cpp | 14 ++++++++++++++ Plugins/API/RainmeterAPI.cs | 21 +++++++++++++++++++-- Plugins/API/RainmeterAPI.h | 18 +++++++++++++++--- 3 files changed, 48 insertions(+), 5 deletions(-) diff --git a/Library/Export.cpp b/Library/Export.cpp index 0ae0d5cf..e4b58e2a 100644 --- a/Library/Export.cpp +++ b/Library/Export.cpp @@ -78,6 +78,20 @@ void* __stdcall RmGet(void* rm, int type) { return (void*)Rainmeter->GetDataFile().c_str(); } + + case RMG_SKINNAME: + { + CMeterWindow* window = measure->GetMeterWindow(); + if (!window) break; + return (void*)window->GetFolderPath().c_str(); + } + + case RMG_SKINWINDOWHANDLE: + { + CMeterWindow* window = measure->GetMeterWindow(); + if (!window) break; + return (void*)window->GetWindow(); + } } return NULL; diff --git a/Plugins/API/RainmeterAPI.cs b/Plugins/API/RainmeterAPI.cs index 6162a160..d75e4a7c 100644 --- a/Plugins/API/RainmeterAPI.cs +++ b/Plugins/API/RainmeterAPI.cs @@ -64,9 +64,9 @@ namespace Rainmeter Debug = 4 } - public unsafe string ReadString(string option, string defValue) + public unsafe string ReadString(string option, string defValue, bool replaceMeasures = true) { - char* value = RmReadString((void*)m_Rm, ToUnsafe(option), ToUnsafe(defValue), 1); + char* value = RmReadString((void*)m_Rm, ToUnsafe(option), ToUnsafe(defValue), replaceMeasures ? 1 : 0); return new string(value); } @@ -98,6 +98,23 @@ namespace Rainmeter return (IntPtr)RmGet((void*)m_Rm, 1); } + public unsafe string GetSettingsFile() + { + char* value = (char*)RmGet((void*)m_Rm, 2); + return new string(value); + } + + public unsafe string GetSkinName() + { + char* value = (char*)RmGet((void*)m_Rm, 3); + return new string(value); + } + + public unsafe IntPtr GetSkinWindow() + { + return (IntPtr)RmGet((void*)m_Rm, 4); + } + public static unsafe void Execute(IntPtr skin, string command) { RmExecute((void*)skin, ToUnsafe(command)); diff --git a/Plugins/API/RainmeterAPI.h b/Plugins/API/RainmeterAPI.h index 5f7ac225..1f5e3e3a 100644 --- a/Plugins/API/RainmeterAPI.h +++ b/Plugins/API/RainmeterAPI.h @@ -47,9 +47,11 @@ LIBRARY_EXPORT void* __stdcall RmGet(void* rm, int type); enum RmGetType { - RMG_MEASURENAME = 0, - RMG_SKIN = 1, - RMG_SETTINGSFILE = 2 + RMG_MEASURENAME = 0, + RMG_SKIN = 1, + RMG_SETTINGSFILE = 2, + RMG_SKINNAME = 3, + RMG_SKINWINDOWHANDLE = 4 }; LIBRARY_EXPORT BOOL LSLog(int type, LPCWSTR unused, LPCWSTR message); @@ -90,6 +92,16 @@ __inline void* RmGetSkin(void* rm) return (void*)RmGet(rm, RMG_SKIN); } +__inline LPCWSTR RmGetSkinName(void* rm) +{ + return (LPCWSTR)RmGet(rm, RMG_SKINNAME); +} + +__inline void* RmGetSkinWindow(void* rm) +{ + return (void*)RmGet(rm, RMG_SKINWINDOWHANDLE); +} + __inline void RmLog(int level, LPCWSTR message) { LSLog(level, NULL, message);