c751fbd8029d69110635769ab57c712552de4351
[blender-staging.git] / source / blender / editors / space_time / time_header.c
1 /**
2  * $Id$
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version. 
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  * The Original Code is Copyright (C) 2008 Blender Foundation.
21  * All rights reserved.
22  *
23  * The Original Code is: all of this file.
24  *
25  * Contributor(s): none yet.
26  *
27  * ***** END GPL LICENSE BLOCK *****
28  */
29
30 #include <string.h>
31 #include <stdio.h>
32
33 #include "DNA_space_types.h"
34 #include "DNA_scene_types.h"
35 #include "DNA_screen_types.h"
36 #include "DNA_windowmanager_types.h"
37 #include "DNA_userdef_types.h"
38
39 #include "MEM_guardedalloc.h"
40
41 #include "BLI_blenlib.h"
42
43 #include "BKE_context.h"
44 #include "BKE_global.h"
45 #include "BKE_screen.h"
46
47 #include "ED_keyframing.h"
48 #include "ED_screen.h"
49 #include "ED_types.h"
50 #include "ED_util.h"
51
52 #include "WM_api.h"
53 #include "WM_types.h"
54
55 #include "BIF_gl.h"
56 #include "BIF_glutil.h"
57
58 #include "UI_interface.h"
59 #include "UI_resources.h"
60 #include "UI_view2d.h"
61
62 #include "ED_markers.h"
63
64 #include "time_intern.h"
65
66
67 /* ************************ header time area region *********************** */
68
69
70 static void do_time_redrawmenu(bContext *C, void *arg, int event)
71 {
72         SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C);
73         
74         if(event < 1001) {
75                 
76                 stime->redraws ^= event;
77                 /* update handler when it's running */
78 //              if(has_screenhandler(G.curscreen, SCREEN_HANDLER_ANIM))
79 //                      start_animated_screen(stime);
80         }
81         else {
82                 if(event==1001) {
83 //                      button(&CTX_data_scene(C)->r.frs_sec,1,120,"FPS:");
84                 }
85         }
86 }
87
88
89 static uiBlock *time_redrawmenu(bContext *C, ARegion *ar, void *arg_unused)
90 {
91         ScrArea *curarea= CTX_wm_area(C);
92         SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C);
93         Scene *scene= CTX_data_scene(C);
94         uiBlock *block;
95         short yco= 0, menuwidth=120, icon;
96         char str[32];
97         
98         block= uiBeginBlock(C, ar, "header time_redrawmenu", UI_EMBOSSP);
99         uiBlockSetButmFunc(block, do_time_redrawmenu, NULL);
100         
101         if(stime->redraws & TIME_LEFTMOST_3D_WIN) icon= ICON_CHECKBOX_HLT;
102         else icon= ICON_CHECKBOX_DEHLT;
103         uiDefIconTextBut(block, BUTM, 1, icon, "Top-Left 3D Window",     0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_LEFTMOST_3D_WIN, "");
104         
105         if(stime->redraws & TIME_ALL_3D_WIN) icon= ICON_CHECKBOX_HLT;
106         else icon= ICON_CHECKBOX_DEHLT;
107         uiDefIconTextBut(block, BUTM, 1, icon, "All 3D Windows",         0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_3D_WIN, "");
108         
109         if(stime->redraws & TIME_ALL_ANIM_WIN) icon= ICON_CHECKBOX_HLT;
110         else icon= ICON_CHECKBOX_DEHLT;
111         uiDefIconTextBut(block, BUTM, 1, icon, "Animation Windows",      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_ANIM_WIN, "");
112         
113         if(stime->redraws & TIME_ALL_BUTS_WIN) icon= ICON_CHECKBOX_HLT;
114         else icon= ICON_CHECKBOX_DEHLT;
115         uiDefIconTextBut(block, BUTM, 1, icon, "Buttons Windows",        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_BUTS_WIN, "");
116         
117         if(stime->redraws & TIME_ALL_IMAGE_WIN) icon= ICON_CHECKBOX_HLT;
118         else icon= ICON_CHECKBOX_DEHLT;
119         uiDefIconTextBut(block, BUTM, 1, icon, "Image Windows",      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_IMAGE_WIN, "");
120         
121         /* Add sequencer only redraw*/
122         if(stime->redraws & TIME_SEQ) icon= ICON_CHECKBOX_HLT;
123         else icon= ICON_CHECKBOX_DEHLT;
124         uiDefIconTextBut(block, BUTM, 1, icon, "Sequencer Windows",      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_SEQ, "");
125         
126         uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
127         
128         sprintf(str, "Set Frames/Sec (%d/%f)", scene->r.frs_sec, scene->r.frs_sec_base);
129         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, str,       0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1001, "");
130         
131         uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
132         
133         if(stime->redraws & TIME_CONTINUE_PHYSICS) icon= ICON_CHECKBOX_HLT;
134         else icon= ICON_CHECKBOX_DEHLT;
135         uiDefIconTextBut(block, BUTM, 1, icon, "Continue Physics",      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_CONTINUE_PHYSICS, "During playblack, continue physics simulations regardless of the frame number");
136         
137         
138         if(curarea->headertype==HEADERTOP) {
139                 uiBlockSetDirection(block, UI_DOWN);
140         }
141         else {
142                 uiBlockSetDirection(block, UI_TOP);
143                 uiBlockFlipOrder(block);
144         }
145         
146         uiTextBoundsBlock(block, 50);
147         uiEndBlock(C, block);
148         
149         return block;
150 }
151
152 static void do_time_viewmenu(bContext *C, void *arg, int event)
153 {
154         ScrArea *curarea= CTX_wm_area(C);
155         SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C);
156         View2D *v2d= UI_view2d_fromcontext_rwin(C);
157         Scene *scene= CTX_data_scene(C);
158         int first;
159         
160         switch(event) {
161                 case 2: /* Play Back Animation */
162                         //if(!has_screenhandler(G.curscreen, SCREEN_HANDLER_ANIM))
163                         //      start_animated_screen(stime);
164                         break;
165                 case 3: /* View All */
166                         if(v2d) {
167                                 first= scene->r.sfra;
168                                 if(first >= scene->r.efra) first= scene->r.efra;
169                                         v2d->cur.xmin=v2d->tot.xmin= (float)first-2;
170                                 v2d->cur.xmax=v2d->tot.xmax= (float)scene->r.efra+2;
171                         
172                                 ED_area_tag_redraw(curarea);
173                         }
174                         break;
175                 case 4: /* Maximize Window */
176                         /* using event B_FULL */
177                         break;
178                 case 5: /* show time or frames */
179                         stime->flag ^= TIME_DRAWFRAMES;
180                         ED_area_tag_redraw(curarea);
181                         break;
182                 case 6:
183                         //nextprev_marker(1);
184                         break;
185                 case 7:
186                         //nextprev_marker(-1);
187                         break;
188                 case 8:
189                         //nextprev_timeline_key(1);
190                         break;
191                 case 9:
192                         //nextprev_timeline_key(-1);
193                         break;
194                 case 10:
195                         //timeline_frame_to_center();
196                         break;
197                 case 11:
198                         if(v2d) {
199                                 v2d->flag ^= V2D_VIEWSYNC_SCREEN_TIME;
200                                 UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_SET);
201                         }
202                         break;
203                 case 12: /* only show keyframes from selected data */
204                         stime->flag ^= TIME_ONLYACTSEL;
205                         ED_area_tag_redraw(curarea);
206                         break;
207         }
208 }
209
210 static uiBlock *time_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
211 {
212         ScrArea *curarea= CTX_wm_area(C);
213         SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C);
214         View2D *v2d= UI_view2d_fromcontext_rwin(C);
215         uiBlock *block;
216         short yco= 0, menuwidth=120;
217         
218         block= uiBeginBlock(C, ar, "time_viewmenu", UI_EMBOSSP);
219         uiBlockSetButmFunc(block, do_time_viewmenu, NULL);
220         
221         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation", 0, yco-=20,
222                                          menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
223         
224         uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
225         
226         if(stime->flag & TIME_DRAWFRAMES)
227                 uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Seconds|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
228         else 
229                 uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Frames|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
230         
231         uiDefIconTextBut(block, BUTM, 1, (stime->flag & TIME_ONLYACTSEL)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT, 
232                                          "Only Selected Data Keys|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
233         
234         uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
235         
236         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump To Next Marker|PageUp", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
237         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump To Prev Marker|PageDown", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
238         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump To Next Key|Ctrl PageUp", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
239         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump To Prev Key|Ctrl PageDown", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
240         
241         uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
242         
243         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center View|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
244         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
245         uiDefIconTextBut(block, BUTM, 1, (v2d->flag & V2D_VIEWSYNC_SCREEN_TIME)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT, 
246                                          "Lock Time to Other Windows|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
247         
248 //      if (!curarea->full) 
249 //              uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
250 //      else 
251 //              uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
252         
253         if(curarea->headertype==HEADERTOP) {
254                 uiBlockSetDirection(block, UI_DOWN);
255         }
256         else {
257                 uiBlockSetDirection(block, UI_TOP);
258                 uiBlockFlipOrder(block);
259         }
260         
261         uiTextBoundsBlock(block, 50);
262         uiEndBlock(C, block);
263         
264         return block;
265 }
266
267 static void do_time_framemenu(bContext *C, void *arg, int event)
268 {
269         Scene *scene= CTX_data_scene(C);
270
271         switch(event) {
272                 case 1: /*Set as Start */
273                         if (scene->r.psfra) {
274                                 if (scene->r.pefra < scene->r.cfra)
275                                         scene->r.pefra= scene->r.cfra;
276                                 scene->r.psfra= scene->r.cfra;
277                         }                               
278                         else
279                                 scene->r.sfra = scene->r.cfra;
280                         WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
281                         break;
282                 case 2: /* Set as End */
283                         if (scene->r.psfra) {
284                                 if (scene->r.cfra < scene->r.psfra)
285                                         scene->r.psfra= scene->r.cfra;
286                                 scene->r.pefra= scene->r.cfra;
287                         }                               
288                         else
289                                 scene->r.efra = scene->r.cfra;
290                         WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
291                         break;
292                 case 3: /* Rename Marker */
293                         //rename_marker();
294                         break;
295         }
296 }
297
298 static uiBlock *time_framemenu(bContext *C, ARegion *ar, void *arg_unused)
299 {
300         ScrArea *curarea= CTX_wm_area(C);
301         uiBlock *block;
302         short yco= 0, menuwidth=120;
303         
304         block= uiBeginBlock(C, ar, "time_framemenu", UI_EMBOSSP);
305         uiBlockSetButmFunc(block, do_time_framemenu, NULL);
306
307         uiDefIconTextButO(block, BUTM, "MARKER_OT_add", WM_OP_EXEC_REGION_WIN, ICON_BLANK1, "Add Marker",
308                                           0, yco-=2, menuwidth, 19, "");
309         uiDefIconTextButO(block, BUTM, "MARKER_OT_duplicate", WM_OP_EXEC_REGION_WIN, ICON_BLANK1, "Duplicate Marker",
310                                           0, yco-=20, menuwidth, 19, "");
311         uiDefIconTextButO(block, BUTM, "MARKER_OT_delete", WM_OP_EXEC_REGION_WIN, ICON_BLANK1, "Delete Marker",
312                                           0, yco-=20, menuwidth, 19, "");
313         
314         uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
315         
316         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Name Marker|Ctrl M",
317                                          0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
318         uiDefIconTextButO(block, BUTM, "MARKER_OT_move", WM_OP_INVOKE_REGION_WIN, ICON_BLANK1, "Grab/Move Marker",
319                                           0, yco-=20, menuwidth, 19, "");
320         
321         uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
322         
323         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set as Start|S",
324                                          0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
325         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set as End|E",
326                                          0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
327         
328         if(curarea->headertype==HEADERTOP) {
329                 uiBlockSetDirection(block, UI_DOWN);
330         }
331         else {
332                 uiBlockSetDirection(block, UI_TOP);
333                 uiBlockFlipOrder(block);
334         }
335         
336         uiTextBoundsBlock(block, 50);
337         uiEndBlock(C, block);
338         
339         return block;
340 }
341
342
343 #define B_REDRAWALL             750
344 #define B_TL_REW                751
345 #define B_TL_PLAY               752
346 #define B_TL_FF                 753
347 #define B_TL_PREVKEY    754
348 #define B_TL_NEXTKEY    755
349 #define B_TL_STOP               756
350 #define B_TL_PREVIEWON  757
351 #define B_TL_INSERTKEY  758
352 #define B_TL_DELETEKEY  759
353
354 #define B_FLIPINFOMENU 0
355 #define B_NEWFRAME 0
356 #define B_DIFF 0
357
358
359 void do_time_buttons(bContext *C, void *arg, int event)
360 {
361 //      SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C);
362         Scene *scene= CTX_data_scene(C);
363         
364         switch(event) {
365                 case B_REDRAWALL:
366                         WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
367                         break;
368                 case B_NEWFRAME:
369                         WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
370                         break;
371                 case B_TL_REW:
372                         scene->r.cfra= PSFRA;
373                         WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
374                         //update_for_newframe();
375                         break;
376                 case B_TL_PLAY:
377                         ED_screen_animation_timer(C, 1);
378                         break;
379                 case B_TL_STOP:
380                         ED_screen_animation_timer(C, 0);
381                         break;
382                 case B_TL_FF:
383                         /* end frame */
384                         scene->r.cfra= PEFRA;
385                         WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
386                         //update_for_newframe();
387                         break;
388                 case B_TL_PREVKEY:
389                         /* previous keyframe */
390                         //nextprev_timeline_key(-1);
391                         break;
392                 case B_TL_NEXTKEY:
393                         /* next keyframe */
394                         //nextprev_timeline_key(1);
395                         break;
396                         
397                 case B_TL_PREVIEWON:
398                         if (scene->r.psfra) {
399                                 /* turn on preview range */
400                                 scene->r.psfra= scene->r.sfra;
401                                 scene->r.pefra= scene->r.efra;
402                         }
403                         else {
404                                 /* turn off preview range */
405                                 scene->r.psfra= 0;
406                                 scene->r.pefra= 0;
407                         }
408                         //BIF_undo_push("Set anim-preview range");
409                         WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
410                         break;
411                         
412                 case B_TL_INSERTKEY:
413                         /* insert keyframe */
414                         //common_insertkey();
415                         //allqueue(REDRAWTIME, 1);
416                         break;
417                 case B_TL_DELETEKEY:
418                         /* delete keyframe */
419                         //common_deletekey();
420                         //allqueue(REDRAWTIME, 1);
421                         break;
422         }
423 }
424
425
426 void time_header_buttons(const bContext *C, ARegion *ar)
427 {
428         ScrArea *sa= CTX_wm_area(C);
429         SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C);
430         Scene *scene= CTX_data_scene(C);
431         uiBlock *block;
432         int xco, yco= 3;
433         char *menustr= NULL;
434         
435         block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS);
436         uiBlockSetHandleFunc(block, do_time_buttons, NULL);
437         
438         xco= ED_area_header_standardbuttons(C, block, yco);
439         
440         if((sa->flag & HEADER_NO_PULLDOWN)==0) {
441                 int xmax;
442                 
443                 /* pull down menus */
444                 uiBlockSetEmboss(block, UI_EMBOSSP);
445                 
446                 xmax= GetButStringLength("View");
447                 uiDefPulldownBut(block, time_viewmenu, sa, 
448                                                  "View", xco, yco, xmax-3, 20, "");
449                 xco+= xmax;
450                 xmax= GetButStringLength("Frame");
451                 uiDefPulldownBut(block, time_framemenu, sa, 
452                                                  "Frame", xco, yco, xmax-3, 20, "");
453                 xco+= xmax;
454                 
455                 xmax= GetButStringLength("Playback");
456                 uiDefPulldownBut(block, time_redrawmenu, sa, 
457                                                  "Playback", xco, yco, xmax-3, 20, "");
458                 xco+= xmax;
459         }
460         
461         uiBlockSetEmboss(block, UI_EMBOSS);
462         
463         uiBlockBeginAlign(block);
464         
465         uiDefButI(block, TOG, B_TL_PREVIEWON,"PR",      
466                           xco,yco, XIC*2, YIC,
467                           &scene->r.psfra,0, 1, 0, 0,
468                           "Show settings for frame range of animation preview");
469         
470         xco += XIC*2;
471         
472         if (scene->r.psfra) {
473                 uiDefButI(block, NUM, B_REDRAWALL,"Start:",     
474                                   xco,yco, (int)4.5*XIC, YIC,
475                                   &scene->r.psfra,MINFRAMEF, MAXFRAMEF, 0, 0,
476                                   "The start frame of the animation preview (inclusive)");
477                 
478                 xco += (int)(4.5*XIC);
479                 
480                 uiDefButI(block, NUM, B_REDRAWALL,"End:",       
481                                   xco,yco, (int)4.5*XIC,YIC,
482                                   &scene->r.pefra,(float)PSFRA, MAXFRAMEF, 0, 0,
483                                   "The end frame of the animation preview (inclusive)");
484         }
485         else {
486                 uiDefButI(block, NUM, B_REDRAWALL,"Start:",     
487                                   xco,yco, (int)4.5*XIC, YIC,
488                                   &scene->r.sfra,MINFRAMEF, MAXFRAMEF, 0, 0,
489                                   "The start frame of the animation (inclusive)");
490                 
491                 xco += (short)(4.5*XIC);
492                 
493                 uiDefButI(block, NUM, B_REDRAWALL,"End:",       
494                                   xco,yco, (int)4.5*XIC,YIC,
495                                   &scene->r.efra,(float)SFRA, MAXFRAMEF, 0, 0,
496                                   "The end frame of the animation (inclusive)");
497         }
498         uiBlockEndAlign(block);
499         
500         xco += (short)(4.5 * XIC + 16);
501         
502         uiDefButI(block, NUM, B_NEWFRAME, "",
503                           xco,yco, (int)3.5*XIC,YIC,
504                           &(scene->r.cfra), MINFRAMEF, MAXFRAMEF, 0, 0,
505                           "Displays Current Frame of animation");
506         
507         xco += (short)(3.5 * XIC + 16);
508         
509         uiDefIconBut(block, BUT, B_TL_REW, ICON_REW,
510                                  xco, yco, XIC, YIC, 0, 0, 0, 0, 0, "Skip to Start frame (Shift DownArrow)");
511         xco+= XIC+4;
512         uiDefIconBut(block, BUT, B_TL_PREVKEY, ICON_PREV_KEYFRAME,
513                                  xco, yco, XIC, YIC, 0, 0, 0, 0, 0, "Skip to previous keyframe (Ctrl PageDown)");
514         xco+= XIC+4;
515         
516         if(CTX_wm_screen(C)->animtimer)
517                 uiDefIconBut(block, BUT, B_TL_STOP, ICON_PAUSE,
518                                          xco, yco, XIC, YIC, 0, 0, 0, 0, 0, "Stop Playing Timeline");
519         else       
520                 uiDefIconBut(block, BUT, B_TL_PLAY, ICON_PLAY,
521                                          xco, yco, XIC, YIC, 0, 0, 0, 0, 0, "Play Timeline ");
522         
523         xco+= XIC+4;
524         uiDefIconBut(block, BUT, B_TL_NEXTKEY, ICON_NEXT_KEYFRAME,
525                                  xco, yco, XIC, YIC, 0, 0, 0, 0, 0, "Skip to next keyframe (Ctrl PageUp)");
526         xco+= XIC+4;
527         uiDefIconBut(block, BUT, B_TL_FF, ICON_FF,
528                                  xco, yco, XIC, YIC, 0, 0, 0, 0, 0, "Skip to End frame (Shift UpArrow)");
529         xco+= XIC+8;
530         
531         uiBlockBeginAlign(block);
532                 uiDefIconButBitS(block, TOG, AUTOKEY_ON, B_REDRAWALL, ICON_REC,
533                                                  xco, yco, XIC, YIC, &(scene->autokey_mode), 0, 0, 0, 0, "Automatic keyframe insertion for Objects and Bones");
534                 xco+= XIC;
535                 if (IS_AUTOKEY_ON(scene)) {
536                         uiDefButS(block, MENU, B_REDRAWALL, 
537                                           "Auto-Keying Mode %t|Add/Replace Keys%x3|Replace Keys %x5", 
538                                           xco, yco, (int)5.5*XIC, YIC, &(scene->autokey_mode), 0, 1, 0, 0, 
539                                           "Mode of automatic keyframe insertion for Objects and Bones");
540                         xco+= (6*XIC);
541                 }
542         uiBlockEndAlign(block);
543         
544         xco+= 16;
545         
546         
547         menustr= ANIM_build_keyingsets_menu(&scene->keyingsets, 0);
548         uiDefButI(block, MENU, B_DIFF, 
549                                   menustr, 
550                                   xco, yco, (int)5.5*XIC, YIC, &(scene->active_keyingset), 0, 1, 0, 0, 
551                                   "Active Keying Set (i.e. set of channels to Insert Keyframes for)");
552         MEM_freeN(menustr);
553         xco+= (6*XIC);
554         
555         uiBlockBeginAlign(block);
556                 uiDefIconButO(block, BUT, "ANIM_OT_delete_keyframe", WM_OP_INVOKE_REGION_WIN, ICON_KEY_DEHLT, xco,yco,XIC,YIC, "Delete Keyframes for the Active Keying Set (Alt-I)");
557                 xco += XIC;
558                 uiDefIconButO(block, BUT, "ANIM_OT_insert_keyframe", WM_OP_INVOKE_REGION_WIN, ICON_KEY_HLT, xco,yco,XIC,YIC, "Insert Keyframes for the Active Keying Set (I)");
559                 xco += XIC;
560         uiBlockEndAlign(block);
561         
562         xco+= 16;
563         
564         uiDefIconButBitI(block, TOG, TIME_WITH_SEQ_AUDIO, B_DIFF, ICON_SPEAKER,
565                                          xco, yco, XIC, YIC, &(stime->redraws), 0, 0, 0, 0, "Play back and sync with audio from Sequence Editor");
566         
567         
568         /* always as last  */
569         UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, (int)(ar->v2d.tot.ymax-ar->v2d.tot.ymin));
570         
571         uiEndBlock(C, block);
572         uiDrawBlock(C, block);
573 }
574
575