diff options
| author | Eduard Braun <eduard.braun2@gmx.de> | 2018-10-01 00:18:45 +0000 |
|---|---|---|
| committer | Eduard Braun <eduard.braun2@gmx.de> | 2018-10-01 22:50:13 +0000 |
| commit | 848e80d0a4f15b0860e9aeac822f1c2121debce3 (patch) | |
| tree | bd5ae746e583ce614eacc273a9bd96cf1c49f836 /src/include | |
| parent | Remove #include "config.h" wherever possible (diff) | |
| download | inkscape-848e80d0a4f15b0860e9aeac822f1c2121debce3.tar.gz inkscape-848e80d0a4f15b0860e9aeac822f1c2121debce3.zip | |
Move macros.h and remove unneeded macros
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/include/README | 3 | ||||
| -rw-r--r-- | src/include/macros.h | 42 |
3 files changed, 46 insertions, 0 deletions
diff --git a/src/include/CMakeLists.txt b/src/include/CMakeLists.txt index 7a089b86c..f63079edf 100644 --- a/src/include/CMakeLists.txt +++ b/src/include/CMakeLists.txt @@ -1,5 +1,6 @@ set(include_SRC gtkmm_version.h + macros.h ) add_inkscape_source("${io_SRC}") diff --git a/src/include/README b/src/include/README new file mode 100644 index 000000000..336b3e20d --- /dev/null +++ b/src/include/README @@ -0,0 +1,3 @@ +Configuration, defines, macros and similar that do not fit anywhere else. + +Try to keep this to a minimum and move to more suitable locations whenever possible. diff --git a/src/include/macros.h b/src/include/macros.h new file mode 100644 index 000000000..71a81848f --- /dev/null +++ b/src/include/macros.h @@ -0,0 +1,42 @@ +#ifndef SEEN_MACROS_H +#define SEEN_MACROS_H + +/** + * Useful macros for inkscape + * + * Author: + * Lauris Kaplinski <lauris@kaplinski.com> + * + * Copyright (C) 2002 Lauris Kaplinski + * + * Released under GNU GPL + */ + +// I'm of the opinion that this file should be removed, so I will in the future take the necessary steps to wipe it out. +// Macros are not in general bad, but these particular ones are rather ugly. Especially that sp_round one. --Liam + +#define sp_signal_disconnect_by_data(o,d) g_signal_handlers_disconnect_matched(o, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, d) + +#define sp_round(v,m) (((v) < 0.0) ? ((ceil((v) / (m) - 0.5)) * (m)) : ((floor((v) / (m) + 0.5)) * (m))) + + +// keyboard modifiers in an event +#define MOD__SHIFT(event) ((event)->key.state & GDK_SHIFT_MASK) +#define MOD__CTRL(event) ((event)->key.state & GDK_CONTROL_MASK) +#define MOD__ALT(event) ((event)->key.state & GDK_MOD1_MASK) +#define MOD__SHIFT_ONLY(event) (((event)->key.state & GDK_SHIFT_MASK) && !((event)->key.state & GDK_CONTROL_MASK) && !((event)->key.state & GDK_MOD1_MASK)) +#define MOD__CTRL_ONLY(event) (!((event)->key.state & GDK_SHIFT_MASK) && ((event)->key.state & GDK_CONTROL_MASK) && !((event)->key.state & GDK_MOD1_MASK)) +#define MOD__ALT_ONLY(event) (!((event)->key.state & GDK_SHIFT_MASK) && !((event)->key.state & GDK_CONTROL_MASK) && ((event)->key.state & GDK_MOD1_MASK)) + +#endif // SEEN_MACROS_H + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : |
