protected override void CreateDrawTextListMain(List <List <Tuple <Brush, GlyphRun> > > textDrawLists) { var ItemFontNormal = ItemFontCache.ItemFont(Settings.Instance.TunerFontName, false); var ItemFontTitle = ItemFontCache.ItemFont(Settings.Instance.TunerFontNameService, Settings.Instance.TunerFontBoldService); EpgSetting set = Settings.Instance.EpgSettingList.FirstOrDefault(s => s.ApplyReplacePatternTuner); var DictionaryTitle = set != null?CommonManager.GetReplaceDictionaryTitle(set) : null; bool recSettingInfo = PopUpMode == true ? Settings.Instance.TunerPopupRecinfo : false; bool noWrap = PopUpMode == true ? false : Settings.Instance.TunerServiceNoWrap; double sizeTitle = Settings.Instance.TunerFontSizeService; double sizeMin = Math.Max(sizeTitle - 1, Math.Min(sizeTitle, Settings.Instance.TunerFontSize)); double sizeNormal = Settings.Instance.TunerFontSize; double indentTitle = recSettingInfo ? 0 : sizeMin *CulcRenderWidth("0", ItemFontNormal) * (2 + sizeTitle / sizeMin); double indentNormal = Settings.Instance.TunerTitleIndent ? indentTitle : 0; Brush colorNormal = Settings.BrushCache.CustTunerTextColor; //録画中のものを後で描画する Items = Items.Cast <TunerReserveViewItem>().OrderBy(info => info.Data.IsOnRec()).ToList(); foreach (TunerReserveViewItem info in Items) { var textDrawList = new List <Tuple <Brush, GlyphRun> >(); textDrawLists.Add(textDrawList); Rect drawRect = TextRenderRect(info); double useHeight = 0; //追加情報の表示 if (recSettingInfo == true) { var resItem = new ReserveItem(info.Data); string text = info.Status; if (text != "") { useHeight = sizeNormal / 5 + RenderText(textDrawList, text, ItemFontNormal, sizeNormal, drawRect, 0, 0, resItem.StatusColor); } text = resItem.StartTimeShort; text += "\r\n" + "優先度 : " + resItem.Priority; text += "\r\n" + "録画モード : " + resItem.RecMode; useHeight += sizeNormal / 2 + RenderText(textDrawList, text, ItemFontNormal, sizeNormal, drawRect, 0, useHeight, info.ServiceColor); } else { //分のみ RenderText(textDrawList, info.Data.StartTime.ToString("mm"), ItemFontNormal, sizeMin, drawRect, 0, 0, info.ServiceColor); } //サービス名 string serviceName = info.Data.StationName + "(" + CommonManager.ConvertNetworkNameText(info.Data.OriginalNetworkID) + ")"; serviceName = CommonManager.ReplaceText(serviceName, DictionaryTitle); useHeight += sizeTitle / 3 + RenderText(textDrawList, serviceName, ItemFontTitle, sizeTitle, drawRect, indentTitle, useHeight, info.ServiceColor, noWrap); //番組名 if (useHeight < drawRect.Height) { string title = CommonManager.ReplaceText(info.Data.Title.TrimEnd(), DictionaryTitle); if (title != "") { useHeight += sizeNormal / 3 + RenderText(textDrawList, title, ItemFontNormal, sizeNormal, drawRect, indentNormal, useHeight, colorNormal); } } SaveMaxRenderHeight(useHeight); } }
protected override void SetPopup(object item) { var viewInfo = (ReserveViewItem)item; var resItem = new ReserveItem(viewInfo.ReserveInfo); popupItem.Background = viewInfo.BackColorTuner; Canvas.SetLeft(popupItem, Math.Floor(viewInfo.LeftPos)); Canvas.SetTop(popupItem, Math.Floor(viewInfo.TopPos)); popupItem.Width = Math.Ceiling(viewInfo.Width + 1); popupItem.MinHeight = Math.Ceiling(viewInfo.Height + 1); //popupItemTextArea.Margin = new Thickness(2, -1, 0, 0); popupItemTextArea.Margin = new Thickness(1, -1, 5, 1); double sizeTitle = Settings.Instance.TunerFontSizeService; double sizeNormal = Settings.Instance.TunerFontSize; double indentTitle = Math.Floor((Settings.Instance.TunerPopupRecinfo == false || Settings.Instance.TunerTitleIndent == true) ? sizeNormal * 1.7 : 2); double indentNormal = Math.Floor(Settings.Instance.TunerTitleIndent == true ? indentTitle : 2); var fontTitle = new FontFamily(Settings.Instance.TunerFontNameService); var fontNormal = new FontFamily(Settings.Instance.TunerFontName); FontWeight weightTitle = Settings.Instance.TunerFontBoldService == true ? FontWeights.Bold : FontWeights.Normal; SolidColorBrush colorTitle = Settings.Instance.TunerColorModeUse == true ? viewInfo.ForeColorPriTuner : CommonManager.Instance.CustTunerServiceColor; SolidColorBrush colorNormal = CommonManager.Instance.CustTunerTextColor; //録画中は枠をかえる popupItem.BorderBrush = viewInfo.BorderBrushTuner; //追加情報の表示 if (Settings.Instance.TunerPopupRecinfo == true) { timeText.Visibility = Visibility.Visible; recInfoText.Visibility = Visibility.Visible; minText.Visibility = Visibility.Collapsed; //'録画中'を表示 statusText.Text = viewInfo.StatusTuner; statusText.Visibility = Visibility.Collapsed; if (statusText.Text != "") { statusText.Visibility = Visibility.Visible; statusText.FontFamily = fontNormal; statusText.FontSize = sizeNormal; //statusText.FontWeight = FontWeights.Normal; statusText.Foreground = CommonManager.Instance.StatRecForeColor; minText.Margin = new Thickness(1, 1, 0, 4); statusText.LineHeight = Math.Max(Settings.Instance.TunerFontHeight, sizeNormal + 2); } timeText.Text = resItem.StartTimeShort; timeText.FontFamily = fontNormal; timeText.FontSize = sizeNormal; timeText.Foreground = colorTitle; timeText.Margin = new Thickness(1, 1, 0, 2); timeText.LineHeight = Math.Max(Settings.Instance.TunerFontHeight, sizeNormal + 2); recInfoText.Text = "優先度 : " + resItem.Priority + "\r\n" + "録画モード : " + resItem.RecMode; recInfoText.FontFamily = fontNormal; recInfoText.FontSize = sizeNormal; //recInfoText.FontWeight = FontWeights.Normal; recInfoText.Foreground = colorTitle; recInfoText.Margin = new Thickness(2 + indentTitle, 0, 2, 4); recInfoText.LineHeight = Math.Max(Settings.Instance.TunerFontHeight, sizeNormal + 2); } else { statusText.Visibility = Visibility.Collapsed; timeText.Visibility = Visibility.Collapsed; recInfoText.Visibility = Visibility.Collapsed; minText.Visibility = Visibility.Visible; minText.Text = viewInfo.ReserveInfo.StartTime.Minute.ToString("d02"); minText.FontFamily = fontNormal; minText.FontSize = sizeNormal; minText.VerticalAlignment = VerticalAlignment.Center; //minText.FontWeight = FontWeights.Normal; minText.Foreground = colorTitle; minText.Margin = new Thickness(1, 0, 0, 2); minText.LineHeight = Settings.Instance.TunerFontHeight; } var titletext = resItem.ServiceName + "(" + resItem.NetworkName + ")"; titleText.Text = Regex.Replace(titletext, ".", "$0\u200b"); titleText.FontFamily = fontTitle; titleText.FontSize = sizeTitle; titleText.FontWeight = weightTitle; titleText.Foreground = colorTitle; titleText.VerticalAlignment = VerticalAlignment.Center; titleText.Margin = new Thickness(2 + indentTitle, 1, 0, 2); titleText.LineHeight = Math.Max(Settings.Instance.TunerFontHeightService, sizeTitle + 2); //必ず文字単位で折り返すためにZWSPを挿入 (\\w を使うと記号の間にZWSPが入らない) infoText.Text = Regex.Replace(resItem.EventName, ".", "$0\u200b"); //infoText.Text = resItem.EventName; infoText.FontFamily = fontNormal; infoText.FontSize = sizeNormal; //infoText.FontWeight = FontWeights.Normal; infoText.Foreground = colorNormal; infoText.Margin = new Thickness(2 + indentNormal, 0, 0, 2); infoText.LineHeight = Math.Max(Settings.Instance.TunerFontHeight, sizeNormal + 2); }
protected override void SetPopup(ViewPanelItemBase item) { base.SetPopup(item); var viewInfo = (ReserveViewItem)item; var resItem = new ReserveItem(viewInfo.ReserveInfo); popupItem.Background = viewInfo.BackColorTuner; popupItemTextArea.Margin = new Thickness(1, -1, 5, 1); double sizeTitle = Settings.Instance.TunerFontSizeService; double sizeNormal = Settings.Instance.TunerFontSize; double indentTitle = Math.Floor((Settings.Instance.TunerPopupRecinfo == false || Settings.Instance.TunerTitleIndent == true) ? sizeNormal * 1.7 : 2); double indentNormal = Math.Floor(Settings.Instance.TunerTitleIndent == true ? indentTitle : 2); var fontTitle = new FontFamily(Settings.Instance.TunerFontNameService); var fontNormal = new FontFamily(Settings.Instance.TunerFontName); FontWeight weightTitle = Settings.Instance.TunerFontBoldService == true ? FontWeights.Bold : FontWeights.Normal; Brush colorTitle = Settings.Instance.TunerColorModeUse == true ? viewInfo.ForeColorPriTuner : CommonManager.Instance.CustTunerServiceColor; Brush colorNormal = CommonManager.Instance.CustTunerTextColor; //録画中は枠をかえる popupItem.BorderBrush = viewInfo.BorderBrushTuner; //追加情報の表示 if (Settings.Instance.TunerPopupRecinfo == true) { timeText.Visibility = Visibility.Visible; recInfoText.Visibility = Visibility.Visible; minText.Visibility = Visibility.Collapsed; //'録画中'を表示 statusText.Text = viewInfo.StatusTuner; statusText.Visibility = Visibility.Collapsed; if (statusText.Text != "") { statusText.Visibility = Visibility.Visible; statusText.FontFamily = fontNormal; statusText.FontSize = sizeNormal; //statusText.FontWeight = FontWeights.Normal; statusText.Foreground = CommonManager.Instance.StatRecForeColor; minText.Margin = new Thickness(1, 1, 0, 4); statusText.LineHeight = Math.Max(Settings.Instance.TunerFontHeight, sizeNormal + 2); } timeText.Text = resItem.StartTimeShort; timeText.FontFamily = fontNormal; timeText.FontSize = sizeNormal; timeText.Foreground = colorTitle; timeText.Margin = new Thickness(1, 1, 0, 2); timeText.LineHeight = Math.Max(Settings.Instance.TunerFontHeight, sizeNormal + 2); recInfoText.Text = "優先度 : " + resItem.Priority + "\r\n" + "録画モード : " + resItem.RecMode; recInfoText.FontFamily = fontNormal; recInfoText.FontSize = sizeNormal; //recInfoText.FontWeight = FontWeights.Normal; recInfoText.Foreground = colorTitle; recInfoText.Margin = new Thickness(2 + indentTitle, 0, 2, 4); recInfoText.LineHeight = Math.Max(Settings.Instance.TunerFontHeight, sizeNormal + 2); } else { statusText.Visibility = Visibility.Collapsed; timeText.Visibility = Visibility.Collapsed; recInfoText.Visibility = Visibility.Collapsed; minText.Visibility = Visibility.Visible; minText.Text = viewInfo.ReserveInfo.StartTime.Minute.ToString("d02"); minText.FontFamily = fontNormal; minText.FontSize = sizeNormal; //minText.FontWeight = FontWeights.Normal; minText.Foreground = colorTitle; minText.Margin = new Thickness(1, 1, 0, 0); minText.LineHeight = Settings.Instance.TunerFontHeight; } var titletext = resItem.ServiceName + "(" + resItem.NetworkName + ")"; titleText.Text = Regex.Replace(titletext, ".", "$0\u200b"); titleText.FontFamily = fontTitle; titleText.FontSize = sizeTitle; titleText.FontWeight = weightTitle; titleText.Foreground = colorTitle; titleText.Margin = new Thickness(2 + indentTitle, 1, 0, 2); titleText.LineHeight = Math.Max(Settings.Instance.TunerFontHeightService, sizeTitle + 2); //必ず文字単位で折り返すためにZWSPを挿入 (\\w を使うと記号の間にZWSPが入らない) infoText.Text = Regex.Replace(resItem.EventName, ".", "$0\u200b"); //infoText.Text = resItem.EventName; infoText.FontFamily = fontNormal; infoText.FontSize = sizeNormal; //infoText.FontWeight = FontWeights.Normal; infoText.Foreground = colorNormal; infoText.Margin = new Thickness(2 + indentNormal, 0, 0, 2); infoText.LineHeight = Math.Max(Settings.Instance.TunerFontHeight, sizeNormal + 2); }
protected void PopupItem() { ReserveViewItem info = null; if (reserveViewPanel.Items != null) { Point cursorPos2 = Mouse.GetPosition(scrollViewer); if (cursorPos2.X < 0 || cursorPos2.Y < 0 || scrollViewer.ViewportWidth < cursorPos2.X || scrollViewer.ViewportHeight < cursorPos2.Y) { return; } Point cursorPos = Mouse.GetPosition(reserveViewPanel); foreach (ReserveViewItem item in reserveViewPanel.Items) { if (item.LeftPos <= cursorPos.X && cursorPos.X < item.LeftPos + item.Width) { if (item.TopPos <= cursorPos.Y && cursorPos.Y < item.TopPos + item.Height) { if (item == lastPopupInfo) { return; } info = item; lastPopupInfo = info; lastPopupPos = cursorPos; break; } } } } if (info == null || info.ReserveInfo == null) { popupItem.Visibility = System.Windows.Visibility.Hidden; lastPopupInfo = null; return; } double sizeNormal = Settings.Instance.FontSize; double sizeTitle = Settings.Instance.FontSizeTitle; FontFamily fontNormal = null; FontFamily fontTitle = null; try { if (Settings.Instance.FontName.Length > 0) { fontNormal = new FontFamily(Settings.Instance.FontName); } if (Settings.Instance.FontNameTitle.Length > 0) { fontTitle = new FontFamily(Settings.Instance.FontNameTitle); } if (fontNormal == null) { fontNormal = new FontFamily("MS UI Gothic"); } if (fontTitle == null) { fontTitle = new FontFamily("MS UI Gothic"); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } ReserveItem reserveItem = new ReserveItem(info.ReserveInfo); popupItem.Background = reserveItem.BackColor; Canvas.SetTop(popupItem, info.TopPos); popupItem.MinHeight = info.Height; Canvas.SetLeft(popupItem, info.LeftPos); popupItem.Width = info.Width; if (info.ReserveInfo.OverlapMode == 2) { errText.Text = reserveItem.Comment; errText.FontFamily = fontTitle; errText.FontSize = sizeTitle; errText.FontWeight = FontWeights.Bold; errText.Foreground = CommonManager.Instance.CustTitle1Color; errText.Margin = new Thickness(1, 1, 1, sizeTitle / 2); errText.Visibility = System.Windows.Visibility.Visible; } else { errText.Text = ""; errText.Height = 0; errText.Margin = new Thickness(); errText.Visibility = System.Windows.Visibility.Hidden; } String text; DateTime endTime = info.ReserveInfo.StartTime + TimeSpan.FromSeconds(info.ReserveInfo.DurationSecond); text = info.ReserveInfo.StartTime.ToString("HH:mm ~ "); text += endTime.ToString("HH:mm"); minText.Text = text; minText.FontFamily = fontNormal;// fontTitle; minText.FontSize = sizeNormal; minText.FontWeight = FontWeights.Normal; minText.Foreground = CommonManager.Instance.CustTitle1Color; minText.Margin = new Thickness(1, 1, 1, 1); //minGrid.Width = new GridLength(sizeNormal * 1.7 + 1); double indent = Settings.Instance.EpgTitleIndent ? sizeNormal * 2 : 2; text = reserveItem.ServiceName; text += " (" + reserveItem.NetworkName + ")"; titleText.Text = text; titleText.FontFamily = fontTitle; titleText.FontSize = sizeTitle; titleText.FontWeight = FontWeights.Bold; titleText.Foreground = CommonManager.Instance.CustTitle1Color; titleText.Margin = new Thickness(indent, 1, 1, sizeNormal / 2); infoText.Text = reserveItem.EventName; infoText.FontFamily = fontNormal; infoText.FontSize = sizeNormal; infoText.FontWeight = FontWeights.Normal; infoText.Foreground = CommonManager.Instance.CustTitle2Color; infoText.Margin = new Thickness(indent, 0, 9.5, sizeNormal / 2); popupItem.Visibility = System.Windows.Visibility.Visible; }