/// <summary> /// Renders the titles that will result in more than one line. /// Workaround function. Breaks long strings into parts of length CharsPerLine. /// So the MatrixBrailleRenderer will not break strings unpredictable, resulting in /// spaces after or between broken parts. --> Causes CursorPosition to fail /// </summary> /// <param name="view">The view.</param> /// <returns></returns> private bool[,] renderMultiLineTitle(IViewBoxModel view, EditField_DialogEntry entry, int LineContentWidth, int LineCount, int CharsPerLine) { if (brailleRenderer == null) { brailleRenderer = new Renderer.MatrixBrailleRenderer(Renderer.RenderingProperties.IGNORE_LAST_LINESPACE | Renderer.RenderingProperties.RETURN_REAL_WIDTH); } bool[,] completeMatrix = brailleRenderer.RenderMatrix(view.ContentBox.Width, entry.Title); //bool[,] completeMatrix = emptyMatrix; //if (view != null && entry != null && entry.Title != null) //{ // List<string> titleParts = new List<string>(); // /*Cut string into CharsPerLine-long bits*/ // for (int i = 0; i < LineCount; i++) // { // if (entry.Title.Length > i * CharsPerLine + CharsPerLine) // titleParts.Add(entry.Title.Substring(i * CharsPerLine, CharsPerLine)); // else // { // if (entry.Title.Length >= i * CharsPerLine) // titleParts.Add(entry.Title.Substring(i * CharsPerLine)); // else break; // } // } // List<bool[,]> boolTitleParts = new List<bool[,]>(); // int dimensiony = CHAR_HEIGHT; // int dimensionx = LineContentWidth; // int index = 0; // /*Backup because entry's own renderer will be used. Renderer uses title for rendering.*/ // string titleBackup = Entry.Title; // /*Render all string parts seperately*/ // foreach (var item in titleParts) // { // if (index > 0) dimensiony = INTER_LINE_HEIGHT + CHAR_HEIGHT + dimensiony; // Entry.Title = item; // boolTitleParts.Add(renderDialogEntry(view)); // index++; // } // Entry.Title = titleBackup; // completeMatrix = new bool[dimensiony, dimensionx]; // index = 0; // /*Join all seperate rendered string parts into one Matrix*/ // foreach (var item in boolTitleParts) // { // for (int i = 0; i < item.GetLength(0); i++) // { // if(i < completeMatrix.GetLength(0)) // for (int j = 0; j < item.GetLength(1); j++) // { // try // { // if (j < completeMatrix.GetLength(1)) // { // if (index == 0) // completeMatrix[i, j] = item[i, j]; // else // { // completeMatrix[i + (index * (INTER_CHAR_WIDTH + CHAR_HEIGHT)), j] = item[i, j]; // } // } // } // catch (Exception e) // { // System.Diagnostics.Debug.WriteLine(e.ToString()); // } // } // } // index++; // } //} return(completeMatrix); }