mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-13 21:52:30 +00:00
* Moved all remaining classes to use the new display::Frame.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@749 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+13
-14
@@ -207,7 +207,7 @@ Frame::refresh() {
|
||||
break;
|
||||
|
||||
case TYPE_WINDOW:
|
||||
if (m_window->is_active())
|
||||
if (m_window->is_active() && !m_window->is_offscreen())
|
||||
m_window->refresh();
|
||||
|
||||
break;
|
||||
@@ -232,9 +232,14 @@ Frame::balance(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {
|
||||
return;
|
||||
|
||||
if (m_type == TYPE_WINDOW) {
|
||||
if (!m_window->is_active())
|
||||
// Ensure that we don't draw windows that are offscreen or have
|
||||
// zero extent.
|
||||
if (width == 0 || height == 0 || !m_window->is_active()) {
|
||||
m_window->set_offscreen(true);
|
||||
return;
|
||||
}
|
||||
|
||||
m_window->set_offscreen(false);
|
||||
m_window->resize(x, y, width, height);
|
||||
m_window->mark_dirty();
|
||||
return;
|
||||
@@ -284,26 +289,20 @@ Frame::balance(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {
|
||||
(*itr)->m_width = s;
|
||||
}
|
||||
|
||||
// Expand/shrink m_w/h according to what is required to fill the min
|
||||
// height/width.
|
||||
// if (m_type == TYPE_ROW)
|
||||
// m_height -= remaining;
|
||||
// else
|
||||
// m_width -= remaining;
|
||||
|
||||
for (Frame **itr = m_container, **last = m_container + m_containerSize; itr != last; ++itr) {
|
||||
if (m_type == TYPE_ROW) {
|
||||
(*itr)->balance(x, y, m_width, (*itr)->m_height);
|
||||
(*itr)->balance(x, y, m_width, std::min((*itr)->m_height, height));
|
||||
|
||||
y += (*itr)->m_height;
|
||||
height -= (*itr)->m_height;
|
||||
|
||||
} else {
|
||||
(*itr)->balance(x, y, (*itr)->m_width, m_height);
|
||||
(*itr)->balance(x, y, std::min((*itr)->m_width, width), m_height);
|
||||
|
||||
x += (*itr)->m_width;
|
||||
width -= (*itr)->m_width;
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_type == TYPE_ROW && y != m_height) || (m_type == TYPE_COLUMN && x != m_width))
|
||||
throw torrent::client_error("Frame::balance(...) The algorithm did not end up with the correct remainder.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -93,8 +93,6 @@ Manager::receive_update() {
|
||||
Canvas::refresh_std();
|
||||
|
||||
rak::priority_queue_perform(&m_scheduler, cachedTime);
|
||||
|
||||
// std::for_each(begin(), end(), rak::if_then(std::mem_fun(&Window::is_active), std::mem_fun(&Window::refresh)));
|
||||
m_rootFrame.refresh();
|
||||
|
||||
Canvas::do_update();
|
||||
|
||||
@@ -46,16 +46,16 @@ Window::SlotTimer Window::m_slotSchedule;
|
||||
Window::SlotWindow Window::m_slotUnschedule;
|
||||
Window::Slot Window::m_slotAdjust;
|
||||
|
||||
// When constructing the window we set flag_offscreen so that redraw
|
||||
// doesn't get triggered until after a successful Frame::balance call.
|
||||
|
||||
Window::Window(Canvas* canvas, int flags, extent_type minWidth, extent_type minHeight) :
|
||||
m_canvas(canvas),
|
||||
m_flags(flags),
|
||||
m_flags(flags | flag_offscreen),
|
||||
m_minWidth(minWidth),
|
||||
m_minHeight(minHeight) {
|
||||
|
||||
m_taskUpdate.set_slot(rak::mem_fn(this, &Window::redraw));
|
||||
|
||||
if (flags & flag_active)
|
||||
mark_dirty();
|
||||
}
|
||||
|
||||
Window::~Window() {
|
||||
@@ -71,8 +71,11 @@ Window::set_active(bool state) {
|
||||
return;
|
||||
|
||||
if (state) {
|
||||
m_flags |= flag_active;
|
||||
// Set offscreen so we don't try rendering before Frame::balance
|
||||
// has been called.
|
||||
m_flags |= flag_active | flag_offscreen;
|
||||
mark_dirty();
|
||||
|
||||
} else {
|
||||
m_flags &= ~flag_active;
|
||||
m_slotUnschedule(this);
|
||||
|
||||
@@ -57,8 +57,9 @@ public:
|
||||
typedef rak::mem_fun2<Manager, void, Window*, rak::timer> SlotTimer;
|
||||
|
||||
static const int flag_active = (1 << 0);
|
||||
static const int flag_width_dynamic = (1 << 1);
|
||||
static const int flag_height_dynamic = (1 << 2);
|
||||
static const int flag_offscreen = (1 << 1);
|
||||
static const int flag_width_dynamic = (1 << 2);
|
||||
static const int flag_height_dynamic = (1 << 3);
|
||||
|
||||
Window(Canvas* canvas, int flags, extent_type minWidth, extent_type minHeight);
|
||||
|
||||
@@ -67,6 +68,9 @@ public:
|
||||
bool is_active() const { return m_flags & flag_active; }
|
||||
void set_active(bool state);
|
||||
|
||||
bool is_offscreen() const { return m_flags & flag_offscreen; }
|
||||
void set_offscreen(bool state) { if (state) m_flags |= flag_offscreen; else m_flags &= ~flag_offscreen; }
|
||||
|
||||
bool is_width_dynamic() const { return m_flags & flag_width_dynamic; }
|
||||
bool is_height_dynamic() const { return m_flags & flag_height_dynamic; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user