private bool GetCellInfo(MouseEventArgs e, out ChartLocation clickedCell, out int irow)
{
clickedCell = null; // in case of premature 'return'
irow = -1;
if (m_hvoChart == 0 || AllColumns == null || e.Y > RootBox.Height || e.X > RootBox.Width)
return false;
Point pt;
Rectangle rcSrcRoot;
Rectangle rcDstRoot;
using (new HoldGraphics(this))
{
pt = PixelToView(new Point(e.X, e.Y));
GetCoordRects(out rcSrcRoot, out rcDstRoot);
var sel = RootBox.MakeSelAt(pt.X, pt.Y, rcSrcRoot, rcDstRoot, false);
if (sel == null)
return false;
var info = new TextSelInfo(sel);
if (info.Levels(false) < 2)
return false;
irow = GetIndexOfTopLevelObject(info, false);
var chart = Cache.ServiceLocator.GetInstance<IDsConstChartRepository>().GetObject(m_hvoChart);
if (irow < 0 || chart.RowsOS.Count <= irow)
return false;
var icol = m_logic.GetColumnFromPosition(e.X, m_chart.ColumnPositions) - 1;
if (-1 < icol && icol < AllColumns.Length && e.Clicks > 0)
icol = LogicalFromDisplay(icol); // if this is just a mouse move, use 'display' column
clickedCell = new ChartLocation(chart.RowsOS[irow], icol);
// return true if we clicked on a valid template column (other than notes)
// return false if we clicked on an 'other' column, like notes or row number?
return -1 < icol && icol < AllColumns.Length;
}
}