本文整理汇总了C#中MatterHackers.Agg.UI.GuiWidget.AnchorAll方法的典型用法代码示例。如果您正苦于以下问题:C# GuiWidget.AnchorAll方法的具体用法?C# GuiWidget.AnchorAll怎么用?C# GuiWidget.AnchorAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatterHackers.Agg.UI.GuiWidget
的用法示例。
在下文中一共展示了GuiWidget.AnchorAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MeshViewerApplication
public MeshViewerApplication(string meshFileToLoad = "")
: base(800, 600)
{
BackgroundColor = RGBA_Bytes.White;
MinimumSize = new VectorMath.Vector2(200, 200);
Title = "MatterHackers MeshViewr";
UseOpenGL = true;
FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
mainContainer.AnchorAll();
viewArea = new GuiWidget();
viewArea.AnchorAll();
Vector3 viewerVolume = new Vector3(200, 200, 200);
double scale = 1;
meshViewerWidget = new MeshViewerWidget(viewerVolume, scale, MeshViewerWidget.BedShape.Rectangular, "No Part Loaded");
meshViewerWidget.AnchorAll();
viewArea.AddChild(meshViewerWidget);
mainContainer.AddChild(viewArea);
FlowLayoutWidget buttonPanel = new FlowLayoutWidget(FlowDirection.LeftToRight);
buttonPanel.HAnchor = HAnchor.ParentLeftRight;
buttonPanel.Padding = new BorderDouble(3, 3);
buttonPanel.BackgroundColor = RGBA_Bytes.DarkGray;
if (meshFileToLoad != "")
{
meshViewerWidget.LoadMesh(meshFileToLoad);
}
else
{
openFileButton = new Button("Open 3D File", 0, 0);
openFileButton.Click += new Button.ButtonEventHandler(openFileButton_ButtonClick);
buttonPanel.AddChild(openFileButton);
}
bedCheckBox = new CheckBox("Bed");
bedCheckBox.Checked = true;
buttonPanel.AddChild(bedCheckBox);
wireframeCheckBox = new CheckBox("Wireframe");
buttonPanel.AddChild(wireframeCheckBox);
GuiWidget leftRightSpacer = new GuiWidget();
leftRightSpacer.HAnchor = HAnchor.ParentLeftRight;
buttonPanel.AddChild(leftRightSpacer);
mainContainer.AddChild(buttonPanel);
this.AddChild(mainContainer);
this.AnchorAll();
AddHandlers();
}
示例2: FatFlatClickWidget
public FatFlatClickWidget(TextWidget textWidget)
{
overlay = new GuiWidget();
overlay.AnchorAll();
overlay.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
overlay.Visible = false;
this.GetChildClicks = true;
this.AddChild(textWidget);
this.AddChild(overlay);
}
示例3: View3DTextCreator
public View3DTextCreator(Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape)
{
boldTypeFace = TypeFace.LoadFrom(StaticData.Instance.ReadAllText(Path.Combine("Fonts", "LiberationSans-Bold.svg")));
MeshGroupExtraData = new List<PlatingMeshGroupData>();
FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;
mainContainerTopToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight;
FlowLayoutWidget centerPartPreviewAndControls = new FlowLayoutWidget(FlowDirection.LeftToRight);
centerPartPreviewAndControls.AnchorAll();
GuiWidget viewArea = new GuiWidget();
viewArea.AnchorAll();
{
meshViewerWidget = new MeshViewerWidget(viewerVolume, bedCenter, bedShape);
meshViewerWidget.AllowBedRenderingWhenEmpty = true;
meshViewerWidget.AnchorAll();
}
viewArea.AddChild(meshViewerWidget);
centerPartPreviewAndControls.AddChild(viewArea);
mainContainerTopToBottom.AddChild(centerPartPreviewAndControls);
FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight);
buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight;
buttonBottomPanel.Padding = new BorderDouble(3, 3);
buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
buttonRightPanel = CreateRightButtonPanel(viewerVolume.y);
// add in the plater tools
{
FlowLayoutWidget editToolBar = new FlowLayoutWidget();
processingProgressControl = new ProgressControl("Finding Parts:".Localize(), ActiveTheme.Instance.PrimaryTextColor, ActiveTheme.Instance.PrimaryAccentColor);
processingProgressControl.VAnchor = Agg.UI.VAnchor.ParentCenter;
editToolBar.AddChild(processingProgressControl);
editToolBar.VAnchor |= Agg.UI.VAnchor.ParentCenter;
editPlateButtonsContainer = new FlowLayoutWidget();
MHTextEditWidget textToAddWidget = new MHTextEditWidget("", pixelWidth: 300, messageWhenEmptyAndNotSelected: "Enter Text Here".Localize());
textToAddWidget.VAnchor = VAnchor.ParentCenter;
textToAddWidget.Margin = new BorderDouble(5);
editPlateButtonsContainer.AddChild(textToAddWidget);
textToAddWidget.ActualTextEditWidget.EnterPressed += (object sender, KeyEventArgs keyEvent) =>
{
InsertTextNow(textToAddWidget.Text);
};
Button insertTextButton = textImageButtonFactory.Generate("Insert".Localize());
editPlateButtonsContainer.AddChild(insertTextButton);
insertTextButton.Click += (sender, e) =>
{
InsertTextNow(textToAddWidget.Text);
};
KeyDown += (sender, e) =>
{
KeyEventArgs keyEvent = e as KeyEventArgs;
if (keyEvent != null && !keyEvent.Handled)
{
if (keyEvent.KeyCode == Keys.Escape)
{
if (meshSelectInfo.downOnPart)
{
meshSelectInfo.downOnPart = false;
ScaleRotateTranslate translated = SelectedMeshTransform;
translated.translation *= transformOnMouseDown;
SelectedMeshTransform = translated;
Invalidate();
}
}
}
};
editToolBar.AddChild(editPlateButtonsContainer);
buttonBottomPanel.AddChild(editToolBar);
}
GuiWidget buttonRightPanelHolder = new GuiWidget(HAnchor.FitToChildren, VAnchor.ParentBottomTop);
centerPartPreviewAndControls.AddChild(buttonRightPanelHolder);
buttonRightPanelHolder.AddChild(buttonRightPanel);
viewControls3D = new ViewControls3D(meshViewerWidget);
buttonRightPanelDisabledCover = new Cover(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop);
buttonRightPanelDisabledCover.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryBackgroundColor, 150);
buttonRightPanelHolder.AddChild(buttonRightPanelDisabledCover);
LockEditControls();
GuiWidget leftRightSpacer = new GuiWidget();
leftRightSpacer.HAnchor = HAnchor.ParentLeftRight;
buttonBottomPanel.AddChild(leftRightSpacer);
closeButton = textImageButtonFactory.Generate("Close".Localize());
//.........这里部分代码省略.........
示例4: EePromMarlinWindow
public EePromMarlinWindow()
: base(650 * GuiWidget.DeviceScale, 480 * GuiWidget.DeviceScale)
{
AlwaysOnTopOfMain = true;
Title = "Marlin Firmware EEPROM Settings".Localize();
currentEePromSettings = new EePromMarlinSettings();
currentEePromSettings.eventAdded += SetUiToPrinterSettings;
GuiWidget mainContainer = new GuiWidget();
mainContainer.AnchorAll();
mainContainer.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
mainContainer.Padding = new BorderDouble(3, 0);
// space filling color
GuiWidget spaceFiller = new GuiWidget(0, 500);
spaceFiller.VAnchor = VAnchor.ParentBottom;
spaceFiller.HAnchor = HAnchor.ParentLeftRight;
spaceFiller.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
spaceFiller.Padding = new BorderDouble(top: 3);
mainContainer.AddChild(spaceFiller);
double topBarHeight = 0;
// the top button bar
{
FlowLayoutWidget topButtonBar = new FlowLayoutWidget();
topButtonBar.HAnchor = HAnchor.ParentLeftRight;
topButtonBar.VAnchor = VAnchor.FitToChildren | VAnchor.ParentTop;
topButtonBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
topButtonBar.Margin = new BorderDouble(0, 3);
Button buttonSetToFactorySettings = textImageButtonFactory.Generate("Reset to Factory Defaults".Localize());
topButtonBar.AddChild(buttonSetToFactorySettings);
buttonSetToFactorySettings.Click += (sender, e) =>
{
currentEePromSettings.SetPrinterToFactorySettings();
currentEePromSettings.Update();
};
mainContainer.AddChild(topButtonBar);
topBarHeight = topButtonBar.Height;
}
// the center content
FlowLayoutWidget conterContent = new FlowLayoutWidget(FlowDirection.TopToBottom);
conterContent.VAnchor = VAnchor.FitToChildren | VAnchor.ParentTop;
conterContent.HAnchor = HAnchor.ParentLeftRight;
conterContent.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
conterContent.Padding = new BorderDouble(top: 3);
conterContent.Margin = new BorderDouble(top: topBarHeight);
conterContent.AddChild(Create4FieldSet("Steps per mm:".Localize(),
"X:", ref stepsPerMmX,
"Y:", ref stepsPerMmY,
"Z:", ref stepsPerMmZ,
"E:", ref stepsPerMmE));
conterContent.AddChild(Create4FieldSet("Maximum feedrates [mm/s]:".Localize(),
"X:", ref maxFeedrateMmPerSX,
"Y:", ref maxFeedrateMmPerSY,
"Z:", ref maxFeedrateMmPerSZ,
"E:", ref maxFeedrateMmPerSE));
conterContent.AddChild(Create4FieldSet("Maximum Acceleration [mm/s²]:".Localize(),
"X:", ref maxAccelerationMmPerSSqrdX,
"Y:", ref maxAccelerationMmPerSSqrdY,
"Z:", ref maxAccelerationMmPerSSqrdZ,
"E:", ref maxAccelerationMmPerSSqrdE));
conterContent.AddChild(CreateField("Acceleration:".Localize(), ref acceleration));
conterContent.AddChild(CreateField("Retract Acceleration:".Localize(), ref retractAcceleration));
conterContent.AddChild(Create3FieldSet("PID settings:".Localize(),
"P:", ref pidP,
"I:", ref pidI,
"D:", ref pidD));
conterContent.AddChild(Create3FieldSet("Homing Offset:".Localize(),
"X:", ref homingOffsetX,
"Y:", ref homingOffsetY,
"Z:", ref homingOffsetZ));
conterContent.AddChild(CreateField("Min feedrate [mm/s]:".Localize(), ref minFeedrate));
conterContent.AddChild(CreateField("Min travel feedrate [mm/s]:".Localize(), ref minTravelFeedrate));
conterContent.AddChild(CreateField("Minimum segment time [ms]:".Localize(), ref minSegmentTime));
conterContent.AddChild(CreateField("Maximum X-Y jerk [mm/s]:".Localize(), ref maxXYJerk));
conterContent.AddChild(CreateField("Maximum Z jerk [mm/s]:".Localize(), ref maxZJerk));
GuiWidget topBottomSpacer = new GuiWidget(1, 1);
topBottomSpacer.VAnchor = VAnchor.ParentBottomTop;
conterContent.AddChild(topBottomSpacer);
mainContainer.AddChild(conterContent);
// the bottom button bar
{
FlowLayoutWidget bottomButtonBar = new FlowLayoutWidget();
//.........这里部分代码省略.........
示例5: AddElements
public void AddElements()
{
Title = LocalizedString.Get("Design Add-ons");
FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
topToBottom.AnchorAll();
topToBottom.Padding = new BorderDouble(3, 0, 3, 5);
FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
headerRow.HAnchor = HAnchor.ParentLeftRight;
headerRow.Margin = new BorderDouble(0, 3, 0, 0);
headerRow.Padding = new BorderDouble(0, 3, 0, 3);
{
string elementHeaderLabelBeg = LocalizedString.Get("Select a Design Tool");
string elementHeaderLabelFull = string.Format("{0}:", elementHeaderLabelBeg);
string elementHeaderLabel = elementHeaderLabelFull;
TextWidget elementHeader = new TextWidget(string.Format(elementHeaderLabel), pointSize: 14);
elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor;
elementHeader.HAnchor = HAnchor.ParentLeftRight;
elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom;
headerRow.AddChild(elementHeader);
}
topToBottom.AddChild(headerRow);
GuiWidget presetsFormContainer = new GuiWidget();
{
presetsFormContainer.HAnchor = HAnchor.ParentLeftRight;
presetsFormContainer.VAnchor = VAnchor.ParentBottomTop;
presetsFormContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
}
FlowLayoutWidget pluginRowContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
pluginRowContainer.AnchorAll();
presetsFormContainer.AddChild(pluginRowContainer);
unlockButtonFactory.Margin = new BorderDouble(10,0);
if (ActiveTheme.Instance.IsDarkTheme)
{
unlockButtonFactory.normalFillColor = new RGBA_Bytes(0, 0, 0, 100);
unlockButtonFactory.normalBorderColor = new RGBA_Bytes(0, 0, 0, 100);
unlockButtonFactory.hoverFillColor = new RGBA_Bytes(0, 0, 0, 50);
unlockButtonFactory.hoverBorderColor = new RGBA_Bytes(0, 0, 0, 50);
}
else
{
unlockButtonFactory.normalFillColor = new RGBA_Bytes(0, 0, 0, 50);
unlockButtonFactory.normalBorderColor = new RGBA_Bytes(0, 0, 0, 50);
unlockButtonFactory.hoverFillColor = new RGBA_Bytes(0, 0, 0, 100);
unlockButtonFactory.hoverBorderColor = new RGBA_Bytes(0, 0, 0, 100);
}
foreach(CreatorInformation creatorInfo in RegisteredCreators.Instance.Creators)
{
FlowLayoutWidget pluginListingContainer = new FlowLayoutWidget();
pluginListingContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
pluginListingContainer.BackgroundColor = RGBA_Bytes.White;
pluginListingContainer.Padding = new BorderDouble(0);
pluginListingContainer.Margin = new BorderDouble(6, 0, 6, 6);
ClickWidget pluginRow = new ClickWidget();
pluginRow.Margin = new BorderDouble(6, 0, 6, 0);
pluginRow.Height = 38;
pluginRow.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
GuiWidget overlay = new GuiWidget();
overlay.AnchorAll();
overlay.Cursor = Cursors.Hand;
FlowLayoutWidget macroRow = new FlowLayoutWidget();
macroRow.AnchorAll();
macroRow.BackgroundColor = RGBA_Bytes.White;
if (creatorInfo.iconPath != "")
{
ImageBuffer imageBuffer = LoadImage(creatorInfo.iconPath);
ImageWidget imageWidget = new ImageWidget(imageBuffer);
imageWidget.VAnchor = Agg.UI.VAnchor.ParentCenter;
macroRow.AddChild(imageWidget);
}
bool userHasPermission;
if (!creatorInfo.paidAddOnFlag)
{
userHasPermission = true;
}
else
{
userHasPermission = creatorInfo.permissionFunction();
}
string addOnDescription;
addOnDescription = creatorInfo.description;
TextWidget buttonLabel = new TextWidget(addOnDescription, pointSize: 14);
buttonLabel.Margin = new BorderDouble(left: 10);
buttonLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
macroRow.AddChild(buttonLabel);
if (!userHasPermission)
//.........这里部分代码省略.........
示例6: SetProcessingMessage
private void SetProcessingMessage(string message)
{
if (gcodeProcessingStateInfoText == null)
{
gcodeProcessingStateInfoText = new TextWidget(message);
gcodeProcessingStateInfoText.HAnchor = HAnchor.ParentCenter;
gcodeProcessingStateInfoText.VAnchor = VAnchor.ParentCenter;
gcodeProcessingStateInfoText.AutoExpandBoundsToText = true;
GuiWidget labelContainer = new GuiWidget();
labelContainer.AnchorAll();
labelContainer.AddChild(gcodeProcessingStateInfoText);
labelContainer.Selectable = false;
gcodeDisplayWidget.AddChild(labelContainer);
}
if (message == "")
{
gcodeProcessingStateInfoText.BackgroundColor = new RGBA_Bytes();
}
else
{
gcodeProcessingStateInfoText.BackgroundColor = RGBA_Bytes.White;
}
gcodeProcessingStateInfoText.Text = message;
}
示例7: SlicePresetsWindow
public SlicePresetsWindow(PresetsContext presetsContext)
: base(641, 481)
{
this.presetsContext = presetsContext;
this.AlwaysOnTopOfMain = true;
this.Title = LocalizedString.Get("Slice Presets Editor");
this.MinimumSize = new Vector2(640, 480);
this.AnchorAll();
var linkButtonFactory = new LinkButtonFactory()
{
fontSize = 8,
textColor = ActiveTheme.Instance.SecondaryAccentColor
};
var buttonFactory = new TextImageButtonFactory()
{
normalTextColor = ActiveTheme.Instance.PrimaryTextColor,
hoverTextColor = ActiveTheme.Instance.PrimaryTextColor,
disabledTextColor = ActiveTheme.Instance.PrimaryTextColor,
pressedTextColor = ActiveTheme.Instance.PrimaryTextColor,
borderWidth = 0
};
FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom)
{
Padding = new BorderDouble(3)
};
mainContainer.AnchorAll();
middleRow = new GuiWidget();
middleRow.AnchorAll();
middleRow.AddChild(CreateSliceSettingsWidget(presetsContext.PersistenceLayer));
mainContainer.AddChild(GetTopRow());
mainContainer.AddChild(middleRow);
mainContainer.AddChild(GetBottomRow(buttonFactory));
this.AddChild(mainContainer);
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
}
示例8: SoftKeyboardContentOffset
public SoftKeyboardContentOffset(GuiWidget content)
{
this.content = content;
AnchorAll();
contentOffsetHolder = new GuiWidget(Width, Height);
contentOffsetHolder.AnchorAll();
contentOffsetHolder.AddChild(content);
AddChild(contentOffsetHolder);
TextEditWidget.ShowSoftwareKeyboard += EnsureEditControlIsVisible;
TextEditWidget.KeyboardCollapsed += MoveContentBackDown;
}
示例9: View3DBrailleBuilder
public View3DBrailleBuilder(Vector3 viewerVolume, Vector2 bedCenter, BedShape bedShape)
{
monoSpacedTypeFace = ApplicationController.MonoSpacedTypeFace;
brailTypeFace = TypeFace.LoadFrom(StaticData.Instance.ReadAllText(Path.Combine("Fonts", "Braille.svg")));
MeshGroupExtraData = new List<PlatingMeshGroupData>();
FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;
mainContainerTopToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight;
FlowLayoutWidget centerPartPreviewAndControls = new FlowLayoutWidget(FlowDirection.LeftToRight);
centerPartPreviewAndControls.AnchorAll();
GuiWidget viewArea = new GuiWidget();
viewArea.AnchorAll();
{
meshViewerWidget = new MeshViewerWidget(viewerVolume, bedCenter, bedShape);
meshViewerWidget.AllowBedRenderingWhenEmpty = true;
meshViewerWidget.AnchorAll();
}
viewArea.AddChild(meshViewerWidget);
centerPartPreviewAndControls.AddChild(viewArea);
mainContainerTopToBottom.AddChild(centerPartPreviewAndControls);
FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight);
buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight;
buttonBottomPanel.Padding = new BorderDouble(3, 3);
buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
buttonRightPanel = CreateRightButtonPanel(viewerVolume.y);
// add in the plater tools
{
FlowLayoutWidget editToolBar = new FlowLayoutWidget();
processingProgressControl = new ProgressControl("Finding Parts:".Localize(), ActiveTheme.Instance.PrimaryTextColor, ActiveTheme.Instance.PrimaryAccentColor);
processingProgressControl.VAnchor = Agg.UI.VAnchor.ParentCenter;
editToolBar.AddChild(processingProgressControl);
editToolBar.VAnchor |= Agg.UI.VAnchor.ParentCenter;
editPlateButtonsContainer = new FlowLayoutWidget();
textToAddWidget = new MHTextEditWidget("", pixelWidth: 300, messageWhenEmptyAndNotSelected: "Enter Text Here".Localize());
textToAddWidget.VAnchor = VAnchor.ParentCenter;
textToAddWidget.Margin = new BorderDouble(5);
editPlateButtonsContainer.AddChild(textToAddWidget);
textToAddWidget.ActualTextEditWidget.EnterPressed += (object sender, KeyEventArgs keyEvent) =>
{
InsertTextNow(textToAddWidget.Text);
};
Button insertTextButton = textImageButtonFactory.Generate("Insert".Localize());
editPlateButtonsContainer.AddChild(insertTextButton);
insertTextButton.Click += (sender, e) =>
{
InsertTextNow(textToAddWidget.Text);
};
editToolBar.AddChild(editPlateButtonsContainer);
buttonBottomPanel.AddChild(editToolBar);
}
GuiWidget buttonRightPanelHolder = new GuiWidget(HAnchor.FitToChildren, VAnchor.ParentBottomTop);
centerPartPreviewAndControls.AddChild(buttonRightPanelHolder);
buttonRightPanelHolder.AddChild(buttonRightPanel);
viewControls3D = new ViewControls3D(meshViewerWidget);
viewControls3D.ResetView += (sender, e) =>
{
meshViewerWidget.ResetView();
};
buttonRightPanelDisabledCover = new Cover(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop);
buttonRightPanelDisabledCover.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryBackgroundColor, 150);
buttonRightPanelHolder.AddChild(buttonRightPanelDisabledCover);
LockEditControls();
GuiWidget leftRightSpacer = new GuiWidget();
leftRightSpacer.HAnchor = HAnchor.ParentLeftRight;
buttonBottomPanel.AddChild(leftRightSpacer);
closeButton = textImageButtonFactory.Generate("Close".Localize());
buttonBottomPanel.AddChild(closeButton);
mainContainerTopToBottom.AddChild(buttonBottomPanel);
this.AddChild(mainContainerTopToBottom);
this.AnchorAll();
meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation;
AddChild(viewControls3D);
// set the view to be a good angle and distance
meshViewerWidget.ResetView();
//.........这里部分代码省略.........
示例10: View3DTransformPart
public View3DTransformPart(PrintItemWrapper printItemWrapper, Vector3 viewerVolume, MeshViewerWidget.BedShape bedShape)
{
MeshExtraData = new List<PlatingMeshData>();
MeshExtraData.Add(new PlatingMeshData());
this.printItemWrapper = printItemWrapper;
FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;
mainContainerTopToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight;
FlowLayoutWidget centerPartPreviewAndControls = new FlowLayoutWidget(FlowDirection.LeftToRight);
centerPartPreviewAndControls.AnchorAll();
GuiWidget viewArea = new GuiWidget();
viewArea.AnchorAll();
{
meshViewerWidget = new MeshViewerWidget(viewerVolume, 1, bedShape);
SetMeshViewerDisplayTheme();
meshViewerWidget.AnchorAll();
}
viewArea.AddChild(meshViewerWidget);
centerPartPreviewAndControls.AddChild(viewArea);
mainContainerTopToBottom.AddChild(centerPartPreviewAndControls);
meshViewerWidget.LoadMesh(printItemWrapper.FileLocation);
meshViewerWidget.LoadDone += new EventHandler(meshViewerWidget_LoadDone);
FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight);
buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight;
buttonBottomPanel.Padding = new BorderDouble(3, 3);
buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
buttonRightPanel = CreateRightButtonPannel(viewerVolume.y);
CreateOptionsContent();
// add in the plater tools
{
FlowLayoutWidget editToolBar = new FlowLayoutWidget();
string progressFindPartsLbl = new LocalizedString ("Finding Parts").Translated;
string progressFindPartsLblFull = string.Format ("{0}:", progressFindPartsLbl);
processingProgressControl = new ProgressControl(progressFindPartsLblFull);
processingProgressControl.VAnchor = Agg.UI.VAnchor.ParentCenter;
editToolBar.AddChild(processingProgressControl);
editToolBar.VAnchor |= Agg.UI.VAnchor.ParentCenter;
processingProgressControl.Visible = false;
editPlateButton = textImageButtonFactory.Generate(new LocalizedString("Edit").Translated);
editToolBar.AddChild(editPlateButton);
editPlateButtonsContainer = new FlowLayoutWidget();
editPlateButtonsContainer.Visible = false;
Button addButton = textImageButtonFactory.Generate(new LocalizedString("Add").Translated, "icon_circle_plus.png");
addButton.Margin = new BorderDouble(right: 10);
editPlateButtonsContainer.AddChild(addButton);
addButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
{
OpenFileDialogParams openParams = new OpenFileDialogParams("Select an STL file|*.stl", multiSelect: true);
FileDialog.OpenFileDialog(ref openParams);
LoadAndAddPartsToPlate(openParams.FileNames);
});
};
Button copyButton = textImageButtonFactory.Generate(new LocalizedString("Copy").Translated);
editPlateButtonsContainer.AddChild(copyButton);
copyButton.Click += (sender, e) =>
{
MakeCopyOfMesh();
};
Button deleteButton = textImageButtonFactory.Generate(new LocalizedString("Delete").Translated);
deleteButton.Margin = new BorderDouble(left: 20);
editPlateButtonsContainer.AddChild(deleteButton);
deleteButton.Click += (sender, e) =>
{
DeleteSelectedMesh();
};
KeyDown += (sender, e) =>
{
KeyEventArgs keyEvent = e as KeyEventArgs;
if (keyEvent != null && !keyEvent.Handled)
{
if (keyEvent.KeyCode == Keys.Delete || keyEvent.KeyCode == Keys.Back)
{
DeleteSelectedMesh();
}
if (keyEvent.KeyCode == Keys.Escape)
{
if (meshSelectInfo.downOnPart)
{
//.........这里部分代码省略.........
示例11: TabPage
public TabPage(GuiWidget widgetToAddToPage, string tabTitle)
: this(tabTitle)
{
widgetToAddToPage.AnchorAll();
AddChild(widgetToAddToPage);
}
示例12: View3DTransformPart
public View3DTransformPart(PrintItemWrapper printItemWrapper, Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape, WindowType windowType, AutoRotate autoRotate)
{
this.windowType = windowType;
autoRotateEnabled = (autoRotate == AutoRotate.Enabled);
MeshExtraData = new List<PlatingMeshData>();
MeshExtraData.Add(new PlatingMeshData());
this.printItemWrapper = printItemWrapper;
FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;
mainContainerTopToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight;
FlowLayoutWidget centerPartPreviewAndControls = new FlowLayoutWidget(FlowDirection.LeftToRight);
centerPartPreviewAndControls.AnchorAll();
GuiWidget viewArea = new GuiWidget();
viewArea.AnchorAll();
{
meshViewerWidget = new MeshViewerWidget(viewerVolume, bedCenter, bedShape, "Press 'Add' to select an item.".Localize());
// this is to add an image to the bed
string imagePathAndFile = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "OEMSettings", "bedimage.png");
if (autoRotateEnabled && File.Exists(imagePathAndFile))
{
ImageBuffer wattermarkImage = new ImageBuffer();
ImageIO.LoadImageData(imagePathAndFile, wattermarkImage);
ImageBuffer bedImage = meshViewerWidget.BedImage;
Graphics2D bedGraphics = bedImage.NewGraphics2D();
bedGraphics.Render(wattermarkImage,
new Vector2((bedImage.Width - wattermarkImage.Width) / 2, (bedImage.Height - wattermarkImage.Height)/2));
}
meshViewerWidget.AnchorAll();
}
viewArea.AddChild(meshViewerWidget);
centerPartPreviewAndControls.AddChild(viewArea);
mainContainerTopToBottom.AddChild(centerPartPreviewAndControls);
FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight);
buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight;
buttonBottomPanel.Padding = new BorderDouble(3, 3);
buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
buttonRightPanel = CreateRightButtonPanel(viewerVolume.y);
CreateOptionsContent();
// add in the plater tools
{
FlowLayoutWidget editToolBar = new FlowLayoutWidget();
string progressFindPartsLabel = LocalizedString.Get("Finding Parts");
string progressFindPartsLabelFull = "{0}:".FormatWith(progressFindPartsLabel);
processingProgressControl = new ProgressControl(progressFindPartsLabelFull, ActiveTheme.Instance.PrimaryTextColor, ActiveTheme.Instance.PrimaryAccentColor);
processingProgressControl.VAnchor = Agg.UI.VAnchor.ParentCenter;
editToolBar.AddChild(processingProgressControl);
editToolBar.VAnchor |= Agg.UI.VAnchor.ParentCenter;
processingProgressControl.Visible = false;
// If the window is embeded (in the center pannel) and there is no item loaded then don't show the add button
enterEditButtonsContainer = new FlowLayoutWidget();
{
Button addButton = textImageButtonFactory.Generate(LocalizedString.Get("Add"), "icon_circle_plus.png");
addButton.Margin = new BorderDouble(right: 10);
enterEditButtonsContainer.AddChild(addButton);
addButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
{
EnterEditAndSplitIntoMeshes();
OpenAddDialogWhenDone = true;
});
};
Button enterEdittingButton = textImageButtonFactory.Generate(LocalizedString.Get("Edit"));
enterEdittingButton.Click += (sender, e) =>
{
EnterEditAndSplitIntoMeshes();
};
enterEditButtonsContainer.AddChild(enterEdittingButton);
}
editToolBar.AddChild(enterEditButtonsContainer);
doEdittingButtonsContainer = new FlowLayoutWidget();
doEdittingButtonsContainer.Visible = false;
{
Button addButton = textImageButtonFactory.Generate(LocalizedString.Get("Add"), "icon_circle_plus.png");
addButton.Margin = new BorderDouble(right: 10);
doEdittingButtonsContainer.AddChild(addButton);
addButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
{
OpenFileDialogParams openParams = new OpenFileDialogParams("Select an STL file|*.stl", multiSelect: true);
//.........这里部分代码省略.........
示例13: LoadMesh
public void LoadMesh(string meshPathAndFileName)
{
backgroundWorker = new BackgroundWorker();
backgroundWorker.WorkerReportsProgress = true;
backgroundWorker.WorkerSupportsCancellation = true;
backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker_ProgressChanged);
backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker_RunWorkerCompleted);
bool loadingMeshFile = false;
switch(Path.GetExtension(meshPathAndFileName).ToUpper())
{
case ".STL":
{
StlProcessing stlLoader = new StlProcessing();
stlLoader.LoadInBackground(backgroundWorker, meshPathAndFileName);
loadingMeshFile = true;
}
break;
case ".AMF":
{
AmfProcessing amfLoader = new AmfProcessing();
amfLoader.LoadInBackground(backgroundWorker, meshPathAndFileName);
loadingMeshFile = true;
}
break;
default:
loadingMeshFile = false;
break;
}
if (loadingMeshFile)
{
meshLoadingStateInfoText = new TextWidget("Loading Mesh...");
meshLoadingStateInfoText.HAnchor = HAnchor.ParentCenter;
meshLoadingStateInfoText.VAnchor = VAnchor.ParentCenter;
meshLoadingStateInfoText.AutoExpandBoundsToText = true;
GuiWidget labelContainer = new GuiWidget();
labelContainer.AnchorAll();
labelContainer.AddChild(meshLoadingStateInfoText);
labelContainer.Selectable = false;
this.AddChild(labelContainer);
}
else
{
TextWidget no3DView = new TextWidget(string.Format("No 3D view for this file type '{0}'.", Path.GetExtension(meshPathAndFileName).ToUpper()));
no3DView.Margin = new BorderDouble(0, 0, 0, 0);
no3DView.VAnchor = Agg.UI.VAnchor.ParentCenter;
no3DView.HAnchor = Agg.UI.HAnchor.ParentCenter;
this.AddChild(no3DView);
}
}
示例14: DoLayout
private void DoLayout()
{
FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
mainContainer.AnchorAll();
FlowLayoutWidget labelContainer = new FlowLayoutWidget();
labelContainer.HAnchor = HAnchor.ParentLeftRight;
TextWidget formLabel = new TextWidget("After a Print is Finished:".Localize(), pointSize: 16);
formLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
formLabel.VAnchor = VAnchor.ParentCenter;
formLabel.Margin = new BorderDouble(10, 0,10, 12);
labelContainer.AddChild(formLabel);
mainContainer.AddChild(labelContainer);
centerContainer = new GuiWidget();
centerContainer.AnchorAll();
centerContainer.Padding = new BorderDouble(10);
messageContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
messageContainer.AnchorAll();
messageContainer.Visible = false;
messageContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
messageContainer.Padding = new BorderDouble(10);
submissionStatus = new TextWidget("Saving your settings...".Localize(), pointSize: 13);
submissionStatus.AutoExpandBoundsToText = true;
submissionStatus.Margin = new BorderDouble(0, 5);
submissionStatus.TextColor = ActiveTheme.Instance.PrimaryTextColor;
submissionStatus.HAnchor = HAnchor.ParentLeft;
messageContainer.AddChild(submissionStatus);
formContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
formContainer.AnchorAll();
formContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
formContainer.Padding = new BorderDouble(10);
{
FlowLayoutWidget smsLabelContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
smsLabelContainer.Margin = new BorderDouble(0, 2, 0, 4);
smsLabelContainer.HAnchor |= Agg.UI.HAnchor.ParentLeft;
//Add sms notification option
notifySendTextCheckbox = new CheckBox("Send an SMS notification".Localize());
notifySendTextCheckbox.Margin = new BorderDouble(0);
notifySendTextCheckbox.VAnchor = Agg.UI.VAnchor.ParentBottom;
notifySendTextCheckbox.TextColor = ActiveTheme.Instance.PrimaryTextColor;
notifySendTextCheckbox.Cursor = Cursors.Hand;
notifySendTextCheckbox.Checked = (UserSettings.Instance.get("AfterPrintFinishedSendTextMessage") == "true");
notifySendTextCheckbox.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(OnSendTextChanged);
TextWidget experimentalLabel = new TextWidget("Experimental".Localize(), pointSize: 10);
experimentalLabel.TextColor = ActiveTheme.Instance.SecondaryAccentColor;
experimentalLabel.VAnchor = Agg.UI.VAnchor.ParentBottom;
experimentalLabel.Margin = new BorderDouble(left:10);
smsLabelContainer.AddChild(notifySendTextCheckbox);
smsLabelContainer.AddChild(experimentalLabel);
formContainer.AddChild(smsLabelContainer);
formContainer.AddChild(LabelGenerator("Have MatterControl send you a text message after your print is finished".Localize(), 9, 14));
phoneNumberContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
phoneNumberContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
phoneNumberLabel = LabelGenerator("Your Phone Number*".Localize());
phoneNumberHelperLabel = LabelGenerator("A U.S. or Canadian mobile phone number".Localize(), 9, 14);
phoneNumberContainer.AddChild(phoneNumberLabel);
phoneNumberContainer.AddChild(phoneNumberHelperLabel);
phoneNumberInput = new MHTextEditWidget();
phoneNumberInput.HAnchor = HAnchor.ParentLeftRight;
string phoneNumber = UserSettings.Instance.get("NotificationPhoneNumber");
if (phoneNumber != null)
{
phoneNumberInput.Text = phoneNumber;
}
phoneNumberContainer.AddChild(phoneNumberInput);
phoneNumberErrorMessage = ErrorMessageGenerator();
phoneNumberContainer.AddChild(phoneNumberErrorMessage);
formContainer.AddChild(phoneNumberContainer);
}
{
//Add email notification option
notifySendEmailCheckbox = new CheckBox("Send an email notification".Localize());
notifySendEmailCheckbox.Margin = new BorderDouble(0, 2, 0, 16);
notifySendEmailCheckbox.HAnchor = Agg.UI.HAnchor.ParentLeft;
notifySendEmailCheckbox.TextColor = ActiveTheme.Instance.PrimaryTextColor;
notifySendEmailCheckbox.Cursor = Cursors.Hand;
notifySendEmailCheckbox.Checked = (UserSettings.Instance.get("AfterPrintFinishedSendEmail") == "true");
notifySendEmailCheckbox.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(OnSendEmailChanged);
formContainer.AddChild(notifySendEmailCheckbox);
//.........这里部分代码省略.........
示例15: CSGOpenGLApplication
public CSGOpenGLApplication(string meshFileToLoad = "")
: base(800, 600)
{
MinimumSize = new VectorMath.Vector2(200, 200);
Title = "MatterHackers MeshViewr";
UseOpenGL = true;
StencilBufferDepth = 8;
BitDepth = ValidDepthVaules.Depth24;
FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
mainContainer.AnchorAll();
viewArea = new GuiWidget();
viewArea.AnchorAll();
double bedXSize = 200;
double bedYSize = 200;
double scale = 1;
meshViewerWidget = new MeshViewerWidget(bedXSize, bedYSize, scale);
MeshViewWidget.AnchorAll();
viewArea.AddChild(MeshViewWidget);
mainContainer.AddChild(viewArea);
FlowLayoutWidget buttonPanel = new FlowLayoutWidget(FlowDirection.LeftToRight);
buttonPanel.HAnchor = HAnchor.ParentLeftRight;
buttonPanel.Padding = new BorderDouble(3, 3);
buttonPanel.BackgroundColor = RGBA_Bytes.DarkGray;
if (meshFileToLoad != "")
{
MeshViewWidget.LoadMesh(meshFileToLoad);
}
else
{
openFileButton = new Button("Open 3D File", 0, 0);
openFileButton.Click += new Button.ButtonEventHandler(openFileButton_ButtonClick);
buttonPanel.AddChild(openFileButton);
}
bedCheckBox = new CheckBox("Bed");
bedCheckBox.Checked = true;
buttonPanel.AddChild(bedCheckBox);
wireframeCheckBox = new CheckBox("Wireframe");
buttonPanel.AddChild(wireframeCheckBox);
GuiWidget leftRightSpacer = new GuiWidget();
leftRightSpacer.HAnchor = HAnchor.ParentLeftRight;
buttonPanel.AddChild(leftRightSpacer);
mainContainer.AddChild(buttonPanel);
this.AddChild(mainContainer);
this.AnchorAll();
bedCheckBox.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(bedCheckBox_CheckedStateChanged);
wireframeCheckBox.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(wireframeCheckBox_CheckedStateChanged);
}