IDE Window: EditorMouseOptionsAdvanced/de

From Free Pascal wiki

Deutsch (de) English (en)

Der Kontext Baum

Bei dem Kontext Baum handelt es sich um die Baum-Struktur direkt links neben der Übersichts-Tabelle. Gegenwärtig hat er folgende Einträge:

  • Text
    • Auswahl
  • Randleiste
    • Falt Baum
      • Gefaltet [+]
      • Entfaltet [-]
    • Zeilen Nummern

Das Verhalten der einzelnen Maus-Tasten kann Kontext-sensitiv festgelegt werden. Z.B. ein Klick auf den markierten Text kann eine andere Aktion auslösen als ein Klick auf unmarkierten Text.

Wenn für einen Kontext kein Verhalten für einen bestimmten Klick definiert ist, dann dient der übergeordnete Kontext als Definition (Rückfall). Z.B. für einen Klick auf markierten Text wird zuerst der Kontext "Markierung" durchsucht. Ist hier kein Eintrag für den Klick vorhanden dann wird der Kontext "Text" durchsucht. (In der Vorgabe-Konfiguration ist die Aktion für "Markierten Text verschieben" (Drag) auf diese Weise definiert.)

Randleiste und Text sind Haupteinträge im Kontext Baum. Sie haben keine Rückfall-Konfigurationen. Die anderen Einträge können jeweils auf ihre übergeordneten Einträge zurückfallen.

Die Klick Konfiguration

Welche Reaktion ein Klick mit einer der Maustasten auslöst wird anhand der folgenden Kriterien ermittelt.

Die Maustaste

Alle Einstellungen können individuell, jeweils für die Linke, Rechte oder Mittlere Maustaste vorgenommen werden.

Die Zahl der Klicks

Alle Einstellungen können individuell, jeweils für einfach, doppel, dreifach oder vierfach Klicks vorgenommen werden.

Bitte beachten sie unbedingt den Abschnitt über Doppel bis Vierfach Klicks

Es gibt eine spezielle Einstellung "Alle". "Alle" bedeutet das die konfigurierte Aktion für jede der Klickarten (Zahl der Klicks) ausgeführt wird. In diesem Fall würde ein Doppelklick die Aktion zweimal ausführen (zuerst für den Einfach-, dann für den Doppelklick). Sollte der erste Klick eine Status Änderung bewirkt haben, dann bezöge sich der zweit Klick auf den neuen Status.

Beispiel

Die linke Maustaste ist für den Quelltext-Falt Bereich auf "Alle" eingestellt. Als Folge wird mit jedem Klick zwischen auf- und zugefaltet umgestellt.
Ohne die "Alle" Einstellung müsste man, wenn man versehentlich die falsche Textstelle gefaltet hat, einen Moment warten, bevor man sie mit einem weiteren Klick wieder entfalten kann. (Weil ein schneller zweiter Klick als Doppelklick zählt, und von der Einstellung "Einfach" ignoriert würde)

Anmerkungen
  • Nicht alle von ihnen werden auf allen Plattformen unterstützt.
  • Derzeit funktionieren Double, Triple und Quad nur für die Linke Taste, und nur für down Klicks.

Die Richtung des Klicks

Ein Mausklick besteht aus 2 Ereignissen: Dem Drücken der Taste ("Runter") und dem Loslassen ("Rauf")

Für jedes dieser zwei Ereignisse können eigene Einstellungen(Aktionen) vorgenommen werden.

Es ist auch Möglich dem Runter und Rauf Ereignis des selben Klicks zwei verschiedene Aktionen zuzuweisen. Diese werden dann in der entsprechenden Reihenfolge ausgeführt. Es sollte aber beachtet werden, dass sich die beiden Aktionen in unerwünschter Weise beeinflussen können.

Anmerkungen:

  • Einige Aktionen funktionieren nur dann richtig, wenn sie der korrekten Klick-Richtung zugewiesen sind.
    • 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)
    • Kontextmenü: On some WidgetSets this will only work reliable on mouse-up events

Die Umstelltasten

Das Maus-Verhalten kann verändert werden durch das Drücken der Shift, Alt oder Strg Taste (oder einer Kombination von ihnen).

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 Strg ignored
  • Left, Single, down Click with: Strg required pressed; Alt and Shift ignored
Now if you do this click, with both of Shift and Strg pressed, it would be unclear which of the 2 settings to use
Correct
  • Left, Single, down Click with: Shift required pressed; Strg required un-pressed; Alt ignored
  • Left, Single, down Click with: Strg 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: Strg required pressed; Shift required pressed; Alt ignored


Default Fallback

Es gibt eine Ausnahme von dieser Regel. 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.

Anmerkung

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 "strg" to copy the dragged text instead of moving it. However the use of "strg" 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 Strg 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)

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.
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.

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

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. (Implicit mouse up action)

"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. (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.

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

Note: GTK2: PopUp-Menu is recommended for use with ButtonUp only

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.
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.
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)

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

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

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.

Breakpoint Command

Toggle breakpoint on this line

Doppel bis Vierfach Klicks

  • Anmerkung: Dies funktioniert gegenwärtig nur mit der linken Maustaste.
  • Anmerkung: Those are currently only triggering Mouse Down

Wenn sie einem Doppel- oder Dreifachklick eine Aktion zuweisen, dann sollten sie daran denken, dass diese immer auch die Aktionen für einen Einfach- bzw. Doppelklick auslösen.

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.
  • Das ist kein Bug sondern das korrekte Verhalten.

Aktuelle Einschränkungen

  • Double/Triple/Quad click ist nur für die linke Maustaste und nur für Mouse down verfügbar
  • Double/Triple/Quad may depend on OS
  • GTK2: PopUp-Menu is recommended for use with ButtonUp only
  • OS-Depended: Some clicks may be used by the Window-Manager, and not reach the IDE at all

Useful Examples

Line Numbers in Gutter to select Lines

You can set the Line number part of the gutter to select text (full lines) instead of toggling a breakpoint. The Rest of the gutter (left to the line numbers) will still do breakpoints.

Context Node
Gutter => Line Numbers
Configuration
Left - Any - Down - All modifiers greyed
Action
Line Selection - Mode: Begin

Setting Click to "Any" instead of "Single" means that double-clicks do not accidentally toggle breakpoints.

Fold by clicking on Keyword ("begin")

Instead of folding a block by clicking on the [-] symbol in the gutter, you can fold a block by clicking on it's start keyword (e.g. "begin" or "$region"). this is useful if more than one block starts on the same line.

Context Node
Text
Configuration
Middle or Right - Single - Down - Ctrl or Alt
Action
Fold Code - Nodes: At Caret

Fold current block by clicking on vertical fold line

You can set a click on the vertical line ("|" below the [-] sign in the fold tree) to fold the enclosing node. This may be useful if the [-] is outside the visible area.

Context Node
Gutter => Fold Tree
Configuration
Left - Any - Down - All modifiers greyed
Action
Fold Code - Nodes: Current Node

This replaces the default "No Action" Entry. The default entry (as will the substitute) prevents Fold-Tree-Gutter clicks to toggle breakpoints.