Move AegisubFileDropTarget to frame_main.cpp. It's under ten lines of code so there's really no point in having two separate files for it.

Originally committed to SVN as r5936.
This commit is contained in:
Thomas Goyne 2011-11-29 23:18:24 +00:00
parent bad20c2898
commit b993c02dee
7 changed files with 11 additions and 155 deletions

View file

@ -721,14 +721,6 @@
RelativePath="..\..\src\colorspace.h"
>
</File>
<File
RelativePath="..\..\src\drop.cpp"
>
</File>
<File
RelativePath="..\..\src\drop.h"
>
</File>
<File
RelativePath="..\..\src\factory_manager.h"
>

View file

@ -130,7 +130,6 @@
<ClInclude Include="$(SrcDir)dialog_translation.h" />
<ClInclude Include="$(SrcDir)dialog_version_check.h" />
<ClInclude Include="$(SrcDir)dialog_video_details.h" />
<ClInclude Include="$(SrcDir)drop.h" />
<ClInclude Include="$(SrcDir)export_clean_info.h" />
<ClInclude Include="$(SrcDir)export_fixstyle.h" />
<ClInclude Include="$(SrcDir)export_framerate.h" />
@ -319,7 +318,6 @@
<ClCompile Include="$(SrcDir)dialog_translation.cpp" />
<ClCompile Include="$(SrcDir)dialog_version_check.cpp" />
<ClCompile Include="$(SrcDir)dialog_video_details.cpp" />
<ClCompile Include="$(SrcDir)drop.cpp" />
<ClCompile Include="$(SrcDir)export_clean_info.cpp" />
<ClCompile Include="$(SrcDir)export_fixstyle.cpp" />
<ClCompile Include="$(SrcDir)export_framerate.cpp" />

View file

@ -546,9 +546,6 @@
<ClInclude Include="$(SrcDir)colour_button.h">
<Filter>Features\Colour picker</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)drop.h">
<Filter>Main UI</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)aegisublocale.h">
<Filter>Utilities</Filter>
</ClInclude>
@ -1064,9 +1061,6 @@
<ClCompile Include="$(SrcDir)colour_button.cpp">
<Filter>Features\Colour picker</Filter>
</ClCompile>
<ClCompile Include="$(SrcDir)drop.cpp">
<Filter>Main UI</Filter>
</ClCompile>
<ClCompile Include="$(SrcDir)aegisublocale.cpp">
<Filter>Utilities</Filter>
</ClCompile>

View file

@ -178,7 +178,6 @@ SRC += \
dialog_translation.cpp \
dialog_version_check.cpp \
dialog_video_details.cpp \
drop.cpp \
audio_provider_dummy.cpp \
export_clean_info.cpp \
export_fixstyle.cpp \

View file

@ -1,70 +0,0 @@
// Copyright (c) 2005, Rodrigo Braz Monteiro
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Aegisub Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Aegisub Project http://www.aegisub.org/
//
// $Id$
/// @file drop.cpp
/// @brief Drag-drop handling from other applications
/// @ingroup main_ui
///
///////////
// Headers
#include "config.h"
#ifndef AGI_PRE
#include <wx/filename.h>
#endif
#include "drop.h"
#include "frame_main.h"
/// @brief Constructor
/// @param par Parent frame
///
AegisubFileDropTarget::AegisubFileDropTarget(FrameMain *par) {
parent = par;
}
/// @brief Handle dropped files.
/// @param x X drop co-ordinate.
/// @param y Y drop co-ordinate
/// @param filenames List of files dropped.
/// @return Whether handling dropped files was sucessful
///
bool AegisubFileDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) {
return parent->LoadList(filenames);
}

View file

@ -1,67 +0,0 @@
// Copyright (c) 2005, Rodrigo Braz Monteiro
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Aegisub Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Aegisub Project http://www.aegisub.org/
//
// $Id$
/// @file drop.h
/// @see drop.cpp
/// @ingroup main_ui
///
///////////
// Headers
#ifndef AGI_PRE
#include <wx/dnd.h>
#endif
//////////////
// Prototypes
class FrameMain;
/// @class AegisubFileDropTarget
/// @brief Handle files DnD'd onto Aegisub
///
class AegisubFileDropTarget : public wxFileDropTarget {
private:
/// Parent frame
FrameMain *parent;
public:
AegisubFileDropTarget(FrameMain *parent);
bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames);
//wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def);
};

View file

@ -39,6 +39,7 @@
#ifndef AGI_PRE
#include <wx/clipbrd.h>
#include <wx/dnd.h>
#include <wx/filename.h>
#include <wx/image.h>
#include <wx/mimetype.h>
@ -63,7 +64,6 @@
#include "command/command.h"
#include "dialog_search_replace.h"
#include "dialog_version_check.h"
#include "drop.h"
#include "help_button.h"
#include "libresrc/libresrc.h"
#include "main.h"
@ -94,6 +94,16 @@ enum {
static void autosave_timer_changed(wxTimer *timer, const agi::OptionValue &opt);
/// Handle files drag and dropped onto Aegisub
class AegisubFileDropTarget : public wxFileDropTarget {
FrameMain *parent;
public:
AegisubFileDropTarget(FrameMain *parent) : parent(parent) { }
bool OnDropFiles(wxCoord, wxCoord, const wxArrayString& filenames) {
return parent->LoadList(filenames);
}
};
FrameMain::FrameMain (wxArrayString args)
: wxFrame(0,-1,"",wxDefaultPosition,wxSize(920,700),wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN)
, context(new agi::Context)