mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Compatibility updates step 1.
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@815 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -224,11 +224,11 @@ void TreeList::onChar(wxKeyEvent& ev) {
|
||||
expand(selection, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
} case WXK_PAGEUP: case WXK_PRIOR: {
|
||||
ScrollToLine(first_line > visible_lines_t ? first_line - visible_lines_t : 0);
|
||||
break;
|
||||
} case WXK_PAGEDOWN: case WXK_NEXT: {
|
||||
break;
|
||||
} case WXK_PAGEUP: {
|
||||
ScrollToLine(first_line > visible_lines_t ? first_line - visible_lines_t : 0);
|
||||
break;
|
||||
} case WXK_PAGEDOWN: {
|
||||
ScrollToLine(first_line + visible_lines_t);
|
||||
break;
|
||||
} case WXK_HOME: {
|
||||
@@ -272,56 +272,56 @@ void TreeList::onLeftDClick(wxMouseEvent& ev) {
|
||||
// ----------------------------------------------------------------------------- : TreeList : Copy of VScrolledWindow
|
||||
|
||||
void TreeList::ScrollToLine(size_t line) {
|
||||
// determine the real first line to scroll to: we shouldn't scroll beyond the end
|
||||
line = (size_t)max((int)line, 0);
|
||||
line = (size_t)min((int)line, max(0, (int)(total_lines - visible_lines_t)));
|
||||
// nothing to do?
|
||||
if (line == first_line) return;
|
||||
first_line = line;
|
||||
UpdateScrollbar();
|
||||
// determine the real first line to scroll to: we shouldn't scroll beyond the end
|
||||
line = (size_t)max((int)line, 0);
|
||||
line = (size_t)min((int)line, max(0, (int)(total_lines - visible_lines_t)));
|
||||
// nothing to do?
|
||||
if (line == first_line) return;
|
||||
first_line = line;
|
||||
UpdateScrollbar();
|
||||
Refresh(false);
|
||||
}
|
||||
|
||||
void TreeList::UpdateScrollbar() {
|
||||
// how many lines fit on the screen?
|
||||
int h = GetClientSize().y - header_height;
|
||||
visible_lines = (h + item_height - 1) / item_height;
|
||||
visible_lines_t = h / item_height;
|
||||
// set the scrollbar parameters to reflect this
|
||||
SetScrollbar(wxVERTICAL, (int)first_line, (int)visible_lines_t, (int)total_lines);
|
||||
}
|
||||
|
||||
void TreeList::RefreshLine(size_t line) {
|
||||
if (line < first_line || line >= first_line + visible_lines) return;
|
||||
// calculate the rect occupied by this line on screen
|
||||
wxRect rect;
|
||||
rect.x = 0;
|
||||
rect.y = header_height + (int)(line - first_line) * item_height;
|
||||
rect.width = GetClientSize().x;
|
||||
rect.height = item_height;
|
||||
// do refresh it
|
||||
RefreshRect(rect, false);
|
||||
}
|
||||
|
||||
void TreeList::onScroll(wxScrollWinEvent& ev) {
|
||||
wxEventType type = ev.GetEventType();
|
||||
if (type == wxEVT_SCROLLWIN_TOP) {
|
||||
ScrollToLine(0);
|
||||
} else if (type == wxEVT_SCROLLWIN_BOTTOM) {
|
||||
ScrollToLine(total_lines);
|
||||
} else if (type == wxEVT_SCROLLWIN_LINEUP) {
|
||||
ScrollToLine(first_line > 0 ? first_line - 1 : 0);
|
||||
} else if (type == wxEVT_SCROLLWIN_LINEDOWN) {
|
||||
ScrollToLine(first_line + 1);
|
||||
} else if (type == wxEVT_SCROLLWIN_PAGEUP) {
|
||||
ScrollToLine(first_line > visible_lines_t ? first_line - visible_lines_t : 0);
|
||||
} else if (type == wxEVT_SCROLLWIN_PAGEDOWN) {
|
||||
ScrollToLine(first_line + visible_lines_t);
|
||||
} else {
|
||||
ScrollToLine(ev.GetPosition());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TreeList::UpdateScrollbar() {
|
||||
// how many lines fit on the screen?
|
||||
int h = GetClientSize().y - header_height;
|
||||
visible_lines = (h + item_height - 1) / item_height;
|
||||
visible_lines_t = h / item_height;
|
||||
// set the scrollbar parameters to reflect this
|
||||
SetScrollbar(wxVERTICAL, (int)first_line, (int)visible_lines_t, (int)total_lines);
|
||||
}
|
||||
|
||||
void TreeList::RefreshLine(size_t line) {
|
||||
if (line < first_line || line >= first_line + visible_lines) return;
|
||||
// calculate the rect occupied by this line on screen
|
||||
wxRect rect;
|
||||
rect.x = 0;
|
||||
rect.y = header_height + (int)(line - first_line) * item_height;
|
||||
rect.width = GetClientSize().x;
|
||||
rect.height = item_height;
|
||||
// do refresh it
|
||||
RefreshRect(rect, false);
|
||||
}
|
||||
|
||||
void TreeList::onScroll(wxScrollWinEvent& ev) {
|
||||
wxEventType type = ev.GetEventType();
|
||||
if (type == wxEVT_SCROLLWIN_TOP) {
|
||||
ScrollToLine(0);
|
||||
} else if (type == wxEVT_SCROLLWIN_BOTTOM) {
|
||||
ScrollToLine(total_lines);
|
||||
} else if (type == wxEVT_SCROLLWIN_LINEUP) {
|
||||
ScrollToLine(first_line > 0 ? first_line - 1 : 0);
|
||||
} else if (type == wxEVT_SCROLLWIN_LINEDOWN) {
|
||||
ScrollToLine(first_line + 1);
|
||||
} else if (type == wxEVT_SCROLLWIN_PAGEUP) {
|
||||
ScrollToLine(first_line > visible_lines_t ? first_line - visible_lines_t : 0);
|
||||
} else if (type == wxEVT_SCROLLWIN_PAGEDOWN) {
|
||||
ScrollToLine(first_line + visible_lines_t);
|
||||
} else {
|
||||
ScrollToLine(ev.GetPosition());
|
||||
}
|
||||
}
|
||||
|
||||
void TreeList::onSize(wxSizeEvent& ev) {
|
||||
UpdateScrollbar();
|
||||
Refresh(false);
|
||||
|
||||
Reference in New Issue
Block a user