Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- ./EpgTimer.orig/EpgTimer/EpgView/EpgViewPanel.cs 2011-08-01 01:19:34.000000000 +0900
- +++ ./EpgTimer/EpgTimer/EpgView/EpgViewPanel.cs 2013-04-14 04:54:24.320794400 +0900
- @@ -17,7 +17,8 @@
- public static readonly DependencyProperty BackgroundProperty =
- Panel.BackgroundProperty.AddOwner(typeof(EpgViewPanel));
- private List<ProgramViewItem> items;
- - private List<TextDrawItem> textDrawList = new List<TextDrawItem>();
- + //private List<TextDrawItem> textDrawList = new List<TextDrawItem>();
- + private Dictionary<ProgramViewItem, List<TextDrawItem>> textDrawDict = new Dictionary<ProgramViewItem, List<TextDrawItem>>();
- public Brush Background
- {
- set { SetValue(BackgroundProperty, value); }
- @@ -46,9 +47,9 @@
- protected void CreateDrawTextList()
- {
- - textDrawList.Clear();
- - textDrawList = null;
- - textDrawList = new List<TextDrawItem>();
- + textDrawDict.Clear();
- + textDrawDict = null;
- + textDrawDict = new Dictionary<ProgramViewItem, List<TextDrawItem>>();
- Matrix m = PresentationSource.FromVisual(Application.Current.MainWindow).CompositionTarget.TransformToDevice;
- this.VisualTextRenderingMode = TextRenderingMode.ClearType;
- @@ -134,15 +135,18 @@
- double sizeTitle = Settings.Instance.FontSizeTitle;
- foreach (ProgramViewItem info in Items)
- {
- + List<TextDrawItem> textDrawList = new List<TextDrawItem>();
- + textDrawDict[info] = textDrawList;
- if (info.Height > 2)
- {
- + /*
- if (info.Height < 4 + sizeTitle + 2)
- {
- //高さ足りない
- info.TitleDrawErr = true;
- continue;
- }
- -
- + */
- double totalHeight = 0;
- //分
- @@ -214,11 +218,13 @@
- protected bool RenderText(String text, ref List<TextDrawItem> textDrawList, GlyphTypeface glyphType, double fontSize, double maxWidth, double maxHeight, double x, double y, ref double useHeight, SolidColorBrush fontColor, Matrix m)
- {
- + /*
- if (maxHeight < fontSize + 2)
- {
- useHeight = 0;
- return false;
- }
- + */
- double totalHeight = 0;
- string[] lineText = text.Replace("\r", "").Split('\n');
- @@ -234,7 +240,7 @@
- double width = glyphType.AdvanceWidths[glyphIndex] * fontSize;
- if (totalWidth + width > maxWidth)
- {
- - if (totalHeight + fontSize > maxHeight)
- + if (totalHeight > maxHeight)
- {
- //次の行無理
- glyphIndex = glyphType.CharacterToGlyphMap['…'];
- @@ -292,14 +298,15 @@
- textDrawList.Add(item);
- }
- + /*
- //高さ確認
- - if (totalHeight + fontSize > maxHeight)
- + if (totalHeight + fontSize> maxHeight)
- {
- //これ以上は無理
- useHeight = totalHeight;
- return false;
- }
- -
- + */
- }
- useHeight = Math.Floor(totalHeight);
- return true;
- @@ -327,12 +334,17 @@
- if (info.Height > 2)
- {
- dc.DrawRectangle(info.ContentColor, null, new Rect(info.LeftPos + 1, info.TopPos + 1, info.Width - 2, info.Height - 2));
- + if (textDrawDict.ContainsKey(info))
- + {
- + dc.PushClip(new RectangleGeometry(new Rect(info.LeftPos + 1, info.TopPos + 1, info.Width - 2, info.Height - 2)));
- + foreach (TextDrawItem txtinfo in textDrawDict[info])
- + {
- + dc.DrawGlyphRun(txtinfo.FontColor, txtinfo.Text);
- + }
- + dc.Pop();
- + }
- }
- }
- - foreach (TextDrawItem info in textDrawList)
- - {
- - dc.DrawGlyphRun(info.FontColor, info.Text);
- - }
- }
- catch (Exception ex)
- {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement