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:
1 parent
99e06b72ea
commit
8d3ebf2329
31 files changed
+308
-362
No files matched your search
+3
-3
@@ -114,7 +114,7 @@ static void shader_status_format_append(std::string* status, StringType format,
|
||||
if (!status)
|
||||
return;
|
||||
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,
|
||||
@@ -138,7 +138,7 @@ static bool shader_source_load(Document& document, const std::filesystem::path&
|
||||
if (status)
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -976,7 +976,7 @@ Choices Document::choices_get(SelectionKind kind, int layerId) const
|
||||
auto path_label_get = [](StringType format) {
|
||||
return [format](const auto& item) {
|
||||
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;
|
||||
|
||||
+2
-2
@@ -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)
|
||||
action.run();
|
||||
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);
|
||||
if (shortcutText.empty())
|
||||
ImGui::SetItemTooltip("%s", localize.get(action.tooltip));
|
||||
tooltip_set(action.tooltip);
|
||||
else
|
||||
set_item_tooltip_shortcut(localize.get(action.tooltip), shortcutText);
|
||||
}
|
||||
|
||||
@@ -301,14 +301,13 @@ void AnimationPreview::update(Manager& manager, Settings& settings, Resources& r
|
||||
if (ImGui::BeginChild("##View Child", childSize, true, ImGuiWindowFlags_HorizontalScrollbar))
|
||||
{
|
||||
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);
|
||||
|
||||
auto readoutSize = ImVec2(row_widget_width_get(2), ImGui::GetTextLineHeightWithSpacing());
|
||||
auto mousePosInt = IVec2(mousePos);
|
||||
auto positionText =
|
||||
std::vformat(localize.get(FORMAT_POSITION_SPACED), std::make_format_args(mousePosInt.x, mousePosInt.y));
|
||||
auto positionText = localize_format(FORMAT_POSITION_SPACED, mousePosInt.x, mousePosInt.y);
|
||||
if (ImGui::BeginChild("##Position Readout", readoutSize, false, ImGuiWindowFlags_NoScrollbar))
|
||||
{
|
||||
ImGui::TextUnformatted(positionText.c_str());
|
||||
@@ -320,7 +319,7 @@ void AnimationPreview::update(Manager& manager, Settings& settings, Resources& r
|
||||
ImGui::SameLine();
|
||||
|
||||
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))
|
||||
{
|
||||
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),
|
||||
ImGuiColorEditFlags_NoInputs);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_BACKGROUND_COLOR));
|
||||
tooltip_set(TOOLTIP_BACKGROUND_COLOR);
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox(localize.get(LABEL_AXES), &isAxes);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_AXES));
|
||||
tooltip_set(TOOLTIP_AXES);
|
||||
ImGui::SameLine();
|
||||
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 overlayLabels = overlay_animation_option_labels_get(overlayOptions);
|
||||
@@ -365,7 +364,7 @@ void AnimationPreview::update(Manager& manager, Settings& settings, Resources& r
|
||||
overlayIndex = option.animationIndex;
|
||||
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);
|
||||
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::DragFloat("##Overlay Alpha", &overlayTransparency, DRAG_SPEED, 0, 100, "%.0f%%");
|
||||
ImGui::PopItemWidth();
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_OVERLAY_ALPHA));
|
||||
tooltip_set(TOOLTIP_OVERLAY_ALPHA);
|
||||
overlayTransparency = vec_clamp(overlayTransparency, 0.0f, 100.0f);
|
||||
|
||||
ImGui::SameLine();
|
||||
radio_button_icon("##Overlay Over", &overlayDrawOrder, OVERLAY_OVER, resources.icon_id_get(ICON_OVER),
|
||||
orderIconSize, overlayIconTint);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_OVERLAY_OVER));
|
||||
tooltip_set(TOOLTIP_OVERLAY_OVER);
|
||||
|
||||
ImGui::SameLine();
|
||||
radio_button_icon("##Overlay Under", &overlayDrawOrder, OVERLAY_UNDER, resources.icon_id_get(ICON_UNDER),
|
||||
orderIconSize, overlayIconTint);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_OVERLAY_UNDER));
|
||||
tooltip_set(TOOLTIP_OVERLAY_UNDER);
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
@@ -402,11 +401,11 @@ void AnimationPreview::update(Manager& manager, Settings& settings, Resources& r
|
||||
if (ImGui::BeginChild("##Helpers Child 1", helpersChildSize))
|
||||
{
|
||||
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::SetItemTooltip("%s", localize.get(TOOLTIP_PIVOTS));
|
||||
tooltip_set(TOOLTIP_PIVOTS);
|
||||
ImGui::Checkbox(localize.get(LABEL_TRANSPARENT), &isTransparent);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_PREVIEW_TRANSPARENT));
|
||||
tooltip_set(TOOLTIP_PREVIEW_TRANSPARENT);
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
@@ -415,9 +414,9 @@ void AnimationPreview::update(Manager& manager, Settings& settings, Resources& r
|
||||
if (ImGui::BeginChild("##Helpers Child 2", helpersChildSize))
|
||||
{
|
||||
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::SetItemTooltip("%s", localize.get(TOOLTIP_BORDER));
|
||||
tooltip_set(TOOLTIP_BORDER);
|
||||
}
|
||||
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,
|
||||
fit_view, animation != nullptr);
|
||||
|
||||
manager.progressPopup.trigger();
|
||||
|
||||
if (ImGui::BeginPopupModal(manager.progressPopup.label(), &manager.progressPopup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (manager.progressPopup.begin())
|
||||
{
|
||||
ImGui::ProgressBar(recorder.count > 0 ? (float)recorder.index / (float)recorder.count : 0.0f);
|
||||
ImGui::TextUnformatted(localize.get(TEXT_RECORDING_PROGRESS));
|
||||
|
||||
+49
-53
@@ -455,8 +455,7 @@ static void animations_merge_popup_update(Panel& panel, AnimationsPanel& animati
|
||||
auto& mergeSelection = animations.mergeSelection;
|
||||
auto mergeReference = animations.mergeReference;
|
||||
|
||||
popup.trigger();
|
||||
if (!ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (!popup.begin())
|
||||
return popup.end();
|
||||
|
||||
struct AnimationMergeCandidate
|
||||
@@ -686,57 +685,54 @@ void animations_update(Panel& panel, AnimationsPanel& animations)
|
||||
animations.mergePopup.open();
|
||||
};
|
||||
|
||||
ListRows rows{
|
||||
.label_get = [&](int index) { return model.animation_get(index)->name; },
|
||||
.name_get = [&](int index) { return model.animation_get(index)->name; },
|
||||
.rename =
|
||||
[&](int index, const std::string& name) {
|
||||
command_push(panel, [index, name](Document& document) {
|
||||
document.edit_apply(SNAPSHOT_RENAME_ANIMATION, [&](Model& model) {
|
||||
auto animation = model.animation_edit(index);
|
||||
if (!animation)
|
||||
return;
|
||||
if (model.animations_count_get() == 1)
|
||||
model.animations.defaultAnimation = name;
|
||||
animation->name = name;
|
||||
});
|
||||
});
|
||||
},
|
||||
.font_get =
|
||||
[&](int index) {
|
||||
auto animation = model.animation_get(index);
|
||||
auto isDefault = animation && model.animations.defaultAnimation == animation->name;
|
||||
auto isFocused = document.reference_get().animationIndex == index;
|
||||
return isDefault && isFocused ? FONT_BOLD_ITALICS
|
||||
: isDefault ? FONT_BOLD
|
||||
: isFocused ? FONT_ITALICS
|
||||
: FONT_REGULAR;
|
||||
},
|
||||
.tooltip_draw =
|
||||
[&](int index) {
|
||||
auto& animation = *model.animation_get(index);
|
||||
tooltip_name_draw(resources, animation.name);
|
||||
if (model.animations.defaultAnimation == animation.name)
|
||||
{
|
||||
ImGui::PushFont(resources.fonts[FONT_ITALICS], FONT_SIZE);
|
||||
ImGui::TextUnformatted(localize.get(BASIC_DEFAULT));
|
||||
ImGui::PopFont();
|
||||
}
|
||||
ImGui::TextUnformatted(
|
||||
std::vformat(localize.get(FORMAT_LENGTH), std::make_format_args(animation.frameNum)).c_str());
|
||||
auto loopLabel = localize.get(animation.isLoop ? BASIC_YES : BASIC_NO);
|
||||
ImGui::TextUnformatted(
|
||||
std::vformat(localize.get(FORMAT_LOOP), std::make_format_args(loopLabel)).c_str());
|
||||
},
|
||||
.select =
|
||||
[&](int index) {
|
||||
auto& io = ImGui::GetIO();
|
||||
if (!io.KeyCtrl && !io.KeyShift)
|
||||
groupSelection.clear();
|
||||
document.reference_set({index});
|
||||
document.frame_references_clear();
|
||||
},
|
||||
.drag_drop_update = [&](int index, int) { return animation_row_drag_drop_update(panel, index); }};
|
||||
ListRows rows{.label_get = [&](int index) { return model.animation_get(index)->name; },
|
||||
.name_get = [&](int index) { return model.animation_get(index)->name; },
|
||||
.rename =
|
||||
[&](int index, const std::string& name) {
|
||||
command_push(panel, [index, name](Document& document) {
|
||||
document.edit_apply(SNAPSHOT_RENAME_ANIMATION, [&](Model& model) {
|
||||
auto animation = model.animation_edit(index);
|
||||
if (!animation)
|
||||
return;
|
||||
if (model.animations_count_get() == 1)
|
||||
model.animations.defaultAnimation = name;
|
||||
animation->name = name;
|
||||
});
|
||||
});
|
||||
},
|
||||
.font_get =
|
||||
[&](int index) {
|
||||
auto animation = model.animation_get(index);
|
||||
auto isDefault = animation && model.animations.defaultAnimation == animation->name;
|
||||
auto isFocused = document.reference_get().animationIndex == index;
|
||||
return isDefault && isFocused ? FONT_BOLD_ITALICS
|
||||
: isDefault ? FONT_BOLD
|
||||
: isFocused ? FONT_ITALICS
|
||||
: FONT_REGULAR;
|
||||
},
|
||||
.tooltip_draw =
|
||||
[&](int index) {
|
||||
auto& animation = *model.animation_get(index);
|
||||
tooltip_name_draw(resources, animation.name);
|
||||
if (model.animations.defaultAnimation == animation.name)
|
||||
{
|
||||
ImGui::PushFont(resources.fonts[FONT_ITALICS], FONT_SIZE);
|
||||
ImGui::TextUnformatted(localize.get(BASIC_DEFAULT));
|
||||
ImGui::PopFont();
|
||||
}
|
||||
ImGui::TextUnformatted(localize_format(FORMAT_LENGTH, animation.frameNum).c_str());
|
||||
auto loopLabel = localize.get(animation.isLoop ? BASIC_YES : BASIC_NO);
|
||||
ImGui::TextUnformatted(localize_format(FORMAT_LOOP, loopLabel).c_str());
|
||||
},
|
||||
.select =
|
||||
[&](int index) {
|
||||
auto& io = ImGui::GetIO();
|
||||
if (!io.KeyCtrl && !io.KeyShift)
|
||||
groupSelection.clear();
|
||||
document.reference_set({index});
|
||||
document.frame_references_clear();
|
||||
},
|
||||
.drag_drop_update = [&](int index, int) { return animation_row_drag_drop_update(panel, index); }};
|
||||
|
||||
list_panel_draw(
|
||||
panel, actions, {{ACTION_ADD, ACTION_DUPLICATE, ACTION_MERGE, ACTION_REMOVE, ACTION_DEFAULT}},
|
||||
|
||||
@@ -15,9 +15,7 @@ void AutosaveRestore::update(Manager& manager)
|
||||
popup.open();
|
||||
}
|
||||
|
||||
popup.trigger();
|
||||
|
||||
if (isRestoreAvailable && ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (isRestoreAvailable && popup.begin())
|
||||
{
|
||||
ImGui::TextUnformatted(localize.get(LABEL_RESTORE_AUTOSAVES_PROMPT));
|
||||
|
||||
|
||||
@@ -156,21 +156,21 @@ void CanvasView::grid_child_draw(ImVec2 childSize, bool& isGrid, Vec4& gridColor
|
||||
if (ImGui::BeginChild("##Grid Child", childSize, true, ImGuiWindowFlags_HorizontalScrollbar))
|
||||
{
|
||||
ImGui::Checkbox(localize.get(BASIC_GRID), &isGrid);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_GRID_VISIBILITY));
|
||||
tooltip_set(TOOLTIP_GRID_VISIBILITY);
|
||||
if (isGridSnap)
|
||||
{
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox(localize.get(LABEL_SNAP), isGridSnap);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_GRID_SNAP));
|
||||
tooltip_set(TOOLTIP_GRID_SNAP);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
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));
|
||||
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));
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_GRID_OFFSET));
|
||||
tooltip_set(TOOLTIP_GRID_OFFSET);
|
||||
}
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ void ChangeAllFrameProperties::update(Manager& manager, Document& document, Sett
|
||||
property_toggle_begin(settings.changeIsDepth);
|
||||
input_int_range(localize.get(BASIC_DEPTH), settings.changeDepth, -FRAME_DEPTH_MAX, FRAME_DEPTH_MAX, STEP,
|
||||
STEP_FAST);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_DEPTH));
|
||||
tooltip_set(TOOLTIP_DEPTH);
|
||||
ImGui::EndDisabled();
|
||||
ImGui::PopID();
|
||||
ImGui::EndDisabled();
|
||||
@@ -267,7 +267,7 @@ void ChangeAllFrameProperties::update(Manager& manager, Document& document, Sett
|
||||
ImGui::PushID("Child Animation");
|
||||
property_toggle_begin(settings.changeIsChildAnimation);
|
||||
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::PopID();
|
||||
|
||||
@@ -283,7 +283,7 @@ void ChangeAllFrameProperties::update(Manager& manager, Document& document, Sett
|
||||
ImGui::PushID("Child Start");
|
||||
property_toggle_begin(settings.changeIsChildStart);
|
||||
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::PopID();
|
||||
|
||||
@@ -374,7 +374,7 @@ void ChangeAllFrameProperties::update(Manager& manager, Document& document, Sett
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginDisabled(!option.isAvailable);
|
||||
ImGui::RadioButton(localize.get(option.label), &destination, option.value);
|
||||
ImGui::SetItemTooltip("%s", localize.get(option.tooltip));
|
||||
tooltip_set(option.tooltip);
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ void ChangeAllFrameProperties::update(Manager& manager, Document& document, Sett
|
||||
if (&option != targetOptions)
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox(localize.get(option.label), &option.value);
|
||||
ImGui::SetItemTooltip("%s", localize.get(option.tooltip));
|
||||
tooltip_set(option.tooltip);
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
ImGui::Separator();
|
||||
@@ -424,7 +424,7 @@ void ChangeAllFrameProperties::update(Manager& manager, Document& document, Sett
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(std::format("{} {}", button.symbol, localize.get(button.label)).c_str(), rowWidgetSize))
|
||||
frame_change(button.type);
|
||||
ImGui::SetItemTooltip("%s", localize.get(button.tooltip));
|
||||
tooltip_set(button.tooltip);
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
+18
-18
@@ -27,23 +27,23 @@ void Configure::update(Manager& manager, Settings& settings)
|
||||
ImGui::SeparatorText(localize.get(LABEL_WINDOW_MENU));
|
||||
input_float_range(localize.get(LABEL_UI_SCALE), temporary.uiScale, UI_SCALE_MIN, UI_SCALE_MAX,
|
||||
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::SetItemTooltip("%s", localize.get(TOOLTIP_VSYNC));
|
||||
tooltip_set(TOOLTIP_VSYNC);
|
||||
ImGui::SameLine();
|
||||
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::RadioButton("30 Hz", &temporary.playbackTickRate, 30);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_PLAYBACK_TICK_RATE));
|
||||
tooltip_set(TOOLTIP_PLAYBACK_TICK_RATE);
|
||||
ImGui::SameLine();
|
||||
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::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));
|
||||
|
||||
@@ -65,28 +65,28 @@ void Configure::update(Manager& manager, Settings& settings)
|
||||
ImGui::SeparatorText(localize.get(LABEL_AUTOSAVE));
|
||||
|
||||
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::PushID(LABEL_AUTO_RESOURCE_RELOAD);
|
||||
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::SeparatorText(localize.get(LABEL_SNAPSHOTS));
|
||||
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::Checkbox(localize.get(LABEL_OVERWRITE_WARNING), &temporary.fileIsWarnOverwrite);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_OVERWRITE_WARNING));
|
||||
tooltip_set(TOOLTIP_OVERWRITE_WARNING);
|
||||
ImGui::SameLine();
|
||||
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::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();
|
||||
|
||||
@@ -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,
|
||||
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,
|
||||
0.005f, "%.3f");
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_REPEAT_DELAY));
|
||||
tooltip_set(TOOLTIP_REPEAT_DELAY);
|
||||
|
||||
ImGui::SeparatorText(localize.get(LABEL_TOOL));
|
||||
|
||||
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();
|
||||
|
||||
@@ -216,18 +216,18 @@ void Configure::update(Manager& manager, Settings& settings)
|
||||
|
||||
isSet = true;
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SETTINGS_SAVE));
|
||||
tooltip_set(TOOLTIP_SETTINGS_SAVE);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button(localize.get(LABEL_USE_DEFAULT_SETTINGS), widgetSize))
|
||||
temporary = Settings();
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_USE_DEFAULT_SETTINGS));
|
||||
tooltip_set(TOOLTIP_USE_DEFAULT_SETTINGS);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
shortcut(manager.chords[SHORTCUT_CLOSE]);
|
||||
if (ImGui::Button(localize.get(LABEL_CLOSE), widgetSize))
|
||||
isSet = true;
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CLOSE_SETTINGS));
|
||||
tooltip_set(TOOLTIP_CLOSE_SETTINGS);
|
||||
}
|
||||
+6
-13
@@ -201,9 +201,7 @@ void Documents::update(Taskbar& taskbar, Manager& manager, Settings& settings, R
|
||||
auto isRequested = i == manager.pendingSelected;
|
||||
auto font = isDocumentDirty ? FONT_ITALICS : FONT_REGULAR;
|
||||
auto filename = path_to_utf8(document.filename_get());
|
||||
auto string = isDocumentDirty
|
||||
? std::vformat(localize.get(FORMAT_NOT_SAVED), std::make_format_args(filename))
|
||||
: filename;
|
||||
auto string = isDocumentDirty ? localize_format(FORMAT_NOT_SAVED, filename) : filename;
|
||||
auto label = std::format("{}###Document{}", string, document.tabId);
|
||||
auto imguiId = ImGui::GetCurrentWindow()->GetID(label.c_str());
|
||||
documentTabs.push_back({imguiId, document.tabId});
|
||||
@@ -266,9 +264,7 @@ void Documents::update(Taskbar& taskbar, Manager& manager, Settings& settings, R
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
|
||||
closePopup.trigger();
|
||||
|
||||
if (ImGui::BeginPopupModal(closePopup.label(), &closePopup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (closePopup.begin())
|
||||
{
|
||||
if (closeDocumentIndex >= 0 && closeDocumentIndex < (int)manager.documents.size())
|
||||
{
|
||||
@@ -281,7 +277,7 @@ void Documents::update(Taskbar& taskbar, Manager& manager, Settings& settings, R
|
||||
isDocumentDirty && isSpritesheetDirty
|
||||
? LABEL_DOCUMENT_AND_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());
|
||||
|
||||
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();
|
||||
else if (manager.anm2DragDropMergePopup.is_open())
|
||||
{
|
||||
manager.anm2DragDropMergePopup.trigger();
|
||||
|
||||
if (ImGui::BeginPopupModal(manager.anm2DragDropMergePopup.label(), &manager.anm2DragDropMergePopup.isOpen,
|
||||
ImGuiWindowFlags_NoResize))
|
||||
if (manager.anm2DragDropMergePopup.begin())
|
||||
{
|
||||
auto document = manager.get();
|
||||
manager.anm2DragDropMergePreset =
|
||||
@@ -388,7 +381,7 @@ void Documents::update(Taskbar& taskbar, Manager& manager, Settings& settings, R
|
||||
ImGui::PushID(preset);
|
||||
ImGui::RadioButton(localize.get(ANM2_DRAG_DROP_MERGE_PRESET_LABELS[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();
|
||||
}
|
||||
|
||||
@@ -459,7 +452,7 @@ void Documents::update(Taskbar& taskbar, Manager& manager, Settings& settings, R
|
||||
}});
|
||||
drag_drop_reset();
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_LIBRARY_ADD));
|
||||
tooltip_set(TOOLTIP_LIBRARY_ADD);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
|
||||
+22
-22
@@ -132,7 +132,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
|
||||
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),
|
||||
frame ? &useFrame.isVisible : &dummy_value<bool>()) &&
|
||||
@@ -144,7 +144,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
|
||||
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).
|
||||
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())
|
||||
(frame.*member)[index] = id;
|
||||
});
|
||||
ImGui::SetItemTooltip("%s", localize.get(tooltip));
|
||||
tooltip_set(tooltip);
|
||||
ImGui::PopID();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
@@ -175,7 +175,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
|
||||
[member](Document&, Frame& frame, Track*, const Reference&) {
|
||||
(frame.*member).push_back(-1);
|
||||
});
|
||||
ImGui::SetItemTooltip("%s", localize.get(addTooltip));
|
||||
tooltip_set(addTooltip);
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginDisabled((useFrame.*member).empty());
|
||||
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())
|
||||
(frame.*member).pop_back();
|
||||
});
|
||||
ImGui::SetItemTooltip("%s", localize.get(removeTooltip));
|
||||
tooltip_set(removeTooltip);
|
||||
ImGui::EndDisabled();
|
||||
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&) {
|
||||
frame.*member = value;
|
||||
});
|
||||
ImGui::SetItemTooltip("%s", localize.get(field.tooltip));
|
||||
tooltip_set(field.tooltip);
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
|
||||
[rotation = useFrame.rotation](Document&, Frame& frame, Track*, const Reference&) {
|
||||
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>(),
|
||||
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;
|
||||
});
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_DURATION));
|
||||
tooltip_set(TOOLTIP_DURATION);
|
||||
|
||||
ImGui::BeginDisabled(type != LAYER);
|
||||
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,
|
||||
[depth](Document&, Frame& frame, Track*, const Reference&) { frame.depth = depth; });
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_DEPTH));
|
||||
tooltip_set(TOOLTIP_DEPTH);
|
||||
ImGui::EndDisabled();
|
||||
|
||||
auto tintEdit =
|
||||
@@ -265,7 +265,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
|
||||
[tint = useFrame.tint](Document&, Frame& frame, Track*, const Reference&) {
|
||||
frame.tint = tint;
|
||||
});
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_TINT));
|
||||
tooltip_set(TOOLTIP_TINT);
|
||||
|
||||
auto colorOffsetEdit = color_edit4_persistent(localize.get(BASIC_COLOR_OFFSET),
|
||||
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&) {
|
||||
frame.colorOffset = colorOffset;
|
||||
});
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_COLOR_OFFSET));
|
||||
tooltip_set(TOOLTIP_COLOR_OFFSET);
|
||||
|
||||
ImGui::BeginDisabled(type != LAYER);
|
||||
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&) {
|
||||
frame.blur = std::clamp(blur, 0.0f, FRAME_BLUR_MAX);
|
||||
});
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_BLUR));
|
||||
tooltip_set(TOOLTIP_BLUR);
|
||||
ImGui::EndDisabled();
|
||||
|
||||
ImGui::BeginDisabled(type != LAYER || isAnimationLayer);
|
||||
@@ -302,7 +302,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
|
||||
frame.pivot = effectiveFrame.pivot;
|
||||
});
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_REGION));
|
||||
tooltip_set(TOOLTIP_REGION);
|
||||
ImGui::EndDisabled();
|
||||
|
||||
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&) {
|
||||
frame.interpolation = static_cast<Interpolation>(interpolationValue);
|
||||
});
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_FRAME_INTERPOLATION));
|
||||
tooltip_set(TOOLTIP_FRAME_INTERPOLATION);
|
||||
|
||||
ImGui::BeginDisabled(type != LAYER || isAnimationLayer);
|
||||
if (combo_id_mapped(localize.get(BASIC_SHADER),
|
||||
@@ -327,7 +327,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
|
||||
frame.shaderId = shaderId;
|
||||
});
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_FRAME_SHADER));
|
||||
tooltip_set(TOOLTIP_FRAME_SHADER);
|
||||
ImGui::EndDisabled();
|
||||
|
||||
if (ImGui::Checkbox(localize.get(BASIC_VISIBLE),
|
||||
@@ -340,7 +340,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
|
||||
frame.isVisible = isVisible;
|
||||
});
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_FRAME_VISIBILITY));
|
||||
tooltip_set(TOOLTIP_FRAME_VISIBILITY);
|
||||
|
||||
auto widgetSize = widget_size_with_row_get(2);
|
||||
|
||||
@@ -356,7 +356,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
|
||||
if (isPositionFlipped)
|
||||
frame.position[axis] = -frame.position[axis];
|
||||
});
|
||||
ImGui::SetItemTooltip("%s", localize.get(FLIP_BUTTONS[axis].tooltip));
|
||||
tooltip_set(FLIP_BUTTONS[axis].tooltip);
|
||||
}
|
||||
|
||||
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));
|
||||
bool isChildChanged = combo_string_mapped(localize.get(LABEL_ANIMATION),
|
||||
&useFrame.childAnimation, values, labels);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CHILD_ANIMATION));
|
||||
tooltip_set(TOOLTIP_CHILD_ANIMATION);
|
||||
|
||||
std::vector<const char*> modeLabels;
|
||||
for (auto label : CHILD_MODE_LABELS)
|
||||
@@ -379,19 +379,19 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
|
||||
useFrame.childMode = (ChildMode)mode;
|
||||
isChildChanged = true;
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CHILD_MODE));
|
||||
tooltip_set(TOOLTIP_CHILD_MODE);
|
||||
|
||||
ImGui::BeginDisabled(useFrame.isChildStartRandom);
|
||||
isChildChanged |= input_int_range(localize.get(LABEL_START_FRAME), useFrame.childStart, 0,
|
||||
FRAME_NUM_MAX, STEP, STEP_FAST);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CHILD_START));
|
||||
tooltip_set(TOOLTIP_CHILD_START);
|
||||
ImGui::EndDisabled();
|
||||
|
||||
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();
|
||||
isChildChanged |= ImGui::Checkbox(localize.get(LABEL_RESTART), &useFrame.isChildRestart);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CHILD_RESTART));
|
||||
tooltip_set(TOOLTIP_CHILD_RESTART);
|
||||
|
||||
if (isChildChanged)
|
||||
frame_edit(EDIT_STATE_COMPLETE, EDIT_FRAME_CHILD,
|
||||
|
||||
@@ -52,10 +52,10 @@ void GenerateAnimationFromGrid::update(Manager& manager, Document& document, Res
|
||||
ImGui::InputInt(localize.get(BASIC_DURATION), &delay, STEP, STEP_FAST);
|
||||
ImGui::Separator();
|
||||
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);
|
||||
input_text_string(localize.get(LABEL_FORMAT), ®ionNameFormat);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_GENERATE_REGION_NAME_FORMAT));
|
||||
tooltip_set(TOOLTIP_GENERATE_REGION_NAME_FORMAT);
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
+11
-14
@@ -31,9 +31,7 @@ bool ItemProperties::update(Manager& manager, Settings& settings, Document& docu
|
||||
: std::set<int>{};
|
||||
};
|
||||
|
||||
popup.trigger();
|
||||
|
||||
if (ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (popup.begin())
|
||||
{
|
||||
auto close = [&]() {
|
||||
reset();
|
||||
@@ -60,11 +58,11 @@ bool ItemProperties::update(Manager& manager, Settings& settings, Document& docu
|
||||
spaced_pair(
|
||||
[&]() {
|
||||
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::SetItemTooltip("%s", localize.get(TOOLTIP_NULL_TYPE));
|
||||
tooltip_set(TOOLTIP_NULL_TYPE);
|
||||
});
|
||||
|
||||
ImGui::SeparatorText(localize.get(LABEL_SOURCE));
|
||||
@@ -73,7 +71,7 @@ bool ItemProperties::update(Manager& manager, Settings& settings, Document& docu
|
||||
spaced_pair(
|
||||
[&]() {
|
||||
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);
|
||||
@@ -88,11 +86,11 @@ bool ItemProperties::update(Manager& manager, Settings& settings, Document& docu
|
||||
spaced_pair(
|
||||
[&]() {
|
||||
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::SetItemTooltip("%s", localize.get(TOOLTIP_ITEM_THIS_ANIMATION));
|
||||
tooltip_set(TOOLTIP_ITEM_THIS_ANIMATION);
|
||||
});
|
||||
|
||||
if (source == SOURCE_NEW)
|
||||
@@ -100,13 +98,13 @@ bool ItemProperties::update(Manager& manager, Settings& settings, Document& docu
|
||||
ImGui::SeparatorText(localize.get(LABEL_OPTIONS));
|
||||
|
||||
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)
|
||||
layer_source_draw(document, edit);
|
||||
else if (type == NULL_)
|
||||
{
|
||||
ImGui::Checkbox(localize.get(LABEL_RECT), &edit.isShowRect);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_NULL_RECT));
|
||||
tooltip_set(TOOLTIP_NULL_RECT);
|
||||
}
|
||||
}
|
||||
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))
|
||||
{
|
||||
auto label =
|
||||
std::vformat(localize.get(FORMAT_NULL), std::make_format_args(id, null->name));
|
||||
auto label = localize_format(FORMAT_NULL, id, null->name);
|
||||
if (ImGui::Selectable(label.c_str(), isSelected))
|
||||
edit.id = id;
|
||||
}
|
||||
@@ -191,14 +188,14 @@ bool ItemProperties::update(Manager& manager, Settings& settings, Document& docu
|
||||
close();
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ADD_ITEM));
|
||||
tooltip_set(TOOLTIP_ADD_ITEM);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
shortcut(manager.chords[SHORTCUT_CANCEL]);
|
||||
if (ImGui::Button(localize.get(BASIC_CANCEL), widgetSize))
|
||||
close();
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CANCEL_ADD_ITEM));
|
||||
tooltip_set(TOOLTIP_CANCEL_ADD_ITEM);
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
+10
-11
@@ -27,7 +27,7 @@ static auto& events_get(Model& model)
|
||||
static void item_tooltip_draw(Resources& resources, const std::string& name, int id)
|
||||
{
|
||||
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.
|
||||
@@ -36,7 +36,7 @@ std::string layer_label_get(const Layer& layer)
|
||||
if (layer.is_animation())
|
||||
return std::vformat(localize.get(FORMAT_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.
|
||||
@@ -79,7 +79,7 @@ void layer_source_draw(Document& document, Manager::ItemEdit& layer)
|
||||
ImGui::SameLine();
|
||||
if (ImGui::RadioButton(localize.get(label), layer.isAnimation == isAnimation))
|
||||
layer.isAnimation = isAnimation;
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_LAYER_SOURCE));
|
||||
tooltip_set(TOOLTIP_LAYER_SOURCE);
|
||||
}
|
||||
ImGui::PopID();
|
||||
ImGui::Separator();
|
||||
@@ -88,19 +88,19 @@ void layer_source_draw(Document& document, Manager::ItemEdit& layer)
|
||||
{
|
||||
auto spritesheets = document.choices_get(SelectionKind::SPRITESHEETS);
|
||||
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;
|
||||
}
|
||||
|
||||
auto libraries = document.choices_get(SelectionKind::LIBRARIES);
|
||||
libraries.labels.front() = localize.get(TEXT_SELF);
|
||||
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);
|
||||
if (layer.animation.empty() && !names.empty())
|
||||
layer.animation = names.front();
|
||||
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.
|
||||
@@ -112,15 +112,14 @@ void item_properties_update(Panel& panel, int popupIndex, int rows, SelectionKin
|
||||
auto& popup = manager.itemPropertiesPopups[popupIndex];
|
||||
auto& edit = manager.itemEdit;
|
||||
|
||||
popup.trigger();
|
||||
if (ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (popup.begin())
|
||||
{
|
||||
if (ImGui::BeginChild("##Child", child_size_get(rows), ImGuiChildFlags_Borders))
|
||||
{
|
||||
if (popup.isJustOpened)
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
input_text_string(localize.get(BASIC_NAME), &edit.name);
|
||||
ImGui::SetItemTooltip("%s", localize.get(nameTooltip));
|
||||
tooltip_set(nameTooltip);
|
||||
fields_draw(edit);
|
||||
}
|
||||
ImGui::EndChild();
|
||||
@@ -223,7 +222,7 @@ void nulls_update(Panel& panel)
|
||||
ListRows rows{.label_get =
|
||||
[&](int id) {
|
||||
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); },
|
||||
.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,
|
||||
EDIT_SET_NULL_PROPERTIES, nulls_get, [](Manager::ItemEdit& null) {
|
||||
ImGui::Checkbox(localize.get(LABEL_RECT), &null.isShowRect);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_NULL_RECT));
|
||||
tooltip_set(TOOLTIP_NULL_RECT);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "vec.h"
|
||||
#include <imgui/imgui.h>
|
||||
|
||||
#include "localization.h"
|
||||
|
||||
constexpr ImVec2 to_imvec2(const Vec2& v) noexcept
|
||||
{
|
||||
return {v.x, v.y};
|
||||
@@ -45,3 +47,8 @@ ImVec2 size_without_footer_get(int = 1);
|
||||
ImVec2 child_size_get(int = 1);
|
||||
ImVec2 icon_size_get();
|
||||
void set_item_tooltip_shortcut(const char*, const std::string& = {});
|
||||
|
||||
inline void tooltip_set(StringType type)
|
||||
{
|
||||
ImGui::SetItemTooltip("%s", localize.get(type));
|
||||
}
|
||||
@@ -68,7 +68,7 @@ void libraries_update(Panel& panel)
|
||||
ListRows rows{.label_get =
|
||||
[&](int id) {
|
||||
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 =
|
||||
[&](int id) {
|
||||
|
||||
@@ -24,9 +24,9 @@ void onionskin_update(Manager& manager, Settings& settings)
|
||||
ImGui::PushID(separator);
|
||||
ImGui::SeparatorText(separator);
|
||||
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::SetItemTooltip("%s", localize.get(TOOLTIP_ONIONSKIN_COLOR));
|
||||
tooltip_set(TOOLTIP_ONIONSKIN_COLOR);
|
||||
ImGui::PopID();
|
||||
};
|
||||
|
||||
@@ -37,17 +37,17 @@ void onionskin_update(Manager& manager, Settings& settings)
|
||||
configure_widgets(localize.get(BASIC_AFTER), afterCount, afterColor);
|
||||
ImGui::SeparatorText(localize.get(BASIC_MODE));
|
||||
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::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::Checkbox(localize.get(LABEL_PIVOT_PATH), &settings.onionskinIsPivotPath);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_PIVOT_PATH));
|
||||
tooltip_set(TOOLTIP_PIVOT_PATH);
|
||||
ImGui::SameLine();
|
||||
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();
|
||||
|
||||
|
||||
+1
-2
@@ -413,8 +413,7 @@ void content_remove_action_add(Actions& actions, Panel& panel, ElementType type,
|
||||
static void content_remove_popup_draw(Panel& panel)
|
||||
{
|
||||
auto& popup = panel.state.removePopup;
|
||||
popup.trigger();
|
||||
if (!ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (!popup.begin())
|
||||
return popup.end();
|
||||
auto& removal = panel.state.removal;
|
||||
ImGui::TextUnformatted(localize.get(TEXT_REMOVE_LIST));
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
isJustOpened = false;
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
bool is_open();
|
||||
void open();
|
||||
void trigger();
|
||||
bool begin();
|
||||
void end();
|
||||
void close();
|
||||
};
|
||||
+8
-10
@@ -255,8 +255,7 @@ static void region_properties_open(RegionsPanel& regions, Document& document, in
|
||||
static void region_properties_popup_update(Panel& panel, RegionsPanel& regions)
|
||||
{
|
||||
auto& popup = regions.propertiesPopup;
|
||||
popup.trigger();
|
||||
if (!ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (!popup.begin())
|
||||
return popup.end();
|
||||
|
||||
auto& region = regions.editRegion;
|
||||
@@ -265,7 +264,7 @@ static void region_properties_popup_update(Panel& panel, RegionsPanel& regions)
|
||||
if (popup.isJustOpened)
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
input_text_string(localize.get(BASIC_NAME), ®ion.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,
|
||||
vec2_format_get(region.crop));
|
||||
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,
|
||||
(int)std::size(originOptions)))
|
||||
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);
|
||||
}
|
||||
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& popup = regions.exportPopup;
|
||||
|
||||
popup.trigger();
|
||||
if (!ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (!popup.begin())
|
||||
return popup.end();
|
||||
|
||||
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);
|
||||
ImGui::SameLine();
|
||||
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::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::SetItemTooltip("%s", localize.get(TOOLTIP_EXPORT_REMOVE_CURRENT_REGION));
|
||||
tooltip_set(TOOLTIP_EXPORT_REMOVE_CURRENT_REGION);
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
@@ -486,7 +484,7 @@ void regions_update(Panel& panel, RegionsPanel& regions)
|
||||
(region.origin == Origin::CUSTOM
|
||||
? std::vformat(localize.get(FORMAT_PIVOT),
|
||||
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());
|
||||
});
|
||||
},
|
||||
|
||||
+17
-17
@@ -130,7 +130,7 @@ void RenderAnimation::update(Manager& manager, Document& document, Resources& re
|
||||
dialog.file_open(Dialog::FFMPEG_PATH_SET);
|
||||
ImGui::SameLine();
|
||||
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))
|
||||
{
|
||||
@@ -149,7 +149,7 @@ void RenderAnimation::update(Manager& manager, Document& document, Resources& re
|
||||
ImGui::SameLine();
|
||||
auto pathLabel = type == RENDER_PNGS ? LABEL_OUTPUT_DIRECTORY : LABEL_OUTPUT_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))
|
||||
{
|
||||
@@ -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))
|
||||
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)
|
||||
ImGui::Separator();
|
||||
@@ -168,21 +168,21 @@ void RenderAnimation::update(Manager& manager, Document& document, Resources& re
|
||||
if (type == RENDER_PNGS)
|
||||
{
|
||||
input_text_path(localize.get(LABEL_FORMAT), &format);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_FORMAT));
|
||||
tooltip_set(TOOLTIP_FORMAT);
|
||||
}
|
||||
else if (type == RENDER_SPRITESHEET)
|
||||
{
|
||||
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);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_COLUMNS));
|
||||
tooltip_set(TOOLTIP_COLUMNS);
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Checkbox(localize.get(LABEL_CUSTOM_RANGE), &isRange);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CUSTOM_RANGE));
|
||||
tooltip_set(TOOLTIP_CUSTOM_RANGE);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
@@ -190,21 +190,21 @@ void RenderAnimation::update(Manager& manager, Document& document, Resources& re
|
||||
reference.itemType == TRIGGER);
|
||||
if (ImGui::Button(localize.get(LABEL_TO_SELECTED_FRAMES)))
|
||||
range_to_frames_set(manager, document);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_TO_SELECTED_FRAMES));
|
||||
tooltip_set(TOOLTIP_TO_SELECTED_FRAMES);
|
||||
ImGui::EndDisabled();
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button(localize.get(LABEL_TO_ANIMATION_RANGE)))
|
||||
range_to_animation_set(manager, document);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_TO_ANIMATION_RANGE));
|
||||
tooltip_set(TOOLTIP_TO_ANIMATION_RANGE);
|
||||
|
||||
ImGui::BeginDisabled(!isRange);
|
||||
{
|
||||
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);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_END));
|
||||
tooltip_set(TOOLTIP_END);
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
renderFrameNum = render_frame_count_get();
|
||||
@@ -219,18 +219,18 @@ void RenderAnimation::update(Manager& manager, Document& document, Resources& re
|
||||
ImGui::Separator();
|
||||
|
||||
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::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);
|
||||
{
|
||||
input_float_range(localize.get(BASIC_SCALE), scale, RENDER_SCALE_MIN, RENDER_SCALE_MAX, RENDER_SCALE_STEP,
|
||||
RENDER_SCALE_STEP, "%.0f%%");
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SCALE_OUTPUT));
|
||||
tooltip_set(TOOLTIP_SCALE_OUTPUT);
|
||||
}
|
||||
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)};
|
||||
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);
|
||||
renderFrameNum = render_frame_count_get();
|
||||
@@ -252,7 +252,7 @@ void RenderAnimation::update(Manager& manager, Document& document, Resources& re
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Checkbox(localize.get(LABEL_SOUND), &settings.timelineIsSound);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SOUND));
|
||||
tooltip_set(TOOLTIP_SOUND);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
@@ -362,7 +362,7 @@ void RenderAnimation::update(Manager& manager, Document& document, Resources& re
|
||||
isEnd = true;
|
||||
}
|
||||
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_RENDER_BUTTON));
|
||||
tooltip_set(TOOLTIP_RENDER_BUTTON);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
|
||||
+4
-6
@@ -332,8 +332,7 @@ void shaders_update(Panel& panel, ShadersPanel& shaders)
|
||||
if (auto shader = shader_element_get(document, id))
|
||||
{
|
||||
document.shader_reload(id, &status);
|
||||
toasts.push(
|
||||
std::vformat(localize.get(TOAST_RELOAD_SHADER), std::make_format_args(id, shader->name)));
|
||||
toasts.push(localize_format(TOAST_RELOAD_SHADER, id, shader->name));
|
||||
}
|
||||
},
|
||||
TOOLTIP_RELOAD_SHADERS);
|
||||
@@ -346,7 +345,7 @@ void shaders_update(Panel& panel, ShadersPanel& shaders)
|
||||
ListRows rows{.label_get =
|
||||
[&](int id) {
|
||||
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 =
|
||||
[&](int id) {
|
||||
@@ -368,8 +367,7 @@ void shaders_update(Panel& panel, ShadersPanel& shaders)
|
||||
panel, actions, {{ACTION_ADD, ACTION_REMOVE, ACTION_RELOAD}},
|
||||
[&]() { content_list_draw(panel, SelectionKind::SHADERS, item_ids_get(items), rows); }, true);
|
||||
|
||||
propertiesPopup.trigger();
|
||||
if (ImGui::BeginPopupModal(propertiesPopup.label(), &propertiesPopup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (propertiesPopup.begin())
|
||||
{
|
||||
auto shader = shader_element_get(document, popupShaderId);
|
||||
if (!shader)
|
||||
@@ -432,7 +430,7 @@ void shaders_update(Panel& panel, ShadersPanel& shaders)
|
||||
document.shader_reload(shader->id, &status);
|
||||
propertiesPopup.close();
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_RELOAD_SHADERS));
|
||||
tooltip_set(TOOLTIP_RELOAD_SHADERS);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(localize.get(BASIC_CANCEL), popupWidgetSize))
|
||||
propertiesPopup.close();
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ void sounds_update(Panel& panel)
|
||||
ListRows rows{.label_get =
|
||||
[&](int id) {
|
||||
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 =
|
||||
[&](int id) {
|
||||
|
||||
@@ -77,14 +77,12 @@ void SpritesheetEditor::update(Manager& manager, Settings& settings, Resources&
|
||||
if (ImGui::BeginChild("##View Child", childSize, true, ImGuiWindowFlags_HorizontalScrollbar))
|
||||
{
|
||||
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);
|
||||
|
||||
auto mousePosInt = IVec2(mousePos);
|
||||
ImGui::TextUnformatted(
|
||||
std::vformat(localize.get(FORMAT_POSITION_SPACED), std::make_format_args(mousePosInt.x, mousePosInt.y))
|
||||
.c_str());
|
||||
ImGui::TextUnformatted(localize_format(FORMAT_POSITION_SPACED, mousePosInt.x, mousePosInt.y).c_str());
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
@@ -100,12 +98,12 @@ void SpritesheetEditor::update(Manager& manager, Settings& settings, Resources&
|
||||
{
|
||||
ImGui::ColorEdit3(localize.get(LABEL_BACKGROUND_COLOR), values_get(backgroundColor),
|
||||
ImGuiColorEditFlags_NoInputs);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_BACKGROUND_COLOR));
|
||||
tooltip_set(TOOLTIP_BACKGROUND_COLOR);
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
|
||||
ImGui::Checkbox(localize.get(LABEL_BORDER), &isBorder);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SPRITESHEET_BORDER));
|
||||
tooltip_set(TOOLTIP_SPRITESHEET_BORDER);
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
@@ -114,7 +112,7 @@ void SpritesheetEditor::update(Manager& manager, Settings& settings, Resources&
|
||||
if (ImGui::BeginChild("##Background Child 2", subChildSize))
|
||||
{
|
||||
ImGui::Checkbox(localize.get(LABEL_TRANSPARENT), &isTransparent);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_TRANSPARENT));
|
||||
tooltip_set(TOOLTIP_TRANSPARENT);
|
||||
}
|
||||
|
||||
ImGui::EndChild();
|
||||
|
||||
+39
-44
@@ -117,8 +117,7 @@ static void spritesheets_merge_popup_update(Panel& panel, SpritesheetsPanel& spr
|
||||
{
|
||||
auto& [manager, settings, resources, dialog, clipboard, document, state] = panel;
|
||||
auto& popup = spritesheets.mergePopup;
|
||||
popup.trigger();
|
||||
if (!ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (!popup.begin())
|
||||
return popup.end();
|
||||
|
||||
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::RadioButton(localize.get(LABEL_MERGE_SPRITESHEETS_APPEND_BOTTOM), &settings.mergeSpritesheetsOrigin,
|
||||
APPEND_BOTTOM);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_MERGE_SPRITESHEETS_BOTTOM_LEFT));
|
||||
tooltip_set(TOOLTIP_MERGE_SPRITESHEETS_BOTTOM_LEFT);
|
||||
ImGui::SameLine();
|
||||
ImGui::RadioButton(localize.get(LABEL_MERGE_SPRITESHEETS_APPEND_RIGHT), &settings.mergeSpritesheetsOrigin,
|
||||
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::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::Checkbox(localize.get(LABEL_MERGE_MAKE_PRIMARY_SPRITESHEET_REGION),
|
||||
&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),
|
||||
localize.get(LABEL_REGION_ORIGIN_CENTER)};
|
||||
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& popup = spritesheets.packPopup;
|
||||
popup.trigger();
|
||||
if (!ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (!popup.begin())
|
||||
return popup.end();
|
||||
|
||||
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)
|
||||
{
|
||||
auto& popup = spritesheets.overwritePopup;
|
||||
popup.trigger();
|
||||
if (!ImGui::BeginPopupModal(popup.label(), &popup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (!popup.begin())
|
||||
return popup.end();
|
||||
|
||||
ImGui::TextUnformatted(localize.get(LABEL_OVERWRITE_CONFIRMATION));
|
||||
@@ -302,40 +299,38 @@ void spritesheets_update(Panel& panel, SpritesheetsPanel& spritesheets)
|
||||
auto& image = isValid ? *texture : resources.icons[ICON_NONE];
|
||||
return CardImage{.texture = &image, .size = Vec2(image.size), .isValid = isValid};
|
||||
};
|
||||
ListRows rows{
|
||||
.label_get =
|
||||
[&](int id) {
|
||||
auto pathString = path_to_utf8(spritesheet_get(document, id)->path);
|
||||
auto label = std::vformat(localize.get(FORMAT_SPRITESHEET), std::make_format_args(id, pathString));
|
||||
return document.spritesheet_is_dirty(id)
|
||||
? std::vformat(localize.get(FORMAT_SPRITESHEET_NOT_SAVED), std::make_format_args(label))
|
||||
: label;
|
||||
},
|
||||
.tooltip_draw =
|
||||
[&](int id) {
|
||||
auto image = image_get(id);
|
||||
tooltip_image_draw(image, [&]() {
|
||||
tooltip_name_draw(resources, path_to_utf8(spritesheet_get(document, id)->path));
|
||||
ImGui::TextUnformatted(
|
||||
std::vformat(localize.get(FORMAT_ID), std::make_format_args(id)).c_str());
|
||||
if (image.isValid)
|
||||
ImGui::TextUnformatted(
|
||||
std::vformat(localize.get(FORMAT_TEXTURE_SIZE),
|
||||
std::make_format_args(image.texture->size.x, image.texture->size.y))
|
||||
.c_str());
|
||||
else
|
||||
ImGui::TextUnformatted(localize.get(TOOLTIP_SPRITESHEET_INVALID));
|
||||
ImGui::TextUnformatted(localize.get(TEXT_OPEN_DIRECTORY));
|
||||
});
|
||||
},
|
||||
.image_get = image_get,
|
||||
.select =
|
||||
[&](int) {
|
||||
document.editTarget = Document::EditTarget::SPRITESHEET;
|
||||
document.selected_clear(SelectionKind::REGIONS);
|
||||
},
|
||||
.activate = open,
|
||||
.cardLines = SPRITESHEET_CARD_LINES};
|
||||
ListRows rows{.label_get =
|
||||
[&](int id) {
|
||||
auto pathString = path_to_utf8(spritesheet_get(document, id)->path);
|
||||
auto label = localize_format(FORMAT_SPRITESHEET, id, pathString);
|
||||
return document.spritesheet_is_dirty(id)
|
||||
? localize_format(FORMAT_SPRITESHEET_NOT_SAVED, label)
|
||||
: label;
|
||||
},
|
||||
.tooltip_draw =
|
||||
[&](int id) {
|
||||
auto image = image_get(id);
|
||||
tooltip_image_draw(image, [&]() {
|
||||
tooltip_name_draw(resources, path_to_utf8(spritesheet_get(document, id)->path));
|
||||
ImGui::TextUnformatted(localize_format(FORMAT_ID, id).c_str());
|
||||
if (image.isValid)
|
||||
ImGui::TextUnformatted(std::vformat(localize.get(FORMAT_TEXTURE_SIZE),
|
||||
std::make_format_args(image.texture->size.x,
|
||||
image.texture->size.y))
|
||||
.c_str());
|
||||
else
|
||||
ImGui::TextUnformatted(localize.get(TOOLTIP_SPRITESHEET_INVALID));
|
||||
ImGui::TextUnformatted(localize.get(TEXT_OPEN_DIRECTORY));
|
||||
});
|
||||
},
|
||||
.image_get = image_get,
|
||||
.select =
|
||||
[&](int) {
|
||||
document.editTarget = Document::EditTarget::SPRITESHEET;
|
||||
document.selected_clear(SelectionKind::REGIONS);
|
||||
},
|
||||
.activate = open,
|
||||
.cardLines = SPRITESHEET_CARD_LINES};
|
||||
list_panel_draw(
|
||||
panel, actions, {{ACTION_ADD, ACTION_RELOAD, ACTION_REPLACE}, {ACTION_REMOVE, ACTION_SAVE}},
|
||||
[&]() { content_list_draw(panel, SelectionKind::SPRITESHEETS, item_ids_get(items), rows); }, true);
|
||||
|
||||
+16
-28
@@ -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,
|
||||
isGenerateAnimationFromGridAvailable))
|
||||
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))
|
||||
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))
|
||||
{
|
||||
@@ -172,7 +172,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
|
||||
}});
|
||||
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();
|
||||
|
||||
@@ -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,
|
||||
isChangeAllFramesAvailable || isChangeAllAnimationsAvailable))
|
||||
changePopup.open();
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_WIZARD_CHANGE_ALL_FRAME_PROPERTIES));
|
||||
tooltip_set(TOOLTIP_WIZARD_CHANGE_ALL_FRAME_PROPERTIES);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::MenuItem(localize.get(LABEL_TASKBAR_RENDER_ANIMATION), nullptr, false,
|
||||
animation && manager.isAbleToRecord))
|
||||
renderPopup.open();
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_WIZARD_RENDER_ANIMATION));
|
||||
tooltip_set(TOOLTIP_WIZARD_RENDER_ANIMATION);
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
@@ -197,10 +197,10 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
|
||||
if (ImGui::BeginMenu(localize.get(LABEL_PLAYBACK_MENU)))
|
||||
{
|
||||
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::SetItemTooltip("%s", localize.get(TOOLTIP_PLAYBACK_CLAMP));
|
||||
tooltip_set(TOOLTIP_PLAYBACK_CLAMP);
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
@@ -233,9 +233,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
|
||||
generatePopup.trigger();
|
||||
|
||||
if (ImGui::BeginPopupModal(generatePopup.label(), &generatePopup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (generatePopup.begin())
|
||||
{
|
||||
if (document)
|
||||
{
|
||||
@@ -246,8 +244,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
generateRegionsPopup.trigger();
|
||||
if (ImGui::BeginPopupModal(generateRegionsPopup.label(), &generateRegionsPopup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (generateRegionsPopup.begin())
|
||||
{
|
||||
if (document)
|
||||
{
|
||||
@@ -299,9 +296,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
|
||||
}
|
||||
generateRegionsPopup.end();
|
||||
|
||||
changePopup.trigger();
|
||||
|
||||
if (ImGui::BeginPopupModal(changePopup.label(), &changePopup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (changePopup.begin())
|
||||
{
|
||||
if (document)
|
||||
{
|
||||
@@ -312,8 +307,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
configurePopup.trigger();
|
||||
if (ImGui::BeginPopupModal(configurePopup.label(), &configurePopup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (configurePopup.begin())
|
||||
{
|
||||
if (configurePopup.isJustOpened)
|
||||
configure.reset(settings);
|
||||
@@ -324,8 +318,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
|
||||
}
|
||||
configurePopup.end();
|
||||
|
||||
renderPopup.trigger();
|
||||
if (ImGui::BeginPopupModal(renderPopup.label(), &renderPopup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (renderPopup.begin())
|
||||
{
|
||||
if (document)
|
||||
{
|
||||
@@ -339,8 +332,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
|
||||
}
|
||||
renderPopup.end();
|
||||
|
||||
aboutPopup.trigger();
|
||||
if (ImGui::BeginPopupModal(aboutPopup.label(), &aboutPopup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (aboutPopup.begin())
|
||||
{
|
||||
if (aboutPopup.isJustOpened)
|
||||
about.reset(resources);
|
||||
@@ -352,9 +344,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
|
||||
if (is_audio_playing(*music) && !aboutPopup.isOpen)
|
||||
audio_stop(*music);
|
||||
|
||||
overwritePopup.trigger();
|
||||
|
||||
if (ImGui::BeginPopupModal(overwritePopup.label(), &overwritePopup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (overwritePopup.begin())
|
||||
{
|
||||
ImGui::TextUnformatted(localize.get(LABEL_OVERWRITE_CONFIRMATION));
|
||||
|
||||
@@ -376,8 +366,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
|
||||
|
||||
aboutPopup.end();
|
||||
|
||||
vectorPopup.trigger();
|
||||
if (ImGui::BeginPopupModal(vectorPopup.label(), &vectorPopup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (vectorPopup.begin())
|
||||
{
|
||||
ImGui::TextWrapped("%s", localize.get(TEXT_CONVERT_SVG));
|
||||
auto widgetSize = widget_size_with_row_get(2);
|
||||
@@ -400,8 +389,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
|
||||
}
|
||||
vectorPopup.end();
|
||||
|
||||
isaacPopup.trigger();
|
||||
if (ImGui::BeginPopupModal(isaacPopup.label(), &isaacPopup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (isaacPopup.begin())
|
||||
{
|
||||
if (settings.fileIsJson)
|
||||
ImGui::TextWrapped("%s", localize.get(TEXT_ISAAC_JSON));
|
||||
|
||||
+16
-21
@@ -1,4 +1,5 @@
|
||||
#include "ui/timeline_context.h"
|
||||
#include "ui/layout.h"
|
||||
|
||||
Timeline::Timeline() = default;
|
||||
Timeline::~Timeline() = default;
|
||||
@@ -64,8 +65,7 @@ void TimelineContext::draw()
|
||||
|
||||
void TimelineContext::popups_update()
|
||||
{
|
||||
makeManyRegionsPopup.trigger();
|
||||
if (ImGui::BeginPopupModal(makeManyRegionsPopup.label(), &makeManyRegionsPopup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (makeManyRegionsPopup.begin())
|
||||
{
|
||||
input_text_string(localize.get(LABEL_FORMAT), &settings.generateRegionNameFormat);
|
||||
ImGui::Checkbox(localize.get(LABEL_MAP_FRAMES_TO_REGIONS), &isMakeManyRegionsMapFrames);
|
||||
@@ -83,9 +83,7 @@ void TimelineContext::popups_update()
|
||||
}
|
||||
makeManyRegionsPopup.end();
|
||||
|
||||
bakePopup.trigger();
|
||||
|
||||
if (ImGui::BeginPopupModal(bakePopup.label(), &bakePopup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (bakePopup.begin())
|
||||
{
|
||||
auto& interval = settings.bakeInterval;
|
||||
auto& isRoundRotation = settings.bakeIsRoundRotation;
|
||||
@@ -95,13 +93,13 @@ void TimelineContext::popups_update()
|
||||
|
||||
input_int_range(localize.get(LABEL_INTERVAL), interval, 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::SetItemTooltip("%s", localize.get(TOOLTIP_ROUND_ROTATION));
|
||||
tooltip_set(TOOLTIP_ROUND_ROTATION);
|
||||
|
||||
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);
|
||||
|
||||
@@ -111,22 +109,19 @@ void TimelineContext::popups_update()
|
||||
frames_bake();
|
||||
bakePopup.close();
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_BAKE_FRAMES_OPTIONS));
|
||||
tooltip_set(TOOLTIP_BAKE_FRAMES_OPTIONS);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
shortcut(manager.chords[SHORTCUT_CANCEL]);
|
||||
if (ImGui::Button(localize.get(BASIC_CANCEL), widgetSize))
|
||||
bakePopup.close();
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CANCEL_BAKE_FRAMES));
|
||||
tooltip_set(TOOLTIP_CANCEL_BAKE_FRAMES);
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
bakeIntoOtherFramesPopup.trigger();
|
||||
|
||||
if (ImGui::BeginPopupModal(bakeIntoOtherFramesPopup.label(), &bakeIntoOtherFramesPopup.isOpen,
|
||||
ImGuiWindowFlags_NoResize))
|
||||
if (bakeIntoOtherFramesPopup.begin())
|
||||
{
|
||||
auto& isRoundRotation = settings.bakeIsRoundRotation;
|
||||
auto& isRoundScale = settings.bakeIsRoundScale;
|
||||
@@ -135,10 +130,10 @@ void TimelineContext::popups_update()
|
||||
int target = (int)bakeIntoOtherFramesTarget;
|
||||
ImGui::RadioButton(localize.get(LABEL_CURRENT_SELECTION), &target,
|
||||
(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::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;
|
||||
|
||||
auto isCurrentSelection = bakeIntoOtherFramesTarget == BakeIntoOtherFramesTarget::CURRENT_SELECTION;
|
||||
@@ -149,16 +144,16 @@ void TimelineContext::popups_update()
|
||||
ImGui::EndDisabled();
|
||||
|
||||
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::SetItemTooltip("%s", localize.get(TOOLTIP_ROUND_SCALE));
|
||||
tooltip_set(TOOLTIP_ROUND_SCALE);
|
||||
|
||||
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::SetItemTooltip("%s", localize.get(TOOLTIP_BAKE_USE_ROOT_PIVOT));
|
||||
tooltip_set(TOOLTIP_BAKE_USE_ROOT_PIVOT);
|
||||
|
||||
auto widgetSize = widget_size_with_row_get(2);
|
||||
|
||||
@@ -176,7 +171,7 @@ void TimelineContext::popups_update()
|
||||
shortcut(manager.chords[SHORTCUT_CANCEL]);
|
||||
if (ImGui::Button(localize.get(BASIC_CANCEL), widgetSize))
|
||||
bakeIntoOtherFramesPopup.close();
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CANCEL_BAKE_FRAMES));
|
||||
tooltip_set(TOOLTIP_CANCEL_BAKE_FRAMES);
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#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),
|
||||
// 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();
|
||||
if (ImGui::IsWindowHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left))
|
||||
child_step_in(row);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CHILD_TRACK));
|
||||
tooltip_set(TOOLTIP_CHILD_TRACK);
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::PopStyleVar(2);
|
||||
@@ -153,7 +154,7 @@ void TimelineContext::breadcrumb_draw()
|
||||
manager.command_push({.runManager = [index = manager.selected, stepIndex](Manager& manager) {
|
||||
manager.child_step_out(index, stepIndex);
|
||||
}});
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_STEP_OUT));
|
||||
tooltip_set(TOOLTIP_STEP_OUT);
|
||||
ImGui::PopID();
|
||||
ImGui::SameLine();
|
||||
ImGui::TextUnformatted(BREADCRUMB_SEPARATOR);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "ui/timeline_context.h"
|
||||
#include "ui/layout.h"
|
||||
|
||||
// Moves the dragged frames to `target`'s track, before its frame index.
|
||||
void TimelineContext::frames_move_to(Reference target)
|
||||
@@ -903,7 +904,7 @@ void TimelineContext::frames_child()
|
||||
}
|
||||
if (ImGui::IsItemDeactivated())
|
||||
animationLengthEditIndex = -1;
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ANIMATION_LENGTH));
|
||||
tooltip_set(TOOLTIP_ANIMATION_LENGTH);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
@@ -917,7 +918,7 @@ void TimelineContext::frames_child()
|
||||
animation->isLoop = isLoop;
|
||||
});
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_LOOP_ANIMATION));
|
||||
tooltip_set(TOOLTIP_LOOP_ANIMATION);
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
|
||||
@@ -927,7 +928,7 @@ void TimelineContext::frames_child()
|
||||
ImGui::SetNextItemWidth(widgetSize.x);
|
||||
if (input_int_range(localize.get(LABEL_FPS), fps, FPS_MIN, FPS_MAX))
|
||||
edit_push(EDIT_FPS, [=](Model& model) { model.info.fps = fps; });
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_FPS));
|
||||
tooltip_set(TOOLTIP_FPS);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
@@ -935,13 +936,13 @@ void TimelineContext::frames_child()
|
||||
ImGui::SetNextItemWidth(widgetSize.x);
|
||||
if (input_text_string(localize.get(LABEL_AUTHOR), &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::SetNextItemWidth(widgetSize.x);
|
||||
ImGui::Checkbox(localize.get(LABEL_SOUND), &settings.timelineIsSound);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SOUND));
|
||||
tooltip_set(TOOLTIP_SOUND);
|
||||
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "ui/timeline_context.h"
|
||||
#include "ui/layout.h"
|
||||
|
||||
constexpr StringType FRAME_PROPERTY_LABELS[] = {
|
||||
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()
|
||||
{
|
||||
groupPropertiesPopup.trigger();
|
||||
|
||||
if (ImGui::BeginPopupModal(groupPropertiesPopup.label(), &groupPropertiesPopup.isOpen, ImGuiWindowFlags_NoResize))
|
||||
if (groupPropertiesPopup.begin())
|
||||
{
|
||||
auto childSize = child_size_get(1);
|
||||
if (ImGui::BeginChild("##Group Properties Child", childSize, ImGuiChildFlags_Borders))
|
||||
@@ -249,7 +248,7 @@ void TimelineContext::group_properties_update()
|
||||
if (groupPropertiesPopup.isJustOpened)
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
input_text_string(localize.get(BASIC_NAME), &groupName);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ITEM_NAME));
|
||||
tooltip_set(TOOLTIP_ITEM_NAME);
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
|
||||
+15
-37
@@ -158,10 +158,9 @@ void TimelineContext::item_child(const TimelineRow& row, int index)
|
||||
ImGui::PushFont(resources.fonts[FONT_BOLD], FONT_SIZE);
|
||||
ImGui::TextUnformatted(label.c_str());
|
||||
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();
|
||||
ImGui::TextUnformatted(
|
||||
std::vformat(localize.get(FORMAT_ITEMS_COUNT), std::make_format_args(groupItemsCount)).c_str());
|
||||
ImGui::TextUnformatted(localize_format(FORMAT_ITEMS_COUNT, groupItemsCount).c_str());
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
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);
|
||||
if (!null)
|
||||
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]);
|
||||
}();
|
||||
@@ -311,16 +310,10 @@ void TimelineContext::item_child(const TimelineRow& row, int index)
|
||||
ImGui::TextUnformatted(localize.get(BASIC_ROOT));
|
||||
ImGui::PopFont();
|
||||
|
||||
ImGui::TextUnformatted(
|
||||
std::vformat(localize.get(FORMAT_VISIBLE), std::make_format_args(visibleLabel))
|
||||
.c_str());
|
||||
ImGui::TextUnformatted(localize_format(FORMAT_VISIBLE, visibleLabel).c_str());
|
||||
auto transformLabel = yesNoLabel(settings.previewIsRootTransform);
|
||||
ImGui::TextUnformatted(
|
||||
std::vformat(localize.get(FORMAT_TRANSFORM), std::make_format_args(transformLabel))
|
||||
.c_str());
|
||||
ImGui::TextUnformatted(
|
||||
std::vformat(localize.get(FORMAT_FRAMES_COUNT), std::make_format_args(framesCount))
|
||||
.c_str());
|
||||
ImGui::TextUnformatted(localize_format(FORMAT_TRANSFORM, transformLabel).c_str());
|
||||
ImGui::TextUnformatted(localize_format(FORMAT_FRAMES_COUNT, framesCount).c_str());
|
||||
break;
|
||||
}
|
||||
case LAYER:
|
||||
@@ -332,15 +325,10 @@ void TimelineContext::item_child(const TimelineRow& row, int index)
|
||||
ImGui::TextUnformatted(layer->name.c_str());
|
||||
ImGui::PopFont();
|
||||
|
||||
ImGui::TextUnformatted(
|
||||
std::vformat(localize.get(FORMAT_ID), std::make_format_args(id)).c_str());
|
||||
ImGui::TextUnformatted(localize_format(FORMAT_ID, id).c_str());
|
||||
layer_source_tooltip_draw(document, *layer);
|
||||
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());
|
||||
ImGui::TextUnformatted(localize_format(FORMAT_VISIBLE, visibleLabel).c_str());
|
||||
ImGui::TextUnformatted(localize_format(FORMAT_FRAMES_COUNT, framesCount).c_str());
|
||||
break;
|
||||
}
|
||||
case NULL_:
|
||||
@@ -353,16 +341,10 @@ void TimelineContext::item_child(const TimelineRow& row, int index)
|
||||
ImGui::PopFont();
|
||||
|
||||
auto rectLabel = yesNoLabel(nullInfo->isShowRect);
|
||||
ImGui::TextUnformatted(
|
||||
std::vformat(localize.get(FORMAT_ID), std::make_format_args(id)).c_str());
|
||||
ImGui::TextUnformatted(
|
||||
std::vformat(localize.get(FORMAT_RECT), std::make_format_args(rectLabel)).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());
|
||||
ImGui::TextUnformatted(localize_format(FORMAT_ID, id).c_str());
|
||||
ImGui::TextUnformatted(localize_format(FORMAT_RECT, rectLabel).c_str());
|
||||
ImGui::TextUnformatted(localize_format(FORMAT_VISIBLE, visibleLabel).c_str());
|
||||
ImGui::TextUnformatted(localize_format(FORMAT_FRAMES_COUNT, framesCount).c_str());
|
||||
break;
|
||||
}
|
||||
case TRIGGER:
|
||||
@@ -371,12 +353,8 @@ void TimelineContext::item_child(const TimelineRow& row, int index)
|
||||
ImGui::TextUnformatted(localize.get(BASIC_TRIGGERS));
|
||||
ImGui::PopFont();
|
||||
|
||||
ImGui::TextUnformatted(
|
||||
std::vformat(localize.get(FORMAT_VISIBLE), std::make_format_args(visibleLabel))
|
||||
.c_str());
|
||||
ImGui::TextUnformatted(
|
||||
std::vformat(localize.get(FORMAT_TRIGGERS_COUNT), std::make_format_args(framesCount))
|
||||
.c_str());
|
||||
ImGui::TextUnformatted(localize_format(FORMAT_VISIBLE, visibleLabel).c_str());
|
||||
ImGui::TextUnformatted(localize_format(FORMAT_TRIGGERS_COUNT, framesCount).c_str());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
Reference in new issue
Block a user