Remove namespaces, and make file-local helpers static
Names that only a namespace told apart get prefixes: TOOL_PAN, FONT_BOLD, ICON_FOLDER, COLOR_WHITE, path_to_utf8 and so on. The OpenGL shader class is ShaderProgram, and its uniform ShaderUniform, beside the document's Shader and Uniform. Free functions a member of the same name would hide are called through :: for now. Two unused shader window helpers are gone.
This commit is contained in:
1 parent
7fb2c607c2
commit
666f65bf3a
174 files changed
+2396
-3154
No files matched your search
+12
-15
@@ -1,8 +1,6 @@
|
||||
#include "selection.h"
|
||||
|
||||
namespace anm2ed
|
||||
{
|
||||
std::set<Reference> selection_references_get(const Selection& selection, const model::UidIndex& index,
|
||||
std::set<Reference> selection_references_get(const Selection& selection, const UidIndex& index,
|
||||
SelectionKind kind)
|
||||
{
|
||||
std::set<Reference> references{};
|
||||
@@ -12,12 +10,12 @@ namespace anm2ed
|
||||
return references;
|
||||
}
|
||||
|
||||
std::uint64_t handle_uid_get(Handle handle)
|
||||
static std::uint64_t handle_uid_get(Handle handle)
|
||||
{
|
||||
return handle.frame ? handle.frame : handle.item ? handle.item : handle.animation;
|
||||
}
|
||||
|
||||
void selection_references_set(Selection& selection, const model::Model& model, SelectionKind kind,
|
||||
void selection_references_set(Selection& selection, const Model& model, SelectionKind kind,
|
||||
const std::set<Reference>& references)
|
||||
{
|
||||
auto& uids = selection.uids[kind];
|
||||
@@ -27,20 +25,20 @@ namespace anm2ed
|
||||
}
|
||||
|
||||
// The most specific part of the focus that still exists.
|
||||
Reference selection_focus_get(const Selection& selection, const model::UidIndex& index)
|
||||
Reference selection_focus_get(const Selection& selection, const UidIndex& index)
|
||||
{
|
||||
for (auto uid : {selection.focus.frame, selection.focus.item, selection.focus.animation})
|
||||
if (auto reference = index.reference_get(uid)) return *reference;
|
||||
return {};
|
||||
}
|
||||
|
||||
void selection_focus_set(Selection& selection, const model::Model& model, Reference reference)
|
||||
void selection_focus_set(Selection& selection, const Model& model, Reference reference)
|
||||
{
|
||||
selection.focus = model.handle_get(reference);
|
||||
}
|
||||
|
||||
// (id, uid) of every content item a kind selects from.
|
||||
std::vector<std::pair<int, std::uint64_t>> content_keys_get(const Selection& selection, const model::Model& model,
|
||||
static std::vector<std::pair<int, std::uint64_t>> content_keys_get(const Selection& selection, const Model& model,
|
||||
SelectionKind kind)
|
||||
{
|
||||
std::vector<std::pair<int, std::uint64_t>> keys{};
|
||||
@@ -58,13 +56,13 @@ namespace anm2ed
|
||||
if (kind == SelectionKind::SOUNDS) add(content.sounds);
|
||||
if (kind == SelectionKind::LIBRARIES) add(content.libraries);
|
||||
if (kind == SelectionKind::REGIONS)
|
||||
if (auto spritesheet = model::item_get(content.spritesheets,
|
||||
if (auto spritesheet = item_get(content.spritesheets,
|
||||
selection_focus_id_get(selection, model, SelectionKind::SPRITESHEETS)))
|
||||
add(spritesheet->regions);
|
||||
return keys;
|
||||
}
|
||||
|
||||
std::set<int> selection_ids_get(const Selection& selection, const model::Model& model, SelectionKind kind)
|
||||
std::set<int> selection_ids_get(const Selection& selection, const Model& model, SelectionKind kind)
|
||||
{
|
||||
std::set<int> ids{};
|
||||
auto uids = selection.uids.find(kind);
|
||||
@@ -74,7 +72,7 @@ namespace anm2ed
|
||||
return ids;
|
||||
}
|
||||
|
||||
void selection_ids_set(Selection& selection, const model::Model& model, SelectionKind kind, const std::set<int>& ids)
|
||||
void selection_ids_set(Selection& selection, const Model& model, SelectionKind kind, const std::set<int>& ids)
|
||||
{
|
||||
auto& uids = selection.uids[kind];
|
||||
uids.clear();
|
||||
@@ -82,7 +80,7 @@ namespace anm2ed
|
||||
if (ids.contains(id)) uids.insert(uid);
|
||||
}
|
||||
|
||||
int selection_focus_id_get(const Selection& selection, const model::Model& model, SelectionKind kind)
|
||||
int selection_focus_id_get(const Selection& selection, const Model& model, SelectionKind kind)
|
||||
{
|
||||
auto focus = selection.focuses.find(kind);
|
||||
if (focus == selection.focuses.end()) return -1;
|
||||
@@ -91,7 +89,7 @@ namespace anm2ed
|
||||
return -1;
|
||||
}
|
||||
|
||||
void selection_focus_id_set(Selection& selection, const model::Model& model, SelectionKind kind, int id)
|
||||
void selection_focus_id_set(Selection& selection, const Model& model, SelectionKind kind, int id)
|
||||
{
|
||||
selection.focuses.erase(kind);
|
||||
for (auto [itemId, uid] : content_keys_get(selection, model, kind))
|
||||
@@ -104,7 +102,7 @@ namespace anm2ed
|
||||
|
||||
// After an edit: drops uids that no longer exist, and moves a focus whose element was removed to its nearest
|
||||
// survivor (a frame at the same index of its track, the animation's root track, or the nearest animation).
|
||||
void selection_follow(Selection& selection, const model::Model& model, const model::UidIndex& index, Reference before)
|
||||
void selection_follow(Selection& selection, const Model& model, const UidIndex& index, Reference before)
|
||||
{
|
||||
for (auto& [kind, uids] : selection.uids)
|
||||
if (kind < SelectionKind::SPRITESHEETS)
|
||||
@@ -133,4 +131,3 @@ namespace anm2ed
|
||||
|
||||
selection_focus_set(selection, model, reference);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user