Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Drag and drop.
  • Loading branch information
RachelBryk committed Jul 22, 2013
1 parent 4981b7c commit e742b32
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Source/Core/DolphinWX/Src/GameListCtrl.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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());
}
}
1 change: 1 addition & 0 deletions Source/Core/DolphinWX/Src/GameListCtrl.h
Expand Up @@ -97,6 +97,7 @@ class CGameListCtrl : public wxListCtrl
void OnMultiCompressGCM(wxCommandEvent& event);
void OnMultiDecompressGCM(wxCommandEvent& event);
void OnInstallWAD(wxCommandEvent& event);
void OnDropFiles(wxDropFilesEvent& event);

void CompressSelection(bool _compress);
void AutomaticColumnWidth();
Expand Down

0 comments on commit e742b32

Please sign in to comment.