From f35f9cb4b8d0385ed37f5f849f2c8dc9bb959622 Mon Sep 17 00:00:00 2001 From: shweet Date: Sun, 22 Nov 2026 19:35:33 -0500 Subject: [PATCH] Build cleanly under clang, and name the remaining booleans with is Exported XML templates lose the static clang rejects. Unused this captures, a dead null check, an undefined declaration, an unused constant and stray semicolons go, and single statements lose their braces. --- src/math_util.cpp | 2 +- src/model/json.cpp | 6 +++--- src/model/xml.cpp | 5 ++--- src/render.h | 1 - src/resources.cpp | 2 +- src/settings.cpp | 4 ---- src/ui/animation_preview.cpp | 8 ++++---- src/ui/animation_preview.h | 2 +- src/ui/canvas_view.cpp | 8 ++++---- src/ui/canvas_view.h | 2 +- src/ui/documents.cpp | 6 +++--- src/ui/multiselect.cpp | 12 ++++++------ src/ui/multiselect.h | 1 - src/ui/spritesheet_editor.cpp | 18 ++++++------------ src/ui/taskbar.cpp | 4 ++-- src/ui/timeline.cpp | 2 +- src/ui/timeline_context.h | 2 +- src/ui/timeline_edit.cpp | 10 +++++----- src/ui/timeline_frames.cpp | 4 ++-- src/ui/timeline_menus.cpp | 28 ++++++++++++++-------------- src/ui/timeline_tracks.cpp | 4 ++-- 21 files changed, 59 insertions(+), 72 deletions(-) diff --git a/src/math_util.cpp b/src/math_util.cpp index a922f67..c35ee3c 100644 --- a/src/math_util.cpp +++ b/src/math_util.cpp @@ -84,7 +84,7 @@ Mat4 quad_model_parent_get(Vec2 position, Vec2 pivot, Vec2 scale, float rotation float random_unit_get() { - return (float)rand() / RAND_MAX; + return (float)rand() / (float)RAND_MAX; } float random_in_range(float min, float max) diff --git a/src/model/json.cpp b/src/model/json.cpp index 48b5c1e..6660d1b 100644 --- a/src/model/json.cpp +++ b/src/model/json.cpp @@ -308,10 +308,10 @@ struct JsonWriter // Each returns what it expected when the value is the wrong kind (and leaves the value as it was). static std::string_view value_read(dom::element element, bool& value) { - bool read = false; - if (element.get(read)) + bool isTrue = false; + if (element.get(isTrue)) return "true or false"; - value = read; + value = isTrue; return {}; } diff --git a/src/model/xml.cpp b/src/model/xml.cpp index 535344b..d8893b5 100644 --- a/src/model/xml.cpp +++ b/src/model/xml.cpp @@ -56,7 +56,6 @@ constexpr std::size_t VALUE_BUFFER_SIZE = 64; constexpr int FLOAT_DIGITS = 8; constexpr int DOUBLE_DIGITS = 17; constexpr double FLOAT_WHOLE_MAX = 1e8; -constexpr std::size_t FRAME_ATTRIBUTES_MAX = 27; constexpr std::string_view INDENT = " "; constexpr int TEXT_ENTITY_COUNT = 3; constexpr std::pair ENTITIES[] = { @@ -1914,12 +1913,12 @@ std::vector animations_from_string(const std::string& text, std: return entries; } -template static std::string item_to_string(const Item& item) +template std::string item_to_string(const Item& item) { return text_get([&](Sink& sink) { element_write(sink, Writer(SAVE_CLIPBOARD), item, item.id); }); } -template static std::vector items_from_string(const std::string& text, std::string* errorString) +template std::vector items_from_string(const std::string& text, std::string* errorString) { pugi::xml_document document; if (!document_parse(document, text, errorString)) diff --git a/src/render.h b/src/render.h index 2ea313e..50f698d 100644 --- a/src/render.h +++ b/src/render.h @@ -185,6 +185,5 @@ private: bool animation_record(const RecorderOptions&, Canvas&, ShaderProgram&, Document&, const Animation&, Vec4, float, Vec4, bool); -std::filesystem::path ffmpeg_log_path(); bool animation_render(const std::filesystem::path&, const std::filesystem::path&, const std::vector&, const std::vector&, RenderType, int); diff --git a/src/resources.cpp b/src/resources.cpp index adcd866..90bbd01 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -67,7 +67,7 @@ Resources::Resources() for (auto [i, shaderInfo] : std::views::enumerate(SHADERS)) shaders[i] = ShaderProgram(shaderInfo.vertex, shaderInfo.fragment); -}; +} GLuint Resources::icon_id_get(int icon) { diff --git a/src/settings.cpp b/src/settings.cpp index 90ef05f..5a3ea01 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -211,9 +211,7 @@ Settings::Settings(const std::filesystem::path& path) dest = (val == "true" || val == "1"); } else if constexpr (std::is_same_v) - { std::getline(ss, dest); - } else if constexpr (std::is_same_v) { std::string value; @@ -221,9 +219,7 @@ Settings::Settings(const std::filesystem::path& path) dest = path_from_utf8(value); } else - { stream_assign(dest, ss); - } }; auto entry_load = [&](const std::string& key, std::istringstream& ss, const std::string& name, auto& value, diff --git a/src/ui/animation_preview.cpp b/src/ui/animation_preview.cpp index 6d201d7..8eba1a1 100644 --- a/src/ui/animation_preview.cpp +++ b/src/ui/animation_preview.cpp @@ -143,7 +143,7 @@ void AnimationPreview::tick(Manager& manager, Settings& settings, float deltaSec recording_stop(manager, document); } stop_all_sounds(); - wasPlaybackPlaying = false; + isPlaybackPlayingBefore = false; return; } @@ -161,7 +161,7 @@ void AnimationPreview::tick(Manager& manager, Settings& settings, float deltaSec { auto fps = std::max(model.info.fps, 1); auto range = animation_play_range_get(*animation); - if (!wasPlaybackPlaying) + if (!isPlaybackPlayingBefore) soundFrame = (int)std::floor(playback.time) - 1; auto isLoop = (animation->isLoop || settings.playbackIsLoop) && !manager.isRecording; playback.tick(fps, range.x, range.y, isLoop ? PLAYBACK_LOOP : PLAYBACK_ONCE, deltaSeconds); @@ -181,9 +181,9 @@ void AnimationPreview::tick(Manager& manager, Settings& settings, float deltaSec } } - if (wasPlaybackPlaying && !playback.isPlaying) + if (isPlaybackPlayingBefore && !playback.isPlaying) stop_all_sounds(); - wasPlaybackPlaying = playback.isPlaying; + isPlaybackPlayingBefore = playback.isPlaying; } void AnimationPreview::recording_stop(Manager& manager, Document& document) diff --git a/src/ui/animation_preview.h b/src/ui/animation_preview.h index ebfcc1a..fedb547 100644 --- a/src/ui/animation_preview.h +++ b/src/ui/animation_preview.h @@ -12,7 +12,7 @@ class AnimationPreview : public CanvasView { - bool wasPlaybackPlaying = false; + bool isPlaybackPlayingBefore = false; int soundFrame = -1; bool isMoveDragging = false; Vec2 moveOffset{}; diff --git a/src/ui/canvas_view.cpp b/src/ui/canvas_view.cpp index 8c41c11..b0b35b5 100644 --- a/src/ui/canvas_view.cpp +++ b/src/ui/canvas_view.cpp @@ -123,7 +123,7 @@ void CanvasView::checker_pan_reset(float zoom, Vec2 pan) checkerSyncPan = pan; checkerSyncZoom = zoom; isCheckerPanInitialized = true; - hasPendingZoomPanAdjust = false; + isZoomPanAdjustPending = false; } void CanvasView::checker_pan_sync(float zoom, Vec2 pan) @@ -133,13 +133,13 @@ void CanvasView::checker_pan_sync(float zoom, Vec2 pan) if (pan == checkerSyncPan && zoom == checkerSyncZoom) return; - auto isPanDeltaIgnored = hasPendingZoomPanAdjust && zoom != checkerSyncZoom; + auto isPanDeltaIgnored = isZoomPanAdjustPending && zoom != checkerSyncZoom; if (!isPanDeltaIgnored) checkerPan += pan - checkerSyncPan; checkerSyncPan = pan; checkerSyncZoom = zoom; if (isPanDeltaIgnored) - hasPendingZoomPanAdjust = false; + isZoomPanAdjustPending = false; } void CanvasView::zoom_step(float& zoom, Vec2& pan, Vec2 focus, int levelDelta) @@ -147,7 +147,7 @@ void CanvasView::zoom_step(float& zoom, Vec2& pan, Vec2 focus, int levelDelta) auto previousZoom = zoom; zoom_level_adjust(zoom, pan, focus, levelDelta); if (zoom != previousZoom) - hasPendingZoomPanAdjust = true; + isZoomPanAdjustPending = true; } void CanvasView::grid_child_draw(ImVec2 childSize, bool& isGrid, Vec4& gridColor, IVec2& gridSize, IVec2& gridOffset, diff --git a/src/ui/canvas_view.h b/src/ui/canvas_view.h index b242813..25a1943 100644 --- a/src/ui/canvas_view.h +++ b/src/ui/canvas_view.h @@ -52,7 +52,7 @@ protected: Vec2 checkerSyncPan{}; float checkerSyncZoom = 0; bool isCheckerPanInitialized = false; - bool hasPendingZoomPanAdjust = false; + bool isZoomPanAdjustPending = false; bool isFocused = false; void checker_pan_reset(float, Vec2); diff --git a/src/ui/documents.cpp b/src/ui/documents.cpp index ef4bb06..86313c3 100644 --- a/src/ui/documents.cpp +++ b/src/ui/documents.cpp @@ -124,7 +124,7 @@ void Documents::update(Taskbar& taskbar, Manager& manager, Settings& settings, R auto viewport = ImGui::GetMainViewport(); auto windowHeight = ImGui::GetFrameHeightWithSpacing(); bool isLightTheme = settings.theme == THEME_LIGHT; - bool pushedStyle = false; + bool isStylePushed = false; ImGui::SetNextWindowViewport(viewport->ID); ImGui::SetNextWindowPos(ImVec2(viewport->Pos.x, viewport->Pos.y + taskbar.height)); @@ -132,7 +132,7 @@ void Documents::update(Taskbar& taskbar, Manager& manager, Settings& settings, R if (isLightTheme) { ImGui::PushStyleColor(ImGuiCol_WindowBg, ImGui::GetStyleColorVec4(ImGuiCol_TitleBgActive)); - pushedStyle = true; + isStylePushed = true; } for (auto i = 0; i < (int)manager.documents.size(); ++i) @@ -336,7 +336,7 @@ void Documents::update(Taskbar& taskbar, Manager& manager, Settings& settings, R } ImGui::End(); - if (pushedStyle) + if (isStylePushed) ImGui::PopStyleColor(); if (manager.isAnm2DragDrop) diff --git a/src/ui/multiselect.cpp b/src/ui/multiselect.cpp index 3fd5336..277592f 100644 --- a/src/ui/multiselect.cpp +++ b/src/ui/multiselect.cpp @@ -1,14 +1,14 @@ #include "ui/multiselect.h" -void external_storage_set(ImGuiSelectionExternalStorage* self, int id, bool isSelected) +static void external_storage_set(ImGuiSelectionExternalStorage* self, int id, bool isSelected) { - auto* storage = static_cast(self->UserData); - auto value = storage ? storage->resolve_index(id) : id; + auto& storage = *(MultiSelectStorage*)self->UserData; + auto value = storage.resolve_index(id); if (isSelected) - storage->insert(value); + storage.insert(value); else - storage->erase(value); -}; + storage.erase(value); +} MultiSelectStorage::MultiSelectStorage() { diff --git a/src/ui/multiselect.h b/src/ui/multiselect.h index 05c68e1..b46534d 100644 --- a/src/ui/multiselect.h +++ b/src/ui/multiselect.h @@ -24,4 +24,3 @@ public: int resolve_index(int) const; }; -void external_storage_set(ImGuiSelectionExternalStorage*, int, bool); diff --git a/src/ui/spritesheet_editor.cpp b/src/ui/spritesheet_editor.cpp index a9b1056..655cc5d 100644 --- a/src/ui/spritesheet_editor.cpp +++ b/src/ui/spritesheet_editor.cpp @@ -250,7 +250,7 @@ void SpritesheetEditor::update(Manager& manager, Settings& settings, Resources& [pivot = pivot_snap(mousePos - region->crop, region->pivot)](Vec2) { return pivot; }); if (isArrow) region_pivot_update( - [=, this](Vec2 pivot) { return isGridSnap ? Vec2(IVec2(pivot + arrow)) : pivot + arrow; }); + [=](Vec2 pivot) { return isGridSnap ? Vec2(IVec2(pivot + arrow)) : pivot + arrow; }); if (isDuring) tooltip_lines_draw({localize_format(FORMAT_PIVOT, region->pivot.x, region->pivot.y)}); if (isEnd) @@ -315,14 +315,14 @@ void SpritesheetEditor::update(Manager& manager, Settings& settings, Resources& // Arrow nudges are snapped (and the rectangle normalized) when the command runs, after the nudge. if (isDuring && !isMouseDown && isRegionCrop) - regions_update(regionSelection, [=, this](Region& region) { + regions_update(regionSelection, [=](Region& region) { auto [minPoint, maxPoint] = rect_snap(region.crop, region.crop + region.size, isGridSnap, gridSize, gridOffset); region.crop = minPoint; region.size = maxPoint - minPoint; }); else if (isDuring && !isMouseDown) - manager.command_push({manager.selected, [=, this](Manager&, Document& document) { + manager.command_push({manager.selected, [=](Manager&, Document& document) { auto source = document.model.frame_get(editReference); if (!source) return; @@ -455,19 +455,13 @@ void SpritesheetEditor::update(Manager& manager, Settings& settings, Resources& frame && reference.itemID > -1 && layer && layer->spritesheetId == referenceSpritesheet; int highlightedRegionId = -1; - if (document.editTarget == Document::EditTarget::REGION && regionReference != -1 && - region_get(regionReference)) - { + auto isRegionReferenced = regionReference != -1 && region_get(regionReference); + if (document.editTarget == Document::EditTarget::REGION && isRegionReferenced) highlightedRegionId = regionReference; - } else if (isReferenceLayerOnSpritesheet && frame->regionId != -1 && region_get(frame->regionId)) - { highlightedRegionId = frame->regionId; - } - else if (regionReference != -1 && region_get(regionReference)) - { + else if (isRegionReferenced) highlightedRegionId = regionReference; - } auto draw_region_rect = [&](const Region& region, Vec4 regionColor) { auto cropModel = quad_model_get(region.size, region.crop); diff --git a/src/ui/taskbar.cpp b/src/ui/taskbar.cpp index 5ec64a0..8fb69b5 100644 --- a/src/ui/taskbar.cpp +++ b/src/ui/taskbar.cpp @@ -77,7 +77,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources, auto animation = document ? document->model.animation_get(document->reference_get().animationIndex) : nullptr; auto layerReferences = document ? document->layer_references_get() : std::vector{}; bool isGenerateAnimationFromGridAvailable = !layerReferences.empty(); - bool hasRegions = + bool isRegions = document && std::ranges::any_of(document->model.content.spritesheets, [](const auto& spritesheet) { return !spritesheet.regions.empty(); }); @@ -165,7 +165,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources, generateRegionsPopup.open(); tooltip_set(TOOLTIP_WIZARD_GENERATE_REGIONS_FROM_ANIMATIONS); - if (ImGui::MenuItem(localize.get(LABEL_SCAN_AND_SET_REGIONS), nullptr, false, document && hasRegions)) + if (ImGui::MenuItem(localize.get(LABEL_SCAN_AND_SET_REGIONS), nullptr, false, document && isRegions)) { manager.command_push({manager.selected, [](Manager&, Document& document) { document.edit_apply(EDIT_SCAN_AND_SET_REGIONS, diff --git a/src/ui/timeline.cpp b/src/ui/timeline.cpp index 92abf91..a023033 100644 --- a/src/ui/timeline.cpp +++ b/src/ui/timeline.cpp @@ -199,7 +199,7 @@ void TimelineContext::shortcuts_update() { if (resizeChordTabIds[i] != document.tabId) edit_begin_push(resize.edit); - command_push([=, this](Manager&, Document& document) { + command_push([=](Manager&, Document& document) { for (auto frameReference : selectedFrames) if (auto frame = document.model.frame_edit(frameReference)) frame->duration = diff --git a/src/ui/timeline_context.h b/src/ui/timeline_context.h index 3694a66..870cfe3 100644 --- a/src/ui/timeline_context.h +++ b/src/ui/timeline_context.h @@ -208,7 +208,7 @@ struct TimelineContext : TimelineState template void edit_push(StringType label, Operation operation, std::function select = {}) { - command_push([=, this](Manager&, Document& document) mutable { + command_push([=](Manager&, Document& document) mutable { auto uids = document.edit_apply(label, operation); select ? select(document, uids) : document.frames_select(uids); }); diff --git a/src/ui/timeline_edit.cpp b/src/ui/timeline_edit.cpp index ff85b5c..2574690 100644 --- a/src/ui/timeline_edit.cpp +++ b/src/ui/timeline_edit.cpp @@ -16,7 +16,7 @@ void TimelineContext::frames_delete_action() return; edit_push( EDIT_DELETE_FRAMES, [=](Model& model) { return frames_delete(model, selectedFrames); }, - [this](Document& document, const Uids&) { document.frame_focus_select(); }); + [](Document& document, const Uids&) { document.frame_focus_select(); }); } void TimelineContext::frames_duplicate() @@ -190,7 +190,7 @@ void TimelineContext::item_group() name = std::string(localize.get(TEXT_NEW_GROUP))](Model& model) { return items_group(model, animationIndex, type, ids, name); }, - [=, this](Document& document, const Uids& uids) { + [=](Document& document, const Uids& uids) { if (uids.empty()) return; document.selected_set(SelectionKind::TRACKS, {targetReferences.begin(), targetReferences.end()}); @@ -233,7 +233,7 @@ void TimelineContext::rows_move_to_row(std::vector draggedRows, Tim edit_push( EDIT_MOVE_ITEMS, [=](Model& model) { return items_move(model, animationIndex, targetType, ids, groupIds, target, zone); }, - [=, this](Document& document, const Uids&) { + [=](Document& document, const Uids&) { document.selection.uids[SelectionKind::TRACKS] = moved.uids.at(SelectionKind::TRACKS); document.selection.uids[SelectionKind::GROUPS] = moved.uids.at(SelectionKind::GROUPS); if (tracks.empty()) @@ -289,7 +289,7 @@ void TimelineContext::cut() frame_references_copy(selectedFrames); edit_push( EDIT_CUT_FRAMES, [=](Model& model) { return frames_delete(model, selectedFrames); }, - [this](Document& document, const Uids&) { document.frame_focus_select(); }); + [](Document& document, const Uids&) { document.frame_focus_select(); }); } void TimelineContext::paste() @@ -311,7 +311,7 @@ void TimelineContext::paste() time = hoveredTime](Model& model) { return frames_paste(model, targetReference, selectedFrames, text, time, errorString.get()); }, - [=, this](Document& document, const Uids& uids) { + [=](Document& document, const Uids& uids) { if (errorString->empty()) return document.frames_select(uids); toasts.push(std::format("{} {}", localize.get(TOAST_DESERIALIZE_FRAMES_FAILED), *errorString)); diff --git a/src/ui/timeline_frames.cpp b/src/ui/timeline_frames.cpp index c7259af..efdc466 100644 --- a/src/ui/timeline_frames.cpp +++ b/src/ui/timeline_frames.cpp @@ -19,7 +19,7 @@ void TimelineContext::frames_move_to(Reference target) edit_push( EDIT_MOVE_FRAMES, [frames, target, insertIndex](Model& model) { return frames_move(model, frames, target, insertIndex); }, - [=, this](Document& document, const Uids& uids) { + [=](Document& document, const Uids& uids) { document.frames_select(uids); if (target.itemType == LAYER) if (auto layer = ::item_get(document.model.content.layers, target.itemID)) @@ -607,7 +607,7 @@ void TimelineContext::frame_drag_update() { auto targetReference = draggedFrameReference; auto targetType = draggedFrameType; - command_push([=, this](Manager&, Document& document) { + command_push([=](Manager&, Document& document) { auto item = document.model.track_edit(targetReference); if (targetType == TRIGGER && item) frames_sort_by_at_frame(*item); diff --git a/src/ui/timeline_menus.cpp b/src/ui/timeline_menus.cpp index de70c87..c5154e1 100644 --- a/src/ui/timeline_menus.cpp +++ b/src/ui/timeline_menus.cpp @@ -75,7 +75,7 @@ void TimelineContext::context_menu() return; auto settingsPtr = &settings; - command_push([=, this](Manager& manager, Document& document) { + command_push([=](Manager& manager, Document& document) { auto frame = document.model.frame_get(targetReference); if (!frame || frame->regionId != -1) return; @@ -127,20 +127,20 @@ void TimelineContext::context_menu() .shortcut = SHORTCUT_INSERT_FRAME, .isEnabled = [&]() { return item; }, .run = [&]() { frame_insert(); }}); - actions.add(ACTION_DUPLICATE, [=, this]() { return !selectedBakeFrames.empty(); }, [&]() { frames_duplicate(); }); + actions.add(ACTION_DUPLICATE, [=]() { return !selectedBakeFrames.empty(); }, [&]() { frames_duplicate(); }); actions.add({.label = LABEL_SPLIT, .shortcut = SHORTCUT_SPLIT, - .isEnabled = [=, this]() { return !selectedBakeFrames.empty(); }, + .isEnabled = [=]() { return !selectedBakeFrames.empty(); }, .run = [&]() { frame_split(); }}); - actions.add(ACTION_REVERSE, [=, this]() { return isReverseFrames; }, [&]() { frames_reverse(); }); + actions.add(ACTION_REVERSE, [=]() { return isReverseFrames; }, [&]() { frames_reverse(); }); actions.separator(); actions.add({.label = LABEL_BAKE, .shortcut = SHORTCUT_BAKE, - .isEnabled = [=, this]() { return !selectedBakeFrames.empty(); }, + .isEnabled = [=]() { return !selectedBakeFrames.empty(); }, .run = [&]() { frames_bake(); }}); actions.add({.label = LABEL_BAKE_INTO_OTHER_FRAMES, .shortcut = -1, - .isEnabled = [=, this]() { return !selectedRootFrames.empty(); }, + .isEnabled = [=]() { return !selectedRootFrames.empty(); }, .run = [&]() { bakeIntoOtherFramesPopup.open(); }}); actions.add({.label = LABEL_FIT_ANIMATION_LENGTH, .shortcut = SHORTCUT_FIT, @@ -149,7 +149,7 @@ void TimelineContext::context_menu() actions.separator(); actions.add({.label = isMakeManyRegions ? LABEL_MAKE_MANY_REGIONS : LABEL_MAKE_REGION, .shortcut = -1, - .isEnabled = [=, this]() { return isMakeManyRegions || isMakeRegion; }, + .isEnabled = [=]() { return isMakeManyRegions || isMakeRegion; }, .run = [&]() { if (!isMakeManyRegions) @@ -160,7 +160,7 @@ void TimelineContext::context_menu() actions.separator(); actions.add({.label = LABEL_DELETE, .shortcut = SHORTCUT_REMOVE, - .isEnabled = [=, this]() { return !selectedFrames.empty(); }, + .isEnabled = [=]() { return !selectedFrames.empty(); }, .run = [&]() { frames_delete_action(); }}); actions.separator(); // Cut, copy and paste each open onto the whole frame, or one property of it. @@ -199,10 +199,10 @@ void TimelineContext::context_menu() return sourceFrame != nullptr; }; clipboard_menu_add( - ACTION_CUT, [=, this]() { return !selectedFrames.empty(); }, [this]() { cut(); }, + ACTION_CUT, [=]() { return !selectedFrames.empty(); }, [this]() { cut(); }, properties_get(sourceType, is_source, [this](FrameProperty property) { property_cut(property); })); clipboard_menu_add( - ACTION_COPY, [=, this]() { return !copyFrames.empty(); }, [this]() { copy(); }, + ACTION_COPY, [=]() { return !copyFrames.empty(); }, [this]() { copy(); }, properties_get(sourceType, is_source, [this](FrameProperty property) { property_copy(property); })); // Only one property is ever on the clipboard, so pasting one is a single item. auto clipboardProperty = (FrameProperty)frameClipboard.property; @@ -317,11 +317,11 @@ void TimelineContext::item_context_menu() item_base_properties_open(type, id); }); actions.add(ACTION_ADD, [&]() { return animation; }, [&]() { itemProperties.open(); }); - actions.add(ACTION_REMOVE, [=, this]() { return isRemoveAvailable; }, [&]() { item_remove(); }); - actions.add(ACTION_GROUP, [=, this]() { return !selectedGroupableItems.empty(); }, [&]() { item_group(); }); + actions.add(ACTION_REMOVE, [=]() { return isRemoveAvailable; }, [&]() { item_remove(); }); + actions.add(ACTION_GROUP, [=]() { return !selectedGroupableItems.empty(); }, [&]() { item_group(); }); actions.separator(); - actions.add(ACTION_CUT, [=, this]() { return !copyFrames.empty() && isRemoveAvailable; }, item_cut); - actions.add(ACTION_COPY, [=, this]() { return !copyFrames.empty(); }, [this]() { copy(); }); + actions.add(ACTION_CUT, [=]() { return !copyFrames.empty() && isRemoveAvailable; }, item_cut); + actions.add(ACTION_COPY, [=]() { return !copyFrames.empty(); }, [this]() { copy(); }); actions.add(ACTION_PASTE, [&]() { return item && !clipboard.is_empty(); }, [this]() { paste(); }); if (shortcut(manager.chords[SHORTCUT_CUT], SCOPE_FOCUSED) && !copyFrames.empty() && isRemoveAvailable) item_cut(); diff --git a/src/ui/timeline_tracks.cpp b/src/ui/timeline_tracks.cpp index 79f8492..a7fda46 100644 --- a/src/ui/timeline_tracks.cpp +++ b/src/ui/timeline_tracks.cpp @@ -203,11 +203,11 @@ void TimelineContext::item_child(const TimelineRow& row, int index) ImGuiHoveredFlags_AllowWhenDisabled | ImGuiHoveredFlags_NoSharedDelay; imguiStyle.HoverDelayNormal = FRAME_TOOLTIP_HOVER_DELAY; - bool showItemTooltip = ImGui::BeginItemTooltip(); + bool isItemTooltipShown = ImGui::BeginItemTooltip(); imguiStyle.HoverFlagsForTooltipMouse = previousTooltipFlags; imguiStyle.HoverDelayNormal = previousTooltipDelay; - if (showItemTooltip) + if (isItemTooltipShown) { auto yesNoLabel = [&](bool value) { return value ? localize.get(BASIC_YES) : localize.get(BASIC_NO);