static public Point2D operator *(int B, Point2D A) { Point2D temp = new Point2D(); temp.x = A.x * B; temp.y = A.y * B; return temp; }
static public Point2D operator *(Point2D A, Point2D B) { Point2D temp = new Point2D(); temp.x = A.x * B.x; temp.y = A.y * B.y; return temp; }
public ThumbnailTracer(List<MeshGroup> meshGroups, int width, int height) { size = new Point2D(width, height); trackballTumbleWidget = new TrackballTumbleWidget(); trackballTumbleWidget.DoOpenGlDrawing = false; trackballTumbleWidget.LocalBounds = new RectangleDouble(0, 0, width, height); loadedMeshGroups = meshGroups; SetRenderPosition(loadedMeshGroups); trackballTumbleWidget.AnchorCenter(); }
public RandomFillWidget(Point2D size) { LocalBounds = new RectangleDouble(0, 0, size.x, size.y); image = new ImageBuffer(size.x, size.y, 32, new BlenderBGRA()); Random rand = new Random(); Graphics2D imageGraphics = image.NewGraphics2D(); for (int i = 0; i < 30; i++) { imageGraphics.Circle(rand.NextDouble() * image.Width, rand.NextDouble() * image.Height, rand.NextDouble() * 10 + 5, RGBA_Bytes.Red); } }
private MatterControlApplication(double width, double height, out bool showWindow) : base(width, height) { Name = "MatterControl"; showWindow = false; // set this at startup so that we can tell next time if it got set to true in close UserSettings.Instance.Fields.StartCount = UserSettings.Instance.Fields.StartCount + 1; this.commandLineArgs = Environment.GetCommandLineArgs(); Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; bool forceSofwareRendering = false; for (int currentCommandIndex = 0; currentCommandIndex < commandLineArgs.Length; currentCommandIndex++) { string command = commandLineArgs[currentCommandIndex]; string commandUpper = command.ToUpper(); switch (commandUpper) { case "TEST": CheckKnownAssemblyConditionalCompSymbols(); return; case "FORCE_SOFTWARE_RENDERING": forceSofwareRendering = true; GL.ForceSoftwareRendering(); break; case "MHSERIAL_TO_ANDROID": { Dictionary<string, string> vidPid_NameDictionary = new Dictionary<string, string>(); string[] MHSerialLines = File.ReadAllLines(Path.Combine("..", "..", "StaticData", "Drivers", "MHSerial", "MHSerial.inf")); foreach (string line in MHSerialLines) { if (line.Contains("=DriverInstall,")) { string name = Regex.Match(line, "%(.*).name").Groups[1].Value; string vid = Regex.Match(line, "VID_(.*)&PID").Groups[1].Value; string pid = Regex.Match(line, "PID_([0-9a-fA-F]+)").Groups[1].Value; string vidPid = "{0},{1}".FormatWith(vid, pid); if (!vidPid_NameDictionary.ContainsKey(vidPid)) { vidPid_NameDictionary.Add(vidPid, name); } } } using (StreamWriter deviceFilter = new StreamWriter("deviceFilter.txt")) { using (StreamWriter serialPort = new StreamWriter("serialPort.txt")) { foreach (KeyValuePair<string, string> vidPid_Name in vidPid_NameDictionary) { string[] vidPid = vidPid_Name.Key.Split(','); int vid = Int32.Parse(vidPid[0], System.Globalization.NumberStyles.HexNumber); int pid = Int32.Parse(vidPid[1], System.Globalization.NumberStyles.HexNumber); serialPort.WriteLine("customTable.AddProduct(0x{0:X4}, 0x{1:X4}, cdcDriverType); // {2}".FormatWith(vid, pid, vidPid_Name.Value)); deviceFilter.WriteLine("<!-- {2} -->\n<usb-device vendor-id=\"{0}\" product-id=\"{1}\" />".FormatWith(vid, pid, vidPid_Name.Value)); } } } } return; case "CLEAR_CACHE": AboutWidget.DeleteCacheData(); break; case "SHOW_MEMORY": ShowMemoryUsed = true; break; case "DO_GC_COLLECT_EVERY_DRAW": ShowMemoryUsed = true; DoCGCollectEveryDraw = true; break; case "CREATE_AND_SELECT_PRINTER": if (currentCommandIndex + 1 <= commandLineArgs.Length) { currentCommandIndex++; string argument = commandLineArgs[currentCommandIndex]; string[] printerData = argument.Split(','); if (printerData.Length >= 2) { Printer ActivePrinter = new Printer(); ActivePrinter.Name = "Auto: {0} {1}".FormatWith(printerData[0], printerData[1]); ActivePrinter.Make = printerData[0]; ActivePrinter.Model = printerData[1]; if (printerData.Length == 3) { ActivePrinter.ComPort = printerData[2]; } PrinterSetupStatus test = new PrinterSetupStatus(ActivePrinter); test.LoadDefaultSliceSettings(ActivePrinter.Make, ActivePrinter.Model); ActivePrinterProfile.Instance.ActivePrinter = ActivePrinter; } } break; case "CONNECT_TO_PRINTER": if (currentCommandIndex + 1 <= commandLineArgs.Length) { PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter(); } break; case "START_PRINT": if (currentCommandIndex + 1 <= commandLineArgs.Length) { bool hasBeenRun = false; currentCommandIndex++; string fullPath = commandLineArgs[currentCommandIndex]; QueueData.Instance.RemoveAll(); if (!string.IsNullOrEmpty(fullPath)) { string fileName = Path.GetFileNameWithoutExtension(fullPath); QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(fileName, fullPath))); PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent((sender, e) => { if (!hasBeenRun && PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.Connected) { hasBeenRun = true; PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible(); } }, ref unregisterEvent); } } break; case "SLICE_AND_EXPORT_GCODE": if (currentCommandIndex + 1 <= commandLineArgs.Length) { currentCommandIndex++; string fullPath = commandLineArgs[currentCommandIndex]; QueueData.Instance.RemoveAll(); if (!string.IsNullOrEmpty(fullPath)) { string fileName = Path.GetFileNameWithoutExtension(fullPath); PrintItemWrapper printItemWrapper = new PrintItemWrapper(new PrintItem(fileName, fullPath)); QueueData.Instance.AddItem(printItemWrapper); SlicingQueue.Instance.QueuePartForSlicing(printItemWrapper); ExportPrintItemWindow exportForTest = new ExportPrintItemWindow(printItemWrapper); exportForTest.ExportGcodeCommandLineUtility(fileName); } } break; } if (MeshFileIo.ValidFileExtensions().Contains(Path.GetExtension(command).ToUpper())) { // If we are the only instance running then do nothing. // Else send these to the running instance so it can load them. } } //WriteTestGCodeFile(); #if !DEBUG if (File.Exists("RunUnitTests.txt")) #endif { #if IS_WINDOWS_FORMS if (!Clipboard.IsInitialized) { Clipboard.SetSystemClipboard(new WindowsFormsClipboard()); } #endif // you can turn this on to debug some bounds issues //GuiWidget.DebugBoundsUnderMouse = true; } GuiWidget.DefaultEnforceIntegerBounds = true; if (ActiveTheme.Instance.DisplayMode == ActiveTheme.ApplicationDisplayType.Touchscreen) { TextWidget.GlobalPointSizeScaleRatio = 1.3; } using (new PerformanceTimer("Startup", "MainView")) { this.AddChild(ApplicationController.Instance.MainView); } this.MinimumSize = minSize; this.Padding = new BorderDouble(0); //To be re-enabled once native borders are turned off #if false // this is to test freeing gcodefile memory Button test = new Button("test"); test.Click += (sender, e) => { //MatterHackers.GCodeVisualizer.GCodeFile gcode = new GCodeVisualizer.GCodeFile(); //gcode.Load(@"C:\Users\lbrubaker\Downloads\drive assy.gcode"); SystemWindow window = new SystemWindow(100, 100); window.ShowAsSystemWindow(); }; allControls.AddChild(test); #endif this.AnchorAll(); if (!forceSofwareRendering) { UseOpenGL = true; } string version = "1.4"; Title = "MatterControl {0}".FormatWith(version); if (OemSettings.Instance.WindowTitleExtra != null && OemSettings.Instance.WindowTitleExtra.Trim().Length > 0) { Title = Title + " - {1}".FormatWith(version, OemSettings.Instance.WindowTitleExtra); } UiThread.RunOnIdle(CheckOnPrinter); string desktopPosition = ApplicationSettings.Instance.get("DesktopPosition"); if (desktopPosition != null && desktopPosition != "") { string[] sizes = desktopPosition.Split(','); //If the desktop position is less than -10,-10, override int xpos = Math.Max(int.Parse(sizes[0]), -10); int ypos = Math.Max(int.Parse(sizes[1]), -10); DesktopPosition = new Point2D(xpos, ypos); } showWindow = true; }
static public Point2D operator /(Point2D A, int B) { Point2D temp = new Point2D(); temp.x = A.x / B; temp.y = A.y / B; return temp; }
public double Dot(Point2D B) { return (x * B.x + y * B.y); }
public double GetSquaredDistanceTo(Point2D Other) { return ((x - Other.x) * (x - Other.x) + (y - Other.y) * (y - Other.y)); }
public static double GetDistanceBetween(Point2D A, Point2D B) { return (double)System.Math.Sqrt(GetDistanceBetweenSquared(A, B)); }
private void CreateRectangularBedGridImage(int linesInX, int linesInY) { using (TimedLock.Lock(lastCreatedBedImage, "CreateRectangularBedGridImage")) { if (linesInX == lastLinesCount.x && linesInY == lastLinesCount.y) { BedImage = lastCreatedBedImage; return; } Vector2 bedImageCentimeters = new Vector2(linesInX, linesInY); BedImage = new ImageBuffer(1024, 1024, 32, new BlenderBGRA()); Graphics2D graphics2D = BedImage.NewGraphics2D(); graphics2D.Clear(bedBaseColor); { double lineDist = BedImage.Width / (double)linesInX; int count = 1; int pointSize = 20; graphics2D.DrawString(count.ToString(), 4, 4, pointSize, color: bedMarkingsColor); for (double linePos = lineDist; linePos < BedImage.Width; linePos += lineDist) { count++; int linePosInt = (int)linePos; graphics2D.Line(linePosInt, 0, linePosInt, BedImage.Height, bedMarkingsColor); graphics2D.DrawString(count.ToString(), linePos + 4, 4, pointSize, color: bedMarkingsColor); } } { double lineDist = BedImage.Height / (double)linesInY; int count = 1; int pointSize = 16; for (double linePos = lineDist; linePos < BedImage.Height; linePos += lineDist) { count++; int linePosInt = (int)linePos; graphics2D.Line(0, linePosInt, BedImage.Height, linePosInt, bedMarkingsColor); graphics2D.DrawString(count.ToString(), 4, linePos + 4, pointSize, color: bedMarkingsColor); } } lastCreatedBedImage = BedImage; lastLinesCount = new Point2D(linesInX, linesInY); } }
public bool MoveToByName(string widgetName, double secondsToWait = 0, SearchRegion searchRegion = null, Point2D offset = default(Point2D), ClickOrigin origin = ClickOrigin.Center) { SystemWindow containingWindow; GuiWidget widgetToClick = GetWidgetByName(widgetName, out containingWindow, secondsToWait, searchRegion); if (widgetToClick != null) { RectangleDouble childBounds = widgetToClick.TransformToParentSpace(containingWindow, widgetToClick.LocalBounds); if (origin == ClickOrigin.Center) { offset.x += (int)childBounds.Width / 2; offset.y += (int)childBounds.Height / 2; } Point2D screenPosition = SystemWindowToScreen(new Point2D(childBounds.Left + offset.x, childBounds.Bottom + offset.y), containingWindow); SetMouseCursorPosition(screenPosition.x, screenPosition.y); return true; } return false; }
public bool DoubleClickByName(string widgetName, double secondsToWait = 0, SearchRegion searchRegion = null, Point2D offset = default(Point2D), ClickOrigin origin = ClickOrigin.Center) { throw new NotImplementedException(); }
public bool DragDropByName(string widgetNameDrag, string widgetNameDrop, double secondsToWait = 0, SearchRegion searchRegion = null, Point2D offsetDrag = default(Point2D), ClickOrigin originDrag = ClickOrigin.Center, Point2D offsetDrop = default(Point2D), ClickOrigin originDrop = ClickOrigin.Center) { if (DragByName(widgetNameDrag, secondsToWait, searchRegion, offsetDrag, originDrag)) { return DropByName(widgetNameDrop, secondsToWait, searchRegion, offsetDrop, originDrop); } return false; }
public bool DropImage(string imageName, double secondsToWait = 0, SearchRegion searchRegion = null, Point2D offset = default(Point2D), ClickOrigin origin = ClickOrigin.Center) { ImageBuffer imageToLookFor = LoadImageFromSourcFolder(imageName); if (imageToLookFor != null) { return DropImage(imageToLookFor, secondsToWait, searchRegion, offset, origin); } return false; }
public bool DragDropImage(string imageNameDrag, string imageNameDrop, double secondsToWait = 0, SearchRegion searchRegion = null, Point2D offsetDrag = default(Point2D), ClickOrigin originDrag = ClickOrigin.Center, Point2D offsetDrop = default(Point2D), ClickOrigin originDrop = ClickOrigin.Center) { ImageBuffer imageNeedleDrag = LoadImageFromSourcFolder(imageNameDrag); if (imageNeedleDrag != null) { ImageBuffer imageNeedleDrop = LoadImageFromSourcFolder(imageNameDrop); if (imageNeedleDrop != null) { return DragDropImage(imageNeedleDrag, imageNeedleDrop, secondsToWait, searchRegion, offsetDrag, originDrag, offsetDrop, originDrop); } } return false; }
public void Render(IImageByte imageSource, Point2D position) { Render(imageSource, position.x, position.y); }
public Point2D GetPerpendicular() { Point2D temp = new Point2D(y, -x); return temp; }
private void CreateRectangularBedGridImage(Vector3 displayVolumeToBuild, Vector2 bedCenter) { int linesInX = (int)Math.Ceiling(displayVolumeToBuild.x / 10); int linesInY = (int)Math.Ceiling(displayVolumeToBuild.y / 10); lock(lastCreatedBedImage) { Vector2 bedImageCentimeters = new Vector2(linesInX, linesInY); BedImage = new ImageBuffer(1024, 1024, 32, new BlenderBGRA()); Graphics2D graphics2D = BedImage.NewGraphics2D(); graphics2D.Clear(bedBaseColor); { double lineDist = BedImage.Width / (displayVolumeToBuild.x / 10.0); double xPositionCm = (-(displayVolume.x / 2.0) + bedCenter.x) / 10.0; int xPositionCmInt = (int)Math.Round(xPositionCm); double fraction = xPositionCm - xPositionCmInt; int pointSize = 20; graphics2D.DrawString(xPositionCmInt.ToString(), 4, 4, pointSize, color: bedMarkingsColor); for (double linePos = lineDist * (1 - fraction); linePos < BedImage.Width; linePos += lineDist) { xPositionCmInt++; int linePosInt = (int)linePos; int lineWidth = 1; if (xPositionCmInt == 0) { lineWidth = 2; } graphics2D.Line(linePosInt, 0, linePosInt, BedImage.Height, bedMarkingsColor, lineWidth); graphics2D.DrawString(xPositionCmInt.ToString(), linePos + 4, 4, pointSize, color: bedMarkingsColor); } } { double lineDist = BedImage.Height / (displayVolumeToBuild.y / 10.0); double yPositionCm = (-(displayVolume.y / 2.0) + bedCenter.y) / 10.0; int yPositionCmInt = (int)Math.Round(yPositionCm); double fraction = yPositionCm - yPositionCmInt; int pointSize = 20; for (double linePos = lineDist * (1 - fraction); linePos < BedImage.Height; linePos += lineDist) { yPositionCmInt++; int linePosInt = (int)linePos; int lineWidth = 1; if (yPositionCmInt == 0) { lineWidth = 2; } graphics2D.Line(0, linePosInt, BedImage.Height, linePosInt, bedMarkingsColor, lineWidth); graphics2D.DrawString(yPositionCmInt.ToString(), 4, linePos + 4, pointSize, color: bedMarkingsColor); } } lastCreatedBedImage = BedImage; lastLinesCount = new Point2D(linesInX, linesInY); } }
public static double GetDistanceBetweenSquared(Point2D A, Point2D B) { return ((A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y)); }
public bool ClickImage(ImageBuffer imageNeedle, int xOffset = 0, int yOffset = 0, ClickOrigin origin = ClickOrigin.Center, SearchRegion searchRegion = null, MouseButtons mouseButtons = MouseButtons.Left) { if (origin == ClickOrigin.Center) { xOffset += imageNeedle.Width / 2; yOffset += imageNeedle.Height / 2; } if (searchRegion == null) { searchRegion = GetScreenRegion(); } Vector2 matchPosition; double bestMatch; if (searchRegion.Image.FindLeastSquaresMatch(imageNeedle, out matchPosition, out bestMatch, MatchLimit)) { int screenHeight = NativeMethods.GetCurrentScreenHeight(); int clickY = (int)(searchRegion.ScreenRect.Bottom + matchPosition.y + yOffset); int clickYOnScreen = screenHeight - clickY; // invert to put it on the screen Point2D screenPosition = new Point2D((int)matchPosition.x + xOffset, clickYOnScreen); SetMouseCursorPosition(screenPosition.x, screenPosition.y); switch (mouseButtons) { case MouseButtons.None: break; case MouseButtons.Left: NativeMethods.mouse_event(NativeMethods.MOUSEEVENTF_LEFTDOWN, screenPosition.x, screenPosition.y, 0, 0); Wait(upDelaySeconds); NativeMethods.mouse_event(NativeMethods.MOUSEEVENTF_LEFTUP, screenPosition.x, screenPosition.y, 0, 0); break; case MouseButtons.Right: NativeMethods.mouse_event(NativeMethods.MOUSEEVENTF_RIGHTDOWN, screenPosition.x, screenPosition.y, 0, 0); Wait(upDelaySeconds); NativeMethods.mouse_event(NativeMethods.MOUSEEVENTF_RIGHTUP, screenPosition.x, screenPosition.y, 0, 0); break; case MouseButtons.Middle: NativeMethods.mouse_event(NativeMethods.MOUSEEVENTF_MIDDLEDOWN, screenPosition.x, screenPosition.y, 0, 0); Wait(upDelaySeconds); NativeMethods.mouse_event(NativeMethods.MOUSEEVENTF_MIDDLEUP, screenPosition.x, screenPosition.y, 0, 0); break; default: break; } return true; } return false; }
public double GetDeltaAngle(Point2D A) { return (double)GetDeltaAngle(GetAngle0To2PI(), A.GetAngle0To2PI()); }
public bool DropImage(ImageBuffer imageNeedle, int xOffset = 0, int yOffset = 0, ClickOrigin origin = ClickOrigin.Center, SearchRegion searchRegion = null) { if (origin == ClickOrigin.Center) { xOffset += imageNeedle.Width / 2; yOffset += imageNeedle.Height / 2; } if (searchRegion == null) { searchRegion = GetScreenRegion(); } Vector2 matchPosition; double bestMatch; if (searchRegion.Image.FindLeastSquaresMatch(imageNeedle, out matchPosition, out bestMatch, MatchLimit)) { int screenHeight = NativeMethods.GetCurrentScreenHeight(); int clickY = (int)(searchRegion.ScreenRect.Bottom + matchPosition.y + yOffset); int clickYOnScreen = screenHeight - clickY; // invert to put it on the screen Point2D screenPosition = new Point2D((int)matchPosition.x + xOffset, clickYOnScreen); SetMouseCursorPosition(screenPosition.x, screenPosition.y); NativeMethods.mouse_event(NativeMethods.MOUSEEVENTF_LEFTUP, screenPosition.x, screenPosition.y, 0, 0); return true; } return false; }
public double Cross(Point2D B) { return x * B.y - y * B.x; }
private static Point2D SystemWindowToScreen(Point2D pointOnWindow, SystemWindow containingWindow) { Point2D screenPosition = new Point2D(pointOnWindow.x, (int)containingWindow.Height - pointOnWindow.y); WidgetForWindowsFormsAbstract mappingWidget = containingWindow.Parent as WidgetForWindowsFormsAbstract; screenPosition.x += mappingWidget.WindowsFormsWindow.Location.X; screenPosition.y += mappingWidget.WindowsFormsWindow.Location.Y + mappingWidget.WindowsFormsWindow.TitleBarHeight; return screenPosition; }
private static Point2D ScreenToSystemWindow(Point2D pointOnScreen, SystemWindow containingWindow) { Point2D screenPosition = pointOnScreen; WidgetForWindowsFormsAbstract mappingWidget = containingWindow.Parent as WidgetForWindowsFormsAbstract; screenPosition.x -= mappingWidget.WindowsFormsWindow.Location.X; screenPosition.y -= (mappingWidget.WindowsFormsWindow.Location.Y + mappingWidget.WindowsFormsWindow.TitleBarHeight); screenPosition.y = (int)containingWindow.Height - screenPosition.y; return screenPosition; }
public Point2D CurrentMousPosition() { Point2D mousePos = new Point2D(System.Windows.Forms.Control.MousePosition.X, System.Windows.Forms.Control.MousePosition.Y); return mousePos; }
public override void SetDesktopPosition(SystemWindow systemWindow, Point2D position) { if (systemWindow.AbstractOsMappingWidget != null) { // Make sure the window is on screen (this logic should improve over time) position.x = Math.Max(0, position.x); position.y = Math.Max(0, position.y); // If it's mac make sure we are not completely under the menu bar. if (OsInformation.OperatingSystem == OSType.Mac) { position.y = Math.Max(5, position.y); } systemWindow.AbstractOsMappingWidget.DesktopPosition = position; } else { pendingSetInitialDesktopPosition = true; InitialDesktopPosition = position; } }
private static ImageBuffer BuildImageFromMeshGroups(List<MeshGroup> loadedMeshGroups, string stlHashCode, Point2D size) { if (loadedMeshGroups != null && loadedMeshGroups.Count > 0 && loadedMeshGroups[0].Meshes != null && loadedMeshGroups[0].Meshes[0] != null) { ImageBuffer tempImage = new ImageBuffer(size.x, size.y); Graphics2D partGraphics2D = tempImage.NewGraphics2D(); partGraphics2D.Clear(new RGBA_Bytes()); AxisAlignedBoundingBox aabb = loadedMeshGroups[0].GetAxisAlignedBoundingBox(); for (int meshGroupIndex = 1; meshGroupIndex < loadedMeshGroups.Count; meshGroupIndex++) { aabb = AxisAlignedBoundingBox.Union(aabb, loadedMeshGroups[meshGroupIndex].GetAxisAlignedBoundingBox()); } double maxSize = Math.Max(aabb.XSize, aabb.YSize); double scale = size.x / (maxSize * 1.2); RectangleDouble bounds2D = new RectangleDouble(aabb.minXYZ.x, aabb.minXYZ.y, aabb.maxXYZ.x, aabb.maxXYZ.y); foreach (MeshGroup meshGroup in loadedMeshGroups) { foreach (Mesh loadedMesh in meshGroup.Meshes) { PolygonMesh.Rendering.OrthographicZProjection.DrawTo(partGraphics2D, loadedMesh, new Vector2((size.x / scale - bounds2D.Width) / 2 - bounds2D.Left, (size.y / scale - bounds2D.Height) / 2 - bounds2D.Bottom), scale, RGBA_Bytes.White); } } if (File.Exists("RunUnitTests.txt")) { foreach (Mesh loadedMesh in loadedMeshGroups[0].Meshes) { List<MeshEdge> nonManifoldEdges = loadedMesh.GetNonManifoldEdges(); if (nonManifoldEdges.Count > 0) { partGraphics2D.Circle(size.x / 4, size.x / 4, size.x / 8, RGBA_Bytes.Red); } } } tempImage.SetRecieveBlender(new BlenderPreMultBGRA()); AllWhite.DoAllWhite(tempImage); // and give it back return tempImage; } return null; }
// are they the same within the error value? public bool Equals(Point2D OtherVector) { if (x == OtherVector.x && y == OtherVector.y) { return true; } return false; }
//private since you can't make one private TerminalWindow(int width, int height) : base(width, height) { AlwaysOnTopOfMain = true; #if __ANDROID__ TerminalWidget terminalWidget = new TerminalWidget(true); this.AddChild(new SoftKeyboardContentOffset(terminalWidget)); terminalWidget.Closed += (sender, e) => { Close(); }; #else this.AddChild(new TerminalWidget(true)); #endif Title = LocalizedString.Get("MatterControl - Terminal"); this.ShowAsSystemWindow(); MinimumSize = minSize; this.Name = "Gcode Terminal"; string desktopPosition = UserSettings.Instance.get(TerminalWindowPositionKey); if (desktopPosition != null && desktopPosition != "") { string[] sizes = desktopPosition.Split(','); //If the desktop position is less than -10,-10, override int xpos = Math.Max(int.Parse(sizes[0]), -10); int ypos = Math.Max(int.Parse(sizes[1]), -10); DesktopPosition = new Point2D(xpos, ypos); } }
public bool Contains(Point2D position) { return(Contains(position.x, position.y)); }