mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-30 00:46:20 +01:00
Compare commits
3 Commits
stable
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d98056db3 | ||
|
|
2a275ac1cb | ||
|
|
406faa4f0d |
@@ -89,6 +89,11 @@ public:
|
||||
*cmdState = ECS_HIDDEN;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Hide MSIX handler to prevent duplicate context menu entries
|
||||
// The traditional handler provides the context menu functionality
|
||||
*cmdState = ECS_HIDDEN;
|
||||
return S_OK;
|
||||
// Hide if the file is not an image
|
||||
*cmdState = ECS_HIDDEN;
|
||||
// Suppressing C26812 warning as the issue is in the shtypes.h library
|
||||
|
||||
@@ -63,6 +63,7 @@ CSettings::CSettings()
|
||||
void CSettings::Save()
|
||||
{
|
||||
json::JsonObject jsonData;
|
||||
jsonData.SetNamedValue(L"extendedContextMenuOnly", json::value(settings.extendedContextMenuOnly));
|
||||
|
||||
json::to_file(jsonFilePath, jsonData);
|
||||
GetSystemTimeAsFileTime(&lastLoadedTime);
|
||||
@@ -133,6 +134,7 @@ void CSettings::ParseJson()
|
||||
try
|
||||
{
|
||||
// NB: add any new settings here
|
||||
json::get(jsonSettings, L"extendedContextMenuOnly", settings.extendedContextMenuOnly, false);
|
||||
}
|
||||
catch (const winrt::hresult_error&)
|
||||
{
|
||||
|
||||
@@ -19,6 +19,16 @@ public:
|
||||
return settings.enabled;
|
||||
}
|
||||
|
||||
inline bool GetExtendedContextMenuOnly() const
|
||||
{
|
||||
return settings.extendedContextMenuOnly;
|
||||
}
|
||||
|
||||
inline void SetExtendedContextMenuOnly(bool extendedOnly)
|
||||
{
|
||||
settings.extendedContextMenuOnly = extendedOnly;
|
||||
}
|
||||
|
||||
void Save();
|
||||
void Load();
|
||||
|
||||
@@ -26,6 +36,7 @@ private:
|
||||
struct Settings
|
||||
{
|
||||
bool enabled{ true };
|
||||
bool extendedContextMenuOnly{ false }; // Disabled by default.
|
||||
};
|
||||
|
||||
void RefreshEnabledState();
|
||||
|
||||
@@ -70,6 +70,10 @@ HRESULT CContextMenuHandler::QueryContextMenu(_In_ HMENU hmenu, UINT indexMenu,
|
||||
if (!CSettingsInstance().GetEnabled())
|
||||
return E_FAIL;
|
||||
|
||||
// Check if we should only be on the extended context menu
|
||||
if (CSettingsInstance().GetExtendedContextMenuOnly() && (!(uFlags & CMF_EXTENDEDVERBS)))
|
||||
return E_FAIL;
|
||||
|
||||
// NB: We just check the first item. We could iterate through more if the first one doesn't meet the criteria
|
||||
HDropIterator i(m_pdtobj);
|
||||
i.First();
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
ImageresizerKeepDateModified = new BoolProperty();
|
||||
ImageresizerFallbackEncoder = new StringProperty(new System.Guid("19e4a5aa-5662-4fc5-a0c0-1758028e1057").ToString());
|
||||
ImageresizerCustomSize = new ImageResizerCustomSizeProperty(new ImageSize(4, "custom", ResizeFit.Fit, 1024, 640, ResizeUnit.Pixel));
|
||||
ImageresizerExtendedContextMenuOnly = new BoolProperty(false);
|
||||
}
|
||||
|
||||
public ImageResizerProperties(Func<string, string> resourceLoader)
|
||||
@@ -84,6 +85,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
[CmdConfigureIgnoreAttribute]
|
||||
public ImageResizerCustomSizeProperty ImageresizerCustomSize { get; set; }
|
||||
|
||||
[JsonPropertyName("imageresizer_extendedContextMenuOnly")]
|
||||
public BoolProperty ImageresizerExtendedContextMenuOnly { get; set; }
|
||||
|
||||
public string ToJsonString()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
|
||||
@@ -48,6 +48,21 @@
|
||||
</InfoBar.IconSource>
|
||||
</InfoBar>
|
||||
|
||||
<controls:SettingsGroup x:Uid="ImageResizer_ShellIntegration" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsExpander x:Uid="ImageResizer_Toggle_ContextMenu" IsExpanded="False">
|
||||
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind ViewModel.ExtendedContextMenuOnly, Mode=TwoWay, Converter={StaticResource BoolToComboBoxIndexConverter}}">
|
||||
<ComboBoxItem x:Uid="ImageResizer_Toggle_StandardContextMenu" />
|
||||
<ComboBoxItem x:Uid="ImageResizer_Toggle_ExtendedContextMenu" />
|
||||
</ComboBox>
|
||||
</tkcontrols:SettingsExpander>
|
||||
<InfoBar
|
||||
x:Uid="ExtendedContextMenuInfo"
|
||||
IsClosable="False"
|
||||
IsOpen="True"
|
||||
IsTabStop="False"
|
||||
Severity="Informational" />
|
||||
</controls:SettingsGroup>
|
||||
|
||||
<controls:SettingsGroup x:Uid="ImageResizer_CustomSizes" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsCard x:Uid="ImageResizer_Presets" HeaderIcon="{ui:FontIcon Glyph=}">
|
||||
<Button
|
||||
|
||||
@@ -1406,6 +1406,18 @@
|
||||
<data name="ImageResizer_UseResizeDate.Content" xml:space="preserve">
|
||||
<value>Timestamp of resize action</value>
|
||||
</data>
|
||||
<data name="ImageResizer_ShellIntegration.Header" xml:space="preserve">
|
||||
<value>Shell integration</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Toggle_ContextMenu.Header" xml:space="preserve">
|
||||
<value>Show Image Resizer in</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Toggle_StandardContextMenu.Content" xml:space="preserve">
|
||||
<value>Default and extended context menu</value>
|
||||
</data>
|
||||
<data name="ImageResizer_Toggle_ExtendedContextMenu.Content" xml:space="preserve">
|
||||
<value>Extended context menu only</value>
|
||||
</data>
|
||||
<data name="Encoding.Header" xml:space="preserve">
|
||||
<value>Encoding</value>
|
||||
</data>
|
||||
|
||||
@@ -94,6 +94,7 @@ public partial class ImageResizerViewModel : Observable
|
||||
FileName = Settings.Properties.ImageresizerFileName.Value;
|
||||
KeepDateModified = Settings.Properties.ImageresizerKeepDateModified.Value;
|
||||
Encoder = GetEncoderIndex(Settings.Properties.ImageresizerFallbackEncoder.Value);
|
||||
ExtendedContextMenuOnly = Settings.Properties.ImageresizerExtendedContextMenuOnly.Value;
|
||||
|
||||
_customSize = Settings.Properties.ImageresizerCustomSize.Value;
|
||||
|
||||
@@ -125,6 +126,7 @@ public partial class ImageResizerViewModel : Observable
|
||||
private string _fileName;
|
||||
private bool _keepDateModified;
|
||||
private int _encoderGuidId;
|
||||
private bool _extendedContextMenuOnly;
|
||||
|
||||
public bool IsListViewFocusRequested { get; set; }
|
||||
|
||||
@@ -285,6 +287,16 @@ public partial class ImageResizerViewModel : Observable
|
||||
}
|
||||
}
|
||||
|
||||
public bool ExtendedContextMenuOnly
|
||||
{
|
||||
get => _extendedContextMenuOnly;
|
||||
|
||||
set
|
||||
{
|
||||
SetProperty(ref _extendedContextMenuOnly, value, v => Settings.Properties.ImageresizerExtendedContextMenuOnly.Value = v);
|
||||
}
|
||||
}
|
||||
|
||||
public int Encoder
|
||||
{
|
||||
get => _encoderGuidId;
|
||||
|
||||
Reference in New Issue
Block a user