Skip to content

Commit

Permalink
Add updates to the project from dev/migrie/oop/the-whole-thing
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjii-msft committed May 10, 2021
1 parent 07c731d commit 71d445b
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 2 deletions.
1 change: 1 addition & 0 deletions samples/ScratchIslandApp/Package/Package.wapproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<Import Project="$(OpenConsoleDir)src\wap-common.build.post.props" />
<ItemGroup>
<ProjectReference Include="..\WindowExe\WindowExe.vcxproj" />
<!-- <ProjectReference Include="$(OpenConsoleDir)src\cascadia\WindowsTerminal\WindowsTerminal.vcxproj" /> -->
</ItemGroup>

<ItemGroup>
Expand Down
11 changes: 11 additions & 0 deletions samples/ScratchIslandApp/SampleApp/MySettings.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

#include "pch.h"

#include "MySettings.h"
#include "MySettings.g.cpp"

namespace winrt::SampleApp::implementation
{
}
96 changes: 96 additions & 0 deletions samples/ScratchIslandApp/SampleApp/MySettings.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
--*/
#pragma once
#include "../../inc/cppwinrt_utils.h"
// #include "../../src/inc/cppwinrt_utils.h"
#include <DefaultSettings.h>
#include <conattrs.hpp>
#include "MySettings.g.h"

namespace winrt::SampleApp::implementation
{
struct MySettings : MySettingsT<MySettings>
{
public:
MySettings() = default;

// --------------------------- Core Settings ---------------------------
// All of these settings are defined in ICoreSettings.

WINRT_PROPERTY(til::color, DefaultForeground, DEFAULT_FOREGROUND);
WINRT_PROPERTY(til::color, DefaultBackground, DEFAULT_BACKGROUND);
WINRT_PROPERTY(til::color, SelectionBackground, DEFAULT_FOREGROUND);
WINRT_PROPERTY(int32_t, HistorySize, DEFAULT_HISTORY_SIZE);
WINRT_PROPERTY(int32_t, InitialRows, 30);
WINRT_PROPERTY(int32_t, InitialCols, 80);

WINRT_PROPERTY(bool, SnapOnInput, true);
WINRT_PROPERTY(bool, AltGrAliasing, true);
WINRT_PROPERTY(til::color, CursorColor, DEFAULT_CURSOR_COLOR);
WINRT_PROPERTY(winrt::Microsoft::Terminal::Core::CursorStyle, CursorShape, winrt::Microsoft::Terminal::Core::CursorStyle::Vintage);
WINRT_PROPERTY(uint32_t, CursorHeight, DEFAULT_CURSOR_HEIGHT);
WINRT_PROPERTY(winrt::hstring, WordDelimiters, DEFAULT_WORD_DELIMITERS);
WINRT_PROPERTY(bool, CopyOnSelect, false);
WINRT_PROPERTY(bool, InputServiceWarning, true);
WINRT_PROPERTY(bool, FocusFollowMouse, false);

WINRT_PROPERTY(winrt::Windows::Foundation::IReference<winrt::Microsoft::Terminal::Core::Color>, TabColor, nullptr);

WINRT_PROPERTY(winrt::Windows::Foundation::IReference<winrt::Microsoft::Terminal::Core::Color>, StartingTabColor, nullptr);

winrt::Microsoft::Terminal::Core::ICoreAppearance UnfocusedAppearance() { return {}; };

WINRT_PROPERTY(bool, TrimBlockSelection, false);
// ------------------------ End of Core Settings -----------------------

WINRT_PROPERTY(winrt::hstring, ProfileName);
WINRT_PROPERTY(bool, UseAcrylic, false);
WINRT_PROPERTY(double, TintOpacity, 0.5);
WINRT_PROPERTY(winrt::hstring, Padding, DEFAULT_PADDING);
WINRT_PROPERTY(winrt::hstring, FontFace, L"Consolas");
WINRT_PROPERTY(int32_t, FontSize, DEFAULT_FONT_SIZE);

WINRT_PROPERTY(winrt::Windows::UI::Text::FontWeight, FontWeight);

WINRT_PROPERTY(winrt::hstring, BackgroundImage);
WINRT_PROPERTY(double, BackgroundImageOpacity, 1.0);

WINRT_PROPERTY(winrt::Windows::UI::Xaml::Media::Stretch, BackgroundImageStretchMode, winrt::Windows::UI::Xaml::Media::Stretch::UniformToFill);
WINRT_PROPERTY(winrt::Windows::UI::Xaml::HorizontalAlignment, BackgroundImageHorizontalAlignment, winrt::Windows::UI::Xaml::HorizontalAlignment::Center);
WINRT_PROPERTY(winrt::Windows::UI::Xaml::VerticalAlignment, BackgroundImageVerticalAlignment, winrt::Windows::UI::Xaml::VerticalAlignment::Center);

WINRT_PROPERTY(winrt::Microsoft::Terminal::Control::IKeyBindings, KeyBindings, nullptr);

WINRT_PROPERTY(winrt::hstring, Commandline);
WINRT_PROPERTY(winrt::hstring, StartingDirectory);
WINRT_PROPERTY(winrt::hstring, StartingTitle);
WINRT_PROPERTY(bool, SuppressApplicationTitle);
WINRT_PROPERTY(winrt::hstring, EnvironmentVariables);

WINRT_PROPERTY(winrt::Microsoft::Terminal::Control::ScrollbarState, ScrollState, winrt::Microsoft::Terminal::Control::ScrollbarState::Visible);

WINRT_PROPERTY(winrt::Microsoft::Terminal::Control::TextAntialiasingMode, AntialiasingMode, winrt::Microsoft::Terminal::Control::TextAntialiasingMode::Grayscale);

WINRT_PROPERTY(bool, RetroTerminalEffect, false);
WINRT_PROPERTY(bool, ForceFullRepaintRendering, false);
WINRT_PROPERTY(bool, SoftwareRendering, false);
WINRT_PROPERTY(bool, ForceVTInput, false);

WINRT_PROPERTY(winrt::hstring, PixelShaderPath);

private:
std::array<winrt::Microsoft::Terminal::Core::Color, COLOR_TABLE_SIZE> _ColorTable;

public:
winrt::Microsoft::Terminal::Core::Color GetColorTableEntry(int32_t index) noexcept { return _ColorTable.at(index); }
std::array<winrt::Microsoft::Terminal::Core::Color, 16> ColorTable() { return _ColorTable; }
void ColorTable(std::array<winrt::Microsoft::Terminal::Core::Color, 16> /*colors*/) {}
};
}

namespace winrt::SampleApp::factory_implementation
{
BASIC_FACTORY(MySettings);
}
14 changes: 14 additions & 0 deletions samples/ScratchIslandApp/SampleApp/MySettings.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

namespace SampleApp
{
[default_interface] runtimeclass MySettings : Microsoft.Terminal.Core.ICoreSettings,
Microsoft.Terminal.Control.IControlSettings,
Microsoft.Terminal.Core.ICoreAppearance,
Microsoft.Terminal.Control.IControlAppearance

{
MySettings();
}
}
7 changes: 6 additions & 1 deletion samples/ScratchIslandApp/SampleApp/SampleAppLib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<!-- ========================= Headers ======================== -->
<ItemGroup>
<ClInclude Include="App.base.h" />
<ClInclude Include="MySettings.h" />
<ClInclude Include="MyPage.h">
<DependentUpon>MyPage.xaml</DependentUpon>
<SubType>Code</SubType>
Expand All @@ -63,6 +64,7 @@
<!-- ========================= Cpp Files ======================== -->
<ItemGroup>
<ClCompile Include="init.cpp" />
<ClCompile Include="MySettings.cpp" />
<ClCompile Include="MyPage.cpp">
<DependentUpon>MyPage.xaml</DependentUpon>
<SubType>Code</SubType>
Expand All @@ -87,6 +89,7 @@
<DependentUpon>App.xaml</DependentUpon>
</Midl>
<Midl Include="SampleAppLogic.idl" />
<Midl Include="MySettings.idl" />
<Midl Include="MyPage.idl">
<DependentUpon>MyPage.xaml</DependentUpon>
<SubType>Code</SubType>
Expand All @@ -105,7 +108,9 @@
make sure that if you add a cppwinrt dependency to any of these projects,
you also update all the consumers
-->
<!-- <ProjectReference Include="$(OpenConsoleDir)src\types\lib\types.vcxproj" /> -->
<ProjectReference Include="$(OpenConsoleDir)src\types\lib\types.vcxproj">
<Project>{18D09A24-8240-42D6-8CB6-236EEE820263}</Project>
</ProjectReference>
<!-- <ProjectReference Include="$(OpenConsoleDir)src\cascadia\WinRTUtils\WinRTUtils.vcxproj">
<Project>{CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
Expand Down
14 changes: 13 additions & 1 deletion samples/ScratchIslandApp/SampleApp/dll/SampleApp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<!-- ========================= Project References ======================== -->
<ItemGroup>

<!-- <ProjectReference Include="$(OpenConsoleDir)src\types\lib\types.vcxproj">
<!-- <ProjectReference Include="$(OpenConsoleDir)src\types\lib\types.vcxproj">
<Project>{18D09A24-8240-42D6-8CB6-236EEE820263}</Project>
</ProjectReference> -->
<!-- Reference SampleAppLib here, so we can use it's App.winmd as
Expand All @@ -65,6 +65,18 @@
<Private>false</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
</Reference>
<Reference Include="Microsoft.Terminal.TerminalConnection">
<HintPath>$(OpenConsoleCommonOutDir)TerminalConnection\Microsoft.Terminal.TerminalConnection.winmd</HintPath>
<IsWinMDFile>true</IsWinMDFile>
<Private>false</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
</Reference>
<Reference Include="Microsoft.Terminal.Control">
<HintPath>$(OpenConsoleCommonOutDir)Microsoft.Terminal.Control\Microsoft.Terminal.Control.winmd</HintPath>
<IsWinMDFile>true</IsWinMDFile>
<Private>false</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
</Reference>
</ItemGroup>


Expand Down
11 changes: 11 additions & 0 deletions samples/ScratchIslandApp/WindowExe/WindowExe.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,17 @@
</PackagingOutputs>
</ItemGroup>
<!-- **END TERMINALCONNECTION HACK** -->

<!-- Same thing again here, with windowsterminal.exe -->
<ItemGroup>
<_WindowsTerminalExe Include="$(OpenConsoleCommonOutDir)\WindowsTerminal\*.exe" />

<PackagingOutputs Include="@(_WindowsTerminalExe)">
<ProjectName>$(ProjectName)</ProjectName>
<OutputGroup>BuiltProjectOutputGroup</OutputGroup>
<TargetPath>%(Filename)%(Extension)</TargetPath>
</PackagingOutputs>
</ItemGroup>
</Target>


Expand Down

1 comment on commit 71d445b

@github-actions

This comment was marked as resolved.

Please sign in to comment.