diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/SciLexer.vcxproj | 1 | ||||
-rw-r--r-- | win32/ScintillaDLL.cxx | 35 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 34 | ||||
-rw-r--r-- | win32/ScintillaWin.h | 15 | ||||
-rw-r--r-- | win32/deps.mak | 1 | ||||
-rw-r--r-- | win32/makefile | 21 | ||||
-rw-r--r-- | win32/scintilla.mak | 49 |
7 files changed, 74 insertions, 82 deletions
diff --git a/win32/SciLexer.vcxproj b/win32/SciLexer.vcxproj index 184ef86e8..91c85139b 100644 --- a/win32/SciLexer.vcxproj +++ b/win32/SciLexer.vcxproj @@ -118,6 +118,7 @@ <ClCompile Include="..\win32\HanjaDic.cxx" />
<ClCompile Include="..\win32\PlatWin.cxx" />
<ClCompile Include="..\win32\ScintillaWin.cxx" />
+ <ClCompile Include="..\win32\ScintillaDLL.cxx" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\*.h" />
diff --git a/win32/ScintillaDLL.cxx b/win32/ScintillaDLL.cxx new file mode 100644 index 000000000..1ecf1c16e --- /dev/null +++ b/win32/ScintillaDLL.cxx @@ -0,0 +1,35 @@ +// Scintilla source code edit control +/** @file ScintillaDLL.cxx + ** DLL entry point for Scintilla. + **/ +// Copyright 1998-2018 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0500 +#undef WINVER +#define WINVER 0x0500 +#include <windows.h> + +#include "Scintilla.h" +#include "ScintillaWin.h" + +extern "C" +__declspec(dllexport) +sptr_t __stdcall Scintilla_DirectFunction( + ScintillaWin *sci, UINT iMessage, uptr_t wParam, sptr_t lParam) { + return Scintilla::DirectFunction(sci, iMessage, wParam, lParam); +} + +extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpvReserved) { + //Platform::DebugPrintf("Scintilla::DllMain %d %d\n", hInstance, dwReason); + if (dwReason == DLL_PROCESS_ATTACH) { + if (!Scintilla_RegisterClasses(hInstance)) + return FALSE; + } else if (dwReason == DLL_PROCESS_DETACH) { + if (lpvReserved == NULL) { + Scintilla::ResourcesRelease(true); + } + } + return TRUE; +} diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 73d8f370c..81ebdfaa8 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -90,6 +90,7 @@ #include "PlatWin.h" #include "HanjaDic.h" +#include "ScintillaWin.h" #ifndef SPI_GETWHEELSCROLLLINES #define SPI_GETWHEELSCROLLLINES 104 @@ -3383,15 +3384,15 @@ sptr_t ScintillaWin::DirectFunction( return reinterpret_cast<ScintillaWin *>(ptr)->WndProc(iMessage, wParam, lParam); } -extern "C" -#ifndef STATIC_BUILD -__declspec(dllexport) -#endif -sptr_t __stdcall Scintilla_DirectFunction( +namespace Scintilla { + +sptr_t DirectFunction( ScintillaWin *sci, UINT iMessage, uptr_t wParam, sptr_t lParam) { return sci->WndProc(iMessage, wParam, lParam); } +} + LRESULT PASCAL ScintillaWin::SWndProc( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) { //Platform::DebugPrintf("S W:%x M:%x WP:%x L:%x\n", hWnd, iMessage, wParam, lParam); @@ -3436,28 +3437,17 @@ int Scintilla_RegisterClasses(void *hInstance) { return result; } -static int ResourcesRelease(bool fromDllMain) { +namespace Scintilla { + +int ResourcesRelease(bool fromDllMain) { const bool result = ScintillaWin::Unregister(); Platform_Finalise(fromDllMain); return result; } +} + // This function is externally visible so it can be called from container when building statically. int Scintilla_ReleaseResources() { - return ResourcesRelease(false); -} - -#ifndef STATIC_BUILD -extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpvReserved) { - //Platform::DebugPrintf("Scintilla::DllMain %d %d\n", hInstance, dwReason); - if (dwReason == DLL_PROCESS_ATTACH) { - if (!Scintilla_RegisterClasses(hInstance)) - return FALSE; - } else if (dwReason == DLL_PROCESS_DETACH) { - if (lpvReserved == NULL) { - ResourcesRelease(true); - } - } - return TRUE; + return Scintilla::ResourcesRelease(false); } -#endif diff --git a/win32/ScintillaWin.h b/win32/ScintillaWin.h new file mode 100644 index 000000000..6d4d2ce26 --- /dev/null +++ b/win32/ScintillaWin.h @@ -0,0 +1,15 @@ +// Scintilla source code edit control +/** @file ScintillaWin.h + ** Define functions from ScintillaWin.cxx that can be called from ScintillaDLL.cxx. + **/ +// Copyright 1998-2018 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +class ScintillaWin; + +namespace Scintilla { + +int ResourcesRelease(bool fromDllMain); +sptr_t DirectFunction(ScintillaWin *sci, UINT iMessage, uptr_t wParam, sptr_t lParam); + +} diff --git a/win32/deps.mak b/win32/deps.mak index c0839f33a..f4db4cd0f 100644 --- a/win32/deps.mak +++ b/win32/deps.mak @@ -2,6 +2,7 @@ CheckD2D.o: CheckD2D.cxx HanjaDic.o: HanjaDic.cxx ../src/UniConversion.h HanjaDic.h PlatWin.o: PlatWin.cxx ../include/Platform.h ../lexlib/StringCopy.h \ ../src/XPM.h ../src/UniConversion.h ../src/DBCS.h ../src/FontQuality.h +ScintillaDLL.o: ScintillaDLL.cxx ScintillaWin.o: ScintillaWin.cxx ../include/Platform.h \ ../include/ILoader.h ../include/Sci_Position.h ../include/ILexer.h \ ../include/Scintilla.h ../lexlib/StringCopy.h ../src/Position.h \ diff --git a/win32/makefile b/win32/makefile index 183c732b5..88014a093 100644 --- a/win32/makefile +++ b/win32/makefile @@ -117,7 +117,7 @@ BASEOBJS = \ XPM.o \ HanjaDic.o -SOBJS = ScintillaWin.o ScintillaBase.o $(BASEOBJS) +SOBJS = ScintillaDLL.o ScintillaWin.o ScintillaBase.o $(BASEOBJS) # Required by lexers LEXLIBOBJS=\ @@ -141,10 +141,10 @@ SCILEXOBJS=\ $(COMPONENT): $(SOBJS) Scintilla.def $(CXX) $(LDFLAGS) -o $@ $(STRIPFLAG) $(SOBJS) $(CXXFLAGS) $(LIBS) -$(LEXCOMPONENT): ScintillaWinL.o $(SCILEXOBJS) Scintilla.def - $(CXX) $(LDFLAGS) -o $@ $(STRIPFLAG) ScintillaWinL.o $(SCILEXOBJS) $(CXXFLAGS) $(LIBS) +$(LEXCOMPONENT): ScintillaDLL.o ScintillaWinL.o $(SCILEXOBJS) Scintilla.def + $(CXX) $(LDFLAGS) -o $@ $(STRIPFLAG) ScintillaDLL.o ScintillaWinL.o $(SCILEXOBJS) $(CXXFLAGS) $(LIBS) -$(LIBSCI): ScintillaWinS.o $(SCILEXOBJS) +$(LIBSCI): ScintillaWin.o $(SCILEXOBJS) $(AR) rc $@ $^ $(RANLIB) $@ @@ -176,22 +176,9 @@ ScintillaWinL.o: ScintillaWin.cxx Platform.h \ LexerModule.h Catalogue.h CaseConvert.h \ CaseFolder.h -ScintillaWinS.o: ScintillaWin.cxx Platform.h \ - ILexer.h Scintilla.h SplitVector.h \ - Partitioning.h RunStyles.h ContractionState.h \ - CellBuffer.h CallTip.h KeyMap.h Indicator.h \ - XPM.h LineMarker.h Style.h AutoComplete.h \ - ViewStyle.h CharClassify.h Decoration.h \ - Document.h Selection.h PositionCache.h \ - EditModel.h Editor.h EditView.h ScintillaBase.h UniConversion.h \ - CaseConvert.h CaseFolder.h - ScintillaBaseL.o: $(CXX) $(CXXFLAGS) -D SCI_LEXER -c $< -o $@ -ScintillaWinS.o: - $(CXX) $(CXXFLAGS) -D STATIC_BUILD -c $< -o $@ - ScintillaWinL.o: $(CXX) $(CXXFLAGS) -D SCI_LEXER -c $< -o $@ diff --git a/win32/scintilla.mak b/win32/scintilla.mak index 91b727d4c..15de55698 100644 --- a/win32/scintilla.mak +++ b/win32/scintilla.mak @@ -106,7 +106,8 @@ BASEOBJS=\ SOBJS=\ $(BASEOBJS) \ $(DIR_O)\ScintillaBase.obj \ - $(DIR_O)\ScintillaWin.obj + $(DIR_O)\ScintillaWin.obj \ + $(DIR_O)\ScintillaDLL.obj #++Autogenerated -- run scripts/LexGen.py to regenerate #**LEXOBJS=\\\n\(\t$(DIR_O)\\\*.obj \\\n\) @@ -245,10 +246,10 @@ $(DIR_O)\ScintRes.res : ScintRes.rc $(COMPONENT): $(SOBJS) $(DIR_O)\ScintRes.res $(LD) $(LDFLAGS) -DEF:Scintilla.def -DLL -OUT:$@ $** $(LIBS) -$(LEXCOMPONENT): $(SCILEXOBJS) $(DIR_O)\ScintillaWinL.obj $(DIR_O)\ScintRes.res +$(LEXCOMPONENT): $(SCILEXOBJS) $(DIR_O)\ScintillaDLL.obj $(DIR_O)\ScintillaWinL.obj $(DIR_O)\ScintRes.res $(LD) $(LDFLAGS) -DEF:Scintilla.def -DLL -OUT:$@ $** $(LIBS) -$(LIBSCI): $(SCILEXOBJS) $(DIR_O)\ScintillaWinS.obj +$(LIBSCI): $(SCILEXOBJS) $(DIR_O)\ScintillaWin.obj LIB /OUT:$@ $** # Define how to build all the objects and what they depend on @@ -269,9 +270,6 @@ $(DIR_O)\ScintillaBaseL.obj: ..\src\ScintillaBase.cxx $(DIR_O)\ScintillaWinL.obj: ScintillaWin.cxx $(CXX) $(CXXFLAGS) -DSCI_LEXER -c $(NAME)$@ ScintillaWin.cxx -$(DIR_O)\ScintillaWinS.obj: ScintillaWin.cxx - $(CXX) $(CXXFLAGS) -DSTATIC_BUILD -c $(NAME)$@ ScintillaWin.cxx - # Dependencies # All lexers depend on this set of headers @@ -965,6 +963,8 @@ $(DIR_O)\ScintillaBaseL.obj: \ ../src/Editor.h \ ../src/AutoComplete.h \ ../src/ScintillaBase.h +$(DIR_O)\ScintillaDLL.obj: \ + ScintillaDLL.cxx $(DIR_O)\ScintillaWin.obj: \ ScintillaWin.cxx \ ../include/Platform.h \ @@ -1039,43 +1039,6 @@ $(DIR_O)\ScintillaWinL.obj: \ ../src/ScintillaBase.h \ PlatWin.h \ HanjaDic.h -$(DIR_O)\ScintillaWinS.obj: \ - ScintillaWin.cxx \ - ../include/Platform.h \ - ../include/ILoader.h \ - ../include/Sci_Position.h \ - ../include/ILexer.h \ - ../include/Scintilla.h \ - ../lexlib/StringCopy.h \ - ../src/Position.h \ - ../src/UniqueString.h \ - ../src/SplitVector.h \ - ../src/Partitioning.h \ - ../src/RunStyles.h \ - ../src/ContractionState.h \ - ../src/CellBuffer.h \ - ../src/CallTip.h \ - ../src/KeyMap.h \ - ../src/Indicator.h \ - ../src/LineMarker.h \ - ../src/Style.h \ - ../src/ViewStyle.h \ - ../src/CharClassify.h \ - ../src/Decoration.h \ - ../src/CaseFolder.h \ - ../src/Document.h \ - ../src/CaseConvert.h \ - ../src/UniConversion.h \ - ../src/Selection.h \ - ../src/PositionCache.h \ - ../src/EditModel.h \ - ../src/MarginView.h \ - ../src/EditView.h \ - ../src/Editor.h \ - ../src/AutoComplete.h \ - ../src/ScintillaBase.h \ - PlatWin.h \ - HanjaDic.h $(DIR_O)\Selection.obj: \ ../src/Selection.cxx \ ../include/Platform.h \ |