summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/content_panel.cc2
-rw-r--r--src/wx/film_editor.cc2
-rw-r--r--src/wx/standard_controls.cc6
-rw-r--r--src/wx/wscript5
-rw-r--r--src/wx/wx_help.cc111
-rw-r--r--src/wx/wx_help.h66
6 files changed, 187 insertions, 5 deletions
diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc
index 7d854224d..681761f19 100644
--- a/src/wx/content_panel.cc
+++ b/src/wx/content_panel.cc
@@ -28,6 +28,7 @@
#include "image_sequence_dialog.h"
#include "film_viewer.h"
#include "dcpomatic_button.h"
+#include "wx_help.h"
#include "lib/audio_content.h"
#include "lib/text_content.h"
#include "lib/video_content.h"
@@ -128,6 +129,7 @@ ContentPanel::ContentPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmV
_add_folder = new Button (top, _("Add folder..."));
_add_folder->SetToolTip (_("Add a folder of image files (which will be used as a moving image sequence) or a folder of sound files."));
b->Add (_add_folder, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+ HelpGUI::instance()->landmark (_add_folder, HelpGUI::ADD_FOLDER_BUTTON);
_add_dcp = new Button (top, _("Add DCP..."));
_add_dcp->SetToolTip (_("Add a DCP."));
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index ae0868f27..5de677c21 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
diff --git a/src/wx/standard_controls.cc b/src/wx/standard_controls.cc
index 5df89f8fe..11426ff59 100644
--- a/src/wx/standard_controls.cc
+++ b/src/wx/standard_controls.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2020 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,8 +18,9 @@
*/
-#include "standard_controls.h"
#include "film_viewer.h"
+#include "standard_controls.h"
+#include "wx_help.h"
#include <wx/wx.h>
#include <wx/tglbtn.h>
@@ -31,6 +32,7 @@ StandardControls::StandardControls (wxWindow* parent, shared_ptr<FilmViewer> vie
{
_button_sizer->Add (_play_button, 0, wxEXPAND);
_play_button->Bind (wxEVT_TOGGLEBUTTON, boost::bind(&StandardControls::play_clicked, this));
+ HelpGUI::instance()->landmark (_play_button, HelpGUI::PLAY_BUTTON);
}
void
diff --git a/src/wx/wscript b/src/wx/wscript
index 7acbcc56f..ad1c49806 100644
--- a/src/wx/wscript
+++ b/src/wx/wscript
@@ -111,8 +111,8 @@ sources = """
playlist_controls.cc
playlist_editor_config_dialog.cc
question_dialog.cc
- rating_dialog.cc
qube_certificate_panel.cc
+ rating_dialog.cc
recipients_panel.cc
recipient_dialog.cc
recreate_chain_dialog.cc
@@ -160,8 +160,9 @@ sources = """
video_view.cc
video_waveform_dialog.cc
video_waveform_plot.cc
- wx_util.cc
+ wx_help.cc
wx_signal_manager.cc
+ wx_util.cc
"""
def configure(conf):
diff --git a/src/wx/wx_help.cc b/src/wx/wx_help.cc
new file mode 100644
index 000000000..529977c96
--- /dev/null
+++ b/src/wx/wx_help.cc
@@ -0,0 +1,111 @@
+#include "wx_help.h"
+#include "wx_util.h"
+#include <iostream>
+
+HelpGUI* HelpGUI::_instance = 0;
+
+
+HelpGUI::HelpGUI ()
+ : _current_index (-1)
+ , _current_frame (0)
+{
+ _messages.push_back (Message("file_new", wxPoint(50, 100), Help::SUCCESSFUL_FILE_NEW));
+ _messages.push_back (Message("add_content", ADD_FOLDER_BUTTON, wxSize(24, -48), Help::SUCCESSFUL_ADD_CONTENT));
+ _messages.push_back (Message("preview", PLAY_BUTTON, wxSize(24, 0)));
+
+ Help::instance()->Event.connect (boost::bind(&HelpGUI::event, this, _1));
+}
+
+
+void
+HelpGUI::event (Help::EventType e)
+{
+ if (
+ _current_index >= 0 &&
+ _current_index < int(_messages.size() - 1) &&
+ _messages[_current_index].next_trigger &&
+ *_messages[_current_index].next_trigger == e) {
+ next ();
+ }
+}
+
+
+void
+HelpGUI::landmark (wxWindow* landmark, Landmark id)
+{
+ _landmarks[id] = landmark;
+}
+
+
+void
+HelpGUI::next ()
+{
+ ++_current_index;
+ show (_current_index);
+}
+
+
+void
+HelpGUI::start ()
+{
+ next ();
+}
+
+
+void
+HelpGUI::show (int index)
+{
+ if (_current_frame) {
+ _current_frame->Destroy ();
+ _current_frame = 0;
+ }
+
+ Message const& m = _messages[index];
+ wxBitmap bitmap (bitmap_path("help/" + m.id));
+ wxPoint pos;
+ if (m.anchor_point) {
+ pos = *m.anchor_point;
+ } else if (m.anchor_landmark) {
+ DCPOMATIC_ASSERT (_landmarks.find(*m.anchor_landmark) != _landmarks.end());
+ wxWindow* lm = _landmarks[*m.anchor_landmark];
+ pos = lm->GetScreenPosition();
+ pos.x += lm->GetSize().GetWidth();
+ }
+ pos += m.offset;
+ _current_frame = new wxFrame (0, wxID_ANY, wxT(""), pos, wxSize(bitmap.GetSize().GetWidth() + 16, bitmap.GetSize().GetHeight() + 128), wxFRAME_TOOL_WINDOW);
+ wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+ wxStaticBitmap* static_bitmap = new wxStaticBitmap (_current_frame, wxID_ANY, bitmap);
+ sizer->Add (static_bitmap, 1, wxEXPAND);
+ wxSizer* buttons_sizer = new wxBoxSizer (wxHORIZONTAL);
+ wxButton* close = new wxButton (_current_frame, wxID_ANY, _("Stop showing tips"));
+ close->Bind (wxEVT_BUTTON, boost::bind(&HelpGUI::stop, this));
+ buttons_sizer->Add (close, 1, wxEXPAND | wxALL, 8);
+ sizer->Add (buttons_sizer, 0, wxALIGN_RIGHT);
+ _current_frame->SetSizer (sizer);
+ _current_frame->Show ();
+}
+
+
+void
+HelpGUI::stop ()
+{
+ _current_index = -1;
+ if (_current_frame) {
+ _current_frame->Destroy ();
+ }
+
+ /* XXX: should write a config entry */
+}
+
+
+HelpGUI *
+HelpGUI::instance ()
+{
+ if (!_instance) {
+ _instance = new HelpGUI ();
+ }
+
+ return _instance;
+}
+
+
diff --git a/src/wx/wx_help.h b/src/wx/wx_help.h
new file mode 100644
index 000000000..0d566346d
--- /dev/null
+++ b/src/wx/wx_help.h
@@ -0,0 +1,66 @@
+#include "lib/help.h"
+#include <wx/wx.h>
+#include <boost/optional.hpp>
+#include <map>
+#include <string>
+#include <vector>
+
+class HelpGUI
+{
+public:
+ static HelpGUI* instance ();
+
+ void start ();
+
+ enum Landmark {
+ ADD_FOLDER_BUTTON,
+ PLAY_BUTTON
+ };
+
+ void landmark (wxWindow* landmark, Landmark id);
+
+private:
+ class Message
+ {
+ public:
+ Message (std::string id_, wxPoint anchor_, Help::EventType next_trigger_)
+ : id (id_)
+ , anchor_point (anchor_)
+ , next_trigger (next_trigger_)
+ {}
+
+ Message (std::string id_, Landmark anchor_, wxSize offset_)
+ : id (id_)
+ , anchor_landmark (anchor_)
+ , offset (offset_)
+ {}
+
+ Message (std::string id_, Landmark anchor_, wxSize offset_, Help::EventType next_trigger_)
+ : id (id_)
+ , anchor_landmark (anchor_)
+ , offset (offset_)
+ , next_trigger (next_trigger_)
+ {}
+
+ std::string id;
+ boost::optional<wxPoint> anchor_point;
+ boost::optional<Landmark> anchor_landmark;
+ wxSize offset;
+ boost::optional<Help::EventType> next_trigger;
+ };
+
+ HelpGUI ();
+ void event (Help::EventType e);
+ void show (int index);
+ void next ();
+ void stop ();
+
+ static HelpGUI* _instance;
+
+ int _current_index;
+ wxFrame* _current_frame;
+ std::vector<Message> _messages;
+ std::map<Landmark, wxWindow*> _landmarks;
+};
+
+