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