38c0f2dfc1dd5a40de8fb32f706e7ef308715a06
[blender.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
38 #include "MEM_guardedalloc.h"
39
40 #include "BLI_blenlib.h"
41
42 #include "BKE_context.h"
43 #include "BKE_global.h"
44 #include "BKE_screen.h"
45
46 #include "ED_keyframing.h"
47 #include "ED_screen.h"
48 #include "ED_types.h"
49 #include "ED_util.h"
50
51 #include "WM_api.h"
52 #include "WM_types.h"
53
54 #include "BIF_gl.h"
55 #include "BIF_glutil.h"
56
57 #include "UI_interface.h"
58 #include "UI_resources.h"
59 #include "UI_view2d.h"
60
61 #include "ED_markers.h"
62
63 #include "time_intern.h"
64
65
66 /* ************************ header time area region *********************** */
67
68
69 static void do_time_redrawmenu(bContext *C, void *arg, int event)
70 {
71         SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C);
72         
73         if(event < 1001) {
74                 
75                 stime->redraws ^= event;
76                 /* update handler when it's running */
77 //              if(has_screenhandler(G.curscreen, SCREEN_HANDLER_ANIM))
78 //                      start_animated_screen(stime);
79         }
80         else {
81                 if(event==1001) {
82 //                      button(&CTX_data_scene(C)->r.frs_sec,1,120,"FPS:");
83                 }
84         }
85 }
86
87
88 static uiBlock *time_redrawmenu(bContext *C, ARegion *ar, void *arg_unused)
89 {
90         ScrArea *curarea= CTX_wm_area(C);
91         SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C);
92         Scene *scene= CTX_data_scene(C);
93         uiBlock *block;
94         short yco= 0, menuwidth=120, icon;
95         char str[32];
96         
97         block= uiBeginBlock(C, ar, "header time_redrawmenu", UI_EMBOSSP, UI_HELV);
98         uiBlockSetButmFunc(block, do_time_redrawmenu, NULL);
99         
100         if(stime->redraws & TIME_LEFTMOST_3D_WIN) icon= ICON_CHECKBOX_HLT;
101         else icon= ICON_CHECKBOX_DEHLT;
102         uiDefIconTextBut(block, BUTM, 1, icon, "Top-Left 3D Window",     0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_LEFTMOST_3D_WIN, "");
103         
104         if(stime->redraws & TIME_ALL_3D_WIN) icon= ICON_CHECKBOX_HLT;
105         else icon= ICON_CHECKBOX_DEHLT;
106         uiDefIconTextBut(block, BUTM, 1, icon, "All 3D Windows",         0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_3D_WIN, "");
107         
108         if(stime->redraws & TIME_ALL_ANIM_WIN) icon= ICON_CHECKBOX_HLT;
109         else icon= ICON_CHECKBOX_DEHLT;
110         uiDefIconTextBut(block, BUTM, 1, icon, "Animation Windows",      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_ANIM_WIN, "");
111         
112         if(stime->redraws & TIME_ALL_BUTS_WIN) icon= ICON_CHECKBOX_HLT;
113         else icon= ICON_CHECKBOX_DEHLT;
114         uiDefIconTextBut(block, BUTM, 1, icon, "Buttons Windows",        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_BUTS_WIN, "");
115         
116         if(stime->redraws & TIME_ALL_IMAGE_WIN) icon= ICON_CHECKBOX_HLT;
117         else icon= ICON_CHECKBOX_DEHLT;
118         uiDefIconTextBut(block, BUTM, 1, icon, "Image Windows",      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_ALL_IMAGE_WIN, "");
119         
120         /* Add sequencer only redraw*/
121         if(stime->redraws & TIME_SEQ) icon= ICON_CHECKBOX_HLT;
122         else icon= ICON_CHECKBOX_DEHLT;
123         uiDefIconTextBut(block, BUTM, 1, icon, "Sequencer Windows",      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_SEQ, "");
124         
125         uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
126         
127         sprintf(str, "Set Frames/Sec (%d/%f)", scene->r.frs_sec, scene->r.frs_sec_base);
128         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, str,       0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1001, "");
129         
130         uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
131         
132         if(stime->redraws & TIME_CONTINUE_PHYSICS) icon= ICON_CHECKBOX_HLT;
133         else icon= ICON_CHECKBOX_DEHLT;
134         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");
135         
136         
137         if(curarea->headertype==HEADERTOP) {
138                 uiBlockSetDirection(block, UI_DOWN);
139         }
140         else {
141                 uiBlockSetDirection(block, UI_TOP);
142                 uiBlockFlipOrder(block);
143         }
144         
145         uiTextBoundsBlock(block, 50);
146         uiEndBlock(C, block);
147         
148         return block;
149 }
150
151 static void do_time_viewmenu(bContext *C, void *arg, int event)
152 {
153         ScrArea *curarea= CTX_wm_area(C);
154         SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C);
155         View2D *v2d= UI_view2d_fromcontext_rwin(C);
156         Scene *scene= CTX_data_scene(C);
157         int first;
158         
159         switch(event) {
160                 case 2: /* Play Back Animation */
161                         //if(!has_screenhandler(G.curscreen, SCREEN_HANDLER_ANIM))
162                         //      start_animated_screen(stime);
163                         break;
164                 case 3: /* View All */
165                         if(v2d) {
166                                 first= scene->r.sfra;
167                                 if(first >= scene->r.efra) first= scene->r.efra;
168                                         v2d->cur.xmin=v2d->tot.xmin= (float)first-2;
169                                 v2d->cur.xmax=v2d->tot.xmax= (float)scene->r.efra+2;
170                         
171                                 ED_area_tag_redraw(curarea);
172                         }
173                         break;
174                 case 4: /* Maximize Window */
175                         /* using event B_FULL */
176                         break;
177                 case 5: /* show time or frames */
178                         stime->flag ^= TIME_DRAWFRAMES;
179                         ED_area_tag_redraw(curarea);
180                         break;
181                 case 6:
182                         //nextprev_marker(1);
183                         break;
184                 case 7:
185                         //nextprev_marker(-1);
186                         break;
187                 case 8:
188                         //nextprev_timeline_key(1);
189                         break;
190                 case 9:
191                         //nextprev_timeline_key(-1);
192                         break;
193                 case 10:
194                         //timeline_frame_to_center();
195                         break;
196                 case 11:
197                         if(v2d) {
198                                 v2d->flag ^= V2D_VIEWSYNC_SCREEN_TIME;
199                                 UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_SET);
200                         }
201                         break;
202                 case 12: /* only show keyframes from selected data */
203                         stime->flag ^= TIME_ONLYACTSEL;
204                         ED_area_tag_redraw(curarea);
205                         break;
206         }
207 }
208
209 static uiBlock *time_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
210 {
211         ScrArea *curarea= CTX_wm_area(C);
212         SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C);
213         View2D *v2d= UI_view2d_fromcontext_rwin(C);
214         uiBlock *block;
215         short yco= 0, menuwidth=120;
216         
217         block= uiBeginBlock(C, ar, "time_viewmenu", UI_EMBOSSP, UI_HELV);
218         uiBlockSetButmFunc(block, do_time_viewmenu, NULL);
219         
220         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation", 0, yco-=20,
221                                          menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
222         
223         uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
224         
225         if(stime->flag & TIME_DRAWFRAMES)
226                 uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Seconds|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
227         else 
228                 uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Frames|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
229         
230         uiDefIconTextBut(block, BUTM, 1, (stime->flag & TIME_ONLYACTSEL)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT, 
231                                          "Only Selected Data Keys|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
232         
233         uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
234         
235         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump To Next Marker|PageUp", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
236         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump To Prev Marker|PageDown", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
237         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump To Next Key|Ctrl PageUp", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
238         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump To Prev Key|Ctrl PageDown", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, "");
239         
240         uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
241         
242         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center View|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
243         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
244         uiDefIconTextBut(block, BUTM, 1, (v2d->flag & V2D_VIEWSYNC_SCREEN_TIME)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT, 
245                                          "Lock Time to Other Windows|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
246         
247 //      if (!curarea->full) 
248 //              uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
249 //      else 
250 //              uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
251         
252         if(curarea->headertype==HEADERTOP) {
253                 uiBlockSetDirection(block, UI_DOWN);
254         }
255         else {
256                 uiBlockSetDirection(block, UI_TOP);
257                 uiBlockFlipOrder(block);
258         }
259         
260         uiTextBoundsBlock(block, 50);
261         uiEndBlock(C, block);
262         
263         return block;
264 }
265
266 static void do_time_framemenu(bContext *C, void *arg, int event)
267 {
268         Scene *scene= CTX_data_scene(C);
269
270         switch(event) {
271                 case 1: /*Set as Start */
272                         if (scene->r.psfra) {
273                                 if (scene->r.pefra < scene->r.cfra)
274                                         scene->r.pefra= scene->r.cfra;
275                                 scene->r.psfra= scene->r.cfra;
276                         }                               
277                         else
278                                 scene->r.sfra = scene->r.cfra;
279                         WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
280                         break;
281                 case 2: /* Set as End */
282                         if (scene->r.psfra) {
283                                 if (scene->r.cfra < scene->r.psfra)
284                                         scene->r.psfra= scene->r.cfra;
285                                 scene->r.pefra= scene->r.cfra;
286                         }                               
287                         else
288                                 scene->r.efra = scene->r.cfra;
289                         WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
290                         break;
291                 case 3: /* Rename Marker */
292                         //rename_marker();
293                         break;
294         }
295 }
296
297 static uiBlock *time_framemenu(bContext *C, ARegion *ar, void *arg_unused)
298 {
299         ScrArea *curarea= CTX_wm_area(C);
300         uiBlock *block;
301         short yco= 0, menuwidth=120;
302         
303         block= uiBeginBlock(C, ar, "time_framemenu", UI_EMBOSSP, UI_HELV);
304         uiBlockSetButmFunc(block, do_time_framemenu, NULL);
305
306         uiDefIconTextButO(block, BUTM, "MARKER_OT_add", WM_OP_EXEC_REGION_WIN, ICON_BLANK1, "Add Marker",
307                                           0, yco-=2, menuwidth, 19, "");
308         uiDefIconTextButO(block, BUTM, "MARKER_OT_duplicate", WM_OP_EXEC_REGION_WIN, ICON_BLANK1, "Duplicate Marker",
309                                           0, yco-=20, menuwidth, 19, "");
310         uiDefIconTextButO(block, BUTM, "MARKER_OT_delete", WM_OP_EXEC_REGION_WIN, ICON_BLANK1, "Delete Marker",
311                                           0, yco-=20, menuwidth, 19, "");
312         
313         uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
314         
315         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Name Marker|Ctrl M",
316                                          0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
317         uiDefIconTextButO(block, BUTM, "MARKER_OT_move", WM_OP_INVOKE_REGION_WIN, ICON_BLANK1, "Grab/Move Marker",
318                                           0, yco-=20, menuwidth, 19, "");
319         
320         uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
321         
322         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set as Start|S",
323                                          0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
324         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set as End|E",
325                                          0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
326         
327         if(curarea->headertype==HEADERTOP) {
328                 uiBlockSetDirection(block, UI_DOWN);
329         }
330         else {
331                 uiBlockSetDirection(block, UI_TOP);
332                 uiBlockFlipOrder(block);
333         }
334         
335         uiTextBoundsBlock(block, 50);
336         uiEndBlock(C, block);
337         
338         return block;
339 }
340
341
342 #define B_REDRAWALL             750
343 #define B_TL_REW                751
344 #define B_TL_PLAY               752
345 #define B_TL_FF                 753
346 #define B_TL_PREVKEY    754
347 #define B_TL_NEXTKEY    755
348 #define B_TL_STOP               756
349 #define B_TL_PREVIEWON  757
350 #define B_TL_INSERTKEY  758
351 #define B_TL_DELETEKEY  759
352
353 #define B_FLIPINFOMENU 0
354 #define B_NEWFRAME 0
355 #define AUTOKEY_ON 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, UI_HELV);
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-2, xmax-3, 24, "");
449                 xco+= xmax;
450                 xmax= GetButStringLength("Frame");
451                 uiDefPulldownBut(block, time_framemenu, sa, 
452                                                  "Frame", xco, yco-2, xmax-3, 24, "");
453                 xco+= xmax;
454                 
455                 xmax= GetButStringLength("Playback");
456                 uiDefPulldownBut(block, time_redrawmenu, sa, 
457                                                  "Playback", xco, yco-2, xmax-3, 24, "");
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         uiDefIconButBitS(block, TOG, AUTOKEY_ON, REDRAWINFO, ICON_REC,
532                                          xco, yco, XIC, YIC, &(scene->autokey_mode), 0, 0, 0, 0, "Automatic keyframe insertion for Objects and Bones");
533         xco+= XIC;
534         if (scene->autokey_mode & AUTOKEY_ON) {
535                 uiDefButS(block, MENU, REDRAWINFO, 
536                                   "Auto-Keying Mode %t|Add/Replace Keys%x3|Replace Keys %x5", 
537                                   xco, yco, (int)3.5*XIC, YIC, &(scene->autokey_mode), 0, 1, 0, 0, 
538                                   "Mode of automatic keyframe insertion for Objects and Bones");
539                 xco+= (4*XIC);
540         }
541         
542         xco+= 16;
543         
544         
545         menustr= ANIM_build_keyingsets_menu(&scene->keyingsets, 0);
546         uiDefButI(block, MENU, B_DIFF, 
547                                   menustr, 
548                                   xco, yco, (int)5.5*XIC, YIC, &(scene->active_keyingset), 0, 1, 0, 0, 
549                                   "Active Keying Set (i.e. set of channels to Insert Keyframes for)");
550         MEM_freeN(menustr);
551         xco+= (6*XIC);
552         
553         uiDefIconBut(block, BUT, B_TL_DELETEKEY, ICON_KEY_DEHLT,
554                                  xco, yco, XIC, YIC, 0, 0, 0, 0, 0, "Delete Keyframe for the context of the largest area (ALTKEY-IKEY)");
555         xco+= XIC+4;
556         uiDefIconBut(block, BUT, B_TL_INSERTKEY, ICON_KEY_HLT,
557                                  xco, yco, XIC, YIC, 0, 0, 0, 0, 0, "Insert Keyframe for the context of the largest area (IKEY)");
558         xco+= XIC+4;
559         
560         xco+= 16;
561         
562         uiDefIconButBitI(block, TOG, TIME_WITH_SEQ_AUDIO, B_DIFF, ICON_SPEAKER,
563                                          xco, yco, XIC, YIC, &(stime->redraws), 0, 0, 0, 0, "Play back and sync with audio from Sequence Editor");
564         
565         
566         /* always as last  */
567         UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, (int)(ar->v2d.tot.ymax-ar->v2d.tot.ymin));
568         
569         uiEndBlock(C, block);
570         uiDrawBlock(C, block);
571 }
572
573