rainmeter-studio/Library/MeterWindow.h

435 lines
14 KiB
C
Raw Normal View History

2009-02-10 18:37:48 +00:00
/*
Copyright (C) 2001 Kimmo Pekkola
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.
2009-02-10 18:37:48 +00:00
*/
#ifndef __METERWINDOW_H__
#define __METERWINDOW_H__
#include <windows.h>
#include <dwmapi.h>
2009-02-10 18:37:48 +00:00
#include <string>
#include <list>
#include "CommandHandler.h"
2009-02-10 18:37:48 +00:00
#include "ConfigParser.h"
#include "Group.h"
#include "Mouse.h"
2009-02-10 18:37:48 +00:00
#define BEGIN_MESSAGEPROC switch (uMsg) {
#define MESSAGE(handler, msg) case msg: return window->handler(uMsg, wParam, lParam);
2009-02-10 18:37:48 +00:00
#define REJECT_MESSAGE(msg) case msg: return 0;
#define END_MESSAGEPROC } return DefWindowProc(hWnd, uMsg, wParam, lParam);
2009-02-10 18:37:48 +00:00
#define WM_METERWINDOW_DELAYED_REFRESH WM_APP + 1
#define WM_METERWINDOW_DELAYED_MOVE WM_APP + 3
2009-02-10 18:37:48 +00:00
2010-09-04 08:04:13 +00:00
#define METERWINDOW_CLASS_NAME L"RainmeterMeterWindow"
#define RI_MOUSE_HORIZONTAL_WHEEL 0x0800
typedef HRESULT (WINAPI * FPDWMENABLEBLURBEHINDWINDOW)(HWND hWnd, const DWM_BLURBEHIND* pBlurBehind);
typedef HRESULT (WINAPI * FPDWMGETCOLORIZATIONCOLOR)(DWORD* pcrColorization, BOOL* pfOpaqueBlend);
typedef HRESULT (WINAPI * FPDWMSETWINDOWATTRIBUTE)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
typedef HRESULT (WINAPI * FPDWMISCOMPOSITIONENABLED)(BOOL* pfEnabled);
enum BUTTONPROC
{
BUTTONPROC_DOWN,
BUTTONPROC_UP,
BUTTONPROC_MOVE
};
2009-02-10 18:37:48 +00:00
enum ZPOSITION
{
ZPOSITION_ONDESKTOP = -2,
ZPOSITION_ONBOTTOM = -1,
ZPOSITION_NORMAL = 0,
ZPOSITION_ONTOP = 1,
ZPOSITION_ONTOPMOST = 2
};
enum BLURMODE
{
BLURMODE_NONE = 0,
BLURMODE_FULL,
BLURMODE_REGION
};
2009-02-10 18:37:48 +00:00
enum BGMODE
{
BGMODE_IMAGE = 0,
BGMODE_COPY,
BGMODE_SOLID,
BGMODE_SCALED_IMAGE,
BGMODE_TILED_IMAGE
2009-02-10 18:37:48 +00:00
};
enum HIDEMODE
{
HIDEMODE_NONE = 0,
HIDEMODE_HIDE,
HIDEMODE_FADEIN,
HIDEMODE_FADEOUT
};
enum BEVELTYPE
{
BEVELTYPE_NONE,
BEVELTYPE_UP,
BEVELTYPE_DOWN
};
2012-07-17 19:15:06 +00:00
enum RESIZEMODE
{
RESIZEMODE_NONE = 0,
RESIZEMODE_CHECK,
RESIZEMODE_RESET
};
2013-05-31 14:18:52 +00:00
class Rainmeter;
class Measure;
class Meter;
2009-02-10 18:37:48 +00:00
2013-03-25 15:42:18 +00:00
namespace Gfx {
class Canvas;
class FontCollection;
2013-03-25 15:42:18 +00:00
class TextFormat;
}
2013-03-25 15:42:18 +00:00
2013-05-31 14:18:52 +00:00
class MeterWindow : public Group
2009-02-10 18:37:48 +00:00
{
public:
2013-05-31 14:18:52 +00:00
MeterWindow(const std::wstring& folderPath, const std::wstring& file);
~MeterWindow();
2009-02-10 18:37:48 +00:00
2012-07-18 06:22:47 +00:00
void Initialize();
void DoBang(Bang bang, const std::vector<std::wstring>& args);
void HideMeter(const std::wstring& name, bool group = false);
void ShowMeter(const std::wstring& name, bool group = false);
void ToggleMeter(const std::wstring& name, bool group = false);
void MoveMeter(const std::wstring& name, int x, int y);
void UpdateMeter(const std::wstring& name, bool group = false);
void DisableMeasure(const std::wstring& name, bool group = false);
void EnableMeasure(const std::wstring& name, bool group = false);
void ToggleMeasure(const std::wstring& name, bool group = false);
void PauseMeasure(const std::wstring& name, bool group = false);
void UnpauseMeasure(const std::wstring& name, bool group = false);
void TogglePauseMeasure(const std::wstring& name, bool group = false);
void UpdateMeasure(const std::wstring& name, bool group = false);
2012-02-02 12:05:14 +00:00
void Deactivate();
void Refresh(bool init, bool all = false);
2009-02-10 18:37:48 +00:00
void Redraw();
2012-04-17 15:20:12 +00:00
void RedrawWindow() { UpdateWindow(m_TransparencyValue, false); }
2012-02-01 18:00:32 +00:00
void SetVariable(const std::wstring& variable, const std::wstring& value);
void SetOption(const std::wstring& section, const std::wstring& option, const std::wstring& value, bool group);
2009-02-10 18:37:48 +00:00
void SetMouseLeaveEvent(bool cancel);
void SetHasMouseScrollAction() { m_HasMouseScrollAction = true; }
2009-02-10 18:37:48 +00:00
void MoveWindow(int x, int y);
void ChangeZPos(ZPOSITION zPos, bool all = false);
void ChangeSingleZPos(ZPOSITION zPos, bool all = false);
void FadeWindow(int from, int to);
void HideFade();
void ShowFade();
void ResizeBlur(const std::wstring& arg, int mode);
bool IsBlur() { return m_Blur; }
void SetBlur(bool b) { m_Blur = b; }
2012-07-17 19:15:06 +00:00
void SetResizeWindowMode(RESIZEMODE mode) { if (m_ResizeWindow != RESIZEMODE_RESET || mode != RESIZEMODE_CHECK) m_ResizeWindow = mode; }
2013-03-25 15:42:18 +00:00
Gfx::Canvas& GetCanvas() { return *m_Canvas; }
2010-10-19 22:03:32 +00:00
HWND GetWindow() { return m_Window; }
2009-02-10 18:37:48 +00:00
2013-05-31 14:18:52 +00:00
ConfigParser& GetParser() { return m_Parser; }
2009-02-10 18:37:48 +00:00
const std::wstring& GetFolderPath() { return m_FolderPath; }
const std::wstring& GetFileName() { return m_FileName; }
std::wstring GetFilePath();
std::wstring GetRootPath();
std::wstring GetResourcesPath();
std::wstring GetSkinPath();
2013-05-31 14:18:52 +00:00
const std::vector<Measure*>& GetMeasures() { return m_Measures; }
const std::vector<Meter*>& GetMeters() { return m_Meters; }
2009-02-10 18:37:48 +00:00
ZPOSITION GetWindowZPosition() { return m_WindowZPosition; }
bool GetXPercentage() { return m_WindowXPercentage; }
bool GetYPercentage() { return m_WindowYPercentage; }
bool GetXFromRight() { return m_WindowXFromRight; }
bool GetYFromBottom() { return m_WindowYFromBottom; }
int GetW() { return m_WindowW; }
int GetH() { return m_WindowH; }
int GetX() { return m_ScreenX; }
int GetY() { return m_ScreenY; }
* Changed the way to get the information of the multiple display monitors. This change brings the order of monitors close to the order of "Display Properties" due to using EnumDisplayDevices and EnumDisplaySettings instead of EnumDisplayMonitors. (If EnumDisplayDevices failed, EnumDisplayMonitors is used as before.) ----- * Added the "Display Monitor" submenu in [Skins Menu]-[Position]. These menus convert the present position to the relative position from the specified monitor. (But the meter window doesn't move to the specified monitor area immediately. Only converts.) - "Use default: Primary monitor" removes the @-directive from WindowX/Y. - @0(@1, @2, ...) adds the specified monitor number to WindowX/Y. @0 means "The Virtual Screen". (http://msdn.microsoft.com/en-us/library/dd145136%28VS.85%29.aspx) - If "Auto-select based on window position" is checked, the WindowX and WindowY "@n" settings are made automatically based on the position of the meter's window. If a monitor is selected directly using "Display Monitor" in the Rainmeter / skin context menu, this menu is unchecked. This setting can be manually made in either the [Rainmeter] (all configs) or individual config sections of Rainmeter.ini. AutoSelectScreen If set to 1, the WindowX and WindowY "@n" settings are made automatically based on the position of the meter's window. If a monitor is selected directly using "Display Monitor" in the Rainmeter / skin context menu, this setting is reset to 0. ----- * Added the variables for multiple display monitors and the virtual screen. All X/Y positions are represented in the virtual screen coordinates. The following variables are for the virtual screen. #VSCREENAREAX# is the X-position of the left-side of the virtual screen. #VSCREENAREAY# is the Y-position of the top-side of the virtual screen. #VSCREENAREAWIDTH# is the width of the virtual screen. #VSCREENAREAHEIGHT# is the height of the virtual screen. The following variables are for the PRESENT monitor. Note that these variables automatically change by the WindowX and WindowY "@n" settings. If "@n" is not set, these variables return the value of the primary monitor. #WORKAREAX# is the X-position of the left-side of the work area. #WORKAREAY# is the Y-position of the top-side of the work area. #WORKAREAWIDTH# is the width of the work area. #WORKAREAHEIGHT# is the height of the work area. #SCREENAREAX# is the X-position of the left-side of the monitor screen. #SCREENAREAY# is the Y-position of the top-side of the monitor screen. #SCREENAREAWIDTH# is the width of the display resolution. #SCREENAREAHEIGHT# is the height of the display resolution. The following variables are for the PRIMARY monitor. #PWORKAREAX# is the X-position of the left-side of the work area. #PWORKAREAY# is the Y-position of the top-side of the work area. #PWORKAREAWIDTH# is the width of the work area. #PWORKAREAHEIGHT# is the height of the work area. #PSCREENAREAX# is the X-position of the left-side of the monitor screen. (maybe, always 0) #PSCREENAREAY# is the Y-position of the top-side of the monitor screen. (maybe, always 0) #PSCREENAREAWIDTH# is the width of the display resolution. #PSCREENAREAHEIGHT# is the height of the display resolution. The following variables are for the SPECIFIED monitor. (@n = @1, @2, ...) #WORKAREAX@n# is the X-position of the left-side of the work area. #WORKAREAY@n# is the Y-position of the top-side of the work area. #WORKAREAWIDTH@n# is the width of the work area. #WORKAREAHEIGHT@n# is the height of the work area. #SCREENAREAX@n# is the X-position of the left-side of the monitor screen. #SCREENAREAY@n# is the Y-position of the top-side of the monitor screen. #SCREENAREAWIDTH@n# is the width of the display resolution. #SCREENAREAHEIGHT@n# is the height of the display resolution. ----- * Other related changes: - Fixed the problem that the primary monitor isn't recognized correctly. - Fixed the problem that the information of the multiple display monitors is refreshed excessively. - For DynamicVariables, when display setting or workarea size has been changed, all variables are now updated to apply changed WORKAREA/SCREENAREA variables. - Fixed the problem that the "On Desktop" window isn't dragged correctly when the top-left corner of the virtual screen has negative coordinates. - Changed the way to stick the "On Desktop" window. ("SysListView32/FolderView" is used instead of "Progman/Program Manager".) ----- * Other changes: - When the meter window is draggable and isn't dragged, LeftMouseUpAction is now executed. - Added MouseDoubleClickAction (LeftMouseDoubleClickAction, RightMouseDoubleClickAction, MiddleMouseDoubleClickAction). If MouseDoubleClickAction is empty when mouse button is double-clicked, MouseDownAction is executed instead. - Fixed the problem that the Meter's hit-test code checks outside the area. - Changed the way to set the #CURRENTCONFIG#. (CMeterWindow::GetSkinName() is now used instead of parsing the path.)
2009-12-18 05:58:37 +00:00
bool GetXScreenDefined() { return m_WindowXScreenDefined; }
bool GetYScreenDefined() { return m_WindowYScreenDefined; }
int GetXScreen() { return m_WindowXScreen; }
int GetYScreen() { return m_WindowYScreen; }
2009-02-10 18:37:48 +00:00
bool GetClickThrough() { return m_ClickThrough; }
bool GetKeepOnScreen() { return m_KeepOnScreen; }
* Changed the way to get the information of the multiple display monitors. This change brings the order of monitors close to the order of "Display Properties" due to using EnumDisplayDevices and EnumDisplaySettings instead of EnumDisplayMonitors. (If EnumDisplayDevices failed, EnumDisplayMonitors is used as before.) ----- * Added the "Display Monitor" submenu in [Skins Menu]-[Position]. These menus convert the present position to the relative position from the specified monitor. (But the meter window doesn't move to the specified monitor area immediately. Only converts.) - "Use default: Primary monitor" removes the @-directive from WindowX/Y. - @0(@1, @2, ...) adds the specified monitor number to WindowX/Y. @0 means "The Virtual Screen". (http://msdn.microsoft.com/en-us/library/dd145136%28VS.85%29.aspx) - If "Auto-select based on window position" is checked, the WindowX and WindowY "@n" settings are made automatically based on the position of the meter's window. If a monitor is selected directly using "Display Monitor" in the Rainmeter / skin context menu, this menu is unchecked. This setting can be manually made in either the [Rainmeter] (all configs) or individual config sections of Rainmeter.ini. AutoSelectScreen If set to 1, the WindowX and WindowY "@n" settings are made automatically based on the position of the meter's window. If a monitor is selected directly using "Display Monitor" in the Rainmeter / skin context menu, this setting is reset to 0. ----- * Added the variables for multiple display monitors and the virtual screen. All X/Y positions are represented in the virtual screen coordinates. The following variables are for the virtual screen. #VSCREENAREAX# is the X-position of the left-side of the virtual screen. #VSCREENAREAY# is the Y-position of the top-side of the virtual screen. #VSCREENAREAWIDTH# is the width of the virtual screen. #VSCREENAREAHEIGHT# is the height of the virtual screen. The following variables are for the PRESENT monitor. Note that these variables automatically change by the WindowX and WindowY "@n" settings. If "@n" is not set, these variables return the value of the primary monitor. #WORKAREAX# is the X-position of the left-side of the work area. #WORKAREAY# is the Y-position of the top-side of the work area. #WORKAREAWIDTH# is the width of the work area. #WORKAREAHEIGHT# is the height of the work area. #SCREENAREAX# is the X-position of the left-side of the monitor screen. #SCREENAREAY# is the Y-position of the top-side of the monitor screen. #SCREENAREAWIDTH# is the width of the display resolution. #SCREENAREAHEIGHT# is the height of the display resolution. The following variables are for the PRIMARY monitor. #PWORKAREAX# is the X-position of the left-side of the work area. #PWORKAREAY# is the Y-position of the top-side of the work area. #PWORKAREAWIDTH# is the width of the work area. #PWORKAREAHEIGHT# is the height of the work area. #PSCREENAREAX# is the X-position of the left-side of the monitor screen. (maybe, always 0) #PSCREENAREAY# is the Y-position of the top-side of the monitor screen. (maybe, always 0) #PSCREENAREAWIDTH# is the width of the display resolution. #PSCREENAREAHEIGHT# is the height of the display resolution. The following variables are for the SPECIFIED monitor. (@n = @1, @2, ...) #WORKAREAX@n# is the X-position of the left-side of the work area. #WORKAREAY@n# is the Y-position of the top-side of the work area. #WORKAREAWIDTH@n# is the width of the work area. #WORKAREAHEIGHT@n# is the height of the work area. #SCREENAREAX@n# is the X-position of the left-side of the monitor screen. #SCREENAREAY@n# is the Y-position of the top-side of the monitor screen. #SCREENAREAWIDTH@n# is the width of the display resolution. #SCREENAREAHEIGHT@n# is the height of the display resolution. ----- * Other related changes: - Fixed the problem that the primary monitor isn't recognized correctly. - Fixed the problem that the information of the multiple display monitors is refreshed excessively. - For DynamicVariables, when display setting or workarea size has been changed, all variables are now updated to apply changed WORKAREA/SCREENAREA variables. - Fixed the problem that the "On Desktop" window isn't dragged correctly when the top-left corner of the virtual screen has negative coordinates. - Changed the way to stick the "On Desktop" window. ("SysListView32/FolderView" is used instead of "Progman/Program Manager".) ----- * Other changes: - When the meter window is draggable and isn't dragged, LeftMouseUpAction is now executed. - Added MouseDoubleClickAction (LeftMouseDoubleClickAction, RightMouseDoubleClickAction, MiddleMouseDoubleClickAction). If MouseDoubleClickAction is empty when mouse button is double-clicked, MouseDownAction is executed instead. - Fixed the problem that the Meter's hit-test code checks outside the area. - Changed the way to set the #CURRENTCONFIG#. (CMeterWindow::GetSkinName() is now used instead of parsing the path.)
2009-12-18 05:58:37 +00:00
bool GetAutoSelectScreen() { return m_AutoSelectScreen; }
2009-02-10 18:37:48 +00:00
bool GetWindowDraggable() { return m_WindowDraggable; }
bool GetSavePosition() { return m_SavePosition; }
bool GetSnapEdges() { return m_SnapEdges; }
HIDEMODE GetWindowHide() { return m_WindowHide; }
int GetAlphaValue() { return m_AlphaValue; }
int GetUpdateCounter() { return m_UpdateCounter; }
int GetTransitionUpdate() { return m_TransitionUpdate; }
2009-02-10 18:37:48 +00:00
2011-11-03 00:13:42 +00:00
bool GetMeterToolTipHidden() { return m_ToolTipHidden; }
2013-03-10 19:59:05 +00:00
bool IsClosing() { return m_State == STATE_CLOSING; }
2013-05-31 14:18:52 +00:00
const Mouse& GetMouse() { return m_Mouse; }
2011-11-03 00:13:42 +00:00
2011-11-28 14:13:20 +00:00
void MakePathAbsolute(std::wstring& path);
Gfx::FontCollection* GetFontCollection() { return m_FontCollection; }
2013-05-31 14:18:52 +00:00
Meter* GetMeter(const std::wstring& meterName);
Measure* GetMeasure(const std::wstring& measureName) { return m_Parser.GetMeasure(measureName); }
2013-05-31 14:18:52 +00:00
friend class DialogManage;
2009-02-10 18:37:48 +00:00
protected:
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK InitialWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
2009-02-10 18:37:48 +00:00
LRESULT OnMouseInput(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnMove(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnEnterSizeMove(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnExitSizeMove(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnSetCursor(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnEnterMenuLoop(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnMouseLeave(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnMouseScrollMove(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnMouseHScrollMove(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnLeftButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnRightButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnMiddleButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnLeftButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnRightButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnMiddleButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnLeftButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnRightButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnMiddleButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnXButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnXButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnXButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnDelayedRefresh(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnDelayedMove(UINT uMsg, WPARAM wParam, LPARAM lParam);
2012-02-02 12:05:14 +00:00
LRESULT OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnDwmColorChange(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnDwmCompositionChange(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnDisplayChange(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnSetWindowFocus(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnWake(UINT uMsg, WPARAM wParam, LPARAM lParam);
2009-02-10 18:37:48 +00:00
private:
2013-03-10 19:59:05 +00:00
enum STATE
{
STATE_INITIALIZING,
STATE_REFRESHING,
STATE_RUNNING,
STATE_CLOSING
};
enum OPTION
{
OPTION_POSITION = 0x00000001,
OPTION_ALPHAVALUE = 0x00000002,
OPTION_FADEDURATION = 0x00000004,
OPTION_CLICKTHROUGH = 0x00000008,
OPTION_DRAGGABLE = 0x00000010,
OPTION_HIDEONMOUSEOVER = 0x00000020,
OPTION_SAVEPOSITION = 0x00000040,
OPTION_SNAPEDGES = 0x00000080,
OPTION_KEEPONSCREEN = 0x00000100,
OPTION_AUTOSELECTSCREEN = 0x00000200,
OPTION_ALWAYSONTOP = 0x00000400,
OPTION_ALL = 0xFFFFFFFF
};
bool HitTest(int x, int y);
2013-05-31 14:18:52 +00:00
void SnapToWindow(MeterWindow* window, LPWINDOWPOS wp);
2009-02-10 18:37:48 +00:00
void MapCoordsToScreen(int& x, int& y, int w, int h);
void WindowToScreen();
void ScreenToWindow();
void PostUpdate(bool bActiveTransition);
2013-05-31 14:18:52 +00:00
bool UpdateMeasure(Measure* measure, bool force);
bool UpdateMeter(Meter* meter, bool& bActiveTransition, bool force);
void Update(bool refresh);
2013-03-25 15:42:18 +00:00
void UpdateWindow(int alpha, bool reset, bool canvasBeginDrawCalled = false);
void UpdateWindowTransparency(int alpha);
2012-05-30 18:53:44 +00:00
void ReadOptions();
void WriteOptions(INT setting = OPTION_ALL);
bool ReadSkin();
2009-02-10 18:37:48 +00:00
void ShowWindowIfAppropriate();
HWND GetWindowFromPoint(POINT pos);
void HandleButtons(POINT pos, BUTTONPROC proc, bool execute = true);
void SetClickThrough(bool b);
void SetKeepOnScreen(bool b);
void SetWindowDraggable(bool b);
void SetSavePosition(bool b);
void SavePositionIfAppropriate();
void SetSnapEdges(bool b);
void SetWindowHide(HIDEMODE hide);
void SetWindowZPosition(ZPOSITION zpos);
bool DoAction(int x, int y, MOUSEACTION action, bool test);
bool DoMoveAction(int x, int y, MOUSEACTION action);
2009-02-10 18:37:48 +00:00
bool ResizeWindow(bool reset);
void IgnoreAeroPeek();
void RegisterMouseInput();
void UnregisterMouseInput();
void AddWindowExStyle(LONG_PTR flag);
void RemoveWindowExStyle(LONG_PTR flag);
void BlurBehindWindow(BOOL fEnable);
void SetWindowPositionVariables(int x, int y);
void SetWindowSizeVariables(int w, int h);
* Changed the way to get the information of the multiple display monitors. This change brings the order of monitors close to the order of "Display Properties" due to using EnumDisplayDevices and EnumDisplaySettings instead of EnumDisplayMonitors. (If EnumDisplayDevices failed, EnumDisplayMonitors is used as before.) ----- * Added the "Display Monitor" submenu in [Skins Menu]-[Position]. These menus convert the present position to the relative position from the specified monitor. (But the meter window doesn't move to the specified monitor area immediately. Only converts.) - "Use default: Primary monitor" removes the @-directive from WindowX/Y. - @0(@1, @2, ...) adds the specified monitor number to WindowX/Y. @0 means "The Virtual Screen". (http://msdn.microsoft.com/en-us/library/dd145136%28VS.85%29.aspx) - If "Auto-select based on window position" is checked, the WindowX and WindowY "@n" settings are made automatically based on the position of the meter's window. If a monitor is selected directly using "Display Monitor" in the Rainmeter / skin context menu, this menu is unchecked. This setting can be manually made in either the [Rainmeter] (all configs) or individual config sections of Rainmeter.ini. AutoSelectScreen If set to 1, the WindowX and WindowY "@n" settings are made automatically based on the position of the meter's window. If a monitor is selected directly using "Display Monitor" in the Rainmeter / skin context menu, this setting is reset to 0. ----- * Added the variables for multiple display monitors and the virtual screen. All X/Y positions are represented in the virtual screen coordinates. The following variables are for the virtual screen. #VSCREENAREAX# is the X-position of the left-side of the virtual screen. #VSCREENAREAY# is the Y-position of the top-side of the virtual screen. #VSCREENAREAWIDTH# is the width of the virtual screen. #VSCREENAREAHEIGHT# is the height of the virtual screen. The following variables are for the PRESENT monitor. Note that these variables automatically change by the WindowX and WindowY "@n" settings. If "@n" is not set, these variables return the value of the primary monitor. #WORKAREAX# is the X-position of the left-side of the work area. #WORKAREAY# is the Y-position of the top-side of the work area. #WORKAREAWIDTH# is the width of the work area. #WORKAREAHEIGHT# is the height of the work area. #SCREENAREAX# is the X-position of the left-side of the monitor screen. #SCREENAREAY# is the Y-position of the top-side of the monitor screen. #SCREENAREAWIDTH# is the width of the display resolution. #SCREENAREAHEIGHT# is the height of the display resolution. The following variables are for the PRIMARY monitor. #PWORKAREAX# is the X-position of the left-side of the work area. #PWORKAREAY# is the Y-position of the top-side of the work area. #PWORKAREAWIDTH# is the width of the work area. #PWORKAREAHEIGHT# is the height of the work area. #PSCREENAREAX# is the X-position of the left-side of the monitor screen. (maybe, always 0) #PSCREENAREAY# is the Y-position of the top-side of the monitor screen. (maybe, always 0) #PSCREENAREAWIDTH# is the width of the display resolution. #PSCREENAREAHEIGHT# is the height of the display resolution. The following variables are for the SPECIFIED monitor. (@n = @1, @2, ...) #WORKAREAX@n# is the X-position of the left-side of the work area. #WORKAREAY@n# is the Y-position of the top-side of the work area. #WORKAREAWIDTH@n# is the width of the work area. #WORKAREAHEIGHT@n# is the height of the work area. #SCREENAREAX@n# is the X-position of the left-side of the monitor screen. #SCREENAREAY@n# is the Y-position of the top-side of the monitor screen. #SCREENAREAWIDTH@n# is the width of the display resolution. #SCREENAREAHEIGHT@n# is the height of the display resolution. ----- * Other related changes: - Fixed the problem that the primary monitor isn't recognized correctly. - Fixed the problem that the information of the multiple display monitors is refreshed excessively. - For DynamicVariables, when display setting or workarea size has been changed, all variables are now updated to apply changed WORKAREA/SCREENAREA variables. - Fixed the problem that the "On Desktop" window isn't dragged correctly when the top-left corner of the virtual screen has negative coordinates. - Changed the way to stick the "On Desktop" window. ("SysListView32/FolderView" is used instead of "Progman/Program Manager".) ----- * Other changes: - When the meter window is draggable and isn't dragged, LeftMouseUpAction is now executed. - Added MouseDoubleClickAction (LeftMouseDoubleClickAction, RightMouseDoubleClickAction, MiddleMouseDoubleClickAction). If MouseDoubleClickAction is empty when mouse button is double-clicked, MouseDownAction is executed instead. - Fixed the problem that the Meter's hit-test code checks outside the area. - Changed the way to set the #CURRENTCONFIG#. (CMeterWindow::GetSkinName() is now used instead of parsing the path.)
2009-12-18 05:58:37 +00:00
void ShowBlur();
void HideBlur();
2012-11-27 08:45:53 +00:00
void Dispose(bool refresh);
void CreateDoubleBuffer(int cx, int cy);
2013-03-25 15:42:18 +00:00
Gfx::Canvas* m_Canvas;
2009-02-10 18:37:48 +00:00
2013-05-31 14:18:52 +00:00
ConfigParser m_Parser;
2012-05-20 17:57:12 +00:00
Gdiplus::Bitmap* m_Background;
2009-02-10 18:37:48 +00:00
SIZE m_BackgroundSize;
2012-05-20 17:57:12 +00:00
HWND m_Window;
2013-05-31 14:18:52 +00:00
Mouse m_Mouse;
bool m_MouseOver;
bool m_MouseInputRegistered;
bool m_HasMouseScrollAction;
2012-05-20 17:57:12 +00:00
std::wstring m_OnRefreshAction;
std::wstring m_OnCloseAction;
std::wstring m_OnFocusAction;
std::wstring m_OnUnfocusAction;
std::wstring m_OnUpdateAction;
std::wstring m_OnWakeAction;
2009-02-10 18:37:48 +00:00
2012-05-20 17:57:12 +00:00
std::wstring m_BackgroundName;
RECT m_BackgroundMargins;
RECT m_DragMargins;
2012-05-20 17:57:12 +00:00
std::wstring m_WindowX;
std::wstring m_WindowY;
std::wstring m_AnchorX;
std::wstring m_AnchorY;
int m_WindowXScreen;
int m_WindowYScreen;
* Changed the way to get the information of the multiple display monitors. This change brings the order of monitors close to the order of "Display Properties" due to using EnumDisplayDevices and EnumDisplaySettings instead of EnumDisplayMonitors. (If EnumDisplayDevices failed, EnumDisplayMonitors is used as before.) ----- * Added the "Display Monitor" submenu in [Skins Menu]-[Position]. These menus convert the present position to the relative position from the specified monitor. (But the meter window doesn't move to the specified monitor area immediately. Only converts.) - "Use default: Primary monitor" removes the @-directive from WindowX/Y. - @0(@1, @2, ...) adds the specified monitor number to WindowX/Y. @0 means "The Virtual Screen". (http://msdn.microsoft.com/en-us/library/dd145136%28VS.85%29.aspx) - If "Auto-select based on window position" is checked, the WindowX and WindowY "@n" settings are made automatically based on the position of the meter's window. If a monitor is selected directly using "Display Monitor" in the Rainmeter / skin context menu, this menu is unchecked. This setting can be manually made in either the [Rainmeter] (all configs) or individual config sections of Rainmeter.ini. AutoSelectScreen If set to 1, the WindowX and WindowY "@n" settings are made automatically based on the position of the meter's window. If a monitor is selected directly using "Display Monitor" in the Rainmeter / skin context menu, this setting is reset to 0. ----- * Added the variables for multiple display monitors and the virtual screen. All X/Y positions are represented in the virtual screen coordinates. The following variables are for the virtual screen. #VSCREENAREAX# is the X-position of the left-side of the virtual screen. #VSCREENAREAY# is the Y-position of the top-side of the virtual screen. #VSCREENAREAWIDTH# is the width of the virtual screen. #VSCREENAREAHEIGHT# is the height of the virtual screen. The following variables are for the PRESENT monitor. Note that these variables automatically change by the WindowX and WindowY "@n" settings. If "@n" is not set, these variables return the value of the primary monitor. #WORKAREAX# is the X-position of the left-side of the work area. #WORKAREAY# is the Y-position of the top-side of the work area. #WORKAREAWIDTH# is the width of the work area. #WORKAREAHEIGHT# is the height of the work area. #SCREENAREAX# is the X-position of the left-side of the monitor screen. #SCREENAREAY# is the Y-position of the top-side of the monitor screen. #SCREENAREAWIDTH# is the width of the display resolution. #SCREENAREAHEIGHT# is the height of the display resolution. The following variables are for the PRIMARY monitor. #PWORKAREAX# is the X-position of the left-side of the work area. #PWORKAREAY# is the Y-position of the top-side of the work area. #PWORKAREAWIDTH# is the width of the work area. #PWORKAREAHEIGHT# is the height of the work area. #PSCREENAREAX# is the X-position of the left-side of the monitor screen. (maybe, always 0) #PSCREENAREAY# is the Y-position of the top-side of the monitor screen. (maybe, always 0) #PSCREENAREAWIDTH# is the width of the display resolution. #PSCREENAREAHEIGHT# is the height of the display resolution. The following variables are for the SPECIFIED monitor. (@n = @1, @2, ...) #WORKAREAX@n# is the X-position of the left-side of the work area. #WORKAREAY@n# is the Y-position of the top-side of the work area. #WORKAREAWIDTH@n# is the width of the work area. #WORKAREAHEIGHT@n# is the height of the work area. #SCREENAREAX@n# is the X-position of the left-side of the monitor screen. #SCREENAREAY@n# is the Y-position of the top-side of the monitor screen. #SCREENAREAWIDTH@n# is the width of the display resolution. #SCREENAREAHEIGHT@n# is the height of the display resolution. ----- * Other related changes: - Fixed the problem that the primary monitor isn't recognized correctly. - Fixed the problem that the information of the multiple display monitors is refreshed excessively. - For DynamicVariables, when display setting or workarea size has been changed, all variables are now updated to apply changed WORKAREA/SCREENAREA variables. - Fixed the problem that the "On Desktop" window isn't dragged correctly when the top-left corner of the virtual screen has negative coordinates. - Changed the way to stick the "On Desktop" window. ("SysListView32/FolderView" is used instead of "Progman/Program Manager".) ----- * Other changes: - When the meter window is draggable and isn't dragged, LeftMouseUpAction is now executed. - Added MouseDoubleClickAction (LeftMouseDoubleClickAction, RightMouseDoubleClickAction, MiddleMouseDoubleClickAction). If MouseDoubleClickAction is empty when mouse button is double-clicked, MouseDownAction is executed instead. - Fixed the problem that the Meter's hit-test code checks outside the area. - Changed the way to set the #CURRENTCONFIG#. (CMeterWindow::GetSkinName() is now used instead of parsing the path.)
2009-12-18 05:58:37 +00:00
bool m_WindowXScreenDefined;
bool m_WindowYScreenDefined;
bool m_WindowXFromRight;
bool m_WindowYFromBottom;
bool m_WindowXPercentage;
bool m_WindowYPercentage;
2012-05-20 17:57:12 +00:00
int m_WindowW;
int m_WindowH;
int m_ScreenX; // X-postion on the virtual screen
int m_ScreenY; // Y-postion on the virtual screen
bool m_AnchorXFromRight;
bool m_AnchorYFromBottom;
bool m_AnchorXPercentage;
bool m_AnchorYPercentage;
2012-05-20 17:57:12 +00:00
int m_AnchorScreenX;
int m_AnchorScreenY;
bool m_WindowDraggable;
int m_WindowUpdate;
int m_TransitionUpdate;
bool m_ActiveTransition;
bool m_HasNetMeasures;
2010-08-17 07:19:48 +00:00
bool m_HasButtons;
2012-05-20 17:57:12 +00:00
HIDEMODE m_WindowHide;
bool m_WindowStartHidden;
bool m_SavePosition;
bool m_SnapEdges;
int m_AlphaValue;
int m_FadeDuration;
2012-05-20 17:57:12 +00:00
ZPOSITION m_WindowZPosition;
bool m_DynamicWindowSize;
bool m_ClickThrough;
bool m_KeepOnScreen;
bool m_AutoSelectScreen;
bool m_Dragging;
bool m_Dragged;
BGMODE m_BackgroundMode;
Gdiplus::Color m_SolidColor;
Gdiplus::Color m_SolidColor2;
Gdiplus::REAL m_SolidAngle;
BEVELTYPE m_SolidBevel;
bool m_Blur;
BLURMODE m_BlurMode;
HRGN m_BlurRegion;
ULONGLONG m_FadeStartTime;
2009-02-10 18:37:48 +00:00
int m_FadeStartValue;
int m_FadeEndValue;
int m_TransparencyValue;
2013-03-10 19:59:05 +00:00
STATE m_State;
2009-02-10 18:37:48 +00:00
2012-05-20 17:57:12 +00:00
bool m_Hidden;
RESIZEMODE m_ResizeWindow;
2009-02-10 18:37:48 +00:00
2013-05-31 14:18:52 +00:00
std::vector<Measure*> m_Measures;
std::vector<Meter*> m_Meters;
2009-02-10 18:37:48 +00:00
const std::wstring m_FolderPath;
const std::wstring m_FileName;
2012-05-20 13:12:13 +00:00
2009-02-10 18:37:48 +00:00
int m_UpdateCounter;
UINT m_MouseMoveCounter;
2009-02-10 18:37:48 +00:00
Gfx::FontCollection* m_FontCollection;
bool m_ToolTipHidden;
static int c_InstanceCount;
static HINSTANCE c_DwmInstance;
static FPDWMENABLEBLURBEHINDWINDOW c_DwmEnableBlurBehindWindow;
static FPDWMGETCOLORIZATIONCOLOR c_DwmGetColorizationColor;
static FPDWMSETWINDOWATTRIBUTE c_DwmSetWindowAttribute;
static FPDWMISCOMPOSITIONENABLED c_DwmIsCompositionEnabled;
2009-02-10 18:37:48 +00:00
};
#endif