///////////////////////////////////////////////////////////////////////////////////////////////////
/// DO NOT STORE YOUR MACROS IN THIS FILE!! 
/// THIS FILE WILL BE OVERWRITTEN BY SOFTWARE UPDATES 
///////////////////////////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Globalization;
using Loxx;

// disabled new extension API 
/// <summary>
///  This is a sample for a formatter used for line popups and the line-preview window. 
///  A formatter can located in any macro extension (one of the CS-files) and must (!) be derived from "LoxxFormatter"
///  If a formatter is selected it will be called from the Line-preview or when a popup line-preview is generated.
///  Return value is an array of LineFormatInfo containg the (possibly changed) content and the display information. 
///  Input is the original line content and the number of characters that can be displayed in the output window. 
/// </summary>
//public class SampleFormatter : LoxxFormatter
//{
//  public override LineFormatInfo[] Format(string s, int width)
//  {
//    // split the content into lines (blank as divider) ... 
//    var ret = s.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
//    List<LineFormatInfo> brokenStrings = new List<LineFormatInfo>();
//    foreach (string st in ret)
//    {
//      if (st.Length <= width) //  can be displayed wihout a change?
//      {
//        brokenStrings.Add(new LineFormatInfo() { Content = st });
//      }
//      else // too long -- split into several strings containing a part of the line 
//      {
//        string tmp = st; // get a copy that can be changed
//        while (tmp.Length > 0) // and while we have remaining content ...
//        {
//          // ... we add a part or the full of the string as new line 
//          brokenStrings.Add(new LineFormatInfo() { Content = tmp.Substring(0, width > tmp.Length ? tmp.Length : width) });
//          tmp = tmp.Length > width ? tmp.Substring(width) : "";
//        }
//      }
//    }
//    return brokenStrings.ToArray();
//  }
//}

///// <summary>
///// Nonsense formatter showing all lines in revers order
///// </summary>
//public class ReversFormatter : LoxxFormatter
//{
//  public override LineFormatInfo[] Format(string s, int width)
//  {
//    var arr = s.ToCharArray();
//    Array.Reverse(arr);
//    var returnValue = new LineFormatInfo[] { new LineFormatInfo() };
//    returnValue[0].Content = new string(arr);
//    var rnd = new Random();

//    var colors = new List<ColorInfo>();
//    for (int i = 0; i < arr.Length; i += 5)
//    {
//      colors.Add(new ColorInfo() { Offset = i, Length = 3, BackColor = (uint)rnd.Next(), ForeColor = (uint)rnd.Next() });
//    }
//    returnValue[0].Colors = colors.ToArray();
//    return returnValue;
//  }
//}
