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