Add new custom events.
This commit is contained in:
parent
77fb65377b
commit
f40f514912
|
|
@ -19,7 +19,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "App.hpp"
|
#include "App.hpp"
|
||||||
#include "SampleHiveConfig.hpp"
|
|
||||||
#include "Utility/Paths.hpp"
|
#include "Utility/Paths.hpp"
|
||||||
#include "Utility/Log.hpp"
|
#include "Utility/Log.hpp"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -319,7 +319,7 @@ void TagEditor::SendInfoBarMessage(const wxString& msg, int mode)
|
||||||
{
|
{
|
||||||
SH_LOG_INFO("{} called..", __FUNCTION__);
|
SH_LOG_INFO("{} called..", __FUNCTION__);
|
||||||
|
|
||||||
SampleHive::SH_InfoBarMessageEvent event(SampleHive::SH_EVT_INFOBAR_MESSAGE_UPDATED, this->GetId());
|
SampleHive::SH_InfoBarMessageEvent event(SampleHive::SH_EVT_INFOBAR_MESSAGE_SHOW, this->GetId());
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
event.SetInfoBarMessage({ msg, mode });
|
event.SetInfoBarMessage({ msg, mode });
|
||||||
|
|
|
||||||
|
|
@ -459,8 +459,11 @@ MainFrame::MainFrame()
|
||||||
Bind(wxEVT_BUTTON, &MainFrame::OnClickRemoveHive, this, BC_HiveRemove);
|
Bind(wxEVT_BUTTON, &MainFrame::OnClickRemoveHive, this, BC_HiveRemove);
|
||||||
|
|
||||||
Bind(SampleHive::SH_EVT_LOOP_POINTS_UPDATED, &MainFrame::OnRecieveLoopPoints, this);
|
Bind(SampleHive::SH_EVT_LOOP_POINTS_UPDATED, &MainFrame::OnRecieveLoopPoints, this);
|
||||||
Bind(SampleHive::SH_EVT_STATUSBAR_MESSAGE_UPDATED, &MainFrame::OnRecieveStatusBarStatus, this);
|
Bind(SampleHive::SH_EVT_STATUSBAR_STATUS_PUSH, &MainFrame::OnRecievePushStatusBarStatus, this);
|
||||||
Bind(SampleHive::SH_EVT_INFOBAR_MESSAGE_UPDATED, &MainFrame::OnRecieveInfoBarStatus, this);
|
Bind(SampleHive::SH_EVT_STATUSBAR_STATUS_POP, &MainFrame::OnRecievePopStatusBarStatus, this);
|
||||||
|
Bind(SampleHive::SH_EVT_STATUSBAR_STATUS_SET, &MainFrame::OnRecieveSetStatusBarStatus, this);
|
||||||
|
Bind(SampleHive::SH_EVT_INFOBAR_MESSAGE_SHOW, &MainFrame::OnRecieveInfoBarStatus, this);
|
||||||
|
Bind(SampleHive::SH_EVT_TIMER_STOP, &MainFrame::OnRecieveTimerStopStatus, this);
|
||||||
|
|
||||||
// Adding widgets to their sizers
|
// Adding widgets to their sizers
|
||||||
m_MainSizer->Add(m_MainPanel, 1, wxALL | wxEXPAND, 0);
|
m_MainSizer->Add(m_MainPanel, 1, wxALL | wxEXPAND, 0);
|
||||||
|
|
@ -3012,21 +3015,33 @@ void MainFrame::OnRecieveLoopPoints(SampleHive::SH_LoopPointsEvent& event)
|
||||||
int loopB_min = static_cast<int>((m_LoopB / 60000).GetValue());
|
int loopB_min = static_cast<int>((m_LoopB / 60000).GetValue());
|
||||||
int loopB_sec = static_cast<int>(((m_LoopB % 60000) / 1000).GetValue());
|
int loopB_sec = static_cast<int>(((m_LoopB % 60000) / 1000).GetValue());
|
||||||
|
|
||||||
// SH_LOG_INFO(wxString::Format(_("Loop points set: A: %2i:%02i, B: %2i:%02i"),
|
SH_LOG_INFO(wxString::Format(_("Loop points set: A: %2i:%02i, B: %2i:%02i"),
|
||||||
// loopA_min, loopA_sec, loopB_min, loopB_sec));
|
loopA_min, loopA_sec, loopB_min, loopB_sec));
|
||||||
|
|
||||||
m_LoopABButton->SetValue(true);
|
m_LoopABButton->SetValue(true);
|
||||||
|
|
||||||
bLoopPointsSet = true;
|
bLoopPointsSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainFrame::OnRecieveStatusBarStatus(SampleHive::SH_StatusBarMessageEvent& event)
|
void MainFrame::OnRecievePushStatusBarStatus(SampleHive::SH_StatusBarStatusEvent& event)
|
||||||
{
|
{
|
||||||
std::pair<wxString, int> status = event.GetMessageAndSection();
|
std::pair<wxString, int> status = event.GetPushMessageAndSection();
|
||||||
|
|
||||||
m_StatusBar->PushStatusText(status.first, status.second);
|
m_StatusBar->PushStatusText(status.first, status.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainFrame::OnRecievePopStatusBarStatus(SampleHive::SH_StatusBarStatusEvent& event)
|
||||||
|
{
|
||||||
|
m_StatusBar->PopStatusText(event.GetPopMessageSection());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainFrame::OnRecieveSetStatusBarStatus(SampleHive::SH_StatusBarStatusEvent& event)
|
||||||
|
{
|
||||||
|
std::pair<wxString, int> status = event.GetStatusTextAndSection();
|
||||||
|
|
||||||
|
m_StatusBar->SetStatusText(status.first, status.second);
|
||||||
|
}
|
||||||
|
|
||||||
void MainFrame::OnRecieveInfoBarStatus(SampleHive::SH_InfoBarMessageEvent& event)
|
void MainFrame::OnRecieveInfoBarStatus(SampleHive::SH_InfoBarMessageEvent& event)
|
||||||
{
|
{
|
||||||
SH_LOG_INFO("{} called..", __FUNCTION__);
|
SH_LOG_INFO("{} called..", __FUNCTION__);
|
||||||
|
|
@ -3038,6 +3053,12 @@ void MainFrame::OnRecieveInfoBarStatus(SampleHive::SH_InfoBarMessageEvent& event
|
||||||
SH_LOG_INFO("{} event processed", __FUNCTION__);
|
SH_LOG_INFO("{} event processed", __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainFrame::OnRecieveTimerStopStatus(SampleHive::SH_TimerEvent& event)
|
||||||
|
{
|
||||||
|
if (m_Timer->IsRunning())
|
||||||
|
m_Timer->Stop();
|
||||||
|
}
|
||||||
|
|
||||||
void MainFrame::ClearLoopPoints()
|
void MainFrame::ClearLoopPoints()
|
||||||
{
|
{
|
||||||
m_LoopA = 0;
|
m_LoopA = 0;
|
||||||
|
|
|
||||||
|
|
@ -273,8 +273,11 @@ class MainFrame : public wxFrame
|
||||||
// Recieve custom events
|
// Recieve custom events
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
void OnRecieveLoopPoints(SampleHive::SH_LoopPointsEvent& event);
|
void OnRecieveLoopPoints(SampleHive::SH_LoopPointsEvent& event);
|
||||||
void OnRecieveStatusBarStatus(SampleHive::SH_StatusBarMessageEvent& event);
|
void OnRecievePushStatusBarStatus(SampleHive::SH_StatusBarStatusEvent& event);
|
||||||
|
void OnRecievePopStatusBarStatus(SampleHive::SH_StatusBarStatusEvent& event);
|
||||||
|
void OnRecieveSetStatusBarStatus(SampleHive::SH_StatusBarStatusEvent& event);
|
||||||
void OnRecieveInfoBarStatus(SampleHive::SH_InfoBarMessageEvent& event);
|
void OnRecieveInfoBarStatus(SampleHive::SH_InfoBarMessageEvent& event);
|
||||||
|
void OnRecieveTimerStopStatus(SampleHive::SH_TimerEvent& event);
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
void LoadDatabase();
|
void LoadDatabase();
|
||||||
|
|
|
||||||
|
|
@ -427,7 +427,7 @@ void WaveformViewer::OnMouseLeftButtonUp(wxMouseEvent& event)
|
||||||
SetCursor(wxCURSOR_ARROW);
|
SetCursor(wxCURSOR_ARROW);
|
||||||
|
|
||||||
m_MediaCtrl.Seek(seek_to, wxFromStart);
|
m_MediaCtrl.Seek(seek_to, wxFromStart);
|
||||||
SendStatusBarStatus(wxString::Format(_("Now playing: %s"), selected), 1);
|
SendPushStatusBarStatus(wxString::Format(_("Now playing: %s"), selected), 1);
|
||||||
m_MediaCtrl.Play();
|
m_MediaCtrl.Play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -474,12 +474,12 @@ void WaveformViewer::SendLoopPoints()
|
||||||
SH_LOG_DEBUG("{} processed event, sending loop points..", __FUNCTION__);
|
SH_LOG_DEBUG("{} processed event, sending loop points..", __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaveformViewer::SendStatusBarStatus(const wxString& msg, int section)
|
void WaveformViewer::SendPushStatusBarStatus(const wxString& msg, int section)
|
||||||
{
|
{
|
||||||
SampleHive::SH_StatusBarMessageEvent event(SampleHive::SH_EVT_STATUSBAR_MESSAGE_UPDATED, this->GetId());
|
SampleHive::SH_StatusBarStatusEvent event(SampleHive::SH_EVT_STATUSBAR_STATUS_PUSH, this->GetId());
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
event.SetMessageAndSection({ msg, section });
|
event.SetPushMessageAndSection({ msg, section });
|
||||||
|
|
||||||
HandleWindowEvent(event);
|
HandleWindowEvent(event);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ class WaveformViewer : public wxPanel
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Send custom events
|
// Send custom events
|
||||||
void SendLoopPoints();
|
void SendLoopPoints();
|
||||||
void SendStatusBarStatus(const wxString& msg, int section);
|
void SendPushStatusBarStatus(const wxString& msg, int section);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "SampleHiveConfig.hpp"
|
||||||
|
|
||||||
// Path to all the assets
|
// Path to all the assets
|
||||||
#define ICON_HIVE_16px SAMPLEHIVE_DATADIR "/icons/icon-hive_16x16.png"
|
#define ICON_HIVE_16px SAMPLEHIVE_DATADIR "/icons/icon-hive_16x16.png"
|
||||||
#define ICON_HIVE_24px SAMPLEHIVE_DATADIR "/icons/icon-hive_24x24.png"
|
#define ICON_HIVE_24px SAMPLEHIVE_DATADIR "/icons/icon-hive_24x24.png"
|
||||||
|
|
|
||||||
|
|
@ -61,18 +61,20 @@ namespace SampleHive
|
||||||
|
|
||||||
// wxDEFINE_EVENT(SH_EVT_MEDIA_STATUS_UPDATED, SH_MediaEvent);
|
// wxDEFINE_EVENT(SH_EVT_MEDIA_STATUS_UPDATED, SH_MediaEvent);
|
||||||
|
|
||||||
SH_StatusBarMessageEvent::SH_StatusBarMessageEvent(wxEventType eventType, int winId)
|
SH_StatusBarStatusEvent::SH_StatusBarStatusEvent(wxEventType eventType, int winId)
|
||||||
: wxCommandEvent(eventType, winId)
|
: wxCommandEvent(eventType, winId)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SH_StatusBarMessageEvent::~SH_StatusBarMessageEvent()
|
SH_StatusBarStatusEvent::~SH_StatusBarStatusEvent()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDEFINE_EVENT(SH_EVT_STATUSBAR_MESSAGE_UPDATED, SH_StatusBarMessageEvent);
|
wxDEFINE_EVENT(SH_EVT_STATUSBAR_STATUS_PUSH, SH_StatusBarStatusEvent);
|
||||||
|
wxDEFINE_EVENT(SH_EVT_STATUSBAR_STATUS_POP, SH_StatusBarStatusEvent);
|
||||||
|
wxDEFINE_EVENT(SH_EVT_STATUSBAR_STATUS_SET, SH_StatusBarStatusEvent);
|
||||||
|
|
||||||
SH_InfoBarMessageEvent::SH_InfoBarMessageEvent(wxEventType eventType, int winId)
|
SH_InfoBarMessageEvent::SH_InfoBarMessageEvent(wxEventType eventType, int winId)
|
||||||
: wxCommandEvent(eventType, winId)
|
: wxCommandEvent(eventType, winId)
|
||||||
|
|
@ -85,18 +87,18 @@ namespace SampleHive
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDEFINE_EVENT(SH_EVT_INFOBAR_MESSAGE_UPDATED, SH_InfoBarMessageEvent);
|
wxDEFINE_EVENT(SH_EVT_INFOBAR_MESSAGE_SHOW, SH_InfoBarMessageEvent);
|
||||||
|
|
||||||
// SH_TimerEvent::SH_TimerEvent(wxEventType eventType, int winId)
|
SH_TimerEvent::SH_TimerEvent(wxEventType eventType, int winId)
|
||||||
// : wxCommandEvent(eventType, winId)
|
: wxCommandEvent(eventType, winId)
|
||||||
// {
|
{
|
||||||
|
|
||||||
// }
|
}
|
||||||
|
|
||||||
// SH_TimerEvent::~SH_TimerEvent()
|
SH_TimerEvent::~SH_TimerEvent()
|
||||||
// {
|
{
|
||||||
|
|
||||||
// }
|
}
|
||||||
|
|
||||||
// wxDEFINE_EVENT(SH_EVT_TIMER_STATUS_UPDATED, SH_TimerEvent);
|
wxDEFINE_EVENT(SH_EVT_TIMER_STOP, SH_TimerEvent);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,26 +84,35 @@ namespace SampleHive
|
||||||
|
|
||||||
// wxDECLARE_EVENT(SH_EVT_MEDIA_STATUS_UPDATED, SH_MediaEvent);
|
// wxDECLARE_EVENT(SH_EVT_MEDIA_STATUS_UPDATED, SH_MediaEvent);
|
||||||
|
|
||||||
class SH_StatusBarMessageEvent : public wxCommandEvent
|
class SH_StatusBarStatusEvent : public wxCommandEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SH_StatusBarMessageEvent(wxEventType eventType, int winId);
|
SH_StatusBarStatusEvent(wxEventType eventType, int winId);
|
||||||
~SH_StatusBarMessageEvent();
|
~SH_StatusBarStatusEvent();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual wxEvent* Clone() const { return new SH_StatusBarMessageEvent(*this); }
|
virtual wxEvent* Clone() const { return new SH_StatusBarStatusEvent(*this); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::pair<wxString, int> GetMessageAndSection() const { return { m_Msg, m_Section }; }
|
std::pair<wxString, int> GetPushMessageAndSection() const { return { m_Msg, m_PushSection }; }
|
||||||
void SetMessageAndSection(std::pair<const wxString&, int> status)
|
void SetPushMessageAndSection(std::pair<const wxString&, int> status)
|
||||||
{ m_Msg = status.first; m_Section = status.second; }
|
{ m_Msg = status.first; m_PushSection = status.second; }
|
||||||
|
|
||||||
|
std::pair<wxString, int> GetStatusTextAndSection() const { return { m_Text, m_SetSection }; }
|
||||||
|
void SetStatusTextAndSection(std::pair<const wxString&, int> status)
|
||||||
|
{ m_Text = status.first, m_SetSection = status.second; }
|
||||||
|
|
||||||
|
int GetPopMessageSection() const { return m_PopSection; }
|
||||||
|
void SetPopMessageSection(int section) { m_PopSection = section; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxString m_Msg;
|
wxString m_Msg, m_Text;
|
||||||
int m_Section;
|
int m_PushSection, m_PopSection, m_SetSection;
|
||||||
};
|
};
|
||||||
|
|
||||||
wxDECLARE_EVENT(SH_EVT_STATUSBAR_MESSAGE_UPDATED, SH_StatusBarMessageEvent);
|
wxDECLARE_EVENT(SH_EVT_STATUSBAR_STATUS_PUSH, SH_StatusBarStatusEvent);
|
||||||
|
wxDECLARE_EVENT(SH_EVT_STATUSBAR_STATUS_POP, SH_StatusBarStatusEvent);
|
||||||
|
wxDECLARE_EVENT(SH_EVT_STATUSBAR_STATUS_SET, SH_StatusBarStatusEvent);
|
||||||
|
|
||||||
class SH_InfoBarMessageEvent : public wxCommandEvent
|
class SH_InfoBarMessageEvent : public wxCommandEvent
|
||||||
{
|
{
|
||||||
|
|
@ -124,25 +133,17 @@ namespace SampleHive
|
||||||
int m_Mode;
|
int m_Mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
wxDECLARE_EVENT(SH_EVT_INFOBAR_MESSAGE_UPDATED, SH_InfoBarMessageEvent);
|
wxDECLARE_EVENT(SH_EVT_INFOBAR_MESSAGE_SHOW, SH_InfoBarMessageEvent);
|
||||||
|
|
||||||
// class SH_TimerEvent : public wxCommandEvent
|
class SH_TimerEvent : public wxCommandEvent
|
||||||
// {
|
{
|
||||||
// public:
|
public:
|
||||||
// SH_TimerEvent(wxEventType eventType, int winId);
|
SH_TimerEvent(wxEventType eventType, int winId);
|
||||||
// ~SH_TimerEvent();
|
~SH_TimerEvent();
|
||||||
|
|
||||||
// public:
|
public:
|
||||||
// virtual wxEvent* Clone() const { return new SH_TimerEvent(*this); }
|
virtual wxEvent* Clone() const { return new SH_TimerEvent(*this); }
|
||||||
|
};
|
||||||
|
|
||||||
// public:
|
wxDECLARE_EVENT(SH_EVT_TIMER_STOP, SH_TimerEvent);
|
||||||
// std::pair<int, bool> GetSecondsAndMode() const { return { m_Seconds, m_Mode }; }
|
|
||||||
// void SetSecondsAndMode(std::pair<int, bool> timerStatus) { m_Seconds = timerStatus.first; m_Mode = timerStatus.second; }
|
|
||||||
|
|
||||||
// private:
|
|
||||||
// int m_Seconds;
|
|
||||||
// bool m_Mode;
|
|
||||||
// };
|
|
||||||
|
|
||||||
// wxDECLARE_EVENT(SH_EVT_TIMER_STATUS_UPDATED, SH_TimerEvent);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ class Sample
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Sample();
|
Sample();
|
||||||
|
|
||||||
Sample(int favorite, const std::string& filename, const std::string& fileExtension,
|
Sample(int favorite, const std::string& filename, const std::string& fileExtension,
|
||||||
const std::string& samplePack, const std::string& type, int channels, int length,
|
const std::string& samplePack, const std::string& type, int channels, int length,
|
||||||
int sampleRate, int bitrate, const std::string& path, int trashed);
|
int sampleRate, int bitrate, const std::string& path, int trashed);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue