38
38
Mono.TextEditor.TextEditor texteditor = new Mono.TextEditor.TextEditor ();
39
39
CSharpFormattingPolicy profile;
40
Gtk.TreeStore indentOptions, bacePositionOptions, newLineOptions, whiteSpaceOptions;
40
Gtk.TreeStore indentOptions, bacePositionOptions, newLineOptions, whiteSpaceOptions, wrappingOptions;
42
42
static Dictionary<Wrapping, string> arrayInitializerTranslationDictionary = new Dictionary<Wrapping, string> ();
43
43
static Dictionary<BraceStyle, string> braceStyleTranslationDictionary = new Dictionary<BraceStyle, string> ();
44
static Dictionary<BraceForcement, string> braceForcementTranslationDictionary = new Dictionary<BraceForcement, string> ();
44
//static Dictionary<BraceForcement, string> braceForcementTranslationDictionary = new Dictionary<BraceForcement, string> ();
45
45
static Dictionary<PropertyFormatting, string> propertyFormattingTranslationDictionary = new Dictionary<PropertyFormatting, string> ();
46
46
static Dictionary<NewLinePlacement, string> newLinePlacementTranslationDictionary = new Dictionary<NewLinePlacement, string> ();
218
const string longMethodCall = @"class ClassDeclaration {
219
public void Test (int test)
221
LongMethodCallInSameLine (""Hello"", 1, test);
222
LongMethodCallInMultiple (
227
LongMethodCallInMultipleCase2 (""Hello"",
232
const string longMethodDeclaration = @"class ClassDeclaration {
233
public void LongMethodCallInSameLine (int test, string foo, double bar)
236
public void LongMethodCallInMultiple (
242
public void LongMethodCallInMultipleCase2 (int test,
248
const string longIndexerDeclaration = @"class ClassDeclaration {
249
public int this [int test, string foo, double bar]
260
public int this [int test,
267
const string longIndexer = @"class ClassDeclaration {
268
public void Test (int test)
270
this [""Hello"", 1, test] = 0;
223
281
const string simpleWhile = @"class ClassDeclaration {
224
282
public void Test ()
547
605
AddOption (bacePositionOptions, category, "EventRemoveBraceStyle", GettextCatalog.GetString ("Remove declaration"), eventExample);
548
606
AddOption (bacePositionOptions, category, "AllowEventRemoveBlockInline", GettextCatalog.GetString ("Allow one line remove"), eventExample);
550
category = AddOption (bacePositionOptions, null, GettextCatalog.GetString ("Brace forcement"), null);
551
AddOption (bacePositionOptions, category, "IfElseBraceForcement", GettextCatalog.GetString ("'if...else' statement"), @"class ClassDeclaration {
555
Console.WriteLine (""Hello World!"");
558
Console.WriteLine (""Hello World!"");
561
AddOption (bacePositionOptions, category, "ForBraceForcement", GettextCatalog.GetString ("'for' statement"), @"class ClassDeclaration {
564
for (int i = 0; i < 10; i++) {
565
Console.WriteLine (""Hello World "" + i);
567
for (int i = 0; i < 10; i++)
568
Console.WriteLine (""Hello World "" + i);
571
AddOption (bacePositionOptions, category, "WhileBraceForcement", GettextCatalog.GetString ("'while' statement"), @"class ClassDeclaration {
576
Console.WriteLine (""Hello World "" + i);
579
Console.WriteLine (""Hello World "" + i);
582
AddOption (bacePositionOptions, category, "UsingBraceForcement", GettextCatalog.GetString ("'using' statement"), simpleUsingStatement);
583
AddOption (bacePositionOptions, category, "FixedBraceForcement", GettextCatalog.GetString ("'fixed' statement"), simpleFixedStatement);
584
608
treeviewBracePositions.ExpandAll ();
587
611
#region New line options
588
612
newLineOptions = new Gtk.TreeStore (typeof(string), typeof(string), typeof(string), typeof(bool), typeof(bool));
590
614
column = new TreeViewColumn ();
592
616
column.PackStart (pixbufCellRenderer, false);
593
617
column.SetCellDataFunc (pixbufCellRenderer, RenderIcon);
596
620
cellRendererText.Ypad = 1;
597
621
column.PackStart (cellRendererText, true);
598
622
column.SetAttributes (cellRendererText, "text", 1);
600
624
treeviewNewLines.Model = newLineOptions;
601
625
treeviewNewLines.HeadersVisible = false;
602
626
treeviewNewLines.Selection.Changed += TreeSelectionChanged;
603
627
treeviewNewLines.AppendColumn (column);
605
629
column = new TreeViewColumn ();
606
630
cellRendererCombo = new CellRendererCombo ();
607
631
cellRendererCombo.Ypad = 1;
635
659
treeviewNewLines.ExpandAll ();
662
#region Wrapping options
663
wrappingOptions = new Gtk.TreeStore (typeof(string), typeof(string), typeof(string), typeof(bool), typeof(bool));
665
column = new TreeViewColumn ();
667
column.PackStart (pixbufCellRenderer, false);
668
column.SetCellDataFunc (pixbufCellRenderer, RenderIcon);
671
cellRendererText.Ypad = 1;
672
column.PackStart (cellRendererText, true);
673
column.SetAttributes (cellRendererText, "text", 1);
676
treeviewWrappingCategory.Model = wrappingOptions;
677
treeviewWrappingCategory.HeadersVisible = false;
678
treeviewWrappingCategory.Selection.Changed += TreeSelectionChanged;
679
treeviewWrappingCategory.AppendColumn (column);
681
column = new TreeViewColumn ();
682
cellRendererCombo = new CellRendererCombo ();
683
cellRendererCombo.Ypad = 1;
684
cellRendererCombo.Mode = CellRendererMode.Editable;
685
cellRendererCombo.TextColumn = 1;
686
cellRendererCombo.Model = comboBoxStore;
687
cellRendererCombo.HasEntry = false;
688
cellRendererCombo.Editable = !profile.IsBuiltIn;
689
cellRendererCombo.Edited += new ComboboxEditedHandler (this, wrappingOptions).ComboboxEdited;
691
column.PackStart (cellRendererCombo, false);
692
column.SetAttributes (cellRendererCombo, "visible", comboVisibleColumn);
693
column.SetCellDataFunc (cellRendererCombo, ComboboxDataFunc);
695
cellRendererToggle = new CellRendererToggle ();
696
cellRendererToggle.Activatable = !profile.IsBuiltIn;
697
cellRendererToggle.Ypad = 1;
698
cellRendererToggle.Toggled += new CellRendererToggledHandler (this, treeviewNewLines, wrappingOptions).Toggled;
699
column.PackStart (cellRendererToggle, false);
700
column.SetAttributes (cellRendererToggle, "visible", toggleVisibleColumn);
701
column.SetCellDataFunc (cellRendererToggle, ToggleDataFunc);
703
treeviewWrappingCategory.AppendColumn (column);
705
category = AddOption (wrappingOptions, null, GettextCatalog.GetString ("Method declarations"), null);
706
AddOption (wrappingOptions, category, "MethodDeclarationParameterWrapping", GettextCatalog.GetString ("Parameters"), longMethodDeclaration);
707
AddOption (wrappingOptions, category, "NewLineAferMethodDeclarationOpenParentheses", GettextCatalog.GetString ("New line after open parentheses"), longMethodDeclaration);
708
AddOption (wrappingOptions, category, "MethodDeclarationClosingParenthesesOnNewLine", GettextCatalog.GetString ("New line before closing parentheses"), longMethodDeclaration);
709
AddOption (wrappingOptions, category, "AlignToFirstMethodDeclarationParameter", GettextCatalog.GetString ("Align to first parameter"), longMethodDeclaration);
711
category = AddOption (wrappingOptions, null, GettextCatalog.GetString ("Method calls"), null);
712
AddOption (wrappingOptions, category, "MethodCallArgumentWrapping", GettextCatalog.GetString ("Arguments"), longMethodCall);
713
AddOption (wrappingOptions, category, "NewLineAferMethodCallOpenParentheses", GettextCatalog.GetString ("New line after open parentheses"), longMethodCall);
714
AddOption (wrappingOptions, category, "MethodCallClosingParenthesesOnNewLine", GettextCatalog.GetString ("New line before closing parentheses"), longMethodCall);
715
AddOption (wrappingOptions, category, "AlignToFirstMethodCallArgument", GettextCatalog.GetString ("Align to first argument"), longMethodCall);
717
category = AddOption (wrappingOptions, null, GettextCatalog.GetString ("Indexer declarations"), null);
718
AddOption (wrappingOptions, category, "IndexerDeclarationParameterWrapping", GettextCatalog.GetString ("Parameters"), longIndexerDeclaration);
719
AddOption (wrappingOptions, category, "NewLineAferIndexerDeclarationOpenBracket", GettextCatalog.GetString ("New line after open parentheses"), longIndexerDeclaration);
720
AddOption (wrappingOptions, category, "IndexerDeclarationClosingBracketOnNewLine", GettextCatalog.GetString ("New line before closing parentheses"), longIndexerDeclaration);
721
AddOption (wrappingOptions, category, "AlignToFirstIndexerDeclarationParameter", GettextCatalog.GetString ("Align to first parameter"), longIndexerDeclaration);
723
category = AddOption (wrappingOptions, null, GettextCatalog.GetString ("Indexer usage"), null);
724
AddOption (wrappingOptions, category, "IndexerArgumentWrapping", GettextCatalog.GetString ("Arguments"), longIndexer);
725
AddOption (wrappingOptions, category, "NewLineAferIndexerOpenBracket", GettextCatalog.GetString ("New line after open bracket"), longIndexer);
726
AddOption (wrappingOptions, category, "IndexerClosingBracketOnNewLine", GettextCatalog.GetString ("New line before closing bracket"), longIndexer);
727
AddOption (wrappingOptions, category, "AlignToFirstIndexerArgument", GettextCatalog.GetString ("Align to first parameter"), longIndexer);
729
treeviewWrappingCategory.ExpandAll ();
638
732
#region White space options
639
733
whiteSpaceOptions = new Gtk.TreeStore (typeof (string), typeof (string), typeof (string), typeof(bool), typeof(bool));