summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorRachel Bryk <RachelBryk@gmail.com>2013-07-21 22:25:26 -0400
committerRachel Bryk <RachelBryk@gmail.com>2013-07-21 22:25:26 -0400
commite742b32c6540bfd83bbd5eefa318839a7d57d313 (patch)
tree0d3e6246a8df9f5a3fac09117b72807fa16aee1b /Source
parent4981b7cdd3e37f1f5846e4f94e2ed1a9538d18e5 (diff)
Drag and drop.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/DolphinWX/Src/GameListCtrl.cpp35
-rw-r--r--Source/Core/DolphinWX/Src/GameListCtrl.h1
2 files changed, 36 insertions, 0 deletions
diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.cpp b/Source/Core/DolphinWX/Src/GameListCtrl.cpp
index a3c6fbe59a..c8e2e94072 100644
--- a/Source/Core/DolphinWX/Src/GameListCtrl.cpp
+++ b/Source/Core/DolphinWX/Src/GameListCtrl.cpp
@@ -23,6 +23,7 @@
#include "WxUtils.h"
#include "Main.h"
#include "MathUtil.h"
+#include "HW/DVDInterface.h"
#include "../resources/Flag_Europe.xpm"
#include "../resources/Flag_Germany.xpm"
@@ -174,6 +175,8 @@ CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const
wxPoint& pos, const wxSize& size, long style)
: wxListCtrl(parent, id, pos, size, style), toolTip(0)
{
+ DragAcceptFiles(true);
+ Connect(wxEVT_DROP_FILES, wxDropFilesEventHandler(CGameListCtrl::OnDropFiles), NULL, this);
}
CGameListCtrl::~CGameListCtrl()
@@ -1298,4 +1301,36 @@ void CGameListCtrl::UnselectAll()
}
}
+void CGameListCtrl::OnDropFiles(wxDropFilesEvent& event)
+{
+ if (event.GetNumberOfFiles() != 1)
+ return;
+ if (File::IsDirectory(WxStrToStr(event.GetFiles()[0])))
+ return;
+ wxFileName file = event.GetFiles()[0];
+
+ if (file.GetExt() == "dtm")
+ {
+ if (Core::IsRunning())
+ return;
+
+ if (!Movie::IsReadOnly())
+ {
+ // let's make the read-only flag consistent at the start of a movie.
+ Movie::SetReadOnly(true);
+ main_frame->GetMenuBar()->FindItem(IDM_RECORDREADONLY)->Check(true);
+ }
+
+ if (Movie::PlayInput(file.GetFullPath().c_str()))
+ main_frame->BootGame(std::string(""));
+ }
+ else if (!Core::IsRunning())
+ {
+ main_frame->BootGame(WxStrToStr(file.GetFullPath()));
+ }
+ else
+ {
+ DVDInterface::ChangeDisc(WxStrToStr(file.GetFullPath()).c_str());
+ }
+}
diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.h b/Source/Core/DolphinWX/Src/GameListCtrl.h
index fbca71bed3..ad46ec6d67 100644
--- a/Source/Core/DolphinWX/Src/GameListCtrl.h
+++ b/Source/Core/DolphinWX/Src/GameListCtrl.h
@@ -97,6 +97,7 @@ private:
void OnMultiCompressGCM(wxCommandEvent& event);
void OnMultiDecompressGCM(wxCommandEvent& event);
void OnInstallWAD(wxCommandEvent& event);
+ void OnDropFiles(wxDropFilesEvent& event);
void CompressSelection(bool _compress);
void AutomaticColumnWidth();