string _GetContentText() { var s = ContentText ?? EdResources.GetEmbeddedResourceString("Au.Editor.Tools.Regex.txt"); if (!s.Contains('\n')) { s = File.ReadAllText(s); } return(s); }
protected override void OnLoad(EventArgs e) { var c = this.Control1; //c.Call(Sci.SCI_SETWRAPSTARTINDENT, 4); //c.ZTags.AddStyleTag(".h", new SciTags.UserDefinedStyle { backColor = 0xC0E0C0, bold = true, eolFilled = true }); //topic header c.ZTags.AddLinkTag("+a", o => _Insert(o)); //link that inserts a key etc c.ZTags.SetLinkStyle(new SciTags.UserDefinedStyle { textColor = 0x0080FF, underline = false }); //remove underline from links var s = EdResources.GetEmbeddedResourceString("Au.Editor.Tools.Keys.txt").RegexReplace(@"\{(.+?)\}(?!\})", "<+a>$1<>"); var z = this.Window.ClientSize; z.Height = c.Z.LineHeight() * s.LineCount() + 6; this.Window.ClientSize = z; this.Text = s; }
/// <summary> /// Adds templates to File -> New. /// </summary> public void ZFillMenuNew(ToolStripDropDownMenu ddm) { if(_newMenuDone) return; _newMenuDone = true; var templDir = FileNode.Templates.DefaultDirBS; var xroot = AExtXml.LoadElem(FileNode.Templates.DefaultFilesXml); _CreateMenu(ddm, xroot, null, 0); void _CreateMenu(ToolStripDropDownMenu ddParent, XElement xParent, string dir, int level) { ddParent.SuspendLayout(); int i = level == 0 ? 4 : 0; foreach(var x in xParent.Elements()) { string tag = x.Name.LocalName, name = x.Attr("n"); int isFolder = tag == "d" ? 1 : 0; if(isFolder == 1) { isFolder = name[0] switch { '@' => 2, '!' => 3, _ => 1 }; //@ project, ! simple folder } else { if(level == 0 && FileNode.Templates.IsStandardTemplateName(name, out _)) continue; } string relPath = dir + name; if(isFolder == 3) name = name[1..]; var item = new ToolStripMenuItem(name, null, (unu, sed) => ZModel.NewItem(relPath, beginRenaming: true)); if(isFolder == 1) { var ddSub = new ToolStripDropDownMenu(); item.DropDown = ddSub; _CreateMenu(ddSub, x, dir + name + "\\", level + 1); } else { string si = null; if(isFolder != 0) si = nameof(Au.Editor.Resources.Resources.folder); else if(tag == "s") si = nameof(Au.Editor.Resources.Resources.fileScript); else if(tag == "c") si = nameof(Au.Editor.Resources.Resources.fileClass); Bitmap im = si != null ? EdResources.GetImageUseCache(si) : FileNode.IconCache.GetImage(templDir + relPath, useExt: true); if(im != null) item.Image = im; } ddParent.Items.Insert(i++, item); }
///// <summary> ///// The child list control. ///// </summary> //public AuListControl ListControl => _list; public CiPopupList(CiCompletion compl) { _compl = compl; _w = new _Window(this); _w.SuspendLayout(); _w.Size = Au.Util.ADpi.ScaleSize((300, 360)); _list = new _FastListBox(); _list.SuspendLayout(); _list.AccessibleName = _list.Name = "Codein_list"; _list.Dock = DockStyle.Fill; _list.BackColor = Color.White; _list.ZItemClick += _list_ItemClick; _list.ZSelectedIndexChanged += _list_SelectedIndexChanged; _tb = new Au.Util.AToolStrip(); _tb.SuspendLayout(); _tb.AccessibleName = _tb.Name = "Codein_listFilter"; _tb.Renderer = new AuDockPanel.ZDockedToolStripRenderer(); _tb.GripStyle = ToolStripGripStyle.Hidden; _tb.LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow; int tbWidth = 0; var kindNames = CiUtil.ItemKindNames; _nKindButtons = kindNames.Length; for (int i = 0; i < kindNames.Length; i++) { _AddButton(kindNames[i], CiUtil.GetKindImage((CiItemKind)i)); } _tb.Items.Add(new ToolStripSeparator()); _groupButton = _AddButton("Group by namespace or inheritance", EdResources.GetImageNoCacheDpi(nameof(Au.Editor.Resources.Resources.ciGroupBy))); if (Program.Settings.ci_complGroup) { _groupButton.Checked = true; } ToolStripButton _AddButton(string text, Image image) { var b = _tb.Items.Add(image) as ToolStripButton; b.DisplayStyle = ToolStripItemDisplayStyle.Image; b.ImageScaling = ToolStripItemImageScaling.None; b.Name = b.AccessibleName = b.ToolTipText = text; b.Margin = new Padding(1, 1, 0, 0); if (tbWidth == 0) { tbWidth = 4 + b.ContentRectangle.Left * 2 + image.Width; } return(b); } _tb.Width = tbWidth; _tb.AutoSize = false; //does not work well with autosize, eg width too small when high DPI _tb.Dock = DockStyle.Left; _tb.ItemClicked += _tb_ItemClicked; _w.Controls.Add(_list); _w.Controls.Add(_tb); _tb.ResumeLayout(); _list.ResumeLayout(); _w.ResumeLayout(true); _imgStatic = EdResources.GetImageNoCacheDpi(nameof(Au.Editor.Resources.Resources.ciOverlayStatic)); _imgAbstract = EdResources.GetImageNoCacheDpi(nameof(Au.Editor.Resources.Resources.ciOverlayAbstract)); _popupHtml = new CiPopupHtml(CiPopupHtml.UsedBy.PopupList); _popupTimer = new ATimer(_ShowPopupHtml); }
public Image GetImage(string imageName) { return(EdResources.GetImageUseCache(imageName)); }