[longomatch] Make the timeline thiner to handle more events



commit aeb9e893de051626d073c26e322d957926ef2c61
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Jul 4 19:31:36 2013 +0200

    Make the timeline thiner to handle more events

 LongoMatch.GUI/Gui/Base/TimeScaleBase.cs           |   13 ++++++++++---
 .../Gui/Component/TimelineLabelsWidget.cs          |    2 +-
 2 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Base/TimeScaleBase.cs b/LongoMatch.GUI/Gui/Base/TimeScaleBase.cs
index c5bb07f..70b8bfb 100644
--- a/LongoMatch.GUI/Gui/Base/TimeScaleBase.cs
+++ b/LongoMatch.GUI/Gui/Base/TimeScaleBase.cs
@@ -39,8 +39,9 @@ namespace LongoMatch.Gui.Base
        [System.ComponentModel.ToolboxItem(true)]
        public abstract class TimeScaleBase<T>: Gtk.DrawingArea where T:ITimelineNode
        {
-               const int SECTION_HEIGHT = 30;
+               const int SECTION_HEIGHT = 25;
                const double ALPHA = 0.6;
+               const int MIN_CHAR_WIDTH = 50;
 
                uint frames;
                uint pixelRatio=10;
@@ -77,6 +78,7 @@ namespace LongoMatch.Gui.Base
                        
                        layout =  new Pango.Layout(PangoContext);
                        layout.Wrap = Pango.WrapMode.Char;
+                       layout.Ellipsize = EllipsizeMode.End;
                        layout.Alignment = Pango.Alignment.Left;
                }
 
@@ -246,13 +248,18 @@ namespace LongoMatch.Gui.Base
 
                void DrawTimeNodesName() {
                        foreach(T tn in list) {
+                               int width;
+                               
                                if (filter != null && !filter.IsVisible (tn)) {
                                        continue;
                                }
-                               layout.Width = Pango.Units.FromPixels((int)(tn.TotalFrames/pixelRatio));
+                               width = (int)(tn.TotalFrames/pixelRatio);
+                               if (width < MIN_CHAR_WIDTH)
+                                       continue;
+                               layout.Width = Pango.Units.FromPixels(width);
                                layout.SetMarkup(tn.Name);
                                GdkWindow.DrawLayout(Style.TextGC(StateType.Normal),
-                                       (int)(tn.StartFrame/pixelRatio)+2, 2, layout);
+                                       (int)(tn.StartFrame/pixelRatio) + 2, 2, layout);
                        }
                }
 
diff --git a/LongoMatch.GUI/Gui/Component/TimelineLabelsWidget.cs 
b/LongoMatch.GUI/Gui/Component/TimelineLabelsWidget.cs
index 09571d4..41a88e2 100644
--- a/LongoMatch.GUI/Gui/Component/TimelineLabelsWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/TimelineLabelsWidget.cs
@@ -29,7 +29,7 @@ namespace LongoMatch.Gui.Component
 {
        public class TimelineLabelsWidget: Gtk.DrawingArea
        {
-               private const int SECTION_HEIGHT = 30;
+               private const int SECTION_HEIGHT = 25;
                private const int SECTION_WIDTH = 100;
                private const int LINE_WIDTH = 2;
                private double scroll;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]