private void SetReserveBorder(Rectangle rect, ReserveViewItem info) { Brush color = info.BorderBrush; if (Settings.Instance.ReserveRectBackground == false) { rect.Opacity = 0.5; rect.Effect = new System.Windows.Media.Effects.DropShadowEffect() { BlurRadius = 10 }; rect.Fill = Brushes.Transparent; rect.StrokeThickness = 3; rect.Stroke = color; } else { rect.Opacity = 0.3; rect.Effect = new System.Windows.Media.Effects.DropShadowEffect() { BlurRadius = 6 }; rect.Fill = color; } }
protected override void MoveToReserveItem(ReserveData target, bool IsMarking) { uint ID = target.ReserveID; ReserveViewItem target_item = this.reserveList.Find(item => item.ReserveInfo.ReserveID == ID); this.programView.ScrollToFindItem(target_item, IsMarking); }
private void SetReserveBorderColor(ReserveViewItem info, Rectangle rect, Rectangle fillOnlyRect = null) { rect.Stroke = info.BorderBrush; rect.Effect = Settings.BrushCache.EpgBlurEffect; rect.StrokeThickness = 3; (fillOnlyRect ?? rect).Fill = info.BackColor; rect.StrokeDashArray = info.Data.IsWatchMode ? Settings.BrushCache.EpgDashArray : null; rect.StrokeDashCap = PenLineCap.Round; }
private void SetReserveBorderColor(ReserveViewItem info, Rectangle rect, Rectangle fillOnlyRect = null) { rect.Stroke = info.BorderBrush; rect.Effect = new System.Windows.Media.Effects.DropShadowEffect() { BlurRadius = 10 }; rect.StrokeThickness = 3; (fillOnlyRect ?? rect).Fill = info.BackColor; }
protected virtual ReserveViewItem AddReserveViewItem(ReserveData resInfo, ref ProgramViewItem refPgItem, bool SearchEvent = false) { //マージン適用前 DateTime startTime = GetViewTime(resInfo.StartTime); DateTime chkStartTime = startTime.Date.AddHours(startTime.Hour); //離れた時間のプログラム予約など、番組表が無いので表示不可 int index = timeList.BinarySearch(chkStartTime); if (index < 0) { return(null); } //EPG予約の場合は番組の外側に予約枠が飛び出さないようなマージンを作成。 double StartMargin = resInfo.IsEpgReserve == false ? resInfo.StartMarginResActual : Math.Min(0, resInfo.StartMarginResActual); double EndMargin = resInfo.IsEpgReserve == false ? resInfo.EndMarginResActual : Math.Min(0, resInfo.EndMarginResActual); //duationがマイナスになる場合は後で処理される startTime = startTime.AddSeconds(-StartMargin); double duration = resInfo.DurationSecond + StartMargin + EndMargin; var resItem = new ReserveViewItem(resInfo); reserveList.Add(resItem); //予約情報から番組情報を特定し、枠表示位置を再設定する refPgItem = null; programList.TryGetValue(resInfo.CurrentPgUID(), out refPgItem); if (refPgItem == null && SearchEvent == true) { EpgEventInfo epgInfo = resInfo.ReserveEventInfo(); if (epgInfo != null) { EpgEventInfo epgRefInfo = epgInfo.GetGroupMainEvent(); if (epgRefInfo != null) { programList.TryGetValue(epgRefInfo.CurrentPgUID(), out refPgItem); } } } if (resInfo.IsEpgReserve == true && refPgItem != null && resInfo.DurationSecond != 0) { resItem.Height = Math.Max(refPgItem.Height * duration / resInfo.DurationSecond, ViewUtil.PanelMinimumHeight); resItem.TopPos = refPgItem.TopPos + Math.Min(refPgItem.Height - resItem.Height, refPgItem.Height * (-StartMargin) / resInfo.DurationSecond); } else { resItem.Height = Math.Max(duration * Settings.Instance.MinHeight / 60, ViewUtil.PanelMinimumHeight); resItem.TopPos = Settings.Instance.MinHeight * (index * 60 + (startTime - chkStartTime).TotalMinutes); } return(resItem); }
public void SetReserveList(IEnumerable <ReserveViewItem> reserveList) { try { ClearReserveViewPanel(); PopupClear(); TooltipClear(); var AddRect = new Func <ReserveViewItem, int, object, Rectangle>((info, zIdx, tag) => { var rect = new Rectangle(); rect.Width = info.Width; rect.Height = info.Height; rect.IsHitTestVisible = false; rect.Tag = tag; Canvas.SetLeft(rect, info.LeftPos); Canvas.SetTop(rect, info.TopPos); Canvas.SetZIndex(rect, zIdx); canvas.Children.Add(rect); return(rect); }); var sortList = reserveList.OrderBy(r => (long)r.LeftPos << 32 | r.Data.ReserveID).ToList(); for (int i = 0; i < sortList.Count; i++) { ReserveViewItem info = sortList[i]; for (int j = i - 1; j >= 0 && sortList[j].LeftPos == info.LeftPos; j--) { //ほかの枠を覆ってしまう場合は少しだけ縮める。判定には若干余裕を持たせる。 if (18 <= sortList[j].Width && sortList[j].Width <= info.Width && info.TopPos - sortList[j].TopPos <6 && sortList[j].BottomPos - info.BottomPos <6 //あまりないと思うが、6px未満で並んでいる番組の除外。(EventIDでの判定はプログラム予約があるので不可) && info.BottomPos> sortList[j].TopPos && sortList[j].BottomPos> info.TopPos) { info.Width = sortList[j].Width - 6; } } var rect = AddRect(info, 10, info); var fillOnlyRect = this.EpgStyle().ReserveRectFillWithShadow ? null : AddRect(info, 9, null); SetReserveBorderColor(info, rect, fillOnlyRect); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
protected override ViewPanelItemBase GetPopupItem(Point cursorPos) { ReserveViewItem lastresPopItem = resPopItem; resPopItem = reserveList == null ? null : reserveList.Find(pg => pg.IsPicked(cursorPos)); if (Settings.Instance.EpgPopupResOnly == true && resPopItem == null) { return(null); } //予約枠を通過したので同じ番組でもポップアップを書き直させる。 if (lastresPopItem != resPopItem) { base.PopupClear(); } return(GetProgramViewData(cursorPos)); }
public void ClearInfo() { lastPopupInfo = null; popupItem.Visibility = System.Windows.Visibility.Hidden; foreach (Rectangle info in reserveBorder) { canvas.Children.Remove(info); } reserveBorder.Clear(); reserveViewPanel.ReleaseMouseCapture(); isDrag = false; reserveViewPanel.Items = null; reserveViewPanel.Height = 0; reserveViewPanel.Width = 0; canvas.Height = 0; canvas.Width = 0; }
protected override PanelItem GetPopupItem(Point cursorPos, bool onClick) { ProgramViewItem popInfo = GetProgramViewData(cursorPos); ReserveViewItem lastPopInfoRes = popInfoRes; popInfoRes = reserveList == null ? null : reserveList.Find(pg => pg.IsPicked(cursorPos)); if (Settings.Instance.EpgPopupMode == 2 && popInfoRes == null && ( onClick == false && !(lastPopInfoRes == null && popInfo == lastPopInfo) || onClick == true && lastPopInfo != null)) { return(null); } //予約枠を通過したので同じ番組でもポップアップを書き直させる。 if (lastPopInfoRes != popInfoRes) { base.PopupClear(); } return(popInfo); }
protected override PanelItem GetPopupItem(Point cursorPos, bool onClick) { ProgramViewItem popInfo = GetProgramViewData(cursorPos); ReserveViewItem lastPopInfoRes = popInfoRes; popInfoRes = GetReserveViewData(cursorPos).FirstOrDefault(); if (this.EpgStyle().EpgPopupMode == 2 && popInfoRes == null && ( onClick == false && !(lastPopInfoRes == null && popInfo == lastPopInfo) || onClick == true && lastPopInfo != null)) { return(null); } //予約枠を通過したので同じ番組でもポップアップを書き直させる。 if (lastPopInfoRes != popInfoRes) { base.PopupClear(); } return(popInfo); }
protected override void PopupClear() { base.PopupClear(); resPopItem = null; }
protected override ViewPanelItemBase GetPopupItem(Point cursorPos) { ReserveViewItem lastresPopItem = resPopItem; resPopItem = reserveList == null ? null : reserveList.Find(pg => pg.IsPicked(cursorPos)); if (Settings.Instance.EpgPopupResOnly == true && resPopItem == null) return null; //予約枠を通過したので同じ番組でもポップアップを書き直させる。 if (lastresPopItem != resPopItem) { base.PopupClear(); } return GetProgramViewData(cursorPos); }
protected virtual ReserveViewItem AddReserveViewItem(ReserveData resInfo, ref ProgramViewItem refPgItem, bool SearchEvent = false) { //LimitedStart()の関係で判定出来ないものを除外 if (timeList.Any() == false || resInfo.IsManual && resInfo.IsOver(timeList[0]) && resInfo.OnTimeBaseOnAir(timeList[0]) > 0) { return(null); } //マージン適用前 DateTime startTime = GetViewTime(LimitedStart(resInfo)); DateTime chkStartTime = startTime.Date.AddHours(startTime.Hour); //離れた時間のプログラム予約など、番組表が無いので表示不可 int index = timeList.BinarySearch(chkStartTime); if (index < 0) { return(null); } var resItem = new ReserveViewItem(resInfo) { EpgSettingIndex = viewInfo.EpgSettingIndex, ViewMode = viewMode }; (resInfo is ReserveDataEnd ? recinfoList : reserveList).Add(resItem); //予約情報から番組情報を特定し、枠表示位置を再設定する refPgItem = null; programList.TryGetValue(resInfo.CurrentPgUID(), out refPgItem); if (refPgItem == null && SearchEvent == true) { EpgEventInfo epgInfo; if (viewData.EventUIDList.TryGetValue(resInfo.CurrentPgUID(), out epgInfo)) { EpgEventInfo epgRefInfo = epgInfo.GetGroupMainEvent(viewData.EventUIDList); if (epgRefInfo != null) { programList.TryGetValue(epgRefInfo.CurrentPgUID(), out refPgItem); } } } //EPG予約の場合は番組の外側に予約枠が飛び出さないようなマージンを作成。 double StartMargin = resInfo.IsEpgReserve == false ? resInfo.StartMarginResActual : Math.Min(0, resInfo.StartMarginResActual); double EndMargin = resInfo.IsEpgReserve == false ? resInfo.EndMarginResActual : Math.Min(0, resInfo.EndMarginResActual); //duationがマイナスになる場合は後で処理される double duration = resInfo.DurationSecond + StartMargin + EndMargin; if (resInfo.IsEpgReserve && resInfo.DurationSecond != 0 && refPgItem != null) { resItem.Height = Math.Max(refPgItem.Height * duration / resInfo.DurationSecond, ViewUtil.PanelMinimumHeight); resItem.TopPos = refPgItem.TopPos + Math.Min(refPgItem.Height - resItem.Height, refPgItem.Height * (-StartMargin) / resInfo.DurationSecond); } else { //週間番組表のプログラム録画の予約前マージン対応があるので、マージンの反映はGetViewTime()の後 startTime = GetViewTime(resInfo.PgStartTime).AddSeconds(-StartMargin); resItem.TopPos = this.EpgStyle().MinHeight *(index * 60 + (startTime - chkStartTime).TotalMinutes); resItem.Height = Math.Max(duration * this.EpgStyle().MinHeight / 60 + Math.Min(resItem.TopPos, 0), ViewUtil.PanelMinimumHeight); resItem.TopPos = Math.Max(resItem.TopPos, 0); } return(resItem); }
void toolTipTimer_Tick(object sender, EventArgs e) { toolTipTimer.Stop(); try { if (Settings.Instance.NoToolTip == true) { return; } if (reserveViewPanel.Items != null) { if (MainWindow.GetWindow(this).IsActive == false) { return; } 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 info in reserveViewPanel.Items) { if (info.LeftPos <= cursorPos.X && cursorPos.X < info.LeftPos + info.Width) { if (info.TopPos <= cursorPos.Y && cursorPos.Y < info.TopPos + info.Height) { if (info.TitleDrawErr == true) { String view = ""; view = info.ReserveInfo.StartTime.ToString("yyyy/MM/dd(ddd) HH:mm:ss ~ "); DateTime endTime = info.ReserveInfo.StartTime + TimeSpan.FromSeconds(info.ReserveInfo.DurationSecond); view += endTime.ToString("yyyy/MM/dd(ddd) HH:mm:ss") + "\r\n"; view += info.ReserveInfo.StationName; if (0x7880 <= info.ReserveInfo.OriginalNetworkID && info.ReserveInfo.OriginalNetworkID <= 0x7FE8) { view += " (地デジ)"; } else if (info.ReserveInfo.OriginalNetworkID == 0x0004) { view += " (BS)"; } else if (info.ReserveInfo.OriginalNetworkID == 0x0006) { view += " (CS1)"; } else if (info.ReserveInfo.OriginalNetworkID == 0x0007) { view += " (CS2)"; } else { view += " (その他)"; } view += "\r\n"; view += info.ReserveInfo.Title; Border border = new Border(); border.Background = Brushes.DarkGray; TextBlock block = new TextBlock(); block.Text = view; block.MaxWidth = 400; block.TextWrapping = TextWrapping.Wrap; block.Margin = new Thickness(2); block.Background = Brushes.LightGray; block.Foreground = Brushes.Black; border.Child = block; toolTip.Child = border; toolTip.IsOpen = true; toolTipOffTimer.Start(); lastPopupInfo = info; lastPopupPos = cursorPos; } } } } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
void toolTipTimer_Tick(object sender, EventArgs e) { toolTipTimer.Stop(); try { if (Settings.Instance.NoToolTip == true) { return; } if (reserveViewPanel.Items != null) { if (MainWindow.GetWindow(this).IsActive == false) { return; } 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 info in reserveViewPanel.Items) { if (info.LeftPos <= cursorPos.X && cursorPos.X < info.LeftPos + info.Width) { if (info.TopPos <= cursorPos.Y && cursorPos.Y < info.TopPos + info.Height) { if (info.TitleDrawErr == true) { string view = CommonManager.GetTimeDurationText(true, info.ReserveInfo.StartTime, true, info.ReserveInfo.DurationSecond) + "\r\n"; view += info.ReserveInfo.StationName; view += " (" + CommonManager.ConvertNetworkNameText(info.ReserveInfo.OriginalNetworkID) + ")" + "\r\n"; view += info.ReserveInfo.Title; Border border = new Border(); border.Background = Brushes.DarkGray; TextBlock block = new TextBlock(); block.Text = view; block.MaxWidth = 400; block.TextWrapping = TextWrapping.Wrap; block.Margin = new Thickness(2); block.Background = Brushes.LightGray; block.Foreground = Brushes.Black; border.Child = block; toolTip.Child = border; toolTip.IsOpen = true; toolTipOffTimer.Start(); lastPopupInfo = info; lastPopupPos = cursorPos; } } } } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
void toolTipTimer_Tick(object sender, EventArgs e) { toolTipTimer.Stop(); try { if (Settings.Instance.NoToolTip == true) { return; } if (reserveViewPanel.Items != null) { if (MainWindow.GetWindow(this).IsActive == false) { return; } 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 info in reserveViewPanel.Items) { if (info.LeftPos <= cursorPos.X && cursorPos.X < info.LeftPos + info.Width) { if (info.TopPos <= cursorPos.Y && cursorPos.Y < info.TopPos + info.Height) { if (info.TitleDrawErr == true) { string view = new CommonManager.TimeDuration(true, info.ReserveInfo.StartTime, true, info.ReserveInfo.DurationSecond) + "\r\n"; view += info.ReserveInfo.StationName; view += " (" + CommonManager.ConvertNetworkNameText(info.ReserveInfo.OriginalNetworkID) + ")" + "\r\n"; view += info.ReserveInfo.Title; toolTipTextBlock.Text = view; toolTipTextBlock.Background = new SolidColorBrush(Color.FromRgb( Settings.Instance.EpgSettingList[0].EpgTipsBackColorR, Settings.Instance.EpgSettingList[0].EpgTipsBackColorG, Settings.Instance.EpgSettingList[0].EpgTipsBackColorB)); toolTipTextBlock.Foreground = new SolidColorBrush(Color.FromRgb( Settings.Instance.EpgSettingList[0].EpgTipsForeColorR, Settings.Instance.EpgSettingList[0].EpgTipsForeColorG, Settings.Instance.EpgSettingList[0].EpgTipsForeColorB)); toolTip.IsOpen = true; toolTipOffTimer.Start(); lastPopupInfo = info; lastPopupPos = cursorPos; } } } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void reserveViewPanel_MouseLeave(object sender, MouseEventArgs e) { popupItem.Visibility = System.Windows.Visibility.Hidden; lastPopupInfo = null; lastPopupPos = new Point(-1, -1); }
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; }
protected override void PopupClear() { base.PopupClear(); popInfoRes = null; }