From ae125753e4d8793f0d6b1b22bc7bc700f93a2097 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 21 Oct 1999 13:57:08 +0000 Subject: [PATCH] updated the makefile to copy dnd.wxr so that the program can find it, don't forget to open the clipboard git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4106 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/dnd/Makefile.in | 2 +- samples/dnd/dnd.cpp | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/samples/dnd/Makefile.in b/samples/dnd/Makefile.in index 1afad34b83..8b77588d69 100644 --- a/samples/dnd/Makefile.in +++ b/samples/dnd/Makefile.in @@ -13,7 +13,7 @@ top_srcdir = @top_srcdir@ top_builddir = ../.. program_dir = samples/dnd -DATAFILES=julian.png +DATAFILES=julian.png dnd.wxr PROGRAM=dnd diff --git a/samples/dnd/dnd.cpp b/samples/dnd/dnd.cpp index 7253d69fac..f0fe76f904 100644 --- a/samples/dnd/dnd.cpp +++ b/samples/dnd/dnd.cpp @@ -619,6 +619,25 @@ END_EVENT_TABLE() // `Main program' equivalent, creating windows and returning main app frame bool DnDApp::OnInit() { + // load our ressources + wxPathList pathList; + pathList.Add("."); +#ifdef __WXMSW__ + pathList.Add("./Debug"); + pathList.Add("./Release"); +#endif // wxMSW + + wxString path = pathList.FindValidPath("dnd.wxr"); + if ( !path ) + { + wxLogError("Can't find the resource file dnd.wxr in the current " + "directory, aborting."); + + return FALSE; + } + + wxDefaultResourceTable->ParseResourceFile(path); + #if wxUSE_LIBPNG wxImage::AddHandler( new wxPNGHandler ); #endif @@ -633,8 +652,6 @@ bool DnDApp::OnInit() SetTopWindow(frame); - wxDefaultResourceTable->ParseResourceFile("dnd.wxr"); - return TRUE; } @@ -1299,11 +1316,29 @@ void DnDShapeFrame::OnClearShape(wxCommandEvent& event) void DnDShapeFrame::OnCopyShape(wxCommandEvent& event) { if ( m_shape ) + { + wxClipboardLocker clipLocker; + if ( !clipLocker ) + { + wxLogError("Can't open the clipboard"); + + return; + } + wxTheClipboard->AddData(new DnDShapeDataObject(m_shape)); + } } void DnDShapeFrame::OnPasteShape(wxCommandEvent& event) { + wxClipboardLocker clipLocker; + if ( !clipLocker ) + { + wxLogError("Can't open the clipboard"); + + return; + } + DnDShapeDataObject shapeDataObject(NULL); if ( wxTheClipboard->GetData(shapeDataObject) ) { -- 2.47.2