my log
[synfig.git] / synfig-studio / trunk / src / synfigapp / editmode.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file editmode.h
3 **      \brief Template Header
4 **
5 **      $Id: editmode.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
6 **
7 **      \legal
8 **      Copyright (c) 2002 Robert B. Quattlebaum Jr.
9 **
10 **      This software and associated documentation
11 **      are CONFIDENTIAL and PROPRIETARY property of
12 **      the above-mentioned copyright holder.
13 **
14 **      You may not copy, print, publish, or in any
15 **      other way distribute this software without
16 **      a prior written agreement with
17 **      the copyright holder.
18 **      \endlegal
19 */
20 /* ========================================================================= */
21
22 /* === S T A R T =========================================================== */
23
24 #ifndef __SYNFIG_EDITMODE_H
25 #define __SYNFIG_EDITMODE_H
26
27 /* === H E A D E R S ======================================================= */
28
29 /* === M A C R O S ========================================================= */
30
31 /* === T Y P E D E F S ===================================================== */
32
33 /* === C L A S S E S & S T R U C T S ======================================= */
34
35 namespace synfigapp {
36         
37 /*!     \enum EditMode
38 **      \brief \writeme
39 */
40 enum EditMode
41 {
42         MODE_NORMAL                     =0,                     //!< Normal editing mode. Place holder.
43
44         MODE_ANIMATE            =(1<<0),        //!< Animated editing mode.
45         MODE_ANIMATE_FUTURE     =(1<<1),        //!< Respect <i>future</i> keyframes
46         MODE_ANIMATE_PAST       =(1<<2),        //!< Respect <i>past</i> keyframes
47         MODE_ANIMATE_ALL        =(3<<1),        //!< Respect <i>all</i> keyframes
48
49         MODE_UNDEFINED          =(~0)   //!< Undefined Mode
50 }; // END of enum EditMode
51
52 //! Combine Flags
53 inline EditMode
54 operator|(const EditMode& lhs, const EditMode& rhs)
55 { return static_cast<EditMode>(int(lhs)|int(rhs)); }
56
57 //! Exclude Flags
58 inline EditMode
59 operator-(const EditMode& lhs, const EditMode& rhs)
60 { return static_cast<EditMode>(int(lhs)&~int(rhs)); }
61
62 inline EditMode&
63 operator|=(EditMode& lhs, const EditMode& rhs)
64 { *reinterpret_cast<int*>(&lhs)|=int(rhs); return lhs; }
65
66 //!     Flag Comparison. THIS IS NOT LESS-THAN-OR-EQUAL-TO.
67 /*!     This function will return true of all of the flags
68 **      in the \a rhs are set in the \a lhs */
69 inline EditMode
70 operator&(const EditMode& lhs, const EditMode& rhs)
71 { return static_cast<EditMode>(int(lhs)&int(rhs)); }
72
73 //!     Flag Comparison. THIS IS NOT LESS-THAN-OR-EQUAL-TO.
74 /*!     This function will return true of all of the flags
75 **      in the \a rhs are set in the \a lhs */
76 inline bool
77 operator<=(const EditMode& lhs, const EditMode& rhs)
78 { return lhs&rhs==int(rhs); }
79
80 }; // END if namespace synfigapp
81 /* === E N D =============================================================== */
82
83 #endif