Add tooltip_set and PopupHelper::begin, and use localize_format

149 localized tooltips, 38 localized formats and 27 modal popups lose their boilerplate.
This commit is contained in:
shweet committed 2026-11-22 18:47:33 -05:00
1 parent 99e06b72ea
commit 8d3ebf2329
31 files changed
+238 -292

No files matched your search

+3 -3
View File
@@ -114,7 +114,7 @@ static void shader_status_format_append(std::string* status, StringType format,
if (!status) if (!status)
return; return;
auto argumentString = std::string(localize.get(argument)); auto argumentString = std::string(localize.get(argument));
*status += std::vformat(localize.get(format), std::make_format_args(argumentString)) + "\n"; *status += localize_format(format, argumentString) + "\n";
} }
static bool shader_source_load(Document& document, const std::filesystem::path& shaderPath, std::string& source, static bool shader_source_load(Document& document, const std::filesystem::path& shaderPath, std::string& source,
@@ -138,7 +138,7 @@ static bool shader_source_load(Document& document, const std::filesystem::path&
if (status) if (status)
{ {
auto pathString = path_to_utf8(shaderPath); auto pathString = path_to_utf8(shaderPath);
*status += std::vformat(localize.get(LABEL_SHADER_READ_FAILED), std::make_format_args(pathString)) + "\n"; *status += localize_format(LABEL_SHADER_READ_FAILED, pathString) + "\n";
} }
return false; return false;
} }
@@ -976,7 +976,7 @@ Choices Document::choices_get(SelectionKind kind, int layerId) const
auto path_label_get = [](StringType format) { auto path_label_get = [](StringType format) {
return [format](const auto& item) { return [format](const auto& item) {
auto pathString = path_to_utf8(item.path); auto pathString = path_to_utf8(item.path);
return std::vformat(localize.get(format), std::make_format_args(item.id, pathString)); return localize_format(format, item.id, pathString);
}; };
}; };
auto& content = model.content; auto& content = model.content;
+2 -2
View File
@@ -100,7 +100,7 @@ static void action_items_menu_draw(std::vector<Action>& items, Settings& setting
if (ImGui::MenuItem(localize.get(action.label), shortcutLabel, false, is_action_enabled(action)) && action.run) if (ImGui::MenuItem(localize.get(action.label), shortcutLabel, false, is_action_enabled(action)) && action.run)
action.run(); action.run();
if (action.tooltip != STRING_UNDEFINED && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) if (action.tooltip != STRING_UNDEFINED && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled))
ImGui::SetItemTooltip("%s", localize.get(action.tooltip)); tooltip_set(action.tooltip);
} }
} }
@@ -161,7 +161,7 @@ void action_button_draw(Action& action, Manager& manager, Settings& settings, Im
{ {
auto shortcutText = action_shortcut_text_get(action, settings); auto shortcutText = action_shortcut_text_get(action, settings);
if (shortcutText.empty()) if (shortcutText.empty())
ImGui::SetItemTooltip("%s", localize.get(action.tooltip)); tooltip_set(action.tooltip);
else else
set_item_tooltip_shortcut(localize.get(action.tooltip), shortcutText); set_item_tooltip_shortcut(localize.get(action.tooltip), shortcutText);
} }
+16 -19
View File
@@ -301,14 +301,13 @@ void AnimationPreview::update(Manager& manager, Settings& settings, Resources& r
if (ImGui::BeginChild("##View Child", childSize, true, ImGuiWindowFlags_HorizontalScrollbar)) if (ImGui::BeginChild("##View Child", childSize, true, ImGuiWindowFlags_HorizontalScrollbar))
{ {
ImGui::InputFloat(localize.get(BASIC_ZOOM), &zoom, 0.0f, 0.0f, "%.0f%%"); ImGui::InputFloat(localize.get(BASIC_ZOOM), &zoom, 0.0f, 0.0f, "%.0f%%");
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_PREVIEW_ZOOM)); tooltip_set(TOOLTIP_PREVIEW_ZOOM);
view_buttons_draw(manager, settings, center_view, fit_view); view_buttons_draw(manager, settings, center_view, fit_view);
auto readoutSize = ImVec2(row_widget_width_get(2), ImGui::GetTextLineHeightWithSpacing()); auto readoutSize = ImVec2(row_widget_width_get(2), ImGui::GetTextLineHeightWithSpacing());
auto mousePosInt = IVec2(mousePos); auto mousePosInt = IVec2(mousePos);
auto positionText = auto positionText = localize_format(FORMAT_POSITION_SPACED, mousePosInt.x, mousePosInt.y);
std::vformat(localize.get(FORMAT_POSITION_SPACED), std::make_format_args(mousePosInt.x, mousePosInt.y));
if (ImGui::BeginChild("##Position Readout", readoutSize, false, ImGuiWindowFlags_NoScrollbar)) if (ImGui::BeginChild("##Position Readout", readoutSize, false, ImGuiWindowFlags_NoScrollbar))
{ {
ImGui::TextUnformatted(positionText.c_str()); ImGui::TextUnformatted(positionText.c_str());
@@ -320,7 +319,7 @@ void AnimationPreview::update(Manager& manager, Settings& settings, Resources& r
ImGui::SameLine(); ImGui::SameLine();
auto sizeInt = IVec2(size); auto sizeInt = IVec2(size);
auto sizeText = std::vformat(localize.get(FORMAT_SIZE_SPACED), std::make_format_args(sizeInt.x, sizeInt.y)); auto sizeText = localize_format(FORMAT_SIZE_SPACED, sizeInt.x, sizeInt.y);
if (ImGui::BeginChild("##Size Readout", readoutSize, false, ImGuiWindowFlags_NoScrollbar)) if (ImGui::BeginChild("##Size Readout", readoutSize, false, ImGuiWindowFlags_NoScrollbar))
{ {
ImGui::TextUnformatted(sizeText.c_str()); ImGui::TextUnformatted(sizeText.c_str());
@@ -339,15 +338,15 @@ void AnimationPreview::update(Manager& manager, Settings& settings, Resources& r
{ {
ImGui::ColorEdit3(localize.get(LABEL_BACKGROUND_COLOR), values_get(backgroundColor), ImGui::ColorEdit3(localize.get(LABEL_BACKGROUND_COLOR), values_get(backgroundColor),
ImGuiColorEditFlags_NoInputs); ImGuiColorEditFlags_NoInputs);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_BACKGROUND_COLOR)); tooltip_set(TOOLTIP_BACKGROUND_COLOR);
} }
ImGui::EndDisabled(); ImGui::EndDisabled();
ImGui::SameLine(); ImGui::SameLine();
ImGui::Checkbox(localize.get(LABEL_AXES), &isAxes); ImGui::Checkbox(localize.get(LABEL_AXES), &isAxes);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_AXES)); tooltip_set(TOOLTIP_AXES);
ImGui::SameLine(); ImGui::SameLine();
ImGui::ColorEdit4(localize.get(BASIC_COLOR), values_get(axesColor), ImGuiColorEditFlags_NoInputs); ImGui::ColorEdit4(localize.get(BASIC_COLOR), values_get(axesColor), ImGuiColorEditFlags_NoInputs);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_AXES_COLOR)); tooltip_set(TOOLTIP_AXES_COLOR);
auto overlayOptions = overlay_animation_options_get(manager); auto overlayOptions = overlay_animation_options_get(manager);
auto overlayLabels = overlay_animation_option_labels_get(overlayOptions); auto overlayLabels = overlay_animation_option_labels_get(overlayOptions);
@@ -365,7 +364,7 @@ void AnimationPreview::update(Manager& manager, Settings& settings, Resources& r
overlayIndex = option.animationIndex; overlayIndex = option.animationIndex;
overlayDocumentId = overlayIndex == -1 ? 0 : option.documentId; overlayDocumentId = overlayIndex == -1 ? 0 : option.documentId;
} }
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_OVERLAY)); tooltip_set(TOOLTIP_OVERLAY);
overlayDrawOrder = vec_clamp(overlayDrawOrder, (int)OVERLAY_OVER, (int)OVERLAY_UNDER); overlayDrawOrder = vec_clamp(overlayDrawOrder, (int)OVERLAY_OVER, (int)OVERLAY_UNDER);
overlayTransparency = vec_clamp(overlayTransparency, 0.0f, 100.0f); overlayTransparency = vec_clamp(overlayTransparency, 0.0f, 100.0f);
@@ -378,18 +377,18 @@ void AnimationPreview::update(Manager& manager, Settings& settings, Resources& r
ImGui::PushItemWidth(alphaWidth); ImGui::PushItemWidth(alphaWidth);
ImGui::DragFloat("##Overlay Alpha", &overlayTransparency, DRAG_SPEED, 0, 100, "%.0f%%"); ImGui::DragFloat("##Overlay Alpha", &overlayTransparency, DRAG_SPEED, 0, 100, "%.0f%%");
ImGui::PopItemWidth(); ImGui::PopItemWidth();
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_OVERLAY_ALPHA)); tooltip_set(TOOLTIP_OVERLAY_ALPHA);
overlayTransparency = vec_clamp(overlayTransparency, 0.0f, 100.0f); overlayTransparency = vec_clamp(overlayTransparency, 0.0f, 100.0f);
ImGui::SameLine(); ImGui::SameLine();
radio_button_icon("##Overlay Over", &overlayDrawOrder, OVERLAY_OVER, resources.icon_id_get(ICON_OVER), radio_button_icon("##Overlay Over", &overlayDrawOrder, OVERLAY_OVER, resources.icon_id_get(ICON_OVER),
orderIconSize, overlayIconTint); orderIconSize, overlayIconTint);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_OVERLAY_OVER)); tooltip_set(TOOLTIP_OVERLAY_OVER);
ImGui::SameLine(); ImGui::SameLine();
radio_button_icon("##Overlay Under", &overlayDrawOrder, OVERLAY_UNDER, resources.icon_id_get(ICON_UNDER), radio_button_icon("##Overlay Under", &overlayDrawOrder, OVERLAY_UNDER, resources.icon_id_get(ICON_UNDER),
orderIconSize, overlayIconTint); orderIconSize, overlayIconTint);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_OVERLAY_UNDER)); tooltip_set(TOOLTIP_OVERLAY_UNDER);
} }
ImGui::EndChild(); ImGui::EndChild();
@@ -402,11 +401,11 @@ void AnimationPreview::update(Manager& manager, Settings& settings, Resources& r
if (ImGui::BeginChild("##Helpers Child 1", helpersChildSize)) if (ImGui::BeginChild("##Helpers Child 1", helpersChildSize))
{ {
ImGui::Checkbox(localize.get(LABEL_ROOT_TRANSFORM), &isRootTransform); ImGui::Checkbox(localize.get(LABEL_ROOT_TRANSFORM), &isRootTransform);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ROOT_TRANSFORM)); tooltip_set(TOOLTIP_ROOT_TRANSFORM);
ImGui::Checkbox(localize.get(LABEL_PIVOTS), &isPivots); ImGui::Checkbox(localize.get(LABEL_PIVOTS), &isPivots);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_PIVOTS)); tooltip_set(TOOLTIP_PIVOTS);
ImGui::Checkbox(localize.get(LABEL_TRANSPARENT), &isTransparent); ImGui::Checkbox(localize.get(LABEL_TRANSPARENT), &isTransparent);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_PREVIEW_TRANSPARENT)); tooltip_set(TOOLTIP_PREVIEW_TRANSPARENT);
} }
ImGui::EndChild(); ImGui::EndChild();
@@ -415,9 +414,9 @@ void AnimationPreview::update(Manager& manager, Settings& settings, Resources& r
if (ImGui::BeginChild("##Helpers Child 2", helpersChildSize)) if (ImGui::BeginChild("##Helpers Child 2", helpersChildSize))
{ {
ImGui::Checkbox(localize.get(LABEL_ALT_ICONS), &isAltIcons); ImGui::Checkbox(localize.get(LABEL_ALT_ICONS), &isAltIcons);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ALT_ICONS)); tooltip_set(TOOLTIP_ALT_ICONS);
ImGui::Checkbox(localize.get(LABEL_BORDER), &isBorder); ImGui::Checkbox(localize.get(LABEL_BORDER), &isBorder);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_BORDER)); tooltip_set(TOOLTIP_BORDER);
} }
ImGui::EndChild(); ImGui::EndChild();
} }
@@ -899,9 +898,7 @@ void AnimationPreview::update(Manager& manager, Settings& settings, Resources& r
view_context_menu_draw("##Animation Preview Context Menu", manager, settings, document, zoom, pan, center_view, view_context_menu_draw("##Animation Preview Context Menu", manager, settings, document, zoom, pan, center_view,
fit_view, animation != nullptr); fit_view, animation != nullptr);
manager.progressPopup.trigger(); if (manager.progressPopup.begin())
if (ImGui::BeginPopupModal(manager.progressPopup.label(), &manager.progressPopup.isOpen, ImGuiWindowFlags_NoResize))
{ {
ImGui::ProgressBar(recorder.count > 0 ? (float)recorder.index / (float)recorder.count : 0.0f); ImGui::ProgressBar(recorder.count > 0 ? (float)recorder.index / (float)recorder.count : 0.0f);
ImGui::TextUnformatted(localize.get(TEXT_RECORDING_PROGRESS)); ImGui::TextUnformatted(localize.get(TEXT_RECORDING_PROGRESS));
+4 -8
View File
@@ -455,8 +455,7 @@ static void animations_merge_popup_update(Panel& panel, AnimationsPanel& animati
auto& mergeSelection = animations.mergeSelection; auto& mergeSelection = animations.mergeSelection;
auto mergeReference = animations.mergeReference; auto mergeReference = animations.mergeReference;
popup.trigger(); if (!popup.begin())
if (!ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
return popup.end(); return popup.end();
struct AnimationMergeCandidate struct AnimationMergeCandidate
@@ -686,8 +685,7 @@ void animations_update(Panel& panel, AnimationsPanel& animations)
animations.mergePopup.open(); animations.mergePopup.open();
}; };
ListRows rows{ ListRows rows{.label_get = [&](int index) { return model.animation_get(index)->name; },
.label_get = [&](int index) { return model.animation_get(index)->name; },
.name_get = [&](int index) { return model.animation_get(index)->name; }, .name_get = [&](int index) { return model.animation_get(index)->name; },
.rename = .rename =
[&](int index, const std::string& name) { [&](int index, const std::string& name) {
@@ -722,11 +720,9 @@ void animations_update(Panel& panel, AnimationsPanel& animations)
ImGui::TextUnformatted(localize.get(BASIC_DEFAULT)); ImGui::TextUnformatted(localize.get(BASIC_DEFAULT));
ImGui::PopFont(); ImGui::PopFont();
} }
ImGui::TextUnformatted( ImGui::TextUnformatted(localize_format(FORMAT_LENGTH, animation.frameNum).c_str());
std::vformat(localize.get(FORMAT_LENGTH), std::make_format_args(animation.frameNum)).c_str());
auto loopLabel = localize.get(animation.isLoop ? BASIC_YES : BASIC_NO); auto loopLabel = localize.get(animation.isLoop ? BASIC_YES : BASIC_NO);
ImGui::TextUnformatted( ImGui::TextUnformatted(localize_format(FORMAT_LOOP, loopLabel).c_str());
std::vformat(localize.get(FORMAT_LOOP), std::make_format_args(loopLabel)).c_str());
}, },
.select = .select =
[&](int index) { [&](int index) {
+1 -3
View File
@@ -15,9 +15,7 @@ void AutosaveRestore::update(Manager& manager)
popup.open(); popup.open();
} }
popup.trigger(); if (isRestoreAvailable && popup.begin())
if (isRestoreAvailable && ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
{ {
ImGui::TextUnformatted(localize.get(LABEL_RESTORE_AUTOSAVES_PROMPT)); ImGui::TextUnformatted(localize.get(LABEL_RESTORE_AUTOSAVES_PROMPT));
+5 -5
View File
@@ -156,21 +156,21 @@ void CanvasView::grid_child_draw(ImVec2 childSize, bool& isGrid, Vec4& gridColor
if (ImGui::BeginChild("##Grid Child", childSize, true, ImGuiWindowFlags_HorizontalScrollbar)) if (ImGui::BeginChild("##Grid Child", childSize, true, ImGuiWindowFlags_HorizontalScrollbar))
{ {
ImGui::Checkbox(localize.get(BASIC_GRID), &isGrid); ImGui::Checkbox(localize.get(BASIC_GRID), &isGrid);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_GRID_VISIBILITY)); tooltip_set(TOOLTIP_GRID_VISIBILITY);
if (isGridSnap) if (isGridSnap)
{ {
ImGui::SameLine(); ImGui::SameLine();
ImGui::Checkbox(localize.get(LABEL_SNAP), isGridSnap); ImGui::Checkbox(localize.get(LABEL_SNAP), isGridSnap);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_GRID_SNAP)); tooltip_set(TOOLTIP_GRID_SNAP);
} }
ImGui::SameLine(); ImGui::SameLine();
ImGui::ColorEdit4(localize.get(BASIC_COLOR), values_get(gridColor), ImGuiColorEditFlags_NoInputs); ImGui::ColorEdit4(localize.get(BASIC_COLOR), values_get(gridColor), ImGuiColorEditFlags_NoInputs);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_GRID_COLOR)); tooltip_set(TOOLTIP_GRID_COLOR);
input_int2_range(localize.get(BASIC_SIZE), gridSize, IVec2(GRID_SIZE_MIN), IVec2(GRID_SIZE_MAX)); input_int2_range(localize.get(BASIC_SIZE), gridSize, IVec2(GRID_SIZE_MIN), IVec2(GRID_SIZE_MAX));
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_GRID_SIZE)); tooltip_set(TOOLTIP_GRID_SIZE);
input_int2_range(localize.get(BASIC_OFFSET), gridOffset, IVec2(GRID_OFFSET_MIN), IVec2(GRID_OFFSET_MAX)); input_int2_range(localize.get(BASIC_OFFSET), gridOffset, IVec2(GRID_OFFSET_MIN), IVec2(GRID_OFFSET_MAX));
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_GRID_OFFSET)); tooltip_set(TOOLTIP_GRID_OFFSET);
} }
ImGui::EndChild(); ImGui::EndChild();
} }
+6 -6
View File
@@ -238,7 +238,7 @@ void ChangeAllFrameProperties::update(Manager& manager, Document& document, Sett
property_toggle_begin(settings.changeIsDepth); property_toggle_begin(settings.changeIsDepth);
input_int_range(localize.get(BASIC_DEPTH), settings.changeDepth, -FRAME_DEPTH_MAX, FRAME_DEPTH_MAX, STEP, input_int_range(localize.get(BASIC_DEPTH), settings.changeDepth, -FRAME_DEPTH_MAX, FRAME_DEPTH_MAX, STEP,
STEP_FAST); STEP_FAST);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_DEPTH)); tooltip_set(TOOLTIP_DEPTH);
ImGui::EndDisabled(); ImGui::EndDisabled();
ImGui::PopID(); ImGui::PopID();
ImGui::EndDisabled(); ImGui::EndDisabled();
@@ -267,7 +267,7 @@ void ChangeAllFrameProperties::update(Manager& manager, Document& document, Sett
ImGui::PushID("Child Animation"); ImGui::PushID("Child Animation");
property_toggle_begin(settings.changeIsChildAnimation); property_toggle_begin(settings.changeIsChildAnimation);
combo_string_mapped(localize.get(LABEL_ANIMATION), &settings.changeChildAnimation, values, labels); combo_string_mapped(localize.get(LABEL_ANIMATION), &settings.changeChildAnimation, values, labels);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CHILD_ANIMATION)); tooltip_set(TOOLTIP_CHILD_ANIMATION);
ImGui::EndDisabled(); ImGui::EndDisabled();
ImGui::PopID(); ImGui::PopID();
@@ -283,7 +283,7 @@ void ChangeAllFrameProperties::update(Manager& manager, Document& document, Sett
ImGui::PushID("Child Start"); ImGui::PushID("Child Start");
property_toggle_begin(settings.changeIsChildStart); property_toggle_begin(settings.changeIsChildStart);
input_int_range(localize.get(LABEL_START_FRAME), settings.changeChildStart, 0, FRAME_NUM_MAX, STEP, STEP_FAST); input_int_range(localize.get(LABEL_START_FRAME), settings.changeChildStart, 0, FRAME_NUM_MAX, STEP, STEP_FAST);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CHILD_START)); tooltip_set(TOOLTIP_CHILD_START);
ImGui::EndDisabled(); ImGui::EndDisabled();
ImGui::PopID(); ImGui::PopID();
@@ -374,7 +374,7 @@ void ChangeAllFrameProperties::update(Manager& manager, Document& document, Sett
ImGui::SameLine(); ImGui::SameLine();
ImGui::BeginDisabled(!option.isAvailable); ImGui::BeginDisabled(!option.isAvailable);
ImGui::RadioButton(localize.get(option.label), &destination, option.value); ImGui::RadioButton(localize.get(option.label), &destination, option.value);
ImGui::SetItemTooltip("%s", localize.get(option.tooltip)); tooltip_set(option.tooltip);
ImGui::EndDisabled(); ImGui::EndDisabled();
} }
@@ -393,7 +393,7 @@ void ChangeAllFrameProperties::update(Manager& manager, Document& document, Sett
if (&option != targetOptions) if (&option != targetOptions)
ImGui::SameLine(); ImGui::SameLine();
ImGui::Checkbox(localize.get(option.label), &option.value); ImGui::Checkbox(localize.get(option.label), &option.value);
ImGui::SetItemTooltip("%s", localize.get(option.tooltip)); tooltip_set(option.tooltip);
} }
ImGui::EndDisabled(); ImGui::EndDisabled();
ImGui::Separator(); ImGui::Separator();
@@ -424,7 +424,7 @@ void ChangeAllFrameProperties::update(Manager& manager, Document& document, Sett
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button(std::format("{} {}", button.symbol, localize.get(button.label)).c_str(), rowWidgetSize)) if (ImGui::Button(std::format("{} {}", button.symbol, localize.get(button.label)).c_str(), rowWidgetSize))
frame_change(button.type); frame_change(button.type);
ImGui::SetItemTooltip("%s", localize.get(button.tooltip)); tooltip_set(button.tooltip);
} }
ImGui::EndDisabled(); ImGui::EndDisabled();
} }
+18 -18
View File
@@ -27,23 +27,23 @@ void Configure::update(Manager& manager, Settings& settings)
ImGui::SeparatorText(localize.get(LABEL_WINDOW_MENU)); ImGui::SeparatorText(localize.get(LABEL_WINDOW_MENU));
input_float_range(localize.get(LABEL_UI_SCALE), temporary.uiScale, UI_SCALE_MIN, UI_SCALE_MAX, input_float_range(localize.get(LABEL_UI_SCALE), temporary.uiScale, UI_SCALE_MIN, UI_SCALE_MAX,
UI_SCALE_STEP, UI_SCALE_STEP, "%.0f%%"); UI_SCALE_STEP, UI_SCALE_STEP, "%.0f%%");
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_UI_SCALE)); tooltip_set(TOOLTIP_UI_SCALE);
ImGui::Checkbox(localize.get(LABEL_VSYNC), &temporary.isVsync); ImGui::Checkbox(localize.get(LABEL_VSYNC), &temporary.isVsync);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_VSYNC)); tooltip_set(TOOLTIP_VSYNC);
ImGui::SameLine(); ImGui::SameLine();
ImGui::Checkbox(localize.get(LABEL_DETACHABLE_WINDOWS), &temporary.isDetachableWindows); ImGui::Checkbox(localize.get(LABEL_DETACHABLE_WINDOWS), &temporary.isDetachableWindows);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_DETACHABLE_WINDOWS)); tooltip_set(TOOLTIP_DETACHABLE_WINDOWS);
ImGui::SeparatorText(localize.get(LABEL_PLAYBACK_MENU)); ImGui::SeparatorText(localize.get(LABEL_PLAYBACK_MENU));
ImGui::RadioButton("30 Hz", &temporary.playbackTickRate, 30); ImGui::RadioButton("30 Hz", &temporary.playbackTickRate, 30);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_PLAYBACK_TICK_RATE)); tooltip_set(TOOLTIP_PLAYBACK_TICK_RATE);
ImGui::SameLine(); ImGui::SameLine();
ImGui::RadioButton("60 Hz", &temporary.playbackTickRate, 60); ImGui::RadioButton("60 Hz", &temporary.playbackTickRate, 60);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_PLAYBACK_TICK_RATE)); tooltip_set(TOOLTIP_PLAYBACK_TICK_RATE);
ImGui::SeparatorText(localize.get(LABEL_LOCALIZATION)); ImGui::SeparatorText(localize.get(LABEL_LOCALIZATION));
ImGui::Combo(localize.get(LABEL_LANGUAGE), &temporary.language, LANGUAGE_STRINGS, LANGUAGE_COUNT); ImGui::Combo(localize.get(LABEL_LANGUAGE), &temporary.language, LANGUAGE_STRINGS, LANGUAGE_COUNT);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_LANGUAGE)); tooltip_set(TOOLTIP_LANGUAGE);
ImGui::SeparatorText(localize.get(LABEL_THEME)); ImGui::SeparatorText(localize.get(LABEL_THEME));
@@ -65,28 +65,28 @@ void Configure::update(Manager& manager, Settings& settings)
ImGui::SeparatorText(localize.get(LABEL_AUTOSAVE)); ImGui::SeparatorText(localize.get(LABEL_AUTOSAVE));
ImGui::Checkbox(localize.get(BASIC_ENABLED), &temporary.fileIsAutosave); ImGui::Checkbox(localize.get(BASIC_ENABLED), &temporary.fileIsAutosave);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_AUTOSAVE_ENABLED)); tooltip_set(TOOLTIP_AUTOSAVE_ENABLED);
ImGui::SeparatorText(localize.get(LABEL_AUTO_RESOURCE_RELOAD)); ImGui::SeparatorText(localize.get(LABEL_AUTO_RESOURCE_RELOAD));
ImGui::PushID(LABEL_AUTO_RESOURCE_RELOAD); ImGui::PushID(LABEL_AUTO_RESOURCE_RELOAD);
ImGui::Checkbox(localize.get(BASIC_ENABLED), &temporary.fileIsAutoReloadResources); ImGui::Checkbox(localize.get(BASIC_ENABLED), &temporary.fileIsAutoReloadResources);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_AUTO_RESOURCE_RELOAD)); tooltip_set(TOOLTIP_AUTO_RESOURCE_RELOAD);
ImGui::PopID(); ImGui::PopID();
ImGui::SeparatorText(localize.get(LABEL_SNAPSHOTS)); ImGui::SeparatorText(localize.get(LABEL_SNAPSHOTS));
input_int_range(localize.get(LABEL_STACK_SIZE), temporary.fileSnapshotStackSize, 0, 100); input_int_range(localize.get(LABEL_STACK_SIZE), temporary.fileSnapshotStackSize, 0, 100);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_STACK_SIZE)); tooltip_set(TOOLTIP_STACK_SIZE);
ImGui::SeparatorText(localize.get(LABEL_OPTIONS)); ImGui::SeparatorText(localize.get(LABEL_OPTIONS));
ImGui::Checkbox(localize.get(LABEL_OVERWRITE_WARNING), &temporary.fileIsWarnOverwrite); ImGui::Checkbox(localize.get(LABEL_OVERWRITE_WARNING), &temporary.fileIsWarnOverwrite);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_OVERWRITE_WARNING)); tooltip_set(TOOLTIP_OVERWRITE_WARNING);
ImGui::SameLine(); ImGui::SameLine();
ImGui::Checkbox(localize.get(LABEL_ISAAC_COMPATIBILITY_WARNING), &temporary.fileIsWarnIsaac); ImGui::Checkbox(localize.get(LABEL_ISAAC_COMPATIBILITY_WARNING), &temporary.fileIsWarnIsaac);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ISAAC_COMPATIBILITY_WARNING)); tooltip_set(TOOLTIP_ISAAC_COMPATIBILITY_WARNING);
ImGui::SeparatorText(localize.get(LABEL_SERIALIZATION)); ImGui::SeparatorText(localize.get(LABEL_SERIALIZATION));
ImGui::Checkbox(localize.get(LABEL_SAVE_AS_JSON), &temporary.fileIsJson); ImGui::Checkbox(localize.get(LABEL_SAVE_AS_JSON), &temporary.fileIsJson);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SAVE_AS_JSON)); tooltip_set(TOOLTIP_SAVE_AS_JSON);
} }
ImGui::EndChild(); ImGui::EndChild();
@@ -101,16 +101,16 @@ void Configure::update(Manager& manager, Settings& settings)
input_float_range(localize.get(LABEL_REPEAT_DELAY), temporary.keyboardRepeatDelay, 0.05f, 1.0f, 0.05f, input_float_range(localize.get(LABEL_REPEAT_DELAY), temporary.keyboardRepeatDelay, 0.05f, 1.0f, 0.05f,
0.05f, "%.2f"); 0.05f, "%.2f");
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_REPEAT_DELAY)); tooltip_set(TOOLTIP_REPEAT_DELAY);
input_float_range(localize.get(LABEL_REPEAT_RATE), temporary.keyboardRepeatRate, 0.005f, 1.0f, 0.005f, input_float_range(localize.get(LABEL_REPEAT_RATE), temporary.keyboardRepeatRate, 0.005f, 1.0f, 0.005f,
0.005f, "%.3f"); 0.005f, "%.3f");
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_REPEAT_DELAY)); tooltip_set(TOOLTIP_REPEAT_DELAY);
ImGui::SeparatorText(localize.get(LABEL_TOOL)); ImGui::SeparatorText(localize.get(LABEL_TOOL));
ImGui::Checkbox(localize.get(LABEL_MOVE_TOOL_SNAP), &temporary.inputIsMoveToolSnapToMouse); ImGui::Checkbox(localize.get(LABEL_MOVE_TOOL_SNAP), &temporary.inputIsMoveToolSnapToMouse);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_MOVE_TOOL_SNAP)); tooltip_set(TOOLTIP_MOVE_TOOL_SNAP);
} }
ImGui::EndChild(); ImGui::EndChild();
@@ -216,18 +216,18 @@ void Configure::update(Manager& manager, Settings& settings)
isSet = true; isSet = true;
} }
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SETTINGS_SAVE)); tooltip_set(TOOLTIP_SETTINGS_SAVE);
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button(localize.get(LABEL_USE_DEFAULT_SETTINGS), widgetSize)) if (ImGui::Button(localize.get(LABEL_USE_DEFAULT_SETTINGS), widgetSize))
temporary = Settings(); temporary = Settings();
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_USE_DEFAULT_SETTINGS)); tooltip_set(TOOLTIP_USE_DEFAULT_SETTINGS);
ImGui::SameLine(); ImGui::SameLine();
shortcut(manager.chords[SHORTCUT_CLOSE]); shortcut(manager.chords[SHORTCUT_CLOSE]);
if (ImGui::Button(localize.get(LABEL_CLOSE), widgetSize)) if (ImGui::Button(localize.get(LABEL_CLOSE), widgetSize))
isSet = true; isSet = true;
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CLOSE_SETTINGS)); tooltip_set(TOOLTIP_CLOSE_SETTINGS);
} }
+6 -13
View File
@@ -201,9 +201,7 @@ void Documents::update(Taskbar& taskbar, Manager& manager, Settings& settings, R
auto isRequested = i == manager.pendingSelected; auto isRequested = i == manager.pendingSelected;
auto font = isDocumentDirty ? FONT_ITALICS : FONT_REGULAR; auto font = isDocumentDirty ? FONT_ITALICS : FONT_REGULAR;
auto filename = path_to_utf8(document.filename_get()); auto filename = path_to_utf8(document.filename_get());
auto string = isDocumentDirty auto string = isDocumentDirty ? localize_format(FORMAT_NOT_SAVED, filename) : filename;
? std::vformat(localize.get(FORMAT_NOT_SAVED), std::make_format_args(filename))
: filename;
auto label = std::format("{}###Document{}", string, document.tabId); auto label = std::format("{}###Document{}", string, document.tabId);
auto imguiId = ImGui::GetCurrentWindow()->GetID(label.c_str()); auto imguiId = ImGui::GetCurrentWindow()->GetID(label.c_str());
documentTabs.push_back({imguiId, document.tabId}); documentTabs.push_back({imguiId, document.tabId});
@@ -266,9 +264,7 @@ void Documents::update(Taskbar& taskbar, Manager& manager, Settings& settings, R
ImGui::EndTabBar(); ImGui::EndTabBar();
} }
closePopup.trigger(); if (closePopup.begin())
if (ImGui::BeginPopupModal(closePopup.label(), &closePopup.isOpen, ImGuiWindowFlags_NoResize))
{ {
if (closeDocumentIndex >= 0 && closeDocumentIndex < (int)manager.documents.size()) if (closeDocumentIndex >= 0 && closeDocumentIndex < (int)manager.documents.size())
{ {
@@ -281,7 +277,7 @@ void Documents::update(Taskbar& taskbar, Manager& manager, Settings& settings, R
isDocumentDirty && isSpritesheetDirty isDocumentDirty && isSpritesheetDirty
? LABEL_DOCUMENT_AND_SPRITESHEETS_MODIFIED_PROMPT ? LABEL_DOCUMENT_AND_SPRITESHEETS_MODIFIED_PROMPT
: (isDocumentDirty ? LABEL_DOCUMENT_MODIFIED_PROMPT : LABEL_SPRITESHEETS_MODIFIED_PROMPT); : (isDocumentDirty ? LABEL_DOCUMENT_MODIFIED_PROMPT : LABEL_SPRITESHEETS_MODIFIED_PROMPT);
auto prompt = std::vformat(localize.get(promptLabel), std::make_format_args(filename)); auto prompt = localize_format(promptLabel, filename);
ImGui::TextUnformatted(prompt.c_str()); ImGui::TextUnformatted(prompt.c_str());
auto widgetSize = widget_size_with_row_get(3); auto widgetSize = widget_size_with_row_get(3);
@@ -374,10 +370,7 @@ void Documents::update(Taskbar& taskbar, Manager& manager, Settings& settings, R
drag_drop_reset(); drag_drop_reset();
else if (manager.anm2DragDropMergePopup.is_open()) else if (manager.anm2DragDropMergePopup.is_open())
{ {
manager.anm2DragDropMergePopup.trigger(); if (manager.anm2DragDropMergePopup.begin())
if (ImGui::BeginPopupModal(manager.anm2DragDropMergePopup.label(), &manager.anm2DragDropMergePopup.isOpen,
ImGuiWindowFlags_NoResize))
{ {
auto document = manager.get(); auto document = manager.get();
manager.anm2DragDropMergePreset = manager.anm2DragDropMergePreset =
@@ -388,7 +381,7 @@ void Documents::update(Taskbar& taskbar, Manager& manager, Settings& settings, R
ImGui::PushID(preset); ImGui::PushID(preset);
ImGui::RadioButton(localize.get(ANM2_DRAG_DROP_MERGE_PRESET_LABELS[preset]), ImGui::RadioButton(localize.get(ANM2_DRAG_DROP_MERGE_PRESET_LABELS[preset]),
&manager.anm2DragDropMergePreset, preset); &manager.anm2DragDropMergePreset, preset);
ImGui::SetItemTooltip("%s", localize.get(ANM2_DRAG_DROP_MERGE_PRESET_TOOLTIPS[preset])); tooltip_set(ANM2_DRAG_DROP_MERGE_PRESET_TOOLTIPS[preset]);
ImGui::PopID(); ImGui::PopID();
} }
@@ -459,7 +452,7 @@ void Documents::update(Taskbar& taskbar, Manager& manager, Settings& settings, R
}}); }});
drag_drop_reset(); drag_drop_reset();
} }
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_LIBRARY_ADD)); tooltip_set(TOOLTIP_LIBRARY_ADD);
ImGui::Separator(); ImGui::Separator();
+22 -22
View File
@@ -132,7 +132,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
document.frame_references_set({reference}); document.frame_references_set({reference});
}); });
} }
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_TRIGGER_AT_FRAME)); tooltip_set(TOOLTIP_TRIGGER_AT_FRAME);
if (ImGui::Checkbox(localize.get(BASIC_VISIBLE), if (ImGui::Checkbox(localize.get(BASIC_VISIBLE),
frame ? &useFrame.isVisible : &dummy_value<bool>()) && frame ? &useFrame.isVisible : &dummy_value<bool>()) &&
@@ -144,7 +144,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
frame.isVisible = isVisible; frame.isVisible = isVisible;
}); });
} }
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_TRIGGER_VISIBILITY)); tooltip_set(TOOLTIP_TRIGGER_VISIBILITY);
// A trigger's events or sounds: a combo for each, then Add and Remove (the last). // A trigger's events or sounds: a combo for each, then Add and Remove (the last).
auto trigger_ids_draw = [&](StringType label, std::vector<int> Frame::* member, auto trigger_ids_draw = [&](StringType label, std::vector<int> Frame::* member,
@@ -164,7 +164,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
if (index < (frame.*member).size()) if (index < (frame.*member).size())
(frame.*member)[index] = id; (frame.*member)[index] = id;
}); });
ImGui::SetItemTooltip("%s", localize.get(tooltip)); tooltip_set(tooltip);
ImGui::PopID(); ImGui::PopID();
} }
ImGui::EndChild(); ImGui::EndChild();
@@ -175,7 +175,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
[member](Document&, Frame& frame, Track*, const Reference&) { [member](Document&, Frame& frame, Track*, const Reference&) {
(frame.*member).push_back(-1); (frame.*member).push_back(-1);
}); });
ImGui::SetItemTooltip("%s", localize.get(addTooltip)); tooltip_set(addTooltip);
ImGui::SameLine(); ImGui::SameLine();
ImGui::BeginDisabled((useFrame.*member).empty()); ImGui::BeginDisabled((useFrame.*member).empty());
if (ImGui::Button(localize.get(BASIC_REMOVE), widgetSize) && frame) if (ImGui::Button(localize.get(BASIC_REMOVE), widgetSize) && frame)
@@ -184,7 +184,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
if (!(frame.*member).empty()) if (!(frame.*member).empty())
(frame.*member).pop_back(); (frame.*member).pop_back();
}); });
ImGui::SetItemTooltip("%s", localize.get(removeTooltip)); tooltip_set(removeTooltip);
ImGui::EndDisabled(); ImGui::EndDisabled();
ImGui::PopID(); ImGui::PopID();
}; };
@@ -219,7 +219,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
[value, member = field.member](Document&, Frame& frame, Track*, const Reference&) { [value, member = field.member](Document&, Frame& frame, Track*, const Reference&) {
frame.*member = value; frame.*member = value;
}); });
ImGui::SetItemTooltip("%s", localize.get(field.tooltip)); tooltip_set(field.tooltip);
ImGui::EndDisabled(); ImGui::EndDisabled();
} }
@@ -230,7 +230,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
[rotation = useFrame.rotation](Document&, Frame& frame, Track*, const Reference&) { [rotation = useFrame.rotation](Document&, Frame& frame, Track*, const Reference&) {
frame.rotation = rotation; frame.rotation = rotation;
}); });
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ROTATION)); tooltip_set(TOOLTIP_ROTATION);
if (input_int_range(localize.get(BASIC_DURATION), frame ? useFrame.duration : dummy_value<int>(), if (input_int_range(localize.get(BASIC_DURATION), frame ? useFrame.duration : dummy_value<int>(),
frame ? FRAME_DURATION_MIN : 0, FRAME_DURATION_MAX, STEP, STEP_FAST, frame ? FRAME_DURATION_MIN : 0, FRAME_DURATION_MAX, STEP, STEP_FAST,
@@ -243,7 +243,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
frame.duration = duration; frame.duration = duration;
}); });
} }
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_DURATION)); tooltip_set(TOOLTIP_DURATION);
ImGui::BeginDisabled(type != LAYER); ImGui::BeginDisabled(type != LAYER);
if (input_int_range(localize.get(BASIC_DEPTH), if (input_int_range(localize.get(BASIC_DEPTH),
@@ -256,7 +256,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
frame_edit(EDIT_STATE_COMPLETE, EDIT_FRAME_DEPTH, frame_edit(EDIT_STATE_COMPLETE, EDIT_FRAME_DEPTH,
[depth](Document&, Frame& frame, Track*, const Reference&) { frame.depth = depth; }); [depth](Document&, Frame& frame, Track*, const Reference&) { frame.depth = depth; });
} }
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_DEPTH)); tooltip_set(TOOLTIP_DEPTH);
ImGui::EndDisabled(); ImGui::EndDisabled();
auto tintEdit = auto tintEdit =
@@ -265,7 +265,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
[tint = useFrame.tint](Document&, Frame& frame, Track*, const Reference&) { [tint = useFrame.tint](Document&, Frame& frame, Track*, const Reference&) {
frame.tint = tint; frame.tint = tint;
}); });
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_TINT)); tooltip_set(TOOLTIP_TINT);
auto colorOffsetEdit = color_edit4_persistent(localize.get(BASIC_COLOR_OFFSET), auto colorOffsetEdit = color_edit4_persistent(localize.get(BASIC_COLOR_OFFSET),
frame ? &useFrame.colorOffset : &dummy_value<Vec4>()); frame ? &useFrame.colorOffset : &dummy_value<Vec4>());
@@ -273,7 +273,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
[colorOffset = useFrame.colorOffset](Document&, Frame& frame, Track*, const Reference&) { [colorOffset = useFrame.colorOffset](Document&, Frame& frame, Track*, const Reference&) {
frame.colorOffset = colorOffset; frame.colorOffset = colorOffset;
}); });
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_COLOR_OFFSET)); tooltip_set(TOOLTIP_COLOR_OFFSET);
ImGui::BeginDisabled(type != LAYER); ImGui::BeginDisabled(type != LAYER);
auto blurEdit = drag_float_persistent( auto blurEdit = drag_float_persistent(
@@ -283,7 +283,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
[blur = useFrame.blur](Document&, Frame& frame, Track*, const Reference&) { [blur = useFrame.blur](Document&, Frame& frame, Track*, const Reference&) {
frame.blur = std::clamp(blur, 0.0f, FRAME_BLUR_MAX); frame.blur = std::clamp(blur, 0.0f, FRAME_BLUR_MAX);
}); });
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_BLUR)); tooltip_set(TOOLTIP_BLUR);
ImGui::EndDisabled(); ImGui::EndDisabled();
ImGui::BeginDisabled(type != LAYER || isAnimationLayer); ImGui::BeginDisabled(type != LAYER || isAnimationLayer);
@@ -302,7 +302,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
frame.pivot = effectiveFrame.pivot; frame.pivot = effectiveFrame.pivot;
}); });
} }
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_REGION)); tooltip_set(TOOLTIP_REGION);
ImGui::EndDisabled(); ImGui::EndDisabled();
auto interpolationValue = frame ? static_cast<int>(useFrame.interpolation) : dummy_value<int>(); auto interpolationValue = frame ? static_cast<int>(useFrame.interpolation) : dummy_value<int>();
@@ -313,7 +313,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
[interpolationValue](Document&, Frame& frame, Track*, const Reference&) { [interpolationValue](Document&, Frame& frame, Track*, const Reference&) {
frame.interpolation = static_cast<Interpolation>(interpolationValue); frame.interpolation = static_cast<Interpolation>(interpolationValue);
}); });
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_FRAME_INTERPOLATION)); tooltip_set(TOOLTIP_FRAME_INTERPOLATION);
ImGui::BeginDisabled(type != LAYER || isAnimationLayer); ImGui::BeginDisabled(type != LAYER || isAnimationLayer);
if (combo_id_mapped(localize.get(BASIC_SHADER), if (combo_id_mapped(localize.get(BASIC_SHADER),
@@ -327,7 +327,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
frame.shaderId = shaderId; frame.shaderId = shaderId;
}); });
} }
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_FRAME_SHADER)); tooltip_set(TOOLTIP_FRAME_SHADER);
ImGui::EndDisabled(); ImGui::EndDisabled();
if (ImGui::Checkbox(localize.get(BASIC_VISIBLE), if (ImGui::Checkbox(localize.get(BASIC_VISIBLE),
@@ -340,7 +340,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
frame.isVisible = isVisible; frame.isVisible = isVisible;
}); });
} }
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_FRAME_VISIBILITY)); tooltip_set(TOOLTIP_FRAME_VISIBILITY);
auto widgetSize = widget_size_with_row_get(2); auto widgetSize = widget_size_with_row_get(2);
@@ -356,7 +356,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
if (isPositionFlipped) if (isPositionFlipped)
frame.position[axis] = -frame.position[axis]; frame.position[axis] = -frame.position[axis];
}); });
ImGui::SetItemTooltip("%s", localize.get(FLIP_BUTTONS[axis].tooltip)); tooltip_set(FLIP_BUTTONS[axis].tooltip);
} }
if (isAnimationLayer && frame) if (isAnimationLayer && frame)
@@ -368,7 +368,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
labels.insert(labels.begin(), localize.get(TEXT_LAYER_ANIMATION)); labels.insert(labels.begin(), localize.get(TEXT_LAYER_ANIMATION));
bool isChildChanged = combo_string_mapped(localize.get(LABEL_ANIMATION), bool isChildChanged = combo_string_mapped(localize.get(LABEL_ANIMATION),
&useFrame.childAnimation, values, labels); &useFrame.childAnimation, values, labels);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CHILD_ANIMATION)); tooltip_set(TOOLTIP_CHILD_ANIMATION);
std::vector<const char*> modeLabels; std::vector<const char*> modeLabels;
for (auto label : CHILD_MODE_LABELS) for (auto label : CHILD_MODE_LABELS)
@@ -379,19 +379,19 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
useFrame.childMode = (ChildMode)mode; useFrame.childMode = (ChildMode)mode;
isChildChanged = true; isChildChanged = true;
} }
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CHILD_MODE)); tooltip_set(TOOLTIP_CHILD_MODE);
ImGui::BeginDisabled(useFrame.isChildStartRandom); ImGui::BeginDisabled(useFrame.isChildStartRandom);
isChildChanged |= input_int_range(localize.get(LABEL_START_FRAME), useFrame.childStart, 0, isChildChanged |= input_int_range(localize.get(LABEL_START_FRAME), useFrame.childStart, 0,
FRAME_NUM_MAX, STEP, STEP_FAST); FRAME_NUM_MAX, STEP, STEP_FAST);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CHILD_START)); tooltip_set(TOOLTIP_CHILD_START);
ImGui::EndDisabled(); ImGui::EndDisabled();
isChildChanged |= ImGui::Checkbox(localize.get(LABEL_RANDOM), &useFrame.isChildStartRandom); isChildChanged |= ImGui::Checkbox(localize.get(LABEL_RANDOM), &useFrame.isChildStartRandom);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CHILD_START_RANDOM)); tooltip_set(TOOLTIP_CHILD_START_RANDOM);
ImGui::SameLine(); ImGui::SameLine();
isChildChanged |= ImGui::Checkbox(localize.get(LABEL_RESTART), &useFrame.isChildRestart); isChildChanged |= ImGui::Checkbox(localize.get(LABEL_RESTART), &useFrame.isChildRestart);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CHILD_RESTART)); tooltip_set(TOOLTIP_CHILD_RESTART);
if (isChildChanged) if (isChildChanged)
frame_edit(EDIT_STATE_COMPLETE, EDIT_FRAME_CHILD, frame_edit(EDIT_STATE_COMPLETE, EDIT_FRAME_CHILD,
+2 -2
View File
@@ -52,10 +52,10 @@ void GenerateAnimationFromGrid::update(Manager& manager, Document& document, Res
ImGui::InputInt(localize.get(BASIC_DURATION), &delay, STEP, STEP_FAST); ImGui::InputInt(localize.get(BASIC_DURATION), &delay, STEP, STEP_FAST);
ImGui::Separator(); ImGui::Separator();
ImGui::Checkbox(localize.get(LABEL_GENERATE_MAKE_REGIONS), &isMakeRegions); ImGui::Checkbox(localize.get(LABEL_GENERATE_MAKE_REGIONS), &isMakeRegions);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_GENERATE_MAKE_REGIONS)); tooltip_set(TOOLTIP_GENERATE_MAKE_REGIONS);
ImGui::BeginDisabled(!isMakeRegions); ImGui::BeginDisabled(!isMakeRegions);
input_text_string(localize.get(LABEL_FORMAT), &regionNameFormat); input_text_string(localize.get(LABEL_FORMAT), &regionNameFormat);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_GENERATE_REGION_NAME_FORMAT)); tooltip_set(TOOLTIP_GENERATE_REGION_NAME_FORMAT);
ImGui::EndDisabled(); ImGui::EndDisabled();
} }
ImGui::EndChild(); ImGui::EndChild();
+11 -14
View File
@@ -31,9 +31,7 @@ bool ItemProperties::update(Manager& manager, Settings& settings, Document& docu
: std::set<int>{}; : std::set<int>{};
}; };
popup.trigger(); if (popup.begin())
if (ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
{ {
auto close = [&]() { auto close = [&]() {
reset(); reset();
@@ -60,11 +58,11 @@ bool ItemProperties::update(Manager& manager, Settings& settings, Document& docu
spaced_pair( spaced_pair(
[&]() { [&]() {
ImGui::RadioButton(localize.get(LABEL_LAYER), &type, LAYER); ImGui::RadioButton(localize.get(LABEL_LAYER), &type, LAYER);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_LAYER_TYPE)); tooltip_set(TOOLTIP_LAYER_TYPE);
}, },
[&]() { [&]() {
ImGui::RadioButton(localize.get(LABEL_NULL), &type, NULL_); ImGui::RadioButton(localize.get(LABEL_NULL), &type, NULL_);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_NULL_TYPE)); tooltip_set(TOOLTIP_NULL_TYPE);
}); });
ImGui::SeparatorText(localize.get(LABEL_SOURCE)); ImGui::SeparatorText(localize.get(LABEL_SOURCE));
@@ -73,7 +71,7 @@ bool ItemProperties::update(Manager& manager, Settings& settings, Document& docu
spaced_pair( spaced_pair(
[&]() { [&]() {
ImGui::RadioButton(localize.get(LABEL_NEW), &source, SOURCE_NEW); ImGui::RadioButton(localize.get(LABEL_NEW), &source, SOURCE_NEW);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_NEW_ITEM)); tooltip_set(TOOLTIP_NEW_ITEM);
}, },
[&]() { [&]() {
ImGui::BeginDisabled(!isUnusedItems); ImGui::BeginDisabled(!isUnusedItems);
@@ -88,11 +86,11 @@ bool ItemProperties::update(Manager& manager, Settings& settings, Document& docu
spaced_pair( spaced_pair(
[&]() { [&]() {
ImGui::RadioButton(localize.get(LABEL_ALL_ANIMATIONS), &destination, DESTINATION_ALL); ImGui::RadioButton(localize.get(LABEL_ALL_ANIMATIONS), &destination, DESTINATION_ALL);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ITEM_ALL_ANIMATIONS)); tooltip_set(TOOLTIP_ITEM_ALL_ANIMATIONS);
}, },
[&]() { [&]() {
ImGui::RadioButton(localize.get(LABEL_THIS_ANIMATION), &destination, DESTINATION_THIS); ImGui::RadioButton(localize.get(LABEL_THIS_ANIMATION), &destination, DESTINATION_THIS);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ITEM_THIS_ANIMATION)); tooltip_set(TOOLTIP_ITEM_THIS_ANIMATION);
}); });
if (source == SOURCE_NEW) if (source == SOURCE_NEW)
@@ -100,13 +98,13 @@ bool ItemProperties::update(Manager& manager, Settings& settings, Document& docu
ImGui::SeparatorText(localize.get(LABEL_OPTIONS)); ImGui::SeparatorText(localize.get(LABEL_OPTIONS));
input_text_string(localize.get(BASIC_NAME), &edit.name); input_text_string(localize.get(BASIC_NAME), &edit.name);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ITEM_NAME)); tooltip_set(TOOLTIP_ITEM_NAME);
if (type == LAYER) if (type == LAYER)
layer_source_draw(document, edit); layer_source_draw(document, edit);
else if (type == NULL_) else if (type == NULL_)
{ {
ImGui::Checkbox(localize.get(LABEL_RECT), &edit.isShowRect); ImGui::Checkbox(localize.get(LABEL_RECT), &edit.isShowRect);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_NULL_RECT)); tooltip_set(TOOLTIP_NULL_RECT);
} }
} }
else if (animation) else if (animation)
@@ -138,8 +136,7 @@ bool ItemProperties::update(Manager& manager, Settings& settings, Document& docu
{ {
if (auto null = item_get(model.content.nulls, id)) if (auto null = item_get(model.content.nulls, id))
{ {
auto label = auto label = localize_format(FORMAT_NULL, id, null->name);
std::vformat(localize.get(FORMAT_NULL), std::make_format_args(id, null->name));
if (ImGui::Selectable(label.c_str(), isSelected)) if (ImGui::Selectable(label.c_str(), isSelected))
edit.id = id; edit.id = id;
} }
@@ -191,14 +188,14 @@ bool ItemProperties::update(Manager& manager, Settings& settings, Document& docu
close(); close();
} }
ImGui::EndDisabled(); ImGui::EndDisabled();
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ADD_ITEM)); tooltip_set(TOOLTIP_ADD_ITEM);
ImGui::SameLine(); ImGui::SameLine();
shortcut(manager.chords[SHORTCUT_CANCEL]); shortcut(manager.chords[SHORTCUT_CANCEL]);
if (ImGui::Button(localize.get(BASIC_CANCEL), widgetSize)) if (ImGui::Button(localize.get(BASIC_CANCEL), widgetSize))
close(); close();
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CANCEL_ADD_ITEM)); tooltip_set(TOOLTIP_CANCEL_ADD_ITEM);
ImGui::EndPopup(); ImGui::EndPopup();
} }
+10 -11
View File
@@ -27,7 +27,7 @@ static auto& events_get(Model& model)
static void item_tooltip_draw(Resources& resources, const std::string& name, int id) static void item_tooltip_draw(Resources& resources, const std::string& name, int id)
{ {
tooltip_name_draw(resources, name); tooltip_name_draw(resources, name);
ImGui::TextUnformatted(std::vformat(localize.get(FORMAT_ID), std::make_format_args(id)).c_str()); ImGui::TextUnformatted(localize_format(FORMAT_ID, id).c_str());
} }
// "#id name", then what the layer shows: its spritesheet or its animation. // "#id name", then what the layer shows: its spritesheet or its animation.
@@ -36,7 +36,7 @@ std::string layer_label_get(const Layer& layer)
if (layer.is_animation()) if (layer.is_animation())
return std::vformat(localize.get(FORMAT_LAYER_ANIMATION), return std::vformat(localize.get(FORMAT_LAYER_ANIMATION),
std::make_format_args(layer.id, layer.name, layer.animation)); std::make_format_args(layer.id, layer.name, layer.animation));
return std::vformat(localize.get(FORMAT_LAYER), std::make_format_args(layer.id, layer.name, layer.spritesheetId)); return localize_format(FORMAT_LAYER, layer.id, layer.name, layer.spritesheetId);
} }
// Tooltip lines for what a layer shows: its spritesheet, or its animation and the library it's from. // Tooltip lines for what a layer shows: its spritesheet, or its animation and the library it's from.
@@ -79,7 +79,7 @@ void layer_source_draw(Document& document, Manager::ItemEdit& layer)
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::RadioButton(localize.get(label), layer.isAnimation == isAnimation)) if (ImGui::RadioButton(localize.get(label), layer.isAnimation == isAnimation))
layer.isAnimation = isAnimation; layer.isAnimation = isAnimation;
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_LAYER_SOURCE)); tooltip_set(TOOLTIP_LAYER_SOURCE);
} }
ImGui::PopID(); ImGui::PopID();
ImGui::Separator(); ImGui::Separator();
@@ -88,19 +88,19 @@ void layer_source_draw(Document& document, Manager::ItemEdit& layer)
{ {
auto spritesheets = document.choices_get(SelectionKind::SPRITESHEETS); auto spritesheets = document.choices_get(SelectionKind::SPRITESHEETS);
combo_id_mapped(localize.get(LABEL_SPRITESHEET), &layer.spritesheetId, spritesheets.ids, spritesheets.labels); combo_id_mapped(localize.get(LABEL_SPRITESHEET), &layer.spritesheetId, spritesheets.ids, spritesheets.labels);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_LAYER_SPRITESHEET)); tooltip_set(TOOLTIP_LAYER_SPRITESHEET);
return; return;
} }
auto libraries = document.choices_get(SelectionKind::LIBRARIES); auto libraries = document.choices_get(SelectionKind::LIBRARIES);
libraries.labels.front() = localize.get(TEXT_SELF); libraries.labels.front() = localize.get(TEXT_SELF);
combo_id_mapped(localize.get(LABEL_LIBRARY), &layer.libraryId, libraries.ids, libraries.labels); combo_id_mapped(localize.get(LABEL_LIBRARY), &layer.libraryId, libraries.ids, libraries.labels);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_LAYER_LIBRARY)); tooltip_set(TOOLTIP_LAYER_LIBRARY);
auto names = document.animation_names_get(layer.libraryId); auto names = document.animation_names_get(layer.libraryId);
if (layer.animation.empty() && !names.empty()) if (layer.animation.empty() && !names.empty())
layer.animation = names.front(); layer.animation = names.front();
combo_string_mapped(localize.get(LABEL_ANIMATION), &layer.animation, names, names); combo_string_mapped(localize.get(LABEL_ANIMATION), &layer.animation, names, names);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_LAYER_ANIMATION)); tooltip_set(TOOLTIP_LAYER_ANIMATION);
} }
// The layer/null properties popup: adds a new item (id -1) or replaces the edited one, then selects it. // The layer/null properties popup: adds a new item (id -1) or replaces the edited one, then selects it.
@@ -112,15 +112,14 @@ void item_properties_update(Panel& panel, int popupIndex, int rows, SelectionKin
auto& popup = manager.itemPropertiesPopups[popupIndex]; auto& popup = manager.itemPropertiesPopups[popupIndex];
auto& edit = manager.itemEdit; auto& edit = manager.itemEdit;
popup.trigger(); if (popup.begin())
if (ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
{ {
if (ImGui::BeginChild("##Child", child_size_get(rows), ImGuiChildFlags_Borders)) if (ImGui::BeginChild("##Child", child_size_get(rows), ImGuiChildFlags_Borders))
{ {
if (popup.isJustOpened) if (popup.isJustOpened)
ImGui::SetKeyboardFocusHere(); ImGui::SetKeyboardFocusHere();
input_text_string(localize.get(BASIC_NAME), &edit.name); input_text_string(localize.get(BASIC_NAME), &edit.name);
ImGui::SetItemTooltip("%s", localize.get(nameTooltip)); tooltip_set(nameTooltip);
fields_draw(edit); fields_draw(edit);
} }
ImGui::EndChild(); ImGui::EndChild();
@@ -223,7 +222,7 @@ void nulls_update(Panel& panel)
ListRows rows{.label_get = ListRows rows{.label_get =
[&](int id) { [&](int id) {
auto name = item_get(nulls, id)->name; auto name = item_get(nulls, id)->name;
return std::vformat(localize.get(FORMAT_NULL), std::make_format_args(id, name)); return localize_format(FORMAT_NULL, id, name);
}, },
.tooltip_draw = [&](int id) { item_tooltip_draw(resources, item_get(nulls, id)->name, id); }, .tooltip_draw = [&](int id) { item_tooltip_draw(resources, item_get(nulls, id)->name, id); },
.activate = [&](int id) { manager.item_properties_open(ElementType::NULL_ELEMENT, id); }, .activate = [&](int id) { manager.item_properties_open(ElementType::NULL_ELEMENT, id); },
@@ -236,7 +235,7 @@ void nulls_update(Panel& panel)
item_properties_update<Null>(panel, 1, NULL_PROPERTIES_ROWS, SelectionKind::NULLS, TOOLTIP_NULL_NAME, EDIT_ADD_NULL, item_properties_update<Null>(panel, 1, NULL_PROPERTIES_ROWS, SelectionKind::NULLS, TOOLTIP_NULL_NAME, EDIT_ADD_NULL,
EDIT_SET_NULL_PROPERTIES, nulls_get, [](Manager::ItemEdit& null) { EDIT_SET_NULL_PROPERTIES, nulls_get, [](Manager::ItemEdit& null) {
ImGui::Checkbox(localize.get(LABEL_RECT), &null.isShowRect); ImGui::Checkbox(localize.get(LABEL_RECT), &null.isShowRect);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_NULL_RECT)); tooltip_set(TOOLTIP_NULL_RECT);
}); });
} }
+7
View File
@@ -5,6 +5,8 @@
#include "vec.h" #include "vec.h"
#include <imgui/imgui.h> #include <imgui/imgui.h>
#include "localization.h"
constexpr ImVec2 to_imvec2(const Vec2& v) noexcept constexpr ImVec2 to_imvec2(const Vec2& v) noexcept
{ {
return {v.x, v.y}; return {v.x, v.y};
@@ -45,3 +47,8 @@ ImVec2 size_without_footer_get(int = 1);
ImVec2 child_size_get(int = 1); ImVec2 child_size_get(int = 1);
ImVec2 icon_size_get(); ImVec2 icon_size_get();
void set_item_tooltip_shortcut(const char*, const std::string& = {}); void set_item_tooltip_shortcut(const char*, const std::string& = {});
inline void tooltip_set(StringType type)
{
ImGui::SetItemTooltip("%s", localize.get(type));
}
+1 -1
View File
@@ -68,7 +68,7 @@ void libraries_update(Panel& panel)
ListRows rows{.label_get = ListRows rows{.label_get =
[&](int id) { [&](int id) {
auto pathString = path_to_utf8(item_get(libraries, id)->path); auto pathString = path_to_utf8(item_get(libraries, id)->path);
return std::vformat(localize.get(FORMAT_SOUND), std::make_format_args(id, pathString)); return localize_format(FORMAT_SOUND, id, pathString);
}, },
.tooltip_draw = .tooltip_draw =
[&](int id) { [&](int id) {
+6 -6
View File
@@ -24,9 +24,9 @@ void onionskin_update(Manager& manager, Settings& settings)
ImGui::PushID(separator); ImGui::PushID(separator);
ImGui::SeparatorText(separator); ImGui::SeparatorText(separator);
input_int_range(localize.get(BASIC_FRAMES), frames, 0, FRAMES_MAX); input_int_range(localize.get(BASIC_FRAMES), frames, 0, FRAMES_MAX);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ONIONSKIN_FRAMES)); tooltip_set(TOOLTIP_ONIONSKIN_FRAMES);
ImGui::ColorEdit3(localize.get(BASIC_COLOR), values_get(color)); ImGui::ColorEdit3(localize.get(BASIC_COLOR), values_get(color));
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ONIONSKIN_COLOR)); tooltip_set(TOOLTIP_ONIONSKIN_COLOR);
ImGui::PopID(); ImGui::PopID();
}; };
@@ -37,17 +37,17 @@ void onionskin_update(Manager& manager, Settings& settings)
configure_widgets(localize.get(BASIC_AFTER), afterCount, afterColor); configure_widgets(localize.get(BASIC_AFTER), afterCount, afterColor);
ImGui::SeparatorText(localize.get(BASIC_MODE)); ImGui::SeparatorText(localize.get(BASIC_MODE));
ImGui::RadioButton(localize.get(BASIC_TIME), &mode, (int)OnionskinMode::TIME); ImGui::RadioButton(localize.get(BASIC_TIME), &mode, (int)OnionskinMode::TIME);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ONIONSKIN_TIME)); tooltip_set(TOOLTIP_ONIONSKIN_TIME);
ImGui::SameLine(); ImGui::SameLine();
ImGui::RadioButton(localize.get(BASIC_INDEX), &mode, (int)OnionskinMode::INDEX); ImGui::RadioButton(localize.get(BASIC_INDEX), &mode, (int)OnionskinMode::INDEX);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ONIONSKIN_INDEX)); tooltip_set(TOOLTIP_ONIONSKIN_INDEX);
ImGui::SeparatorText(localize.get(LABEL_OPTIONS)); ImGui::SeparatorText(localize.get(LABEL_OPTIONS));
ImGui::Checkbox(localize.get(LABEL_PIVOT_PATH), &settings.onionskinIsPivotPath); ImGui::Checkbox(localize.get(LABEL_PIVOT_PATH), &settings.onionskinIsPivotPath);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_PIVOT_PATH)); tooltip_set(TOOLTIP_PIVOT_PATH);
ImGui::SameLine(); ImGui::SameLine();
ImGui::Checkbox(localize.get(LABEL_ONLY_SELECTED_ITEM), &settings.onionskinIsOnlySelected); ImGui::Checkbox(localize.get(LABEL_ONLY_SELECTED_ITEM), &settings.onionskinIsOnlySelected);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ONLY_SELECTED_ITEM)); tooltip_set(TOOLTIP_ONLY_SELECTED_ITEM);
} }
ImGui::End(); ImGui::End();
+1 -2
View File
@@ -413,8 +413,7 @@ void content_remove_action_add(Actions& actions, Panel& panel, ElementType type,
static void content_remove_popup_draw(Panel& panel) static void content_remove_popup_draw(Panel& panel)
{ {
auto& popup = panel.state.removePopup; auto& popup = panel.state.removePopup;
popup.trigger(); if (!popup.begin())
if (!ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
return popup.end(); return popup.end();
auto& removal = panel.state.removal; auto& removal = panel.state.removal;
ImGui::TextUnformatted(localize.get(TEXT_REMOVE_LIST)); ImGui::TextUnformatted(localize.get(TEXT_REMOVE_LIST));
+8
View File
@@ -73,6 +73,14 @@ void PopupHelper::trigger()
} }
} }
// Opens the popup when triggered, and begins it as a fixed-size modal. True while it shows: end it with
// ImGui::EndPopup().
bool PopupHelper::begin()
{
trigger();
return ImGui::BeginPopupModal(label(), &isOpen, ImGuiWindowFlags_NoResize);
}
void PopupHelper::end() void PopupHelper::end()
{ {
isJustOpened = false; isJustOpened = false;
+1
View File
@@ -42,6 +42,7 @@ public:
bool is_open(); bool is_open();
void open(); void open();
void trigger(); void trigger();
bool begin();
void end(); void end();
void close(); void close();
}; };
+8 -10
View File
@@ -255,8 +255,7 @@ static void region_properties_open(RegionsPanel& regions, Document& document, in
static void region_properties_popup_update(Panel& panel, RegionsPanel& regions) static void region_properties_popup_update(Panel& panel, RegionsPanel& regions)
{ {
auto& popup = regions.propertiesPopup; auto& popup = regions.propertiesPopup;
popup.trigger(); if (!popup.begin())
if (!ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
return popup.end(); return popup.end();
auto& region = regions.editRegion; auto& region = regions.editRegion;
@@ -265,7 +264,7 @@ static void region_properties_popup_update(Panel& panel, RegionsPanel& regions)
if (popup.isJustOpened) if (popup.isJustOpened)
ImGui::SetKeyboardFocusHere(); ImGui::SetKeyboardFocusHere();
input_text_string(localize.get(BASIC_NAME), &region.name); input_text_string(localize.get(BASIC_NAME), &region.name);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ITEM_NAME)); tooltip_set(TOOLTIP_ITEM_NAME);
ImGui::DragFloat2(localize.get(BASIC_CROP), values_get(region.crop), DRAG_SPEED, 0.0f, 0.0f, ImGui::DragFloat2(localize.get(BASIC_CROP), values_get(region.crop), DRAG_SPEED, 0.0f, 0.0f,
vec2_format_get(region.crop)); vec2_format_get(region.crop));
ImGui::DragFloat2(localize.get(BASIC_SIZE), values_get(region.size), DRAG_SPEED, 0.0f, 0.0f, ImGui::DragFloat2(localize.get(BASIC_SIZE), values_get(region.size), DRAG_SPEED, 0.0f, 0.0f,
@@ -282,7 +281,7 @@ static void region_properties_popup_update(Panel& panel, RegionsPanel& regions)
if (ImGui::Combo(localize.get(LABEL_REGION_PROPERTIES_ORIGIN), &originIndex, originOptions, if (ImGui::Combo(localize.get(LABEL_REGION_PROPERTIES_ORIGIN), &originIndex, originOptions,
(int)std::size(originOptions))) (int)std::size(originOptions)))
region.origin = ORIGIN_COMBO_ORDER[originIndex]; region.origin = ORIGIN_COMBO_ORDER[originIndex];
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_REGION_PROPERTIES_ORIGIN)); tooltip_set(TOOLTIP_REGION_PROPERTIES_ORIGIN);
region_pivot_apply(region); region_pivot_apply(region);
} }
ImGui::EndChild(); ImGui::EndChild();
@@ -333,8 +332,7 @@ static void region_export_popup_update(Panel& panel, RegionsPanel& regions)
auto region = spritesheet ? item_get(spritesheet->regions, regions.exportId) : nullptr; auto region = spritesheet ? item_get(spritesheet->regions, regions.exportId) : nullptr;
auto& popup = regions.exportPopup; auto& popup = regions.exportPopup;
popup.trigger(); if (!popup.begin())
if (!ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
return popup.end(); return popup.end();
if (!region) if (!region)
@@ -358,11 +356,11 @@ static void region_export_popup_update(Panel& panel, RegionsPanel& regions)
dialog.file_save(Dialog::REGION_EXPORT_PATH_SET, settings.exportRegionPath); dialog.file_save(Dialog::REGION_EXPORT_PATH_SET, settings.exportRegionPath);
ImGui::SameLine(); ImGui::SameLine();
input_text_path(localize.get(LABEL_OUTPUT_PATH), &settings.exportRegionPath); input_text_path(localize.get(LABEL_OUTPUT_PATH), &settings.exportRegionPath);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_OUTPUT_PATH)); tooltip_set(TOOLTIP_OUTPUT_PATH);
ImGui::Checkbox(localize.get(LABEL_EXPORT_MAKE_SPRITESHEET), &settings.isExportRegionMakeSpritesheet); ImGui::Checkbox(localize.get(LABEL_EXPORT_MAKE_SPRITESHEET), &settings.isExportRegionMakeSpritesheet);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_EXPORT_MAKE_SPRITESHEET)); tooltip_set(TOOLTIP_EXPORT_MAKE_SPRITESHEET);
ImGui::Checkbox(localize.get(LABEL_EXPORT_REMOVE_CURRENT_REGION), &settings.isExportRegionRemoveCurrent); ImGui::Checkbox(localize.get(LABEL_EXPORT_REMOVE_CURRENT_REGION), &settings.isExportRegionRemoveCurrent);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_EXPORT_REMOVE_CURRENT_REGION)); tooltip_set(TOOLTIP_EXPORT_REMOVE_CURRENT_REGION);
} }
ImGui::EndChild(); ImGui::EndChild();
@@ -486,7 +484,7 @@ void regions_update(Panel& panel, RegionsPanel& regions)
(region.origin == Origin::CUSTOM (region.origin == Origin::CUSTOM
? std::vformat(localize.get(FORMAT_PIVOT), ? std::vformat(localize.get(FORMAT_PIVOT),
std::make_format_args(region.pivot.x, region.pivot.y)) std::make_format_args(region.pivot.x, region.pivot.y))
: std::vformat(localize.get(FORMAT_ORIGIN), std::make_format_args(originLabel))) : localize_format(FORMAT_ORIGIN, originLabel))
.c_str()); .c_str());
}); });
}, },
+17 -17
View File
@@ -130,7 +130,7 @@ void RenderAnimation::update(Manager& manager, Document& document, Resources& re
dialog.file_open(Dialog::FFMPEG_PATH_SET); dialog.file_open(Dialog::FFMPEG_PATH_SET);
ImGui::SameLine(); ImGui::SameLine();
input_text_path(localize.get(LABEL_FFMPEG_PATH), &ffmpegPath); input_text_path(localize.get(LABEL_FFMPEG_PATH), &ffmpegPath);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_FFMPEG_PATH)); tooltip_set(TOOLTIP_FFMPEG_PATH);
if (dialog.is_selected(Dialog::FFMPEG_PATH_SET)) if (dialog.is_selected(Dialog::FFMPEG_PATH_SET))
{ {
@@ -149,7 +149,7 @@ void RenderAnimation::update(Manager& manager, Document& document, Resources& re
ImGui::SameLine(); ImGui::SameLine();
auto pathLabel = type == RENDER_PNGS ? LABEL_OUTPUT_DIRECTORY : LABEL_OUTPUT_PATH; auto pathLabel = type == RENDER_PNGS ? LABEL_OUTPUT_DIRECTORY : LABEL_OUTPUT_PATH;
input_text_path(localize.get(pathLabel), &path); input_text_path(localize.get(pathLabel), &path);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_OUTPUT_PATH)); tooltip_set(TOOLTIP_OUTPUT_PATH);
if (dialog.is_selected(dialogType)) if (dialog.is_selected(dialogType))
{ {
@@ -160,7 +160,7 @@ void RenderAnimation::update(Manager& manager, Document& document, Resources& re
if (ImGui::Combo(localize.get(LABEL_TYPE), &type, RENDER_STRINGS, RENDER_COUNT)) if (ImGui::Combo(localize.get(LABEL_TYPE), &type, RENDER_STRINGS, RENDER_COUNT))
path.replace_extension(RENDER_EXTENSIONS[type]); path.replace_extension(RENDER_EXTENSIONS[type]);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_RENDER_TYPE)); tooltip_set(TOOLTIP_RENDER_TYPE);
if (type == RENDER_PNGS || type == RENDER_SPRITESHEET) if (type == RENDER_PNGS || type == RENDER_SPRITESHEET)
ImGui::Separator(); ImGui::Separator();
@@ -168,21 +168,21 @@ void RenderAnimation::update(Manager& manager, Document& document, Resources& re
if (type == RENDER_PNGS) if (type == RENDER_PNGS)
{ {
input_text_path(localize.get(LABEL_FORMAT), &format); input_text_path(localize.get(LABEL_FORMAT), &format);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_FORMAT)); tooltip_set(TOOLTIP_FORMAT);
} }
else if (type == RENDER_SPRITESHEET) else if (type == RENDER_SPRITESHEET)
{ {
input_int_range(localize.get(LABEL_GENERATE_ROWS), rows, 1, renderFrameNum); input_int_range(localize.get(LABEL_GENERATE_ROWS), rows, 1, renderFrameNum);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ROWS)); tooltip_set(TOOLTIP_ROWS);
input_int_range(localize.get(LABEL_GENERATE_COLUMNS), columns, 1, renderFrameNum); input_int_range(localize.get(LABEL_GENERATE_COLUMNS), columns, 1, renderFrameNum);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_COLUMNS)); tooltip_set(TOOLTIP_COLUMNS);
} }
ImGui::Separator(); ImGui::Separator();
ImGui::Checkbox(localize.get(LABEL_CUSTOM_RANGE), &isRange); ImGui::Checkbox(localize.get(LABEL_CUSTOM_RANGE), &isRange);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CUSTOM_RANGE)); tooltip_set(TOOLTIP_CUSTOM_RANGE);
ImGui::SameLine(); ImGui::SameLine();
@@ -190,21 +190,21 @@ void RenderAnimation::update(Manager& manager, Document& document, Resources& re
reference.itemType == TRIGGER); reference.itemType == TRIGGER);
if (ImGui::Button(localize.get(LABEL_TO_SELECTED_FRAMES))) if (ImGui::Button(localize.get(LABEL_TO_SELECTED_FRAMES)))
range_to_frames_set(manager, document); range_to_frames_set(manager, document);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_TO_SELECTED_FRAMES)); tooltip_set(TOOLTIP_TO_SELECTED_FRAMES);
ImGui::EndDisabled(); ImGui::EndDisabled();
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button(localize.get(LABEL_TO_ANIMATION_RANGE))) if (ImGui::Button(localize.get(LABEL_TO_ANIMATION_RANGE)))
range_to_animation_set(manager, document); range_to_animation_set(manager, document);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_TO_ANIMATION_RANGE)); tooltip_set(TOOLTIP_TO_ANIMATION_RANGE);
ImGui::BeginDisabled(!isRange); ImGui::BeginDisabled(!isRange);
{ {
input_int_range(localize.get(LABEL_START), start, 0, frameMax); input_int_range(localize.get(LABEL_START), start, 0, frameMax);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_START)); tooltip_set(TOOLTIP_START);
input_int_range(localize.get(LABEL_END), end, start, frameMax); input_int_range(localize.get(LABEL_END), end, start, frameMax);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_END)); tooltip_set(TOOLTIP_END);
} }
ImGui::EndDisabled(); ImGui::EndDisabled();
renderFrameNum = render_frame_count_get(); renderFrameNum = render_frame_count_get();
@@ -219,18 +219,18 @@ void RenderAnimation::update(Manager& manager, Document& document, Resources& re
ImGui::Separator(); ImGui::Separator();
ImGui::Checkbox(localize.get(LABEL_USE_ANIMATION_BOUNDS), &isUseAnimationBounds); ImGui::Checkbox(localize.get(LABEL_USE_ANIMATION_BOUNDS), &isUseAnimationBounds);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_USE_ANIMATION_BOUNDS)); tooltip_set(TOOLTIP_USE_ANIMATION_BOUNDS);
ImGui::SameLine(); ImGui::SameLine();
ImGui::Checkbox(localize.get(LABEL_USE_ISOLATED_ANIMATION), &isUseIsolatedAnimation); ImGui::Checkbox(localize.get(LABEL_USE_ISOLATED_ANIMATION), &isUseIsolatedAnimation);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_USE_ISOLATED_ANIMATION)); tooltip_set(TOOLTIP_USE_ISOLATED_ANIMATION);
ImGui::BeginDisabled(!isUseAnimationBounds); ImGui::BeginDisabled(!isUseAnimationBounds);
{ {
input_float_range(localize.get(BASIC_SCALE), scale, RENDER_SCALE_MIN, RENDER_SCALE_MAX, RENDER_SCALE_STEP, input_float_range(localize.get(BASIC_SCALE), scale, RENDER_SCALE_MIN, RENDER_SCALE_MAX, RENDER_SCALE_STEP,
RENDER_SCALE_STEP, "%.0f%%"); RENDER_SCALE_STEP, "%.0f%%");
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SCALE_OUTPUT)); tooltip_set(TOOLTIP_SCALE_OUTPUT);
} }
ImGui::EndDisabled(); ImGui::EndDisabled();
@@ -238,7 +238,7 @@ void RenderAnimation::update(Manager& manager, Document& document, Resources& re
const char* renderFpsOptions[] = {localize.get(LABEL_ANIMATION_FPS), localize.get(LABEL_PLAYBACK_RATE)}; const char* renderFpsOptions[] = {localize.get(LABEL_ANIMATION_FPS), localize.get(LABEL_PLAYBACK_RATE)};
ImGui::Combo(localize.get(LABEL_RENDER_FPS), &renderFpsMode, renderFpsOptions, IM_ARRAYSIZE(renderFpsOptions)); ImGui::Combo(localize.get(LABEL_RENDER_FPS), &renderFpsMode, renderFpsOptions, IM_ARRAYSIZE(renderFpsOptions));
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_RENDER_FPS)); tooltip_set(TOOLTIP_RENDER_FPS);
renderFps = fps_get(renderFpsMode, animationFps, settings.playbackTickRate); renderFps = fps_get(renderFpsMode, animationFps, settings.playbackTickRate);
renderFrameNum = render_frame_count_get(); renderFrameNum = render_frame_count_get();
@@ -252,7 +252,7 @@ void RenderAnimation::update(Manager& manager, Document& document, Resources& re
ImGui::Separator(); ImGui::Separator();
ImGui::Checkbox(localize.get(LABEL_SOUND), &settings.timelineIsSound); ImGui::Checkbox(localize.get(LABEL_SOUND), &settings.timelineIsSound);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SOUND)); tooltip_set(TOOLTIP_SOUND);
ImGui::Separator(); ImGui::Separator();
@@ -362,7 +362,7 @@ void RenderAnimation::update(Manager& manager, Document& document, Resources& re
isEnd = true; isEnd = true;
} }
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_RENDER_BUTTON)); tooltip_set(TOOLTIP_RENDER_BUTTON);
ImGui::SameLine(); ImGui::SameLine();
+4 -6
View File
@@ -332,8 +332,7 @@ void shaders_update(Panel& panel, ShadersPanel& shaders)
if (auto shader = shader_element_get(document, id)) if (auto shader = shader_element_get(document, id))
{ {
document.shader_reload(id, &status); document.shader_reload(id, &status);
toasts.push( toasts.push(localize_format(TOAST_RELOAD_SHADER, id, shader->name));
std::vformat(localize.get(TOAST_RELOAD_SHADER), std::make_format_args(id, shader->name)));
} }
}, },
TOOLTIP_RELOAD_SHADERS); TOOLTIP_RELOAD_SHADERS);
@@ -346,7 +345,7 @@ void shaders_update(Panel& panel, ShadersPanel& shaders)
ListRows rows{.label_get = ListRows rows{.label_get =
[&](int id) { [&](int id) {
auto name = shader_element_get(document, id)->name; auto name = shader_element_get(document, id)->name;
return std::vformat(localize.get(FORMAT_SHADER), std::make_format_args(id, name)); return localize_format(FORMAT_SHADER, id, name);
}, },
.tooltip_draw = .tooltip_draw =
[&](int id) { [&](int id) {
@@ -368,8 +367,7 @@ void shaders_update(Panel& panel, ShadersPanel& shaders)
panel, actions, {{ACTION_ADD, ACTION_REMOVE, ACTION_RELOAD}}, panel, actions, {{ACTION_ADD, ACTION_REMOVE, ACTION_RELOAD}},
[&]() { content_list_draw(panel, SelectionKind::SHADERS, item_ids_get(items), rows); }, true); [&]() { content_list_draw(panel, SelectionKind::SHADERS, item_ids_get(items), rows); }, true);
propertiesPopup.trigger(); if (propertiesPopup.begin())
if (ImGui::BeginPopupModal(propertiesPopup.label(), &propertiesPopup.isOpen, ImGuiWindowFlags_NoResize))
{ {
auto shader = shader_element_get(document, popupShaderId); auto shader = shader_element_get(document, popupShaderId);
if (!shader) if (!shader)
@@ -432,7 +430,7 @@ void shaders_update(Panel& panel, ShadersPanel& shaders)
document.shader_reload(shader->id, &status); document.shader_reload(shader->id, &status);
propertiesPopup.close(); propertiesPopup.close();
} }
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_RELOAD_SHADERS)); tooltip_set(TOOLTIP_RELOAD_SHADERS);
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button(localize.get(BASIC_CANCEL), popupWidgetSize)) if (ImGui::Button(localize.get(BASIC_CANCEL), popupWidgetSize))
propertiesPopup.close(); propertiesPopup.close();
+1 -1
View File
@@ -83,7 +83,7 @@ void sounds_update(Panel& panel)
ListRows rows{.label_get = ListRows rows{.label_get =
[&](int id) { [&](int id) {
auto pathString = path_to_utf8(item_get(sounds, id)->path); auto pathString = path_to_utf8(item_get(sounds, id)->path);
return std::vformat(localize.get(FORMAT_SOUND), std::make_format_args(id, pathString)); return localize_format(FORMAT_SOUND, id, pathString);
}, },
.tooltip_draw = .tooltip_draw =
[&](int id) { [&](int id) {
+5 -7
View File
@@ -77,14 +77,12 @@ void SpritesheetEditor::update(Manager& manager, Settings& settings, Resources&
if (ImGui::BeginChild("##View Child", childSize, true, ImGuiWindowFlags_HorizontalScrollbar)) if (ImGui::BeginChild("##View Child", childSize, true, ImGuiWindowFlags_HorizontalScrollbar))
{ {
ImGui::InputFloat(localize.get(BASIC_ZOOM), &zoom, 0.0f, 0.0f, "%.0f%%"); ImGui::InputFloat(localize.get(BASIC_ZOOM), &zoom, 0.0f, 0.0f, "%.0f%%");
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_EDITOR_ZOOM)); tooltip_set(TOOLTIP_EDITOR_ZOOM);
view_buttons_draw(manager, settings, center_view, fit_view); view_buttons_draw(manager, settings, center_view, fit_view);
auto mousePosInt = IVec2(mousePos); auto mousePosInt = IVec2(mousePos);
ImGui::TextUnformatted( ImGui::TextUnformatted(localize_format(FORMAT_POSITION_SPACED, mousePosInt.x, mousePosInt.y).c_str());
std::vformat(localize.get(FORMAT_POSITION_SPACED), std::make_format_args(mousePosInt.x, mousePosInt.y))
.c_str());
} }
ImGui::EndChild(); ImGui::EndChild();
@@ -100,12 +98,12 @@ void SpritesheetEditor::update(Manager& manager, Settings& settings, Resources&
{ {
ImGui::ColorEdit3(localize.get(LABEL_BACKGROUND_COLOR), values_get(backgroundColor), ImGui::ColorEdit3(localize.get(LABEL_BACKGROUND_COLOR), values_get(backgroundColor),
ImGuiColorEditFlags_NoInputs); ImGuiColorEditFlags_NoInputs);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_BACKGROUND_COLOR)); tooltip_set(TOOLTIP_BACKGROUND_COLOR);
} }
ImGui::EndDisabled(); ImGui::EndDisabled();
ImGui::Checkbox(localize.get(LABEL_BORDER), &isBorder); ImGui::Checkbox(localize.get(LABEL_BORDER), &isBorder);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SPRITESHEET_BORDER)); tooltip_set(TOOLTIP_SPRITESHEET_BORDER);
} }
ImGui::EndChild(); ImGui::EndChild();
@@ -114,7 +112,7 @@ void SpritesheetEditor::update(Manager& manager, Settings& settings, Resources&
if (ImGui::BeginChild("##Background Child 2", subChildSize)) if (ImGui::BeginChild("##Background Child 2", subChildSize))
{ {
ImGui::Checkbox(localize.get(LABEL_TRANSPARENT), &isTransparent); ImGui::Checkbox(localize.get(LABEL_TRANSPARENT), &isTransparent);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_TRANSPARENT)); tooltip_set(TOOLTIP_TRANSPARENT);
} }
ImGui::EndChild(); ImGui::EndChild();
+14 -19
View File
@@ -117,8 +117,7 @@ static void spritesheets_merge_popup_update(Panel& panel, SpritesheetsPanel& spr
{ {
auto& [manager, settings, resources, dialog, clipboard, document, state] = panel; auto& [manager, settings, resources, dialog, clipboard, document, state] = panel;
auto& popup = spritesheets.mergePopup; auto& popup = spritesheets.mergePopup;
popup.trigger(); if (!popup.begin())
if (!ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
return popup.end(); return popup.end();
settings.mergeSpritesheetsRegionOrigin = settings.mergeSpritesheetsRegionOrigin =
@@ -128,20 +127,20 @@ static void spritesheets_merge_popup_update(Panel& panel, SpritesheetsPanel& spr
ImGui::SeparatorText(localize.get(LABEL_REGION_PROPERTIES_ORIGIN)); ImGui::SeparatorText(localize.get(LABEL_REGION_PROPERTIES_ORIGIN));
ImGui::RadioButton(localize.get(LABEL_MERGE_SPRITESHEETS_APPEND_BOTTOM), &settings.mergeSpritesheetsOrigin, ImGui::RadioButton(localize.get(LABEL_MERGE_SPRITESHEETS_APPEND_BOTTOM), &settings.mergeSpritesheetsOrigin,
APPEND_BOTTOM); APPEND_BOTTOM);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_MERGE_SPRITESHEETS_BOTTOM_LEFT)); tooltip_set(TOOLTIP_MERGE_SPRITESHEETS_BOTTOM_LEFT);
ImGui::SameLine(); ImGui::SameLine();
ImGui::RadioButton(localize.get(LABEL_MERGE_SPRITESHEETS_APPEND_RIGHT), &settings.mergeSpritesheetsOrigin, ImGui::RadioButton(localize.get(LABEL_MERGE_SPRITESHEETS_APPEND_RIGHT), &settings.mergeSpritesheetsOrigin,
APPEND_RIGHT); APPEND_RIGHT);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_MERGE_SPRITESHEETS_TOP_RIGHT)); tooltip_set(TOOLTIP_MERGE_SPRITESHEETS_TOP_RIGHT);
ImGui::SeparatorText(localize.get(LABEL_OPTIONS)); ImGui::SeparatorText(localize.get(LABEL_OPTIONS));
ImGui::Checkbox(localize.get(LABEL_MERGE_MAKE_SPRITESHEET_REGIONS), &settings.mergeSpritesheetsIsMakeRegions); ImGui::Checkbox(localize.get(LABEL_MERGE_MAKE_SPRITESHEET_REGIONS), &settings.mergeSpritesheetsIsMakeRegions);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_MERGE_MAKE_SPRITESHEET_REGIONS)); tooltip_set(TOOLTIP_MERGE_MAKE_SPRITESHEET_REGIONS);
ImGui::BeginDisabled(!settings.mergeSpritesheetsIsMakeRegions); ImGui::BeginDisabled(!settings.mergeSpritesheetsIsMakeRegions);
ImGui::Checkbox(localize.get(LABEL_MERGE_MAKE_PRIMARY_SPRITESHEET_REGION), ImGui::Checkbox(localize.get(LABEL_MERGE_MAKE_PRIMARY_SPRITESHEET_REGION),
&settings.mergeSpritesheetsIsMakePrimaryRegion); &settings.mergeSpritesheetsIsMakePrimaryRegion);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_MERGE_MAKE_PRIMARY_SPRITESHEET_REGION)); tooltip_set(TOOLTIP_MERGE_MAKE_PRIMARY_SPRITESHEET_REGION);
const char* regionOriginOptions[] = {localize.get(LABEL_REGION_ORIGIN_TOP_LEFT), const char* regionOriginOptions[] = {localize.get(LABEL_REGION_ORIGIN_TOP_LEFT),
localize.get(LABEL_REGION_ORIGIN_CENTER)}; localize.get(LABEL_REGION_ORIGIN_CENTER)};
ImGui::Combo(localize.get(LABEL_REGION_PROPERTIES_ORIGIN), &settings.mergeSpritesheetsRegionOrigin, ImGui::Combo(localize.get(LABEL_REGION_PROPERTIES_ORIGIN), &settings.mergeSpritesheetsRegionOrigin,
@@ -180,8 +179,7 @@ static void spritesheets_pack_popup_update(Panel& panel, SpritesheetsPanel& spri
{ {
auto& [manager, settings, resources, dialog, clipboard, document, state] = panel; auto& [manager, settings, resources, dialog, clipboard, document, state] = panel;
auto& popup = spritesheets.packPopup; auto& popup = spritesheets.packPopup;
popup.trigger(); if (!popup.begin())
if (!ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
return popup.end(); return popup.end();
settings.packPadding = std::max(0, settings.packPadding); settings.packPadding = std::max(0, settings.packPadding);
@@ -206,8 +204,7 @@ static void spritesheets_pack_popup_update(Panel& panel, SpritesheetsPanel& spri
static void spritesheets_overwrite_popup_update(Panel& panel, SpritesheetsPanel& spritesheets) static void spritesheets_overwrite_popup_update(Panel& panel, SpritesheetsPanel& spritesheets)
{ {
auto& popup = spritesheets.overwritePopup; auto& popup = spritesheets.overwritePopup;
popup.trigger(); if (!popup.begin())
if (!ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
return popup.end(); return popup.end();
ImGui::TextUnformatted(localize.get(LABEL_OVERWRITE_CONFIRMATION)); ImGui::TextUnformatted(localize.get(LABEL_OVERWRITE_CONFIRMATION));
@@ -302,13 +299,12 @@ void spritesheets_update(Panel& panel, SpritesheetsPanel& spritesheets)
auto& image = isValid ? *texture : resources.icons[ICON_NONE]; auto& image = isValid ? *texture : resources.icons[ICON_NONE];
return CardImage{.texture = &image, .size = Vec2(image.size), .isValid = isValid}; return CardImage{.texture = &image, .size = Vec2(image.size), .isValid = isValid};
}; };
ListRows rows{ ListRows rows{.label_get =
.label_get =
[&](int id) { [&](int id) {
auto pathString = path_to_utf8(spritesheet_get(document, id)->path); auto pathString = path_to_utf8(spritesheet_get(document, id)->path);
auto label = std::vformat(localize.get(FORMAT_SPRITESHEET), std::make_format_args(id, pathString)); auto label = localize_format(FORMAT_SPRITESHEET, id, pathString);
return document.spritesheet_is_dirty(id) return document.spritesheet_is_dirty(id)
? std::vformat(localize.get(FORMAT_SPRITESHEET_NOT_SAVED), std::make_format_args(label)) ? localize_format(FORMAT_SPRITESHEET_NOT_SAVED, label)
: label; : label;
}, },
.tooltip_draw = .tooltip_draw =
@@ -316,12 +312,11 @@ void spritesheets_update(Panel& panel, SpritesheetsPanel& spritesheets)
auto image = image_get(id); auto image = image_get(id);
tooltip_image_draw(image, [&]() { tooltip_image_draw(image, [&]() {
tooltip_name_draw(resources, path_to_utf8(spritesheet_get(document, id)->path)); tooltip_name_draw(resources, path_to_utf8(spritesheet_get(document, id)->path));
ImGui::TextUnformatted( ImGui::TextUnformatted(localize_format(FORMAT_ID, id).c_str());
std::vformat(localize.get(FORMAT_ID), std::make_format_args(id)).c_str());
if (image.isValid) if (image.isValid)
ImGui::TextUnformatted( ImGui::TextUnformatted(std::vformat(localize.get(FORMAT_TEXTURE_SIZE),
std::vformat(localize.get(FORMAT_TEXTURE_SIZE), std::make_format_args(image.texture->size.x,
std::make_format_args(image.texture->size.x, image.texture->size.y)) image.texture->size.y))
.c_str()); .c_str());
else else
ImGui::TextUnformatted(localize.get(TOOLTIP_SPRITESHEET_INVALID)); ImGui::TextUnformatted(localize.get(TOOLTIP_SPRITESHEET_INVALID));
+16 -28
View File
@@ -158,11 +158,11 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
if (ImGui::MenuItem(localize.get(LABEL_TASKBAR_GENERATE_ANIMATION_FROM_GRID), nullptr, false, if (ImGui::MenuItem(localize.get(LABEL_TASKBAR_GENERATE_ANIMATION_FROM_GRID), nullptr, false,
isGenerateAnimationFromGridAvailable)) isGenerateAnimationFromGridAvailable))
generatePopup.open(); generatePopup.open();
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_WIZARD_GENERATE_ANIMATION_FROM_GRID)); tooltip_set(TOOLTIP_WIZARD_GENERATE_ANIMATION_FROM_GRID);
if (ImGui::MenuItem(localize.get(LABEL_TASKBAR_GENERATE_REGIONS_FROM_ANIMATIONS), nullptr, false, document)) if (ImGui::MenuItem(localize.get(LABEL_TASKBAR_GENERATE_REGIONS_FROM_ANIMATIONS), nullptr, false, document))
generateRegionsPopup.open(); generateRegionsPopup.open();
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_WIZARD_GENERATE_REGIONS_FROM_ANIMATIONS)); 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 && hasRegions))
{ {
@@ -172,7 +172,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
}}); }});
toast_log(Level::INFO, TOAST_SCAN_AND_SET_REGIONS); toast_log(Level::INFO, TOAST_SCAN_AND_SET_REGIONS);
} }
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_WIZARD_SCAN_AND_SET_REGIONS)); tooltip_set(TOOLTIP_WIZARD_SCAN_AND_SET_REGIONS);
ImGui::Separator(); ImGui::Separator();
@@ -182,14 +182,14 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
if (ImGui::MenuItem(localize.get(LABEL_CHANGE_ALL_FRAME_PROPERTIES), nullptr, false, if (ImGui::MenuItem(localize.get(LABEL_CHANGE_ALL_FRAME_PROPERTIES), nullptr, false,
isChangeAllFramesAvailable || isChangeAllAnimationsAvailable)) isChangeAllFramesAvailable || isChangeAllAnimationsAvailable))
changePopup.open(); changePopup.open();
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_WIZARD_CHANGE_ALL_FRAME_PROPERTIES)); tooltip_set(TOOLTIP_WIZARD_CHANGE_ALL_FRAME_PROPERTIES);
ImGui::Separator(); ImGui::Separator();
if (ImGui::MenuItem(localize.get(LABEL_TASKBAR_RENDER_ANIMATION), nullptr, false, if (ImGui::MenuItem(localize.get(LABEL_TASKBAR_RENDER_ANIMATION), nullptr, false,
animation && manager.isAbleToRecord)) animation && manager.isAbleToRecord))
renderPopup.open(); renderPopup.open();
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_WIZARD_RENDER_ANIMATION)); tooltip_set(TOOLTIP_WIZARD_RENDER_ANIMATION);
ImGui::EndMenu(); ImGui::EndMenu();
} }
@@ -197,10 +197,10 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
if (ImGui::BeginMenu(localize.get(LABEL_PLAYBACK_MENU))) if (ImGui::BeginMenu(localize.get(LABEL_PLAYBACK_MENU)))
{ {
ImGui::MenuItem(localize.get(LABEL_PLAYBACK_ALWAYS_LOOP), nullptr, &settings.playbackIsLoop); ImGui::MenuItem(localize.get(LABEL_PLAYBACK_ALWAYS_LOOP), nullptr, &settings.playbackIsLoop);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_PLAYBACK_ALWAYS_LOOP)); tooltip_set(TOOLTIP_PLAYBACK_ALWAYS_LOOP);
ImGui::MenuItem(localize.get(LABEL_CLAMP), nullptr, &settings.playbackIsClamp); ImGui::MenuItem(localize.get(LABEL_CLAMP), nullptr, &settings.playbackIsClamp);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_PLAYBACK_CLAMP)); tooltip_set(TOOLTIP_PLAYBACK_CLAMP);
ImGui::EndMenu(); ImGui::EndMenu();
} }
@@ -233,9 +233,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
ImGui::EndMainMenuBar(); ImGui::EndMainMenuBar();
} }
generatePopup.trigger(); if (generatePopup.begin())
if (ImGui::BeginPopupModal(generatePopup.label(), &generatePopup.isOpen, ImGuiWindowFlags_NoResize))
{ {
if (document) if (document)
{ {
@@ -246,8 +244,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
ImGui::EndPopup(); ImGui::EndPopup();
} }
generateRegionsPopup.trigger(); if (generateRegionsPopup.begin())
if (ImGui::BeginPopupModal(generateRegionsPopup.label(), &generateRegionsPopup.isOpen, ImGuiWindowFlags_NoResize))
{ {
if (document) if (document)
{ {
@@ -299,9 +296,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
} }
generateRegionsPopup.end(); generateRegionsPopup.end();
changePopup.trigger(); if (changePopup.begin())
if (ImGui::BeginPopupModal(changePopup.label(), &changePopup.isOpen, ImGuiWindowFlags_NoResize))
{ {
if (document) if (document)
{ {
@@ -312,8 +307,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
ImGui::EndPopup(); ImGui::EndPopup();
} }
configurePopup.trigger(); if (configurePopup.begin())
if (ImGui::BeginPopupModal(configurePopup.label(), &configurePopup.isOpen, ImGuiWindowFlags_NoResize))
{ {
if (configurePopup.isJustOpened) if (configurePopup.isJustOpened)
configure.reset(settings); configure.reset(settings);
@@ -324,8 +318,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
} }
configurePopup.end(); configurePopup.end();
renderPopup.trigger(); if (renderPopup.begin())
if (ImGui::BeginPopupModal(renderPopup.label(), &renderPopup.isOpen, ImGuiWindowFlags_NoResize))
{ {
if (document) if (document)
{ {
@@ -339,8 +332,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
} }
renderPopup.end(); renderPopup.end();
aboutPopup.trigger(); if (aboutPopup.begin())
if (ImGui::BeginPopupModal(aboutPopup.label(), &aboutPopup.isOpen, ImGuiWindowFlags_NoResize))
{ {
if (aboutPopup.isJustOpened) if (aboutPopup.isJustOpened)
about.reset(resources); about.reset(resources);
@@ -352,9 +344,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
if (is_audio_playing(*music) && !aboutPopup.isOpen) if (is_audio_playing(*music) && !aboutPopup.isOpen)
audio_stop(*music); audio_stop(*music);
overwritePopup.trigger(); if (overwritePopup.begin())
if (ImGui::BeginPopupModal(overwritePopup.label(), &overwritePopup.isOpen, ImGuiWindowFlags_NoResize))
{ {
ImGui::TextUnformatted(localize.get(LABEL_OVERWRITE_CONFIRMATION)); ImGui::TextUnformatted(localize.get(LABEL_OVERWRITE_CONFIRMATION));
@@ -376,8 +366,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
aboutPopup.end(); aboutPopup.end();
vectorPopup.trigger(); if (vectorPopup.begin())
if (ImGui::BeginPopupModal(vectorPopup.label(), &vectorPopup.isOpen, ImGuiWindowFlags_NoResize))
{ {
ImGui::TextWrapped("%s", localize.get(TEXT_CONVERT_SVG)); ImGui::TextWrapped("%s", localize.get(TEXT_CONVERT_SVG));
auto widgetSize = widget_size_with_row_get(2); auto widgetSize = widget_size_with_row_get(2);
@@ -400,8 +389,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
} }
vectorPopup.end(); vectorPopup.end();
isaacPopup.trigger(); if (isaacPopup.begin())
if (ImGui::BeginPopupModal(isaacPopup.label(), &isaacPopup.isOpen, ImGuiWindowFlags_NoResize))
{ {
if (settings.fileIsJson) if (settings.fileIsJson)
ImGui::TextWrapped("%s", localize.get(TEXT_ISAAC_JSON)); ImGui::TextWrapped("%s", localize.get(TEXT_ISAAC_JSON));
+16 -21
View File
@@ -1,4 +1,5 @@
#include "ui/timeline_context.h" #include "ui/timeline_context.h"
#include "ui/layout.h"
Timeline::Timeline() = default; Timeline::Timeline() = default;
Timeline::~Timeline() = default; Timeline::~Timeline() = default;
@@ -64,8 +65,7 @@ void TimelineContext::draw()
void TimelineContext::popups_update() void TimelineContext::popups_update()
{ {
makeManyRegionsPopup.trigger(); if (makeManyRegionsPopup.begin())
if (ImGui::BeginPopupModal(makeManyRegionsPopup.label(), &makeManyRegionsPopup.isOpen, ImGuiWindowFlags_NoResize))
{ {
input_text_string(localize.get(LABEL_FORMAT), &settings.generateRegionNameFormat); input_text_string(localize.get(LABEL_FORMAT), &settings.generateRegionNameFormat);
ImGui::Checkbox(localize.get(LABEL_MAP_FRAMES_TO_REGIONS), &isMakeManyRegionsMapFrames); ImGui::Checkbox(localize.get(LABEL_MAP_FRAMES_TO_REGIONS), &isMakeManyRegionsMapFrames);
@@ -83,9 +83,7 @@ void TimelineContext::popups_update()
} }
makeManyRegionsPopup.end(); makeManyRegionsPopup.end();
bakePopup.trigger(); if (bakePopup.begin())
if (ImGui::BeginPopupModal(bakePopup.label(), &bakePopup.isOpen, ImGuiWindowFlags_NoResize))
{ {
auto& interval = settings.bakeInterval; auto& interval = settings.bakeInterval;
auto& isRoundRotation = settings.bakeIsRoundRotation; auto& isRoundRotation = settings.bakeIsRoundRotation;
@@ -95,13 +93,13 @@ void TimelineContext::popups_update()
input_int_range(localize.get(LABEL_INTERVAL), interval, FRAME_DURATION_MIN, input_int_range(localize.get(LABEL_INTERVAL), interval, FRAME_DURATION_MIN,
frame ? frame->duration : FRAME_DURATION_MIN); frame ? frame->duration : FRAME_DURATION_MIN);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_INTERVAL)); tooltip_set(TOOLTIP_INTERVAL);
ImGui::Checkbox(localize.get(LABEL_ROUND_ROTATION), &isRoundRotation); ImGui::Checkbox(localize.get(LABEL_ROUND_ROTATION), &isRoundRotation);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ROUND_ROTATION)); tooltip_set(TOOLTIP_ROUND_ROTATION);
ImGui::Checkbox(localize.get(LABEL_ROUND_SCALE), &isRoundScale); ImGui::Checkbox(localize.get(LABEL_ROUND_SCALE), &isRoundScale);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ROUND_SCALE)); tooltip_set(TOOLTIP_ROUND_SCALE);
auto widgetSize = widget_size_with_row_get(2); auto widgetSize = widget_size_with_row_get(2);
@@ -111,22 +109,19 @@ void TimelineContext::popups_update()
frames_bake(); frames_bake();
bakePopup.close(); bakePopup.close();
} }
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_BAKE_FRAMES_OPTIONS)); tooltip_set(TOOLTIP_BAKE_FRAMES_OPTIONS);
ImGui::SameLine(); ImGui::SameLine();
shortcut(manager.chords[SHORTCUT_CANCEL]); shortcut(manager.chords[SHORTCUT_CANCEL]);
if (ImGui::Button(localize.get(BASIC_CANCEL), widgetSize)) if (ImGui::Button(localize.get(BASIC_CANCEL), widgetSize))
bakePopup.close(); bakePopup.close();
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CANCEL_BAKE_FRAMES)); tooltip_set(TOOLTIP_CANCEL_BAKE_FRAMES);
ImGui::EndPopup(); ImGui::EndPopup();
} }
bakeIntoOtherFramesPopup.trigger(); if (bakeIntoOtherFramesPopup.begin())
if (ImGui::BeginPopupModal(bakeIntoOtherFramesPopup.label(), &bakeIntoOtherFramesPopup.isOpen,
ImGuiWindowFlags_NoResize))
{ {
auto& isRoundRotation = settings.bakeIsRoundRotation; auto& isRoundRotation = settings.bakeIsRoundRotation;
auto& isRoundScale = settings.bakeIsRoundScale; auto& isRoundScale = settings.bakeIsRoundScale;
@@ -135,10 +130,10 @@ void TimelineContext::popups_update()
int target = (int)bakeIntoOtherFramesTarget; int target = (int)bakeIntoOtherFramesTarget;
ImGui::RadioButton(localize.get(LABEL_CURRENT_SELECTION), &target, ImGui::RadioButton(localize.get(LABEL_CURRENT_SELECTION), &target,
(int)BakeIntoOtherFramesTarget::CURRENT_SELECTION); (int)BakeIntoOtherFramesTarget::CURRENT_SELECTION);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_BAKE_INTO_OTHER_FRAMES_CURRENT_SELECTION)); tooltip_set(TOOLTIP_BAKE_INTO_OTHER_FRAMES_CURRENT_SELECTION);
ImGui::SameLine(); ImGui::SameLine();
ImGui::RadioButton(localize.get(LABEL_ALL), &target, (int)BakeIntoOtherFramesTarget::ALL); ImGui::RadioButton(localize.get(LABEL_ALL), &target, (int)BakeIntoOtherFramesTarget::ALL);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_BAKE_INTO_OTHER_FRAMES_ALL)); tooltip_set(TOOLTIP_BAKE_INTO_OTHER_FRAMES_ALL);
bakeIntoOtherFramesTarget = (BakeIntoOtherFramesTarget)target; bakeIntoOtherFramesTarget = (BakeIntoOtherFramesTarget)target;
auto isCurrentSelection = bakeIntoOtherFramesTarget == BakeIntoOtherFramesTarget::CURRENT_SELECTION; auto isCurrentSelection = bakeIntoOtherFramesTarget == BakeIntoOtherFramesTarget::CURRENT_SELECTION;
@@ -149,16 +144,16 @@ void TimelineContext::popups_update()
ImGui::EndDisabled(); ImGui::EndDisabled();
ImGui::Checkbox(localize.get(LABEL_ROUND_ROTATION), &isRoundRotation); ImGui::Checkbox(localize.get(LABEL_ROUND_ROTATION), &isRoundRotation);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ROUND_ROTATION)); tooltip_set(TOOLTIP_ROUND_ROTATION);
ImGui::Checkbox(localize.get(LABEL_ROUND_SCALE), &isRoundScale); ImGui::Checkbox(localize.get(LABEL_ROUND_SCALE), &isRoundScale);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ROUND_SCALE)); tooltip_set(TOOLTIP_ROUND_SCALE);
ImGui::Checkbox(localize.get(LABEL_BAKE_MATCH_ROOT_INTERPOLATION), &isMatchRootInterpolation); ImGui::Checkbox(localize.get(LABEL_BAKE_MATCH_ROOT_INTERPOLATION), &isMatchRootInterpolation);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_BAKE_MATCH_ROOT_INTERPOLATION)); tooltip_set(TOOLTIP_BAKE_MATCH_ROOT_INTERPOLATION);
ImGui::Checkbox(localize.get(LABEL_BAKE_USE_ROOT_PIVOT), &isUseRootPivot); ImGui::Checkbox(localize.get(LABEL_BAKE_USE_ROOT_PIVOT), &isUseRootPivot);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_BAKE_USE_ROOT_PIVOT)); tooltip_set(TOOLTIP_BAKE_USE_ROOT_PIVOT);
auto widgetSize = widget_size_with_row_get(2); auto widgetSize = widget_size_with_row_get(2);
@@ -176,7 +171,7 @@ void TimelineContext::popups_update()
shortcut(manager.chords[SHORTCUT_CANCEL]); shortcut(manager.chords[SHORTCUT_CANCEL]);
if (ImGui::Button(localize.get(BASIC_CANCEL), widgetSize)) if (ImGui::Button(localize.get(BASIC_CANCEL), widgetSize))
bakeIntoOtherFramesPopup.close(); bakeIntoOtherFramesPopup.close();
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CANCEL_BAKE_FRAMES)); tooltip_set(TOOLTIP_CANCEL_BAKE_FRAMES);
ImGui::EndPopup(); ImGui::EndPopup();
} }
+3 -2
View File
@@ -1,4 +1,5 @@
#include "ui/timeline_context.h" #include "ui/timeline_context.h"
#include "ui/layout.h"
// Animation layers in the timeline: their child's tracks under them (read only, timed as the parent plays them), // Animation layers in the timeline: their child's tracks under them (read only, timed as the parent plays them),
// stepping into the child, and the breadcrumb back out. // stepping into the child, and the breadcrumb back out.
@@ -64,7 +65,7 @@ void TimelineContext::peek_item_child(const TimelineRow& row, const PeekRow& pee
ImGui::EndDisabled(); ImGui::EndDisabled();
if (ImGui::IsWindowHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) if (ImGui::IsWindowHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left))
child_step_in(row); child_step_in(row);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CHILD_TRACK)); tooltip_set(TOOLTIP_CHILD_TRACK);
} }
ImGui::EndChild(); ImGui::EndChild();
ImGui::PopStyleVar(2); ImGui::PopStyleVar(2);
@@ -153,7 +154,7 @@ void TimelineContext::breadcrumb_draw()
manager.command_push({.runManager = [index = manager.selected, stepIndex](Manager& manager) { manager.command_push({.runManager = [index = manager.selected, stepIndex](Manager& manager) {
manager.child_step_out(index, stepIndex); manager.child_step_out(index, stepIndex);
}}); }});
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_STEP_OUT)); tooltip_set(TOOLTIP_STEP_OUT);
ImGui::PopID(); ImGui::PopID();
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextUnformatted(BREADCRUMB_SEPARATOR); ImGui::TextUnformatted(BREADCRUMB_SEPARATOR);
+6 -5
View File
@@ -1,4 +1,5 @@
#include "ui/timeline_context.h" #include "ui/timeline_context.h"
#include "ui/layout.h"
// Moves the dragged frames to `target`'s track, before its frame index. // Moves the dragged frames to `target`'s track, before its frame index.
void TimelineContext::frames_move_to(Reference target) void TimelineContext::frames_move_to(Reference target)
@@ -903,7 +904,7 @@ void TimelineContext::frames_child()
} }
if (ImGui::IsItemDeactivated()) if (ImGui::IsItemDeactivated())
animationLengthEditIndex = -1; animationLengthEditIndex = -1;
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ANIMATION_LENGTH)); tooltip_set(TOOLTIP_ANIMATION_LENGTH);
ImGui::SameLine(); ImGui::SameLine();
@@ -917,7 +918,7 @@ void TimelineContext::frames_child()
animation->isLoop = isLoop; animation->isLoop = isLoop;
}); });
} }
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_LOOP_ANIMATION)); tooltip_set(TOOLTIP_LOOP_ANIMATION);
} }
ImGui::EndDisabled(); ImGui::EndDisabled();
@@ -927,7 +928,7 @@ void TimelineContext::frames_child()
ImGui::SetNextItemWidth(widgetSize.x); ImGui::SetNextItemWidth(widgetSize.x);
if (input_int_range(localize.get(LABEL_FPS), fps, FPS_MIN, FPS_MAX)) if (input_int_range(localize.get(LABEL_FPS), fps, FPS_MIN, FPS_MAX))
edit_push(EDIT_FPS, [=](Model& model) { model.info.fps = fps; }); edit_push(EDIT_FPS, [=](Model& model) { model.info.fps = fps; });
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_FPS)); tooltip_set(TOOLTIP_FPS);
ImGui::SameLine(); ImGui::SameLine();
@@ -935,13 +936,13 @@ void TimelineContext::frames_child()
ImGui::SetNextItemWidth(widgetSize.x); ImGui::SetNextItemWidth(widgetSize.x);
if (input_text_string(localize.get(LABEL_AUTHOR), &createdBy)) if (input_text_string(localize.get(LABEL_AUTHOR), &createdBy))
edit_push(EDIT_AUTHOR, [=](Model& model) { model.info.createdBy = createdBy; }); edit_push(EDIT_AUTHOR, [=](Model& model) { model.info.createdBy = createdBy; });
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_AUTHOR)); tooltip_set(TOOLTIP_AUTHOR);
ImGui::SameLine(); ImGui::SameLine();
ImGui::SetNextItemWidth(widgetSize.x); ImGui::SetNextItemWidth(widgetSize.x);
ImGui::Checkbox(localize.get(LABEL_SOUND), &settings.timelineIsSound); ImGui::Checkbox(localize.get(LABEL_SOUND), &settings.timelineIsSound);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SOUND)); tooltip_set(TOOLTIP_SOUND);
ImGui::PopStyleVar(); ImGui::PopStyleVar();
} }
+3 -4
View File
@@ -1,4 +1,5 @@
#include "ui/timeline_context.h" #include "ui/timeline_context.h"
#include "ui/layout.h"
constexpr StringType FRAME_PROPERTY_LABELS[] = { constexpr StringType FRAME_PROPERTY_LABELS[] = {
BASIC_POSITION, BASIC_SCALE, BASIC_ROTATION, BASIC_SKEW, BASIC_PIVOT, BASIC_CROP, BASIC_SIZE, BASIC_POSITION, BASIC_SCALE, BASIC_ROTATION, BASIC_SKEW, BASIC_PIVOT, BASIC_CROP, BASIC_SIZE,
@@ -239,9 +240,7 @@ void TimelineContext::group_properties_open(const TimelineRow& row, const TrackG
void TimelineContext::group_properties_update() void TimelineContext::group_properties_update()
{ {
groupPropertiesPopup.trigger(); if (groupPropertiesPopup.begin())
if (ImGui::BeginPopupModal(groupPropertiesPopup.label(), &groupPropertiesPopup.isOpen, ImGuiWindowFlags_NoResize))
{ {
auto childSize = child_size_get(1); auto childSize = child_size_get(1);
if (ImGui::BeginChild("##Group Properties Child", childSize, ImGuiChildFlags_Borders)) if (ImGui::BeginChild("##Group Properties Child", childSize, ImGuiChildFlags_Borders))
@@ -249,7 +248,7 @@ void TimelineContext::group_properties_update()
if (groupPropertiesPopup.isJustOpened) if (groupPropertiesPopup.isJustOpened)
ImGui::SetKeyboardFocusHere(); ImGui::SetKeyboardFocusHere();
input_text_string(localize.get(BASIC_NAME), &groupName); input_text_string(localize.get(BASIC_NAME), &groupName);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ITEM_NAME)); tooltip_set(TOOLTIP_ITEM_NAME);
} }
ImGui::EndChild(); ImGui::EndChild();
+15 -37
View File
@@ -158,10 +158,9 @@ void TimelineContext::item_child(const TimelineRow& row, int index)
ImGui::PushFont(resources.fonts[FONT_BOLD], FONT_SIZE); ImGui::PushFont(resources.fonts[FONT_BOLD], FONT_SIZE);
ImGui::TextUnformatted(label.c_str()); ImGui::TextUnformatted(label.c_str());
ImGui::PopFont(); ImGui::PopFont();
ImGui::TextUnformatted(std::vformat(localize.get(FORMAT_ID), std::make_format_args(group->id)).c_str()); ImGui::TextUnformatted(localize_format(FORMAT_ID, group->id).c_str());
auto groupItemsCount = (int)group->items.size(); auto groupItemsCount = (int)group->items.size();
ImGui::TextUnformatted( ImGui::TextUnformatted(localize_format(FORMAT_ITEMS_COUNT, groupItemsCount).c_str());
std::vformat(localize.get(FORMAT_ITEMS_COUNT), std::make_format_args(groupItemsCount)).c_str());
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
if (isIconHovered && ImGui::IsMouseReleased(ImGuiMouseButton_Left) && if (isIconHovered && ImGui::IsMouseReleased(ImGuiMouseButton_Left) &&
@@ -211,7 +210,7 @@ void TimelineContext::item_child(const TimelineRow& row, int index)
auto null = ::item_get(model.content.nulls, id); auto null = ::item_get(model.content.nulls, id);
if (!null) if (!null)
return localize.get(TYPE_STRINGS[type]); return localize.get(TYPE_STRINGS[type]);
return std::vformat(localize.get(FORMAT_NULL), std::make_format_args(id, null->name)); return localize_format(FORMAT_NULL, id, null->name);
} }
return localize.get(TYPE_STRINGS[type]); return localize.get(TYPE_STRINGS[type]);
}(); }();
@@ -311,16 +310,10 @@ void TimelineContext::item_child(const TimelineRow& row, int index)
ImGui::TextUnformatted(localize.get(BASIC_ROOT)); ImGui::TextUnformatted(localize.get(BASIC_ROOT));
ImGui::PopFont(); ImGui::PopFont();
ImGui::TextUnformatted( ImGui::TextUnformatted(localize_format(FORMAT_VISIBLE, visibleLabel).c_str());
std::vformat(localize.get(FORMAT_VISIBLE), std::make_format_args(visibleLabel))
.c_str());
auto transformLabel = yesNoLabel(settings.previewIsRootTransform); auto transformLabel = yesNoLabel(settings.previewIsRootTransform);
ImGui::TextUnformatted( ImGui::TextUnformatted(localize_format(FORMAT_TRANSFORM, transformLabel).c_str());
std::vformat(localize.get(FORMAT_TRANSFORM), std::make_format_args(transformLabel)) ImGui::TextUnformatted(localize_format(FORMAT_FRAMES_COUNT, framesCount).c_str());
.c_str());
ImGui::TextUnformatted(
std::vformat(localize.get(FORMAT_FRAMES_COUNT), std::make_format_args(framesCount))
.c_str());
break; break;
} }
case LAYER: case LAYER:
@@ -332,15 +325,10 @@ void TimelineContext::item_child(const TimelineRow& row, int index)
ImGui::TextUnformatted(layer->name.c_str()); ImGui::TextUnformatted(layer->name.c_str());
ImGui::PopFont(); ImGui::PopFont();
ImGui::TextUnformatted( ImGui::TextUnformatted(localize_format(FORMAT_ID, id).c_str());
std::vformat(localize.get(FORMAT_ID), std::make_format_args(id)).c_str());
layer_source_tooltip_draw(document, *layer); layer_source_tooltip_draw(document, *layer);
ImGui::TextUnformatted( ImGui::TextUnformatted(localize_format(FORMAT_VISIBLE, visibleLabel).c_str());
std::vformat(localize.get(FORMAT_VISIBLE), std::make_format_args(visibleLabel)) ImGui::TextUnformatted(localize_format(FORMAT_FRAMES_COUNT, framesCount).c_str());
.c_str());
ImGui::TextUnformatted(
std::vformat(localize.get(FORMAT_FRAMES_COUNT), std::make_format_args(framesCount))
.c_str());
break; break;
} }
case NULL_: case NULL_:
@@ -353,16 +341,10 @@ void TimelineContext::item_child(const TimelineRow& row, int index)
ImGui::PopFont(); ImGui::PopFont();
auto rectLabel = yesNoLabel(nullInfo->isShowRect); auto rectLabel = yesNoLabel(nullInfo->isShowRect);
ImGui::TextUnformatted( ImGui::TextUnformatted(localize_format(FORMAT_ID, id).c_str());
std::vformat(localize.get(FORMAT_ID), std::make_format_args(id)).c_str()); ImGui::TextUnformatted(localize_format(FORMAT_RECT, rectLabel).c_str());
ImGui::TextUnformatted( ImGui::TextUnformatted(localize_format(FORMAT_VISIBLE, visibleLabel).c_str());
std::vformat(localize.get(FORMAT_RECT), std::make_format_args(rectLabel)).c_str()); ImGui::TextUnformatted(localize_format(FORMAT_FRAMES_COUNT, framesCount).c_str());
ImGui::TextUnformatted(
std::vformat(localize.get(FORMAT_VISIBLE), std::make_format_args(visibleLabel))
.c_str());
ImGui::TextUnformatted(
std::vformat(localize.get(FORMAT_FRAMES_COUNT), std::make_format_args(framesCount))
.c_str());
break; break;
} }
case TRIGGER: case TRIGGER:
@@ -371,12 +353,8 @@ void TimelineContext::item_child(const TimelineRow& row, int index)
ImGui::TextUnformatted(localize.get(BASIC_TRIGGERS)); ImGui::TextUnformatted(localize.get(BASIC_TRIGGERS));
ImGui::PopFont(); ImGui::PopFont();
ImGui::TextUnformatted( ImGui::TextUnformatted(localize_format(FORMAT_VISIBLE, visibleLabel).c_str());
std::vformat(localize.get(FORMAT_VISIBLE), std::make_format_args(visibleLabel)) ImGui::TextUnformatted(localize_format(FORMAT_TRIGGERS_COUNT, framesCount).c_str());
.c_str());
ImGui::TextUnformatted(
std::vformat(localize.get(FORMAT_TRIGGERS_COUNT), std::make_format_args(framesCount))
.c_str());
break; break;
} }
default: default: