2
* Whiteboard session playback control dialog
5
* David Yip <yipdw@rose-hulman.edu>
7
* Copyright (c) 2005 Authors
9
* Released under GNU GPL, read the file 'COPYING' for more information
17
#include <glibmm/i18n.h>
18
#include <gtk/gtkdialog.h>
22
#include "path-prefix.h"
25
#include "desktop-handles.h"
30
#include "jabber_whiteboard/node-tracker.h"
31
#include "jabber_whiteboard/session-manager.h"
32
#include "jabber_whiteboard/session-file-player.h"
34
#include "ui/dialog/session-player.h"
36
#include "util/ucompose.hpp"
44
SessionPlaybackDialog*
45
SessionPlaybackDialog::create()
47
return new SessionPlaybackDialogImpl();
50
SessionPlaybackDialogImpl::SessionPlaybackDialogImpl()
51
: _delay(100, 1, 5000, 10, 100), _delayentry(_delay)
53
this->_desktop = SP_ACTIVE_DESKTOP;
54
this->_sm = this->_desktop->whiteboard_session_manager();
55
this->_sfp = this->_sm->session_player();
56
this->_openfile.set_text(this->_sfp->filename());
59
this->get_vbox()->show_all_children();
62
SessionPlaybackDialogImpl::~SessionPlaybackDialogImpl()
68
SessionPlaybackDialogImpl::_construct()
70
Gtk::VBox* main = this->get_vbox();
72
// Dialog organization
73
this->_filemanager.set_label(_("Session file"));
74
this->_playback.set_label(_("Playback controls"));
75
this->_currentmsgbox.set_label(_("Message information"));
77
this->_filemanager.set_border_width(4);
78
this->_playback.set_border_width(4);
79
this->_fm.set_border_width(4);
80
this->_toolbarbox.set_border_width(4);
82
// Active session file display
83
// fixme: Does this mean the active file for the session, or the file for the active session?
84
// Please indicate which with a TRANSLATORS comment.
85
this->_labels[0].set_text(_("Active session file:"));
86
this->_labels[1].set_text(_("Delay (milliseconds):"));
88
this->_openfile.set_editable(false);
90
this->_filebox.pack_start(this->_labels[0], true, false, 8);
91
this->_filebox.pack_end(this->_openfile, true, true, 0);
93
// Unload/load buttons
94
this->_close.set_label(_("Close file"));
95
this->_open.set_label(_("Open new file"));
96
this->_setdelay.set_label(_("Set delay"));
99
this->_close.signal_clicked().connect(sigc::bind< 0 >(sigc::mem_fun(*this, &SessionPlaybackDialogImpl::_respCallback), CLOSE_FILE));
100
this->_open.signal_clicked().connect(sigc::bind< 0 >(sigc::mem_fun(*this, &SessionPlaybackDialogImpl::_respCallback), OPEN_FILE));
101
this->_setdelay.signal_clicked().connect(sigc::bind< 0 >(sigc::mem_fun(*this, &SessionPlaybackDialogImpl::_respCallback), RESET_DELAY));
104
this->_filebuttons.pack_start(this->_close, true, false, 0);
105
this->_filebuttons.pack_start(this->_open, true, false, 0);
107
// Message information box
108
this->_currentmsgbuffer = Gtk::TextBuffer::create();
109
this->_currentmsgview.set_buffer(this->_currentmsgbuffer);
110
this->_currentmsgview.set_editable(false);
111
this->_currentmsgview.set_cursor_visible(false);
112
this->_currentmsgview.set_wrap_mode(Gtk::WRAP_WORD);
113
this->_currentmsgscroller.add(this->_currentmsgview);
114
this->_currentmsgbox.add(this->_currentmsgscroller);
115
this->_sfp->setMessageOutputWidget(this->_currentmsgbuffer);
118
// parameters: initial lower upper single-incr page-incr
119
this->_delayentry.set_numeric(true);
122
this->_playbackcontrols.set_show_arrow(false);
124
/* these are waiting for the Gtkmm conversion
125
this->_controls[0].set_stock_id(Stock::SESSION_PLAYBACK_REW);
126
this->_controls[1].set_stock_id(Stock::SESSION_PLAYBACK_STEPBACK);
127
this->_controls[2].set_stock_id(Stock::SESSION_PLAYBACK_PAUSE);
128
this->_controls[3].set_stock_id(Stock::SESSION_PLAYBACK_STEPFORWARD);
129
this->_controls[4].set_stock_id(Stock::SESSION_PLAYBACK_PLAY);
132
this->_controls[0].set_label("Rewind");
133
this->_controls[1].set_label("Go back one");
134
this->_controls[2].set_label("Pause");
135
this->_controls[3].set_label("Go forward one");
136
this->_controls[4].set_label("Play");
138
this->_controls[0].set_tooltip(this->_tooltips, _("Rewind"));
139
this->_controls[1].set_tooltip(this->_tooltips, _("Go back one change"));
140
this->_controls[2].set_tooltip(this->_tooltips, _("Pause"));
141
this->_controls[3].set_tooltip(this->_tooltips, _("Go forward one change"));
142
this->_controls[4].set_tooltip(this->_tooltips, _("Play"));
144
for(int i = 0; i < 5; i++) {
145
this->_playbackcontrols.append(this->_controls[i], sigc::bind< 0 >(sigc::mem_fun(*this, &SessionPlaybackDialogImpl::_respCallback), TOOLBAR_BASE + i));
148
this->_delaybox.pack_start(this->_labels[1]);
149
this->_delaybox.pack_start(this->_delayentry);
150
this->_delaybox.pack_end(this->_setdelay);
152
this->_toolbarbox.pack_start(this->_delaybox);
153
this->_toolbarbox.pack_end(this->_playbackcontrols);
155
// Pack widgets into frames
156
this->_fm.pack_start(this->_filebox);
157
this->_fm.pack_end(this->_filebuttons);
159
this->_filemanager.add(this->_fm);
160
this->_playback.add(this->_toolbarbox);
162
// Pack widgets into main vbox
163
main->pack_start(this->_filemanager);
164
main->pack_start(this->_playback);
165
main->pack_end(this->_currentmsgbox);
169
SessionPlaybackDialogImpl::_respCallback(int resp)
171
g_log(NULL, G_LOG_LEVEL_DEBUG, "_respCallback: %u", resp);
174
this->_sfp->unload();
177
Gtk::FileChooserDialog sessionfiledlg(_("Open session file"), Gtk::FILE_CHOOSER_ACTION_OPEN);
178
sessionfiledlg.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
179
sessionfiledlg.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
181
int result = sessionfiledlg.run();
183
case Gtk::RESPONSE_OK:
184
this->_sm->clearDocument();
185
sp_document_done(sp_desktop_document(this->_desktop));
186
this->_sm->loadSessionFile(sessionfiledlg.get_filename());
187
this->_openfile.set_text(this->_sfp->filename());
195
this->_sfp->setDelay(this->_delayentry.get_value_as_int());
198
if (this->_sfp->_playing) {
201
this->_sfp->_curdir = Whiteboard::SessionFilePlayer::BACKWARD;
205
this->_sfp->step(Whiteboard::SessionFilePlayer::BACKWARD);
211
this->_sfp->step(Whiteboard::SessionFilePlayer::FORWARD);
214
if (this->_sfp->_playing) {
217
this->_sfp->_curdir = Whiteboard::SessionFilePlayer::FORWARD;