Difference between revisions of "IDE Window: Editor Options Mouse"

From Free Pascal wiki
Jump to navigationJump to search
Line 102: Line 102:
  
 
== Selection Commands ==
 
== Selection Commands ==
 +
 +
Some events that occur on mouse '''down''' events implicitly assign a mouse '''up''' action for the current click. <br>
 +
E.g. dragging implicitly drops (inserts) the text when the button is released
 +
 +
If any configured action is assigned to the mouse up, then the implicit action is performed first, the configured action is performed second.
  
 
=== Block Selection Commands ===
 
=== Block Selection Commands ===
 +
 +
There are 3 Selection commands, for the 3 selection modes supported by SynEdit: '''Normal''', '''Column''' or '''Full-Lines'''.
 +
 +
Note: All of them move the caret implicitly.
 +
 +
Each of those can be configured in 2 different ''Modes'':
 +
* Begin
 +
Starts a new selection . If an old selection exists, it will be disregarded. The new Selections starts at the current mouse location.
 +
* Continue
 +
If an old selection exists, then it will be extend.<br>
 +
If there was no selection, then a new selection is created, which will start at the position the caret had before the event occurred, and range to the click position.
 +
 +
Those events should be assigned to mouse '''down''' events, in which case the selection will resize with any following mouse-movement until the mouse button is released.
 +
 +
"Begin-Mode" on mouse '''up''' does nothing, but setting the caret. (Except currently for line mode, which selects the line).<br>
 +
"Continue-Mode" on mouse '''up''' will extend the selection
  
 
=== Item Selection Commands ===
 
=== Item Selection Commands ===
 +
 +
Allow to select the Word, Line or Paragraph at the mouse position.
 +
Once selected the selection will not extend, if the mouse moves.
 +
 +
"Line" supports 2 modes, either including leading/trailing spaces of the line or not.
 +
 +
Note: All of them move the caret implicitly.
  
 
=== Drag Selection Command ===
 
=== Drag Selection Command ===
 +
 +
Drags (Copies or moves) the current selection to a new position, following mouse movement. It will be pasted there if the button is released.
 +
 +
Independent of the modifier keys pressed at the time of the event occurring (or the configured mod, keys), it will check for the '''ctrl''' key at the time the dragged text is inserted. If Ctrl is pressed the text will be copied, otherwise moved.
 +
 +
Note: moves the caret implicitly.
  
 
=== Quick copy Selection Command ===
 
=== Quick copy Selection Command ===
 +
 +
Inserts a copy of the currently selected text at the mouse location. If no text is selected, inserts the content of the clipboard.
 +
 +
Note: moves the caret implicitly.
  
 
== Context Popup Menu ==
 
== Context Popup Menu ==

Revision as of 15:46, 5 June 2009

Deutsch (de) English (en)


The Context Tree

The context tree is the Treeview just left to the Overview Grid. It currently has the entries:

  • General
    • Selection
  • Gutter
    • Fold Tree
      • Fold Collapsed
      • Fold Expanded

You can define the behaviour of the Mouse-Buttons, dependent on the Context. E.g. clicking "selected text" may have a different action, than clicking unselected text.

If a Node for a specific context exists, it will use it's parents as fallback. E.g. If you click on "selected text", the configuration of the Selection node is searched first. If it has no action for your click, the parent node General is searched. (By default this is used to assign "drag selected text" to the left button)

The Gutter node is a top level node, that does have no fall-back. But the Fold... nodes do fall back on there parents.

The Click Configuration

When you click a mouse button, the following items are checked to find the desired behaviour/action.

The Button

There are individual settings for the Left, Right and Middle mouse Button

The Click Type

There are individual settings for Single, Double, Triple or Quad clicks.

Please make sure you read the section on Double to Quad Clicks

There also is a setting Any, which means the action is executed for any of the clicks. That would mean that a double click would execute the action twice. Or if the first part of the double-click changed the state of the object, the 2nd part would apply to the new state.

  • Example:
The left button on the code fold part is configured as Any. Each click will toggle between folded and unfolded. Therefore a double click will revert the action of the first.
Without the Any setting, if you accidentally folded the wrong node, you would have to wait before you could click again to unfold it. (Because a quick 2nd click would count as double click, which wouldn't be matched by Single)

Notes:

  • Not all of them are supported on all platforms
  • Currently Double, Triple and Quad only work for the left button and only for down clicks

The Click Direction

A mouse click consists of a mouse-down and a mouse-up.

Actions can be configured to happen on either of those 2 events.

You can assign 2 different actions to the 2 events of the same click. They will be executed in the order of the events. However keep in mind that such a configuration may limit the action of the mouse-down event.

Notes:

  • Some events require the correct Click Direction to work properly:
    • Start Selection, Drag Selection: Only works on down events, since it relies on the following mouse-movement-while-button-down. (It has a build in "end" at mouse button up)
    • Context-Menu: On some WidgetSets this will only work reliable on mouse-up events

The Modifier Keys

Mouse behaviour can be modified by holding the Shift, Alt or Ctrl key (or combinations of them)

At the time of the click-down or up the state of all three keys is checked. An action can be defined to:

  • require one, some or all of the modifier keys pressed (Checkbox ticked)
  • require one, some or all of the modifier keys *not* pressed (Checkbox not ticked)
  • ignore the state of one, some or all of the modifier keys (Checkbox greyed)

For a given combination of Button, Click-Type, Click-Direction there must not be any ambiguity for the modifier keys. Example

  • Bad / Ambiguous:
    • Left, Single, down Click with: Shift required pressed; Alt and Ctrl ignored
    • Left, Single, down Click with: Ctrl required pressed; Alt and Shift ignored
Now if you do this click, with both of Shift and Ctrl pressed, it would be unclear which of the 2 settings to use
  • Correct:
    • Left, Single, down Click with: Shift required pressed; Ctrl required un-pressed; Alt ignored
    • Left, Single, down Click with: Ctrl required pressed; Shift required un-pressed; Alt ignored
  • If uou whish Shift to be preferred (the shift action should be taken, if both modifier keys are pressed) then you must at an extra setting:
    • Left, Single, down Click with: Ctrl required pressed; Shift required pressed; Alt ignored

There is one exception from this rule. If all modifier keys are set to be ignored, the entry becomes the fall-back for the button, click-type, click-dir configuration. This is, if no configuration is found which has at least one modifier key required either pressed or un-pressed, then the fallback will be used.

Note:

  • The Modifier Combinations used to detect the action on mouse down (or up) has nothing to do with the modifier Key, that certain actions use during there mouse-move phase.
e.g. Dragging uses "ctrl" to copy the dragged text instead of moving it. However the use of "ctrl" for copy indication is during mouse move, so you can set start dragging to rely on any other Modifier key. It is however recommended to set Ctrl to greyed, so you can start dragging with the key pressed or un-pressed.
This is different to using "alt" (or others) for column mode selection: Here the decision is made only at the time of click. Later changes of the "alt" key during mouse-move do not change the selection mode.

The Action / Behaviour

Each mouse button event as defined above, can trigger some action. The same action can be assigned to more than one event. (IF 2 events have the same behaviour, then there modifier keys are not checked for ambiguity)

With each action you can define, if you whish the caret to be moved. However this only additionally enforces the the caret move. If an action implicitly moves the caret, then this will happen, even if you uncheck the this box. (e.g. Selecting a block always moves the caret)

Some commands take additional params to refine there behaviour

No Action Command

There are 2 uses for this:

  • Move Caret

With "Move Caret" it will set the caret to the mouse location. This will unset an existing selection. It also prevents a new selection from being marked by moving the mouse.
If it occurs on down then the caret will be set to the location the mouse was pressed, never mind where you release the button

  • Prevent fallback to parent node

In Context-Subnodes this can prevent a click from executing the parent node(s) action.
E.g. this is assigned to the FoldTree. It catches clicks that are neither on a [+] or [-] node. Otherwise they fall through to the normal Gutter and toggle a breakpoint.

Selection Commands

Some events that occur on mouse down events implicitly assign a mouse up action for the current click.
E.g. dragging implicitly drops (inserts) the text when the button is released

If any configured action is assigned to the mouse up, then the implicit action is performed first, the configured action is performed second.

Block Selection Commands

There are 3 Selection commands, for the 3 selection modes supported by SynEdit: Normal, Column or Full-Lines.

Note: All of them move the caret implicitly.

Each of those can be configured in 2 different Modes:

  • Begin

Starts a new selection . If an old selection exists, it will be disregarded. The new Selections starts at the current mouse location.

  • Continue

If an old selection exists, then it will be extend.
If there was no selection, then a new selection is created, which will start at the position the caret had before the event occurred, and range to the click position.

Those events should be assigned to mouse down events, in which case the selection will resize with any following mouse-movement until the mouse button is released.

"Begin-Mode" on mouse up does nothing, but setting the caret. (Except currently for line mode, which selects the line).
"Continue-Mode" on mouse up will extend the selection

Item Selection Commands

Allow to select the Word, Line or Paragraph at the mouse position. Once selected the selection will not extend, if the mouse moves.

"Line" supports 2 modes, either including leading/trailing spaces of the line or not.

Note: All of them move the caret implicitly.

Drag Selection Command

Drags (Copies or moves) the current selection to a new position, following mouse movement. It will be pasted there if the button is released.

Independent of the modifier keys pressed at the time of the event occurring (or the configured mod, keys), it will check for the ctrl key at the time the dragged text is inserted. If Ctrl is pressed the text will be copied, otherwise moved.

Note: moves the caret implicitly.

Quick copy Selection Command

Inserts a copy of the currently selected text at the mouse location. If no text is selected, inserts the content of the clipboard.

Note: moves the caret implicitly.

Context Popup Menu

Fold Commands

Fold/Unfold Commands

Fold Popup Menu

Source Link Command

Breakpoint Command

Double to Quad Clicks

  • Note: Those are currently only working with left mouse
  • Note: Those are currently only triggering Mouse Down

If you assign actions to double and triple click, you should aware that they always trigger the lesser clicks too.

This is: Doing a Triple-Click will first do a Single-Click (down and up) with the same Modifier Keys (none, shift, alt, ...), then a double click, then the triple. (At the time of the first click, SynEdit does not know there will be more clicks)

You should therefore take care of the actions assigned to those clicks.

  • With the default (select, select word, select line, select paragraph) this is no problem. Selecting a Line (Triple) is not disturbed by selecting a Word (Double) first.
  • If However you would assign MouseLink to the Single (or Double), and select Word to the Double (or Tripple, one more than the other), this would not work. Because by the time you do your last click, SynEdit already followed the Link (and will not undo this). In fact, if SynEdit followed a Link to an other File, then a new SynEdit became active, and would see your last click as a single click.
  • This is not a bug. This is the correct behaviour

Current Limitations

  • Double/Triple/Quad click only available for Left Mouse and only for mouse down
  • Gutter Config not yet included.
  • GTK2: PopUp-Menu is recommended for use with ButtonUp only

Useful Examples