mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-14 06:02:31 +00:00
Cleaned up ui::Root, fixed updating and hiding status bar.
Using displayScheduler for updating windows, much more efficient. Added saving of some parts of the state of torrents. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@482 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+26
-20
@@ -26,6 +26,7 @@
|
||||
#include <sigc++/slot.h>
|
||||
|
||||
#include "canvas.h"
|
||||
#include "utils/task.h"
|
||||
#include "utils/timer.h"
|
||||
|
||||
namespace display {
|
||||
@@ -36,46 +37,51 @@ class Window {
|
||||
public:
|
||||
typedef sigc::slot0<void> Slot;
|
||||
|
||||
Window(Canvas* c = NULL, bool d = false, int h = 1) :
|
||||
m_canvas(c), m_active(true), m_dynamic(d), m_minHeight(h) {}
|
||||
Window(Canvas* c = NULL, bool d = false, int h = 1);
|
||||
|
||||
virtual ~Window();
|
||||
|
||||
bool is_active() { return m_active; }
|
||||
bool is_dynamic() { return m_dynamic; }
|
||||
bool is_dirty() { return m_nextDraw <= utils::Timer::cache(); }
|
||||
bool is_active() { return m_active; }
|
||||
bool is_dynamic() { return m_dynamic; }
|
||||
bool is_dirty() { return utils::displayScheduler.is_scheduled(&m_taskUpdate); }
|
||||
|
||||
utils::Timer get_next_draw() { return m_nextDraw; }
|
||||
//utils::Timer get_next_draw() { return m_nextDraw; }
|
||||
|
||||
int get_min_height() { return m_minHeight; }
|
||||
int get_min_height() { return m_minHeight; }
|
||||
|
||||
bool get_active() { return m_active; }
|
||||
void set_active(bool a) { m_active = a; }
|
||||
bool get_active() { return m_active; }
|
||||
void set_active(bool a);
|
||||
|
||||
void refresh() { m_canvas->refresh(); }
|
||||
void resize(int x, int y, int w, int h);
|
||||
void refresh() { m_canvas->refresh(); }
|
||||
void resize(int x, int y, int w, int h);
|
||||
|
||||
void mark_dirty() { m_nextDraw = utils::Timer::min(); }
|
||||
void mark_dirty();
|
||||
|
||||
virtual void redraw() = 0;
|
||||
virtual void redraw() = 0;
|
||||
|
||||
static void slot_adjust(Slot s) { m_slotAdjust = s; }
|
||||
static void slot_adjust(Slot s) { m_slotAdjust = s; }
|
||||
|
||||
protected:
|
||||
Window(const Window&);
|
||||
void operator = (const Window&);
|
||||
|
||||
static Slot m_slotAdjust;
|
||||
static Slot m_slotAdjust;
|
||||
|
||||
Canvas* m_canvas;
|
||||
Canvas* m_canvas;
|
||||
|
||||
bool m_active;
|
||||
bool m_dynamic;
|
||||
int m_minHeight;
|
||||
bool m_active;
|
||||
bool m_dynamic;
|
||||
int m_minHeight;
|
||||
|
||||
utils::Timer m_nextDraw;
|
||||
utils::TaskItem m_taskUpdate;
|
||||
};
|
||||
|
||||
inline void
|
||||
Window::mark_dirty() {
|
||||
utils::displayScheduler.erase(&m_taskUpdate);
|
||||
utils::displayScheduler.insert(&m_taskUpdate, utils::Timer::cache());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user