mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-14 03:37:10 +08:00
* Localized shortcut_guide.cpp * localized overlay_window.cpp * formatting changes * Localize overlay window * removed the README link from the set of localized resources * Typo: changed upper to lower
This commit is contained in:
parent
45e3f02832
commit
1ad16ade86
@ -6,8 +6,11 @@
|
|||||||
#include "keyboard_state.h"
|
#include "keyboard_state.h"
|
||||||
#include "shortcut_guide.h"
|
#include "shortcut_guide.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
#include "resource.h"
|
||||||
#include <common/common.h>
|
#include <common/common.h>
|
||||||
|
|
||||||
|
extern "C" IMAGE_DOS_HEADER __ImageBase;
|
||||||
|
|
||||||
D2DOverlaySVG& D2DOverlaySVG::load(const std::wstring& filename, ID2D1DeviceContext5* d2d_dc)
|
D2DOverlaySVG& D2DOverlaySVG::load(const std::wstring& filename, ID2D1DeviceContext5* d2d_dc)
|
||||||
{
|
{
|
||||||
D2DSVG::load(filename, d2d_dc);
|
D2DSVG::load(filename, d2d_dc);
|
||||||
@ -791,71 +794,71 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc)
|
|||||||
switch (window_state)
|
switch (window_state)
|
||||||
{
|
{
|
||||||
case MINIMIZED:
|
case MINIMIZED:
|
||||||
left = L"No action";
|
left = GET_RESOURCE_STRING(IDS_NO_ACTION);
|
||||||
left_disabled = true;
|
left_disabled = true;
|
||||||
right = L"No action";
|
right = GET_RESOURCE_STRING(IDS_NO_ACTION);
|
||||||
right_disabled = true;
|
right_disabled = true;
|
||||||
up = L"Restore";
|
up = GET_RESOURCE_STRING(IDS_RESTORE);
|
||||||
down = L"No action";
|
down = GET_RESOURCE_STRING(IDS_NO_ACTION);
|
||||||
down_disabled = true;
|
down_disabled = true;
|
||||||
break;
|
break;
|
||||||
case MAXIMIZED:
|
case MAXIMIZED:
|
||||||
left = L"Snap left";
|
left = GET_RESOURCE_STRING(IDS_SNAP_LEFT);
|
||||||
right = L"Snap right";
|
right = GET_RESOURCE_STRING(IDS_SNAP_RIGHT);
|
||||||
up = L"No action";
|
up = GET_RESOURCE_STRING(IDS_NO_ACTION);
|
||||||
up_disabled = true;
|
up_disabled = true;
|
||||||
down = L"Restore";
|
down = GET_RESOURCE_STRING(IDS_RESTORE);
|
||||||
break;
|
break;
|
||||||
case SNAPED_TOP_LEFT:
|
case SNAPED_TOP_LEFT:
|
||||||
left = L"Snap upper right";
|
left = GET_RESOURCE_STRING(IDS_SNAP_UPPER_RIGHT);
|
||||||
right = L"Snap upper right";
|
right = GET_RESOURCE_STRING(IDS_SNAP_UPPER_RIGHT);
|
||||||
up = L"Maximize";
|
up = GET_RESOURCE_STRING(IDS_MAXIMIZE);
|
||||||
down = L"Snap left";
|
down = GET_RESOURCE_STRING(IDS_SNAP_LEFT);
|
||||||
break;
|
break;
|
||||||
case SNAPED_LEFT:
|
case SNAPED_LEFT:
|
||||||
left = L"Snap right";
|
left = GET_RESOURCE_STRING(IDS_SNAP_RIGHT);
|
||||||
right = L"Restore";
|
right = GET_RESOURCE_STRING(IDS_RESTORE);
|
||||||
up = L"Snap upper left";
|
up = GET_RESOURCE_STRING(IDS_SNAP_UPPER_LEFT);
|
||||||
down = L"Snap lower left";
|
down = GET_RESOURCE_STRING(IDS_SNAP_LOWER_LEFT);
|
||||||
break;
|
break;
|
||||||
case SNAPED_BOTTOM_LEFT:
|
case SNAPED_BOTTOM_LEFT:
|
||||||
left = L"Snap lower right";
|
left = GET_RESOURCE_STRING(IDS_SNAP_LOWER_RIGHT);
|
||||||
right = L"Snap lower right";
|
right = GET_RESOURCE_STRING(IDS_SNAP_LOWER_RIGHT);
|
||||||
up = L"Snap left";
|
up = GET_RESOURCE_STRING(IDS_SNAP_LEFT);
|
||||||
down = L"Minimize";
|
down = GET_RESOURCE_STRING(IDS_MINIMIZE);
|
||||||
break;
|
break;
|
||||||
case SNAPED_TOP_RIGHT:
|
case SNAPED_TOP_RIGHT:
|
||||||
left = L"Snap upper left";
|
left = GET_RESOURCE_STRING(IDS_SNAP_UPPER_LEFT);
|
||||||
right = L"Snap upper left";
|
right = GET_RESOURCE_STRING(IDS_SNAP_UPPER_LEFT);
|
||||||
up = L"Maximize";
|
up = GET_RESOURCE_STRING(IDS_MAXIMIZE);
|
||||||
down = L"Snap right";
|
down = GET_RESOURCE_STRING(IDS_SNAP_RIGHT);
|
||||||
break;
|
break;
|
||||||
case SNAPED_RIGHT:
|
case SNAPED_RIGHT:
|
||||||
left = L"Restore";
|
left = GET_RESOURCE_STRING(IDS_RESTORE);
|
||||||
right = L"Snap left";
|
right = GET_RESOURCE_STRING(IDS_SNAP_LEFT);
|
||||||
up = L"Snap upper right";
|
up = GET_RESOURCE_STRING(IDS_SNAP_UPPER_RIGHT);
|
||||||
down = L"Snap lower right";
|
down = GET_RESOURCE_STRING(IDS_SNAP_LOWER_RIGHT);
|
||||||
break;
|
break;
|
||||||
case SNAPED_BOTTOM_RIGHT:
|
case SNAPED_BOTTOM_RIGHT:
|
||||||
left = L"Snap lower left";
|
left = GET_RESOURCE_STRING(IDS_SNAP_LOWER_LEFT);
|
||||||
right = L"Snap lower left";
|
right = GET_RESOURCE_STRING(IDS_SNAP_LOWER_LEFT);
|
||||||
up = L"Snap right";
|
up = GET_RESOURCE_STRING(IDS_SNAP_RIGHT);
|
||||||
down = L"Minimize";
|
down = GET_RESOURCE_STRING(IDS_MINIMIZE);
|
||||||
break;
|
break;
|
||||||
case RESTORED:
|
case RESTORED:
|
||||||
left = L"Snap left";
|
left = GET_RESOURCE_STRING(IDS_SNAP_LEFT);
|
||||||
right = L"Snap right";
|
right = GET_RESOURCE_STRING(IDS_SNAP_RIGHT);
|
||||||
up = L"Maximize";
|
up = GET_RESOURCE_STRING(IDS_MAXIMIZE);
|
||||||
down = L"Minimize";
|
down = GET_RESOURCE_STRING(IDS_MINIMIZE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
left = L"No action";
|
left = GET_RESOURCE_STRING(IDS_NO_ACTION);
|
||||||
left_disabled = true;
|
left_disabled = true;
|
||||||
right = L"No action";
|
right = GET_RESOURCE_STRING(IDS_NO_ACTION);
|
||||||
right_disabled = true;
|
right_disabled = true;
|
||||||
up = L"No action";
|
up = GET_RESOURCE_STRING(IDS_NO_ACTION);
|
||||||
up_disabled = true;
|
up_disabled = true;
|
||||||
down = L"No action";
|
down = GET_RESOURCE_STRING(IDS_NO_ACTION);
|
||||||
down_disabled = true;
|
down_disabled = true;
|
||||||
}
|
}
|
||||||
auto text_color = D2D1::ColorF(light_mode ? 0x222222 : 0xDDDDDD, minature_shown || window_state == MINIMIZED ? 1.0f : 0.3f);
|
auto text_color = D2D1::ColorF(light_mode ? 0x222222 : 0xDDDDDD, minature_shown || window_state == MINIMIZED ? 1.0f : 0.3f);
|
||||||
|
@ -1,6 +1,18 @@
|
|||||||
#define IDS_SETTING_DESCRIPTION_PRESS_TIME 101
|
#define IDS_SETTING_DESCRIPTION_PRESS_TIME 101
|
||||||
#define IDS_SETTING_DESCRIPTION_OVERLAY_OPACITY 102
|
#define IDS_SETTING_DESCRIPTION_OVERLAY_OPACITY 102
|
||||||
#define IDS_SETTING_DESCRIPTION_THEME 103
|
#define IDS_SETTING_DESCRIPTION_THEME 103
|
||||||
#define IDS_SETTING_DESCRIPTION_THEME_LIGHT 104
|
#define IDS_SETTING_DESCRIPTION_THEME_LIGHT 104
|
||||||
#define IDS_SETTING_DESCRIPTION_THEME_DARK 105
|
#define IDS_SETTING_DESCRIPTION_THEME_DARK 105
|
||||||
#define IDS_SETTING_DESCRIPTION_THEME_SYSTEM 106
|
#define IDS_SETTING_DESCRIPTION_THEME_SYSTEM 106
|
||||||
|
#define IDS_SETTINGS_DESCRIPTION 107
|
||||||
|
#define IDS_SHORTCUT_GUIDE 108
|
||||||
|
#define IDS_NO_ACTION 109
|
||||||
|
#define IDS_RESTORE 110
|
||||||
|
#define IDS_SNAP_RIGHT 111
|
||||||
|
#define IDS_SNAP_LEFT 112
|
||||||
|
#define IDS_SNAP_UPPER_RIGHT 113
|
||||||
|
#define IDS_SNAP_UPPER_LEFT 114
|
||||||
|
#define IDS_SNAP_LOWER_RIGHT 115
|
||||||
|
#define IDS_SNAP_LOWER_LEFT 116
|
||||||
|
#define IDS_MINIMIZE 117
|
||||||
|
#define IDS_MAXIMIZE 118
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "shortcut_guide.h"
|
#include "shortcut_guide.h"
|
||||||
#include "target_state.h"
|
#include "target_state.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
#include <common/common.h>
|
#include <common/common.h>
|
||||||
#include <common/settings_objects.h>
|
#include <common/settings_objects.h>
|
||||||
@ -12,12 +13,13 @@ OverlayWindow* instance = nullptr;
|
|||||||
|
|
||||||
OverlayWindow::OverlayWindow()
|
OverlayWindow::OverlayWindow()
|
||||||
{
|
{
|
||||||
|
app_name = GET_RESOURCE_STRING(IDS_SHORTCUT_GUIDE);
|
||||||
init_settings();
|
init_settings();
|
||||||
}
|
}
|
||||||
|
|
||||||
const wchar_t* OverlayWindow::get_name()
|
const wchar_t* OverlayWindow::get_name()
|
||||||
{
|
{
|
||||||
return L"Shortcut Guide";
|
return app_name.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
const wchar_t** OverlayWindow::get_events()
|
const wchar_t** OverlayWindow::get_events()
|
||||||
@ -31,7 +33,7 @@ bool OverlayWindow::get_config(wchar_t* buffer, int* buffer_size)
|
|||||||
HINSTANCE hinstance = reinterpret_cast<HINSTANCE>(&__ImageBase);
|
HINSTANCE hinstance = reinterpret_cast<HINSTANCE>(&__ImageBase);
|
||||||
|
|
||||||
PowerToysSettings::Settings settings(hinstance, get_name());
|
PowerToysSettings::Settings settings(hinstance, get_name());
|
||||||
settings.set_description(L"Shows a help overlay with Windows shortcuts when the Windows key is pressed.");
|
settings.set_description(GET_RESOURCE_STRING(IDS_SETTINGS_DESCRIPTION));
|
||||||
settings.set_overview_link(L"https://github.com/microsoft/PowerToys/blob/master/src/modules/shortcut_guide/README.md");
|
settings.set_overview_link(L"https://github.com/microsoft/PowerToys/blob/master/src/modules/shortcut_guide/README.md");
|
||||||
settings.set_icon_key(L"pt-shortcut-guide");
|
settings.set_icon_key(L"pt-shortcut-guide");
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ public:
|
|||||||
virtual void destroy() override;
|
virtual void destroy() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::wstring app_name;
|
||||||
std::unique_ptr<TargetState> target_state;
|
std::unique_ptr<TargetState> target_state;
|
||||||
std::unique_ptr<D2DOverlayWindow> winkey_popup;
|
std::unique_ptr<D2DOverlayWindow> winkey_popup;
|
||||||
bool _enabled = false;
|
bool _enabled = false;
|
||||||
|
@ -7,8 +7,20 @@
|
|||||||
|