Card data in images (minimum viable)

* remove wxEmptyString

* improve style tab carousel

* create web request window

* add drop target and drop source
This commit is contained in:
GenevensiS
2025-11-28 10:42:30 +01:00
committed by GitHub
parent f5b5c0968d
commit cf0a84a8a7
49 changed files with 815 additions and 399 deletions
+2 -2
View File
@@ -72,14 +72,14 @@ String ActionStack::undoName() const {
if (canUndo()) {
return _(" ") + capitalize(undo_actions.back()->getName(true));
} else {
return wxEmptyString;
return _("");
}
}
String ActionStack::redoName() const {
if (canRedo()) {
return _(" ") + capitalize(redo_actions.back()->getName(false));
} else {
return wxEmptyString;
return _("");
}
}
+4 -9
View File
@@ -272,11 +272,6 @@ 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;
}
@@ -366,7 +361,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"), getRect(fn)); // a new unique name in the package, assume it's an image
LocalFileName local_name = clipboard_package()->newFileName(_("image"), _("")); // 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
@@ -403,7 +398,7 @@ void Package::loadZipStream() {
}
void Package::openDirectory(bool fast) {
if (!fast) openSubdir(wxEmptyString);
if (!fast) openSubdir(_(""));
}
void Package::openSubdir(const String& name) {
@@ -411,7 +406,7 @@ void Package::openSubdir(const String& name) {
if (!d.IsOpened()) return; // ignore errors here
// find files
String f; // filename
for(bool ok = d.GetFirst(&f, wxEmptyString, wxDIR_FILES | wxDIR_HIDDEN) ; ok ; ok = d.GetNext(&f)) {
for(bool ok = d.GetFirst(&f, _(""), wxDIR_FILES | wxDIR_HIDDEN) ; ok ; ok = d.GetNext(&f)) {
if (ignore_file(f)) continue;
// add file to list of known files
addFile(name + f);
@@ -420,7 +415,7 @@ void Package::openSubdir(const String& name) {
modified = max(modified,file_time);
}
// find subdirs
for(bool ok = d.GetFirst(&f, wxEmptyString, wxDIR_DIRS | wxDIR_HIDDEN) ; ok ; ok = d.GetNext(&f)) {
for(bool ok = d.GetFirst(&f, _(""), wxDIR_DIRS | wxDIR_HIDDEN) ; ok ; ok = d.GetNext(&f)) {
if (!f.empty() && f.GetChar(0) != _('.')) {
// skip directories starting with '.', like ., .. and .svn
openSubdir(name+f+_("/"));
+36 -6
View File
@@ -54,12 +54,42 @@ 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);
inline static wxRect getExternalRect(const String& filename) {
size_t first = filename.find(_("---"));
if (first == String::npos) return wxRect();
size_t last = filename.find(_("---"), first+3);
if (last == String::npos) return wxRect();
String string = filename.substr(first + 3, last - (first + 3));
if (string.empty()) return wxRect();
size_t divider = string.find(_("-"));
if (divider == String::npos) return wxRect();
if (divider == 0) return wxRect();
int x;
if(!string.substr(0, divider).ToInt(&x)) return wxRect();
string = string.substr(divider + 1);
divider = string.find(_("-"));
if (divider == String::npos) return wxRect();
if (divider == 0) return wxRect();
int y;
if(!string.substr(0, divider).ToInt(&y)) return wxRect();
string = string.substr(divider + 1);
divider = string.find(_("-"));
if (divider == String::npos) return wxRect();
if (divider == 0) return wxRect();
int width;
if(!string.substr(0, divider).ToInt(&width)) return wxRect();
string = string.substr(divider + 1);
int height;
if(!string.ToInt(&height)) return wxRect();
return wxRect(x, y, width, height);
}
inline wxRect getExternalRect() {
return getExternalRect(fn);
}
private:
+1 -1
View File
@@ -154,7 +154,7 @@ String PackageManager::openFilenameFromPackage(Packaged* package, const String&
String PackageManager::getDictionaryDir(bool l) const {
String dir = (l ? local : global).getDirectory();
if (dir.empty()) return wxEmptyString;
if (dir.empty()) return _("");
else return dir + _("/dictionaries/");
}
+1 -1
View File
@@ -37,7 +37,7 @@ public:
/** filename is used only for error messages
* package is used for looking up included files.
*/
Reader(wxInputStream& input, Packaged* package = nullptr, const String& filename = wxEmptyString, bool ignore_invalid = false);
Reader(wxInputStream& input, Packaged* package = nullptr, const String& filename = _(""), bool ignore_invalid = false);
~Reader() { showWarnings(); }
+4 -4
View File
@@ -96,13 +96,13 @@ String fix_old_tags(const String& str) {
ret += c;
if (c==_('<')) {
intag = true;
tags.push(wxEmptyString);
tags.push(_(""));
} else if (c==_('>') && intag) {
intag = false;
if (!starts_with(tags.top(), _("kw")) && !starts_with(tags.top(), _("atom"))) {
// only keep keyword related stuff
ret.resize(ret.size() - tags.top().size() - 2); // remove from output
tags.top() = wxEmptyString;
tags.top() = _("");
}
} else if (intag) {
tags.top() += c;
@@ -303,13 +303,13 @@ bool is_in_tag(const String& str, const String& tag, size_t start, size_t end) {
String tag_at(const String& str, size_t pos) {
size_t end = str.find_first_of(_(">"), pos);
if (end == String::npos) return wxEmptyString;
if (end == String::npos) return _("");
return str.substr(pos + 1, end - pos - 1);
}
String tag_type_at(const String& str, size_t pos) {
size_t end = str.find_first_of(_(">-"), pos);
if (end == String::npos) return wxEmptyString;
if (end == String::npos) return _("");
return str.substr(pos + 1, end - pos - 1);
}