Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / synfigstudio_0_61_07_rc1 / src / synfigapp / editmode.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file editmode.h
3 **      \brief Template Header
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **
10 **      This package is free software; you can redistribute it and/or
11 **      modify it under the terms of the GNU General Public License as
12 **      published by the Free Software Foundation; either version 2 of
13 **      the License, or (at your option) any later version.
14 **
15 **      This package is distributed in the hope that it will be useful,
16 **      but WITHOUT ANY WARRANTY; without even the implied warranty of
17 **      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 **      General Public License for more details.
19 **      \endlegal
20 */
21 /* ========================================================================= */
22
23 /* === S T A R T =========================================================== */
24
25 #ifndef __SYNFIG_EDITMODE_H
26 #define __SYNFIG_EDITMODE_H
27
28 /* === H E A D E R S ======================================================= */
29
30 /* === M A C R O S ========================================================= */
31
32 /* === T Y P E D E F S ===================================================== */
33
34 /* === C L A S S E S & S T R U C T S ======================================= */
35
36 namespace synfigapp {
37
38 /*!     \enum EditMode
39 **      \brief \writeme
40 */
41 enum EditMode
42 {
43         MODE_NORMAL                     =0,                     //!< Normal editing mode. Place holder.
44
45         MODE_ANIMATE            =(1<<0),        //!< Animated editing mode.
46         MODE_ANIMATE_FUTURE     =(1<<1),        //!< Respect <i>future</i> keyframes
47         MODE_ANIMATE_PAST       =(1<<2),        //!< Respect <i>past</i> keyframes
48         MODE_ANIMATE_ALL        =(3<<1),        //!< Respect <i>all</i> keyframes
49
50         MODE_UNDEFINED          =(~0)   //!< Undefined Mode
51 }; // END of enum EditMode
52
53 //! Combine Flags
54 inline EditMode
55 operator|(const EditMode& lhs, const EditMode& rhs)
56 { return static_cast<EditMode>(int(lhs)|int(rhs)); }
57
58 //! Exclude Flags
59 inline EditMode
60 operator-(const EditMode& lhs, const EditMode& rhs)
61 { return static_cast<EditMode>(int(lhs)&~int(rhs)); }
62
63 inline EditMode&
64 operator|=(EditMode& lhs, const EditMode& rhs)
65 { *reinterpret_cast<int*>(&lhs)|=int(rhs); return lhs; }
66
67 //!     Flag Comparison. THIS IS NOT LESS-THAN-OR-EQUAL-TO.
68 /*!     This function will return true of all of the flags
69 **      in the \a rhs are set in the \a lhs */
70 inline EditMode
71 operator&(const EditMode& lhs, const EditMode& rhs)
72 { return static_cast<EditMode>(int(lhs)&int(rhs)); }
73
74 //!     Flag Comparison. THIS IS NOT LESS-THAN-OR-EQUAL-TO.
75 /*!     This function will return true of all of the flags
76 **      in the \a rhs are set in the \a lhs */
77 inline bool
78 operator<=(const EditMode& lhs, const EditMode& rhs)
79 { return lhs&rhs==int(rhs); }
80
81 }; // END if namespace synfigapp
82 /* === E N D =============================================================== */
83
84 #endif