|
From: <ob...@us...> - 2007-10-07 13:28:07
|
Revision: 339
http://iaeditor.svn.sourceforge.net/iaeditor/?rev=339&view=rev
Author: obi666
Date: 2007-10-07 06:28:09 -0700 (Sun, 07 Oct 2007)
Log Message:
-----------
Added rescaling feature for time-line.
Modified Paths:
--------------
trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.cpp
trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.h
Modified: trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.cpp
===================================================================
--- trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.cpp 2007-10-06 14:51:49 UTC (rev 338)
+++ trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.cpp 2007-10-07 13:28:09 UTC (rev 339)
@@ -102,10 +102,27 @@
timeline_sim_ptr_pos = 0;
Refresh ();
}
+void iaTimeLineCtrl::Rescale ()
+{
+ //first try to shrink space between units
+ unit_size -= 1;
+
+ //if we can't shrink the space more, we will rescale labels itself
+ if (unit_size < 5)
+ {
+ unit_size = 8;
+ unit_value *= 2;
+ }
+}
void iaTimeLineCtrl::SimulatorProgressChanged (csTicks progress)
{
int prev_pos = timeline_sim_ptr_pos;
timeline_sim_ptr_pos = GetUnitPos (GetUnit (progress));
+ if (timeline_sim_ptr_pos > GetSize ().x - 20)
+ {
+ Rescale ();
+ timeline_sim_ptr_pos = GetUnitPos (GetUnit (progress));
+ }
if (prev_pos == timeline_sim_ptr_pos)
return;
Modified: trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.h
===================================================================
--- trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.h 2007-10-06 14:51:49 UTC (rev 338)
+++ trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.h 2007-10-07 13:28:09 UTC (rev 339)
@@ -67,8 +67,11 @@
protected:
int GetUnitPos (int i);
- int GetUnit (int value) {return value / unit_value;}
+ float GetUnit (int value) {return value / (float)unit_value;}
int GetUnitValue (int i) {return i * unit_value;}
+
+ /// Rescale timeline
+ void Rescale ();
iEditorCentralInfo *central_info;
wxFont *timeline_font;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|