Fix wxGTK warnings about GetScrollPos on window without scrollbar

This commit is contained in:
Twan van Laarhoven
2020-04-16 19:29:46 +02:00
parent cbf1251f8c
commit 0706ecae13
2 changed files with 7 additions and 3 deletions
+2 -1
View File
@@ -146,7 +146,8 @@ Rotation CardViewer::getRotation() const {
// Same as DataViewer::getRotation, only taking into account scrolling
if (!stylesheet) stylesheet = set->stylesheet;
StyleSheetSettings& ss = settings.stylesheetSettingsFor(*stylesheet);
int dx = GetScrollPos(wxHORIZONTAL), dy = GetScrollPos(wxVERTICAL);
int dx = CanScroll(wxHORIZONTAL) ? GetScrollPos(wxHORIZONTAL) : 0;
int dy = CanScroll(wxVERTICAL) ? GetScrollPos(wxVERTICAL) : 0;
return Rotation(deg_to_rad(ss.card_angle()), stylesheet->getCardRect().move(-dx,-dy,0,0), ss.card_zoom(), 1.0, ROTATION_ATTACH_TOP_LEFT);
}
+5 -2
View File
@@ -24,7 +24,8 @@ NativeLookEditor::NativeLookEditor(Window* parent, int id, long style)
{}
Rotation NativeLookEditor::getRotation() const {
int dx = GetScrollPos(wxHORIZONTAL), dy = GetScrollPos(wxVERTICAL);
int dx = CanScroll(wxHORIZONTAL) ? GetScrollPos(wxHORIZONTAL) : 0;
int dy = CanScroll(wxVERTICAL) ? GetScrollPos(wxVERTICAL) : 0;
return Rotation(0, RealRect(RealPoint(-dx,-dy),GetClientSize()));
}
@@ -90,7 +91,9 @@ void NativeLookEditor::resizeViewers() {
}
y = y - vspace + margin;
SetVirtualSize(w, (int)y);
SetScrollbar(wxVERTICAL, 0, h, (int)y);
if (CanScroll(wxVERTICAL)) {
SetScrollbar(wxVERTICAL, 0, h, (int)y);
}
if (y >= h) {
// Doesn't fit vertically, add scrollbar and resize
/*