Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
{
"file": ".github/prompts/create-pr-summary.prompt.md"
}
]
],
"snyk.advanced.autoSelectOrganization": true
}
10 changes: 6 additions & 4 deletions src/modules/ZoomIt/ZoomIt/ZoomIt.rc
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,15 @@ BEGIN
LTEXT "Microphone:",IDC_MICROPHONE_LABEL,32,178,47,8
END

SNIP DIALOGEX 0, 0, 260, 68
SNIP DIALOGEX 0, 0, 260, 82
STYLE DS_SETFONT | DS_CONTROL | WS_CHILD | WS_CLIPSIBLINGS | WS_SYSMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "",IDC_SNIP_HOTKEY,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,55,32,80,12
LTEXT "Snip Toggle:",IDC_STATIC,7,33,45,8
LTEXT "Copy a region of the screen to the clipboard or enter the hotkey with the Shift key in the opposite mode to save it to a file. ",IDC_STATIC,7,7,230,19
LTEXT "Copy a region of the screen to the clipboard, or save it to a file using the save shortcut.",IDC_STATIC,7,7,230,11
LTEXT "Snip Toggle:",IDC_STATIC,7,25,45,8
CONTROL "",IDC_SNIP_HOTKEY,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,72,24,80,12
LTEXT "Snip Save Toggle:",IDC_STATIC,7,41,62,8
CONTROL "",IDC_SNIP_SAVE_HOTKEY,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,72,40,80,12
END

DEMOTYPE DIALOGEX 0, 0, 260, 249
Expand Down
2 changes: 2 additions & 0 deletions src/modules/ZoomIt/ZoomIt/ZoomItSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ DWORD g_BreakToggleKey = ((HOTKEYF_CONTROL) << 8)| '3';
DWORD g_DemoTypeToggleKey = ((HOTKEYF_CONTROL) << 8) | '7';
DWORD g_RecordToggleKey = ((HOTKEYF_CONTROL) << 8) | '5';
DWORD g_SnipToggleKey = ((HOTKEYF_CONTROL) << 8) | '6';
DWORD g_SnipSaveToggleKey = ((HOTKEYF_CONTROL | HOTKEYF_SHIFT) << 8) | '6';

DWORD g_ShowExpiredTime = 1;
DWORD g_SliderZoomLevel = 3;
Expand Down Expand Up @@ -66,6 +67,7 @@ REG_SETTING RegSettings[] = {
{ L"DrawToggleKey", SETTING_TYPE_DWORD, 0, &g_DrawToggleKey, static_cast<DOUBLE>(g_DrawToggleKey) },
{ L"RecordToggleKey", SETTING_TYPE_DWORD, 0, &g_RecordToggleKey, static_cast<DOUBLE>(g_RecordToggleKey) },
{ L"SnipToggleKey", SETTING_TYPE_DWORD, 0, &g_SnipToggleKey, static_cast<DOUBLE>(g_SnipToggleKey) },
{ L"SnipSaveToggleKey", SETTING_TYPE_DWORD, 0, &g_SnipSaveToggleKey, static_cast<DOUBLE>(g_SnipSaveToggleKey) },
{ L"PenColor", SETTING_TYPE_DWORD, 0, &g_PenColor, static_cast<DOUBLE>(g_PenColor) },
{ L"PenWidth", SETTING_TYPE_DWORD, 0, &g_RootPenWidth, static_cast<DOUBLE>(g_RootPenWidth) },
{ L"OptionsShown", SETTING_TYPE_BOOLEAN, 0, &g_OptionsShown, static_cast<DOUBLE>(g_OptionsShown) },
Expand Down
17 changes: 13 additions & 4 deletions src/modules/ZoomIt/ZoomIt/Zoomit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ DWORD g_BreakToggleMod;
DWORD g_DemoTypeToggleMod;
DWORD g_RecordToggleMod;
DWORD g_SnipToggleMod;
DWORD g_SnipSaveToggleMod;

BOOLEAN g_ZoomOnLiveZoom = FALSE;
DWORD g_PenWidth = PEN_WIDTH;
Expand Down Expand Up @@ -2351,7 +2352,7 @@ void RegisterAllHotkeys(HWND hWnd)
}
if (g_SnipToggleKey) {
RegisterHotKey(hWnd, SNIP_HOTKEY, g_SnipToggleMod, g_SnipToggleKey & 0xFF);
RegisterHotKey(hWnd, SNIP_SAVE_HOTKEY, (g_SnipToggleMod ^ MOD_SHIFT), g_SnipToggleKey & 0xFF);
RegisterHotKey(hWnd, SNIP_SAVE_HOTKEY, g_SnipSaveToggleMod, g_SnipSaveToggleKey & 0xFF);
}
if (g_RecordToggleKey) {
RegisterHotKey(hWnd, RECORD_HOTKEY, g_RecordToggleMod | MOD_NOREPEAT, g_RecordToggleKey & 0xFF);
Expand Down Expand Up @@ -3574,6 +3575,7 @@ INT_PTR CALLBACK OptionsProc( HWND hDlg, UINT message,
TCHAR text[32];
DWORD newToggleKey, newTimeout, newToggleMod, newBreakToggleKey, newDemoTypeToggleKey, newRecordToggleKey, newSnipToggleKey;
DWORD newDrawToggleKey, newDrawToggleMod, newBreakToggleMod, newDemoTypeToggleMod, newRecordToggleMod, newSnipToggleMod;
DWORD newSnipSaveToggleKey, newSnipSaveToggleMod;
DWORD newLiveZoomToggleKey, newLiveZoomToggleMod;
static std::vector<std::pair<std::wstring, std::wstring>> microphones;

Expand Down Expand Up @@ -3808,6 +3810,7 @@ INT_PTR CALLBACK OptionsProc( HWND hDlg, UINT message,
if( g_DemoTypeToggleKey ) SendMessage( GetDlgItem( g_OptionsTabs[DEMOTYPE_PAGE].hPage, IDC_DEMOTYPE_HOTKEY ), HKM_SETHOTKEY, g_DemoTypeToggleKey, 0 );
if( g_RecordToggleKey ) SendMessage( GetDlgItem( g_OptionsTabs[RECORD_PAGE].hPage, IDC_RECORD_HOTKEY), HKM_SETHOTKEY, g_RecordToggleKey, 0 );
if( g_SnipToggleKey) SendMessage( GetDlgItem( g_OptionsTabs[SNIP_PAGE].hPage, IDC_SNIP_HOTKEY), HKM_SETHOTKEY, g_SnipToggleKey, 0 );
if( g_SnipSaveToggleKey) SendMessage( GetDlgItem( g_OptionsTabs[SNIP_PAGE].hPage, IDC_SNIP_SAVE_HOTKEY), HKM_SETHOTKEY, g_SnipSaveToggleKey, 0 );
CheckDlgButton( hDlg, IDC_SHOW_TRAY_ICON,
g_ShowTrayIcon ? BST_CHECKED: BST_UNCHECKED );
CheckDlgButton( hDlg, IDC_AUTOSTART,
Expand Down Expand Up @@ -4248,6 +4251,7 @@ INT_PTR CALLBACK OptionsProc( HWND hDlg, UINT message,
newDemoTypeToggleKey = static_cast<DWORD>(SendMessage( GetDlgItem( g_OptionsTabs[DEMOTYPE_PAGE].hPage, IDC_DEMOTYPE_HOTKEY ), HKM_GETHOTKEY, 0, 0 ));
newRecordToggleKey = static_cast<DWORD>(SendMessage(GetDlgItem(g_OptionsTabs[RECORD_PAGE].hPage, IDC_RECORD_HOTKEY), HKM_GETHOTKEY, 0, 0));
newSnipToggleKey = static_cast<DWORD>(SendMessage( GetDlgItem( g_OptionsTabs[SNIP_PAGE].hPage, IDC_SNIP_HOTKEY), HKM_GETHOTKEY, 0, 0 ));
newSnipSaveToggleKey = static_cast<DWORD>(SendMessage( GetDlgItem( g_OptionsTabs[SNIP_PAGE].hPage, IDC_SNIP_SAVE_HOTKEY), HKM_GETHOTKEY, 0, 0 ));

newToggleMod = GetKeyMod( newToggleKey );
newLiveZoomToggleMod = GetKeyMod( newLiveZoomToggleKey );
Expand All @@ -4256,6 +4260,7 @@ INT_PTR CALLBACK OptionsProc( HWND hDlg, UINT message,
newDemoTypeToggleMod = GetKeyMod( newDemoTypeToggleKey );
newRecordToggleMod = GetKeyMod(newRecordToggleKey);
newSnipToggleMod = GetKeyMod( newSnipToggleKey );
newSnipSaveToggleMod = GetKeyMod( newSnipSaveToggleKey );

g_SliderZoomLevel = static_cast<int>(SendMessage( GetDlgItem(g_OptionsTabs[ZOOM_PAGE].hPage, IDC_ZOOM_SLIDER), TBM_GETPOS, 0, 0 ));
g_DemoTypeSpeedSlider = static_cast<int>(SendMessage( GetDlgItem( g_OptionsTabs[DEMOTYPE_PAGE].hPage, IDC_DEMOTYPE_SPEED_SLIDER ), TBM_GETPOS, 0, 0 ));
Expand Down Expand Up @@ -4318,7 +4323,7 @@ INT_PTR CALLBACK OptionsProc( HWND hDlg, UINT message,
}
else if (newSnipToggleKey &&
(!RegisterHotKey(GetParent(hDlg), SNIP_HOTKEY, newSnipToggleMod, newSnipToggleKey & 0xFF) ||
!RegisterHotKey(GetParent(hDlg), SNIP_SAVE_HOTKEY, (newSnipToggleMod ^ MOD_SHIFT), newSnipToggleKey & 0xFF))) {
!RegisterHotKey(GetParent(hDlg), SNIP_SAVE_HOTKEY, newSnipSaveToggleMod, newSnipSaveToggleKey & 0xFF))) {

MessageBox(hDlg, L"The specified snip hotkey is already in use.\nSelect a different snip hotkey.",
APPNAME, MB_ICONERROR);
Expand Down Expand Up @@ -4352,6 +4357,8 @@ INT_PTR CALLBACK OptionsProc( HWND hDlg, UINT message,
g_RecordToggleMod = newRecordToggleMod;
g_SnipToggleKey = newSnipToggleKey;
g_SnipToggleMod = newSnipToggleMod;
g_SnipSaveToggleKey = newSnipSaveToggleKey;
g_SnipSaveToggleMod = newSnipSaveToggleMod;
reg.WriteRegSettings( RegSettings );
EnableDisableTrayIcon( GetParent( hDlg ), g_ShowTrayIcon );

Expand Down Expand Up @@ -6208,6 +6215,7 @@ LRESULT APIENTRY MainWndProc(
g_BreakToggleMod = GetKeyMod( g_BreakToggleKey );
g_DemoTypeToggleMod = GetKeyMod( g_DemoTypeToggleKey );
g_SnipToggleMod = GetKeyMod( g_SnipToggleKey );
g_SnipSaveToggleMod = GetKeyMod( g_SnipSaveToggleKey );
g_RecordToggleMod = GetKeyMod( g_RecordToggleKey );

if( !g_OptionsShown && !g_StartedByPowerToys ) {
Expand Down Expand Up @@ -6258,7 +6266,7 @@ LRESULT APIENTRY MainWndProc(
}
else if (g_SnipToggleKey &&
(!RegisterHotKey(hWnd, SNIP_HOTKEY, g_SnipToggleMod, g_SnipToggleKey & 0xFF) ||
!RegisterHotKey(hWnd, SNIP_SAVE_HOTKEY, (g_SnipToggleMod ^ MOD_SHIFT), g_SnipToggleKey & 0xFF))) {
!RegisterHotKey(hWnd, SNIP_SAVE_HOTKEY, g_SnipSaveToggleMod, g_SnipSaveToggleKey & 0xFF))) {

MessageBox(hWnd, L"The specified snip hotkey is already in use.\nSelect a different snip hotkey.",
APPNAME, MB_ICONERROR);
Expand Down Expand Up @@ -8548,6 +8556,7 @@ LRESULT APIENTRY MainWndProc(
g_BreakToggleMod = GetKeyMod(g_BreakToggleKey);
g_DemoTypeToggleMod = GetKeyMod(g_DemoTypeToggleKey);
g_SnipToggleMod = GetKeyMod(g_SnipToggleKey);
g_SnipSaveToggleMod = GetKeyMod(g_SnipSaveToggleKey);
g_RecordToggleMod = GetKeyMod(g_RecordToggleKey);
BOOL showOptions = FALSE;
if (g_ToggleKey)
Expand Down Expand Up @@ -8595,7 +8604,7 @@ LRESULT APIENTRY MainWndProc(
if (g_SnipToggleKey)
{
if (!RegisterHotKey(hWnd, SNIP_HOTKEY, g_SnipToggleMod, g_SnipToggleKey & 0xFF) ||
!RegisterHotKey(hWnd, SNIP_SAVE_HOTKEY, (g_SnipToggleMod ^ MOD_SHIFT), g_SnipToggleKey & 0xFF))
!RegisterHotKey(hWnd, SNIP_SAVE_HOTKEY, g_SnipSaveToggleMod, g_SnipSaveToggleKey & 0xFF))
{
MessageBox(hWnd, L"The specified snip hotkey is already in use.\nSelect a different snip hotkey.", APPNAME, MB_ICONERROR);
showOptions = TRUE;
Expand Down
3 changes: 2 additions & 1 deletion src/modules/ZoomIt/ZoomIt/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
#define IDC_CAPTURE_SYSTEM_AUDIO 1108
#define IDC_MICROPHONE_LABEL 1109
#define IDC_MIC_MONO_MIX 1110
#define IDC_SNIP_SAVE_HOTKEY 1111
#define IDC_SAVE 40002
#define IDC_COPY 40004
#define IDC_RECORD 40006
Expand All @@ -126,7 +127,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 120
#define _APS_NEXT_COMMAND_VALUE 40013
#define _APS_NEXT_CONTROL_VALUE 1099
#define _APS_NEXT_CONTROL_VALUE 1112
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ namespace winrt::PowerToys::ZoomItSettingsInterop::implementation
{ L"DrawToggleKey", SPECIAL_SEMANTICS_SHORTCUT },
{ L"RecordToggleKey", SPECIAL_SEMANTICS_SHORTCUT },
{ L"SnipToggleKey", SPECIAL_SEMANTICS_SHORTCUT },
{ L"SnipSaveToggleKey", SPECIAL_SEMANTICS_SHORTCUT },
{ L"BreakTimerKey", SPECIAL_SEMANTICS_SHORTCUT },
{ L"DemoTypeToggleKey", SPECIAL_SEMANTICS_SHORTCUT },
{ L"PenColor", SPECIAL_SEMANTICS_COLOR },
Expand Down
5 changes: 5 additions & 0 deletions src/settings-ui/Settings.UI.Library/ZoomItProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public ZoomItProperties()
[CmdConfigureIgnore]
public static HotkeySettings DefaultSnipToggleKey => new HotkeySettings(false, true, false, false, '6'); // Ctrl+6

[CmdConfigureIgnore]
public static HotkeySettings DefaultSnipSaveToggleKey => new HotkeySettings(false, true, false, true, '6'); // Ctrl+Shift+6

[CmdConfigureIgnore]
public static HotkeySettings DefaultBreakTimerKey => new HotkeySettings(false, true, false, false, '3'); // Ctrl+3

Expand All @@ -44,6 +47,8 @@ public ZoomItProperties()

public KeyboardKeysProperty SnipToggleKey { get; set; }

public KeyboardKeysProperty SnipSaveToggleKey { get; set; }

public KeyboardKeysProperty BreakTimerKey { get; set; }

public StringProperty Font { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,8 @@
IsExpanded="True">
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind ViewModel.SnipToggleKey, Mode=TwoWay}" />
<tkcontrols:SettingsExpander.Items>
<tkcontrols:SettingsCard Name="ZoomItSnipShortcutSave">
<tkcontrols:SettingsCard.Description>
<tkcontrols:MarkdownTextBlock Config="{StaticResource DescriptionTextMarkdownConfig}" Text="{x:Bind ViewModel.SnipToggleKeySave, Mode=OneWay, Converter={StaticResource HotkeySettingsToLocalizedStringConverter}, ConverterParameter=ZoomIt_Snip_Shortcut_Save}" />
</tkcontrols:SettingsCard.Description>
<tkcontrols:SettingsCard x:Uid="ZoomIt_SnipSave_Shortcut" Name="ZoomItSnipShortcutSave">
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind ViewModel.SnipToggleKeySave, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
</tkcontrols:SettingsExpander.Items>
</tkcontrols:SettingsExpander>
Expand Down
4 changes: 2 additions & 2 deletions src/settings-ui/Settings.UI/Strings/en-us/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -4736,8 +4736,8 @@ The break timer font matches the text font.</value>
<data name="ZoomIt_Snip_Shortcut.Header" xml:space="preserve">
<value>Snip activation</value>
</data>
<data name="ZoomIt_Snip_Shortcut_Save" xml:space="preserve">
<value>Press **{0}** to save the snip to a file instead of the clipboard.</value>
<data name="ZoomIt_SnipSave_Shortcut.Header" xml:space="preserve">
<value>Save snip to file</value>
</data>
<data name="Oobe_ZoomIt.Description" xml:space="preserve">
<value>ZoomIt is a screen zoom, annotation, and recording tool for technical presentations and demos. You can also use ZoomIt to snip screenshots to the clipboard or to a file.</value>
Expand Down
18 changes: 6 additions & 12 deletions src/settings-ui/Settings.UI/ViewModels/ZoomItViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,28 +342,22 @@ public HotkeySettings SnipToggleKey
{
_zoomItSettings.Properties.SnipToggleKey.Value = value ?? ZoomItProperties.DefaultSnipToggleKey;
OnPropertyChanged(nameof(SnipToggleKey));
OnPropertyChanged(nameof(SnipToggleKeySave));
NotifySettingsChanged();
}
}
}

public HotkeySettings SnipToggleKeySave
{
get
get => _zoomItSettings.Properties.SnipSaveToggleKey.Value;
set
{
var baseKey = _zoomItSettings.Properties.SnipToggleKey.Value;
if (baseKey == null)
if (_zoomItSettings.Properties.SnipSaveToggleKey.Value != value)
{
return null;
_zoomItSettings.Properties.SnipSaveToggleKey.Value = value ?? ZoomItProperties.DefaultSnipSaveToggleKey;
OnPropertyChanged(nameof(SnipToggleKeySave));
NotifySettingsChanged();
}

return new HotkeySettings(
baseKey.Win,
baseKey.Ctrl,
baseKey.Alt,
!baseKey.Shift, // Toggle Shift: if Shift is present, remove it; if absent, add it
baseKey.Code);
}
}

Expand Down