scintilla code folding

This commit is contained in:
Asval 2019-08-18 01:09:19 +02:00
parent 75610d0b90
commit 86160a8be0
4 changed files with 37 additions and 19 deletions

View File

@ -316,7 +316,7 @@ namespace FModel
// saveImageToolStripMenuItem
//
this.saveImageToolStripMenuItem.Name = "saveImageToolStripMenuItem";
this.saveImageToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.saveImageToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.saveImageToolStripMenuItem.Text = "Save Image";
this.saveImageToolStripMenuItem.Click += new System.EventHandler(this.saveImageToolStripMenuItem_Click);
//
@ -324,18 +324,18 @@ namespace FModel
//
this.autoSaveImagesToolStripMenuItem.CheckOnClick = true;
this.autoSaveImagesToolStripMenuItem.Name = "autoSaveImagesToolStripMenuItem";
this.autoSaveImagesToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.autoSaveImagesToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.autoSaveImagesToolStripMenuItem.Text = "Auto Save Images";
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator3.Size = new System.Drawing.Size(165, 6);
//
// mergeImagesToolStripMenuItem
//
this.mergeImagesToolStripMenuItem.Name = "mergeImagesToolStripMenuItem";
this.mergeImagesToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.mergeImagesToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.mergeImagesToolStripMenuItem.Text = "Merge Images";
this.mergeImagesToolStripMenuItem.Click += new System.EventHandler(this.mergeImagesToolStripMenuItem_Click);
//
@ -518,10 +518,13 @@ namespace FModel
//
// scintilla1
//
this.scintilla1.AutomaticFold = ((ScintillaNET.AutomaticFold)(((ScintillaNET.AutomaticFold.Show | ScintillaNET.AutomaticFold.Click)
| ScintillaNET.AutomaticFold.Change)));
this.scintilla1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.scintilla1.CaretPeriod = 400;
this.scintilla1.Dock = System.Windows.Forms.DockStyle.Fill;
this.scintilla1.IndentationGuides = ScintillaNET.IndentView.Real;
this.scintilla1.Lexer = ScintillaNET.Lexer.Json;
this.scintilla1.Location = new System.Drawing.Point(3, 3);
this.scintilla1.Name = "scintilla1";
this.scintilla1.ScrollWidth = 496;

View File

@ -131,7 +131,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABa
CAAAAk1TRnQBSQFMAgEBAgEAATgBAgE4AQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CAAAAk1TRnQBSQFMAgEBAgEAAUABAgFAAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -61,10 +61,6 @@ namespace FModel
e.SuppressKeyPress = true;
}
}
private static void KeyPressed(object sender, KeyEventArgs e)
{
KeyDown(sender, e);
}
/// <summary>
/// Set styles to a ScintillaNET control and disable some keybinds
@ -73,13 +69,14 @@ namespace FModel
public static void SetScintillaStyle(Scintilla theBox)
{
theBox.Styles[Style.Json.Default].ForeColor = Color.Silver;
theBox.Styles[Style.Json.BlockComment].ForeColor = Color.FromArgb(0, 128, 0);
theBox.Styles[Style.Json.LineComment].ForeColor = Color.FromArgb(0, 128, 0);
theBox.Styles[Style.Json.Number].ForeColor = Color.Green;
theBox.Styles[Style.Json.PropertyName].ForeColor = Color.SteelBlue;
theBox.Styles[Style.Json.String].ForeColor = Color.OrangeRed;
theBox.Styles[Style.Json.StringEol].BackColor = Color.OrangeRed;
theBox.Styles[Style.Json.Operator].ForeColor = Color.Black;
theBox.Styles[Style.Json.Number].ForeColor = Color.Goldenrod;
theBox.Styles[Style.Json.String].ForeColor = Color.RoyalBlue;
theBox.Styles[Style.Json.StringEol].ForeColor = Color.RoyalBlue;
theBox.Styles[Style.Json.PropertyName].ForeColor = Color.Crimson;
theBox.Styles[Style.Json.LineComment].ForeColor = Color.DarkGray;
theBox.Styles[Style.Json.BlockComment].ForeColor = Color.DarkGray;
theBox.Styles[Style.Json.Uri].ForeColor = Color.Peru;
theBox.Styles[Style.Json.CompactIRI].ForeColor = Color.Peru;
theBox.Styles[Style.LineNumber].ForeColor = Color.DarkGray;
var nums = theBox.Margins[1];
nums.Width = 30;
@ -87,9 +84,27 @@ namespace FModel
nums.Sensitive = true;
nums.Mask = 0;
theBox.SetProperty("fold", "1");
theBox.SetProperty("fold.compact", "1");
theBox.Margins[2].Type = MarginType.Symbol;
theBox.Margins[2].Mask = Marker.MaskFolders;
theBox.Margins[2].Sensitive = true;
theBox.Margins[2].Width = 20;
for (int i = 25; i <= 31; i++)
{
theBox.Markers[i].SetForeColor(SystemColors.ControlLightLight);
theBox.Markers[i].SetBackColor(SystemColors.ControlDark);
}
theBox.Markers[Marker.Folder].Symbol = MarkerSymbol.BoxPlus;
theBox.Markers[Marker.FolderOpen].Symbol = MarkerSymbol.BoxMinus;
theBox.Markers[Marker.FolderEnd].Symbol = MarkerSymbol.BoxPlusConnected;
theBox.Markers[Marker.FolderMidTail].Symbol = MarkerSymbol.TCorner;
theBox.Markers[Marker.FolderOpenMid].Symbol = MarkerSymbol.BoxMinusConnected;
theBox.Markers[Marker.FolderSub].Symbol = MarkerSymbol.VLine;
theBox.Markers[Marker.FolderTail].Symbol = MarkerSymbol.LCorner;
theBox.ClearCmdKey(Keys.Control | Keys.F);
theBox.ClearCmdKey(Keys.Control | Keys.Z);
theBox.Lexer = Lexer.Json;
}
}
}

View File

@ -138,7 +138,7 @@ namespace FModel
if (pak == toolstripmenuitem.Text)
{
toolstripmenuitem.Enabled = true;
toolstripmenuitem.BackColor = Color.FromArgb(50, 50, 92, 219);
toolstripmenuitem.BackColor = Color.FromArgb(25, 50, 92, 219);
}
}
@ -150,7 +150,7 @@ namespace FModel
if (!string.IsNullOrEmpty(key) && pak == toolstripmenuitem.Text)
{
toolstripmenuitem.Enabled = true;
toolstripmenuitem.BackColor = Color.FromArgb(100, 50, 92, 219);
toolstripmenuitem.BackColor = Color.FromArgb(50, 50, 92, 219);
}
}
}