add webp support

This commit is contained in:
GenevensiS
2026-01-25 21:22:08 +01:00
parent 6b1c7488bf
commit 7fde6b2605
2 changed files with 10 additions and 6 deletions
+6 -3
View File
@@ -209,7 +209,7 @@ void SymbolWindow::onFileNew(wxCommandEvent& ev) {
}
void SymbolWindow::onFileOpen(wxCommandEvent& ev) {
String name = wxFileSelector(_("Open symbol"),settings.default_symbol_dir,_(""),_(""),_("Symbol files|*.mse-symbol;*.bmp|MSE2 symbol files (*.mse-symbol)|*.mse-symbol|Images/MSE1 symbol files|*.bmp;*.png;*.jpg;*.gif"),wxFD_OPEN|wxFD_FILE_MUST_EXIST, this);
String name = wxFileSelector(_("Open symbol"),settings.default_symbol_dir,_(""),_(""),_("All files|*.mse-symbol;*.bmp;*.jpg;*.jpeg;*.png;*.webp;*.gif;*.tif;*.tiff|MSE2 symbol files (*.mse-symbol)|*.mse-symbol|Images/MSE1 symbol files|*.bmp;*.jpg;*.jpeg;*.png;*.webp;*.gif;*.tif;*.tiff"),wxFD_OPEN|wxFD_FILE_MUST_EXIST, this);
if (!name.empty()) {
settings.default_symbol_dir = wxPathOnly(name);
wxFileName n(name);
@@ -221,8 +221,11 @@ void SymbolWindow::onFileOpen(wxCommandEvent& ev) {
reader.handle_greedy(symbol);
} else {
wxBusyCursor busy;
Image image(name);
if (!image.Ok()) return;
Image image(name);
if (!image.Ok()) {
queue_message(MESSAGE_ERROR, _ERROR_("can't load image"));
return;
}
symbol = import_symbol(image);
}
// show...
+4 -3
View File
@@ -34,7 +34,7 @@ bool ImageValueEditor::onLeftDClick(const RealPoint&, wxMouseEvent&) {
}
}
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"),
_("All images|*.bmp;*.jpg;*.jpeg;*.png;*.webp;*.gif;*.tif;*.tiff|Windows bitmaps (*.bmp)|*.bmp|JPEG images (*.jpg;*.jpeg)|*.jpg;*.jpeg|PNG images (*.png)|*.png|WebP images (*.webp)|*.webp|GIF images (*.gif)|*.gif|TIFF images (*.tif;*.tiff)|*.tif;*.tiff"),
wxFD_OPEN, wxGetTopLevelParent(&editor()));
if (!filename.empty()) {
settings.default_image_dir = wxPathOnly(filename);
@@ -42,8 +42,9 @@ bool ImageValueEditor::onLeftDClick(const RealPoint&, wxMouseEvent&) {
{
wxLogNull noLog;
image = wxImage(filename);
}
sliceImage(image, filename, cardname);
}
if (!image.Ok()) queue_message(MESSAGE_ERROR, _ERROR_("can't load image"));
else sliceImage(image, filename, cardname);
}
return true;
}