From 0645c0ebbf15fa4e57b85805612533eb05165624 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Fri, 2 May 2008 18:03:44 -0500 Subject: [PATCH] Make zoom-fit menu item work. --- Timeline/TLE.fl | 5 +++-- Timeline/Timeline.C | 6 ++++++ Timeline/Timeline.H | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Timeline/TLE.fl b/Timeline/TLE.fl index 7100e5b..aca2f33 100644 --- a/Timeline/TLE.fl +++ b/Timeline/TLE.fl @@ -34,7 +34,7 @@ decl {\#include } {} decl {extern char *user_config_dir;} {global } -class TLE {open selected +class TLE {open } { decl {Fl_Color system_colors[3];} {public } @@ -114,7 +114,7 @@ free( path );} {} label {Non-DAW - Timeline} open xywh {577 94 1024 768} type Double resizable xclass {Non-DAW} visible } { - Fl_Menu_Bar menubar { + Fl_Menu_Bar menubar {open xywh {0 0 1024 25} } { Submenu {} { @@ -227,6 +227,7 @@ exit( 0 );} } MenuItem {} { label {&Fit} + callback {timeline->zoom_fit();} selected xywh {10 10 40 25} divider } MenuItem {} { diff --git a/Timeline/Timeline.C b/Timeline/Timeline.C index 5315d73..60a5fc6 100644 --- a/Timeline/Timeline.C +++ b/Timeline/Timeline.C @@ -1073,6 +1073,12 @@ Timeline::zoom ( float secs ) redraw(); } +void +Timeline::zoom_fit ( void ) +{ + zoom( _length / (float)sample_rate() ); +} + Track * Timeline::track_by_name ( const char *name ) { diff --git a/Timeline/Timeline.H b/Timeline/Timeline.H index 86a6062..fa97097 100644 --- a/Timeline/Timeline.H +++ b/Timeline/Timeline.H @@ -181,7 +181,7 @@ public: void zoom ( float secs ); void zoom_in ( void ); void zoom_out ( void ); - + void zoom_fit ( void ); private: