http://code.google.com/p/pharo/issues/detail?id=810
Alain ---------------------------------------------- annotationPanes : "if true, a thin horizontal pane is used in browsers" We have 3 implementations : Old browser and MC implementation in Pharo-core and OB one in Pharo-dev. Pharo-core Old browser implementation: It first relies on the #annotation related methods. (changed: #annotation, Browser>>annotation, ChangeList>>annotation, CodeHolder>>annotation). CodeHolder>>wantsAnnotationPane is the only user of the annotationPanes preference. CodeHolder>>addOptionalAnnotationsTo: window at: fractions plus: verticalOffset is the only user of wantsAnnotationPane. It has two senders: Browser>>openAsMorphMessageEditing: and CodeHolder>>addLowerPanesTo: window at: nominalFractions with: editString. method source with #annotation gives more interesting results such as: CodeHolder>>refreshAnnotation "If the receiver has an annotation pane that does not bear unaccepted edits, refresh it" (aPane := self dependents detect: [:m | (m inheritsFromAnyIn: #('PluggableTextView' 'PluggableTextMorph' )) and: [m getTextSelector == #annotation]] ifNone: []) ifNotNil: [:aPane | aPane hasUnacceptedEdits ifFalse: [aPane update: #annotation]] other "cool" pieces of code: PluggableTextMorph>>accept .... ok := self acceptTextInModel. ok == true ifTrue: [self setText: self getText. self hasUnacceptedEdits: false. (model dependents detect: [:dep | (dep isKindOf: PluggableTextMorph) and: [dep getTextSelector == #annotation]] ifNone: []) ifNotNilDo: [:aPane | model changed: #annotation]]. ... PluggableTextMorph>>cancel self setText: self getText. self setSelection: self getSelection. getTextSelector == #annotation ifFalse: [(aPane := model dependents detect: [:dep | (dep isKindOf: PluggableTextMorph) and: [dep getTextSelector == #annotation]] ifNone: []) ifNotNil: [:aPane | model changed: #annotation]] The displayed annotation is set only when a browser or message list is opened. Then, displayed information concerns only the method on which the browser is opened or only the method FROM which sender/implementor message list is opened. The annotation is never updated even a new method is selected. Pharo-core MC implementation: MCSnapshotBrowser, MCPatchBrowser, MCMergeBrowser: display (well) annotation when a method is selected. The method author initials, the date and the time of change and the category are displayed. Note that the height of the pane is sometime too thin, depending on the height of the font. When a vertical scrollbar is shown, the pane is always too thin. The implementation relies on #annotations and #annotations: methods. #annotations implementations MCCodeTool>>annotations (subclassresponsibility) ok MCConflict>>annotations ok MCPatchBrowser>>annotations ok MCSnapshotBrowser>>annotations ok MCDefinition>>annotations and MCPatchOperation>>annotations make use of Preferences class>>defaultAnnotationRequests. Preferences class>>defaultAnnotationRequests ^ Parameters at: #MethodAnnotations ifAbsent: [self setDefaultAnnotationInfo "Preferences annotationInfo"] #annotations: implementations MCDefinition>>annotations: and MCPatchOperation>>annotations: are the same MCDefinition>>annotations: requests "Answer a string for an annotation pane, trying to fulfill the annotation requests. These might include anything that Preferences defaultAnnotationRequests might return. Which includes anything in Preferences annotationInfo To edit these, use:" "Preferences editAnnotations" ^ String streamContents: [:s | self printAnnotations: requests on: s] MCSnapshotBrowser>>annotations: stuff self changed: #annotations The displayed data is given by Preferences annotationInfo which is supposed to be adaptable with the help of a specific tool opened with Preferences editAnnotations. The annotation is well updated each time a new method is selected. I didn't succeed in making Preferences editAnnotations work. Found the implementation clean except the Preferences annotationInfo/editAnnotations part. Pharo-dev OB implementation Relies on a OBAnnotationPanel for the view and on the OBSelectionChanged announcement for the annotation update. It works well. The implementation is simple and clean (The only bad point I've found is that, as for the Pharo-core MC implementation, the height of the panel is fixed whereas it should be dynamically computed from current code font height) action: Would remove the annotationPanes preference from pharo-core and make an OBBrowser specific setting. Why: because old browser implementation is really confusing and dirty and because it do not give useful feedback to the user. Would also remove MC implementation because it is not used by default and I think that MC user do not care about it. If people want to keep it, then it should not relies on a specific setting. Anyway, the Preferences annotationInfo/editAnnotations part should be removed. Consequence: Clean/remove all annotation related code from Pharo-core. Ask OB maintainers to add an OB specific settings as follow: OBCodeBrowser class>>showAnnotationPanel <setting> ^ ShowAnnotationPanel ifNil: [ShowAnnotationPanel := (SettingManager newSetting: 'Show annotation panel') default: true; parent: #obBrowsing; description: 'If true, a thin horizontal panel is used in browsers. The annotation panel is used to display useful informations about the selected method'] I will propose a .cs for the cleaning of Pharo-core when I will know what to do with MC implementation (keep, remove, ok to keep with cleaning?). Then I will propose a .cs to OB maintainers for Pharo-dev. Alain ------------------------------------- _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Free forum by Nabble | Edit this page |