prevent dropdown from closing when moving to parent or child

This commit is contained in:
GenevensiS
2026-04-09 19:30:17 +02:00
parent a99c603ffb
commit 4d1c7aae96
20 changed files with 65 additions and 38 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ endif()
# You will most likely get a message about being unable to open hunspell-1.7.lib because pkgconf forgets to add the actual path to # You will most likely get a message about being unable to open hunspell-1.7.lib because pkgconf forgets to add the actual path to
# HUNSPELL_LIBRARIES. If so, uncomment the below line and point it to the correct vcpkg root folder/library. # HUNSPELL_LIBRARIES. If so, uncomment the below line and point it to the correct vcpkg root folder/library.
#set(HUNSPELL_LIBRARIES "C:\\PATH\\TO\\ROOT\\vcpkg\\installed\\${VCPKG_TARGET_TRIPLET}\\lib\\hunspell-1.7.lib") set(HUNSPELL_LIBRARIES "C:\\src\\vcpkg\\installed\\${VCPKG_TARGET_TRIPLET}\\lib\\hunspell-1.7.lib")
message("-- Does this have a full path? If not, and it's just a file name, it's broken: Found Hunspell at ${HUNSPELL_LIBRARIES}") message("-- Does this have a full path? If not, and it's just a file name, it's broken: Found Hunspell at ${HUNSPELL_LIBRARIES}")
include_directories("${PROJECT_BINARY_DIR}/src") include_directories("${PROJECT_BINARY_DIR}/src")
+2 -1
View File
@@ -1129,7 +1129,8 @@ error:
# image stuff # image stuff
coordinates for blending overlap: 坐标混合重叠 coordinates for blending overlap: 坐标混合重叠
images used for blending must have the same size: 边框用图像必须使用相同大小 #TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
#TODO: Localize #TODO: Localize
negative image width: Image with zero or negative width created in function '%s' negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize #TODO: Localize
+2 -1
View File
@@ -1127,7 +1127,8 @@ error:
# image stuff # image stuff
coordinates for blending overlap: 坐標混合重疊 coordinates for blending overlap: 坐標混合重疊
images used for blending must have the same size: 邊框用圖像必須使用相同大小 #TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
#TODO: Localize #TODO: Localize
negative image width: Image with zero or negative width created in function '%s' negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize #TODO: Localize
+2 -2
View File
@@ -1152,9 +1152,9 @@ error:
# image stuff # image stuff
#TODO: Localize #TODO: Localize
coordinates for blending overlap: Coordinates for blending overlap coordinates for blending overlap: Coordinates for blending overlap. Space them out.
#TODO: Localize #TODO: Localize
images used for blending must have the same size: Images used for blending must have the same size blending different sizes: Images used for blending must have the same size in function '%s'
#TODO: Localize #TODO: Localize
negative image width: Image with zero or negative width created in function '%s' negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize #TODO: Localize
+2 -2
View File
@@ -1046,8 +1046,8 @@ error:
im Reminder-Text der Fähigkeit '%s' im Reminder-Text der Fähigkeit '%s'
# image stuff # image stuff
coordinates for blending overlap: Koordinaten zum Blenden überlappen sich coordinates for blending overlap: Die Koordinaten für die Überblendung überlappen sich.
images used for blending must have the same size: Bilder müssen zum Mischen die selbe Größe haben. blending different sizes: Die für die Überblendung verwendeten Bilder müssen in der Funktion '%s' die gleiche Größe haben.
negative image width: Bild mit Breite Null oder negativer Breite, erstellt in der Funktion '%s' negative image width: Bild mit Breite Null oder negativer Breite, erstellt in der Funktion '%s'
negative image height: Bild mit Höhe Null oder negativer Höhe, erstellt in der Funktion '%s' negative image height: Bild mit Höhe Null oder negativer Höhe, erstellt in der Funktion '%s'
can't load image: Bild konnte nicht geladen werden. Stelle sicher, dass das tatsächliche Format des Bildes mit der gespeicherten Dateiendung übereinstimmt. can't load image: Bild konnte nicht geladen werden. Stelle sicher, dass das tatsächliche Format des Bildes mit der gespeicherten Dateiendung übereinstimmt.
+2 -2
View File
@@ -1047,8 +1047,8 @@ error:
in reminder text of keyword '%s' in reminder text of keyword '%s'
# image stuff # image stuff
coordinates for blending overlap: Coordinates for blending overlap coordinates for blending overlap: Coordinates for blending overlap. Space them out.
images used for blending must have the same size: Images used for blending must have the same size blending different sizes: Images used for blending must have the same size in function '%s'
negative image width: Image with zero or negative width created in function '%s' negative image width: Image with zero or negative width created in function '%s'
negative image height: Image with zero or negative height created in function '%s' negative image height: Image with zero or negative height created in function '%s'
can't load image: Failed to load image. Ensure the image's actual format matches its saved extension. can't load image: Failed to load image. Ensure the image's actual format matches its saved extension.
+2 -1
View File
@@ -1130,7 +1130,8 @@ error:
# image stuff # image stuff
coordinates for blending overlap: Coordenadas para la mezcla (blending) solapada coordinates for blending overlap: Coordenadas para la mezcla (blending) solapada
images used for blending must have the same size: Las imagenes utilizadas para la mezcla (blending) deben tener el mismo tamaño #TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
#TODO: Localize #TODO: Localize
negative image width: Image with zero or negative width created in function '%s' negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize #TODO: Localize
+2 -2
View File
@@ -1046,8 +1046,8 @@ error:
dans le texte de rappel du mot-clef '%s' dans le texte de rappel du mot-clef '%s'
# image stuff # image stuff
coordinates for blending overlap: Coordonnées pour la superposition du mélange coordinates for blending overlap: Les coordonnées pour le mélange sont superposées. Espacez-les.
images used for blending must have the same size: Les images utilisées pour le mélange doivent avoir la même taille blending different sizes: Les images utilisées pour le mélange doivent avoir la même taille dans la fonction '%s'.
negative image width: Image de largeur nulle ou négative créée par la fonction '%s' negative image width: Image de largeur nulle ou négative créée par la fonction '%s'
negative image height: Image de hauteur nulle ou négative créée par la fonction '%s' negative image height: Image de hauteur nulle ou négative créée par la fonction '%s'
can't load image: Échec du chargement de l'image. Assurez-vous que le format réel de l'image corresponde à son extension enregistrée. can't load image: Échec du chargement de l'image. Assurez-vous que le format réel de l'image corresponde à son extension enregistrée.
+4 -4
View File
@@ -1046,10 +1046,10 @@ error:
in promemoria della parola-chiave '%s' in promemoria della parola-chiave '%s'
# image stuff # image stuff
coordinates for blending overlap: Coordinate per sovrapposizione coordinates for blending overlap: Le coordinate per la fusione si sovrappongono.
images used for blending must have the same size: Le immagini sovrapposte devono avere le stesse misure blending different sizes: Le immagini utilizzate per la fusione devono avere le stesse dimensioni nella funzione '%s'.
negative image width: Immagine con larghezza zero o negativa creata nella funzione '%s' negative image width: Immagine con larghezza zero o negativa creata nella funzione '%s'.
negative image height: Immagine con altezza zero o negativa creata nella funzione '%s' negative image height: Immagine con altezza zero o negativa creata nella funzione '%s'.
can't load image: Impossibile caricare l'immagine. Assicurarsi che il formato effettivo dell'immagine corrisponda all'estensione salvata. can't load image: Impossibile caricare l'immagine. Assicurarsi che il formato effettivo dell'immagine corrisponda all'estensione salvata.
symbol image has alpha: Per ottenere risultati ottimali, l'immagine dovrebbe essere in bianco e nero, senza trasparenza. symbol image has alpha: Per ottenere risultati ottimali, l'immagine dovrebbe essere in bianco e nero, senza trasparenza.
+2 -1
View File
@@ -1130,7 +1130,8 @@ error:
# image stuff # image stuff
coordinates for blending overlap: オーバーラップを混ぜることのための座標 coordinates for blending overlap: オーバーラップを混ぜることのための座標
images used for blending must have the same size: 混ざることのために使われたイメージは同じサイズを持たなければなりません #TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
#TODO: Localize #TODO: Localize
negative image width: Image with zero or negative width created in function '%s' negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize #TODO: Localize
+2 -1
View File
@@ -1136,7 +1136,8 @@ error:
# image stuff # image stuff
coordinates for blending overlap: 블렌딩 오버랩을 위한 좌표 coordinates for blending overlap: 블렌딩 오버랩을 위한 좌표
images used for blending must have the same size: 블렌딩에 사용되는 이미지의 크기는 동일해야 합니다. #TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
#TODO: Localize #TODO: Localize
negative image width: Image with zero or negative width created in function '%s' negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize #TODO: Localize
+2 -1
View File
@@ -1186,7 +1186,8 @@ error:
# image stuff # image stuff
coordinates for blending overlap: Współrzędne scalania (blending) nachodzą na siebie coordinates for blending overlap: Współrzędne scalania (blending) nachodzą na siebie
images used for blending must have the same size: Obrazy użyte do scalania (blending) muszą mieć ten sam rozmiar #TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
#TODO: Localize #TODO: Localize
negative image width: Image with zero or negative width created in function '%s' negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize #TODO: Localize
+2 -2
View File
@@ -1047,8 +1047,8 @@ error:
lembrete de palavra-chave no texto '%s' lembrete de palavra-chave no texto '%s'
# image stuff # image stuff
coordinates for blending overlap: Cordenadas para mistura sobreposição coordinates for blending overlap: As coordenadas para a mistura se sobrepõem.
images used for blending must have the same size: Imagens utilizados para a mistura deve ter o mesmo tamanho blending different sizes: As imagens usadas para mesclagem devem ter o mesmo tamanho na função '%s'.
negative image width: Imagem com largura zero ou negativa criada na função '%s' negative image width: Imagem com largura zero ou negativa criada na função '%s'
negative image height: Imagem com altura zero ou negativa criada na função '%s' negative image height: Imagem com altura zero ou negativa criada na função '%s'
can't load image: Falha ao carregar a imagem. Verifique se o formato real da imagem corresponde à extensão salva. can't load image: Falha ao carregar a imagem. Verifique se o formato real da imagem corresponde à extensão salva.
+2 -2
View File
@@ -1180,9 +1180,9 @@ error:
# image stuff # image stuff
#TODO: Localize #TODO: Localize
coordinates for blending overlap: Coordinates for blending overlap coordinates for blending overlap: Coordinates for blending overlap. Space them out.
#TODO: Localize #TODO: Localize
images used for blending must have the same size: Images used for blending must have the same size blending different sizes: Images used for blending must have the same size in function '%s'
#TODO: Localize #TODO: Localize
negative image width: Image with zero or negative width created in function '%s' negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize #TODO: Localize
+2 -2
View File
@@ -61,7 +61,7 @@ IMPLEMENT_REFLECTION(WrappedCards) {
} }
wxDataFormat CardsDataObject::format = _("application/x-mse-cards"); wxDataFormat CardsDataObject::format(wxString("application/x-mse-cards"));
CardsDataObject::CardsDataObject(const SetP& set, const String id, const vector<CardP>& cards) { CardsDataObject::CardsDataObject(const SetP& set, const String id, const vector<CardP>& cards) {
// set the stylesheet, so when deserializing we know whos style options we are reading // set the stylesheet, so when deserializing we know whos style options we are reading
@@ -121,7 +121,7 @@ IMPLEMENT_REFLECTION(WrappedKeyword) {
} }
wxDataFormat KeywordDataObject::format = _("application/x-mse-keyword"); wxDataFormat KeywordDataObject::format(wxString("application/x-mse-keyword"));
KeywordDataObject::KeywordDataObject(const SetP& set, const KeywordP& keyword) { KeywordDataObject::KeywordDataObject(const SetP& set, const KeywordP& keyword) {
WrappedKeyword data = { set->game.get(), set->game->name(), keyword }; WrappedKeyword data = { set->game.get(), set->game->name(), keyword };
+1 -1
View File
@@ -19,7 +19,7 @@ template <typename T> inline T sqr(T x) { return x * x; }
void linear_blend(Image& img1, const Image& img2, double x1,double y1, double x2,double y2) { void linear_blend(Image& img1, const Image& img2, double x1,double y1, double x2,double y2) {
int width = img1.GetWidth(), height = img1.GetHeight(); int width = img1.GetWidth(), height = img1.GetHeight();
if (img2.GetWidth() != width || img2.GetHeight() != height) { if (img2.GetWidth() != width || img2.GetHeight() != height) {
throw Error(_ERROR_("images used for blending must have the same size")); throw Error(_ERROR_1_("blending different sizes", "linear_blend"));
} }
const int fixed = 1<<16; // fixed point multiplier const int fixed = 1<<16; // fixed point multiplier
+1 -1
View File
@@ -439,7 +439,7 @@ void combine_image_do(Image& a, Image b) {
void combine_image(Image& a, const Image& b, ImageCombine combine) { void combine_image(Image& a, const Image& b, ImageCombine combine) {
// Images must have same size // Images must have same size
if (a.GetWidth() != b.GetWidth() || a.GetHeight() != b.GetHeight()) { if (a.GetWidth() != b.GetWidth() || a.GetHeight() != b.GetHeight()) {
throw Error(_ERROR_("images used for combine blending must have the same size")); throw Error(_ERROR_1_("blending different sizes", "combine_blend"));
} }
// Copy alpha channel? // Copy alpha channel?
if (b.HasAlpha()) { if (b.HasAlpha()) {
+15 -3
View File
@@ -471,9 +471,13 @@ void DropDownList::onMotion(wxMouseEvent& ev) {
} }
void DropDownList::onMouseLeave(wxMouseEvent& ev) { void DropDownList::onMouseLeave(wxMouseEvent& ev) {
if (close_on_mouse_out) { if (close_on_mouse_out) {
wxSize cs = GetClientSize(); wxPoint screen_pos = ClientToScreen(ev.GetPosition());
if (ev.GetX() < 0 || ev.GetY() < 0 || ev.GetX() >= cs.x || ev.GetY() >= cs.y) { bool in_parent = parent_menu ? parent_menu->isInRect(screen_pos) : false;
bool in_child = open_sub_menu ? open_sub_menu->isInRect(screen_pos) : false;
wxSize cs = GetClientSize();
bool in_self = !(ev.GetX() < 0 || ev.GetY() < 0 || ev.GetX() >= cs.x || ev.GetY() >= cs.y);
if (!(in_parent || in_child || in_self)) {
hide(false); // outside box; hide it hide(false); // outside box; hide it
ev.Skip(); ev.Skip();
return; return;
@@ -481,6 +485,14 @@ void DropDownList::onMouseLeave(wxMouseEvent& ev) {
} }
} }
bool DropDownList::isInRect(wxPoint screen_pos) {
wxRect rect = GetRect();
if (screen_pos.x < rect.x || screen_pos.y < rect.y || screen_pos.x > rect.x+rect.width || screen_pos.y > rect.y+rect.height) {
return false;
}
return true;
}
void DropDownList::onMouseWheel(wxMouseEvent& ev) { void DropDownList::onMouseWheel(wxMouseEvent& ev) {
scrollTo(visible_start - item_size.height * ev.GetWheelRotation() / ev.GetWheelDelta()); scrollTo(visible_start - item_size.height * ev.GetWheelRotation() / ev.GetWheelDelta());
} }
+5 -2
View File
@@ -116,9 +116,12 @@ private:
void onMouseLeave(wxMouseEvent&); void onMouseLeave(wxMouseEvent&);
void onMouseWheel(wxMouseEvent& ev); void onMouseWheel(wxMouseEvent& ev);
void onScroll(wxScrollWinEvent&); void onScroll(wxScrollWinEvent&);
// --------------------------------------------------- : Privates // --------------------------------------------------- : Privates
/// Is the given screen coordinate inside this menu's rect?
bool isInRect(wxPoint screen_pos);
/// Return the y coordinate of an item (in scrolled coordinates) /// Return the y coordinate of an item (in scrolled coordinates)
int itemPosition(size_t item) const; int itemPosition(size_t item) const;
+12 -6
View File
@@ -81,22 +81,28 @@ SCRIPT_FUNCTION(set_metadata) {
SCRIPT_FUNCTION(width_of) { SCRIPT_FUNCTION(width_of) {
SCRIPT_PARAM(Set*, set); SCRIPT_PARAM(Set*, set);
SCRIPT_PARAM(GeneratedImageP, input); SCRIPT_PARAM(CardP, card);
Image image = input->generate(GeneratedImage::Options(0, 0, set->stylesheet.get())); SCRIPT_PARAM(GeneratedImageP, input);
StyleSheet* stylesheet = card && card->stylesheet ? card->stylesheet.get() : set->stylesheet.get();
Image image = input->generate(GeneratedImage::Options(0, 0, stylesheet));
SCRIPT_RETURN(image.GetWidth()); SCRIPT_RETURN(image.GetWidth());
} }
SCRIPT_FUNCTION(height_of) { SCRIPT_FUNCTION(height_of) {
SCRIPT_PARAM(Set*, set); SCRIPT_PARAM(Set*, set);
SCRIPT_PARAM(GeneratedImageP, input); SCRIPT_PARAM(CardP, card);
Image image = input->generate(GeneratedImage::Options(0, 0, set->stylesheet.get())); SCRIPT_PARAM(GeneratedImageP, input);
StyleSheet* stylesheet = card && card->stylesheet ? card->stylesheet.get() : set->stylesheet.get();
Image image = input->generate(GeneratedImage::Options(0, 0, stylesheet));
SCRIPT_RETURN(image.GetHeight()); SCRIPT_RETURN(image.GetHeight());
} }
SCRIPT_FUNCTION(dimensions_of) { SCRIPT_FUNCTION(dimensions_of) {
SCRIPT_PARAM(Set*, set); SCRIPT_PARAM(Set*, set);
SCRIPT_PARAM(GeneratedImageP, input); SCRIPT_PARAM(CardP, card);
Image image = input->generate(GeneratedImage::Options(0, 0, set->stylesheet.get())); SCRIPT_PARAM(GeneratedImageP, input);
StyleSheet* stylesheet = card && card->stylesheet ? card->stylesheet.get() : set->stylesheet.get();
Image image = input->generate(GeneratedImage::Options(0, 0, stylesheet));
ScriptCustomCollectionP ret(new ScriptCustomCollection()); ScriptCustomCollectionP ret(new ScriptCustomCollection());
ret->value.push_back(to_script(image.GetWidth())); ret->value.push_back(to_script(image.GetWidth()));
ret->value.push_back(to_script(image.GetHeight())); ret->value.push_back(to_script(image.GetHeight()));