Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Mouse selections in StyledText and TextViewer

Hi Alan, it looks like your changes cross component boundaries.  This is
the SWT
mailing list so we would be the right people to talk about StyledText but
know nothing
of IDoubleClickStrategy.

Lynne, do you want to comment on the StyledText issues.



                                                                                                                                           
                      "Alan Oursland"                                                                                                      
                      <alan@xxxxxxxxxxxx>             To:      <platform-swt-dev@xxxxxxxxxxx>                                              
                      Sent by:                        cc:                                                                                  
                      platform-swt-dev-admin@         Subject: [platform-swt-dev] Mouse selections in StyledText and TextViewer            
                      eclipse.org                                                                                                          
                                                                                                                                           
                                                                                                                                           
                      09/12/02 04:06 PM                                                                                                    
                      Please respond to                                                                                                    
                      platform-swt-dev                                                                                                     
                                                                                                                                           
                                                                                                                                           



I have been looking at the code for selecting text with the mouse in the
text editor. It looks like StyledText implements most of it and then
TextViewer implements it again.

I have also noticed that selection actions are pretty much hardcoded to the
mouse events.

I would like to rewrite the mouse selection code so that:
a) it works like the editor in MS Visual Studio by default
b) it is customizable

My main reservation with this endeavor is that I have zero understanding of
how changes will affect plug-ins that other people have written. Could
someone provide any information on this and how I can avoid impact.

The changed I would like to make are:
I. get rid of IDoubleClickStrategy and all support (affects ITextViewer,
TextViewer, and SourceViewerConfiguration)
II. introduce a new more general model for customizing mouse selection in
StyledText where:
             a) A mouse down event (including multi-clicks):
                         - clears the current selection unless shift is
pressed (shift always
extends selections)
                         - records a selection start position.
                         - uses modifiers (ctrl, alt, click-count) to find
a content partitioning
object.
                         - sets the selection to the left and right bounds
of the partition in
which the mouse was pressed.
                         - begins autoscrolling
             b) A mouse move event
                         - makes sure a mouse drag selection is taking
place
                         - gets the correct content partitioning based on
modifiers
                         - extends the selection to the left and right
bounds of the partitions
that the start position and current mouse position span.
             c) A mouse up event
                         - ends autoscrolling

Content Partitioning objects define partitions within content. I am pretty
sure I remember seeing something like this in Eclipse already, but it
doesn't seem to be associated with StyledTextContent. You might have
different partitioning objects for words, lines, programming scopes, or
whatever. Each editor would be able to map mouse modifiers to their own
custom partitioning object. A default, or null, partitioning object would
indicate single character partitioning.

Note that there is no functional difference between MouseClick and
MouseDoubleClick events. Ideally, this should also be able to handle triple
clicks, if the event model were to support it.

What this does not support is block selection. To do that, I think that
selection state would need to be encapsulated inside an object, or multiple
selections would need to be supported in the widget (which doesn't make a
lot of sense to me).

I would appreciate any comments on this.

Alan Oursland


_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev






Back to the top