Card data in images (start)

* Add uuid implementation

* Simplify uid implementation

* Check for uid conflicts upon adding/copying cards

* Remove unnecessary checks

these are already checked as part of the first loop, since they were added to set.cards

* Implement card linking

* refactor to avoid triple loop

* Start link visualization

* Continue link visualization

* formatting

* add missing locale entries

* improve layout

* improve UI refresh

* copy links when copying cards

* implement second face editor

* refactor using macros

* get references

* pasting multiple cards and links

* start refactoring editors

* continue refactoring editors

* continue refactoring editors again

* finish refactoring editors

* refresh card list on link editor event

* tweak event handling

* Add insert_image script function

* change parameter type

* add script functions to get cards

* add dimensions_of script function

calculate both dimensions simultaneously while rendering the image only once.

* save value even if not editable

* add get_mse_locale script function

* Change zoom scale choices

* bug fixes

* Scale symbol spacing with font size

* sync locales

* standardize line ending

* handle links in new_card

* initial

waiting on wxWidgets 3.3.1

* update comment

* store rect in image filename

* store rect in temp file name

* Update package.cpp

* change line endings
This commit is contained in:
GenevensiS
2025-08-11 16:57:04 +02:00
committed by GitHub
parent 3bf9de18b1
commit 81e9a1e26f
16 changed files with 193 additions and 110 deletions
+7 -2
View File
@@ -272,6 +272,11 @@ String Package::nameOut(const String& file) {
} else {
// create temp file
String name = wxFileName::CreateTempFileName(_("mse"));
String rect = LocalFileName::getRect(file);
if (!rect.empty()) {
if (name.Contains(".")) name = name.BeforeLast('.') + rect + _(".") + name.AfterLast('.');
else name = name + rect;
}
it->second.tempName = name;
return name;
}
@@ -361,7 +366,7 @@ LocalFileName LocalFileName::fromReadString(String const& fn, String const& pref
if (!fn.empty() && clipboard_package()) {
// copy file into current package
try {
LocalFileName local_name = clipboard_package()->newFileName(_("image"),_("")); // a new unique name in the package, assume it's an image
LocalFileName local_name = clipboard_package()->newFileName(_("image"), getRect(fn)); // a new unique name in the package, assume it's an image
auto out_stream = clipboard_package()->openOut(local_name);
auto in_stream = Package::openAbsoluteFile(fn);
out_stream->Write(*in_stream); // copy
@@ -657,7 +662,7 @@ void Packaged::validate(Version) {
if (short_name.empty()) {
if (!full_name.empty()) short_name = full_name;
else short_name = folder_name;
}
}
// check dependencies
FOR_EACH(dep, dependencies) {
package_manager.checkDependency(*dep, true);
+9
View File
@@ -53,6 +53,15 @@ public:
inline String const& toStringForKey() const { return fn; }
/// Retreive a rect from a filename
static String getRect(const String& file) {
size_t first = file.find(_("---"));
if (first == String::npos) return _("");
size_t last = file.find(_("---"), first+3);
if (first == last) return _("");
return file.substr(first, last + 3 - first);
}
private:
LocalFileName(const wxString& fn) : fn(fn) {}
String fn;
+2 -2
View File
@@ -89,9 +89,9 @@ String tr(const String&, const String& subcat, const String& key, DefaultLocaleF
#define _HELP_1_(s,a) format_string(_HELP_(s), a)
/// A localized string for tooltip labels, with 1 argument (printf style)
#define _TOOL_1_(s,a) format_string(_TOOL_(s), a)
#define _TOOL_1_(s,a) format_string(_TOOL_(s), a)
/// A localized string for tooltip labels, with 2 argument (printf style)
#define _TOOL_2_(s,a,b) format_string(_TOOL_(s), a, b)
#define _TOOL_2_(s,a,b) format_string(_TOOL_(s), a, b)
/// A localized string for tooltip labels, with 3 argument (printf style)
#define _TOOL_3_(s,a,b,c) format_string(_TOOL_(s), a, b, c)