From 50a8884c32acc429260f358ca314afbeee99b586 Mon Sep 17 00:00:00 2001 From: Enrico Giordani Date: Thu, 5 Nov 2020 10:38:46 +0100 Subject: [PATCH] [common, shortcutguide] move d2d files from common to scg (#7844) Also remove d2d classes from common documentation --- doc/devdocs/common.md | 9 -------- src/common/common.vcxproj | 6 ------ src/common/common.vcxproj.filters | 21 ------------------- src/common/pch.h | 7 +------ .../shortcut_guide}/d2d_svg.cpp | 0 .../shortcut_guide}/d2d_svg.h | 0 .../shortcut_guide}/d2d_text.cpp | 0 .../shortcut_guide}/d2d_text.h | 0 .../shortcut_guide}/d2d_window.cpp | 0 .../shortcut_guide}/d2d_window.h | 0 src/modules/shortcut_guide/overlay_window.cpp | 18 ++++++++-------- src/modules/shortcut_guide/overlay_window.h | 6 +++--- src/modules/shortcut_guide/pch.h | 1 + .../shortcut_guide/shortcut_guide.vcxproj | 6 ++++++ .../shortcut_guide.vcxproj.filters | 19 +++++++++++++++++ 15 files changed, 39 insertions(+), 54 deletions(-) rename src/{common => modules/shortcut_guide}/d2d_svg.cpp (100%) rename src/{common => modules/shortcut_guide}/d2d_svg.h (100%) rename src/{common => modules/shortcut_guide}/d2d_text.cpp (100%) rename src/{common => modules/shortcut_guide}/d2d_text.h (100%) rename src/{common => modules/shortcut_guide}/d2d_window.cpp (100%) rename src/{common => modules/shortcut_guide}/d2d_window.h (100%) diff --git a/doc/devdocs/common.md b/doc/devdocs/common.md index 8b4cdf84ad..eb26391370 100644 --- a/doc/devdocs/common.md +++ b/doc/devdocs/common.md @@ -9,15 +9,6 @@ Header-only asynchronous message queue. Used by `TwoWayPipeMessageIPC`. #### class TwoWayPipeMessageIPC: [header](/src/common/two_way_pipe_message_ipc.h) Header-only asynchronous IPC messaging class. Used by the runner to communicate with the settings window. -#### class D2DSVG: [header](/src/common/d2d_svg.h) [source](/src/common/d2d_svg.cpp) -Class for loading, rendering and for some basic modifications of SVG graphics. - -#### class D2DText: [header](/src/common/d2d_text.h) [source](/src/common/d2d_text.cpp) -Class for rendering text using DirectX. - -#### class D2DWindow: [header](/src/common/d2d_window.h) [source](/src/common/d2d_window.cpp) -Base class for creating borderless windows, with DirectX enabled rendering pipeline. - #### class DPIAware: [header](/src/common/dpi_aware.h) [source](/src/common/dpi_aware.cpp) Helper class for creating DPI-aware applications. diff --git a/src/common/common.vcxproj b/src/common/common.vcxproj index d44af3419e..0522f9b932 100644 --- a/src/common/common.vcxproj +++ b/src/common/common.vcxproj @@ -123,9 +123,6 @@ - - - @@ -165,9 +162,6 @@ - - - diff --git a/src/common/common.vcxproj.filters b/src/common/common.vcxproj.filters index da8ff204d2..420c2bbd7c 100644 --- a/src/common/common.vcxproj.filters +++ b/src/common/common.vcxproj.filters @@ -9,23 +9,11 @@ {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - {ed0f9961-6b12-408b-8dbc-fed779a557ac} - {3e9f944e-5d97-4a28-8865-2eff3a3568e7} - - Header Files\Direct2D - - - Header Files\Direct2D - - - Header Files\Direct2D - Header Files @@ -146,15 +134,6 @@ - - Source Files - - - Source Files - - - Source Files - Source Files diff --git a/src/common/pch.h b/src/common/pch.h index c396885a03..53453d3cf9 100644 --- a/src/common/pch.h +++ b/src/common/pch.h @@ -2,12 +2,7 @@ #include #include #include -#include -#include -#include -#include -#include -#include + #include #include #include diff --git a/src/common/d2d_svg.cpp b/src/modules/shortcut_guide/d2d_svg.cpp similarity index 100% rename from src/common/d2d_svg.cpp rename to src/modules/shortcut_guide/d2d_svg.cpp diff --git a/src/common/d2d_svg.h b/src/modules/shortcut_guide/d2d_svg.h similarity index 100% rename from src/common/d2d_svg.h rename to src/modules/shortcut_guide/d2d_svg.h diff --git a/src/common/d2d_text.cpp b/src/modules/shortcut_guide/d2d_text.cpp similarity index 100% rename from src/common/d2d_text.cpp rename to src/modules/shortcut_guide/d2d_text.cpp diff --git a/src/common/d2d_text.h b/src/modules/shortcut_guide/d2d_text.h similarity index 100% rename from src/common/d2d_text.h rename to src/modules/shortcut_guide/d2d_text.h diff --git a/src/common/d2d_window.cpp b/src/modules/shortcut_guide/d2d_window.cpp similarity index 100% rename from src/common/d2d_window.cpp rename to src/modules/shortcut_guide/d2d_window.cpp diff --git a/src/common/d2d_window.h b/src/modules/shortcut_guide/d2d_window.h similarity index 100% rename from src/common/d2d_window.h rename to src/modules/shortcut_guide/d2d_window.h diff --git a/src/modules/shortcut_guide/overlay_window.cpp b/src/modules/shortcut_guide/overlay_window.cpp index 40e340375c..7e4c90f01d 100644 --- a/src/modules/shortcut_guide/overlay_window.cpp +++ b/src/modules/shortcut_guide/overlay_window.cpp @@ -71,7 +71,7 @@ ScaleResult D2DOverlaySVG::get_thumbnail_rect_and_scale(int x_offset, int y_offs } float scale_h = fill * thumbnail_scaled_rect_width / window_cx; float scale_v = fill * thumbnail_scaled_rect_heigh / window_cy; - float use_scale = min(scale_h, scale_v); + float use_scale = std::min(scale_h, scale_v); RECT thumb_rect; thumb_rect.left = thumbnail_scaled_rect.left + (int)(thumbnail_scaled_rect_width - use_scale * window_cx) / 2 + x_offset; thumb_rect.right = thumbnail_scaled_rect.right - (int)(thumbnail_scaled_rect_width - use_scale * window_cx) / 2 + x_offset; @@ -254,10 +254,10 @@ void D2DOverlayWindow::show(HWND active_window, bool snappable) total_screen = ScreenSize(monitors[0].rect); for (auto& monitor : monitors) { - total_screen.rect.left = min(total_screen.rect.left, monitor.rect.left); - total_screen.rect.top = min(total_screen.rect.top, monitor.rect.top); - total_screen.rect.right = max(total_screen.rect.right, monitor.rect.right); - total_screen.rect.bottom = max(total_screen.rect.bottom, monitor.rect.bottom); + total_screen.rect.left = std::min(total_screen.rect.left, monitor.rect.left); + total_screen.rect.top = std::min(total_screen.rect.top, monitor.rect.top); + total_screen.rect.right = std::max(total_screen.rect.right, monitor.rect.right); + total_screen.rect.bottom = std::max(total_screen.rect.bottom, monitor.rect.bottom); } // make sure top-right corner of all the monitor rects is (0,0) monitor_dx = -total_screen.left(); @@ -693,10 +693,10 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc) auto total_monitor_with_screen = total_screen; if (thumb_window) { - total_monitor_with_screen.rect.left = min(total_monitor_with_screen.rect.left, thumb_window->left + monitor_dx); - total_monitor_with_screen.rect.top = min(total_monitor_with_screen.rect.top, thumb_window->top + monitor_dy); - total_monitor_with_screen.rect.right = max(total_monitor_with_screen.rect.right, thumb_window->right + monitor_dx); - total_monitor_with_screen.rect.bottom = max(total_monitor_with_screen.rect.bottom, thumb_window->bottom + monitor_dy); + total_monitor_with_screen.rect.left = std::min(total_monitor_with_screen.rect.left, thumb_window->left + monitor_dx); + total_monitor_with_screen.rect.top = std::min(total_monitor_with_screen.rect.top, thumb_window->top + monitor_dy); + total_monitor_with_screen.rect.right = std::max(total_monitor_with_screen.rect.right, thumb_window->right + monitor_dx); + total_monitor_with_screen.rect.bottom = std::max(total_monitor_with_screen.rect.bottom, thumb_window->bottom + monitor_dy); } // Only allow the new rect being slight bigger. if (total_monitor_with_screen.width() - total_screen.width() > (thumb_window->right - thumb_window->left) / 2 || diff --git a/src/modules/shortcut_guide/overlay_window.h b/src/modules/shortcut_guide/overlay_window.h index 340b3cf3fa..bf78bf329c 100644 --- a/src/modules/shortcut_guide/overlay_window.h +++ b/src/modules/shortcut_guide/overlay_window.h @@ -1,7 +1,7 @@ #pragma once -#include "common/d2d_svg.h" -#include "common/d2d_window.h" -#include "common/d2d_text.h" +#include "d2d_svg.h" +#include "d2d_window.h" +#include "d2d_text.h" #include "common/monitors.h" #include "common/animation.h" #include "common/windows_colors.h" diff --git a/src/modules/shortcut_guide/pch.h b/src/modules/shortcut_guide/pch.h index 63a1318c02..00bc5abf6c 100644 --- a/src/modules/shortcut_guide/pch.h +++ b/src/modules/shortcut_guide/pch.h @@ -1,4 +1,5 @@ #pragma once +#define NOMINMAX #include #include #include diff --git a/src/modules/shortcut_guide/shortcut_guide.vcxproj b/src/modules/shortcut_guide/shortcut_guide.vcxproj index 39047b7830..3bd8dc92cc 100644 --- a/src/modules/shortcut_guide/shortcut_guide.vcxproj +++ b/src/modules/shortcut_guide/shortcut_guide.vcxproj @@ -105,6 +105,9 @@ + + + @@ -116,6 +119,9 @@ + + + diff --git a/src/modules/shortcut_guide/shortcut_guide.vcxproj.filters b/src/modules/shortcut_guide/shortcut_guide.vcxproj.filters index 4ee893ee3b..abd802be47 100644 --- a/src/modules/shortcut_guide/shortcut_guide.vcxproj.filters +++ b/src/modules/shortcut_guide/shortcut_guide.vcxproj.filters @@ -18,6 +18,15 @@ Source Files + + Source Files + + + Source Files + + + Source Files + @@ -39,6 +48,16 @@ Generated Files + + + Header Files + + + Header Files + + + Header Files +