mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
Add identation
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
namespace winrt::PowerRenameUILib::implementation
|
namespace winrt::PowerRenameUILib::implementation
|
||||||
{
|
{
|
||||||
ExplorerItem::ExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, uint32_t depth, bool checked) :
|
ExplorerItem::ExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, uint32_t depth, bool checked) :
|
||||||
m_id{ id }, m_idStr{ std::to_wstring(id) }, m_original{ original }, m_renamed{ renamed }, m_type{ type }, m_depth{ depth }, m_checked{ checked }
|
m_id{ id }, m_idStr{ std::to_wstring(id) }, m_original{ original }, m_renamed{ renamed }, m_type{ type }, m_indentation{ depth * 20 }, m_checked{ checked }
|
||||||
{
|
{
|
||||||
if (m_type == static_cast<UINT>(ExplorerItemType::Folder))
|
if (m_type == static_cast<UINT>(ExplorerItemType::Folder))
|
||||||
{
|
{
|
||||||
@@ -51,8 +51,8 @@ namespace winrt::PowerRenameUILib::implementation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ExplorerItem::Depth() {
|
double ExplorerItem::Indentation() {
|
||||||
return m_depth;
|
return m_indentation;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ExplorerItem::Type()
|
int32_t ExplorerItem::Type()
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace winrt::PowerRenameUILib::implementation
|
|||||||
void Original(hstring const& value);
|
void Original(hstring const& value);
|
||||||
hstring Renamed();
|
hstring Renamed();
|
||||||
void Renamed(hstring const& value);
|
void Renamed(hstring const& value);
|
||||||
uint32_t Depth();
|
double Indentation();
|
||||||
int32_t Type();
|
int32_t Type();
|
||||||
void Type(int32_t value);
|
void Type(int32_t value);
|
||||||
bool Checked();
|
bool Checked();
|
||||||
@@ -35,7 +35,7 @@ namespace winrt::PowerRenameUILib::implementation
|
|||||||
hstring m_idStr;
|
hstring m_idStr;
|
||||||
winrt::hstring m_original;
|
winrt::hstring m_original;
|
||||||
winrt::hstring m_renamed;
|
winrt::hstring m_renamed;
|
||||||
uint32_t m_depth;
|
uint32_t m_indentation;
|
||||||
winrt::Windows::Foundation::Collections::IObservableVector<PowerRenameUILib::ExplorerItem> m_children;
|
winrt::Windows::Foundation::Collections::IObservableVector<PowerRenameUILib::ExplorerItem> m_children;
|
||||||
int32_t m_type;
|
int32_t m_type;
|
||||||
bool m_checked;
|
bool m_checked;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace PowerRenameUILib
|
|||||||
String IdStr { get; };
|
String IdStr { get; };
|
||||||
String Original;
|
String Original;
|
||||||
String Renamed;
|
String Renamed;
|
||||||
UInt32 Depth { get; };
|
Double Indentation { get; };
|
||||||
Int32 Type;
|
Int32 Type;
|
||||||
Boolean Checked;
|
Boolean Checked;
|
||||||
Windows.Foundation.Collections.IObservableVector<ExplorerItem> Children;
|
Windows.Foundation.Collections.IObservableVector<ExplorerItem> Children;
|
||||||
|
|||||||
@@ -206,10 +206,7 @@ namespace winrt::PowerRenameUILib::implementation
|
|||||||
|
|
||||||
void MainWindow::ToggleAll(bool checked)
|
void MainWindow::ToggleAll(bool checked)
|
||||||
{
|
{
|
||||||
for (auto item : m_explorerItems)
|
std::for_each(m_explorerItems.begin(), m_explorerItems.end(), [checked](auto item) { item.Checked(checked); });
|
||||||
{
|
|
||||||
item.Checked(checked);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Checked_ids(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const&)
|
void MainWindow::Checked_ids(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const&)
|
||||||
@@ -217,7 +214,7 @@ namespace winrt::PowerRenameUILib::implementation
|
|||||||
auto checkbox = sender.as<Windows::UI::Xaml::Controls::CheckBox>();
|
auto checkbox = sender.as<Windows::UI::Xaml::Controls::CheckBox>();
|
||||||
auto id = std::stoi(std::wstring{ checkbox.Name() });
|
auto id = std::stoi(std::wstring{ checkbox.Name() });
|
||||||
auto item = FindById(id);
|
auto item = FindById(id);
|
||||||
if (checkbox.IsChecked().GetBoolean() != item.Checked())
|
if (item != NULL && checkbox.IsChecked().GetBoolean() != item.Checked())
|
||||||
{
|
{
|
||||||
m_uiUpdatesItem.Checked(checkbox.IsChecked().GetBoolean());
|
m_uiUpdatesItem.Checked(checkbox.IsChecked().GetBoolean());
|
||||||
m_uiUpdatesItem.ChangedExplorerItemId(id);
|
m_uiUpdatesItem.ChangedExplorerItemId(id);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal" Grid.Column="0">
|
<StackPanel Orientation="Horizontal" Grid.Column="0">
|
||||||
|
<StackPanel MinWidth="{x:Bind Indentation}"/>
|
||||||
<CheckBox TabIndex="0"
|
<CheckBox TabIndex="0"
|
||||||
MinWidth="36"
|
MinWidth="36"
|
||||||
XYFocusKeyboardNavigation="Enabled"
|
XYFocusKeyboardNavigation="Enabled"
|
||||||
@@ -43,6 +44,7 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal" Grid.Column="0">
|
<StackPanel Orientation="Horizontal" Grid.Column="0">
|
||||||
|
<StackPanel MinWidth="{x:Bind Indentation}"/>
|
||||||
<CheckBox TabIndex="0"
|
<CheckBox TabIndex="0"
|
||||||
IsTabStop="True"
|
IsTabStop="True"
|
||||||
XYFocusKeyboardNavigation="Enabled"
|
XYFocusKeyboardNavigation="Enabled"
|
||||||
|
|||||||
Reference in New Issue
Block a user