[ScreenRuler]Add setting to show the measurement in an extra unit (#35887)

* display ruler: supporting millimeter and other units

* Measurement Tool: UI Setting for an extra unit

* Update images

* spelling

* spelling

* suit code style

* Fix for code review

* remove weird file

* rename field
This commit is contained in:
Wenjian Chern
2024-12-06 06:02:17 +08:00
committed by GitHub
parent 076461e460
commit 09ce610dbb
26 changed files with 333 additions and 101 deletions

View File

@@ -1,4 +1,5 @@
#pragma once
#pragma comment(lib, "Gdi32.lib")
#include <Windows.h>
#include <compare>
@@ -42,6 +43,15 @@ struct Box
class MonitorInfo
{
public:
typedef struct Size
{
uint32_t width_logical, height_logical;
uint32_t width_physical, height_physical;
float width_mm, height_mm;
} Size;
private:
HMONITOR handle;
MONITORINFOEX info = {};
@@ -53,8 +63,14 @@ public:
}
Box GetScreenSize(const bool includeNonWorkingArea) const;
bool IsPrimary() const;
Size GetSize() const;
// Returns monitor rects ordered from left to right
static std::vector<MonitorInfo> GetMonitors(bool includeNonWorkingArea);
static MonitorInfo GetPrimaryMonitor();
static MonitorInfo GetFromWindow(HWND);
static MonitorInfo GetFromPoint(int32_t, int32_t);
private:
static Size GetSize(const MONITORINFOEX&);
};