private void createGroup(AnatomyFilterEntry filterEntry, IEnumerable <String> items) { List <CheckButton> groupCheckButtons = new List <CheckButton>(); List <String> activeFacetValues = new List <string>(); AnatomyFacet facet = new AnatomyFacet(filterEntry.FacetName, activeFacetValues); Button labelButton = scrollView.createWidgetT("Button", "Medical.AnatomyFilterButton", 0, 0, widget.Width, ScaleHelper.Scaled(25), Align.Left | Align.Top, "") as Button; labelButton.Caption = filterEntry.Caption; labelButton.ForwardMouseWheelToParent = true; labelButton.MouseButtonClick += (sender, e) => { anatomyController.TopLevelMode = filterEntry; fireTopLevelAnatomyChanged(); }; flowLayout.addChild(new MyGUILayoutContainer(labelButton)); childWidgets.Add(labelButton); topLevelButtons.addButton(filterEntry, labelButton); Button button = scrollView.createWidgetT("Button", "CheckBox", 0, 0, widget.Width, ScaleHelper.Scaled(20), Align.Left | Align.Top, "") as Button; button.Caption = "Include All"; button.ForwardMouseWheelToParent = true; CheckButton allCheckButton = new CheckButton(button); allCheckButton.Checked = true; allCheckButton.CheckedChanged += (sender, e) => { if (allCheckButton.Checked) { foreach (var groupButton in groupCheckButtons) { groupButton.Checked = false; } activeFacets.Remove(facet); fireFilterChanged(); } }; flowLayout.addChild(new MyGUILayoutContainer(button)); childWidgets.Add(button); foreach (String item in items) { button = scrollView.createWidgetT("Button", "CheckBox", 0, 0, widget.Width, ScaleHelper.Scaled(20), Align.Left | Align.Top, "") as Button; button.Caption = item; button.ForwardMouseWheelToParent = true; CheckButton checkButton = new CheckButton(button); checkButton.CheckedChanged += (sender, e) => { if (checkButton.Checked) { allCheckButton.Checked = false; if (!activeFacets.Contains(facet)) { activeFacets.Add(facet); } activeFacetValues.Add(item); fireFilterChanged(); } else { activeFacetValues.Remove(item); if (activeFacetValues.Count == 0) { allCheckButton.Checked = true; //The allCheckButton.CheckedChanged is triggered here } else { fireFilterChanged(); } } }; flowLayout.addChild(new MyGUILayoutContainer(button)); childWidgets.Add(button); groupCheckButtons.Add(checkButton); } }
public PlatformImageLoaderTask(ITarget <PImage, TImageView> target, TaskParameter parameters, IImageService imageService) : base(ImageCache.Instance, target, parameters, imageService) { // do not remove! Kicks scale retrieval so it's available for all, without deadlocks due to accessing MainThread ScaleHelper.Init(); }
/// <summary> /// Creates a new editor control for the document /// </summary> public static ScintillaControl CreateControl(String file, String text, Int32 codepage) { Initialize(); ScintillaControl sci = new ScintillaControl(); sci.AutoCSeparator = 32; sci.AutoCTypeSeparator = 63; sci.IsAutoCGetAutoHide = true; sci.IsAutoCGetCancelAtStart = false; sci.IsAutoCGetChooseSingle = false; sci.IsAutoCGetDropRestOfWord = false; sci.IsAutoCGetIgnoreCase = false; sci.ControlCharSymbol = 0; sci.CurrentPos = 0; sci.CursorType = -1; sci.Dock = DockStyle.Fill; sci.EndAtLastLine = 0; sci.EdgeColumn = 0; sci.EdgeMode = 0; sci.IsMouseDownCaptures = true; sci.IsBufferedDraw = true; sci.IsOvertype = false; sci.IsReadOnly = false; sci.IsUndoCollection = true; sci.IsUsePalette = true; sci.IsTwoPhaseDraw = true; sci.LayoutCache = 1; sci.Lexer = 3; sci.Location = new Point(0, 0); sci.MarginLeft = 5; sci.MarginRight = 5; sci.ModEventMask = (Int32)ModificationFlags.InsertText | (Int32)ModificationFlags.DeleteText | (Int32)ModificationFlags.RedoPerformed | (Int32)ModificationFlags.UndoPerformed; sci.MouseDwellTime = ScintillaControl.MAXDWELLTIME; sci.Name = "sci"; sci.PasteConvertEndings = false; sci.PrintColourMode = (Int32)PrintOption.Normal; sci.PrintWrapMode = (Int32)Wrap.Word; sci.PrintMagnification = 0; sci.SearchFlags = 0; sci.SelectionEnd = 0; sci.SelectionMode = 0; sci.SelectionStart = 0; sci.SmartIndentType = SmartIndent.CPP; sci.Status = 0; sci.StyleBits = 7; sci.TabIndex = 0; sci.TargetEnd = 0; sci.TargetStart = 0; sci.WrapStartIndent = PluginBase.Settings.IndentSize; sci.WrapVisualFlagsLocation = (Int32)WrapVisualLocation.EndByText; sci.WrapVisualFlags = (Int32)WrapVisualFlag.End; sci.XOffset = 0; sci.ZoomLevel = 0; sci.UsePopUp(false); sci.SetMarginTypeN(0, (Int32)MarginType.Symbol); sci.SetMarginMaskN(0, MarkerManager.MARKERS); sci.SetMarginWidthN(0, ScaleHelper.Scale(14)); sci.SetMarginTypeN(1, (Int32)MarginType.Number); sci.SetMarginMaskN(1, (Int32)MarginType.Symbol); sci.SetMarginTypeN(2, (Int32)MarginType.Symbol); sci.SetMarginMaskN(2, -33554432 | 1 << 2); sci.MarginSensitiveN(2, true); sci.SetMultiSelectionTyping(true); sci.MarkerDefineRGBAImage(0, Bookmark); sci.MarkerDefine(2, MarkerSymbol.Fullrect); sci.MarkerDefine((Int32)MarkerOutline.Folder, MarkerSymbol.BoxPlus); sci.MarkerDefine((Int32)MarkerOutline.FolderOpen, MarkerSymbol.BoxMinus); sci.MarkerDefine((Int32)MarkerOutline.FolderSub, MarkerSymbol.VLine); sci.MarkerDefine((Int32)MarkerOutline.FolderTail, MarkerSymbol.LCorner); sci.MarkerDefine((Int32)MarkerOutline.FolderEnd, MarkerSymbol.BoxPlusConnected); sci.MarkerDefine((Int32)MarkerOutline.FolderOpenMid, MarkerSymbol.BoxMinusConnected); sci.MarkerDefine((Int32)MarkerOutline.FolderMidTail, MarkerSymbol.TCorner); sci.SetXCaretPolicy((Int32)CaretPolicy.Even, 0); // Match edge... sci.SetYCaretPolicy((Int32)CaretPolicy.Even, 0); // Match edge... sci.ScrollWidthTracking = (PluginBase.Settings.ScrollWidth == 3000); sci.CodePage = 65001; // Editor handles text as UTF-8 sci.Encoding = Encoding.GetEncoding(codepage); sci.SaveBOM = IsUnicode(codepage) && PluginBase.Settings.SaveUnicodeWithBOM; sci.Text = text; sci.FileName = file; // Set text and save file name sci.Modified += new ModifiedHandler(Globals.MainForm.OnScintillaControlModified); sci.MarginClick += new MarginClickHandler(Globals.MainForm.OnScintillaControlMarginClick); sci.UpdateUI += new UpdateUIHandler(Globals.MainForm.OnScintillaControlUpdateControl); sci.URIDropped += new URIDroppedHandler(Globals.MainForm.OnScintillaControlDropFiles); sci.ModifyAttemptRO += new ModifyAttemptROHandler(Globals.MainForm.OnScintillaControlModifyRO); String untitledFileStart = TextHelper.GetString("Info.UntitledFileStart"); if (!file.StartsWithOrdinal(untitledFileStart)) { sci.IsReadOnly = FileHelper.FileIsReadOnly(file); } sci.SetFoldFlags((Int32)PluginBase.Settings.FoldFlags); sci.EmptyUndoBuffer(); ApplySciSettings(sci); UITools.Manager.ListenTo(sci); return(sci); }
private void GripperMouseMove(object sender, MouseEventArgs e) { Invalidate(); Gripper originatingGripper = (Gripper)sender; int absX = originatingGripper.Left + e.X; int absY = originatingGripper.Top + e.Y; if (originatingGripper == _targetGripper && Status.Equals(EditStatus.MOVING)) { TargetGripperMove(absX, absY); } else if (Status.Equals(EditStatus.RESIZING)) { // check if we already made this undoable if (!isMadeUndoable) { // don't allow another undo until we are finished with this move isMadeUndoable = true; // Make undo-able MakeBoundsChangeUndoable(false); } SuspendLayout(); // reset "workbench" rectangle to current bounds _boundsAfterResize.X = _boundsBeforeResize.X; _boundsAfterResize.Y = _boundsBeforeResize.Y; _boundsAfterResize.Width = _boundsBeforeResize.Width; _boundsAfterResize.Height = _boundsBeforeResize.Height; // calculate scaled rectangle ScaleHelper.Scale(ref _boundsAfterResize, originatingGripper.Position, new PointF(absX, absY), ScaleHelper.GetScaleOptions()); // apply scaled bounds to this DrawableContainer ApplyBounds(_boundsAfterResize); ResumeLayout(); } Invalidate(); }
public static void Initialize(IMainForm mainForm) { Icons.mainForm = mainForm; imageList = new ImageList(); imageList.ColorDepth = ColorDepth.Depth32Bit; imageList.ImageSize = ScaleHelper.Scale(new Size(16, 16)); imageList.TransparentColor = Color.Transparent; BulletAdd = Get(0); SilkPage = GetResource("Icons.SilkPage.png"); XmlFile = GetResource("Icons.XmlFile.png"); MxmlFile = GetResource("Icons.MxmlFile.png"); MxmlFileCompile = GetResource("Icons.MxmlFileCompile.png"); LuaFile = GetResource("Icons.LuaFile.png"); HiddenItems = GetResource("Icons.HiddenItems.png"); HiddenFolder = GetGray("203"); HiddenFile = GetResource("Icons.HiddenFile.png"); BlankFile = GetResource("Icons.BlankPage.png"); Project = Get(274); ProjectClasspath = Get(98); Classpath = Get(98); ProjectClasspathError = Get("98|6|3|3"); ClasspathError = Get("98|6|3|3"); Font = Get(408); ImageResource = Get(336); ActionScript = GetResource("Icons.ActionscriptFile.png"); HaxeFile = GetResource("Icons.HaxeFile.png"); SwfFile = GetResource("Icons.SwfMovie.png"); SwfFileHidden = GetResource("Icons.SwfMovieHidden.png"); SwcFile = GetResource("Icons.SwcFile.png"); Folder = Get(203); FolderCompile = Get("203|22|-3|3"); TextFile = Get(315); FlashCS3 = GetResource("Icons.FlashCS3.png"); ActionScriptCompile = GetResource("Icons.ActionscriptCompile.png"); HtmlFile = GetResource("Icons.HtmlFile.png"); AddFile = GetResource("Icons.AddFile.png"); //Get("304|0|5|4"); OpenFile = Get(214); EditFile = Get(282); Browse = Get(56); FindAndReplace = Get(484); FindInFiles = Get(209); Cut = Get(158); Copy = Get(292); Paste = Get(283); Delete = Get(111); Options = Get(54); OptionsWithIssues = Get("54|6|3|3"); NewProject = Get("274|0|5|4"); GreenCheck = Get(351); Gear = Get(127); Info = Get(229); Class = GetResource("Icons.Class.png"); Method = GetResource("Icons.Method.png"); Variable = GetResource("Icons.Variable.png"); Const = GetResource("Icons.Const.png"); Refresh = Get(66); Debug = Get(101); UpArrow = Get(74); DownArrow = Get(60); AllClasses = Get(202); SyncToFile = Get("315|9|-3|-4"); ClasspathFolder = Get(544); DocumentClass = Get(147); CommandPrompt = Get(57); }
static ScintillaManager() { Bookmark = ScaleHelper.Scale(new Bitmap(ResourceHelper.GetStream("BookmarkIcon.png"))); }
/// <summary> /// Handle the mouse move /// </summary> /// <param name="sender"></param> /// <param name="mouseEventArgs"></param> public override void MouseMove(object sender, MouseEventArgs mouseEventArgs) { if (EditStatus != EditStatus.RESIZING) { return; } Owner.Invalidate(); Owner.MakeBoundsChangeUndoable(false); // reset "workbench" rectangle to current bounds _boundsAfterResize.X = _boundsBeforeResize.X; _boundsAfterResize.Y = _boundsBeforeResize.Y; _boundsAfterResize.Width = _boundsBeforeResize.Width; _boundsAfterResize.Height = _boundsBeforeResize.Height; // calculate scaled rectangle ScaleHelper.Scale(ref _boundsAfterResize, Position, new PointF(mouseEventArgs.X, mouseEventArgs.Y), ScaleHelper.GetScaleOptions()); // apply scaled bounds to this DrawableContainer Owner.ApplyBounds(_boundsAfterResize); Owner.Invalidate(); }
public Ship(string name) : base(name) { Enabled = true; shipCameraObject = new GameObject("shipCam"); shipCameraObject.AddComponent(new ComponentCamera(MathHelper.PiOver4, SystemCore.GraphicsDevice.Viewport.AspectRatio, 0.1f, ScaleHelper.Billions(3), true)); AddComponent(new HighPrecisionPosition()); AddComponent(new ShipController()); AddComponent(new MouseKeyboardShipController()); AddComponent(new PhysicsComponent(true, false, PhysicsMeshType.sphere)); SystemCore.GameObjectManager.AddAndInitialiseGameObject(shipCameraObject); HighPrecisionPositionComponent = GetComponent <HighPrecisionPosition>(); }
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e) { if (renderer is ToolStripProfessionalRenderer) { Color back = GetThemeColor("ToolStripItem.BackColor"); Color border = GetThemeColor("ToolStripItem.BorderColor"); Rectangle borderRect = new Rectangle(4, 2, ScaleHelper.Scale(18), ScaleHelper.Scale(18)); Rectangle backRect = new Rectangle(5, 3, borderRect.Width - 2, borderRect.Height - 2); SolidBrush borderBrush = new SolidBrush(border == Color.Empty ? DockDrawHelper.ColorSelectedBG_Border : border); LinearGradientBrush backBrush = new LinearGradientBrush(backRect, back == Color.Empty ? DockDrawHelper.ColorSelectedBG_White : back, back == Color.Empty ? DockDrawHelper.ColorSelectedBG_Blue : back, LinearGradientMode.Vertical); e.Graphics.FillRectangle(borderBrush, borderRect); e.Graphics.FillRectangle(backBrush, backRect); Image image = PluginBase.MainForm.FindImageAndSetAdjust("485"); e.Graphics.DrawImage(image, e.ImageRectangle, new Rectangle(Point.Empty, image.Size), GraphicsUnit.Pixel); } else { renderer.DrawItemCheck(e); } }
protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e) { Graphics g = e.Graphics; Rectangle dropDownRect = e.ArrowRectangle; Color color = GetThemeColor("ToolStripItem.ArrowColor"); if (!e.Item.Enabled) { e.ArrowColor = SystemColors.GrayText; } else if (color != Color.Empty) { e.ArrowColor = color; } else { e.ArrowColor = SystemColors.MenuText; } using (Brush brush = new SolidBrush(e.ArrowColor)) { Point[] arrow; Int32 hor = ScaleHelper.Scale(2); Int32 ver = ScaleHelper.Scale(2); Point middle = new Point(dropDownRect.Left + dropDownRect.Width / 2, dropDownRect.Top + dropDownRect.Height / 2); switch (e.Direction) { case ArrowDirection.Up: arrow = new Point[] { new Point(middle.X - hor, middle.Y + 1), new Point(middle.X + hor + 1, middle.Y + 1), new Point(middle.X, middle.Y - ver) }; break; case ArrowDirection.Left: arrow = new Point[] { new Point(middle.X + hor, middle.Y - 2 * ver), new Point(middle.X + hor, middle.Y + 2 * ver), new Point(middle.X - hor, middle.Y) }; break; case ArrowDirection.Right: arrow = new Point[] { new Point(middle.X - hor, middle.Y - 2 * ver), new Point(middle.X - hor, middle.Y + 2 * ver), new Point(middle.X + hor, middle.Y) }; break; case ArrowDirection.Down: default: arrow = new Point[] { new Point(middle.X - hor, middle.Y - 1), new Point(middle.X + hor + 1, middle.Y - 1), new Point(middle.X, middle.Y + ver) }; break; } g.FillPolygon(brush, arrow); } }
/// <summary> /// /// </summary> static private void DisplayList(Object sender, System.Timers.ElapsedEventArgs e) { ITabbedDocument doc = PluginBase.MainForm.CurrentDocument; if (!doc.IsEditable) { return; } ScintillaControl sci = doc.SciControl; ListBox cl = completionList; if (cl.Items.Count == 0) { return; } // measure control if (needResize && !string.IsNullOrEmpty(widestLabel)) { needResize = false; Graphics g = cl.CreateGraphics(); SizeF size = g.MeasureString(widestLabel, cl.Font); cl.Width = (int)Math.Min(Math.Max(size.Width + 40, 100), 400) + ScaleHelper.Scale(10); } int newHeight = Math.Min(cl.Items.Count, 10) * cl.ItemHeight + 4; if (newHeight != cl.Height) { cl.Height = newHeight; } // place control Point coord = new Point(sci.PointXFromPosition(startPos), sci.PointYFromPosition(startPos)); listUp = UITools.CallTip.CallTipActive || (coord.Y + cl.Height > sci.Height); coord = sci.PointToScreen(coord); coord = ((Form)PluginBase.MainForm).PointToClient(coord); cl.Left = coord.X - 20 + sci.Left; if (listUp) { cl.Top = coord.Y - cl.Height; } else { cl.Top = coord.Y + UITools.Manager.LineHeight(sci); } // Keep on control area if (cl.Right > ((Form)PluginBase.MainForm).ClientRectangle.Right) { cl.Left = ((Form)PluginBase.MainForm).ClientRectangle.Right - cl.Width; } if (!cl.Visible) { Redraw(); cl.Show(); cl.BringToFront(); if (UITools.CallTip.CallTipActive) { UITools.CallTip.PositionControl(sci); } } }
public FDMenus(IMainForm mainForm) { // modify the file menu ToolStripMenuItem fileMenu = (ToolStripMenuItem)mainForm.FindMenuItem("FileMenu"); RecentProjects = new RecentProjectsMenu(); fileMenu.DropDownItems.Insert(5, RecentProjects); // modify the view menu ToolStripMenuItem viewMenu = (ToolStripMenuItem)mainForm.FindMenuItem("ViewMenu"); View = new ToolStripMenuItem(TextHelper.GetString("Label.MainMenuItem")); View.Image = Icons.Project.Img; viewMenu.DropDownItems.Add(View); PluginBase.MainForm.RegisterShortcutItem("ViewMenu.ShowProject", View); // modify the tools menu - add a nice GUI classpath editor ToolStripMenuItem toolsMenu = (ToolStripMenuItem)mainForm.FindMenuItem("ToolsMenu"); GlobalClasspaths = new ToolStripMenuItem(TextHelper.GetString("Label.GlobalClasspaths")); GlobalClasspaths.ShortcutKeys = Keys.F9 | Keys.Control; GlobalClasspaths.Image = Icons.Classpath.Img; toolsMenu.DropDownItems.Insert(toolsMenu.DropDownItems.Count - 4, GlobalClasspaths); PluginBase.MainForm.RegisterShortcutItem("ToolsMenu.GlobalClasspaths", GlobalClasspaths); ProjectMenu = new ProjectMenu(); MenuStrip mainMenu = mainForm.MenuStrip; mainMenu.Items.Insert(5, ProjectMenu); ToolStrip toolBar = mainForm.ToolStrip; toolBar.Items.Add(new ToolStripSeparator()); toolBar.Items.Add(RecentProjects.ToolbarSelector); BuildProject = new ToolStripButton(Icons.Gear.Img); BuildProject.Name = "BuildProject"; BuildProject.ToolTipText = TextHelper.GetStringWithoutMnemonics("Label.BuildProject"); PluginBase.MainForm.RegisterSecondaryItem("ProjectMenu.BuildProject", BuildProject); toolBar.Items.Add(BuildProject); TestMovie = new ToolStripButton(Icons.GreenCheck.Img); TestMovie.Name = "TestMovie"; TestMovie.ToolTipText = TextHelper.GetStringWithoutMnemonics("Label.TestMovie"); PluginBase.MainForm.RegisterSecondaryItem("ProjectMenu.TestMovie", TestMovie); toolBar.Items.Add(TestMovie); ConfigurationSelector = new ToolStripComboBoxEx(); ConfigurationSelector.Name = "ConfigurationSelector"; ConfigurationSelector.ToolTipText = TextHelper.GetString("ToolTip.SelectConfiguration"); ConfigurationSelector.Items.AddRange(new string[] { TextHelper.GetString("Info.Debug"), TextHelper.GetString("Info.Release") }); ConfigurationSelector.DropDownStyle = ComboBoxStyle.DropDownList; ConfigurationSelector.AutoSize = false; ConfigurationSelector.Enabled = false; ConfigurationSelector.Width = ScaleHelper.Scale(GetThemeWidth("ProjectManager.TargetBuildSelectorWidth", 85)); ConfigurationSelector.Margin = new Padding(1, 0, 0, 0); ConfigurationSelector.FlatStyle = PluginBase.MainForm.Settings.ComboBoxFlatStyle; ConfigurationSelector.Font = PluginBase.Settings.DefaultFont; toolBar.Items.Add(ConfigurationSelector); PluginBase.MainForm.RegisterShortcutItem("ProjectMenu.ConfigurationSelectorToggle", Keys.Control | Keys.F5); PluginBase.MainForm.RegisterSecondaryItem("ProjectMenu.ConfigurationSelectorToggle", ConfigurationSelector); TargetBuildSelector = new ToolStripComboBoxEx(); TargetBuildSelector.Name = "TargetBuildSelector"; TargetBuildSelector.ToolTipText = TextHelper.GetString("ToolTip.TargetBuild"); TargetBuildSelector.AutoSize = false; TargetBuildSelector.Width = ScaleHelper.Scale(GetThemeWidth("ProjectManager.ConfigurationSelectorWidth", 120)); TargetBuildSelector.Margin = new Padding(1, 0, 0, 0); TargetBuildSelector.FlatStyle = PluginBase.MainForm.Settings.ComboBoxFlatStyle; TargetBuildSelector.Font = PluginBase.Settings.DefaultFont; toolBar.Items.Add(TargetBuildSelector); PluginBase.MainForm.RegisterShortcutItem("ProjectMenu.TargetBuildSelector", Keys.Control | Keys.F7); PluginBase.MainForm.RegisterSecondaryItem("ProjectMenu.TargetBuildSelector", TargetBuildSelector); EnableTargetBuildSelector(false); }
/// <summary> /// This method is required for Windows Forms designer support. /// Do not change the method contents inside the source code editor. The Forms designer might /// not be able to load this method if it was changed manually. /// </summary> private void InitializeComponent() { this.scrollTimer = new System.Timers.Timer(); this.textLog = new System.Windows.Forms.RichTextBox(); this.toolStrip = new PluginCore.Controls.ToolStripEx(); this.toggleButton = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.findTextBox = new System.Windows.Forms.ToolStripSpringTextBox(); this.clearButton = new System.Windows.Forms.ToolStripButton(); ((System.ComponentModel.ISupportInitialize)(this.scrollTimer)).BeginInit(); this.toolStrip.SuspendLayout(); this.SuspendLayout(); // // scrollTimer // this.scrollTimer.Enabled = true; this.scrollTimer.Interval = 50; this.scrollTimer.SynchronizingObject = this; this.scrollTimer.Elapsed += new System.Timers.ElapsedEventHandler(this.ScrollTimerElapsed); // // textLog // this.textLog.BackColor = System.Drawing.SystemColors.Window; this.textLog.BorderStyle = System.Windows.Forms.BorderStyle.None; this.textLog.Dock = System.Windows.Forms.DockStyle.Fill; this.textLog.Location = new System.Drawing.Point(1, 26); this.textLog.Name = "textLog"; this.textLog.ReadOnly = true; this.textLog.Size = new System.Drawing.Size(278, 326); this.textLog.TabIndex = 1; this.textLog.Text = ""; this.textLog.WordWrap = false; this.textLog.KeyDown += new System.Windows.Forms.KeyEventHandler(this.PluginUIKeyDown); this.textLog.MouseUp += new System.Windows.Forms.MouseEventHandler(this.TextLogMouseUp); this.textLog.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.LinkClicked); this.textLog.MouseDown += new System.Windows.Forms.MouseEventHandler(this.TextLogMouseDown); // // toolStrip // this.toolStrip.CanOverflow = false; this.toolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; this.toolStrip.ImageScalingSize = ScaleHelper.Scale(new Size(16, 16)); this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toggleButton, this.toolStripSeparator1, this.findTextBox, this.clearButton }); this.toolStrip.Location = new System.Drawing.Point(1, 0); this.toolStrip.Name = "toolStrip"; this.toolStrip.Padding = new System.Windows.Forms.Padding(1, 1, 2, 2); this.toolStrip.Size = new System.Drawing.Size(278, 26); this.toolStrip.Stretch = true; this.toolStrip.TabIndex = 1; // // toggleButton // this.toggleButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toggleButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.toggleButton.Name = "toggleButton"; this.toggleButton.Size = new System.Drawing.Size(23, 20); this.toggleButton.Text = "toolStripButton1"; this.toggleButton.Click += new System.EventHandler(this.ToggleButtonClick); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Size = new System.Drawing.Size(6, 23); // // findTextBox // this.findTextBox.Name = "FindTextBox"; this.findTextBox.Size = new System.Drawing.Size(190, 23); this.findTextBox.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0); this.findTextBox.ForeColor = System.Drawing.SystemColors.GrayText; this.findTextBox.TextChanged += new System.EventHandler(this.FindTextBoxTextChanged); this.findTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.PluginUIKeyDown); this.findTextBox.Leave += new System.EventHandler(this.FindTextBoxLeave); this.findTextBox.Enter += new System.EventHandler(this.FindTextBoxEnter); // // clearButton // this.clearButton.Name = "clearButton"; this.clearButton.Size = new System.Drawing.Size(23, 21); this.clearButton.Margin = new System.Windows.Forms.Padding(0, 1, 0, 1); this.clearButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.clearButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.clearButton.Click += new System.EventHandler(this.ClearButtonClick); // // PluginUI // this.Controls.Add(this.textLog); this.Controls.Add(this.toolStrip); this.Name = "PluginUI"; this.Size = new System.Drawing.Size(280, 352); ((System.ComponentModel.ISupportInitialize)(this.scrollTimer)).EndInit(); this.toolStrip.ResumeLayout(false); this.toolStrip.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); }
/// <summary> /// Applies additional scaling to controls in order to support HDPI /// </summary> private void ApplyScaling() { this.idHeader.Width = ScaleHelper.Scale(this.idHeader.Width); this.keyHeader.Width = ScaleHelper.Scale(this.keyHeader.Width); }
public void InitializeComponent() { this.ImageScalingSize = ScaleHelper.Scale(new Size(16, 16)); this.highlightTimer = new Timer(); this.wholeWordCheckBox = new CheckBox(); this.matchCaseCheckBox = new CheckBox(); this.highlightCheckBox = new CheckBox(); this.nextButton = new ToolStripButton(); this.closeButton = new ToolStripButton(); this.moreButton = new ToolStripButton(); this.highlightHost = new ToolStripControlHost(this.highlightCheckBox); this.matchCaseHost = new ToolStripControlHost(this.matchCaseCheckBox); this.wholeWordHost = new ToolStripControlHost(this.wholeWordCheckBox); this.previousButton = new ToolStripButton(); this.findTextBox = new EscapeTextBox(); this.findLabel = new ToolStripLabel(); this.infoLabel = new ToolStripLabel(); this.SuspendLayout(); // // highlightTimer // this.highlightTimer = new Timer(); this.highlightTimer.Interval = 500; this.highlightTimer.Enabled = false; this.highlightTimer.Tick += delegate { this.HighlightTimerTick(); }; // // findLabel // this.findLabel.BackColor = Color.Transparent; this.findLabel.Text = TextHelper.GetString("Info.Find"); this.findLabel.Margin = new Padding(0, 0, 0, 3); // // infoLabel // this.infoLabel.BackColor = Color.Transparent; this.infoLabel.ForeColor = SystemColors.GrayText; this.infoLabel.Text = TextHelper.GetString("Info.NoMatches"); this.infoLabel.Margin = new Padding(0, 0, 0, 1); // // highlightCheckBox // this.highlightHost.Margin = new Padding(0, 2, 6, 1); this.highlightCheckBox.Text = TextHelper.GetString("Label.HighlightAll"); this.highlightCheckBox.BackColor = Color.Transparent; this.highlightCheckBox.Click += new EventHandler(this.HighlightAllCheckBoxClick); // // matchCaseCheckBox // this.matchCaseHost.Margin = new Padding(0, 2, 6, 1); this.matchCaseCheckBox.Text = TextHelper.GetString("Label.MatchCase"); this.matchCaseCheckBox.BackColor = Color.Transparent; this.matchCaseCheckBox.CheckedChanged += new EventHandler(this.MatchCaseCheckBoxCheckedChanged); // // wholeWordCheckBox // this.wholeWordHost.Margin = new Padding(0, 2, 6, 1); this.wholeWordCheckBox.Text = TextHelper.GetString("Label.WholeWord"); this.wholeWordCheckBox.BackColor = Color.Transparent; this.wholeWordCheckBox.CheckedChanged += new EventHandler(this.WholeWordCheckBoxCheckedChanged); // // nextButton // this.nextButton.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; this.nextButton.Image = Image.FromStream(ResourceHelper.GetStream("QuickFindNext.png")); this.nextButton.Click += new EventHandler(this.FindNextButtonClick); this.nextButton.Text = TextHelper.GetString("Label.Next"); this.nextButton.Margin = new Padding(0, 1, 2, 2); // // previousButton // this.previousButton.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; this.previousButton.Image = Image.FromStream(ResourceHelper.GetStream("QuickFindPrev.png")); this.previousButton.Click += new EventHandler(this.FindPrevButtonClick); this.previousButton.Text = TextHelper.GetString("Label.Previous"); this.previousButton.Margin = new Padding(0, 1, 7, 2); // // closeButton // this.closeButton.DisplayStyle = ToolStripItemDisplayStyle.Image; this.closeButton.Image = Image.FromStream(ResourceHelper.GetStream("QuickFindClose.png")); this.closeButton.Click += new EventHandler(this.CloseButtonClick); this.closeButton.Margin = new Padding(0, 1, 5, 2); // // findTextBox // this.findTextBox.Size = new Size(150, 21); this.findTextBox.KeyPress += new KeyPressEventHandler(this.FindTextBoxKeyPress); this.findTextBox.TextChanged += new EventHandler(this.FindTextBoxTextChanged); this.findTextBox.OnKeyEscape += new KeyEscapeEvent(this.FindTextBoxOnKeyEscape); this.findTextBox.Margin = new Padding(0, 1, 7, 2); // // moreButton // this.moreButton.Click += new EventHandler(this.MoreButtonClick); this.moreButton.Text = TextHelper.GetString("Label.More"); this.moreButton.Alignment = ToolStripItemAlignment.Right; this.moreButton.Margin = new Padding(0, 1, 5, 2); // // QuickFind // this.Items.Add(this.closeButton); this.Items.Add(this.findLabel); this.Items.Add(this.findTextBox); this.Items.Add(this.nextButton); this.Items.Add(this.previousButton); this.Items.Add(this.matchCaseHost); this.Items.Add(this.wholeWordHost); this.Items.Add(this.highlightHost); this.Items.Add(this.infoLabel); this.Items.Add(this.moreButton); this.GripStyle = ToolStripGripStyle.Hidden; this.Renderer = new QuickFindRenderer(); this.Padding = new Padding(4, 4, 0, 3); this.Dock = DockStyle.Bottom; this.CanOverflow = false; this.Visible = false; this.ResumeLayout(false); }
public async override Task Init() { await ScaleHelper.InitAsync(); await base.Init(); }
public static void ApplySciSettings(ScintillaControl sci, Boolean hardUpdate) { try { sci.CaretPeriod = Globals.Settings.CaretPeriod; sci.CaretWidth = Globals.Settings.CaretWidth; sci.EOLMode = LineEndDetector.DetectNewLineMarker(sci.Text, (Int32)Globals.Settings.EOLMode); sci.IsBraceMatching = Globals.Settings.BraceMatchingEnabled; sci.UseHighlightGuides = !Globals.Settings.HighlightGuide; sci.Indent = Globals.Settings.IndentSize; sci.SmartIndentType = Globals.Settings.SmartIndentType; sci.IsBackSpaceUnIndents = Globals.Settings.BackSpaceUnIndents; sci.IsCaretLineVisible = Globals.Settings.CaretLineVisible; sci.IsIndentationGuides = Globals.Settings.ViewIndentationGuides; sci.IndentView = Globals.Settings.IndentView; sci.IsTabIndents = Globals.Settings.TabIndents; sci.IsUseTabs = Globals.Settings.UseTabs; sci.IsViewEOL = Globals.Settings.ViewEOL; sci.ScrollWidth = Globals.Settings.ScrollWidth; sci.TabWidth = Globals.Settings.TabWidth; sci.ViewWS = Convert.ToInt32(Globals.Settings.ViewWhitespace); sci.WrapMode = Convert.ToInt32(Globals.Settings.WrapText); sci.SetProperty("fold", Convert.ToInt32(Globals.Settings.UseFolding).ToString()); sci.SetProperty("fold.comment", Convert.ToInt32(Globals.Settings.FoldComment).ToString()); sci.SetProperty("fold.compact", Convert.ToInt32(Globals.Settings.FoldCompact).ToString()); sci.SetProperty("fold.preprocessor", Convert.ToInt32(Globals.Settings.FoldPreprocessor).ToString()); sci.SetProperty("fold.at.else", Convert.ToInt32(Globals.Settings.FoldAtElse).ToString()); sci.SetProperty("fold.html", Convert.ToInt32(Globals.Settings.FoldHtml).ToString()); sci.SetProperty("lexer.cpp.track.preprocessor", "0"); sci.SetVirtualSpaceOptions((Int32)Globals.Settings.VirtualSpaceMode); sci.SetFoldFlags((Int32)Globals.Settings.FoldFlags); /** * Set correct line number margin width */ Boolean viewLineNumbers = Globals.Settings.ViewLineNumbers; if (viewLineNumbers) { sci.SetMarginWidthN(1, ScaleHelper.Scale(31)); } else { sci.SetMarginWidthN(1, 0); } /** * Set correct bookmark margin width */ Boolean viewBookmarks = Globals.Settings.ViewBookmarks; if (viewBookmarks) { sci.SetMarginWidthN(0, ScaleHelper.Scale(14)); } else { sci.SetMarginWidthN(0, 0); } /** * Set correct folding margin width */ Boolean useFolding = Globals.Settings.UseFolding; if (!useFolding && !viewBookmarks && !viewLineNumbers) { sci.SetMarginWidthN(2, 0); } else if (useFolding) { sci.SetMarginWidthN(2, ScaleHelper.Scale(15)); } else { sci.SetMarginWidthN(2, ScaleHelper.Scale(2)); } /** * Adjust the print margin */ sci.EdgeColumn = Globals.Settings.PrintMarginColumn; if (sci.EdgeColumn > 0) { sci.EdgeMode = 1; } else { sci.EdgeMode = 0; } /** * Add missing ignored keys */ foreach (Keys keys in ShortcutManager.AllShortcuts) { if (keys != Keys.None && !sci.ContainsIgnoredKeys(keys)) { sci.AddIgnoredKeys(keys); } } if (hardUpdate) { String lang = sci.ConfigurationLanguage; sci.ConfigurationLanguage = lang; } sci.Colourise(0, -1); sci.Refresh(); } catch (Exception ex) { ErrorManager.ShowError(ex); } }
public PlatformImageLoaderTask(ITarget <UIImage, TImageView> target, TaskParameter parameters, IImageService imageService, Configuration configuration, IMainThreadDispatcher mainThreadDispatcher) : base(ImageCache.Instance, configuration.DataResolverFactory ?? DataResolvers.DataResolverFactory.Instance, target, parameters, imageService, configuration, mainThreadDispatcher, true) { // do not remove! Kicks scale retrieval so it's available for all, without deadlocks due to accessing MainThread ScaleHelper.Init(); }
private void InitializeComponents(ImageList imageList) { this.toolStripLabelFilter = new System.Windows.Forms.ToolStripLabel(); this.toolStripTextBoxFilter = new System.Windows.Forms.ToolStripSpringTextBox(); this.clearFilterButton = new System.Windows.Forms.ToolStripButton(); this.toolStripDropDownOptions = new System.Windows.Forms.ToolStripDropDownButton(); this.toolStripItemMatchCase = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripItemRegEx = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripItemNegate = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripFilters = new PluginCore.Controls.ToolStripEx(); this.toolStripFilters.SuspendLayout(); // // toolStripTextBoxFilter // this.toolStripTextBoxFilter.Name = "toolStripTextBoxFilter"; this.toolStripTextBoxFilter.Size = new System.Drawing.Size(100, 25); this.toolStripTextBoxFilter.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0); this.toolStripTextBoxFilter.Enabled = false; this.toolStripTextBoxFilter.TextChanged += new System.EventHandler(this.ToolStripTextFieldFilter_Changed); // // toolStripLabelFilter // this.toolStripLabelFilter.Margin = new System.Windows.Forms.Padding(2, 1, 0, 1); this.toolStripLabelFilter.Name = "toolStripLabelFilter"; this.toolStripLabelFilter.Size = new System.Drawing.Size(36, 22); this.toolStripLabelFilter.Text = "Filter:"; // // clearFilterButton // this.clearFilterButton.Enabled = false; this.clearFilterButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.clearFilterButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.clearFilterButton.Margin = new System.Windows.Forms.Padding(0, 1, 0, 1); this.clearFilterButton.Name = "clearFilterButton"; this.clearFilterButton.Size = new System.Drawing.Size(23, 26); this.clearFilterButton.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; this.clearFilterButton.Image = PluginBase.MainForm.FindImage("153"); this.clearFilterButton.Click += new System.EventHandler(this.ClearFilterButton_Click); // // toolStripItemMatchCase // this.toolStripItemMatchCase.Name = "toolStripItemMatchCase"; this.toolStripItemMatchCase.CheckOnClick = true; this.toolStripItemMatchCase.Text = "Match Case"; this.toolStripItemNegate.Click += FilterOption_Click; // // toolStripItemRegEx // this.toolStripItemRegEx.Name = "toolStripItemRegEx"; this.toolStripItemRegEx.CheckOnClick = true; this.toolStripItemRegEx.Text = "Regular Expression"; this.toolStripItemNegate.Click += FilterOption_Click; // // toolStripItemNegate // this.toolStripItemNegate.Name = "toolStripItemNegate"; this.toolStripItemNegate.CheckOnClick = true; this.toolStripItemNegate.Text = "Match Opposite"; this.toolStripItemNegate.Click += FilterOption_Click; // // toolStripDropDownOptions // this.toolStripDropDownOptions.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.toolStripDropDownOptions.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripItemMatchCase, this.toolStripItemRegEx, this.toolStripItemNegate }); this.toolStripDropDownOptions.Name = "toolStripDropDownOptions"; this.toolStripDropDownOptions.Text = "Options"; // // toolStripFilters // this.toolStripFilters.ImageScalingSize = ScaleHelper.Scale(new System.Drawing.Size(16, 16)); this.toolStripFilters.CanOverflow = false; this.toolStripFilters.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow; this.toolStripFilters.Padding = new System.Windows.Forms.Padding(1, 1, 2, 2); this.toolStripFilters.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; this.toolStripFilters.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripLabelFilter, this.toolStripTextBoxFilter, this.clearFilterButton, this.toolStripDropDownOptions }); this.toolStripFilters.Name = "toolStripFilters"; this.toolStripFilters.Location = new System.Drawing.Point(1, 0); this.toolStripFilters.Size = new System.Drawing.Size(710, 25); this.toolStripFilters.TabIndex = 0; this.toolStripFilters.Text = "toolStripFilters"; // lv this.lv = new ListViewEx(); this.lv.ShowItemToolTips = true; this.imageColumnHeader = new ColumnHeader(); this.imageColumnHeader.Text = string.Empty; this.imageColumnHeader.Width = 20; this.frameColumnHeader = new ColumnHeader(); this.frameColumnHeader.Text = string.Empty; this.lv.Columns.AddRange(new ColumnHeader[] { this.imageColumnHeader, this.frameColumnHeader }); this.lv.FullRowSelect = true; this.lv.BorderStyle = BorderStyle.None; this.lv.Dock = System.Windows.Forms.DockStyle.Fill; foreach (ColumnHeader column in lv.Columns) { column.Width = ScaleHelper.Scale(column.Width); } lv.SmallImageList = imageList; currentImageIndex = imageList.Images.IndexOfKey("StartContinue"); lv.View = System.Windows.Forms.View.Details; lv.MouseDoubleClick += new MouseEventHandler(Lv_MouseDoubleClick); lv.KeyDown += new KeyEventHandler(Lv_KeyDown); lv.SizeChanged += new EventHandler(Lv_SizeChanged); this.Controls.Add(lv); this.Controls.Add(toolStripFilters); this.toolStripFilters.ResumeLayout(false); this.toolStripFilters.PerformLayout(); }