|
From: <ob...@us...> - 2007-10-06 12:58:52
|
Revision: 336
http://iaeditor.svn.sourceforge.net/iaeditor/?rev=336&view=rev
Author: obi666
Date: 2007-10-06 05:58:56 -0700 (Sat, 06 Oct 2007)
Log Message:
-----------
Improved time-line scale visualization.
Modified Paths:
--------------
trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.cpp
trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.h
Removed Paths:
-------------
trunk/data/gui/icons/Icon_timeline.png
Deleted: trunk/data/gui/icons/Icon_timeline.png
===================================================================
(Binary files differ)
Modified: trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.cpp
===================================================================
--- trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.cpp 2007-10-06 12:10:23 UTC (rev 335)
+++ trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.cpp 2007-10-06 12:58:56 UTC (rev 336)
@@ -65,7 +65,6 @@
wxWindow(parent, id, pos, size, style, name)
{
iaTimeLineCtrl::central_info = central_info;
- scale = 10;
timeline_font = new wxFont (10, wxMODERN, wxNORMAL, wxBOLD);
central_info->Get3dView ()->AddProgressListener (this);
@@ -73,11 +72,11 @@
wxString icons_path = wxString (central_info->GetIconsPath ().c_str (), wxConvUTF8);
- timeline_bitmap = wxBitmap (icons_path + _T("Icon_timeline.png"),
- wxBITMAP_TYPE_PNG);
timeline_ptr_bitmap = wxBitmap (icons_path + _T("Icon_timeline_pointer.png"), wxBITMAP_TYPE_PNG);
timeline_anim_ptr_pos = 0;
timeline_sim_ptr_pos = 0;
+ unit_size = 8;
+ unit_value = 1;
}
iaTimeLineCtrl::~iaTimeLineCtrl()
@@ -126,11 +125,18 @@
memdc.SetBackground (wxBrush(GetBackgroundColour(), wxSOLID));
memdc.Clear();
- int b_cnt = GetSize ().x / timeline_bitmap.GetWidth () + 1;
+ memdc.SetPen (*wxBLACK_PEN);
+ memdc.SetBrush (*wxBLACK_BRUSH);
+ int b_cnt = GetSize ().x / unit_size / 10 + 1;
for (int i = 0; i < b_cnt; i++)
{
- memdc.DrawBitmap (timeline_bitmap, TIMELINE_START + i * timeline_bitmap.GetWidth (),
- TIMELINE_YPOS, false);
+ int curr_scale = i * 10;
+ int curr_scale_pos = GetScalePos (curr_scale);
+ memdc.DrawRectangle (curr_scale_pos, GetSize ().y - 18, 2, 18);
+ for (size_t i = 0; i < 10; i++)
+ {
+ memdc.DrawRectangle (GetScalePos (curr_scale++), GetSize ().y - 5, 2, 5);
+ }
}
memdc.DrawBitmap (timeline_ptr_bitmap, timeline_anim_ptr_pos,
GetSize ().y - timeline_ptr_bitmap.GetHeight (), true);
@@ -143,14 +149,18 @@
for (int i = 0; i < b_cnt; i++)
{
wxString label;
- label.sprintf ("%d", GetScale (i));
- memdc.DrawText (label, TIMELINE_START + i * timeline_bitmap.GetWidth ()
- - timeline_font->GetPointSize () * label.Length () / 2 - timeline_font->GetPointSize () / 4, 0);
+ label.sprintf ("%d", GetScaleValue (i * 10));
+ memdc.DrawText (label, GetScalePos (i * 10) - timeline_font->GetPointSize () * label.Length () / 2 -
+ timeline_font->GetPointSize () / 4, 0);
}
memdc.SelectObject (wxNullBitmap);
dc->DrawBitmap (dummy_bitmap, 0, 0);
}
+int iaTimeLineCtrl::GetScalePos (int i)
+{
+ return TIMELINE_START + i * unit_size;
+}
void iaTimeLineCtrl::AnimationLockChanged (bool lock)
{
if (lock)
Modified: trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.h
===================================================================
--- trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.h 2007-10-06 12:10:23 UTC (rev 335)
+++ trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.h 2007-10-06 12:58:56 UTC (rev 336)
@@ -63,15 +63,16 @@
protected:
int ScaleProgress (csTicks progress);
- int GetScale (int i) {return i * scale;}
+ int GetScaleValue (int i) {return i * unit_value;}
+ int GetScalePos (int i);
iEditorCentralInfo *central_info;
wxFont *timeline_font;
- wxBitmap timeline_bitmap;
wxBitmap timeline_ptr_bitmap;
int timeline_anim_ptr_pos;
int timeline_sim_ptr_pos;
- int scale; //value of first 10 units on timeline
+ int unit_value; //value of one unit on timeline
+ int unit_size; //size of one unit on timeline
DECLARE_EVENT_TABLE()
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|