1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2008 Blender Foundation.
17  * All rights reserved.
18  */
19 
20 /** \file
21  * \ingroup editors
22  */
23 
24 #pragma once
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 /* ----------------------------------------------------- */
31 
32 /* for animplayer */
33 typedef struct ScreenAnimData {
34   ARegion *region; /* do not read from this, only for comparing if region exists */
35   short redraws;
36   short flag;                 /* flags for playback */
37   int sfra;                   /* frame that playback was started from */
38   int nextfra;                /* next frame to go to (when ANIMPLAY_FLAG_USE_NEXT_FRAME is set) */
39   double lagging_frame_count; /* used for frame dropping */
40   bool from_anim_edit;        /* playback was invoked from animation editor */
41 } ScreenAnimData;
42 
43 /* for animplayer */
44 enum {
45   /* user-setting - frame range is played backwards */
46   ANIMPLAY_FLAG_REVERSE = (1 << 0),
47   /* temporary - playback just jumped to the start/end */
48   ANIMPLAY_FLAG_JUMPED = (1 << 1),
49   /* drop frames as needed to maintain framerate */
50   ANIMPLAY_FLAG_SYNC = (1 << 2),
51   /* don't drop frames (and ignore SCE_FRAME_DROP flag) */
52   ANIMPLAY_FLAG_NO_SYNC = (1 << 3),
53   /* use nextfra at next timer update */
54   ANIMPLAY_FLAG_USE_NEXT_FRAME = (1 << 4),
55 };
56 
57 /* ----------------------------------------------------- */
58 
59 #define REDRAW_FRAME_AVERAGE 8
60 
61 /* for playback framerate info
62  * stored during runtime as scene->fps_info
63  */
64 typedef struct ScreenFrameRateInfo {
65   double redrawtime;
66   double lredrawtime;
67   float redrawtimes_fps[REDRAW_FRAME_AVERAGE];
68   short redrawtime_index;
69 } ScreenFrameRateInfo;
70 
71 /* ----------------------------------------------------- */
72 
73 /* Enum for Action Zone Edges. Which edge of area is action zone. */
74 typedef enum {
75   /** Region located on the left, _right_ edge is action zone.
76    * Region minimized to the top left */
77   AE_RIGHT_TO_TOPLEFT,
78   /** Region located on the right, _left_ edge is action zone.
79    * Region minimized to the top right */
80   AE_LEFT_TO_TOPRIGHT,
81   /** Region located at the bottom, _top_ edge is action zone.
82    * Region minimized to the bottom right */
83   AE_TOP_TO_BOTTOMRIGHT,
84   /** Region located at the top, _bottom_ edge is action zone.
85    * Region minimized to the top left */
86   AE_BOTTOM_TO_TOPLEFT,
87 } AZEdge;
88 
89 typedef enum {
90   AZ_SCROLL_VERT,
91   AZ_SCROLL_HOR,
92 } AZScrollDirection;
93 
94 /* for editing areas/regions */
95 typedef struct AZone {
96   struct AZone *next, *prev;
97   ARegion *region;
98   int type;
99 
100   union {
101     /* region-azone, which of the edges (only for AZONE_REGION) */
102     AZEdge edge;
103     AZScrollDirection direction;
104   };
105   /* for draw */
106   short x1, y1, x2, y2;
107   /* for clip */
108   rcti rect;
109   /* for fade in/out */
110   float alpha;
111 } AZone;
112 
113 /** Action-Zone Type: #AZone.type */
114 enum {
115   /**
116    * Corner widgets for:
117    * - Splitting areas.
118    * - Swapping areas (Ctrl).
119    * - Copying the area into a new window (Shift).
120    */
121   AZONE_AREA = 1,
122   /**
123    * Use for region show/hide state:
124    * - When a region is collapsed, draw a handle to expose.
125    * - When a region is expanded, use the action zone to resize the region.
126    */
127   AZONE_REGION,
128   /**
129    * Used when in editor fullscreen draw a corner to return to normal mode.
130    */
131   AZONE_FULLSCREEN,
132   /**
133    * Hot-spot #AZone around scroll-bars to show/hide them.
134    * Only show the scroll-bars when the cursor is close.
135    */
136   AZONE_REGION_SCROLL,
137 };
138 
139 #ifdef __cplusplus
140 }
141 #endif
142