|
From: <ob...@us...> - 2007-10-06 12:10:19
|
Revision: 335
http://iaeditor.svn.sourceforge.net/iaeditor/?rev=335&view=rev
Author: obi666
Date: 2007-10-06 05:10:23 -0700 (Sat, 06 Oct 2007)
Log Message:
-----------
Added scale labels on 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-02 12:01:30 UTC (rev 334)
+++ trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.cpp 2007-10-06 12:10:23 UTC (rev 335)
@@ -66,6 +66,7 @@
{
iaTimeLineCtrl::central_info = central_info;
scale = 10;
+ timeline_font = new wxFont (10, wxMODERN, wxNORMAL, wxBOLD);
central_info->Get3dView ()->AddProgressListener (this);
central_info->GetObjectsInfo ()->AddListener (this);
@@ -81,6 +82,7 @@
iaTimeLineCtrl::~iaTimeLineCtrl()
{
+ delete timeline_font;
}
void iaTimeLineCtrl::ObjectAdded (iEditorObject *obj)
{
@@ -124,8 +126,8 @@
memdc.SetBackground (wxBrush(GetBackgroundColour(), wxSOLID));
memdc.Clear();
- size_t b_cnt = GetSize ().x / timeline_bitmap.GetWidth () + 1;
- for (size_t i = 0; i < b_cnt; i++)
+ int b_cnt = GetSize ().x / timeline_bitmap.GetWidth () + 1;
+ for (int i = 0; i < b_cnt; i++)
{
memdc.DrawBitmap (timeline_bitmap, TIMELINE_START + i * timeline_bitmap.GetWidth (),
TIMELINE_YPOS, false);
@@ -136,6 +138,16 @@
memdc.SetBrush (wxBrush(wxColor (223, 211, 195, 125), wxCROSSDIAG_HATCH));
memdc.DrawRectangle (0,0, timeline_sim_ptr_pos, GetSize ().y);
+ memdc.SetFont(*timeline_font);
+ memdc.SetTextForeground (wxColor (122, 110, 90));
+ 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);
+ }
+
memdc.SelectObject (wxNullBitmap);
dc->DrawBitmap (dummy_bitmap, 0, 0);
}
Modified: trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.h
===================================================================
--- trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.h 2007-10-02 12:01:30 UTC (rev 334)
+++ trunk/src/apps/editor/gui/widgets/iaTimeLineCtrl.h 2007-10-06 12:10:23 UTC (rev 335)
@@ -63,14 +63,15 @@
protected:
int ScaleProgress (csTicks progress);
+ int GetScale (int i) {return i * scale;}
iEditorCentralInfo *central_info;
+ wxFont *timeline_font;
wxBitmap timeline_bitmap;
wxBitmap timeline_ptr_bitmap;
int timeline_anim_ptr_pos;
int timeline_sim_ptr_pos;
- //value of first 10 units on timeline
- int scale;
+ int scale; //value of first 10 units on timeline
DECLARE_EVENT_TABLE()
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|