From e5dbdd6203d9a861a1d12ed611f3d269c69580ee Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Sat, 8 Mar 2008 15:41:03 +0100 Subject: [PATCH] Higher constrast mouse cursor in insert mode An Ibeam cursor with a white outline was added to make it easier to spot when 'bg=dark'. --- src/MacVim/MMWindowController.m | 22 +++++++++++++++++++++- src/MacVim/MacVim.xcodeproj/project.pbxproj | 4 ++++ src/MacVim/ibeam.png | Bin 0 -> 193 bytes 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/MacVim/ibeam.png diff --git a/src/MacVim/MMWindowController.m b/src/MacVim/MMWindowController.m index 06284499..7ff93748 100644 --- a/src/MacVim/MMWindowController.m +++ b/src/MacVim/MMWindowController.m @@ -487,11 +487,31 @@ - (void)setMouseShape:(int)shape { + static NSCursor *customIbeamCursor = nil; + + if (!customIbeamCursor) { + // Use a custom Ibeam cursor that has better contrast against dark + // backgrounds. + // TODO: Is the hotspot ok? + NSImage *ibeamImage = [NSImage imageNamed:@"ibeam"]; + if (ibeamImage) { + NSSize size = [ibeamImage size]; + NSPoint hotSpot = { size.width*.5f, size.height*.5f }; + + customIbeamCursor = [[NSCursor alloc] + initWithImage:ibeamImage hotSpot:hotSpot]; + } + if (!customIbeamCursor) { + NSLog(@"WARNING: Failed to load custom Ibeam cursor"); + customIbeamCursor = [NSCursor IBeamCursor]; + } + } + // This switch should match mshape_names[] in misc2.c. // // TODO: Add missing cursor shapes. switch (shape) { - case 2: [[NSCursor IBeamCursor] set]; break; + case 2: [customIbeamCursor set]; break; case 3: case 4: [[NSCursor resizeUpDownCursor] set]; break; case 5: case 6: [[NSCursor resizeLeftRightCursor] set]; break; case 9: [[NSCursor crosshairCursor] set]; break; diff --git a/src/MacVim/MacVim.xcodeproj/project.pbxproj b/src/MacVim/MacVim.xcodeproj/project.pbxproj index 64a72304..dd9c1d4c 100644 --- a/src/MacVim/MacVim.xcodeproj/project.pbxproj +++ b/src/MacVim/MacVim.xcodeproj/project.pbxproj @@ -47,6 +47,7 @@ 1D9918490D299F9900A96335 /* MMAtsuiTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D9918470D299F9900A96335 /* MMAtsuiTextView.m */; }; 1DD04DEC0C529C5E006CDC2B /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 1DD04DEB0C529C5E006CDC2B /* Credits.rtf */; }; 1DD0C20C0C60FFB4008CD84A /* gvimrc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1DD0C20A0C60FF9A008CD84A /* gvimrc */; }; + 1DD3D51E0D82D4C9006E4320 /* ibeam.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DD3D51D0D82D4C9006E4320 /* ibeam.png */; }; 1DD66ECE0C803D3600EBDAB3 /* MMApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DD66ECC0C803D3600EBDAB3 /* MMApplication.m */; }; 1DD703B90BA9D15D008679E9 /* vim_gloss.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1DD703B80BA9D15D008679E9 /* vim_gloss.icns */; }; 1DD704310BA9F9C2008679E9 /* SpecialKeys.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1DD704300BA9F9C2008679E9 /* SpecialKeys.plist */; }; @@ -218,6 +219,7 @@ 1D9918470D299F9900A96335 /* MMAtsuiTextView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMAtsuiTextView.m; sourceTree = ""; }; 1DD04DEB0C529C5E006CDC2B /* Credits.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = ""; }; 1DD0C20A0C60FF9A008CD84A /* gvimrc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = gvimrc; sourceTree = ""; }; + 1DD3D51D0D82D4C9006E4320 /* ibeam.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ibeam.png; sourceTree = ""; }; 1DD66ECB0C803D3600EBDAB3 /* MMApplication.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMApplication.h; sourceTree = ""; }; 1DD66ECC0C803D3600EBDAB3 /* MMApplication.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMApplication.m; sourceTree = ""; }; 1DD703B80BA9D15D008679E9 /* vim_gloss.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = vim_gloss.icns; sourceTree = ""; }; @@ -463,6 +465,7 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( + 1DD3D51D0D82D4C9006E4320 /* ibeam.png */, 1D0F11480D58C77800D5DA09 /* Font */, 1DCE78490C460C6C006305A6 /* Icons */, 1DE9726C0C48050600F96A9F /* Toolbar */, @@ -614,6 +617,7 @@ 1DE3F8E70D50F80500052B9E /* Preferences.nib in Resources */, 0395A8AA0D72D88B00881434 /* General.png in Resources */, 0395A95A0D74D47B00881434 /* Integration.png in Resources */, + 1DD3D51E0D82D4C9006E4320 /* ibeam.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/src/MacVim/ibeam.png b/src/MacVim/ibeam.png new file mode 100644 index 0000000000000000000000000000000000000000..724aae51b59d86922f402e81a7081361dad000a2 GIT binary patch literal 193 zcwXxa@N?(olHy`uVBq!ia0vp^oIotZ!VDy<*S)L;QjEnx?oJHr&dIz4a`*#$LR>$8 z{`~*{e<1JEr%xY0evGl(&<#>o666=m;PC858pxCakH}&M25w;xW@MN(M*=9wUgGKN z%6@~HgO5eOv~P14P)OU;#W95AdUAqDf{uKbLh*2~7YP={EBK literal 0 HcwPel00001 -- 2.11.4.GIT