mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Fixed line endings and applied gitignore
This commit is contained in:
@ -1,117 +1,117 @@
|
||||
#ifndef _DEXPOT_CONSTANTS_H_
|
||||
#define _DEXPOT_CONSTANTS_H_
|
||||
|
||||
#define DEXPOTTITLE _T("Dexpot - Main Menu")
|
||||
#define DEXPOTCLASS _T("ThunderRT6FormDC")
|
||||
#define DEXPOTCLASS2 _T("ThunderFormDC")
|
||||
|
||||
#define WM_HOOXPOTRUFT 1802
|
||||
|
||||
#define DEX_SWITCHDESKTOP (WM_HOOXPOTRUFT + 1)
|
||||
#define DEX_DEXPOTCOMMAND (WM_HOOXPOTRUFT + 2)
|
||||
|
||||
#define DEX_MOVEICONS (WM_HOOXPOTRUFT + 13)
|
||||
#define DEX_COPYICONS (WM_HOOXPOTRUFT + 14)
|
||||
#define DEX_REMOVEICONS (WM_HOOXPOTRUFT + 15)
|
||||
|
||||
#define DEX_REGISTERPLUGIN (WM_HOOXPOTRUFT + 200)
|
||||
#define DEX_UNREGISTERPLUGIN (WM_HOOXPOTRUFT + 217)
|
||||
#define DEX_SETFILEMAP (WM_HOOXPOTRUFT + 218)
|
||||
|
||||
#define DEX_REGISTERHOTKEY (WM_HOOXPOTRUFT + 211)
|
||||
#define DEX_LOADSETTINGS (WM_HOOXPOTRUFT + 212)
|
||||
#define DEX_REGISTEROPTION (WM_HOOXPOTRUFT + 213)
|
||||
#define DEX_SETOPTIONVALUE (WM_HOOXPOTRUFT + 214)
|
||||
#define DEX_SETHOTKEYVALUE (WM_HOOXPOTRUFT + 215)
|
||||
#define DEX_SAVESETTINGS (WM_HOOXPOTRUFT + 216)
|
||||
|
||||
#define DEX_GETSCREENSHOT (WM_HOOXPOTRUFT + 201)
|
||||
#define DEX_GETDESKTOPWIDTH (WM_HOOXPOTRUFT + 202)
|
||||
#define DEX_GETDESKTOPHEIGHT (WM_HOOXPOTRUFT + 203)
|
||||
#define DEX_GETCURRENTDESKTOP (WM_HOOXPOTRUFT + 204)
|
||||
#define DEX_GETDESKTOPCOUNT (WM_HOOXPOTRUFT + 205)
|
||||
#define DEX_SETSWITCHINGEXCEPTION (WM_HOOXPOTRUFT + 206)
|
||||
#define DEX_GETSWITCHINGEXCEPTION (WM_HOOXPOTRUFT + 207)
|
||||
#define DEX_SETMINANIMATION (WM_HOOXPOTRUFT + 208)
|
||||
#define DEX_DEBUGOUTPUT (WM_HOOXPOTRUFT + 209)
|
||||
#define DEX_GETDEBUGMODE (WM_HOOXPOTRUFT + 210)
|
||||
#define DEX_GETLANGUAGEFILE (WM_HOOXPOTRUFT + 219)
|
||||
#define DEX_INSERTMAINMENUITEM (WM_HOOXPOTRUFT + 220)
|
||||
#define DEX_GETDESKTOPTITLE (WM_HOOXPOTRUFT + 221)
|
||||
#define DEX_GETDESKTOPWALLPAPER (WM_HOOXPOTRUFT + 222)
|
||||
#define DEX_ISPORTABLE (WM_HOOXPOTRUFT + 223)
|
||||
#define DEX_GETDEXPOTHOME (WM_HOOXPOTRUFT + 224)
|
||||
#define DEX_GETAPPDATAPATH (WM_HOOXPOTRUFT + 225)
|
||||
#define DEX_GETTRAYICONMODE (WM_HOOXPOTRUFT + 226)
|
||||
#define DEX_SETTRAYICONMODE (WM_HOOXPOTRUFT + 227)
|
||||
#define DEX_GATHERWINDOWS (WM_HOOXPOTRUFT + 228)
|
||||
#define DEX_MOVEWINDOW (WM_HOOXPOTRUFT + 229)
|
||||
#define DEX_COPYWINDOW (WM_HOOXPOTRUFT + 230)
|
||||
#define DEX_SETFOREGROUNDWINDOW (WM_HOOXPOTRUFT + 231)
|
||||
#define DEX_ASSIGNWINDOW (WM_HOOXPOTRUFT + 232)
|
||||
#define DEX_SWITCHTOWINDOW (WM_HOOXPOTRUFT + 233)
|
||||
#define DEX_SHOWWINDOW (WM_HOOXPOTRUFT + 234)
|
||||
#define DEX_UPDATESCREENSHOT (WM_HOOXPOTRUFT + 235)
|
||||
#define DEX_REMOVEMAINMENUITEM (WM_HOOXPOTRUFT + 236)
|
||||
#define DEX_SUBSCRIBEHOOXPOT (WM_HOOXPOTRUFT + 237)
|
||||
#define DEX_UNSUBSCRIBEHOOXPOT (WM_HOOXPOTRUFT + 238)
|
||||
#define DEX_GETACTIVEWINDOW (WM_HOOXPOTRUFT + 239)
|
||||
#define DEX_GETWINDOWSONDESKTOP (WM_HOOXPOTRUFT + 240)
|
||||
#define DEX_OPENWINDOWMENU (WM_HOOXPOTRUFT + 241)
|
||||
#define DEX_OPENMAINMENU (WM_HOOXPOTRUFT + 242)
|
||||
|
||||
#define DEX_SWITCHING (WM_HOOXPOTRUFT + 100)
|
||||
#define DEX_SWITCHED (WM_HOOXPOTRUFT + 101)
|
||||
#define DEX_SHUTDOWN (WM_HOOXPOTRUFT + 102)
|
||||
#define DEX_LOAD (WM_HOOXPOTRUFT + 103)
|
||||
#define DEX_HOTKEY (WM_HOOXPOTRUFT + 104)
|
||||
#define DEX_SETOPTION (WM_HOOXPOTRUFT + 105)
|
||||
#define DEX_CONFIGURE (WM_HOOXPOTRUFT + 106)
|
||||
#define DEX_MENUCOMMAND (WM_HOOXPOTRUFT + 107)
|
||||
#define DEX_SWITCHREQUEST (WM_HOOXPOTRUFT + 108)
|
||||
#define DEX_DESKTOPCOUNTCHANGED (WM_HOOXPOTRUFT + 109)
|
||||
#define DEX_DESKTOPCONTENTCHANGED (WM_HOOXPOTRUFT + 111)
|
||||
#define DEX_DESKTOPCONFIGURATIONCHANGED (WM_HOOXPOTRUFT + 112)
|
||||
#define DEX_DEXPOTSETTINGSCHANGED (WM_HOOXPOTRUFT + 113)
|
||||
|
||||
#define DEX_SWITCH_NOSCREENSHOT 0x0001
|
||||
#define DEX_SWITCH_DONTSWITCH 0x0002
|
||||
#define DEX_SWITCH_NOANIMATION 0x0004
|
||||
|
||||
#define DEX_OPTION_TYPE_INTEGER 1
|
||||
#define DEX_OPTION_TYPE_STRING 2
|
||||
|
||||
#define DEX_COMMAND_SETTINGS 1
|
||||
#define DEX_COMMAND_DESKTOPWINDOWS 2
|
||||
#define DEX_COMMAND_MANAGER 3
|
||||
#define DEX_COMMAND_CONFIGUREDESKTOPS 4
|
||||
#define DEX_COMMAND_PREVIEW 6
|
||||
#define DEX_COMMAND_RULES 7
|
||||
#define DEX_COMMAND_ABOUT 8
|
||||
#define DEX_COMMAND_EXIT 9
|
||||
#define DEX_COMMAND_QUICKEXIT 10
|
||||
#define DEX_COMMAND_FULLSCREENPREVIEW 11
|
||||
#define DEX_COMMAND_WINDOWCATALOG 12
|
||||
#define DEX_COMMAND_APPLYRULES 13
|
||||
|
||||
#define DEX_TRAYICON_NONE 0
|
||||
#define DEX_TRAYICON_NORMAL 1
|
||||
#define DEX_TRAYICON_CURRENTDESKTOP 2
|
||||
#define DEX_TRAYICON_NEXTPREVIOUS 3
|
||||
#define DEX_TRAYICON_ONEPERDESKTOP 4
|
||||
|
||||
#define DEX_EXCEPTION_UNKNOWN 0
|
||||
#define DEX_EXCEPTION_NORMAL 1
|
||||
#define DEX_EXCEPTION_MOVE 2
|
||||
#define DEX_EXCEPTION_STICKY 3
|
||||
#define DEX_EXCEPTION_CLOSE 6
|
||||
#define DEX_EXCEPTION_IGNORE 4
|
||||
#define DEX_EXCEPTION_HIDE 5
|
||||
#define DEX_EXCEPTION_DONTMOVE 7
|
||||
|
||||
#define DEX_DEBUG_LOGFILE 0x0001
|
||||
#define DEX_DEBUG_IMAGING 0x0002
|
||||
#define DEX_DEBUG_TASKBAR 0x0004
|
||||
#define DEX_DEBUG_RECOVERY 0x0008
|
||||
|
||||
#endif
|
||||
#ifndef _DEXPOT_CONSTANTS_H_
|
||||
#define _DEXPOT_CONSTANTS_H_
|
||||
|
||||
#define DEXPOTTITLE _T("Dexpot - Main Menu")
|
||||
#define DEXPOTCLASS _T("ThunderRT6FormDC")
|
||||
#define DEXPOTCLASS2 _T("ThunderFormDC")
|
||||
|
||||
#define WM_HOOXPOTRUFT 1802
|
||||
|
||||
#define DEX_SWITCHDESKTOP (WM_HOOXPOTRUFT + 1)
|
||||
#define DEX_DEXPOTCOMMAND (WM_HOOXPOTRUFT + 2)
|
||||
|
||||
#define DEX_MOVEICONS (WM_HOOXPOTRUFT + 13)
|
||||
#define DEX_COPYICONS (WM_HOOXPOTRUFT + 14)
|
||||
#define DEX_REMOVEICONS (WM_HOOXPOTRUFT + 15)
|
||||
|
||||
#define DEX_REGISTERPLUGIN (WM_HOOXPOTRUFT + 200)
|
||||
#define DEX_UNREGISTERPLUGIN (WM_HOOXPOTRUFT + 217)
|
||||
#define DEX_SETFILEMAP (WM_HOOXPOTRUFT + 218)
|
||||
|
||||
#define DEX_REGISTERHOTKEY (WM_HOOXPOTRUFT + 211)
|
||||
#define DEX_LOADSETTINGS (WM_HOOXPOTRUFT + 212)
|
||||
#define DEX_REGISTEROPTION (WM_HOOXPOTRUFT + 213)
|
||||
#define DEX_SETOPTIONVALUE (WM_HOOXPOTRUFT + 214)
|
||||
#define DEX_SETHOTKEYVALUE (WM_HOOXPOTRUFT + 215)
|
||||
#define DEX_SAVESETTINGS (WM_HOOXPOTRUFT + 216)
|
||||
|
||||
#define DEX_GETSCREENSHOT (WM_HOOXPOTRUFT + 201)
|
||||
#define DEX_GETDESKTOPWIDTH (WM_HOOXPOTRUFT + 202)
|
||||
#define DEX_GETDESKTOPHEIGHT (WM_HOOXPOTRUFT + 203)
|
||||
#define DEX_GETCURRENTDESKTOP (WM_HOOXPOTRUFT + 204)
|
||||
#define DEX_GETDESKTOPCOUNT (WM_HOOXPOTRUFT + 205)
|
||||
#define DEX_SETSWITCHINGEXCEPTION (WM_HOOXPOTRUFT + 206)
|
||||
#define DEX_GETSWITCHINGEXCEPTION (WM_HOOXPOTRUFT + 207)
|
||||
#define DEX_SETMINANIMATION (WM_HOOXPOTRUFT + 208)
|
||||
#define DEX_DEBUGOUTPUT (WM_HOOXPOTRUFT + 209)
|
||||
#define DEX_GETDEBUGMODE (WM_HOOXPOTRUFT + 210)
|
||||
#define DEX_GETLANGUAGEFILE (WM_HOOXPOTRUFT + 219)
|
||||
#define DEX_INSERTMAINMENUITEM (WM_HOOXPOTRUFT + 220)
|
||||
#define DEX_GETDESKTOPTITLE (WM_HOOXPOTRUFT + 221)
|
||||
#define DEX_GETDESKTOPWALLPAPER (WM_HOOXPOTRUFT + 222)
|
||||
#define DEX_ISPORTABLE (WM_HOOXPOTRUFT + 223)
|
||||
#define DEX_GETDEXPOTHOME (WM_HOOXPOTRUFT + 224)
|
||||
#define DEX_GETAPPDATAPATH (WM_HOOXPOTRUFT + 225)
|
||||
#define DEX_GETTRAYICONMODE (WM_HOOXPOTRUFT + 226)
|
||||
#define DEX_SETTRAYICONMODE (WM_HOOXPOTRUFT + 227)
|
||||
#define DEX_GATHERWINDOWS (WM_HOOXPOTRUFT + 228)
|
||||
#define DEX_MOVEWINDOW (WM_HOOXPOTRUFT + 229)
|
||||
#define DEX_COPYWINDOW (WM_HOOXPOTRUFT + 230)
|
||||
#define DEX_SETFOREGROUNDWINDOW (WM_HOOXPOTRUFT + 231)
|
||||
#define DEX_ASSIGNWINDOW (WM_HOOXPOTRUFT + 232)
|
||||
#define DEX_SWITCHTOWINDOW (WM_HOOXPOTRUFT + 233)
|
||||
#define DEX_SHOWWINDOW (WM_HOOXPOTRUFT + 234)
|
||||
#define DEX_UPDATESCREENSHOT (WM_HOOXPOTRUFT + 235)
|
||||
#define DEX_REMOVEMAINMENUITEM (WM_HOOXPOTRUFT + 236)
|
||||
#define DEX_SUBSCRIBEHOOXPOT (WM_HOOXPOTRUFT + 237)
|
||||
#define DEX_UNSUBSCRIBEHOOXPOT (WM_HOOXPOTRUFT + 238)
|
||||
#define DEX_GETACTIVEWINDOW (WM_HOOXPOTRUFT + 239)
|
||||
#define DEX_GETWINDOWSONDESKTOP (WM_HOOXPOTRUFT + 240)
|
||||
#define DEX_OPENWINDOWMENU (WM_HOOXPOTRUFT + 241)
|
||||
#define DEX_OPENMAINMENU (WM_HOOXPOTRUFT + 242)
|
||||
|
||||
#define DEX_SWITCHING (WM_HOOXPOTRUFT + 100)
|
||||
#define DEX_SWITCHED (WM_HOOXPOTRUFT + 101)
|
||||
#define DEX_SHUTDOWN (WM_HOOXPOTRUFT + 102)
|
||||
#define DEX_LOAD (WM_HOOXPOTRUFT + 103)
|
||||
#define DEX_HOTKEY (WM_HOOXPOTRUFT + 104)
|
||||
#define DEX_SETOPTION (WM_HOOXPOTRUFT + 105)
|
||||
#define DEX_CONFIGURE (WM_HOOXPOTRUFT + 106)
|
||||
#define DEX_MENUCOMMAND (WM_HOOXPOTRUFT + 107)
|
||||
#define DEX_SWITCHREQUEST (WM_HOOXPOTRUFT + 108)
|
||||
#define DEX_DESKTOPCOUNTCHANGED (WM_HOOXPOTRUFT + 109)
|
||||
#define DEX_DESKTOPCONTENTCHANGED (WM_HOOXPOTRUFT + 111)
|
||||
#define DEX_DESKTOPCONFIGURATIONCHANGED (WM_HOOXPOTRUFT + 112)
|
||||
#define DEX_DEXPOTSETTINGSCHANGED (WM_HOOXPOTRUFT + 113)
|
||||
|
||||
#define DEX_SWITCH_NOSCREENSHOT 0x0001
|
||||
#define DEX_SWITCH_DONTSWITCH 0x0002
|
||||
#define DEX_SWITCH_NOANIMATION 0x0004
|
||||
|
||||
#define DEX_OPTION_TYPE_INTEGER 1
|
||||
#define DEX_OPTION_TYPE_STRING 2
|
||||
|
||||
#define DEX_COMMAND_SETTINGS 1
|
||||
#define DEX_COMMAND_DESKTOPWINDOWS 2
|
||||
#define DEX_COMMAND_MANAGER 3
|
||||
#define DEX_COMMAND_CONFIGUREDESKTOPS 4
|
||||
#define DEX_COMMAND_PREVIEW 6
|
||||
#define DEX_COMMAND_RULES 7
|
||||
#define DEX_COMMAND_ABOUT 8
|
||||
#define DEX_COMMAND_EXIT 9
|
||||
#define DEX_COMMAND_QUICKEXIT 10
|
||||
#define DEX_COMMAND_FULLSCREENPREVIEW 11
|
||||
#define DEX_COMMAND_WINDOWCATALOG 12
|
||||
#define DEX_COMMAND_APPLYRULES 13
|
||||
|
||||
#define DEX_TRAYICON_NONE 0
|
||||
#define DEX_TRAYICON_NORMAL 1
|
||||
#define DEX_TRAYICON_CURRENTDESKTOP 2
|
||||
#define DEX_TRAYICON_NEXTPREVIOUS 3
|
||||
#define DEX_TRAYICON_ONEPERDESKTOP 4
|
||||
|
||||
#define DEX_EXCEPTION_UNKNOWN 0
|
||||
#define DEX_EXCEPTION_NORMAL 1
|
||||
#define DEX_EXCEPTION_MOVE 2
|
||||
#define DEX_EXCEPTION_STICKY 3
|
||||
#define DEX_EXCEPTION_CLOSE 6
|
||||
#define DEX_EXCEPTION_IGNORE 4
|
||||
#define DEX_EXCEPTION_HIDE 5
|
||||
#define DEX_EXCEPTION_DONTMOVE 7
|
||||
|
||||
#define DEX_DEBUG_LOGFILE 0x0001
|
||||
#define DEX_DEBUG_IMAGING 0x0002
|
||||
#define DEX_DEBUG_TASKBAR 0x0004
|
||||
#define DEX_DEBUG_RECOVERY 0x0008
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,210 +1,210 @@
|
||||
/*
|
||||
Copyright (C) 2010-2011 Patrick Dubbert
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "VDMeasure.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#define STRINGBUFFER_SIZE MAX_PATH
|
||||
|
||||
class DexpotMeasure : public VDMeasure
|
||||
{
|
||||
public:
|
||||
DexpotMeasure(HMODULE instance, UINT id);
|
||||
virtual ~DexpotMeasure(void) {};
|
||||
|
||||
virtual UINT Initialize(LPCTSTR iniFile, LPCTSTR section);
|
||||
virtual void Finalize();
|
||||
virtual UINT Update();
|
||||
virtual LPCTSTR GetString(UINT flags);
|
||||
virtual void ExecuteBang(LPCTSTR args) {};
|
||||
|
||||
static DexpotMeasure* CreateMeasure(HMODULE instance, UINT id, LPCTSTR iniFile, LPCTSTR section);
|
||||
|
||||
protected:
|
||||
virtual void InitializeData() {};
|
||||
virtual void OnSwitched(int FromDesktop, int ToDesktop, WORD Flags, WORD Trigger) {};
|
||||
virtual void OnDesktopCountChanged(int) {};
|
||||
virtual void OnShutdown() {};
|
||||
virtual void OnDexpotStarted();
|
||||
virtual void OnDesktopConfigurationChanged() {};
|
||||
|
||||
static void SendBang(std::wstring&);
|
||||
|
||||
static HWND hWndDexpot;
|
||||
static HWND hWndMessageWindow;
|
||||
static TCHAR StringBuffer[STRINGBUFFER_SIZE];
|
||||
static BOOL PluginRegistered;
|
||||
static int CurrentDesktop;
|
||||
|
||||
private:
|
||||
static BOOL FindDexpotWindow();
|
||||
static HWND CreateMessageWindow();
|
||||
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
static int InstanceCount;
|
||||
static HWND hWndRainmeterControl;
|
||||
static std::set<DexpotMeasure*> DexpotMeasures;
|
||||
static UINT WM_DEXPOTSTARTED;
|
||||
};
|
||||
|
||||
|
||||
class DexpotDesktopCountMeasure : public DexpotMeasure
|
||||
{
|
||||
public:
|
||||
DexpotDesktopCountMeasure(HMODULE instance, UINT id);
|
||||
virtual ~DexpotDesktopCountMeasure(void) {};
|
||||
|
||||
virtual UINT Initialize(LPCTSTR iniFile, LPCTSTR section);
|
||||
virtual UINT Update();
|
||||
virtual void InitializeData();
|
||||
virtual void OnDesktopCountChanged(int);
|
||||
|
||||
private:
|
||||
enum DesktopCountType
|
||||
{
|
||||
Total,
|
||||
Columns,
|
||||
Rows,
|
||||
};
|
||||
|
||||
int DesktopCount;
|
||||
std::wstring OnChange;
|
||||
DesktopCountType CountType;
|
||||
};
|
||||
|
||||
|
||||
class DexpotCurrentDesktopMeasure : public DexpotMeasure
|
||||
{
|
||||
public:
|
||||
DexpotCurrentDesktopMeasure(HMODULE instance, UINT id);
|
||||
virtual ~DexpotCurrentDesktopMeasure(void) {};
|
||||
|
||||
virtual UINT Initialize(LPCTSTR iniFile, LPCTSTR section);
|
||||
virtual UINT Update();
|
||||
virtual void OnSwitched(int, int, WORD, WORD);
|
||||
|
||||
private:
|
||||
std::wstring OnChange;
|
||||
};
|
||||
|
||||
|
||||
class DexpotVDMActiveMeasure : public DexpotMeasure
|
||||
{
|
||||
public:
|
||||
DexpotVDMActiveMeasure(HMODULE instance, UINT id);
|
||||
virtual ~DexpotVDMActiveMeasure(void) {};
|
||||
|
||||
virtual UINT Initialize(LPCTSTR iniFile, LPCTSTR section);
|
||||
virtual UINT Update();
|
||||
virtual void OnShutdown();
|
||||
virtual void OnDexpotStarted();
|
||||
|
||||
private:
|
||||
std::wstring OnActivate;
|
||||
std::wstring OnDeactivate;
|
||||
};
|
||||
|
||||
|
||||
class DexpotSwitchDesktopMeasure : public DexpotMeasure
|
||||
{
|
||||
public:
|
||||
DexpotSwitchDesktopMeasure(HMODULE instance, UINT id);
|
||||
virtual ~DexpotSwitchDesktopMeasure(void) {};
|
||||
|
||||
virtual void ExecuteBang(LPCTSTR args);
|
||||
};
|
||||
|
||||
|
||||
class DexpotScreenshotMeasure : public DexpotMeasure
|
||||
{
|
||||
public:
|
||||
DexpotScreenshotMeasure(HMODULE instance, UINT id);
|
||||
virtual ~DexpotScreenshotMeasure(void) {};
|
||||
|
||||
virtual UINT Initialize(LPCTSTR iniFile, LPCTSTR section);
|
||||
virtual UINT Update();
|
||||
virtual LPCTSTR GetString(UINT flags);
|
||||
virtual void InitializeData();
|
||||
virtual void OnSwitched(int, int, WORD, WORD);
|
||||
|
||||
private:
|
||||
void UpdateScreenshot();
|
||||
|
||||
std::wstring OutputFile;
|
||||
int DesktopNumber;
|
||||
int Width;
|
||||
int Height;
|
||||
BOOL RefreshOnUpdate;
|
||||
};
|
||||
|
||||
|
||||
class DexpotDesktopNameMeasure : public DexpotMeasure
|
||||
{
|
||||
public:
|
||||
DexpotDesktopNameMeasure(HMODULE instance, UINT id);
|
||||
virtual ~DexpotDesktopNameMeasure(void) {};
|
||||
|
||||
virtual UINT Initialize(LPCTSTR iniFile, LPCTSTR section);
|
||||
virtual LPCTSTR GetString(UINT flags);
|
||||
virtual void InitializeData();
|
||||
virtual void OnDesktopConfigurationChanged();
|
||||
virtual void OnDesktopCountChanged(int NewCount);
|
||||
|
||||
static void SetDesktopName(UINT Desktop, std::wstring &Name);
|
||||
|
||||
private:
|
||||
int DesktopNumber;
|
||||
static std::vector<std::wstring> DesktopNames;
|
||||
};
|
||||
|
||||
|
||||
class DexpotDesktopWallpaperMeasure : public DexpotMeasure
|
||||
{
|
||||
public:
|
||||
DexpotDesktopWallpaperMeasure(HMODULE instance, UINT id);
|
||||
virtual ~DexpotDesktopWallpaperMeasure(void) {};
|
||||
|
||||
virtual UINT Initialize(LPCTSTR iniFile, LPCTSTR section);
|
||||
virtual LPCTSTR GetString(UINT flags);
|
||||
virtual void InitializeData();
|
||||
virtual void OnSwitched(int FromDesktop, int ToDesktop, WORD Flags, WORD Trigger);
|
||||
virtual void OnDesktopConfigurationChanged();
|
||||
virtual void OnDesktopCountChanged(int NewCount);
|
||||
|
||||
static void SetDesktopWallpaper(UINT Desktop, std::wstring &Wallpaper);
|
||||
|
||||
private:
|
||||
int DesktopNumber;
|
||||
static std::vector<std::wstring> DesktopWallpapers;
|
||||
};
|
||||
|
||||
|
||||
class DexpotCommandMeasure : public DexpotMeasure
|
||||
{
|
||||
public:
|
||||
DexpotCommandMeasure(HMODULE instance, UINT id);
|
||||
virtual ~DexpotCommandMeasure(void) {};
|
||||
|
||||
virtual void ExecuteBang(LPCTSTR args);
|
||||
};
|
||||
/*
|
||||
Copyright (C) 2010-2011 Patrick Dubbert
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "VDMeasure.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#define STRINGBUFFER_SIZE MAX_PATH
|
||||
|
||||
class DexpotMeasure : public VDMeasure
|
||||
{
|
||||
public:
|
||||
DexpotMeasure(HMODULE instance, UINT id);
|
||||
virtual ~DexpotMeasure(void) {};
|
||||
|
||||
virtual UINT Initialize(LPCTSTR iniFile, LPCTSTR section);
|
||||
virtual void Finalize();
|
||||
virtual UINT Update();
|
||||
virtual LPCTSTR GetString(UINT flags);
|
||||
virtual void ExecuteBang(LPCTSTR args) {};
|
||||
|
||||
static DexpotMeasure* CreateMeasure(HMODULE instance, UINT id, LPCTSTR iniFile, LPCTSTR section);
|
||||
|
||||
protected:
|
||||
virtual void InitializeData() {};
|
||||
virtual void OnSwitched(int FromDesktop, int ToDesktop, WORD Flags, WORD Trigger) {};
|
||||
virtual void OnDesktopCountChanged(int) {};
|
||||
virtual void OnShutdown() {};
|
||||
virtual void OnDexpotStarted();
|
||||
virtual void OnDesktopConfigurationChanged() {};
|
||||
|
||||
static void SendBang(std::wstring&);
|
||||
|
||||
static HWND hWndDexpot;
|
||||
static HWND hWndMessageWindow;
|
||||
static TCHAR StringBuffer[STRINGBUFFER_SIZE];
|
||||
static BOOL PluginRegistered;
|
||||
static int CurrentDesktop;
|
||||
|
||||
private:
|
||||
static BOOL FindDexpotWindow();
|
||||
static HWND CreateMessageWindow();
|
||||
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
static int InstanceCount;
|
||||
static HWND hWndRainmeterControl;
|
||||
static std::set<DexpotMeasure*> DexpotMeasures;
|
||||
static UINT WM_DEXPOTSTARTED;
|
||||
};
|
||||
|
||||
|
||||
class DexpotDesktopCountMeasure : public DexpotMeasure
|
||||
{
|
||||
public:
|
||||
DexpotDesktopCountMeasure(HMODULE instance, UINT id);
|
||||
virtual ~DexpotDesktopCountMeasure(void) {};
|
||||
|
||||
virtual UINT Initialize(LPCTSTR iniFile, LPCTSTR section);
|
||||
virtual UINT Update();
|
||||
virtual void InitializeData();
|
||||
virtual void OnDesktopCountChanged(int);
|
||||
|
||||
private:
|
||||
enum DesktopCountType
|
||||
{
|
||||
Total,
|
||||
Columns,
|
||||
Rows,
|
||||
};
|
||||
|
||||
int DesktopCount;
|
||||
std::wstring OnChange;
|
||||
DesktopCountType CountType;
|
||||
};
|
||||
|
||||
|
||||
class DexpotCurrentDesktopMeasure : public DexpotMeasure
|
||||
{
|
||||
public:
|
||||
DexpotCurrentDesktopMeasure(HMODULE instance, UINT id);
|
||||
virtual ~DexpotCurrentDesktopMeasure(void) {};
|
||||
|
||||
virtual UINT Initialize(LPCTSTR iniFile, LPCTSTR section);
|
||||
virtual UINT Update();
|
||||
virtual void OnSwitched(int, int, WORD, WORD);
|
||||
|
||||
private:
|
||||
std::wstring OnChange;
|
||||
};
|
||||
|
||||
|
||||
class DexpotVDMActiveMeasure : public DexpotMeasure
|
||||
{
|
||||
public:
|
||||
DexpotVDMActiveMeasure(HMODULE instance, UINT id);
|
||||
virtual ~DexpotVDMActiveMeasure(void) {};
|
||||
|
||||
virtual UINT Initialize(LPCTSTR iniFile, LPCTSTR section);
|
||||
virtual UINT Update();
|
||||
virtual void OnShutdown();
|
||||
virtual void OnDexpotStarted();
|
||||
|
||||
private:
|
||||
std::wstring OnActivate;
|
||||
std::wstring OnDeactivate;
|
||||
};
|
||||
|
||||
|
||||
class DexpotSwitchDesktopMeasure : public DexpotMeasure
|
||||
{
|
||||
public:
|
||||
DexpotSwitchDesktopMeasure(HMODULE instance, UINT id);
|
||||
virtual ~DexpotSwitchDesktopMeasure(void) {};
|
||||
|
||||
virtual void ExecuteBang(LPCTSTR args);
|
||||
};
|
||||
|
||||
|
||||
class DexpotScreenshotMeasure : public DexpotMeasure
|
||||
{
|
||||
public:
|
||||
DexpotScreenshotMeasure(HMODULE instance, UINT id);
|
||||
virtual ~DexpotScreenshotMeasure(void) {};
|
||||
|
||||
virtual UINT Initialize(LPCTSTR iniFile, LPCTSTR section);
|
||||
virtual UINT Update();
|
||||
virtual LPCTSTR GetString(UINT flags);
|
||||
virtual void InitializeData();
|
||||
virtual void OnSwitched(int, int, WORD, WORD);
|
||||
|
||||
private:
|
||||
void UpdateScreenshot();
|
||||
|
||||
std::wstring OutputFile;
|
||||
int DesktopNumber;
|
||||
int Width;
|
||||
int Height;
|
||||
BOOL RefreshOnUpdate;
|
||||
};
|
||||
|
||||
|
||||
class DexpotDesktopNameMeasure : public DexpotMeasure
|
||||
{
|
||||
public:
|
||||
DexpotDesktopNameMeasure(HMODULE instance, UINT id);
|
||||
virtual ~DexpotDesktopNameMeasure(void) {};
|
||||
|
||||
virtual UINT Initialize(LPCTSTR iniFile, LPCTSTR section);
|
||||
virtual LPCTSTR GetString(UINT flags);
|
||||
virtual void InitializeData();
|
||||
virtual void OnDesktopConfigurationChanged();
|
||||
virtual void OnDesktopCountChanged(int NewCount);
|
||||
|
||||
static void SetDesktopName(UINT Desktop, std::wstring &Name);
|
||||
|
||||
private:
|
||||
int DesktopNumber;
|
||||
static std::vector<std::wstring> DesktopNames;
|
||||
};
|
||||
|
||||
|
||||
class DexpotDesktopWallpaperMeasure : public DexpotMeasure
|
||||
{
|
||||
public:
|
||||
DexpotDesktopWallpaperMeasure(HMODULE instance, UINT id);
|
||||
virtual ~DexpotDesktopWallpaperMeasure(void) {};
|
||||
|
||||
virtual UINT Initialize(LPCTSTR iniFile, LPCTSTR section);
|
||||
virtual LPCTSTR GetString(UINT flags);
|
||||
virtual void InitializeData();
|
||||
virtual void OnSwitched(int FromDesktop, int ToDesktop, WORD Flags, WORD Trigger);
|
||||
virtual void OnDesktopConfigurationChanged();
|
||||
virtual void OnDesktopCountChanged(int NewCount);
|
||||
|
||||
static void SetDesktopWallpaper(UINT Desktop, std::wstring &Wallpaper);
|
||||
|
||||
private:
|
||||
int DesktopNumber;
|
||||
static std::vector<std::wstring> DesktopWallpapers;
|
||||
};
|
||||
|
||||
|
||||
class DexpotCommandMeasure : public DexpotMeasure
|
||||
{
|
||||
public:
|
||||
DexpotCommandMeasure(HMODULE instance, UINT id);
|
||||
virtual ~DexpotCommandMeasure(void) {};
|
||||
|
||||
virtual void ExecuteBang(LPCTSTR args);
|
||||
};
|
||||
|
@ -1,40 +1,40 @@
|
||||
#include <VerRsrc.h>
|
||||
#include "../../Version.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,0
|
||||
PRODUCTVERSION PRODUCTVER
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE VFT_UNKNOWN
|
||||
{
|
||||
BLOCK "StringFileInfo"
|
||||
{
|
||||
BLOCK "040904E4"
|
||||
{
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
VALUE "LegalCopyright", "<22> 2010 - Dexpot GbR"
|
||||
VALUE "ProductName", "Rainmeter"
|
||||
#ifdef _WIN64
|
||||
VALUE "ProductVersion", STRPRODUCTVER " (64-bit)"
|
||||
#else
|
||||
VALUE "ProductVersion", STRPRODUCTVER " (32-bit)"
|
||||
#endif //_WIN64
|
||||
}
|
||||
}
|
||||
BLOCK "VarFileInfo"
|
||||
{
|
||||
VALUE "Translation", 0x409, 1252
|
||||
}
|
||||
}
|
||||
#include <VerRsrc.h>
|
||||
#include "../../Version.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,0
|
||||
PRODUCTVERSION PRODUCTVER
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE VFT_UNKNOWN
|
||||
{
|
||||
BLOCK "StringFileInfo"
|
||||
{
|
||||
BLOCK "040904E4"
|
||||
{
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
VALUE "LegalCopyright", "<22> 2010 - Dexpot GbR"
|
||||
VALUE "ProductName", "Rainmeter"
|
||||
#ifdef _WIN64
|
||||
VALUE "ProductVersion", STRPRODUCTVER " (64-bit)"
|
||||
#else
|
||||
VALUE "ProductVersion", STRPRODUCTVER " (32-bit)"
|
||||
#endif //_WIN64
|
||||
}
|
||||
}
|
||||
BLOCK "VarFileInfo"
|
||||
{
|
||||
VALUE "Translation", 0x409, 1252
|
||||
}
|
||||
}
|
||||
|
@ -1,44 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(SolutionDir)Build\VS\Rainmeter.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{4640AB3A-5A8B-2DA0-980C-A70BCAB3A7F1}</ProjectGuid>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<TargetName>VirtualDesktops</TargetName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(SolutionDir)Build\VS\Rainmeter.Cpp.props" />
|
||||
<Import Project="$(SolutionDir)Build\VS\RainmeterPlugin.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="DexpotConstants.h" />
|
||||
<ClInclude Include="DexpotMeasure.h" />
|
||||
<ClInclude Include="VirtuaWinMeasure.h" />
|
||||
<ClInclude Include="VirtuaWinMessages.h" />
|
||||
<ClInclude Include="VDMeasure.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="DexpotMeasure.cpp" />
|
||||
<ClCompile Include="VirtuaWinMeasure.cpp" />
|
||||
<ClCompile Include="VirtualDesktops.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="PluginVirtualDesktops.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(SolutionDir)Build\VS\Rainmeter.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{4640AB3A-5A8B-2DA0-980C-A70BCAB3A7F1}</ProjectGuid>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<TargetName>VirtualDesktops</TargetName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(SolutionDir)Build\VS\Rainmeter.Cpp.props" />
|
||||
<Import Project="$(SolutionDir)Build\VS\RainmeterPlugin.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="DexpotConstants.h" />
|
||||
<ClInclude Include="DexpotMeasure.h" />
|
||||
<ClInclude Include="VirtuaWinMeasure.h" />
|
||||
<ClInclude Include="VirtuaWinMessages.h" />
|
||||
<ClInclude Include="VDMeasure.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="DexpotMeasure.cpp" />
|
||||
<ClCompile Include="VirtuaWinMeasure.cpp" />
|
||||
<ClCompile Include="VirtualDesktops.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="PluginVirtualDesktops.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@ -1,38 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Dexpot">
|
||||
<UniqueIdentifier>{33f898cd-3c3c-42a0-9b7c-112f37cd558b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="VirtuaWin">
|
||||
<UniqueIdentifier>{9d236685-79d3-4b8c-a7d6-8405dd5d260b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="DexpotConstants.h">
|
||||
<Filter>Dexpot</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DexpotMeasure.h">
|
||||
<Filter>Dexpot</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VirtuaWinMeasure.h">
|
||||
<Filter>VirtuaWin</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VirtuaWinMessages.h">
|
||||
<Filter>VirtuaWin</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VDMeasure.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="DexpotMeasure.cpp">
|
||||
<Filter>Dexpot</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VirtuaWinMeasure.cpp">
|
||||
<Filter>VirtuaWin</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VirtualDesktops.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="PluginVirtualDesktops.rc" />
|
||||
</ItemGroup>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Dexpot">
|
||||
<UniqueIdentifier>{33f898cd-3c3c-42a0-9b7c-112f37cd558b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="VirtuaWin">
|
||||
<UniqueIdentifier>{9d236685-79d3-4b8c-a7d6-8405dd5d260b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="DexpotConstants.h">
|
||||
<Filter>Dexpot</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DexpotMeasure.h">
|
||||
<Filter>Dexpot</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VirtuaWinMeasure.h">
|
||||
<Filter>VirtuaWin</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VirtuaWinMessages.h">
|
||||
<Filter>VirtuaWin</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VDMeasure.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="DexpotMeasure.cpp">
|
||||
<Filter>Dexpot</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VirtuaWinMeasure.cpp">
|
||||
<Filter>VirtuaWin</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VirtualDesktops.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="PluginVirtualDesktops.rc" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,65 +1,65 @@
|
||||
/*
|
||||
Copyright (C) 2010 Patrick Dubbert
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
class VDMeasure
|
||||
{
|
||||
public:
|
||||
VDMeasure(HMODULE instance, UINT id) { hInstance = instance; ID = id; };
|
||||
virtual ~VDMeasure(void) {};
|
||||
|
||||
/*
|
||||
This function is called when the measure is initialized.
|
||||
The function must return the maximum value that can be measured.
|
||||
The return value can also be 0, which means that Rainmeter will
|
||||
track the maximum value automatically. The parameters for this
|
||||
function are:
|
||||
|
||||
iniFile The name of the ini-file (usually Rainmeter.ini)
|
||||
section The name of the section in the ini-file for this measure
|
||||
*/
|
||||
virtual UINT Initialize(LPCTSTR iniFile, LPCTSTR section) = 0;
|
||||
|
||||
/*
|
||||
If the measure needs to free resources before quitting.
|
||||
The plugin can export Finalize function, which is called
|
||||
when Rainmeter quits (or refreshes).
|
||||
*/
|
||||
virtual void Finalize() = 0;
|
||||
|
||||
/*
|
||||
This function is called when new value should be measured.
|
||||
The function returns the new value.
|
||||
*/
|
||||
virtual UINT Update() = 0;
|
||||
|
||||
/*
|
||||
This function is called when the value should be
|
||||
returned as a string.
|
||||
*/
|
||||
virtual LPCTSTR GetString(UINT flags) = 0;
|
||||
|
||||
virtual void ExecuteBang(LPCTSTR args) = 0;
|
||||
|
||||
protected:
|
||||
static HMODULE hInstance;
|
||||
UINT ID;
|
||||
};
|
||||
/*
|
||||
Copyright (C) 2010 Patrick Dubbert
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
class VDMeasure
|
||||
{
|
||||
public:
|
||||
VDMeasure(HMODULE instance, UINT id) { hInstance = instance; ID = id; };
|
||||
virtual ~VDMeasure(void) {};
|
||||
|
||||
/*
|
||||
This function is called when the measure is initialized.
|
||||
The function must return the maximum value that can be measured.
|
||||
The return value can also be 0, which means that Rainmeter will
|
||||
track the maximum value automatically. The parameters for this
|
||||
function are:
|
||||
|
||||
iniFile The name of the ini-file (usually Rainmeter.ini)
|
||||
section The name of the section in the ini-file for this measure
|
||||
*/
|
||||
virtual UINT Initialize(LPCTSTR iniFile, LPCTSTR section) = 0;
|
||||
|
||||
/*
|
||||
If the measure needs to free resources before quitting.
|
||||
The plugin can export Finalize function, which is called
|
||||
when Rainmeter quits (or refreshes).
|
||||
*/
|
||||
virtual void Finalize() = 0;
|
||||
|
||||
/*
|
||||
This function is called when new value should be measured.
|
||||
The function returns the new value.
|
||||
*/
|
||||
virtual UINT Update() = 0;
|
||||
|
||||
/*
|
||||
This function is called when the value should be
|
||||
returned as a string.
|
||||
*/
|
||||
virtual LPCTSTR GetString(UINT flags) = 0;
|
||||
|
||||
virtual void ExecuteBang(LPCTSTR args) = 0;
|
||||
|
||||
protected:
|
||||
static HMODULE hInstance;
|
||||
UINT ID;
|
||||
};
|
||||
|
@ -1,148 +1,148 @@
|
||||
/*
|
||||
Copyright (C) 2010 Patrick Dubbert
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "VirtuaWinMeasure.h"
|
||||
|
||||
#include <tchar.h>
|
||||
|
||||
#include "VirtuaWinMessages.h"
|
||||
#include "../../Library/Export.h"
|
||||
|
||||
HWND VirtuaWinMeasure::vwHandle = nullptr;
|
||||
std::map<std::wstring, VirtuaWinMeasure::MeasureType> VirtuaWinMeasure::StringToType;
|
||||
|
||||
VirtuaWinMeasure::VirtuaWinMeasure(HMODULE instance, UINT id) : VDMeasure(instance, id)
|
||||
{
|
||||
if (StringToType.size() == 0)
|
||||
{
|
||||
StringToType.insert(std::make_pair(std::wstring(L"VDMActive"), VDMActive));
|
||||
StringToType.insert(std::make_pair(std::wstring(L"DesktopCount"), DesktopCountTotal));
|
||||
StringToType.insert(std::make_pair(std::wstring(L"CurrentDesktop"), CurrentDesktop));
|
||||
StringToType.insert(std::make_pair(std::wstring(L"SwitchDesktop"), SwitchDesktop));
|
||||
}
|
||||
}
|
||||
|
||||
VirtuaWinMeasure::~VirtuaWinMeasure(void)
|
||||
{
|
||||
}
|
||||
|
||||
UINT VirtuaWinMeasure::Initialize(LPCTSTR iniFile, LPCTSTR section)
|
||||
{
|
||||
std::wstring TypeString(ReadConfigString(section, _T("VDMeasureType"), _T("")));
|
||||
std::map<std::wstring, MeasureType>::iterator i = StringToType.find(TypeString);
|
||||
if (i != StringToType.end())
|
||||
{
|
||||
Type = i->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
Type = Unknown;
|
||||
}
|
||||
|
||||
switch(Type)
|
||||
{
|
||||
case VDMActive:
|
||||
return 1;
|
||||
|
||||
case DesktopCountTotal:
|
||||
{
|
||||
LPCTSTR CountType = ReadConfigString(section, _T("VDDesktopCount"), _T(""));
|
||||
if (_tcsicmp(CountType, _T("X")) == 0) Type = DesktopCountColumns;
|
||||
else if (_tcsicmp(CountType, _T("Y")) == 0) Type = DesktopCountRows;
|
||||
if (FindVirtuaWinWindow())
|
||||
{
|
||||
return (UINT) SendMessage(vwHandle, VW_DESKTOP_SIZE, 0, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void VirtuaWinMeasure::Finalize()
|
||||
{
|
||||
}
|
||||
|
||||
UINT VirtuaWinMeasure::Update()
|
||||
{
|
||||
if (!FindVirtuaWinWindow())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch(Type)
|
||||
{
|
||||
case VDMActive:
|
||||
return 1;
|
||||
|
||||
case DesktopCountColumns:
|
||||
return (UINT) SendMessage(vwHandle, VW_DESKX, 0, 0);
|
||||
|
||||
case DesktopCountRows:
|
||||
return (UINT) SendMessage(vwHandle, VW_DESKY, 0, 0);
|
||||
|
||||
case DesktopCountTotal:
|
||||
return (UINT) SendMessage(vwHandle, VW_DESKX, 0, 0) * (UINT) SendMessage(vwHandle, VW_DESKY, 0, 0);
|
||||
|
||||
case CurrentDesktop:
|
||||
return (UINT) SendMessage(vwHandle, VW_CURDESK, 0, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LPCTSTR VirtuaWinMeasure::GetString(UINT flags)
|
||||
{
|
||||
static TCHAR Buffer[MAX_PATH];
|
||||
Buffer[0] = _T('\0');
|
||||
|
||||
switch(Type)
|
||||
{
|
||||
case VDMActive:
|
||||
case DesktopCountColumns:
|
||||
case DesktopCountRows:
|
||||
case DesktopCountTotal:
|
||||
case CurrentDesktop:
|
||||
swprintf_s(Buffer, MAX_PATH, L"%i", Update());
|
||||
break;
|
||||
}
|
||||
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
void VirtuaWinMeasure::ExecuteBang(LPCTSTR args)
|
||||
{
|
||||
INT32 Desktop;
|
||||
|
||||
if (!FindVirtuaWinWindow()) return;
|
||||
|
||||
switch(Type)
|
||||
{
|
||||
case SwitchDesktop:
|
||||
Desktop = _wtoi(args);
|
||||
SendNotifyMessage(vwHandle, VW_CHANGEDESK, Desktop, 0);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL VirtuaWinMeasure::FindVirtuaWinWindow()
|
||||
{
|
||||
if (IsWindow(vwHandle)) return TRUE;
|
||||
vwHandle = FindWindow(_T("VirtuaWinMainClass"), _T("VirtuaWinMainClass"));
|
||||
return vwHandle != nullptr;
|
||||
}
|
||||
/*
|
||||
Copyright (C) 2010 Patrick Dubbert
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "VirtuaWinMeasure.h"
|
||||
|
||||
#include <tchar.h>
|
||||
|
||||
#include "VirtuaWinMessages.h"
|
||||
#include "../../Library/Export.h"
|
||||
|
||||
HWND VirtuaWinMeasure::vwHandle = nullptr;
|
||||
std::map<std::wstring, VirtuaWinMeasure::MeasureType> VirtuaWinMeasure::StringToType;
|
||||
|
||||
VirtuaWinMeasure::VirtuaWinMeasure(HMODULE instance, UINT id) : VDMeasure(instance, id)
|
||||
{
|
||||
if (StringToType.size() == 0)
|
||||
{
|
||||
StringToType.insert(std::make_pair(std::wstring(L"VDMActive"), VDMActive));
|
||||
StringToType.insert(std::make_pair(std::wstring(L"DesktopCount"), DesktopCountTotal));
|
||||
StringToType.insert(std::make_pair(std::wstring(L"CurrentDesktop"), CurrentDesktop));
|
||||
StringToType.insert(std::make_pair(std::wstring(L"SwitchDesktop"), SwitchDesktop));
|
||||
}
|
||||
}
|
||||
|
||||
VirtuaWinMeasure::~VirtuaWinMeasure(void)
|
||||
{
|
||||
}
|
||||
|
||||
UINT VirtuaWinMeasure::Initialize(LPCTSTR iniFile, LPCTSTR section)
|
||||
{
|
||||
std::wstring TypeString(ReadConfigString(section, _T("VDMeasureType"), _T("")));
|
||||
std::map<std::wstring, MeasureType>::iterator i = StringToType.find(TypeString);
|
||||
if (i != StringToType.end())
|
||||
{
|
||||
Type = i->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
Type = Unknown;
|
||||
}
|
||||
|
||||
switch(Type)
|
||||
{
|
||||
case VDMActive:
|
||||
return 1;
|
||||
|
||||
case DesktopCountTotal:
|
||||
{
|
||||
LPCTSTR CountType = ReadConfigString(section, _T("VDDesktopCount"), _T(""));
|
||||
if (_tcsicmp(CountType, _T("X")) == 0) Type = DesktopCountColumns;
|
||||
else if (_tcsicmp(CountType, _T("Y")) == 0) Type = DesktopCountRows;
|
||||
if (FindVirtuaWinWindow())
|
||||
{
|
||||
return (UINT) SendMessage(vwHandle, VW_DESKTOP_SIZE, 0, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void VirtuaWinMeasure::Finalize()
|
||||
{
|
||||
}
|
||||
|
||||
UINT VirtuaWinMeasure::Update()
|
||||
{
|
||||
if (!FindVirtuaWinWindow())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch(Type)
|
||||
{
|
||||
case VDMActive:
|
||||
return 1;
|
||||
|
||||
case DesktopCountColumns:
|
||||
return (UINT) SendMessage(vwHandle, VW_DESKX, 0, 0);
|
||||
|
||||
case DesktopCountRows:
|
||||
return (UINT) SendMessage(vwHandle, VW_DESKY, 0, 0);
|
||||
|
||||
case DesktopCountTotal:
|
||||
return (UINT) SendMessage(vwHandle, VW_DESKX, 0, 0) * (UINT) SendMessage(vwHandle, VW_DESKY, 0, 0);
|
||||
|
||||
case CurrentDesktop:
|
||||
return (UINT) SendMessage(vwHandle, VW_CURDESK, 0, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LPCTSTR VirtuaWinMeasure::GetString(UINT flags)
|
||||
{
|
||||
static TCHAR Buffer[MAX_PATH];
|
||||
Buffer[0] = _T('\0');
|
||||
|
||||
switch(Type)
|
||||
{
|
||||
case VDMActive:
|
||||
case DesktopCountColumns:
|
||||
case DesktopCountRows:
|
||||
case DesktopCountTotal:
|
||||
case CurrentDesktop:
|
||||
swprintf_s(Buffer, MAX_PATH, L"%i", Update());
|
||||
break;
|
||||
}
|
||||
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
void VirtuaWinMeasure::ExecuteBang(LPCTSTR args)
|
||||
{
|
||||
INT32 Desktop;
|
||||
|
||||
if (!FindVirtuaWinWindow()) return;
|
||||
|
||||
switch(Type)
|
||||
{
|
||||
case SwitchDesktop:
|
||||
Desktop = _wtoi(args);
|
||||
SendNotifyMessage(vwHandle, VW_CHANGEDESK, Desktop, 0);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL VirtuaWinMeasure::FindVirtuaWinWindow()
|
||||
{
|
||||
if (IsWindow(vwHandle)) return TRUE;
|
||||
vwHandle = FindWindow(_T("VirtuaWinMainClass"), _T("VirtuaWinMainClass"));
|
||||
return vwHandle != nullptr;
|
||||
}
|
||||
|
@ -1,57 +1,57 @@
|
||||
/*
|
||||
Copyright (C) 2010 Patrick Dubbert
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "VDMeasure.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
class VirtuaWinMeasure :
|
||||
public VDMeasure
|
||||
{
|
||||
public:
|
||||
VirtuaWinMeasure(HMODULE, UINT id);
|
||||
virtual ~VirtuaWinMeasure(void);
|
||||
|
||||
virtual UINT Initialize(LPCTSTR iniFile, LPCTSTR section);
|
||||
virtual void Finalize();
|
||||
virtual UINT Update();
|
||||
virtual LPCTSTR GetString(UINT flags);
|
||||
virtual void ExecuteBang(LPCTSTR args);
|
||||
|
||||
private:
|
||||
enum MeasureType
|
||||
{
|
||||
Unknown,
|
||||
VDMActive,
|
||||
DesktopCountRows,
|
||||
DesktopCountColumns,
|
||||
DesktopCountTotal,
|
||||
CurrentDesktop,
|
||||
SwitchDesktop,
|
||||
};
|
||||
|
||||
static BOOL FindVirtuaWinWindow();
|
||||
|
||||
MeasureType Type;
|
||||
static std::map<std::wstring, MeasureType> StringToType;
|
||||
static HWND vwHandle;
|
||||
|
||||
};
|
||||
/*
|
||||
Copyright (C) 2010 Patrick Dubbert
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "VDMeasure.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
class VirtuaWinMeasure :
|
||||
public VDMeasure
|
||||
{
|
||||
public:
|
||||
VirtuaWinMeasure(HMODULE, UINT id);
|
||||
virtual ~VirtuaWinMeasure(void);
|
||||
|
||||
virtual UINT Initialize(LPCTSTR iniFile, LPCTSTR section);
|
||||
virtual void Finalize();
|
||||
virtual UINT Update();
|
||||
virtual LPCTSTR GetString(UINT flags);
|
||||
virtual void ExecuteBang(LPCTSTR args);
|
||||
|
||||
private:
|
||||
enum MeasureType
|
||||
{
|
||||
Unknown,
|
||||
VDMActive,
|
||||
DesktopCountRows,
|
||||
DesktopCountColumns,
|
||||
DesktopCountTotal,
|
||||
CurrentDesktop,
|
||||
SwitchDesktop,
|
||||
};
|
||||
|
||||
static BOOL FindVirtuaWinWindow();
|
||||
|
||||
MeasureType Type;
|
||||
static std::map<std::wstring, MeasureType> StringToType;
|
||||
static HWND vwHandle;
|
||||
|
||||
};
|
||||
|
@ -1,162 +1,162 @@
|
||||
/*
|
||||
Copyright (C) 2010-2011 Patrick Dubbert
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
VirtualDesktops Plugin
|
||||
----------------------
|
||||
|
||||
This plugin aims to give Rainmeter skins access to various virtual desktop
|
||||
managers through a common interface. The following VDMs are supported:
|
||||
|
||||
* Dexpot
|
||||
* VirtuaWin
|
||||
|
||||
To add support for another virtual desktop manager,
|
||||
|
||||
1) implement a new class derived from VDMeasure
|
||||
2) include its header file below
|
||||
3) add a new case for the "VDManager" config string in the Initialize
|
||||
funtion below
|
||||
|
||||
Different types of measures are identified using the "VDMeasureType" config
|
||||
string, i.e.
|
||||
|
||||
[VirtualDesktopsMeasure]
|
||||
Measure=Plugin
|
||||
Plugin=VirtualDesktops.dll
|
||||
VDManager=SomeVDM
|
||||
VDMeasureType=...
|
||||
|
||||
The following basic measure types have to be implemented:
|
||||
|
||||
* VDMActive: returns 1 when the VDM is running, 0 otherwise
|
||||
|
||||
* DesktopCount: returns the number of virtual desktops available; when
|
||||
"VDDesktopCount=X" or "VDDesktopCount=Y" is given, returns
|
||||
the number of columns or rows, respectively, in a grid of
|
||||
desktops
|
||||
|
||||
* CurrentDesktop: returns the number of the currently active desktop
|
||||
|
||||
* SwitchDesktop: when sent a desktop number as a bang, switches to the
|
||||
corresponding desktop
|
||||
|
||||
You're welcome to add any other measure types that suit the feature set of
|
||||
the virtual desktop manager in question. Examples can be found in the
|
||||
existing implementations.
|
||||
|
||||
*/
|
||||
|
||||
#include "DexpotMeasure.h"
|
||||
#include "VirtuaWinMeasure.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <map>
|
||||
|
||||
#include "../../Library/Export.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
__declspec(dllexport) UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id);
|
||||
__declspec(dllexport) void Finalize(HMODULE instance, UINT id);
|
||||
__declspec(dllexport) UINT Update(UINT id);
|
||||
__declspec(dllexport) LPCTSTR GetString(UINT id, UINT flags);
|
||||
__declspec(dllexport) void ExecuteBang(LPCTSTR args, UINT id);
|
||||
__declspec(dllexport) UINT GetPluginVersion();
|
||||
__declspec(dllexport) LPCTSTR GetPluginAuthor();
|
||||
}
|
||||
|
||||
std::map<UINT, VDMeasure*> Measures;
|
||||
HMODULE VDMeasure::hInstance;
|
||||
|
||||
UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
|
||||
{
|
||||
VDMeasure *Measure = nullptr;
|
||||
LPCTSTR VDManager = ReadConfigString(section, _T("VDManager"), _T(""));
|
||||
|
||||
if (_tcsicmp(VDManager, _T("Dexpot")) == 0)
|
||||
{
|
||||
Measure = DexpotMeasure::CreateMeasure(instance, id, iniFile, section);
|
||||
}
|
||||
else if (_tcsicmp(VDManager, _T("VirtuaWin")) == 0)
|
||||
{
|
||||
Measure = new VirtuaWinMeasure(instance, id);
|
||||
}
|
||||
|
||||
if (Measure)
|
||||
{
|
||||
Measures.insert(std::make_pair(id, Measure));
|
||||
return Measure->Initialize(iniFile, section);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT Update(UINT id)
|
||||
{
|
||||
std::map<UINT, VDMeasure*>::iterator i = Measures.find(id);
|
||||
if (i != Measures.end())
|
||||
{
|
||||
return i->second->Update();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LPCTSTR GetString(UINT id, UINT flags)
|
||||
{
|
||||
std::map<UINT, VDMeasure*>::iterator i = Measures.find(id);
|
||||
if (i != Measures.end())
|
||||
{
|
||||
return i->second->GetString(flags);
|
||||
}
|
||||
|
||||
return _T("");
|
||||
}
|
||||
|
||||
void ExecuteBang(LPCTSTR args, UINT id)
|
||||
{
|
||||
std::map<UINT, VDMeasure*>::iterator i = Measures.find(id);
|
||||
if (i != Measures.end())
|
||||
{
|
||||
i->second->ExecuteBang(args);
|
||||
}
|
||||
}
|
||||
|
||||
void Finalize(HMODULE instance, UINT id)
|
||||
{
|
||||
std::map<UINT, VDMeasure*>::iterator i = Measures.find(id);
|
||||
if (i != Measures.end())
|
||||
{
|
||||
i->second->Finalize();
|
||||
delete i->second;
|
||||
Measures.erase(i);
|
||||
}
|
||||
}
|
||||
|
||||
UINT GetPluginVersion()
|
||||
{
|
||||
return 1001;
|
||||
}
|
||||
|
||||
LPCTSTR GetPluginAuthor()
|
||||
{
|
||||
return _T("Dexpot GbR (info@dexpot.de)");
|
||||
}
|
||||
/*
|
||||
Copyright (C) 2010-2011 Patrick Dubbert
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
VirtualDesktops Plugin
|
||||
----------------------
|
||||
|
||||
This plugin aims to give Rainmeter skins access to various virtual desktop
|
||||
managers through a common interface. The following VDMs are supported:
|
||||
|
||||
* Dexpot
|
||||
* VirtuaWin
|
||||
|
||||
To add support for another virtual desktop manager,
|
||||
|
||||
1) implement a new class derived from VDMeasure
|
||||
2) include its header file below
|
||||
3) add a new case for the "VDManager" config string in the Initialize
|
||||
funtion below
|
||||
|
||||
Different types of measures are identified using the "VDMeasureType" config
|
||||
string, i.e.
|
||||
|
||||
[VirtualDesktopsMeasure]
|
||||
Measure=Plugin
|
||||
Plugin=VirtualDesktops.dll
|
||||
VDManager=SomeVDM
|
||||
VDMeasureType=...
|
||||
|
||||
The following basic measure types have to be implemented:
|
||||
|
||||
* VDMActive: returns 1 when the VDM is running, 0 otherwise
|
||||
|
||||
* DesktopCount: returns the number of virtual desktops available; when
|
||||
"VDDesktopCount=X" or "VDDesktopCount=Y" is given, returns
|
||||
the number of columns or rows, respectively, in a grid of
|
||||
desktops
|
||||
|
||||
* CurrentDesktop: returns the number of the currently active desktop
|
||||
|
||||
* SwitchDesktop: when sent a desktop number as a bang, switches to the
|
||||
corresponding desktop
|
||||
|
||||
You're welcome to add any other measure types that suit the feature set of
|
||||
the virtual desktop manager in question. Examples can be found in the
|
||||
existing implementations.
|
||||
|
||||
*/
|
||||
|
||||
#include "DexpotMeasure.h"
|
||||
#include "VirtuaWinMeasure.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <map>
|
||||
|
||||
#include "../../Library/Export.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
__declspec(dllexport) UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id);
|
||||
__declspec(dllexport) void Finalize(HMODULE instance, UINT id);
|
||||
__declspec(dllexport) UINT Update(UINT id);
|
||||
__declspec(dllexport) LPCTSTR GetString(UINT id, UINT flags);
|
||||
__declspec(dllexport) void ExecuteBang(LPCTSTR args, UINT id);
|
||||
__declspec(dllexport) UINT GetPluginVersion();
|
||||
__declspec(dllexport) LPCTSTR GetPluginAuthor();
|
||||
}
|
||||
|
||||
std::map<UINT, VDMeasure*> Measures;
|
||||
HMODULE VDMeasure::hInstance;
|
||||
|
||||
UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
|
||||
{
|
||||
VDMeasure *Measure = nullptr;
|
||||
LPCTSTR VDManager = ReadConfigString(section, _T("VDManager"), _T(""));
|
||||
|
||||
if (_tcsicmp(VDManager, _T("Dexpot")) == 0)
|
||||
{
|
||||
Measure = DexpotMeasure::CreateMeasure(instance, id, iniFile, section);
|
||||
}
|
||||
else if (_tcsicmp(VDManager, _T("VirtuaWin")) == 0)
|
||||
{
|
||||
Measure = new VirtuaWinMeasure(instance, id);
|
||||
}
|
||||
|
||||
if (Measure)
|
||||
{
|
||||
Measures.insert(std::make_pair(id, Measure));
|
||||
return Measure->Initialize(iniFile, section);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT Update(UINT id)
|
||||
{
|
||||
std::map<UINT, VDMeasure*>::iterator i = Measures.find(id);
|
||||
if (i != Measures.end())
|
||||
{
|
||||
return i->second->Update();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LPCTSTR GetString(UINT id, UINT flags)
|
||||
{
|
||||
std::map<UINT, VDMeasure*>::iterator i = Measures.find(id);
|
||||
if (i != Measures.end())
|
||||
{
|
||||
return i->second->GetString(flags);
|
||||
}
|
||||
|
||||
return _T("");
|
||||
}
|
||||
|
||||
void ExecuteBang(LPCTSTR args, UINT id)
|
||||
{
|
||||
std::map<UINT, VDMeasure*>::iterator i = Measures.find(id);
|
||||
if (i != Measures.end())
|
||||
{
|
||||
i->second->ExecuteBang(args);
|
||||
}
|
||||
}
|
||||
|
||||
void Finalize(HMODULE instance, UINT id)
|
||||
{
|
||||
std::map<UINT, VDMeasure*>::iterator i = Measures.find(id);
|
||||
if (i != Measures.end())
|
||||
{
|
||||
i->second->Finalize();
|
||||
delete i->second;
|
||||
Measures.erase(i);
|
||||
}
|
||||
}
|
||||
|
||||
UINT GetPluginVersion()
|
||||
{
|
||||
return 1001;
|
||||
}
|
||||
|
||||
LPCTSTR GetPluginAuthor()
|
||||
{
|
||||
return _T("Dexpot GbR (info@dexpot.de)");
|
||||
}
|
||||
|
Reference in New Issue
Block a user