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