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