EditTextView.st
branchtext-view-selection-refactoring
changeset 4852 04fe7fca9320
parent 4851 6cebb40eb268
parent 4803 87d60a4b098b
child 4854 6c3caad0bdfa
--- a/EditTextView.st	Fri Sep 27 23:01:16 2013 +0100
+++ b/EditTextView.st	Sun Sep 29 18:55:50 2013 +0100
@@ -22,7 +22,7 @@
 		st80Mode disableIfInvisible cursorMovementWhenUpdating learnMode
 		learnedMacro cursorLineHolder cursorColHolder tabRequiresControl
 		undoSupport lastStringFromReplaceForNextSearch
-		lastReplacementInfo completionSupport'
+		lastReplacementInfo completionSupport codeAspectHolder'
 	classVariableNames:'DefaultCursorForegroundColor DefaultCursorBackgroundColor
 		DefaultCursorType DefaultCursorNoFocusForegroundColor
 		DefaultCursorTypeNoFocus LastColumnNumberForSort Macros'
@@ -829,6 +829,28 @@
 
 !EditTextView methodsFor:'accessing'!
 
+codeAspect
+    | codeAspect app |
+
+    codeAspect := codeAspectHolder value.
+    codeAspect notNil ifTrue:[^codeAspect].
+    self editedMethod notNil ifTrue:[^SyntaxHighlighter codeAspectMethod].
+
+    "/ Applications should set it explictly, however, to make it behavinh like
+    "/ CodeView2, I kept fetching code here for now.
+    ^((app := self topView application) notNil and:[app respondsTo: #codeAspect])
+        ifTrue:[app codeAspect]
+        ifFalse:[nil]
+
+    "Created: / 27-09-2013 / 09:53:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+codeAspect: aSymbol
+    codeAspectHolder value: aSymbol
+
+    "Created: / 27-09-2013 / 09:50:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 completionSupport
     ^ completionSupport
 !
@@ -858,6 +880,12 @@
     "Created: / 18-09-2013 / 14:16:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+editedLanguage: aProgrammingLanguage
+    "Sets the edited language. Only defined here to make it polymorph with Workspace"
+
+    "Created: / 27-09-2013 / 10:15:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 editedMethod
     |cm|
 
@@ -871,6 +899,12 @@
     ^ nil
 !
 
+editedMethodOrClass: methodOrClass
+    "Sets the edited method or class. Only defined here to make it polymorph with Workspace"
+
+    "Created: / 27-09-2013 / 10:10:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 hasSelectionOrTextInCursorLine
     ^ (self selectionOrTextOfCursorLine:false) notNil
 !
@@ -965,6 +999,14 @@
     "Created: 5.3.1996 / 14:37:50 / cg"
 !
 
+codeAspectHolder
+    ^ codeAspectHolder
+!
+
+codeAspectHolder:something
+    codeAspectHolder := something.
+!
+
 cursorMovementWhenUpdating
     "return what is be done with the cursor,
      when I get a new text (via the model or the #contents/#list)
@@ -5705,6 +5747,9 @@
     self allowDrop:true.        "/ readOnly tested in #canDrop:
 
     undoSupport := UndoSupport for:self.
+    codeAspectHolder := nil asValue.
+
+    "Modified: / 27-09-2013 / 09:41:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 initializeCompletionSupport
@@ -8498,11 +8543,11 @@
 !EditTextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.587 2013-09-26 17:35:11 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.588 2013-09-27 09:26:51 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.587 2013-09-26 17:35:11 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.588 2013-09-27 09:26:51 vrany Exp $'
 !
 
 version_HG