Merge branch 'rr1-maint'
Conflicts: include/core/dispatch.hpp src/core/dispatch.cpp src/core/inthread.cpp
This commit is contained in:
commit
fa3211f87f
4 changed files with 61 additions and 14 deletions
|
@ -381,6 +381,16 @@ public:
|
||||||
* Call on_new_core on on all objects.
|
* Call on_new_core on on all objects.
|
||||||
*/
|
*/
|
||||||
static void do_new_core() throw();
|
static void do_new_core() throw();
|
||||||
|
/**
|
||||||
|
* Notify about changes to voice streams.
|
||||||
|
*
|
||||||
|
* Default implementation does nothing.
|
||||||
|
*/
|
||||||
|
virtual void on_voice_stream_change();
|
||||||
|
/**
|
||||||
|
* Call on_voice_stream_change on all objects.
|
||||||
|
*/
|
||||||
|
static void do_voice_stream_change() throw();
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Call to indicate this target is interested in sound sample data.
|
* Call to indicate this target is interested in sound sample data.
|
||||||
|
|
|
@ -497,3 +497,19 @@ void information_dispatch::do_new_core() throw()
|
||||||
END_EH_BLOCK(i, "on_new_core");
|
END_EH_BLOCK(i, "on_new_core");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void information_dispatch::on_voice_stream_change()
|
||||||
|
{
|
||||||
|
//Do nothing.
|
||||||
|
}
|
||||||
|
|
||||||
|
void information_dispatch::do_voice_stream_change() throw()
|
||||||
|
{
|
||||||
|
if(in_global_ctors())
|
||||||
|
return;
|
||||||
|
for(auto& i : dispatch()) {
|
||||||
|
START_EH_BLOCK
|
||||||
|
i->on_voice_stream_change();
|
||||||
|
END_EH_BLOCK(i, "on_voice_stream_change");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "library/ogg.hpp"
|
#include "library/ogg.hpp"
|
||||||
#include "core/audioapi.hpp"
|
#include "core/audioapi.hpp"
|
||||||
#include "core/command.hpp"
|
#include "core/command.hpp"
|
||||||
|
#include "core/dispatch.hpp"
|
||||||
#include "core/framerate.hpp"
|
#include "core/framerate.hpp"
|
||||||
#include "core/inthread.hpp"
|
#include "core/inthread.hpp"
|
||||||
#include "core/keymapper.hpp"
|
#include "core/keymapper.hpp"
|
||||||
|
@ -1669,6 +1670,7 @@ out:
|
||||||
messages << "Can't add stream: " << e.what() << std::endl;
|
messages << "Can't add stream: " << e.what() << std::endl;
|
||||||
active_stream->put_ref();
|
active_stream->put_ref();
|
||||||
}
|
}
|
||||||
|
information_dispatch::do_voice_stream_change();
|
||||||
} else
|
} else
|
||||||
active_stream->put_ref();
|
active_stream->put_ref();
|
||||||
active_stream = NULL;
|
active_stream = NULL;
|
||||||
|
@ -1925,6 +1927,7 @@ uint64_t voicesub_import_stream(uint64_t ts, const std::string& filename, extern
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
st->unlock(); //Not locked.
|
st->unlock(); //Not locked.
|
||||||
|
information_dispatch::do_voice_stream_change();
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1934,6 +1937,7 @@ void voicesub_delete_stream(uint64_t id)
|
||||||
if(!current_collection)
|
if(!current_collection)
|
||||||
throw std::runtime_error("No collection loaded");
|
throw std::runtime_error("No collection loaded");
|
||||||
current_collection->delete_stream(id);
|
current_collection->delete_stream(id);
|
||||||
|
information_dispatch::do_voice_stream_change();
|
||||||
}
|
}
|
||||||
|
|
||||||
void voicesub_export_superstream(const std::string& filename)
|
void voicesub_export_superstream(const std::string& filename)
|
||||||
|
@ -1957,6 +1961,7 @@ void voicesub_load_collection(const std::string& filename)
|
||||||
if(current_collection)
|
if(current_collection)
|
||||||
delete current_collection;
|
delete current_collection;
|
||||||
current_collection = newc;
|
current_collection = newc;
|
||||||
|
information_dispatch::do_voice_stream_change();
|
||||||
}
|
}
|
||||||
|
|
||||||
void voicesub_unload_collection()
|
void voicesub_unload_collection()
|
||||||
|
@ -1965,6 +1970,7 @@ void voicesub_unload_collection()
|
||||||
if(current_collection)
|
if(current_collection)
|
||||||
delete current_collection;
|
delete current_collection;
|
||||||
current_collection = NULL;
|
current_collection = NULL;
|
||||||
|
information_dispatch::do_voice_stream_change();
|
||||||
}
|
}
|
||||||
|
|
||||||
void voicesub_alter_timebase(uint64_t id, uint64_t ts)
|
void voicesub_alter_timebase(uint64_t id, uint64_t ts)
|
||||||
|
@ -1973,6 +1979,7 @@ void voicesub_alter_timebase(uint64_t id, uint64_t ts)
|
||||||
if(!current_collection)
|
if(!current_collection)
|
||||||
throw std::runtime_error("No collection loaded");
|
throw std::runtime_error("No collection loaded");
|
||||||
current_collection->alter_stream_timebase(id, ts);
|
current_collection->alter_stream_timebase(id, ts);
|
||||||
|
information_dispatch::do_voice_stream_change();
|
||||||
}
|
}
|
||||||
|
|
||||||
double voicesub_ts_seconds(uint64_t ts)
|
double voicesub_ts_seconds(uint64_t ts)
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <wx/control.h>
|
#include <wx/control.h>
|
||||||
#include <wx/combobox.h>
|
#include <wx/combobox.h>
|
||||||
|
|
||||||
|
#include "core/dispatch.hpp"
|
||||||
#include "library/string.hpp"
|
#include "library/string.hpp"
|
||||||
|
|
||||||
#define NOTHING 0xFFFFFFFFFFFFFFFFULL
|
#define NOTHING 0xFFFFFFFFFFFFFFFFULL
|
||||||
|
@ -22,6 +23,7 @@ class wxeditor_voicesub : public wxDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxeditor_voicesub(wxWindow* parent);
|
wxeditor_voicesub(wxWindow* parent);
|
||||||
|
~wxeditor_voicesub() throw();
|
||||||
bool ShouldPreventAppExit() const;
|
bool ShouldPreventAppExit() const;
|
||||||
void on_select(wxCommandEvent& e);
|
void on_select(wxCommandEvent& e);
|
||||||
void on_play(wxCommandEvent& e);
|
void on_play(wxCommandEvent& e);
|
||||||
|
@ -39,9 +41,23 @@ public:
|
||||||
void on_refresh(wxCommandEvent& e);
|
void on_refresh(wxCommandEvent& e);
|
||||||
void on_close(wxCommandEvent& e);
|
void on_close(wxCommandEvent& e);
|
||||||
void on_wclose(wxCloseEvent& e);
|
void on_wclose(wxCloseEvent& e);
|
||||||
private:
|
|
||||||
bool closing;
|
|
||||||
void refresh();
|
void refresh();
|
||||||
|
private:
|
||||||
|
struct refresh_listener : public information_dispatch
|
||||||
|
{
|
||||||
|
refresh_listener(wxeditor_voicesub* v)
|
||||||
|
: information_dispatch("voicesub-editor-change-listner")
|
||||||
|
{
|
||||||
|
obj = v;
|
||||||
|
}
|
||||||
|
void on_voice_stream_change()
|
||||||
|
{
|
||||||
|
wxeditor_voicesub* _obj = obj;
|
||||||
|
runuifun([_obj]() -> void { _obj->refresh(); });
|
||||||
|
}
|
||||||
|
wxeditor_voicesub* obj;
|
||||||
|
};
|
||||||
|
bool closing;
|
||||||
uint64_t get_id();
|
uint64_t get_id();
|
||||||
std::map<int, uint64_t> smap;
|
std::map<int, uint64_t> smap;
|
||||||
wxListBox* subtitles;
|
wxListBox* subtitles;
|
||||||
|
@ -59,6 +75,8 @@ private:
|
||||||
wxButton* unloadbutton;
|
wxButton* unloadbutton;
|
||||||
wxButton* refreshbutton;
|
wxButton* refreshbutton;
|
||||||
wxButton* closebutton;
|
wxButton* closebutton;
|
||||||
|
refresh_listener* rlistener;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
wxeditor_voicesub::wxeditor_voicesub(wxWindow* parent)
|
wxeditor_voicesub::wxeditor_voicesub(wxWindow* parent)
|
||||||
|
@ -150,9 +168,15 @@ wxeditor_voicesub::wxeditor_voicesub(wxWindow* parent)
|
||||||
|
|
||||||
top_s->SetSizeHints(this);
|
top_s->SetSizeHints(this);
|
||||||
Fit();
|
Fit();
|
||||||
|
rlistener = new refresh_listener(this);
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxeditor_voicesub::~wxeditor_voicesub() throw()
|
||||||
|
{
|
||||||
|
delete rlistener;
|
||||||
|
}
|
||||||
|
|
||||||
void wxeditor_voicesub::on_select(wxCommandEvent& e)
|
void wxeditor_voicesub::on_select(wxCommandEvent& e)
|
||||||
{
|
{
|
||||||
if(closing)
|
if(closing)
|
||||||
|
@ -177,7 +201,6 @@ void wxeditor_voicesub::on_play(wxCommandEvent& e)
|
||||||
} catch(std::exception& e) {
|
} catch(std::exception& e) {
|
||||||
show_message_ok(this, "Error playing", e.what(), wxICON_EXCLAMATION);
|
show_message_ok(this, "Error playing", e.what(), wxICON_EXCLAMATION);
|
||||||
}
|
}
|
||||||
refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxeditor_voicesub::on_delete(wxCommandEvent& e)
|
void wxeditor_voicesub::on_delete(wxCommandEvent& e)
|
||||||
|
@ -190,7 +213,6 @@ void wxeditor_voicesub::on_delete(wxCommandEvent& e)
|
||||||
} catch(std::exception& e) {
|
} catch(std::exception& e) {
|
||||||
show_message_ok(this, "Error deleting", e.what(), wxICON_EXCLAMATION);
|
show_message_ok(this, "Error deleting", e.what(), wxICON_EXCLAMATION);
|
||||||
}
|
}
|
||||||
refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxeditor_voicesub::on_export_o(wxCommandEvent& e)
|
void wxeditor_voicesub::on_export_o(wxCommandEvent& e)
|
||||||
|
@ -209,7 +231,6 @@ void wxeditor_voicesub::on_export_o(wxCommandEvent& e)
|
||||||
} catch(std::exception& e) {
|
} catch(std::exception& e) {
|
||||||
show_message_ok(this, "Error exporting", e.what(), wxICON_EXCLAMATION);
|
show_message_ok(this, "Error exporting", e.what(), wxICON_EXCLAMATION);
|
||||||
}
|
}
|
||||||
refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxeditor_voicesub::on_export_p(wxCommandEvent& e)
|
void wxeditor_voicesub::on_export_p(wxCommandEvent& e)
|
||||||
|
@ -228,7 +249,6 @@ void wxeditor_voicesub::on_export_p(wxCommandEvent& e)
|
||||||
} catch(std::exception& e) {
|
} catch(std::exception& e) {
|
||||||
show_message_ok(this, "Error exporting", e.what(), wxICON_EXCLAMATION);
|
show_message_ok(this, "Error exporting", e.what(), wxICON_EXCLAMATION);
|
||||||
}
|
}
|
||||||
refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxeditor_voicesub::on_export_q(wxCommandEvent& e)
|
void wxeditor_voicesub::on_export_q(wxCommandEvent& e)
|
||||||
|
@ -247,7 +267,6 @@ void wxeditor_voicesub::on_export_q(wxCommandEvent& e)
|
||||||
} catch(std::exception& e) {
|
} catch(std::exception& e) {
|
||||||
show_message_ok(this, "Error exporting", e.what(), wxICON_EXCLAMATION);
|
show_message_ok(this, "Error exporting", e.what(), wxICON_EXCLAMATION);
|
||||||
}
|
}
|
||||||
refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxeditor_voicesub::on_export_s(wxCommandEvent& e)
|
void wxeditor_voicesub::on_export_s(wxCommandEvent& e)
|
||||||
|
@ -263,7 +282,6 @@ void wxeditor_voicesub::on_export_s(wxCommandEvent& e)
|
||||||
} catch(std::exception& e) {
|
} catch(std::exception& e) {
|
||||||
show_message_ok(this, "Error exporting superstream", e.what(), wxICON_EXCLAMATION);
|
show_message_ok(this, "Error exporting superstream", e.what(), wxICON_EXCLAMATION);
|
||||||
}
|
}
|
||||||
refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxeditor_voicesub::on_import_o(wxCommandEvent& e)
|
void wxeditor_voicesub::on_import_o(wxCommandEvent& e)
|
||||||
|
@ -282,7 +300,6 @@ void wxeditor_voicesub::on_import_o(wxCommandEvent& e)
|
||||||
} catch(std::exception& e) {
|
} catch(std::exception& e) {
|
||||||
show_message_ok(this, "Error importing", e.what(), wxICON_EXCLAMATION);
|
show_message_ok(this, "Error importing", e.what(), wxICON_EXCLAMATION);
|
||||||
}
|
}
|
||||||
refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxeditor_voicesub::on_import_p(wxCommandEvent& e)
|
void wxeditor_voicesub::on_import_p(wxCommandEvent& e)
|
||||||
|
@ -301,7 +318,6 @@ void wxeditor_voicesub::on_import_p(wxCommandEvent& e)
|
||||||
} catch(std::exception& e) {
|
} catch(std::exception& e) {
|
||||||
show_message_ok(this, "Error importing", e.what(), wxICON_EXCLAMATION);
|
show_message_ok(this, "Error importing", e.what(), wxICON_EXCLAMATION);
|
||||||
}
|
}
|
||||||
refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxeditor_voicesub::on_import_q(wxCommandEvent& e)
|
void wxeditor_voicesub::on_import_q(wxCommandEvent& e)
|
||||||
|
@ -320,7 +336,6 @@ void wxeditor_voicesub::on_import_q(wxCommandEvent& e)
|
||||||
} catch(std::exception& e) {
|
} catch(std::exception& e) {
|
||||||
show_message_ok(this, "Error importing", e.what(), wxICON_EXCLAMATION);
|
show_message_ok(this, "Error importing", e.what(), wxICON_EXCLAMATION);
|
||||||
}
|
}
|
||||||
refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxeditor_voicesub::on_change_ts(wxCommandEvent& e)
|
void wxeditor_voicesub::on_change_ts(wxCommandEvent& e)
|
||||||
|
@ -340,7 +355,6 @@ void wxeditor_voicesub::on_change_ts(wxCommandEvent& e)
|
||||||
} catch(std::exception& e) {
|
} catch(std::exception& e) {
|
||||||
show_message_ok(this, "Error changing timebase", e.what(), wxICON_EXCLAMATION);
|
show_message_ok(this, "Error changing timebase", e.what(), wxICON_EXCLAMATION);
|
||||||
}
|
}
|
||||||
refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxeditor_voicesub::on_load(wxCommandEvent& e)
|
void wxeditor_voicesub::on_load(wxCommandEvent& e)
|
||||||
|
@ -356,13 +370,11 @@ void wxeditor_voicesub::on_load(wxCommandEvent& e)
|
||||||
} catch(std::exception& e) {
|
} catch(std::exception& e) {
|
||||||
show_message_ok(this, "Error loading collection", e.what(), wxICON_EXCLAMATION);
|
show_message_ok(this, "Error loading collection", e.what(), wxICON_EXCLAMATION);
|
||||||
}
|
}
|
||||||
refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxeditor_voicesub::on_unload(wxCommandEvent& e)
|
void wxeditor_voicesub::on_unload(wxCommandEvent& e)
|
||||||
{
|
{
|
||||||
voicesub_unload_collection();
|
voicesub_unload_collection();
|
||||||
refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxeditor_voicesub::on_refresh(wxCommandEvent& e)
|
void wxeditor_voicesub::on_refresh(wxCommandEvent& e)
|
||||||
|
@ -378,6 +390,8 @@ void wxeditor_voicesub::on_close(wxCommandEvent& e)
|
||||||
|
|
||||||
void wxeditor_voicesub::refresh()
|
void wxeditor_voicesub::refresh()
|
||||||
{
|
{
|
||||||
|
if(closing)
|
||||||
|
return;
|
||||||
bool cflag = voicesub_collection_loaded();
|
bool cflag = voicesub_collection_loaded();
|
||||||
unloadbutton->Enable(cflag);
|
unloadbutton->Enable(cflag);
|
||||||
exportsbutton->Enable(cflag);
|
exportsbutton->Enable(cflag);
|
||||||
|
|
Loading…
Add table
Reference in a new issue