Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/pstatserver/pStatPianoRoll.I

Go to the documentation of this file.
00001 // Filename: pStatPianoRoll.I
00002 // Created by:  drose (18Jul00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 ////////////////////////////////////////////////////////////////////
00020 //     Function: PStatPianoRoll::set_horizontal_scale
00021 //       Access: Public
00022 //  Description: Changes the amount of time the width of the
00023 //               horizontal axis represents.  This may force a redraw.
00024 ////////////////////////////////////////////////////////////////////
00025 INLINE void PStatPianoRoll::
00026 set_horizontal_scale(float time_width) {
00027   if (_time_width != time_width) {
00028     _time_width = time_width;
00029     normal_guide_bars();
00030     force_redraw();
00031   }
00032 }
00033 
00034 ////////////////////////////////////////////////////////////////////
00035 //     Function: PStatPianoRoll::get_horizontal_scale
00036 //       Access: Public
00037 //  Description: Returns the amount of total time the width of the
00038 //               horizontal axis represents.
00039 ////////////////////////////////////////////////////////////////////
00040 INLINE float PStatPianoRoll::
00041 get_horizontal_scale() const {
00042   return _time_width;
00043 }
00044 
00045 ////////////////////////////////////////////////////////////////////
00046 //     Function: PStatPianoRoll::timestamp_to_pixel
00047 //       Access: Public
00048 //  Description: Converts a timestamp to a horizontal pixel offset.
00049 ////////////////////////////////////////////////////////////////////
00050 INLINE int PStatPianoRoll::
00051 timestamp_to_pixel(float time) const {
00052   return (int)((float)_xsize * (time - _start_time) / _time_width);
00053 }
00054 
00055 ////////////////////////////////////////////////////////////////////
00056 //     Function: PStatPianoRoll::pixel_to_timestamp
00057 //       Access: Public
00058 //  Description: Converts a horizontal pixel offset to a timestamp.
00059 ////////////////////////////////////////////////////////////////////
00060 INLINE float PStatPianoRoll::
00061 pixel_to_timestamp(int x) const {
00062   return _time_width * (float)x / (float)_xsize + _start_time;
00063 }

Generated on Fri May 2 03:21:37 2003 for Panda-Tool by doxygen1.3