Skip to content

Commit

Permalink
sHoUlDn't bE ToO DiFfIcUlT
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjii-msft committed Jan 14, 2021
1 parent 608ef13 commit bfaafcb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
11 changes: 10 additions & 1 deletion src/cascadia/TerminalSettingsEditor/Profiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
PropertyChanged([this](auto&&, const Data::PropertyChangedEventArgs& args) {
if (args.PropertyName() == L"BackgroundImagePath")
{
_NotifyChanges(L"UseDesktopBGImage");
_NotifyChanges(L"UseDesktopBGImage", L"BackgroundImageSettingsVisible");
}
else if (args.PropertyName() == L"IsBaseLayer")
{
_NotifyChanges(L"BackgroundImageSettingsVisible");
}
});

Expand Down Expand Up @@ -105,6 +109,11 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
}
}

bool ProfileViewModel::BackgroundImageSettingsVisible()
{
return IsBaseLayer() || BackgroundImagePath() != L"";
}

void ProfilePageNavigationState::DeleteProfile()
{
auto deleteProfileArgs{ winrt::make_self<DeleteProfileEventArgs>(_Profile.Guid()) };
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalSettingsEditor/Profiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation

bool UseDesktopBGImage();
void UseDesktopBGImage(const bool useDesktop);
bool BackgroundImageSettingsVisible();

GETSET_PROPERTY(bool, IsBaseLayer, false);

Expand Down
3 changes: 2 additions & 1 deletion src/cascadia/TerminalSettingsEditor/Profiles.idl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ namespace Microsoft.Terminal.Settings.Editor
{
Boolean CanDeleteProfile { get; };
Boolean IsBaseLayer;
Boolean UseDesktopBGImage { get; set; };
Boolean UseDesktopBGImage;
Boolean BackgroundImageSettingsVisible { get; };

OBSERVABLE_PROJECTED_SETTING(String, Name);
OBSERVABLE_PROJECTED_SETTING(Guid, Guid);
Expand Down
6 changes: 3 additions & 3 deletions src/cascadia/TerminalSettingsEditor/Profiles.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ the MIT License. See LICENSE in the project root for license information. -->

<!--Background Image Stretch Mode-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Visibility="{x:Bind State.Profile.BackgroundImagePath, Mode=OneWay, Converter={StaticResource StringIsEmptyConverter}}">
Visibility="{x:Bind State.Profile.BackgroundImageSettingsVisible, Mode=OneWay}">
<muxc:RadioButtons x:Uid="Profile_BackgroundImageStretchMode"
ItemsSource="{x:Bind BackgroundImageStretchModeList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentBackgroundImageStretchMode, Mode=TwoWay}"
Expand All @@ -321,7 +321,7 @@ the MIT License. See LICENSE in the project root for license information. -->

<!--Background Image Alignment-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Visibility="{x:Bind State.Profile.BackgroundImagePath, Mode=OneWay, Converter={StaticResource StringIsEmptyConverter}}">
Visibility="{x:Bind State.Profile.BackgroundImageSettingsVisible, Mode=OneWay}">
<StackPanel HorizontalAlignment="Left">
<TextBlock x:Uid="Profile_BackgroundImageAlignment"
Style="{StaticResource CustomSettingHeaderStyle}"
Expand Down Expand Up @@ -478,7 +478,7 @@ the MIT License. See LICENSE in the project root for license information. -->

<!--Background Image Opacity-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Visibility="{x:Bind State.Profile.BackgroundImagePath, Mode=OneWay, Converter={StaticResource StringIsEmptyConverter}}">
Visibility="{x:Bind State.Profile.BackgroundImageSettingsVisible, Mode=OneWay}">
<StackPanel>
<TextBlock x:Uid="Profile_BackgroundImageOpacity"
Style="{StaticResource SliderHeaderStyle}"/>
Expand Down

1 comment on commit bfaafcb

@github-actions

This comment was marked as outdated.

Please sign in to comment.