From 1b4e97f8b5e628af033612e12e647718f8d5ee84 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Wed, 24 Apr 2013 19:33:49 +1000 Subject: Feature: [feature-requests:#987]. Cocoa user interface validation. --- cocoa/ScintillaView.h | 2 +- cocoa/ScintillaView.mm | 22 ++++++++++++++++++++++ doc/ScintillaHistory.html | 14 +++++++++----- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/cocoa/ScintillaView.h b/cocoa/ScintillaView.h index 996501788..356c34adb 100644 --- a/cocoa/ScintillaView.h +++ b/cocoa/ScintillaView.h @@ -48,7 +48,7 @@ extern NSString *SCIUpdateUINotification; * InnerView is the Cocoa interface to the Scintilla backend. It handles text input and * provides a canvas for painting the output. */ -@interface InnerView : NSView +@interface InnerView : NSView { @private ScintillaView* mOwner; diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index a23a4b8b0..7f6b4991e 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -787,6 +787,28 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) return mOwner.backend->CanRedo(); } +- (BOOL) validateUserInterfaceItem: (id ) anItem +{ + SEL action = [anItem action]; + if (action==@selector(undo:)) { + return [self canUndo]; + } + else if (action==@selector(redo:)) { + return [self canRedo]; + } + else if (action==@selector(cut:) || action==@selector(copy:) || action==@selector(clear:)) { + return mOwner.backend->HasSelection(); + } + else if (action==@selector(paste:)) { + return mOwner.backend->CanPaste(); + } + return YES; +} + +- (void) clear: (id) sender +{ + [self deleteBackward:sender]; +} - (BOOL) isEditable { diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index cd57f33a0..1e8facbf7 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -446,8 +446,16 @@ easier for containers to implement folding.
  • + Add indicator INDIC_COMPOSITIONTHICK, a thick low underline, to mimic an + appearance used for Asian language input composition. +
  • +
  • + On Cocoa implement automatic enabling of commands and added clear command. + Feature #987. +
  • +
  • Haskell folder improved. - Bug #1459 . + Bug #1459 .
  • PowerShell lexer recognises here strings and doccomment keywords. @@ -455,10 +463,6 @@ Feature #985.
  • - Add indicator INDIC_COMPOSITIONTHICK, a thick low underline, to mimic an - appearance used for Asian language input composition. -
  • -
  • Fix multi-typing when two carets are located in virtual space on one line so that spaces are preserved.
  • -- cgit v1.2.3