diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-12-03 20:27:51 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-12-03 20:27:51 +0000 |
| commit | d7fe5fa4178af87b5f1e5a571a78313fa00c3327 (patch) | |
| tree | 62a0aa38043fbd3458401634e9d584a678a94ea2 /src/wx | |
| parent | c1cfb24a12ad8109ec9e86cbff5646071ad2e85a (diff) | |
Remove film player, DVD ripping, alignment, screen configs; never finished and not really very likely to be.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/alignment.cc | 167 | ||||
| -rw-r--r-- | src/wx/alignment.h | 35 | ||||
| -rw-r--r-- | src/wx/config_dialog.cc | 1 | ||||
| -rw-r--r-- | src/wx/config_dialog.h | 1 | ||||
| -rw-r--r-- | src/wx/dvd_title_dialog.cc | 80 | ||||
| -rw-r--r-- | src/wx/dvd_title_dialog.h | 32 | ||||
| -rw-r--r-- | src/wx/film_editor.cc | 1 | ||||
| -rw-r--r-- | src/wx/film_player.cc | 310 | ||||
| -rw-r--r-- | src/wx/film_player.h | 63 | ||||
| -rw-r--r-- | src/wx/wscript | 7 |
10 files changed, 0 insertions, 697 deletions
diff --git a/src/wx/alignment.cc b/src/wx/alignment.cc deleted file mode 100644 index ee4ca51c1..000000000 --- a/src/wx/alignment.cc +++ /dev/null @@ -1,167 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington <cth@carlh.net> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <iostream> -#include <gtkmm.h> -#include <cairomm/cairomm.h> -#include "alignment.h" - -using namespace std; - -class AlignmentWidget : public Gtk::DrawingArea -{ -public: - void set_text_line (int n, string t) - { - if (int(_text.size()) < (n + 1)) { - _text.resize (n + 1); - } - - _text[n] = t; - queue_draw (); - } - -private: - bool on_expose_event (GdkEventExpose* ev) - { - if (!get_window ()) { - return false; - } - - Cairo::RefPtr<Cairo::Context> c = get_window()->create_cairo_context (); - - Gtk::Allocation a = get_allocation (); - int const w = a.get_width (); - int const h = a.get_height (); - - c->rectangle (0, 0, w, h); - c->set_source_rgb (0, 0, 0); - c->fill (); - - c->set_source_rgb (1, 1, 1); - c->set_line_width (1); - - int const arrow_size = h / 8; - int const head_size = h / 32; - - /* arrow to left edge */ - c->move_to (arrow_size, h / 2); - c->line_to (0, h / 2); - c->rel_line_to (head_size, head_size); - c->move_to (0, h / 2); - c->rel_line_to (head_size, -head_size); - c->stroke (); - - /* arrow to right edge */ - c->move_to (w - arrow_size, h / 2); - c->line_to (w, h / 2); - c->rel_line_to (-head_size, head_size); - c->move_to (w, h / 2); - c->rel_line_to (-head_size, -head_size); - c->stroke (); - - /* arrow to top edge */ - c->move_to (w / 2, arrow_size); - c->line_to (w / 2, 0); - c->rel_line_to (head_size, head_size); - c->move_to (w / 2, 0); - c->rel_line_to (-head_size, head_size); - c->stroke (); - - /* arrow to bottom edge */ - c->move_to (w / 2, h - h / 8); - c->line_to (w / 2, h); - c->rel_line_to (head_size, -head_size); - c->move_to (w / 2, h); - c->rel_line_to (-head_size, -head_size); - c->stroke (); - - /* arrow to top-left corner */ - c->move_to (arrow_size, arrow_size); - c->line_to (0, 0); - c->rel_line_to (head_size, 0); - c->move_to (0, 0); - c->rel_line_to (0, head_size); - c->stroke (); - - /* arrow to top-right corner */ - c->move_to (w - arrow_size, arrow_size); - c->line_to (w, 0); - c->rel_line_to (0, head_size); - c->move_to (w, 0); - c->rel_line_to (-head_size, 0); - c->stroke (); - - /* arrow to bottom-left corner */ - c->move_to (arrow_size, h - arrow_size); - c->line_to (0, h); - c->rel_line_to (head_size, 0); - c->move_to (0, h); - c->rel_line_to (0, -head_size); - c->stroke (); - - /* arrow to bottom-right corner */ - c->move_to (w - arrow_size, h - arrow_size); - c->line_to (w, h); - c->rel_line_to (-head_size, 0); - c->line_to (w, h); - c->rel_line_to (0, -head_size); - c->stroke (); - - /* text */ - int max_height = 0; - for (vector<string>::iterator i = _text.begin(); i != _text.end(); ++i) { - Cairo::TextExtents e; - c->get_text_extents (*i, e); - max_height = max (max_height, int (e.height)); - } - - int total_height = max_height * _text.size() * 2; - - for (vector<string>::size_type i = 0; i < _text.size(); ++i) { - Cairo::TextExtents e; - c->get_text_extents (_text[i], e); - c->move_to ((w - e.width) / 2, ((h - total_height) / 2) + ((i * 2) + 1) * max_height); - c->text_path (_text[i]); - c->stroke (); - } - - return true; - } - - std::vector<std::string> _text; -}; - -Alignment::Alignment (Position p, Size s) -{ - _widget = Gtk::manage (new AlignmentWidget); - add (*_widget); - show_all (); - - set_decorated (false); - set_resizable (false); - set_size_request (s.width, s.height); - move (p.x, p.y); -} - -void -Alignment::set_text_line (int n, string t) -{ - _widget->set_text_line (n, t); -} diff --git a/src/wx/alignment.h b/src/wx/alignment.h deleted file mode 100644 index fb740b7c0..000000000 --- a/src/wx/alignment.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington <cth@carlh.net> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <gtkmm.h> -#include <string> -#include "lib/util.h" - -class AlignmentWidget; - -class Alignment : public Gtk::Window -{ -public: - Alignment (Position, Size); - - void set_text_line (int, std::string); - -private: - AlignmentWidget* _widget; -}; diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index ef09b288e..9408be970 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -27,7 +27,6 @@ #include <wx/stdpaths.h> #include "lib/config.h" #include "lib/server.h" -#include "lib/screen.h" #include "lib/format.h" #include "lib/scaler.h" #include "lib/filter.h" diff --git a/src/wx/config_dialog.h b/src/wx/config_dialog.h index 8e85db653..615d36f83 100644 --- a/src/wx/config_dialog.h +++ b/src/wx/config_dialog.h @@ -28,7 +28,6 @@ class DirPickerCtrl; -class Screen; class ServerDescription; /** @class ConfigDialog diff --git a/src/wx/dvd_title_dialog.cc b/src/wx/dvd_title_dialog.cc deleted file mode 100644 index e9606d396..000000000 --- a/src/wx/dvd_title_dialog.cc +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington <cth@carlh.net> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <cassert> -#include <iostream> -#include "lib/exceptions.h" -#include "dvd_title_dialog.h" -#include "gtk_util.h" - -using namespace std; - -DVDTitleDialog::DVDTitleDialog () -{ - string const dvd = find_dvd (); - if (dvd.empty ()) { - throw DVDError ("could not find DVD"); - } - - list<DVDTitle> t = dvd_titles (dvd); - if (t.empty ()) { - throw DVDError ("no titles found on DVD"); - } - - set_title ("Choose DVD title"); - get_vbox()->set_border_width (6); - get_vbox()->set_spacing (3); - - Gtk::RadioButtonGroup g; - for (list<DVDTitle>::const_iterator i = t.begin(); i != t.end(); ++i) { - Gtk::RadioButton* b = manage (new Gtk::RadioButton); - stringstream s; -#if HAVE_G_FORMAT_SIZE - s << "Title " << i->number << ": " << g_format_size (i->size); -#else - s << "Title " << i->number << ": " << g_format_size_for_display (i->size); -#endif - b->set_label (s.str ()); - if (i == t.begin ()) { - b->set_active (); - g = b->get_group (); - } else { - b->set_group (g); - } - get_vbox()->pack_start (*b); - _buttons[*i] = b; - } - - add_button ("Cancel", Gtk::RESPONSE_CANCEL); - add_button ("Copy Title", Gtk::RESPONSE_OK); - - show_all (); -} - -DVDTitle -DVDTitleDialog::selected () -{ - std::map<DVDTitle, Gtk::RadioButton *>::const_iterator i = _buttons.begin (); - while (i != _buttons.end() && i->second->get_active() == false) { - ++i; - } - - assert (i != _buttons.end ()); - return i->first; -} diff --git a/src/wx/dvd_title_dialog.h b/src/wx/dvd_title_dialog.h deleted file mode 100644 index 26aef286f..000000000 --- a/src/wx/dvd_title_dialog.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington <cth@carlh.net> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <gtkmm.h> -#include "lib/dvd.h" - -class DVDTitleDialog : public Gtk::Dialog -{ -public: - DVDTitleDialog (); - - DVDTitle selected (); - -private: - std::map<DVDTitle, Gtk::RadioButton *> _buttons; -}; diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 703059780..67cd17d4a 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -34,7 +34,6 @@ #include "lib/ab_transcode_job.h" #include "lib/job_manager.h" #include "lib/filter.h" -#include "lib/screen.h" #include "lib/config.h" #include "filter_dialog.h" #include "wx_util.h" diff --git a/src/wx/film_player.cc b/src/wx/film_player.cc deleted file mode 100644 index 53779d650..000000000 --- a/src/wx/film_player.cc +++ /dev/null @@ -1,310 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington <cth@carlh.net> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include "lib/screen.h" -#include "lib/config.h" -#include "lib/player_manager.h" -#include "lib/film.h" -#include "film_player.h" -#include "gtk_util.h" - -using namespace std; -using namespace boost; - -FilmPlayer::FilmPlayer (Film const * f) - : _play ("Play") - , _pause ("Pause") - , _stop ("Stop") - , _ab ("A/B") - , _ignore_position_changed (false) -{ - set_film (f); - - vector<shared_ptr<Screen> > const scr = Config::instance()->screens (); - for (vector<shared_ptr<Screen> >::const_iterator i = scr.begin(); i != scr.end(); ++i) { - _screen.append_text ((*i)->name ()); - } - - if (!scr.empty ()) { - _screen.set_active (0); - } - - _status.set_use_markup (true); - - _position.set_digits (0); - - _main_vbox.set_spacing (12); - - Gtk::HBox* l = manage (new Gtk::HBox); - l->pack_start (_play); - l->pack_start (_pause); - l->pack_start (_stop); - - Gtk::VBox* r = manage (new Gtk::VBox); - r->pack_start (_screen, false, false); - r->pack_start (_ab, false, false); - r->pack_start (*manage (new Gtk::Label ("")), true, true); - - Gtk::HBox* t = manage (new Gtk::HBox); - t->pack_start (*l, true, true); - t->pack_start (*r, false, false); - - _main_vbox.pack_start (*t, true, true); - _main_vbox.pack_start (_position, false, false); - _main_vbox.pack_start (_status, false, false); - - _play.signal_clicked().connect (sigc::mem_fun (*this, &FilmPlayer::play_clicked)); - _pause.signal_clicked().connect (sigc::mem_fun (*this, &FilmPlayer::pause_clicked)); - _stop.signal_clicked().connect (sigc::mem_fun (*this, &FilmPlayer::stop_clicked)); - _position.signal_value_changed().connect (sigc::mem_fun (*this, &FilmPlayer::position_changed)); - _position.signal_format_value().connect (sigc::mem_fun (*this, &FilmPlayer::format_position)); - - set_button_states (); - Glib::signal_timeout().connect (sigc::bind_return (sigc::mem_fun (*this, &FilmPlayer::update), true), 1000); - - Config::instance()->Changed.connect (sigc::mem_fun (*this, &FilmPlayer::update_screens)); -} - -void -FilmPlayer::set_film (Film const * f) -{ - _film = f; - - if (_film && _film->length() != 0 && _film->frames_per_second() != 0) { - _position.set_range (0, _film->length() / _film->frames_per_second()); - } - - if (_film) { - _film->Changed.connect (sigc::mem_fun (*this, &FilmPlayer::film_changed)); - } -} - -Gtk::Widget & -FilmPlayer::widget () -{ - return _main_vbox; -} - -void -FilmPlayer::set_button_states () -{ - if (_film == 0) { - _play.set_sensitive (false); - _pause.set_sensitive (false); - _stop.set_sensitive (false); - _screen.set_sensitive (false); - _position.set_sensitive (false); - _ab.set_sensitive (false); - return; - } - - PlayerManager::State s = PlayerManager::instance()->state (); - - switch (s) { - case PlayerManager::QUIESCENT: - _play.set_sensitive (true); - _pause.set_sensitive (false); - _stop.set_sensitive (false); - _screen.set_sensitive (true); - _position.set_sensitive (false); - _ab.set_sensitive (true); - break; - case PlayerManager::PLAYING: - _play.set_sensitive (false); - _pause.set_sensitive (true); - _stop.set_sensitive (true); - _screen.set_sensitive (false); - _position.set_sensitive (true); - _ab.set_sensitive (false); - break; - case PlayerManager::PAUSED: - _play.set_sensitive (true); - _pause.set_sensitive (false); - _stop.set_sensitive (true); - _screen.set_sensitive (false); - _position.set_sensitive (false); - _ab.set_sensitive (false); - break; - } -} - -void -FilmPlayer::play_clicked () -{ - PlayerManager* p = PlayerManager::instance (); - - switch (p->state ()) { - case PlayerManager::QUIESCENT: - _last_play_fs = _film->state_copy (); - if (_ab.get_active ()) { - shared_ptr<Film> fs_a = _film->state_copy (); - fs_a->filters.clear (); - /* This is somewhat arbitrary, but hey ho */ - fs_a->scaler = Scaler::from_id ("bicubic"); - p->setup (fs_a, _last_play_fs, screen ()); - } else { - p->setup (_last_play_fs, screen ()); - } - p->pause_or_unpause (); - break; - case PlayerManager::PLAYING: - break; - case PlayerManager::PAUSED: - p->pause_or_unpause (); - break; - } -} - -void -FilmPlayer::pause_clicked () -{ - PlayerManager* p = PlayerManager::instance (); - - switch (p->state ()) { - case PlayerManager::QUIESCENT: - break; - case PlayerManager::PLAYING: - p->pause_or_unpause (); - break; - case PlayerManager::PAUSED: - break; - } -} - -void -FilmPlayer::stop_clicked () -{ - PlayerManager::instance()->stop (); -} - -shared_ptr<Screen> -FilmPlayer::screen () const -{ - vector<shared_ptr<Screen> > const s = Config::instance()->screens (); - if (s.empty ()) { - return shared_ptr<Screen> (); - } - - int const r = _screen.get_active_row_number (); - if (r >= int (s.size ())) { - return s[0]; - } - - return s[r]; -} - -void -FilmPlayer::update () -{ - set_button_states (); - set_status (); -} - -void -FilmPlayer::set_status () -{ - PlayerManager::State s = PlayerManager::instance()->state (); - - stringstream m; - switch (s) { - case PlayerManager::QUIESCENT: - m << "Idle"; - break; - case PlayerManager::PLAYING: - m << "<span foreground=\"red\" weight=\"bold\">PLAYING</span>"; - break; - case PlayerManager::PAUSED: - m << "<b>Paused</b>"; - break; - } - - _ignore_position_changed = true; - - if (s != PlayerManager::QUIESCENT) { - float const p = PlayerManager::instance()->position (); - if (_last_play_fs->frames_per_second != 0 && _last_play_fs->length != 0) { - m << " <i>(" << seconds_to_hms (_last_play_fs->length / _last_play_fs->frames_per_second - p) << " remaining)</i>"; - } - - _position.set_value (p); - } else { - _position.set_value (0); - } - - _ignore_position_changed = false; - - _status.set_markup (m.str ()); -} - -void -FilmPlayer::position_changed () -{ - if (_ignore_position_changed) { - return; - } - - PlayerManager::instance()->set_position (_position.get_value ()); -} - -string -FilmPlayer::format_position (double v) -{ - return seconds_to_hms (v); -} - -void -FilmPlayer::update_screens () -{ - string const c = _screen.get_active_text (); - - _screen.clear (); - - vector<shared_ptr<Screen> > const scr = Config::instance()->screens (); - bool have_last_active_text = false; - for (vector<shared_ptr<Screen> >::const_iterator i = scr.begin(); i != scr.end(); ++i) { - _screen.append_text ((*i)->name ()); - if ((*i)->name() == c) { - have_last_active_text = true; - } - } - - if (have_last_active_text) { - _screen.set_active_text (c); - } else if (!scr.empty ()) { - _screen.set_active (0); - } -} - -void -FilmPlayer::film_changed (Film::Property p) -{ - if (p == Film::CONTENT) { - setup_visibility (); - } -} - -void -FilmPlayer::setup_visibility () -{ - if (!_film) { - return; - } - - widget().property_visible() = (_film->content_type() == VIDEO); -} diff --git a/src/wx/film_player.h b/src/wx/film_player.h deleted file mode 100644 index bb60eeb3b..000000000 --- a/src/wx/film_player.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington <cth@carlh.net> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <gtkmm.h> -#include "lib/film.h" - -class Film; -class Screen; -class FilmState; - -class FilmPlayer -{ -public: - FilmPlayer (Film const * f = 0); - - Gtk::Widget& widget (); - - void set_film (Film const *); - void setup_visibility (); - -private: - void play_clicked (); - void pause_clicked (); - void stop_clicked (); - void position_changed (); - std::string format_position (double); - void film_changed (Film::Property); - - void set_button_states (); - boost::shared_ptr<Screen> screen () const; - void set_status (); - void update (); - void update_screens (); - - Film const * _film; - boost::shared_ptr<const FilmState> _last_play_fs; - - Gtk::VBox _main_vbox; - Gtk::Button _play; - Gtk::Button _pause; - Gtk::Button _stop; - Gtk::Label _status; - Gtk::CheckButton _ab; - Gtk::ComboBoxText _screen; - Gtk::HScale _position; - bool _ignore_position_changed; -}; diff --git a/src/wx/wscript b/src/wx/wscript index e5431460f..d425c3e05 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -26,11 +26,4 @@ def build(bld): wx_ui_signaller.cc """ -# alignment.cc -# film_list.cc -# dvd_title_dialog.cc - - if not bld.env.DISABLE_PLAYER: - obj.source += " film_player.cc" - obj.target = 'dvdomatic-wx' |
