diff options
-rw-r--r-- | doc/ScintillaDoc.html | 6 | ||||
-rw-r--r-- | gtk/PlatGTK.cxx | 10 | ||||
-rw-r--r-- | win32/Margin.cur | bin | 326 -> 0 bytes | |||
-rw-r--r-- | win32/PlatWin.cxx | 61 | ||||
-rw-r--r-- | win32/PlatformRes.h | 8 | ||||
-rw-r--r-- | win32/ScintRes.rc | 4 | ||||
-rw-r--r-- | win32/deps.mak | 2 | ||||
-rw-r--r-- | win32/makefile | 2 | ||||
-rw-r--r-- | win32/scintilla.mak | 2 | ||||
-rw-r--r-- | win32/scintilla_vc6.mak | 2 |
10 files changed, 56 insertions, 41 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 17484539e..f120e29f1 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -6547,11 +6547,7 @@ EM_SETTARGETDEVICE <code>Scintilla_RegisterClasses</code> called. <code>STATIC_BUILD</code> prevents compiling the <code>DllMain</code> function which will conflict with any <code>DllMain</code> defined in your code. <code>Scintilla_RegisterClasses</code> takes the <code>HINSTANCE</code> of your - application and ensures that the "Scintilla" window class is registered. To make sure that the - right pointing arrow cursor used in the margin is displayed by Scintilla add the - <code>scintilla/win32/Margin.cur</code> file to your application's resources with the ID - <code>IDC_MARGIN</code> which is defined in <code>scintilla/win32/platfromRes.h</code> as - 400.</p> + application and ensures that the "Scintilla" window class is registered.</p> <h3>Ensuring lexers are linked into Scintilla</h3> diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 09e49f370..24f44ee21 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -826,7 +826,7 @@ context(0), psurf(0), #else drawable(0), -gc(0), +gc(0), ppixmap(0), #endif x(0), y(0), inited(false), createdGC(false) @@ -888,7 +888,7 @@ void SurfaceImpl::Init(WindowID wid) { context = gdk_cairo_create(drawable_); PLATFORM_ASSERT(context); } else { - // Shouldn't happen with valid window but may when calls made before + // Shouldn't happen with valid window but may when calls made before // window completely allocated and mapped. psurf = cairo_image_surface_create(CAIRO_FORMAT_RGB24, 1, 1); context = cairo_create(psurf); @@ -1249,7 +1249,7 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated ColourAllocated outline, int alphaOutline, int flags) { #ifdef USE_CAIRO if (context && rc.Width() > 0) { - cairo_set_source_rgba(context, + cairo_set_source_rgba(context, GetRValue(fill.AsLong()) / 255.0, GetGValue(fill.AsLong()) / 255.0, GetBValue(fill.AsLong()) / 255.0, @@ -1257,7 +1257,7 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated PathRoundRectangle(context, rc.left + 1.0, rc.top+1.0, rc.right - rc.left - 2.0, rc.bottom - rc.top - 2.0, cornerSize); cairo_fill(context); - cairo_set_source_rgba(context, + cairo_set_source_rgba(context, GetRValue(outline.AsLong()) / 255.0, GetGValue(outline.AsLong()) / 255.0, GetBValue(outline.AsLong()) / 255.0, @@ -1311,7 +1311,7 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) { PenColour(back); #ifdef USE_CAIRO - cairo_arc(context, (rc.left + rc.right) / 2 + 0.5, (rc.top + rc.bottom) / 2 + 0.5, + cairo_arc(context, (rc.left + rc.right) / 2 + 0.5, (rc.top + rc.bottom) / 2 + 0.5, Platform::Minimum(rc.Width(), rc.Height()) / 2, 0, 2*M_PI); cairo_fill_preserve(context); PenColour(fore); diff --git a/win32/Margin.cur b/win32/Margin.cur Binary files differdeleted file mode 100644 index 9e0e79066..000000000 --- a/win32/Margin.cur +++ /dev/null diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 0bae1bef2..ba67fc1af 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -20,7 +20,6 @@ #include <windowsx.h> #include "Platform.h" -#include "PlatformRes.h" #include "UniConversion.h" #include "XPM.h" #include "FontQuality.h" @@ -80,7 +79,7 @@ static HINSTANCE hinstPlatformRes = 0; static bool onNT = false; static HMODULE hDLLImage = 0; static AlphaBlendSig AlphaBlendFn = 0; - +static HCURSOR reverseArrowCursor = NULL; bool IsNT() { return onNT; @@ -1103,6 +1102,47 @@ void Window::SetFont(Font &font) { reinterpret_cast<WPARAM>(font.GetID()), 0); } +static void FlipBitmap(HBITMAP bitmap, int width, int height) { + HDC hdc = ::CreateCompatibleDC(NULL); + if (hdc != NULL) { + HGDIOBJ prevBmp = ::SelectObject(hdc, bitmap); + ::StretchBlt(hdc, width - 1, 0, -width, height, hdc, 0, 0, width, height, SRCCOPY); + ::SelectObject(hdc, prevBmp); + ::DeleteDC(hdc); + } +} + +static HCURSOR GetReverseArrowCursor() { + if (reverseArrowCursor != NULL) + return reverseArrowCursor; + + ::EnterCriticalSection(&crPlatformLock); + HCURSOR cursor = reverseArrowCursor; + if (cursor == NULL) { + cursor = ::LoadCursor(NULL, IDC_ARROW); + ICONINFO info; + if (::GetIconInfo(cursor, &info)) { + BITMAP bmp; + if (::GetObject(info.hbmMask, sizeof(bmp), &bmp)) { + FlipBitmap(info.hbmMask, bmp.bmWidth, bmp.bmHeight); + if (info.hbmColor != NULL) + FlipBitmap(info.hbmColor, bmp.bmWidth, bmp.bmHeight); + info.xHotspot = (DWORD)bmp.bmWidth - 1 - info.xHotspot; + + reverseArrowCursor = ::CreateIconIndirect(&info); + if (reverseArrowCursor != NULL) + cursor = reverseArrowCursor; + } + + ::DeleteObject(info.hbmMask); + if (info.hbmColor != NULL) + ::DeleteObject(info.hbmColor); + } + } + ::LeaveCriticalSection(&crPlatformLock); + return cursor; +} + void Window::SetCursor(Cursor curs) { switch (curs) { case cursorText: @@ -1123,19 +1163,8 @@ void Window::SetCursor(Cursor curs) { case cursorHand: ::SetCursor(::LoadCursor(NULL,IDC_HAND)); break; - case cursorReverseArrow: { - if (!hinstPlatformRes) - hinstPlatformRes = ::GetModuleHandle(TEXT("Scintilla")); - if (!hinstPlatformRes) - hinstPlatformRes = ::GetModuleHandle(TEXT("SciLexer")); - if (!hinstPlatformRes) - hinstPlatformRes = ::GetModuleHandle(NULL); - HCURSOR hcursor = ::LoadCursor(hinstPlatformRes, MAKEINTRESOURCE(IDC_MARGIN)); - if (hcursor) - ::SetCursor(hcursor); - else - ::SetCursor(::LoadCursor(NULL,IDC_ARROW)); - } + case cursorReverseArrow: + ::SetCursor(GetReverseArrowCursor()); break; case cursorArrow: case cursorInvalid: // Should not occur, but just in case. @@ -2306,6 +2335,8 @@ void Platform_Initialise(void *hInstance) { } void Platform_Finalise() { + if (reverseArrowCursor != NULL) + ::DestroyCursor(reverseArrowCursor); ListBoxX_Unregister(); ::DeleteCriticalSection(&crPlatformLock); } diff --git a/win32/PlatformRes.h b/win32/PlatformRes.h deleted file mode 100644 index bbffcbac7..000000000 --- a/win32/PlatformRes.h +++ /dev/null @@ -1,8 +0,0 @@ -// Scintilla source code edit control -/** @file PlatformRes.h - ** Defines IDs of resources used by Scintilla on Windows platform. - **/ -// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#define IDC_MARGIN 400 diff --git a/win32/ScintRes.rc b/win32/ScintRes.rc index 802917f29..f228c1990 100644 --- a/win32/ScintRes.rc +++ b/win32/ScintRes.rc @@ -4,8 +4,6 @@ #include <windows.h> -#include "PlatformRes.h" - VS_VERSION_INFO VERSIONINFO FILEVERSION 2, 2, 3, 0 PRODUCTVERSION 2, 2, 3, 0 @@ -34,5 +32,3 @@ BEGIN END END END - -IDC_MARGIN CURSOR DISCARDABLE "Margin.cur" diff --git a/win32/deps.mak b/win32/deps.mak index c20cae8ce..990fa9f74 100644 --- a/win32/deps.mak +++ b/win32/deps.mak @@ -1,4 +1,4 @@ -PlatWin.o: PlatWin.cxx ../include/Platform.h PlatformRes.h \ +PlatWin.o: PlatWin.cxx ../include/Platform.h \ ../src/UniConversion.h ../src/XPM.h ../src/FontQuality.h ScintillaWin.o: ScintillaWin.cxx ../include/Platform.h \ ../include/ILexer.h ../include/Scintilla.h ../src/SplitVector.h \ diff --git a/win32/makefile b/win32/makefile index 20c30eedf..7a7c43dc0 100644 --- a/win32/makefile +++ b/win32/makefile @@ -138,6 +138,6 @@ ScintillaWinS.o: ScintillaWinL.o: $(CC) $(CXXFLAGS) -D SCI_LEXER -c $< -o $@ -ScintRes.o: ScintRes.rc PlatformRes.h +ScintRes.o: ScintRes.rc windres ScintRes.rc $@ diff --git a/win32/scintilla.mak b/win32/scintilla.mak index 07b6bac26..468c05be5 100644 --- a/win32/scintilla.mak +++ b/win32/scintilla.mak @@ -450,7 +450,7 @@ $(DIR_O)\LineMarker.obj: ../src/LineMarker.cxx ../include/Platform.h \ $(DIR_O)\PerLine.obj: ../src/PerLine.cxx ../include/Platform.h \ ../include/Scintilla.h ../src/SVector.h ../src/SplitVector.h \ ../src/Partitioning.h ../src/RunStyles.h ../src/PerLine.h -$(DIR_O)\PlatWin.obj: PlatWin.cxx ../include/Platform.h PlatformRes.h \ +$(DIR_O)\PlatWin.obj: PlatWin.cxx ../include/Platform.h \ ../src/UniConversion.h ../src/XPM.h $(DIR_O)\PositionCache.obj: ../src/Editor.cxx ../include/Platform.h ../include/Scintilla.h \ ../src/ContractionState.h ../src/SVector.h ../src/SplitVector.h \ diff --git a/win32/scintilla_vc6.mak b/win32/scintilla_vc6.mak index fe33f3c50..3ec22a25d 100644 --- a/win32/scintilla_vc6.mak +++ b/win32/scintilla_vc6.mak @@ -494,7 +494,7 @@ $(DIR_O)\LineMarker.obj: ../src/LineMarker.cxx ../include/Platform.h \ $(DIR_O)\PerLine.obj: ../src/PerLine.cxx ../include/Platform.h \ ../include/Scintilla.h ../src/SVector.h ../src/SplitVector.h \ ../src/Partitioning.h ../src/RunStyles.h ../src/PerLine.h -$(DIR_O)\PlatWin.obj: PlatWin.cxx ../include/Platform.h PlatformRes.h \ +$(DIR_O)\PlatWin.obj: PlatWin.cxx ../include/Platform.h \ ../src/UniConversion.h ../src/XPM.h $(DIR_O)\PositionCache.obj: ../src/Editor.cxx ../include/Platform.h ../include/Scintilla.h \ ../src/ContractionState.h ../src/SVector.h ../src/SplitVector.h \ |