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
+12 -9
View File
@@ -20,18 +20,18 @@
IMPLEMENT_VALUE_EDITOR(Image) {}
bool ImageValueEditor::onLeftDClick(const RealPoint&, wxMouseEvent&) {
String directory = settings.default_image_dir;
String directory = settings.default_image_dir;
String filename = _("");
CardP card = parent.getCard();
String cardname = card ? card->identification() : _("clipboard");
if (ImageSliceWindow::previously_used_settings_path.find(cardname) != ImageSliceWindow::previously_used_settings_path.end()) {
String filepath = ImageSliceWindow::previously_used_settings_path[cardname];
String cardname = card ? card->identification() : _("clipboard");
if (ImageSliceWindow::previously_used_settings_path.find(cardname) != ImageSliceWindow::previously_used_settings_path.end()) {
String filepath = ImageSliceWindow::previously_used_settings_path[cardname];
size_t pos = filepath.rfind(wxFileName::GetPathSeparator());
if (pos != String::npos) {
directory = filepath.substr(0, pos+1);
filename = filepath.substr(pos+1);
}
}
}
}
filename = wxFileSelector(_("Open image file"), directory, filename, _(""),
_("All images|*.bmp;*.jpg;*.jpeg;*.png;*.gif;*.tif;*.tiff|Windows bitmaps (*.bmp)|*.bmp|JPEG images (*.jpg;*.jpeg)|*.jpg;*.jpeg|PNG images (*.png)|*.png|GIF images (*.gif)|*.gif|TIFF images (*.tif;*.tiff)|*.tif;*.tiff"),
wxFD_OPEN, wxGetTopLevelParent(&editor()));
@@ -53,12 +53,15 @@ void ImageValueEditor::sliceImage(const Image& image, const String& filename, co
GeneratedImage::Options options((int)style().width, (int)style().height, &parent.getStylePackage(), &parent.getLocalPackage());
AlphaMask mask;
style().mask.getNoCache(options,mask);
// slice
ImageSliceWindow s(wxGetTopLevelParent(&editor()), image, filename, cardname, style().getSize(), mask);
// slice
ImageSliceWindow s(wxGetTopLevelParent(&editor()), image, filename, cardname, style().getSize(), mask);
// clicked ok?
if (s.ShowModal() == wxID_OK) {
// store the image into the set
LocalFileName new_image_file = getLocalPackage().newFileName(field().name, settings.internal_image_extension ? _(".png") : _("")); // a new unique name in the package
StyleP style = field().styleP;
String rect = style ? style->getRect() : _("");
String extension = settings.internal_image_extension ? _(".png") : _("");
LocalFileName new_image_file = getLocalPackage().newFileName(field().name, rect + extension); // a new unique name in the package
// Specify a desired size based on the stylesheet and a scale multiplier defined within the user's settings.
// Storing at a greater than 100% resolution allows for better exports >100%, but may change how images look when filters (sharpen) are applied.