From 848e80d0a4f15b0860e9aeac822f1c2121debce3 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 1 Oct 2018 02:18:45 +0200 Subject: Move macros.h and remove unneeded macros --- src/include/CMakeLists.txt | 1 + src/include/README | 3 +++ src/include/macros.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 src/include/README create mode 100644 src/include/macros.h (limited to 'src/include') 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 + * + * 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 : -- cgit v1.2.3