Cut, copy & paste debugged. Long needed feature finally implemented.
This commit is contained in:
parent
3ad5f00c8f
commit
2ebe1d8638
@ -21,8 +21,7 @@ Class {
|
|||||||
],
|
],
|
||||||
#classInstVars : [
|
#classInstVars : [
|
||||||
'dockingBar',
|
'dockingBar',
|
||||||
'recentNotebooks',
|
'recentNotebooks'
|
||||||
'nodesClipboard'
|
|
||||||
],
|
],
|
||||||
#category : #'Grafoscopio-UI'
|
#category : #'Grafoscopio-UI'
|
||||||
}
|
}
|
||||||
@ -379,16 +378,6 @@ GrafoscopioGUI class >> messageNotImplementedYet [
|
|||||||
title: 'No implementado aún'.
|
title: 'No implementado aún'.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
GrafoscopioGUI class >> nodesClipboard [
|
|
||||||
^ nodesClipboard
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
GrafoscopioGUI class >> nodesClipboard: anObject [
|
|
||||||
nodesClipboard := anObject
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #'graphical interface' }
|
{ #category : #'graphical interface' }
|
||||||
GrafoscopioGUI class >> open [
|
GrafoscopioGUI class >> open [
|
||||||
^ self new open
|
^ self new open
|
||||||
|
@ -23,12 +23,37 @@ Class {
|
|||||||
'node',
|
'node',
|
||||||
'level',
|
'level',
|
||||||
'nodesInPreorder',
|
'nodesInPreorder',
|
||||||
'cacheNode',
|
|
||||||
'metadata'
|
'metadata'
|
||||||
],
|
],
|
||||||
|
#classInstVars : [
|
||||||
|
'clipboard'
|
||||||
|
],
|
||||||
#category : #'Grafoscopio-Model'
|
#category : #'Grafoscopio-Model'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ #category : #utility }
|
||||||
|
GrafoscopioNode class >> cleanTreeRootReferences [
|
||||||
|
|
||||||
|
| ref |
|
||||||
|
clipboard ifNil: [ ^ self ].
|
||||||
|
clipboard children ifNil: [ ^ self ].
|
||||||
|
clipboard preorderTraversal allButFirstDo: [ :n |
|
||||||
|
ref := n.
|
||||||
|
n level - 1 timesRepeat: [ ref := ref parent ].
|
||||||
|
ref parent: nil
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
GrafoscopioNode class >> clipboard [
|
||||||
|
^ clipboard
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
GrafoscopioNode class >> clipboard: anObject [
|
||||||
|
clipboard := anObject
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #'instance creation' }
|
{ #category : #'instance creation' }
|
||||||
GrafoscopioNode class >> header: aHeader body: aText [
|
GrafoscopioNode class >> header: aHeader body: aText [
|
||||||
"Create a new instance with given header and body"
|
"Create a new instance with given header and body"
|
||||||
@ -59,7 +84,7 @@ GrafoscopioNode class >> named: aString [
|
|||||||
yourself
|
yourself
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'as yet unclassified' }
|
{ #category : #utility }
|
||||||
GrafoscopioNode class >> specialWords [
|
GrafoscopioNode class >> specialWords [
|
||||||
"I return a list of word that were used in the first versions of grafoscopio to mark node
|
"I return a list of word that were used in the first versions of grafoscopio to mark node
|
||||||
headers to indicate special ways to handle them and their node contents.
|
headers to indicate special ways to handle them and their node contents.
|
||||||
@ -248,8 +273,17 @@ GrafoscopioNode >> content: anObject [
|
|||||||
|
|
||||||
{ #category : #'add/remove nodes' }
|
{ #category : #'add/remove nodes' }
|
||||||
GrafoscopioNode >> copyToClipboard [
|
GrafoscopioNode >> copyToClipboard [
|
||||||
GrafoscopioGUI nodesClipboard: self copy.
|
self class clipboard: self copy.
|
||||||
|
self class cleanTreeRootReferences
|
||||||
|
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #utility }
|
||||||
|
GrafoscopioNode >> deleteReferencesToRoot: aRootNode [
|
||||||
|
|
||||||
|
| sparseTree |
|
||||||
|
sparseTree := self preorderTraversal.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #movement }
|
{ #category : #movement }
|
||||||
@ -541,8 +575,8 @@ GrafoscopioNode >> parent: aNode [
|
|||||||
|
|
||||||
{ #category : #'add/remove nodes' }
|
{ #category : #'add/remove nodes' }
|
||||||
GrafoscopioNode >> pasteFromClipboard [
|
GrafoscopioNode >> pasteFromClipboard [
|
||||||
GrafoscopioGUI nodesClipboard
|
self class clipboard
|
||||||
ifNotNil: [ self addNode: GrafoscopioGUI nodesClipboard ]
|
ifNotNil: [ self addNode: self class clipboard ]
|
||||||
ifNil: [ self inform: 'Cache is emtpy. Pleas cut/copy a node before pasting' ]
|
ifNil: [ self inform: 'Cache is emtpy. Pleas cut/copy a node before pasting' ]
|
||||||
|
|
||||||
]
|
]
|
||||||
|
@ -81,6 +81,17 @@ GrafoscopioNotebook >> body: anObject [
|
|||||||
body := anObject
|
body := anObject
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #'editing nodes' }
|
||||||
|
GrafoscopioNotebook >> copyNodeToClipboard [
|
||||||
|
tree highlightedItem content copyToClipboard.
|
||||||
|
self notebookContent: notebook.
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #'editing nodes' }
|
||||||
|
GrafoscopioNotebook >> cutNodeToClipboard [
|
||||||
|
self copyNodeToClipboard; removeNode.
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #'editing nodes' }
|
{ #category : #'editing nodes' }
|
||||||
GrafoscopioNotebook >> demoteNode [
|
GrafoscopioNotebook >> demoteNode [
|
||||||
| editedNode |
|
| editedNode |
|
||||||
@ -205,19 +216,19 @@ GrafoscopioNotebook >> newWindowMainMenu [
|
|||||||
name: nil;
|
name: nil;
|
||||||
description: 'Cut';
|
description: 'Cut';
|
||||||
icon: Smalltalk ui icons smallCutIcon;
|
icon: Smalltalk ui icons smallCutIcon;
|
||||||
action: [ self inform: 'To be implemented...' ] ].
|
action: [ self cutNodeToClipboard ] ].
|
||||||
group addItem: [ :item |
|
group addItem: [ :item |
|
||||||
item
|
item
|
||||||
name: nil;
|
name: nil;
|
||||||
description: 'Copy';
|
description: 'Copy';
|
||||||
icon: Smalltalk ui icons smallCopyIcon;
|
icon: Smalltalk ui icons smallCopyIcon;
|
||||||
action: [ self inform: 'To be implemented...' ] ].
|
action: [ self copyNodeToClipboard ] ].
|
||||||
group addItem: [ :item |
|
group addItem: [ :item |
|
||||||
item
|
item
|
||||||
name: nil;
|
name: nil;
|
||||||
description: 'Paste';
|
description: 'Paste';
|
||||||
icon: Smalltalk ui icons smallPasteIcon;
|
icon: Smalltalk ui icons smallPasteIcon;
|
||||||
action: [ self inform: 'To be implemented...' ] ]];
|
action: [ self pasteNodeFromClipboard ] ]];
|
||||||
addGroup: [ :group |
|
addGroup: [ :group |
|
||||||
group addItem: [ :item |
|
group addItem: [ :item |
|
||||||
item
|
item
|
||||||
@ -425,6 +436,12 @@ GrafoscopioNotebook >> openTutorial [
|
|||||||
ifFalse: [ GrafoscopioGUI updateDocumentationUI ]
|
ifFalse: [ GrafoscopioGUI updateDocumentationUI ]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #'editing nodes' }
|
||||||
|
GrafoscopioNotebook >> pasteNodeFromClipboard [
|
||||||
|
tree highlightedItem content pasteFromClipboard.
|
||||||
|
self notebookContent: notebook.
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
GrafoscopioNotebook >> projectSubMenu [
|
GrafoscopioNotebook >> projectSubMenu [
|
||||||
|
|
||||||
|
@ -18,6 +18,11 @@ ManifestGrafoscopio class >> ruleRBEqualsTrueRuleV1FalsePositive [
|
|||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'code-critics' }
|
{ #category : #'code-critics' }
|
||||||
ManifestGrafoscopio class >> ruleRBSentNotImplementedRuleV1FalsePositive [
|
ManifestGrafoscopio class >> ruleRBLongMethodsRuleV1FalsePositive [
|
||||||
^ #(#(#(#RGMetaclassDefinition #(#'GrafoscopioGUI class' #GrafoscopioGUI)) #'2015-12-23T10:38:16.706667-05:00') #(#(#RGClassDefinition #(#GrafoscopioGUI)) #'2016-01-06T18:53:45.844051-05:00') )
|
^ #(#(#(#RGMethodDefinition #(#GrafoscopioNotebook #newWindowMainMenu #false)) #'2016-12-17T18:51:33.99062-05:00') )
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #'code-critics' }
|
||||||
|
ManifestGrafoscopio class >> ruleRBSentNotImplementedRuleV1FalsePositive [
|
||||||
|
^ #(#(#(#RGMetaclassDefinition #(#'GrafoscopioGUI class' #GrafoscopioGUI)) #'2015-12-23T10:38:16.706667-05:00') #(#(#RGClassDefinition #(#GrafoscopioGUI)) #'2016-01-06T18:53:45.844051-05:00') #(#(#RGMethodDefinition #(#GrafoscopioNotebook #newWindowMainMenu #false)) #'2016-12-17T18:51:40.617924-05:00') )
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user