Cleanup: Use "this->" to call class methods

This commit is contained in:
Hans Goudey
2024-03-07 14:45:33 -05:00
parent 7e8baea394
commit d8252cdff7
6 changed files with 30 additions and 30 deletions

View File

@@ -176,7 +176,7 @@ AssetLibrary::AssetLibrary(eAssetLibraryType library_type, StringRef name, Strin
AssetLibrary::~AssetLibrary()
{
if (on_save_callback_store_.func) {
on_blend_save_handler_unregister();
this->on_blend_save_handler_unregister();
}
}

View File

@@ -75,7 +75,7 @@ bool AllAssetLibrary::is_catalogs_dirty() const
void AllAssetLibrary::refresh_catalogs()
{
rebuild_catalogs_from_nested(/*reload_nested_catalogs=*/true);
this->rebuild_catalogs_from_nested(/*reload_nested_catalogs=*/true);
}
} // namespace blender::asset_system

View File

@@ -20,7 +20,7 @@ OnDiskAssetLibrary::OnDiskAssetLibrary(eAssetLibraryType library_type,
void OnDiskAssetLibrary::refresh_catalogs()
{
catalog_service().reload_catalogs();
this->catalog_service().reload_catalogs();
}
} // namespace blender::asset_system

View File

@@ -54,7 +54,7 @@ void AbstractView::update_from_old(uiBlock &new_block)
rename_buffer_ = std::move(old_view.rename_buffer_);
old_view.rename_buffer_ = nullptr;
update_children_from_old(old_view);
this->update_children_from_old(old_view);
/* Finished (re-)constructing the tree. */
is_reconstructed_ = true;
@@ -69,7 +69,7 @@ void AbstractView::update_from_old(uiBlock &new_block)
void AbstractView::change_state_delayed()
{
BLI_assert_msg(
is_reconstructed(),
this->is_reconstructed(),
"These state changes are supposed to be delayed until reconstruction is completed");
/* Debug-only sanity check: Ensure only one item requests to be active. */
@@ -85,7 +85,7 @@ void AbstractView::change_state_delayed()
});
#endif
foreach_view_item([](AbstractViewItem &item) { item.change_state_delayed(); });
this->foreach_view_item([](AbstractViewItem &item) { item.change_state_delayed(); });
}
/** \} */
@@ -129,7 +129,7 @@ bool AbstractView::is_renaming() const
bool AbstractView::begin_renaming()
{
if (is_renaming()) {
if (this->is_renaming()) {
return false;
}

View File

@@ -79,7 +79,7 @@ void AbstractGridView::update_children_from_old(const AbstractView &old_view)
{
const AbstractGridView &old_grid_view = dynamic_cast<const AbstractGridView &>(old_view);
foreach_item([this, &old_grid_view](AbstractGridViewItem &new_item) {
this->foreach_item([this, &old_grid_view](AbstractGridViewItem &new_item) {
const AbstractGridViewItem *matching_old_item = find_matching_item(new_item, old_grid_view);
if (!matching_old_item) {
return;

View File

@@ -88,18 +88,18 @@ void TreeViewItemContainer::foreach_item_recursive(ItemIterFn iter_fn, IterOptio
/* Implementation for the base class virtual function. More specialized iterators below. */
void AbstractTreeView::foreach_view_item(FunctionRef<void(AbstractViewItem &)> iter_fn) const
{
foreach_item_recursive(iter_fn);
this->foreach_item_recursive(iter_fn);
}
void AbstractTreeView::foreach_item(ItemIterFn iter_fn, IterOptions options) const
{
foreach_item_recursive(iter_fn, options);
this->foreach_item_recursive(iter_fn, options);
}
AbstractTreeViewItem *AbstractTreeView::find_hovered(const ARegion &region, const int2 &xy)
{
AbstractTreeViewItem *hovered_item = nullptr;
foreach_item_recursive(
this->foreach_item_recursive(
[&](AbstractTreeViewItem &item) {
if (hovered_item) {
return;
@@ -145,7 +145,7 @@ void AbstractTreeView::draw_hierarchy_lines_recursive(const ARegion &region,
continue;
}
draw_hierarchy_lines_recursive(region, *item, pos, aspect);
this->draw_hierarchy_lines_recursive(region, *item, pos, aspect);
const AbstractTreeViewItem *first_descendant = item->children_.first().get();
const AbstractTreeViewItem *last_descendant = find_last_visible_descendant(*item);
@@ -198,14 +198,14 @@ void AbstractTreeView::draw_hierarchy_lines(const ARegion &region) const
void AbstractTreeView::draw_overlays(const ARegion &region) const
{
draw_hierarchy_lines(region);
this->draw_hierarchy_lines(region);
}
void AbstractTreeView::update_children_from_old(const AbstractView &old_view)
{
const AbstractTreeView &old_tree_view = dynamic_cast<const AbstractTreeView &>(old_view);
update_children_from_old_recursive(*this, old_tree_view);
this->update_children_from_old_recursive(*this, old_tree_view);
}
void AbstractTreeView::update_children_from_old_recursive(const TreeViewOrItem &new_items,
@@ -310,7 +310,7 @@ void AbstractTreeViewItem::add_treerow_button(uiBlock &block)
int AbstractTreeViewItem::indent_width() const
{
return count_parents() * UI_TREEVIEW_INDENT;
return this->count_parents() * UI_TREEVIEW_INDENT;
}
void AbstractTreeViewItem::add_indent(uiLayout &row) const
@@ -319,11 +319,11 @@ void AbstractTreeViewItem::add_indent(uiLayout &row) const
uiLayout *subrow = uiLayoutRow(&row, true);
uiLayoutSetFixedSize(subrow, true);
uiDefBut(block, UI_BTYPE_SEPR, 0, "", 0, 0, indent_width(), 0, nullptr, 0.0, 0.0, "");
uiDefBut(block, UI_BTYPE_SEPR, 0, "", 0, 0, this->indent_width(), 0, nullptr, 0.0, 0.0, "");
/* Indent items without collapsing icon some more within their parent. Makes it clear that they
* are actually nested and not just a row at the same level without a chevron. */
if (!is_collapsible()) {
if (!this->is_collapsible()) {
uiDefBut(block, UI_BTYPE_SEPR, 0, "", 0, 0, UI_TREEVIEW_INDENT, 0, nullptr, 0.0, 0.0, "");
}
@@ -357,11 +357,11 @@ void AbstractTreeViewItem::collapse_chevron_click_fn(bContext *C,
void AbstractTreeViewItem::add_collapse_chevron(uiBlock &block) const
{
if (!is_collapsible()) {
if (!this->is_collapsible()) {
return;
}
const BIFIconID icon = is_collapsed() ? ICON_RIGHTARROW : ICON_DOWNARROW_HLT;
const BIFIconID icon = this->is_collapsed() ? ICON_RIGHTARROW : ICON_DOWNARROW_HLT;
uiBut *but = uiDefIconBut(&block,
UI_BTYPE_BUT_TOGGLE,
0,
@@ -438,7 +438,7 @@ bool AbstractTreeViewItem::matches_single(const AbstractTreeViewItem &other) con
std::unique_ptr<DropTargetInterface> AbstractTreeViewItem::create_item_drop_target()
{
return create_drop_target();
return this->create_drop_target();
}
std::unique_ptr<TreeViewItemDropTarget> AbstractTreeViewItem::create_drop_target()
@@ -503,17 +503,17 @@ bool AbstractTreeViewItem::is_collapsed() const
{
BLI_assert_msg(get_tree_view().is_reconstructed(),
"State can't be queried until reconstruction is completed");
return is_collapsible() && !is_open_;
return this->is_collapsible() && !is_open_;
}
bool AbstractTreeViewItem::toggle_collapsed()
{
return set_collapsed(is_open_);
return this->set_collapsed(is_open_);
}
bool AbstractTreeViewItem::set_collapsed(const bool collapsed)
{
if (!is_collapsible()) {
if (!this->is_collapsible()) {
return false;
}
if (collapsed == !is_open_) {
@@ -546,8 +546,8 @@ std::optional<bool> AbstractTreeViewItem::should_be_collapsed() const
void AbstractTreeViewItem::toggle_collapsed_from_view(bContext &C)
{
if (toggle_collapsed()) {
on_collapse_change(C, is_collapsed());
if (this->toggle_collapsed()) {
this->on_collapse_change(C, this->is_collapsed());
}
}
@@ -559,7 +559,7 @@ void AbstractTreeViewItem::change_state_delayed()
if (should_be_collapsed.has_value()) {
/* This reflects an external state change and therefore shouldn't call #on_collapse_change().
*/
set_collapsed(*should_be_collapsed);
this->set_collapsed(*should_be_collapsed);
}
}
@@ -574,10 +574,10 @@ bool AbstractTreeViewItem::matches(const AbstractViewItem &other) const
{
const AbstractTreeViewItem &other_tree_item = dynamic_cast<const AbstractTreeViewItem &>(other);
if (!matches_single(other_tree_item)) {
if (!this->matches_single(other_tree_item)) {
return false;
}
if (count_parents() != other_tree_item.count_parents()) {
if (this->count_parents() != other_tree_item.count_parents()) {
return false;
}
@@ -618,7 +618,7 @@ TreeViewLayoutBuilder::TreeViewLayoutBuilder(uiLayout &layout) : block_(*uiLayou
void TreeViewLayoutBuilder::build_from_tree(const AbstractTreeView &tree_view)
{
uiLayout &parent_layout = current_layout();
uiLayout &parent_layout = this->current_layout();
uiLayout *box = uiLayoutBox(&parent_layout);
uiLayoutColumn(box, true);
@@ -724,7 +724,7 @@ BasicTreeViewItem::BasicTreeViewItem(StringRef label, BIFIconID icon_) : icon(ic
void BasicTreeViewItem::build_row(uiLayout &row)
{
add_label(row);
this->add_label(row);
}
void BasicTreeViewItem::add_label(uiLayout &layout, StringRefNull label_override)