mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+ add: increased build env version
+ refactoring: C++ code cleanup for MiniPath DropSource
This commit is contained in:
parent
62b58dd525
commit
0ce3ad8d80
@ -265,7 +265,7 @@
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\Dialogs.c" />
|
||||
<ClCompile Include="src\Dlapi.c" />
|
||||
<ClCompile Include="src\Dropsource.cpp" />
|
||||
<ClCompile Include="src\DropSource.cpp" />
|
||||
<ClCompile Include="src\Helpers.c" />
|
||||
<ClCompile Include="src\minipath.c" />
|
||||
</ItemGroup>
|
||||
@ -273,7 +273,7 @@
|
||||
<ClInclude Include="language\common_res.h" />
|
||||
<ClInclude Include="src\Dialogs.h" />
|
||||
<ClInclude Include="src\Dlapi.h" />
|
||||
<ClInclude Include="src\Dropsource.h" />
|
||||
<ClInclude Include="src\DropSource.h" />
|
||||
<ClInclude Include="src\Helpers.h" />
|
||||
<ClInclude Include="src\minipath.h" />
|
||||
<ClInclude Include="src\resource.h" />
|
||||
|
||||
@ -25,15 +25,15 @@
|
||||
<ClCompile Include="src\Dlapi.c">
|
||||
<Filter>C/C++ Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Dropsource.cpp">
|
||||
<Filter>C/C++ Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Helpers.c">
|
||||
<Filter>C/C++ Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\minipath.c">
|
||||
<Filter>C/C++ Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\DropSource.cpp">
|
||||
<Filter>C/C++ Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\Dialogs.h">
|
||||
@ -42,9 +42,6 @@
|
||||
<ClInclude Include="src\Dlapi.h">
|
||||
<Filter>H Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Dropsource.h">
|
||||
<Filter>H Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Helpers.h">
|
||||
<Filter>H Source Files</Filter>
|
||||
</ClInclude>
|
||||
@ -60,6 +57,9 @@
|
||||
<ClInclude Include="language\common_res.h">
|
||||
<Filter>H Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\DropSource.h">
|
||||
<Filter>H Source Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\Hover.cur">
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
* Dropsource.cpp *
|
||||
* OLE drop source functionality *
|
||||
* Based on code from metapath, (c) Florian Balmer 1996-2011 *
|
||||
* and ZuFu Liu *
|
||||
* *
|
||||
* (c) Rizonesoft 2008-2016 *
|
||||
* https://rizonesoft.com *
|
||||
@ -15,88 +16,70 @@
|
||||
#define _WIN32_WINNT 0x601
|
||||
#include <windows.h>
|
||||
//#include <strsafe.h>
|
||||
#include "helpers.h"
|
||||
#include "dropsource.h"
|
||||
|
||||
#include "DropSource.h"
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* IUnknown Implementation
|
||||
*
|
||||
******************************************************************************/
|
||||
STDMETHODIMP CDropSource::QueryInterface(REFIID iid, void FAR* FAR* ppv)
|
||||
{
|
||||
if (iid == IID_IUnknown || iid == IID_IDropSource)
|
||||
{
|
||||
STDMETHODIMP CDropSource::QueryInterface(REFIID iid, PVOID *ppv) noexcept {
|
||||
if (iid == IID_IUnknown || iid == IID_IDropSource) {
|
||||
*ppv = this;
|
||||
++m_refs;
|
||||
AddRef();
|
||||
return NOERROR;
|
||||
}
|
||||
*ppv = NULL;
|
||||
*ppv = nullptr;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP_(ULONG) CDropSource::AddRef()
|
||||
{
|
||||
STDMETHODIMP_(ULONG) CDropSource::AddRef() noexcept {
|
||||
return ++m_refs;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP_(ULONG) CDropSource::Release()
|
||||
{
|
||||
if(--m_refs == 0)
|
||||
{
|
||||
STDMETHODIMP_(ULONG) CDropSource::Release() noexcept {
|
||||
const ULONG refs = --m_refs;
|
||||
if (refs == 0) {
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
return m_refs;
|
||||
return refs;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* CDropSource Constructor
|
||||
*
|
||||
******************************************************************************/
|
||||
CDropSource::CDropSource()
|
||||
{
|
||||
CDropSource::CDropSource() noexcept {
|
||||
m_refs = 1;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* IDropSource Implementation
|
||||
*
|
||||
******************************************************************************/
|
||||
STDMETHODIMP CDropSource::QueryContinueDrag(BOOL fEscapePressed,
|
||||
DWORD grfKeyState)
|
||||
{
|
||||
if (fEscapePressed)
|
||||
STDMETHODIMP CDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) noexcept {
|
||||
if (fEscapePressed) {
|
||||
return DRAGDROP_S_CANCEL;
|
||||
|
||||
else if (!(grfKeyState & MK_LBUTTON) && !(grfKeyState & MK_RBUTTON))
|
||||
}
|
||||
if (!(grfKeyState & MK_LBUTTON) && !(grfKeyState & MK_RBUTTON)) {
|
||||
return DRAGDROP_S_DROP;
|
||||
|
||||
else
|
||||
return NOERROR;
|
||||
}
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CDropSource::GiveFeedback(DWORD dwEffect)
|
||||
{
|
||||
STDMETHODIMP CDropSource::GiveFeedback(DWORD dwEffect) noexcept {
|
||||
UNUSED(dwEffect);
|
||||
return DRAGDROP_S_USEDEFAULTCURSORS;
|
||||
}
|
||||
|
||||
|
||||
extern "C" {
|
||||
LPDROPSOURCE CreateDropSource()
|
||||
{
|
||||
|
||||
LPDROPSOURCE CreateDropSource(void) {
|
||||
return ((LPDROPSOURCE) new CDropSource);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// End of Dropsource.cpp
|
||||
// End of DropSource.cpp
|
||||
@ -6,6 +6,7 @@
|
||||
* Dropsource.h *
|
||||
* OLE drop source functionality *
|
||||
* Based on code from metapath, (c) Florian Balmer 1996-2011 *
|
||||
* and ZuFu Liu *
|
||||
* *
|
||||
* (c) Rizonesoft 2008-2016 *
|
||||
* https://rizonesoft.com *
|
||||
@ -13,25 +14,28 @@
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
class FAR CDropSource : public IDropSource
|
||||
{
|
||||
#ifndef METAPATH_DROPSOURCE_H_
|
||||
#define METAPATH_DROPSOURCE_H_
|
||||
|
||||
class CDropSource : public IDropSource {
|
||||
public:
|
||||
CDropSource();
|
||||
CDropSource() noexcept;
|
||||
virtual ~CDropSource() = default;
|
||||
|
||||
/* IUnknown methods */
|
||||
STDMETHOD(QueryInterface)(REFIID riid,void FAR* FAR* ppvObj);
|
||||
STDMETHOD_(ULONG,AddRef)();
|
||||
STDMETHOD_(ULONG,Release)();
|
||||
/* IUnknown methods */
|
||||
STDMETHODIMP QueryInterface(REFIID riid, PVOID *ppv) noexcept override;
|
||||
STDMETHODIMP_(ULONG)AddRef() noexcept override;
|
||||
STDMETHODIMP_(ULONG)Release() noexcept override;
|
||||
|
||||
/* IDropSource methods */
|
||||
STDMETHOD(QueryContinueDrag)(BOOL fEscapePressed,DWORD grfKeyState);
|
||||
STDMETHOD(GiveFeedback)(DWORD dwEffect);
|
||||
/* IDropSource methods */
|
||||
STDMETHODIMP QueryContinueDrag(BOOL fEsc, DWORD grfKeyState) noexcept override;
|
||||
STDMETHODIMP GiveFeedback(DWORD) noexcept override;
|
||||
|
||||
private:
|
||||
ULONG m_refs;
|
||||
|
||||
ULONG m_refs;
|
||||
};
|
||||
|
||||
#endif // METAPATH_DROPSOURCE_H_
|
||||
|
||||
|
||||
// End of Dropsource.h
|
||||
BIN
src/Version.h
BIN
src/Version.h
Binary file not shown.
Loading…
Reference in New Issue
Block a user