Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::Modifiers Namespace Reference

Classes

class  Modifier
 A class to represent ways functionality is driven by shift modifiers. More...
 

Typedefs

using KeyMask = int
 
using Trigger = int
 

Enumerations

enum  Key : KeyMask {
  NEVER = -2 , NOT_SET = -1 , ALWAYS = 0 , SHIFT = GDK_SHIFT_MASK ,
  CTRL = GDK_CONTROL_MASK , ALT = GDK_ALT_MASK , SUPER = GDK_SUPER_MASK , HYPER = GDK_HYPER_MASK ,
  META = GDK_META_MASK , ALL_MODS = SHIFT | CTRL | ALT | SUPER | HYPER | META
}
 
enum  Triggers : Trigger {
  NO_CATEGORY , CANVAS , SELECT , MOVE ,
  TRANSFORM , NODE_TOOL , BOOLEANS_TOOL , CLICK = 32 ,
  DRAG = 64 , SCROLL = 128
}
 
enum class  Type {
  CANVAS_PAN_Y , CANVAS_PAN_X , CANVAS_ZOOM , CANVAS_ROTATE ,
  SELECT_ADD_TO , SELECT_IN_GROUPS , SELECT_TOUCH_PATH , SELECT_ALWAYS_BOX ,
  SELECT_REMOVE_FROM , SELECT_FORCE_DRAG , SELECT_CYCLE , MOVE_CONFINE ,
  MOVE_INCREMENT , MOVE_SNAPPING , TRANS_CONFINE , TRANS_INCREMENT ,
  TRANS_OFF_CENTER , TRANS_SNAPPING , BOOL_SHIFT , NODE_GROW_LINEAR ,
  NODE_INVERT , NODE_REMOVE_FROM , NODE_GROW_SPATIAL
}
 This anonymous enum is used to provide a list of the Shifts. More...
 

Functions

std::string generate_label (KeyMask mask, std::string sep)
 Generate a label for any modifier keys based on the mask.
 
unsigned long calculate_weight (KeyMask mask)
 Calculate the weight of this mask based on how many bits are set.
 
void responsive_tooltip (MessageContext *message_context, KeyEvent const &event, int num_args,...)
 Set the responsive tooltip for this tool, given the selected types.
 
int add_keyval (int state, int keyval, bool release)
 Add or remove the GDK keyval to the button state if it's one of the keys that define the key mask.
 

Typedef Documentation

◆ KeyMask

using Inkscape::Modifiers::KeyMask = typedef int

Definition at line 26 of file modifiers.h.

◆ Trigger

using Inkscape::Modifiers::Trigger = typedef int

Definition at line 27 of file modifiers.h.

Enumeration Type Documentation

◆ Key

Enumerator
NEVER 
NOT_SET 
ALWAYS 
SHIFT 
CTRL 
ALT 
SUPER 
HYPER 
META 
ALL_MODS 

Definition at line 29 of file modifiers.h.

◆ Triggers

Enumerator
NO_CATEGORY 
CANVAS 
SELECT 
MOVE 
TRANSFORM 
NODE_TOOL 
BOOLEANS_TOOL 
CLICK 
DRAG 
SCROLL 

Definition at line 43 of file modifiers.h.

◆ Type

enum class Inkscape::Modifiers::Type
strong

This anonymous enum is used to provide a list of the Shifts.

Enumerator
CANVAS_PAN_Y 
CANVAS_PAN_X 
CANVAS_ZOOM 
CANVAS_ROTATE 
SELECT_ADD_TO 
SELECT_IN_GROUPS 
SELECT_TOUCH_PATH 
SELECT_ALWAYS_BOX 
SELECT_REMOVE_FROM 
SELECT_FORCE_DRAG 
SELECT_CYCLE 
MOVE_CONFINE 
MOVE_INCREMENT 
MOVE_SNAPPING 
TRANS_CONFINE 
TRANS_INCREMENT 
TRANS_OFF_CENTER 
TRANS_SNAPPING 
BOOL_SHIFT 
NODE_GROW_LINEAR 
NODE_INVERT 
NODE_REMOVE_FROM 
NODE_GROW_SPATIAL 

Definition at line 56 of file modifiers.h.

Function Documentation

◆ add_keyval()

int Inkscape::Modifiers::add_keyval ( int  state,
int  keyval,
bool  release 
)

Add or remove the GDK keyval to the button state if it's one of the keys that define the key mask.

Useful for PRESS and RELEASE events.

Parameters
state- The GDK button state from an event
keyval- The GDK keyval from a key press/release event
release- Boolean, if true the keyval is removed instead
Returns
a new state including the requested change.

Definition at line 335 of file modifiers.cpp.

Referenced by Inkscape::Modifiers::Modifier::active().

◆ calculate_weight()

unsigned long Inkscape::Modifiers::calculate_weight ( KeyMask  mask)

Calculate the weight of this mask based on how many bits are set.

Parameters
mask- The Modifier Mask such as {SHIFT & CTRL}
Returns
count of all modifiers being pressed (or excluded)

Definition at line 273 of file modifiers.cpp.

Referenced by Inkscape::Modifiers::Modifier::Modifier(), Inkscape::Modifiers::Modifier::set_keys(), and Inkscape::Modifiers::Modifier::set_user().

◆ generate_label()

std::string Inkscape::Modifiers::generate_label ( KeyMask  mask,
std::string  sep 
)

Generate a label for any modifier keys based on the mask.

Parameters
mask- The Modifier Mask such as {SHIFT & CTRL}
Returns
a string of the keys needed for this mask to be true.

Definition at line 233 of file modifiers.cpp.

References ALT, CTRL, HYPER, META, NEVER, NOT_SET, SHIFT, and SUPER.

Referenced by Inkscape::Modifiers::Modifier::get_config_user_and(), Inkscape::Modifiers::Modifier::get_config_user_not(), and Inkscape::Modifiers::Modifier::get_label().

◆ responsive_tooltip()

void Inkscape::Modifiers::responsive_tooltip ( MessageContext message_context,
KeyEvent const &  event,
int  num_args,
  ... 
)

Set the responsive tooltip for this tool, given the selected types.

Parameters
message_context- The desktop's message context for showing tooltips
event- The current event status (which keys are pressed)
num_args- Number of Modifier::Type arguments to follow.
...- One or more Modifier::Type arguments.

Definition at line 290 of file modifiers.cpp.

References ALT, CTRL, Inkscape::Modifiers::Modifier::get(), name, SHIFT, Inkscape::UI::Tools::sp_event_show_modifier_tip(), va_end(), and va_start().