1 /**
2 * Whiteboard session file playback mechanism
3 *
4 * Authors:
5 * David Yip <yipdw@rose-hulman.edu>
6 *
7 * Copyright (c) 2005 Authors
8 *
9 * Released under GNU GPL, read the file 'COPYING' for more information
10 */
12 #ifndef __WHITEBOARD_SESSION_FILE_PLAYER_H__
13 #define __WHITEBOARD_SESSION_FILE_PLAYER_H__
15 #include <list>
16 #include <glibmm/refptr.h>
17 #include <glibmm/ustring.h>
18 #include <gtkmm/textbuffer.h>
19 #include <sigc++/sigc++.h>
21 struct SPDesktop;
23 namespace Inkscape {
24 namespace UI {
25 namespace Dialog {
26 class SessionPlaybackDialogImpl;
27 }
28 }
29 namespace Whiteboard {
31 class SessionFile;
32 class SessionManager;
34 class SessionFilePlayer {
35 friend class UI::Dialog::SessionPlaybackDialogImpl;
37 public:
38 SessionFilePlayer(unsigned int bufsz, SessionManager* sm);
39 ~SessionFilePlayer();
41 void load(SessionFile* sm);
42 SessionFile* unload();
44 Glib::ustring const& filename();
45 Glib::ustring const& curmsg();
47 void start();
48 void stop();
49 void setDelay(unsigned int delay);
50 void setMessageOutputWidget(Glib::RefPtr<Gtk::TextBuffer> const& widgetptr);
52 static unsigned short const BACKWARD = 0;
53 static unsigned short const FORWARD = 1;
55 private:
56 bool step(unsigned short dir);
57 void _outputMessageToWidget();
59 SessionManager* _sm;
60 SessionFile* _sf;
62 // Output widget refptr
63 Glib::RefPtr<Gtk::TextBuffer> _outputwidget;
65 // Playback signal
66 sigc::connection _playback_dispatcher;
68 // trackers
69 unsigned int _delay;
70 unsigned short _curdir;
71 bool _playing;
72 Glib::ustring _curmsg;
74 // (position, msgsize)
75 std::list< std::pair< gint64, gint64 > > _visited;
76 gint64 _current;
77 gint64 _next;
79 // noncopyable, nonassignable
80 SessionFilePlayer(SessionFilePlayer const&);
81 void operator=(SessionFilePlayer const&);
82 };
84 }
86 }
88 #endif
90 /*
91 Local Variables:
92 mode:c++
93 c-file-style:"stroustrup"
94 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
95 indent-tabs-mode:nil
96 fill-column:99
97 End:
98 */
99 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :