diff --git a/src/modules/powerrename/PowerRenameUILib/ExplorerItem.cpp b/src/modules/powerrename/PowerRenameUILib/ExplorerItem.cpp index 9018ff7088..7a6611cccb 100644 --- a/src/modules/powerrename/PowerRenameUILib/ExplorerItem.cpp +++ b/src/modules/powerrename/PowerRenameUILib/ExplorerItem.cpp @@ -5,7 +5,7 @@ namespace winrt::PowerRenameUILib::implementation { 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(ExplorerItemType::Folder)) { @@ -51,8 +51,8 @@ namespace winrt::PowerRenameUILib::implementation } } - uint32_t ExplorerItem::Depth() { - return m_depth; + double ExplorerItem::Indentation() { + return m_indentation; } int32_t ExplorerItem::Type() diff --git a/src/modules/powerrename/PowerRenameUILib/ExplorerItem.h b/src/modules/powerrename/PowerRenameUILib/ExplorerItem.h index fbb0832837..035ec4aca5 100644 --- a/src/modules/powerrename/PowerRenameUILib/ExplorerItem.h +++ b/src/modules/powerrename/PowerRenameUILib/ExplorerItem.h @@ -20,7 +20,7 @@ namespace winrt::PowerRenameUILib::implementation void Original(hstring const& value); hstring Renamed(); void Renamed(hstring const& value); - uint32_t Depth(); + double Indentation(); int32_t Type(); void Type(int32_t value); bool Checked(); @@ -35,7 +35,7 @@ namespace winrt::PowerRenameUILib::implementation hstring m_idStr; winrt::hstring m_original; winrt::hstring m_renamed; - uint32_t m_depth; + uint32_t m_indentation; winrt::Windows::Foundation::Collections::IObservableVector m_children; int32_t m_type; bool m_checked; diff --git a/src/modules/powerrename/PowerRenameUILib/ExplorerItem.idl b/src/modules/powerrename/PowerRenameUILib/ExplorerItem.idl index b215ad398a..38dd190d05 100644 --- a/src/modules/powerrename/PowerRenameUILib/ExplorerItem.idl +++ b/src/modules/powerrename/PowerRenameUILib/ExplorerItem.idl @@ -7,7 +7,7 @@ namespace PowerRenameUILib String IdStr { get; }; String Original; String Renamed; - UInt32 Depth { get; }; + Double Indentation { get; }; Int32 Type; Boolean Checked; Windows.Foundation.Collections.IObservableVector Children; diff --git a/src/modules/powerrename/PowerRenameUILib/MainWindow.cpp b/src/modules/powerrename/PowerRenameUILib/MainWindow.cpp index 16acf38981..afee949caf 100644 --- a/src/modules/powerrename/PowerRenameUILib/MainWindow.cpp +++ b/src/modules/powerrename/PowerRenameUILib/MainWindow.cpp @@ -206,10 +206,7 @@ namespace winrt::PowerRenameUILib::implementation void MainWindow::ToggleAll(bool checked) { - for (auto item : m_explorerItems) - { - item.Checked(checked); - } + std::for_each(m_explorerItems.begin(), m_explorerItems.end(), [checked](auto item) { item.Checked(checked); }); } 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(); auto id = std::stoi(std::wstring{ checkbox.Name() }); 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.ChangedExplorerItemId(id); diff --git a/src/modules/powerrename/PowerRenameUILib/MainWindow.xaml b/src/modules/powerrename/PowerRenameUILib/MainWindow.xaml index f0217315c1..c4c408c20f 100644 --- a/src/modules/powerrename/PowerRenameUILib/MainWindow.xaml +++ b/src/modules/powerrename/PowerRenameUILib/MainWindow.xaml @@ -13,6 +13,7 @@ + +