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

From Free Pascal wiki
Jump to navigationJump to search
Line 10: Line 10:
 
<br>
 
<br>
  
= The Context Tree =
+
= Gutter =
  
The context tree is the Treeview just left to the Overview Grid. It currently has the entries:
+
= Text-area =
* '''Text'''
 
** '''Selection'''
 
* '''Gutter'''
 
** '''Fold''' '''Tree'''
 
*** '''Collapsed''' '''[+]'''
 
*** '''Expanded''' '''[-]'''
 
** '''Line''' '''Numbers'''
 
 
 
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 click has no Entry in a specific context, it will use the content's parent(s) 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 '''Text''' is searched. (By default this is used to assign "drag selected text" to the left button)
 
 
 
The '''Gutter''' and '''Text''' node are top level nodes, that do not have fall-backs. But the other nodes do fall back on their parents.
 
 
 
See also [[#The Priority|The Priority]] and [[#fallthrough|Fall-Through]] in the [[#The Action / Behaviour|The Action / Behaviour]] section.
 
 
 
= 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
 
* Extra Mouse Buttons (Button 4 and 5) work only on Windows
 
 
 
== <div id="ClickType"></div> 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|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
 
* On Windows '''Triple''' and '''Quad''' only work for the left button.
 
 
 
== <div id="ClickDir"></div> 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:
 
** Context-Menu: On some WidgetSets this will only work reliable on mouse-'''up''' events
 
** 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)
 
* Selecting and Dragging (only if actually done by moving the mouse) capture the mouse-up event and prevent any other Action on the up event.<br>This can be used to select/drag if mouse is moved, otherwise fall back to an action configured on mouse up
 
 
 
== <div id="ModKeys"></div> 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 you 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
 
 
 
 
 
;Default Fallback:
 
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.<br>
 
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.<br>
 
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.
 
 
 
== <div id="Priority"></div> The Priority ==
 
 
 
It is possible to configure several equal (or overlapping / ambiguous) Clicks in the same Context. The Configuration with the highest Priority (lowest number (0 = top)) wins.
 
 
 
This can be used for 2 purposes:
 
 
 
;Resolve Ambiguity:
 
# Left, Single, down Click, '''priority''' '''0''' with: Shift, Ctrl required pressed; Alt ignored
 
# Left, Single, down Click, '''priority''' '''1''' with: Shift required pressed; Ctrl, Alt ignored
 
Normally those two would conflict, because if you click with shift and ctrl then both will match. However due to the priority this can be resolved:
 
* Only Shift pressed: Only Config 2 (priority 1) does match. Config 2 is taken.
 
* Shift and Ctrl pressed: Both Config do match. Config 1 has higher priority (0), Config 1 is taken
 
 
 
 
 
;<div id="Fallthrough"></div>Define Actions for Command Fall-through:
 
Sometimes a Command can not be executed at the given location. If the Command notices this, it will pass the Click on. The [[#fallthrough|Fall-Through]] first looks for further Commands in the same Context, but with lower priority. If none are found it will search parent context too.
 
* Not all Commands/Actions support Fall-through
 
* "Default Fallback" (modifier Keys) will act like any other entry in the Priority. If A click is matched by a "specific configuration" at priority 2 (low) and a "default fallback" at priority 1 (higher), then it will first be given to the "default fallback", and only if this supports and trigger Fall-through the event may go to the "specific config"
 
* See Useful Examples: [[#Extend "Source Links" to jump Begin/End-pairs|Extend "Source Links" to jump Begin/End-pairs]]
 
 
 
= <div id="ActionHelp"></div>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)
 
 
 
;Move Caret checkbox: With each action you can define, if you whish the caret to be moved. However this only additionally enforces 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)
 
 
 
;Command options: Some commands take additional params to refine there behaviour
 
 
 
;Implicit mouse up action: Some events that occur on mouse '''down''' events implicitly assign a mouse '''up''' action for the current click. <br> An implicit Mouse-Up event may or may not cancel the action/behaviour normally assigned  to the mouse up. <br> E.g. dragging implicitly drops (inserts) the text when the button is released, it cancel whatever action may have been assigned to the mouse up event.
 
 
 
<div id='fallthrough'></div>
 
;Fall-Through:
 
Some Commands can not always be executed. For Example "Source Link Command" can only be executed, if above a link-able identifier. In cases where a command can not be executed, it may trigger a Fall-Through. This means the Click will behave as if the configuration had not existed, and consequently a lower priority followed by the parent context will be searched.
 
<br>Note: Not all commands support this, even if they are not executed.
 
 
 
== 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. <br> 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. <br> 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.
 
 
 
 
 
;Fall-Through: Never
 
 
 
== 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. ('''Implicit mouse up action''')
 
 
 
"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
 
 
 
 
 
;Fall-Through: Never
 
 
 
=== 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.
 
 
 
 
 
;Fall-Through: Never
 
 
 
=== 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. ('''Implicit mouse up action''')
 
 
 
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.
 
 
 
 
 
;Fall-Through: If no text is selected. Or if the selection can not be dragged (Column or Line mode selection)
 
 
 
=== 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.
 
 
 
 
 
;Fall-Through: If no text is selected and the clipboard is empty
 
 
 
== Context Popup Menu ==
 
 
 
Note: GTK2: PopUp-Menu is recommended for use with ButtonUp only
 
 
 
 
 
;Fall-Through: Never
 
 
 
== Fold Commands ==
 
 
 
Fold commands are commonly assigned to the fold-tree-nodes, but can also be assigned to other context, like the text area.
 
 
 
The fold-tree has 3 context-nodes
 
;Fold Tree: Any area of the fold-tree, this can be [+], [-], |, or empty
 
:;Collapsed: The [+] only. This means the line has at least one collapsed section. It may have a mix of collapsed/expanded sections
 
:;Expanded: The [-] only. This means the line has at at only expanded sections (at least one)
 
 
 
Note, that if you configure a specific click (e.g. shift-left-down) for either [+] or [-] or both, then most likely you should add the same click with "no action" (or other default) to the parent "Fold Tree" node. Otherwise such a click if not on the [+]/[-] node will fall through to the gutter, and may trigger an action there.
 
 
 
=== Fold Commands ===
 
 
 
By default only acts on nodes starting on the line at the mouse location.
 
 
 
The following modes are available:
 
;One: Folds the "most inner" unfolded node starting on this line. This is the node that starts at the right most place in the line. Any node already folded is ignored, so if any unfolded node exists, one and exactly one node will be folded.<br>This is not necessarily the shortest fold-node (in amount of lines folded), as $region and begin folds can overlap.
 
;All: Folds all Nodes that start on this line
 
;At Caret: This only works if configured for the "Text" context. It folds the node which starts under the current mouse location. This allows you to click on a "begin" (or other keyword) to fold it. (Useful if more than one node starts at the line).
 
;Current: Folds the most inner node containing the current mouse location (the gutter is treated as "at the start of line"). It will search for the first fold-starting keyword (e.g "begin") in front of the current mouse location, whic has a block enclosing the mouse location (end is past mouse location). This may be above the current line.<br> If assigned to the gutter (or fold tree) this is always above the current line, unless the line starts with a keyword (no spaces before)
 
 
 
 
 
;Fall-Through:  (subject to change) Only in "At Caret" mode, if no fold starts under the mouse location
 
 
 
=== Unfold Commands ===
 
 
 
Only acts on nodes starting on the line at the mouse location.
 
 
 
The following modes are available:
 
;One: Folds the "most outer" folded node starting on this line. This is the node that starts at the left most place in the line.
 
;All: Unfolds all nodes that start at the current line
 
 
 
;Fall-Through: Never (subject to change)
 
 
 
=== Fold Popup Menu ===
 
 
 
Note: GTK2: PopUp-Menu is recommended for use with ButtonUp only
 
 
 
A pop up menu allowing you to see and change folds enclosing the current line
 
 
 
 
 
;Fall-Through: Never
 
 
 
== Source Link Command ==
 
 
 
Trigger jump to implementation.
 
 
 
The "underline" argument controls, if the curremt link under the mouse is highlighted (by an underline) while the modifier keys are pressed.
 
 
 
If you assign this command to a click with no modifier keys needed, you would get constant highlights (because the expected modifiers (none) are pressed). In this case you cn switch it off.
 
 
 
 
 
;Fall-Through: If no linkable identifier is below the mouse
 
 
 
== Breakpoint Command ==
 
 
 
Toggle breakpoint on this line
 
 
 
 
 
;Fall-Through: Never
 
 
 
== IDE-Command ==
 
 
 
Select from the same commands that are available via the Keyboard Config.
 
 
 
If the chosen Command depends on the current caret location, then it is recommended to tick "Move Caret".
 
 
 
 
 
;Fall-Through: Never
 
 
 
 
 
 
 
= The "Other Actions using the same button" Table =
 
 
 
This table can help you identifying other clicks, that may be executed together with the current click. It lists potential other clicks. The listed clicks are <b>not</b> necessarily executed together.
 
 
 
The list includes clicks from the parent(s) contexts, but not any child contexts.
 
 
 
The clicks are usually searched in the order indicated in the first column. You need to check:
 
* Clicks in the other direction (up/down)
 
* if the Modifier Keys match or could match
 
* A click could [[#Fallthrough|fall through]]
 
* A click with lesser count (single, double, ...) exists
 
 
 
Usually there are up to two Actions executed. The first matching one from the up and one the first matching one from the down clicks part of the list. Further Actions can happen due to [[#Fallthrough|fall through]].
 
 
 
So if your item (highlighted) is not first in the list, or there are actions in the other click-dir (up/down) check carefully, if this matches your intention.
 
 
 
= Current Limitations =
 
 
 
* On Windows '''Triple''' and '''Quad''' only work for the left button.
 
* Extra Mouse Buttons (Button 4 and 5) work only on Windows
 
* GTK2: PopUp-Menu is recommended for use with Button-Up only
 
* OS-Depended: Some clicks may be used by the Window-Manager, and not reach the IDE at all
 
 
 
= Pitfalls =
 
 
 
== Mixing Down and Up Clicks ==
 
 
 
A mouse-down action does <b>not</b> prevent the mouse up action. This may lead to unexpected additional actions being executed<br>Consequential a click-up may be preceeded by unexpected click-down actions.
 
* The mouse-up / mouse-down can be in a parent [[#The Context Tree|context node]]
 
* To avoid search in parent nodes, define a "no action" event in the current node
 
 
 
== Double to Quad Clicks ==
 
 
 
* On Windows '''Triple''' and '''Quad''' only work for the left button.
 
 
 
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)
 
* The single click can be in a parent [[#The Context Tree|context node]]
 
 
 
 
 
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
 
  
 
= Advanced Options =
 
= Advanced Options =
  
 
For advanced options please see here: [[IDE_Window:_EditorMouseOptionsAdvanced|Advanced Mouse Options]]
 
For advanced options please see here: [[IDE_Window:_EditorMouseOptionsAdvanced|Advanced Mouse Options]]

Revision as of 22:15, 15 August 2009

Deutsch (de) English (en)


  • You can get this dialog via:
Menu / Environment / Editor options / Mouse
Source editor / popup menu / Editor properties ...


Gutter

Text-area

Advanced Options

For advanced options please see here: Advanced Mouse Options