- Region generate/scan move to anm2/regions.cpp; both generators number from 1 - file_merge moves to anm2/merge.cpp and is table-driven - MaxRects packer moves to util/pack - Uniform config apply/trim/save move to resource/shader - Snapshots push from their owned state; Document snapshot wrappers removed - DocumentData base replaces the hand-written move constructor - toast_log replaces 55 duplicated toast + English log pairs - Apply repo .clang-format to touched files Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
49 lines
878 B
C++
49 lines
878 B
C++
#pragma once
|
|
|
|
#include <format>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "log.hpp"
|
|
#include "strings.hpp"
|
|
|
|
namespace anm2ed::imgui
|
|
{
|
|
class Toast
|
|
{
|
|
public:
|
|
std::string message{};
|
|
float lifetime{};
|
|
|
|
Toast(const std::string&);
|
|
};
|
|
|
|
class Toasts
|
|
{
|
|
public:
|
|
std::vector<Toast> toasts{};
|
|
|
|
void update();
|
|
void push(const std::string&);
|
|
};
|
|
|
|
}
|
|
|
|
extern anm2ed::imgui::Toasts toasts;
|
|
|
|
namespace anm2ed
|
|
{
|
|
template <class... Args> void toast_log(Level level, StringType type, Args&&... args)
|
|
{
|
|
auto format = [&](Language language) -> std::string
|
|
{
|
|
if constexpr (sizeof...(Args) == 0)
|
|
return localize.get(type, language);
|
|
else
|
|
return std::vformat(localize.get(type, language), std::make_format_args(args...));
|
|
};
|
|
toasts.push(format(localize.language));
|
|
logger.write(level, format(ENGLISH));
|
|
}
|
|
}
|