public FirstPanelTabView(QueueDataView queueDataView) { this.queueDataView = queueDataView; this.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; this.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0); this.TabBar.Margin = new BorderDouble(0, 0); this.TabBar.Padding = new BorderDouble(0, 2); this.Margin = new BorderDouble(top: 4); QueueTabPage = new TabPage(new QueueDataWidget(queueDataView), LocalizedString.Get("Queue").ToUpper()); this.AddTab(new SimpleTextTabWidget(QueueTabPage, "Queue Tab", 15, ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); LibraryTabPage = new TabPage(new PrintLibraryWidget(), LocalizedString.Get("Library").ToUpper()); this.AddTab(new SimpleTextTabWidget(LibraryTabPage, "Library Tab", 15, ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); HistoryTabPage = new TabPage(new PrintHistoryWidget(), LocalizedString.Get("History").ToUpper()); this.AddTab(new SimpleTextTabWidget(HistoryTabPage, "History Tab", 15, ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); NumQueueItemsChanged(this, null); QueueData.Instance.ItemAdded.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents); QueueData.Instance.ItemRemoved.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents); WidescreenPanel.PreChangePanels.RegisterEvent(SaveCurrentTab, ref unregisterEvents); SelectedTabIndex = firstPanelCurrentTab; }
public CompactSlidePanel(QueueDataView queueDataView) : base(2) { this.queueDataView = queueDataView; // do the front panel stuff { // first add the print progress bar this.LeftPanel.AddChild(new PrintProgressBar()); // construct the main controls tab control mainControlsTabControl = new FirstPanelTabView(queueDataView); var advancedControlsButtonFactory = new TextImageButtonFactory() { normalTextColor = ActiveTheme.Instance.PrimaryTextColor, hoverTextColor = ActiveTheme.Instance.PrimaryTextColor, pressedTextColor = ActiveTheme.Instance.PrimaryTextColor, fontSize = 10, disabledTextColor = RGBA_Bytes.LightGray, disabledFillColor = ActiveTheme.Instance.PrimaryBackgroundColor, disabledBorderColor = ActiveTheme.Instance.PrimaryBackgroundColor, invertImageLocation = true }; Button advancedControlsLinkButton = advancedControlsButtonFactory.Generate(LocalizedString.Get("Settings\n& Controls"), StaticData.Instance.LoadIcon("icon_arrow_right_32x32.png", 32,32)); advancedControlsLinkButton.Name = "SettingsAndControls"; advancedControlsLinkButton.ToolTipText = "Switch to Settings, Controls and Options".Localize(); advancedControlsLinkButton.Margin = new BorderDouble(right: 3); advancedControlsLinkButton.VAnchor = VAnchor.ParentBottom; advancedControlsLinkButton.Cursor = Cursors.Hand; advancedControlsLinkButton.Click += ToggleActivePanel_Click; mainControlsTabControl.TabBar.AddChild(new HorizontalSpacer()); mainControlsTabControl.TabBar.AddChild(advancedControlsLinkButton); mainControlsTabControl.TabBar.HAnchor = HAnchor.Max_FitToChildren_ParentWidth; mainControlsTabControl.HAnchor = HAnchor.Max_FitToChildren_ParentWidth; this.LeftPanel.AddChild(mainControlsTabControl); } // Right panel this.RightPanel.AddChild(new PrintProgressBar()); var advancedControlsPanel = new AdvancedControlsPanel() { Name = "For - CompactSlidePanel" }; advancedControlsPanel.BackClicked += ToggleActivePanel_Click; this.RightPanel.AddChild(advancedControlsPanel); WidescreenPanel.PreChangePanels.RegisterEvent(SaveCurrentPanelIndex, ref unregisterEvents); SetPanelIndexImmediate(lastPanelIndexBeforeReload); }
public CompactSlidePanel(QueueDataView queueDataView) : base(2) { this.queueDataView = queueDataView; // do the front panel stuff { // first add the print progress bar this.LeftPanel.AddChild(new PrintProgressBar()); // construct the main controls tab control mainControlsTabControl = new FirstPanelTabView(queueDataView); TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory(); advancedControlsButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; advancedControlsButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; advancedControlsButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; advancedControlsButtonFactory.fontSize = 10; advancedControlsButtonFactory.disabledTextColor = RGBA_Bytes.LightGray; advancedControlsButtonFactory.disabledFillColor = ActiveTheme.Instance.PrimaryBackgroundColor; advancedControlsButtonFactory.disabledBorderColor = ActiveTheme.Instance.PrimaryBackgroundColor; advancedControlsButtonFactory.invertImageLocation = true; Button advancedControlsLinkButton = advancedControlsButtonFactory.Generate(LocalizedString.Get("Settings\n& Controls"), "icon_arrow_right_32x32.png"); advancedControlsLinkButton.Name = "SettingsAndControls"; advancedControlsLinkButton.ToolTipText = "Switch to Settings, Controls and Options".Localize(); advancedControlsLinkButton.Margin = new BorderDouble(right: 3); advancedControlsLinkButton.VAnchor = VAnchor.ParentBottom; advancedControlsLinkButton.Cursor = Cursors.Hand; advancedControlsLinkButton.Click += new EventHandler(AdvancedControlsButton_Click); advancedControlsLinkButton.MouseEnterBounds += new EventHandler(onMouseEnterBoundsAdvancedControlsLink); advancedControlsLinkButton.MouseLeaveBounds += new EventHandler(onMouseLeaveBoundsAdvancedControlsLink); GuiWidget hSpacer = new GuiWidget(); hSpacer.HAnchor = HAnchor.ParentLeftRight; mainControlsTabControl.TabBar.AddChild(hSpacer); mainControlsTabControl.TabBar.AddChild(advancedControlsLinkButton); mainControlsTabControl.TabBar.HAnchor = HAnchor.Max_FitToChildren_ParentWidth; mainControlsTabControl.HAnchor = HAnchor.Max_FitToChildren_ParentWidth; this.LeftPanel.AddChild(mainControlsTabControl); } // do the right panel { this.RightPanel.AddChild(new PrintProgressBar()); ThirdPanelTabView thirdPanelTabView = new ThirdPanelTabView(AdvancedControlsButton_Click, onMouseEnterBoundsPrintQueueLink, onMouseLeaveBoundsPrintQueueLink); thirdPanelTabView.Name = "For - CompactSlidePanel"; this.RightPanel.AddChild(thirdPanelTabView); } WidescreenPanel.PreChangePanels.RegisterEvent(SaveCurrentPanelIndex, ref unregisterEvents); SetPanelIndexImediate(lastPanelIndexBeforeReload); }
public static GuiWidget Create(QueueDataView queueDataView) { if (UserSettings.Instance.IsTouchScreen) { return new TouchScreenPrintStatusRow(queueDataView); } else { return new DesktopPrintStatusRow(queueDataView); } }
public QueueRowItem(PrintItemWrapper printItemWrapper, QueueDataView queueDataView) { this.queueDataView = queueDataView; this.PrintItemWrapper = printItemWrapper; this.Name = "Queue Item " + printItemWrapper.Name; // Ensure queue items do not overwrite existing AMF files on disk when converting // from STL or similar to AMF this.PrintItemWrapper.UseIncrementedNameDuringTypeChange = true; ConstructPrintQueueItem(); }
public PrintStatusRow(QueueDataView queueDataView) { Initialize(); this.HAnchor = HAnchor.ParentLeftRight; this.queueDataView = queueDataView; AddChildElements(); AddHandlers(); onActivePrintItemChanged(null, null); if (privateAddIconToPrintStatusRow != null) { privateAddIconToPrintStatusRow(iconContainer); } }
public PrintActionRow(QueueDataView queueDataView) { this.HAnchor = HAnchor.ParentLeftRight; textImageButtonFactory.normalTextColor = RGBA_Bytes.White; textImageButtonFactory.disabledTextColor = RGBA_Bytes.LightGray; textImageButtonFactory.hoverTextColor = RGBA_Bytes.White; textImageButtonFactory.pressedTextColor = RGBA_Bytes.White; textImageButtonFactory.AllowThemeToAdjustImage = false; textImageButtonFactory.borderWidth = 1; textImageButtonFactory.FixedHeight = 52 * GuiWidget.DeviceScale; textImageButtonFactory.fontSize = 14; textImageButtonFactory.normalBorderColor = new RGBA_Bytes(255, 255, 255, 100); textImageButtonFactory.hoverBorderColor = new RGBA_Bytes(255, 255, 255, 100); this.queueDataView = queueDataView; AddChildElements(); AddHandlers(); }
public QueueBottomToolbar(QueueDataView queueDataView) { this.queueDataView = queueDataView; SetDisplayAttributes(); textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.borderWidth = 0; FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom); { { // Ensure the form opens with no rows selected. //ActiveQueueList.Instance.ClearSelected(); allControls.AddChild(queueDataView); } FlowLayoutWidget buttonPanel1 = new FlowLayoutWidget(); buttonPanel1.HAnchor = HAnchor.ParentLeftRight; buttonPanel1.Padding = new BorderDouble(0, 3); { Button addToQueueButton = textImageButtonFactory.Generate(LocalizedString.Get("Add"), "icon_circle_plus.png"); buttonPanel1.AddChild(addToQueueButton); addToQueueButton.Margin = new BorderDouble(0, 0, 3, 0); addToQueueButton.Click += new ButtonBase.ButtonEventHandler(addToQueueButton_Click); // put in the creator button { Button runCreator = textImageButtonFactory.Generate(LocalizedString.Get("Create"), "icon_creator_white_32x32.png"); buttonPanel1.AddChild(runCreator); runCreator.Margin = new BorderDouble(0, 0, 3, 0); runCreator.Click += (sender, e) => { OpenPluginChooserWindow(); }; } if(OemSettings.Instance.ShowShopButton) { shopButton = textImageButtonFactory.Generate(LocalizedString.Get("Buy Materials"), "icon_shopping_cart_32x32.png"); buttonPanel1.AddChild(shopButton); shopButton.Margin = new BorderDouble(0, 0, 3, 0); shopButton.Click += (sender, e) => { double activeFilamentDiameter = 0; if(ActivePrinterProfile.Instance.ActivePrinter != null) { activeFilamentDiameter = 3; if (ActiveSliceSettings.Instance.FilamentDiameter < 2) { activeFilamentDiameter = 1.75; } } System.Diagnostics.Process.Start("http://www.matterhackers.com/mc/store/redirect?d={0}&clk=mcs&a={1}".FormatWith(activeFilamentDiameter, OemSettings.Instance.AffiliateCode)); }; } Button deleteAllFromQueueButton = textImageButtonFactory.Generate(LocalizedString.Get("Remove All")); deleteAllFromQueueButton.Margin = new BorderDouble(3, 0); deleteAllFromQueueButton.Click += new ButtonBase.ButtonEventHandler(deleteAllFromQueueButton_Click); //buttonPanel1.AddChild(deleteAllFromQueueButton); GuiWidget spacer1 = new GuiWidget(); spacer1.HAnchor = HAnchor.ParentLeftRight; buttonPanel1.AddChild(spacer1); GuiWidget spacer2 = new GuiWidget(); spacer2.HAnchor = HAnchor.ParentLeftRight; buttonPanel1.AddChild(spacer2); FlowLayoutWidget queueMenuSpace = new FlowLayoutWidget(); GuiWidget queueMenu = new QueueOptionsMenu(); queueMenu.VAnchor = VAnchor.ParentTop; queueMenuSpace.AddChild(queueMenu); buttonPanel1.AddChild(queueMenuSpace); ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent((object sender, EventArgs e) => { queueMenuSpace.RemoveAllChildren(); // the printer changed reload the queueMenue queueMenu = new QueueOptionsMenu(); queueMenu.VAnchor = VAnchor.ParentTop; queueMenuSpace.AddChild(queueMenu); }, ref unregisterEvents); } allControls.AddChild(buttonPanel1); } allControls.AnchorAll(); this.AddChild(allControls); }
public QueueDataWidget(QueueDataView queueDataView) { this.queueDataView = queueDataView; SetDisplayAttributes(); textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.borderWidth = 0; editButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.disabledTextColor = ActiveTheme.Instance.TabLabelUnselected; editButtonFactory.disabledFillColor = new RGBA_Bytes(); editButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.borderWidth = 0; editButtonFactory.Margin = new BorderDouble(10, 0); editButtonFactory.Margin *= TextWidget.GlobalPointSizeScaleRatio; FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom); { enterEditModeButton = editButtonFactory.Generate("Edit".Localize(), centerText: true); enterEditModeButton.Click += enterEditModeButtonClick; leaveEditModeButton = editButtonFactory.Generate("Done".Localize(), centerText: true); leaveEditModeButton.Click += leaveEditModeButtonClick; // make sure the buttons are the same size even when localized if (leaveEditModeButton.Width < enterEditModeButton.Width) { editButtonFactory.FixedWidth = enterEditModeButton.Width; leaveEditModeButton = editButtonFactory.Generate("Done".Localize(), centerText: true); leaveEditModeButton.Click += leaveEditModeButtonClick; } else { editButtonFactory.FixedWidth = leaveEditModeButton.Width; enterEditModeButton = editButtonFactory.Generate("Edit".Localize(), centerText: true); enterEditModeButton.Click += enterEditModeButtonClick; } CreateEditBarButtons(); leaveEditModeButton.Visible = false; FlowLayoutWidget topBarContainer = new FlowLayoutWidget(); topBarContainer.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay; topBarContainer.HAnchor = HAnchor.ParentLeftRight; topBarContainer.Padding = new BorderDouble(0); topBarContainer.AddChild(enterEditModeButton); topBarContainer.AddChild(leaveEditModeButton); topBarContainer.AddChild(new HorizontalSpacer()); topBarContainer.AddChild(itemOperationButtons); // put in the itme edit menu { moreMenu = new DropDownMenu("More".Localize() + "... "); moreMenu.NormalColor = new RGBA_Bytes(); moreMenu.BorderWidth = 1; moreMenu.BorderColor = ActiveTheme.Instance.SecondaryTextColor; moreMenu.MenuAsWideAsItems = false; moreMenu.VAnchor = VAnchor.ParentBottomTop; moreMenu.Margin = new BorderDouble(3, 3); moreMenu.AlignToRightEdge = true; topBarContainer.AddChild(moreMenu); SetMenuItems(moreMenu); moreMenu.SelectionChanged += new EventHandler(ItemMenu_SelectionChanged); } allControls.AddChild(topBarContainer); { // Ensure the form opens with no rows selected. //ActiveQueueList.Instance.ClearSelected(); allControls.AddChild(queueDataView); } FlowLayoutWidget buttonPanel1 = new FlowLayoutWidget(); buttonPanel1.HAnchor = HAnchor.ParentLeftRight; buttonPanel1.Padding = new BorderDouble(0, 3); buttonPanel1.MinimumSize = new Vector2(0, 46); { addToQueueButton = textImageButtonFactory.Generate(LocalizedString.Get("Add"), "icon_circle_plus.png"); buttonPanel1.AddChild(addToQueueButton); addToQueueButton.Margin = new BorderDouble(0, 0, 3, 0); addToQueueButton.Click += new EventHandler(addToQueueButton_Click); // put in the creator button { createButton = textImageButtonFactory.Generate(LocalizedString.Get("Create"), "icon_creator_white_32x32.png"); buttonPanel1.AddChild(createButton); createButton.Margin = new BorderDouble(0, 0, 3, 0); createButton.Click += (sender, e) => { OpenPluginChooserWindow(); }; } bool touchScreenMode = ActiveTheme.Instance.IsTouchScreen; if (!touchScreenMode) { if (OemSettings.Instance.ShowShopButton) { shopButton = textImageButtonFactory.Generate(LocalizedString.Get("Buy Materials"), "icon_shopping_cart_32x32.png"); buttonPanel1.AddChild(shopButton); shopButton.Margin = new BorderDouble(0, 0, 3, 0); shopButton.Click += (sender, e) => { double activeFilamentDiameter = 0; if (ActivePrinterProfile.Instance.ActivePrinter != null) { activeFilamentDiameter = 3; if (ActiveSliceSettings.Instance.FilamentDiameter < 2) { activeFilamentDiameter = 1.75; } } MatterControlApplication.Instance.LaunchBrowser("http://www.matterhackers.com/mc/store/redirect?d={0}&clk=mcs&a={1}".FormatWith(activeFilamentDiameter, OemSettings.Instance.AffiliateCode)); }; } } buttonPanel1.AddChild(new HorizontalSpacer()); queueMenuContainer = new FlowLayoutWidget(); queueMenuContainer.VAnchor = Agg.UI.VAnchor.ParentBottomTop; queueMenu = new QueueOptionsMenu(); queueMenuContainer.AddChild(queueMenu.MenuDropList); if (!touchScreenMode) { buttonPanel1.AddChild(queueMenuContainer); } ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent((object sender, EventArgs e) => { queueMenuContainer.RemoveAllChildren(); // the printer changed reload the queueMenue queueMenu = new QueueOptionsMenu(); queueMenuContainer.AddChild(queueMenu.MenuDropList); }, ref unregisterEvents); } allControls.AddChild(buttonPanel1); } allControls.AnchorAll(); this.AddChild(allControls); AddHandlers(); //enterEditModeButtonClick(null, null); }
public QueueDataWidget(QueueDataView queueDataView) { this.queueDataView = queueDataView; SetDisplayAttributes(); textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.borderWidth = 0; editButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.borderWidth = 0; editButtonFactory.FixedWidth = 70 * TextWidget.GlobalPointSizeScaleRatio; FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom); { enterEditModeButton = editButtonFactory.Generate("Edit".Localize(), centerText: true); leaveEditModeButton = editButtonFactory.Generate("Done".Localize(), centerText: true); leaveEditModeButton.Visible = false; FlowLayoutWidget searchPanel = new FlowLayoutWidget(); searchPanel.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay; searchPanel.HAnchor = HAnchor.ParentLeftRight; searchPanel.Padding = new BorderDouble(0); searchPanel.AddChild(enterEditModeButton); searchPanel.AddChild(leaveEditModeButton); searchPanel.AddChild(new HorizontalSpacer()); allControls.AddChild(searchPanel); { // Ensure the form opens with no rows selected. //ActiveQueueList.Instance.ClearSelected(); allControls.AddChild(queueDataView); } FlowLayoutWidget buttonPanel1 = new FlowLayoutWidget(); buttonPanel1.HAnchor = HAnchor.ParentLeftRight; buttonPanel1.Padding = new BorderDouble(0, 3); buttonPanel1.MinimumSize = new Vector2(0, 46); { addToQueueButton = textImageButtonFactory.Generate(LocalizedString.Get("Add"), "icon_circle_plus.png"); buttonPanel1.AddChild(addToQueueButton); addToQueueButton.Margin = new BorderDouble(0, 0, 3, 0); addToQueueButton.Click += new EventHandler(addToQueueButton_Click); // put in the creator button { createButton = textImageButtonFactory.Generate(LocalizedString.Get("Create"), "icon_creator_white_32x32.png"); buttonPanel1.AddChild(createButton); createButton.Margin = new BorderDouble(0, 0, 3, 0); createButton.Click += (sender, e) => { OpenPluginChooserWindow(); }; } sendItemButton = textImageButtonFactory.Generate("Send".Localize()); sendItemButton.Margin = new BorderDouble(0, 0, 3, 0); sendItemButton.Click += new EventHandler(sendButton_Click); sendItemButton.Visible = false; buttonPanel1.AddChild(sendItemButton); exportItemButton = textImageButtonFactory.Generate("Export".Localize()); exportItemButton.Margin = new BorderDouble(3, 0); exportItemButton.Click += new EventHandler(exportButton_Click); exportItemButton.Visible = false; buttonPanel1.AddChild(exportItemButton); copyItemButton = textImageButtonFactory.Generate("Copy".Localize()); copyItemButton.Margin = new BorderDouble(3, 0); copyItemButton.Click += new EventHandler(copy_Button_Click); copyItemButton.Visible = false; buttonPanel1.AddChild(copyItemButton); removeItemButton = textImageButtonFactory.Generate("Remove".Localize()); removeItemButton.Margin = new BorderDouble(3, 0); removeItemButton.Click += new EventHandler(removeButton_Click); removeItemButton.Visible = false; buttonPanel1.AddChild(removeItemButton); if (OemSettings.Instance.ShowShopButton) { shopButton = textImageButtonFactory.Generate(LocalizedString.Get("Buy Materials"), "icon_shopping_cart_32x32.png"); buttonPanel1.AddChild(shopButton); shopButton.Margin = new BorderDouble(0, 0, 3, 0); shopButton.Click += (sender, e) => { double activeFilamentDiameter = 0; if (ActivePrinterProfile.Instance.ActivePrinter != null) { activeFilamentDiameter = 3; if (ActiveSliceSettings.Instance.FilamentDiameter < 2) { activeFilamentDiameter = 1.75; } } MatterControlApplication.Instance.LaunchBrowser("http://www.matterhackers.com/mc/store/redirect?d={0}&clk=mcs&a={1}".FormatWith(activeFilamentDiameter, OemSettings.Instance.AffiliateCode)); }; } Button deleteAllFromQueueButton = textImageButtonFactory.Generate(LocalizedString.Get("Remove All")); deleteAllFromQueueButton.Margin = new BorderDouble(3, 0); deleteAllFromQueueButton.Click += new EventHandler(deleteAllFromQueueButton_Click); //buttonPanel1.AddChild(deleteAllFromQueueButton); buttonPanel1.AddChild(new HorizontalSpacer()); queueMenuContainer = new FlowLayoutWidget(); queueMenuContainer.VAnchor = Agg.UI.VAnchor.ParentBottomTop; queueMenu = new QueueOptionsMenu(); queueMenuContainer.AddChild(queueMenu.MenuDropList); buttonPanel1.AddChild(queueMenuContainer); ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent((object sender, EventArgs e) => { queueMenuContainer.RemoveAllChildren(); // the printer changed reload the queueMenue queueMenu = new QueueOptionsMenu(); queueMenuContainer.AddChild(queueMenu.MenuDropList); }, ref unregisterEvents); } allControls.AddChild(buttonPanel1); } allControls.AnchorAll(); this.AddChild(allControls); AddHandlers(); }
public ActionBarPlus(QueueDataView queueDataView) : base(FlowDirection.TopToBottom) { this.queueDataView = queueDataView; this.Create(); }
public QueueDataWidget(QueueDataView queueDataView) { this.queueDataView = queueDataView; SetDisplayAttributes(); textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.borderWidth = 0; editButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.disabledTextColor = ActiveTheme.Instance.TabLabelUnselected; editButtonFactory.disabledFillColor = new RGBA_Bytes(); editButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.borderWidth = 0; editButtonFactory.Margin = new BorderDouble(10, 0); FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom); { enterEditModeButton = editButtonFactory.Generate("Edit".Localize(), centerText: true); enterEditModeButton.ToolTipText = "Enter Multi Select mode".Localize(); enterEditModeButton.Click += enterEditModeButtonClick; leaveEditModeButton = editButtonFactory.Generate("Done".Localize(), centerText: true); leaveEditModeButton.Name = "Queue Done Button"; leaveEditModeButton.Click += leaveEditModeButtonClick; // make sure the buttons are the same size even when localized if (leaveEditModeButton.Width < enterEditModeButton.Width) { editButtonFactory.FixedWidth = enterEditModeButton.Width; leaveEditModeButton = editButtonFactory.Generate("Done".Localize(), centerText: true); leaveEditModeButton.Click += leaveEditModeButtonClick; } else { editButtonFactory.FixedWidth = leaveEditModeButton.Width; enterEditModeButton = editButtonFactory.Generate("Edit".Localize(), centerText: true); enterEditModeButton.Name = "Queue Edit Button"; enterEditModeButton.Click += enterEditModeButtonClick; } multiSelectionMenuItems.Add("Merge".Localize() + "..."); CreateEditBarButtons(); leaveEditModeButton.Visible = false; FlowLayoutWidget topBarContainer = new FlowLayoutWidget(); topBarContainer.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay; topBarContainer.HAnchor = HAnchor.ParentLeftRight; topBarContainer.Padding = new BorderDouble(0); topBarContainer.AddChild(enterEditModeButton); topBarContainer.AddChild(leaveEditModeButton); topBarContainer.AddChild(new HorizontalSpacer()); topBarContainer.AddChild(itemOperationButtons); // put in the item edit menu { moreMenu = new DropDownMenu("More".Localize() + "... "); moreMenu.NormalColor = new RGBA_Bytes(); moreMenu.BorderWidth = (int)(1 * GuiWidget.DeviceScale + .5); moreMenu.BorderColor = new RGBA_Bytes(ActiveTheme.Instance.SecondaryTextColor, 100); moreMenu.MenuAsWideAsItems = false; moreMenu.VAnchor = VAnchor.ParentBottomTop; moreMenu.Margin = new BorderDouble(3, 3); moreMenu.AlignToRightEdge = true; topBarContainer.AddChild(moreMenu); SetMenuItems(moreMenu); moreMenu.SelectionChanged += new EventHandler(ItemMenu_SelectionChanged); } allControls.AddChild(topBarContainer); { // Ensure the form opens with no rows selected. //ActiveQueueList.Instance.ClearSelected(); allControls.AddChild(queueDataView); } FlowLayoutWidget buttonPanel1 = new FlowLayoutWidget(); buttonPanel1.HAnchor = HAnchor.ParentLeftRight; buttonPanel1.Padding = new BorderDouble(0, 3); buttonPanel1.MinimumSize = new Vector2(0, 46); { addToQueueButton = textImageButtonFactory.Generate("Add".Localize(), StaticData.Instance.LoadIcon("icon_plus.png", 32, 32)); addToQueueButton.ToolTipText = "Add an .stl, .amf, .gcode or .zip file to the Queue".Localize(); buttonPanel1.AddChild(addToQueueButton); addToQueueButton.Margin = new BorderDouble(0, 0, 3, 0); addToQueueButton.Click += addToQueueButton_Click; addToQueueButton.Name = "Queue Add Button"; // put in the creator button { createButton = textImageButtonFactory.Generate("Create".Localize(), StaticData.Instance.LoadIcon("icon_creator.png", 32, 32)); createButton.ToolTipText = "Choose a Create Tool to generate custom designs".Localize(); createButton.Name = "Design Tool Button"; buttonPanel1.AddChild(createButton); createButton.Margin = new BorderDouble(0, 0, 3, 0); createButton.Click += (sender, e) => { OpenPluginChooserWindow(); }; } bool touchScreenMode = UserSettings.Instance.IsTouchScreen; if (OemSettings.Instance.ShowShopButton) { shopButton = textImageButtonFactory.Generate("Buy Materials".Localize(), StaticData.Instance.LoadIcon("icon_shopping_cart_32x32.png", 32, 32)); shopButton.ToolTipText = "Shop online for printing materials".Localize(); shopButton.Name = "Buy Materials Button"; buttonPanel1.AddChild(shopButton); shopButton.Margin = new BorderDouble(0, 0, 3, 0); shopButton.Click += (sender, e) => { double activeFilamentDiameter = 0; if (ActiveSliceSettings.Instance.PrinterSelected) { activeFilamentDiameter = 3; if (ActiveSliceSettings.Instance.GetValue <double>(SettingsKey.filament_diameter) < 2) { activeFilamentDiameter = 1.75; } } MatterControlApplication.Instance.LaunchBrowser("http://www.matterhackers.com/mc/store/redirect?d={0}&clk=mcs&a={1}".FormatWith(activeFilamentDiameter, OemSettings.Instance.AffiliateCode)); }; } buttonPanel1.AddChild(new HorizontalSpacer()); queueMenuContainer = new FlowLayoutWidget(); queueMenuContainer.VAnchor = Agg.UI.VAnchor.ParentBottomTop; queueMenu = new QueueOptionsMenu(); queueMenuContainer.AddChild(queueMenu.MenuDropList); buttonPanel1.AddChild(queueMenuContainer); } allControls.AddChild(buttonPanel1); } allControls.AnchorAll(); this.AddChild(allControls); QueueData.Instance.SelectedIndexChanged.RegisterEvent((s, e) => SetEditButtonsStates(), ref unregisterEvents); SetEditButtonsStates(); }
public CompactTabView(QueueDataView queueDataView) : base(Orientation.Vertical) { this.queueDataView = queueDataView; this.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; this.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0); this.TabBar.Margin = new BorderDouble(4, 0, 0, 0); this.TabBar.Padding = new BorderDouble(0, 8); this.Margin = new BorderDouble(top: 0); this.TabTextSize = 18; string simpleModeString = UserSettings.Instance.get("IsSimpleMode"); if (simpleModeString == null) { simpleMode = true; UserSettings.Instance.set("IsSimpleMode", "true"); } else { simpleMode = Convert.ToBoolean(simpleModeString); } QueueTabPage = new TabPage(new QueueDataWidget(queueDataView), LocalizedString.Get("Queue").ToUpper()); SimpleTextTabWidget queueTabWidget = new SimpleTextTabWidget(QueueTabPage, "Queue Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()); partPreviewContainer = new PartPreviewContent(PrinterConnectionAndCommunication.Instance.ActivePrintItem, View3DWidget.WindowMode.Embeded, View3DWidget.AutoRotate.Enabled, View3DWidget.OpenMode.Viewing); string partPreviewLabel = LocalizedString.Get("Preview").ToUpper(); this.AddTab(new SimpleTextTabWidget(new TabPage(partPreviewContainer, partPreviewLabel), "Part Preview Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); string sliceSettingsLabel = LocalizedString.Get("Settings").ToUpper(); sliceSettingsWidget = new SliceSettingsWidget(); sliceTabPage = new TabPage(sliceSettingsWidget, sliceSettingsLabel); this.AddTab(new SimpleTextTabWidget(sliceTabPage, "Slice Settings Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); HorizontalLine lineSpacerZero = new HorizontalLine(); lineSpacerZero.Margin = new BorderDouble(4, 10); this.TabBar.AddChild(lineSpacerZero); GuiWidget manualPrinterControls = new ManualControlsWidget(); #if __ANDROID__ //Add the tab contents for 'Advanced Controls' string printerControlsLabel = LocalizedString.Get("Controls").ToUpper(); manualControlsPage = new TabPage(manualPrinterControls, printerControlsLabel); this.AddTab(new SimpleTextTabWidget(manualControlsPage, "Controls Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); #else ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true); manualPrinterControlsScrollArea.ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; manualPrinterControlsScrollArea.AnchorAll(); manualPrinterControlsScrollArea.AddChild(manualPrinterControls); //Add the tab contents for 'Advanced Controls' string printerControlsLabel = LocalizedString.Get("Controls").ToUpper(); manualControlsPage = new TabPage(manualPrinterControlsScrollArea, printerControlsLabel); this.AddTab(new SimpleTextTabWidget(manualControlsPage, "Controls Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); #endif HorizontalLine lineSpacerOne = new HorizontalLine(); lineSpacerOne.Margin = new BorderDouble(4, 10); this.TabBar.AddChild(lineSpacerOne); this.AddTab(queueTabWidget); LibraryTabPage = new TabPage(new PrintLibraryWidget(), LocalizedString.Get("Library").ToUpper()); this.AddTab(new SimpleTextTabWidget(LibraryTabPage, "Library Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); HistoryTabPage = new TabPage(new PrintHistoryWidget(), LocalizedString.Get("History").ToUpper()); SimpleTextTabWidget historyTabWidget = new SimpleTextTabWidget(HistoryTabPage, "History Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()); if (!simpleMode) { this.AddTab(historyTabWidget); } HorizontalLine lineSpacerTwo = new HorizontalLine(); lineSpacerTwo.Margin = new BorderDouble(4, 10); this.TabBar.AddChild(lineSpacerTwo); string configurationLabel = LocalizedString.Get("Options").ToUpper(); PrinterConfigurationScrollWidget printerConfigurationWidget = new PrinterConfigurationScrollWidget(); // Make sure we have the right scroll position when we create this view // This is not working well enough. So, I disabled it until it can be fixed. // Specifically, it has the wronge position on the app restarting. if(false) { UiThread.RunOnIdle(() => { int scrollPosition = UserSettings.Instance.Fields.GetInt(CompactTabView_Options_ScrollPosition, -100000); if (scrollPosition != -100000) { printerConfigurationWidget.ScrollPosition = new Vector2(0, scrollPosition); } }); printerConfigurationWidget.ScrollPositionChanged += (object sender, EventArgs e) => { UserSettings.Instance.Fields.SetInt(CompactTabView_Options_ScrollPosition, (int)printerConfigurationWidget.ScrollPosition.y); }; } optionsPage = new TabPage(printerConfigurationWidget, configurationLabel); this.AddTab(new SimpleTextTabWidget(optionsPage, "Options Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); TerminalTabPage = new TabPage(new TerminalWidget(false), LocalizedString.Get("Console").ToUpper()); SimpleTextTabWidget terminalTabWidget = new SimpleTextTabWidget(TerminalTabPage, "Terminal Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()); if (!simpleMode) { this.AddTab(terminalTabWidget); } AboutTabPage = new TabPage(new AboutWidget(), LocalizedString.Get("About").ToUpper()); aboutTabWidget = new SimpleTextTabWidget(AboutTabPage, "About Tab", TabTextSize, ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()); this.AddTab(aboutTabWidget); NumQueueItemsChanged(this, null); SetUpdateNotification(this, null); QueueData.Instance.ItemAdded.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents); QueueData.Instance.ItemRemoved.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents); ActiveSliceSettings.ActivePrinterChanged.RegisterEvent((s, e) => ApplicationController.Instance.ReloadAdvancedControlsPanel(), ref unregisterEvents); PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent((s, e) => UiThread.RunOnIdle(ReloadPartPreview, null, 1), ref unregisterEvents); ApplicationController.Instance.ReloadAdvancedControlsPanelTrigger.RegisterEvent((s, e) => UiThread.RunOnIdle(LoadAdvancedControls), ref unregisterEvents); UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(SetUpdateNotification, ref unregisterEvents); // Make sure we are on the right tab when we create this view { string selectedTab = UserSettings.Instance.get(CompactTabView_CurrentTab); this.SelectTab(selectedTab); TabBar.TabIndexChanged += (object sender, EventArgs e) => { UserSettings.Instance.set(CompactTabView_CurrentTab, TabBar.SelectedTabName); }; } }
void LoadColumnOne() { queueDataView = new QueueDataView(); ColumnOne.VAnchor = VAnchor.ParentBottomTop; ColumnOne.AddChild(new ActionBarPlus(queueDataView)); ColumnOne.AddChild(new PrintProgressBar()); ColumnOne.AddChild(new FirstPanelTabView(queueDataView)); ColumnOne.Width = 500; //Ordering here matters - must go after children are added }
public QueueRowItem(PrintItemWrapper printItemWrapper, QueueDataView queueDataView) { this.queueDataView = queueDataView; this.PrintItemWrapper = printItemWrapper; ConstructPrintQueueItem(); }
public QueueRowItem(PrintItemWrapper printItemWrapper, QueueDataView queueDataView) { this.queueDataView = queueDataView; this.PrintItemWrapper = printItemWrapper; this.Name = "Queue Item " + printItemWrapper.Name; ConstructPrintQueueItem(); }
public PrintActionRow(QueueDataView queueDataView) { this.queueDataView = queueDataView; }
public QueueBottomToolbar(QueueDataView queueDataView) { this.queueDataView = queueDataView; SetDisplayAttributes(); textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.borderWidth = 0; FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom); { { // Ensure the form opens with no rows selected. //ActiveQueueList.Instance.ClearSelected(); allControls.AddChild(queueDataView); } FlowLayoutWidget buttonPanel1 = new FlowLayoutWidget(); buttonPanel1.HAnchor = HAnchor.ParentLeftRight; buttonPanel1.Padding = new BorderDouble(0, 3); { Button addToQueueButton = textImageButtonFactory.Generate(LocalizedString.Get("Add"), "icon_circle_plus.png"); buttonPanel1.AddChild(addToQueueButton); addToQueueButton.Margin = new BorderDouble(0, 0, 3, 0); addToQueueButton.Click += new ButtonBase.ButtonEventHandler(addToQueueButton_Click); // put in the creator button { Button runCreator = textImageButtonFactory.Generate(LocalizedString.Get("Create"), "icon_creator_white_32x32.png"); buttonPanel1.AddChild(runCreator); runCreator.Margin = new BorderDouble(0, 0, 3, 0); runCreator.Click += (sender, e) => { OpenPluginChooserWindow(); }; } if (OemSettings.Instance.ShowShopButton) { shopButton = textImageButtonFactory.Generate(LocalizedString.Get("Buy Materials"), "icon_shopping_cart_32x32.png"); buttonPanel1.AddChild(shopButton); shopButton.Margin = new BorderDouble(0, 0, 3, 0); shopButton.Click += (sender, e) => { double activeFilamentDiameter = 0; if (ActivePrinterProfile.Instance.ActivePrinter != null) { activeFilamentDiameter = 3; if (ActiveSliceSettings.Instance.FilamentDiameter < 2) { activeFilamentDiameter = 1.75; } } System.Diagnostics.Process.Start("http://www.matterhackers.com/mc/store/redirect?d={0}&clk=mcs&a={1}".FormatWith(activeFilamentDiameter, OemSettings.Instance.AffiliateCode)); }; } Button deleteAllFromQueueButton = textImageButtonFactory.Generate(LocalizedString.Get("Remove All")); deleteAllFromQueueButton.Margin = new BorderDouble(3, 0); deleteAllFromQueueButton.Click += new ButtonBase.ButtonEventHandler(deleteAllFromQueueButton_Click); //buttonPanel1.AddChild(deleteAllFromQueueButton); GuiWidget spacer1 = new GuiWidget(); spacer1.HAnchor = HAnchor.ParentLeftRight; buttonPanel1.AddChild(spacer1); GuiWidget spacer2 = new GuiWidget(); spacer2.HAnchor = HAnchor.ParentLeftRight; buttonPanel1.AddChild(spacer2); GuiWidget queueMenu = new QueueOptionsMenu(); queueMenu.VAnchor = VAnchor.ParentTop; buttonPanel1.AddChild(queueMenu); } allControls.AddChild(buttonPanel1); } allControls.AnchorAll(); this.AddChild(allControls); }
public DesktopPrintStatusRow(QueueDataView queueDataView) { Initialize(); this.HAnchor = HAnchor.ParentLeftRight; this.queueDataView = queueDataView; AddChildElements(); AddHandlers(); onActivePrintItemChanged(null, null); DoAddIconToPrintStatusRow(); }
public QueueRowItem(PrintItemWrapper printItemWrapper, QueueDataView queueDataViewThisIsIn) { this.queueDataViewThisIsIn = queueDataViewThisIsIn; this.PrintItemWrapper = printItemWrapper; ConstructPrintQueueItem(); }
public QueueDataWidget(QueueDataView queueDataView) { this.queueDataView = queueDataView; SetDisplayAttributes(); textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.borderWidth = 0; editButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.borderWidth = 0; editButtonFactory.FixedWidth = 70 * TextWidget.GlobalPointSizeScaleRatio; FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom); { enterEditModeButton = editButtonFactory.Generate("Edit".Localize(), centerText: true); leaveEditModeButton = editButtonFactory.Generate("Done".Localize(), centerText: true); clearAllButton = editButtonFactory.Generate("Clear".Localize(), centerText: true); clearAllButton.Visible = false; leaveEditModeButton.Visible = false; clearAllPlaceholder = new GuiWidget(clearAllButton.Width, clearAllButton.Height); FlowLayoutWidget searchPanel = new FlowLayoutWidget(); searchPanel.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay; searchPanel.HAnchor = HAnchor.ParentLeftRight; searchPanel.Padding = new BorderDouble(0); searchPanel.AddChild(enterEditModeButton); searchPanel.AddChild(leaveEditModeButton); searchPanel.AddChild(new HorizontalSpacer()); if (ActiveTheme.Instance.IsTouchScreen) { TextWidget textWidget = new TextWidget("Print Queue".Localize().ToUpper(), pointSize: 14); textWidget.TextColor = ActiveTheme.Instance.PrimaryAccentColor; textWidget.VAnchor = VAnchor.ParentCenter; searchPanel.AddChild(textWidget); searchPanel.AddChild(new HorizontalSpacer()); searchPanel.AddChild(clearAllButton); searchPanel.AddChild(clearAllPlaceholder); } allControls.AddChild(searchPanel); { // Ensure the form opens with no rows selected. //ActiveQueueList.Instance.ClearSelected(); allControls.AddChild(queueDataView); } FlowLayoutWidget buttonPanel1 = new FlowLayoutWidget(); buttonPanel1.HAnchor = HAnchor.ParentLeftRight; buttonPanel1.Padding = new BorderDouble(0, 3); buttonPanel1.MinimumSize = new Vector2(0, 46); { addToQueueButton = textImageButtonFactory.Generate(LocalizedString.Get("Add"), "icon_circle_plus.png"); buttonPanel1.AddChild(addToQueueButton); addToQueueButton.Margin = new BorderDouble(0, 0, 3, 0); addToQueueButton.Click += new EventHandler(addToQueueButton_Click); // put in the creator button { createButton = textImageButtonFactory.Generate(LocalizedString.Get("Create"), "icon_creator_white_32x32.png"); buttonPanel1.AddChild(createButton); createButton.Margin = new BorderDouble(0, 0, 3, 0); createButton.Click += (sender, e) => { OpenPluginChooserWindow(); }; } sendItemButton = textImageButtonFactory.Generate("Send".Localize()); sendItemButton.Margin = new BorderDouble(0, 0, 3, 0); sendItemButton.Click += new EventHandler(sendButton_Click); sendItemButton.Visible = false; buttonPanel1.AddChild(sendItemButton); addToLibraryButton = textImageButtonFactory.Generate("Add To Library".Localize()); addToLibraryButton.Margin = new BorderDouble(3, 0); addToLibraryButton.Click += new EventHandler(addToLibraryButton_Click); addToLibraryButton.Visible = false; buttonPanel1.AddChild(addToLibraryButton); exportItemButton = textImageButtonFactory.Generate("Export".Localize()); exportItemButton.Margin = new BorderDouble(3, 0); exportItemButton.Click += new EventHandler(exportButton_Click); exportItemButton.Visible = false; buttonPanel1.AddChild(exportItemButton); copyItemButton = textImageButtonFactory.Generate("Copy".Localize()); copyItemButton.Margin = new BorderDouble(3, 0); copyItemButton.Click += new EventHandler(copy_Button_Click); copyItemButton.Visible = false; buttonPanel1.AddChild(copyItemButton); removeItemButton = textImageButtonFactory.Generate("Remove".Localize()); removeItemButton.Margin = new BorderDouble(3, 0); removeItemButton.Click += new EventHandler(removeButton_Click); removeItemButton.Visible = false; buttonPanel1.AddChild(removeItemButton); bool touchScreenMode = ActiveTheme.Instance.IsTouchScreen; if (!touchScreenMode) { if (OemSettings.Instance.ShowShopButton) { shopButton = textImageButtonFactory.Generate(LocalizedString.Get("Buy Materials"), "icon_shopping_cart_32x32.png"); buttonPanel1.AddChild(shopButton); shopButton.Margin = new BorderDouble(0, 0, 3, 0); shopButton.Click += (sender, e) => { double activeFilamentDiameter = 0; if (ActivePrinterProfile.Instance.ActivePrinter != null) { activeFilamentDiameter = 3; if (ActiveSliceSettings.Instance.FilamentDiameter < 2) { activeFilamentDiameter = 1.75; } } MatterControlApplication.Instance.LaunchBrowser("http://www.matterhackers.com/mc/store/redirect?d={0}&clk=mcs&a={1}".FormatWith(activeFilamentDiameter, OemSettings.Instance.AffiliateCode)); }; } } Button deleteAllFromQueueButton = textImageButtonFactory.Generate(LocalizedString.Get("Remove All")); deleteAllFromQueueButton.Margin = new BorderDouble(3, 0); deleteAllFromQueueButton.Click += new EventHandler(deleteAllFromQueueButton_Click); //buttonPanel1.AddChild(deleteAllFromQueueButton); buttonPanel1.AddChild(new HorizontalSpacer()); queueMenuContainer = new FlowLayoutWidget(); queueMenuContainer.VAnchor = Agg.UI.VAnchor.ParentBottomTop; queueMenu = new QueueOptionsMenu(); queueMenuContainer.AddChild(queueMenu.MenuDropList); if (!touchScreenMode) { buttonPanel1.AddChild(queueMenuContainer); } ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent((object sender, EventArgs e) => { queueMenuContainer.RemoveAllChildren(); // the printer changed reload the queueMenue queueMenu = new QueueOptionsMenu(); queueMenuContainer.AddChild(queueMenu.MenuDropList); }, ref unregisterEvents); } allControls.AddChild(buttonPanel1); } allControls.AnchorAll(); this.AddChild(allControls); AddHandlers(); }
private void LoadCompactView() { queueDataView = new QueueDataView(); ColumnOne.RemoveAllChildren(); ColumnOne.AddChild(new ActionBarPlus(queueDataView)); compactSlidePanel = new CompactSlidePanel(queueDataView); ColumnOne.AddChild(compactSlidePanel); ColumnOne.AnchorAll(); }
public TouchscreenTabView(QueueDataView queueDataView) : base(Orientation.Vertical) { this.queueDataView = queueDataView; this.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; this.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0); this.TabBar.Margin = new BorderDouble(4, 0, 0, 0); this.TabBar.Padding = new BorderDouble(0, 8); this.Margin = new BorderDouble(top: 0); this.TabTextSize = 18; string simpleModeString = UserSettings.Instance.get("IsSimpleMode"); if (simpleModeString == null) { simpleMode = true; UserSettings.Instance.set("IsSimpleMode", "true"); } else { simpleMode = Convert.ToBoolean(simpleModeString); } this.AddTab( "Part Preview Tab", "Preview".Localize().ToUpper(), generator: () => { partPreviewContainer = new PartPreviewContent(PrinterConnectionAndCommunication.Instance.ActivePrintItem, View3DWidget.WindowMode.Embeded, View3DWidget.AutoRotate.Enabled, View3DWidget.OpenMode.Viewing); return partPreviewContainer; }); this.AddTab( "Slice Settings Tab", "Settings".Localize().ToUpper(), generator: () => { // sliceSettingsWidget = (ActiveSliceSettings.Instance.PrinterSelected) ? new SliceSettingsWidget() : new NoSettingsWidget(); if (ActiveSliceSettings.Instance.PrinterSelected) { sliceSettingsWidget = new SliceSettingsWidget(); } else { sliceSettingsWidget = new NoSettingsWidget(); } return sliceSettingsWidget; }); this.TabBar.AddChild(new HorizontalLine() { Margin = new BorderDouble(4, 10) }); this.AddTab( "Controls Tab", "Controls".Localize().ToUpper(), () => new ManualPrinterControls()); // TODO: How to handle reload? Create .Reload on LazyTab? Create accessor for tabs["Controls Tab"].Reload()? //manualControlsPage = new TabPage(, printerControlsLabel); this.TabBar.AddChild(new HorizontalLine() { Margin = new BorderDouble(4, 10) }); this.AddTab( "Queue Tab", "Queue".Localize().ToUpper(), () => new QueueDataWidget(queueDataView)); QueueTabPage = this.GetTabPage("Queue Tab"); this.AddTab( "Library Tab", "Library".Localize().ToUpper(), () => new PrintLibraryWidget()); if (!simpleMode) { this.AddTab( "History Tab", "History".Localize().ToUpper(), () => new PrintHistoryWidget()); } this.TabBar.AddChild(new HorizontalLine() { Margin = new BorderDouble(4, 10) }); // Make sure we have the right scroll position when we create this view // This is not working well enough. So, I disabled it until it can be fixed. // Specifically, it has the wronge position on the app restarting. /* if(false) { UiThread.RunOnIdle(() => { int scrollPosition = UserSettings.Instance.Fields.GetInt(CompactTabView_Options_ScrollPosition, -100000); if (scrollPosition != -100000) { printerConfigurationWidget.ScrollPosition = new Vector2(0, scrollPosition); } }); printerConfigurationWidget.ScrollPositionChanged += (object sender, EventArgs e) => { UserSettings.Instance.Fields.SetInt(CompactTabView_Options_ScrollPosition, (int)printerConfigurationWidget.ScrollPosition.y); }; } */ this.AddTab( "Options Tab", "Options".Localize().ToUpper(), () => new PrinterConfigurationScrollWidget()); if (!simpleMode) { this.AddTab( "Terminal Tab", "Console".Localize().ToUpper(), () => new TerminalWidget(false)); } this.AddTab( "About Tab", "About".Localize().ToUpper(), () => new AboutWidget()); NumQueueItemsChanged(this, null); SetUpdateNotification(this, null); QueueData.Instance.ItemAdded.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents); QueueData.Instance.ItemRemoved.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents); ActiveSliceSettings.ActivePrinterChanged.RegisterEvent((s, e) => ApplicationController.Instance.ReloadAdvancedControlsPanel(), ref unregisterEvents); PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent((s, e) => { // ReloadPartPreview UiThread.RunOnIdle(() => { partPreviewContainer?.Reload(PrinterConnectionAndCommunication.Instance.ActivePrintItem); }, 1); }, ref unregisterEvents); ApplicationController.Instance.AdvancedControlsPanelReloading.RegisterEvent((s, e) => UiThread.RunOnIdle(ReloadAdvancedControls), ref unregisterEvents); UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(SetUpdateNotification, ref unregisterEvents); // Make sure we are on the right tab when we create this view { string selectedTab = UserSettings.Instance.get(CompactTabView_CurrentTab); this.SelectTab(selectedTab); TabBar.TabIndexChanged += (object sender, EventArgs e) => { string selectedTabName = TabBar.SelectedTabName; if (!string.IsNullOrEmpty(selectedTabName)) { UserSettings.Instance.set(CompactTabView_CurrentTab, selectedTabName); } }; } }
public QueueDataWidget(QueueDataView queueDataView) { this.queueDataView = queueDataView; SetDisplayAttributes(); textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.borderWidth = 0; editButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.disabledTextColor = ActiveTheme.Instance.TabLabelUnselected; editButtonFactory.disabledFillColor = new RGBA_Bytes(); editButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.borderWidth = 0; editButtonFactory.Margin = new BorderDouble(10, 0); FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom); { enterEditModeButton = editButtonFactory.Generate("Edit".Localize(), centerText: true); enterEditModeButton.ToolTipText = "Enter Multi Select mode".Localize(); enterEditModeButton.Click += enterEditModeButtonClick; leaveEditModeButton = editButtonFactory.Generate("Done".Localize(), centerText: true); leaveEditModeButton.Name = "Queue Done Button"; leaveEditModeButton.Click += leaveEditModeButtonClick; // make sure the buttons are the same size even when localized if (leaveEditModeButton.Width < enterEditModeButton.Width) { editButtonFactory.FixedWidth = enterEditModeButton.Width; leaveEditModeButton = editButtonFactory.Generate("Done".Localize(), centerText: true); leaveEditModeButton.Click += leaveEditModeButtonClick; } else { editButtonFactory.FixedWidth = leaveEditModeButton.Width; enterEditModeButton = editButtonFactory.Generate("Edit".Localize(), centerText: true); enterEditModeButton.Name = "Queue Edit Button"; enterEditModeButton.Click += enterEditModeButtonClick; } multiSelectionMenuItems.Add("Merge..."); CreateEditBarButtons(); leaveEditModeButton.Visible = false; FlowLayoutWidget topBarContainer = new FlowLayoutWidget(); topBarContainer.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay; topBarContainer.HAnchor = HAnchor.ParentLeftRight; topBarContainer.Padding = new BorderDouble(0); topBarContainer.AddChild(enterEditModeButton); topBarContainer.AddChild(leaveEditModeButton); topBarContainer.AddChild(new HorizontalSpacer()); topBarContainer.AddChild(itemOperationButtons); // put in the item edit menu { moreMenu = new DropDownMenu("More".Localize() + "... "); moreMenu.NormalColor = new RGBA_Bytes(); moreMenu.BorderWidth = (int)(1 * GuiWidget.DeviceScale + .5); moreMenu.BorderColor = new RGBA_Bytes(ActiveTheme.Instance.SecondaryTextColor,100); moreMenu.MenuAsWideAsItems = false; moreMenu.VAnchor = VAnchor.ParentBottomTop; moreMenu.Margin = new BorderDouble(3, 3); moreMenu.AlignToRightEdge = true; topBarContainer.AddChild(moreMenu); SetMenuItems(moreMenu); moreMenu.SelectionChanged += new EventHandler(ItemMenu_SelectionChanged); } allControls.AddChild(topBarContainer); { // Ensure the form opens with no rows selected. //ActiveQueueList.Instance.ClearSelected(); allControls.AddChild(queueDataView); } FlowLayoutWidget buttonPanel1 = new FlowLayoutWidget(); buttonPanel1.HAnchor = HAnchor.ParentLeftRight; buttonPanel1.Padding = new BorderDouble(0, 3); buttonPanel1.MinimumSize = new Vector2(0, 46); { addToQueueButton = textImageButtonFactory.Generate(LocalizedString.Get("Add"), StaticData.Instance.LoadIcon("icon_plus.png", 32, 32)); addToQueueButton.ToolTipText = "Add an .stl, .amf, .gcode or .zip file to the Queue".Localize(); buttonPanel1.AddChild(addToQueueButton); addToQueueButton.Margin = new BorderDouble(0, 0, 3, 0); addToQueueButton.Click += new EventHandler(addToQueueButton_Click); addToQueueButton.Name = "Queue Add Button"; // put in the creator button { createButton = textImageButtonFactory.Generate(LocalizedString.Get("Create"), StaticData.Instance.LoadIcon("icon_creator.png", 32, 32)); createButton.ToolTipText = "Choose a Create Tool to generate custom designs".Localize(); createButton.Name = "Design Tool Button"; buttonPanel1.AddChild(createButton); createButton.Margin = new BorderDouble(0, 0, 3, 0); createButton.Click += (sender, e) => { OpenPluginChooserWindow(); }; } bool touchScreenMode = UserSettings.Instance.IsTouchScreen; if (OemSettings.Instance.ShowShopButton) { shopButton = textImageButtonFactory.Generate(LocalizedString.Get("Buy Materials"), StaticData.Instance.LoadIcon("icon_shopping_cart_32x32.png", 32,32)); shopButton.ToolTipText = "Shop online for printing materials".Localize(); shopButton.Name = "Buy Materials Button"; buttonPanel1.AddChild(shopButton); shopButton.Margin = new BorderDouble(0, 0, 3, 0); shopButton.Click += (sender, e) => { double activeFilamentDiameter = 0; if (ActiveSliceSettings.Instance != null) { activeFilamentDiameter = 3; if (ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.filament_diameter) < 2) { activeFilamentDiameter = 1.75; } } MatterControlApplication.Instance.LaunchBrowser("http://www.matterhackers.com/mc/store/redirect?d={0}&clk=mcs&a={1}".FormatWith(activeFilamentDiameter, OemSettings.Instance.AffiliateCode)); }; } buttonPanel1.AddChild(new HorizontalSpacer()); queueMenuContainer = new FlowLayoutWidget(); queueMenuContainer.VAnchor = Agg.UI.VAnchor.ParentBottomTop; queueMenu = new QueueOptionsMenu(); queueMenuContainer.AddChild(queueMenu.MenuDropList); buttonPanel1.AddChild(queueMenuContainer); } allControls.AddChild(buttonPanel1); } allControls.AnchorAll(); this.AddChild(allControls); QueueData.Instance.SelectedIndexChanged.RegisterEvent((s,e) => SetEditButtonsStates(), ref unregisterEvents); SetEditButtonsStates(); }
public override void AddElements() { topIsHidden = false; this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom); container.AnchorAll(); TopContainer = new TopContainerWidget(); TopContainer.HAnchor = HAnchor.ParentLeftRight; ApplicationMenuRow menuRow = new ApplicationMenuRow(); #if !__ANDROID__ TopContainer.AddChild(menuRow); #endif menuSeparator = new GuiWidget(); menuSeparator.Height = 12; menuSeparator.HAnchor = HAnchor.ParentLeftRight; menuSeparator.MinimumSize = new Vector2(0, 12); menuSeparator.Visible = false; queueDataView = new QueueDataView(); TopContainer.AddChild(new ActionBarPlus(queueDataView)); TopContainer.SetOriginalHeight(); container.AddChild(TopContainer); progressBar = new PrintProgressBar(); container.AddChild(progressBar); container.AddChild(menuSeparator); compactTabView = new CompactTabView(queueDataView); BottomOverlay bottomOverlay = new BottomOverlay(); bottomOverlay.AddChild(compactTabView); container.AddChild(bottomOverlay); this.AddChild(container); }
public QueueDataWidget(QueueDataView queueDataView) { this.queueDataView = queueDataView; SetDisplayAttributes(); textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.borderWidth = 0; editButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.disabledTextColor = ActiveTheme.Instance.TabLabelUnselected; editButtonFactory.disabledFillColor = new RGBA_Bytes(); editButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.borderWidth = 0; editButtonFactory.Margin = new BorderDouble(10, 0); editButtonFactory.Margin *= TextWidget.GlobalPointSizeScaleRatio; FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom); { enterEditModeButton = editButtonFactory.Generate("Edit".Localize(), centerText: true); enterEditModeButton.Click += enterEditModeButtonClick; leaveEditModeButton = editButtonFactory.Generate("Done".Localize(), centerText: true); leaveEditModeButton.Click += leaveEditModeButtonClick; // make sure the buttons are the same size even when localized if (leaveEditModeButton.Width < enterEditModeButton.Width) { editButtonFactory.FixedWidth = enterEditModeButton.Width; leaveEditModeButton = editButtonFactory.Generate("Done".Localize(), centerText: true); leaveEditModeButton.Click += leaveEditModeButtonClick; } else { editButtonFactory.FixedWidth = leaveEditModeButton.Width; enterEditModeButton = editButtonFactory.Generate("Edit".Localize(), centerText: true); enterEditModeButton.Click += enterEditModeButtonClick; } CreateEditBarButtons(); leaveEditModeButton.Visible = false; FlowLayoutWidget topBarContainer = new FlowLayoutWidget(); topBarContainer.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay; topBarContainer.HAnchor = HAnchor.ParentLeftRight; topBarContainer.Padding = new BorderDouble(0); topBarContainer.AddChild(enterEditModeButton); topBarContainer.AddChild(leaveEditModeButton); topBarContainer.AddChild(new HorizontalSpacer()); topBarContainer.AddChild(itemOperationButtons); // put in the itme edit menu { moreMenu = new DropDownMenu("More".Localize() + "... "); moreMenu.NormalColor = new RGBA_Bytes(); moreMenu.BorderWidth = 1; moreMenu.BorderColor = ActiveTheme.Instance.SecondaryTextColor; moreMenu.MenuAsWideAsItems = false; moreMenu.VAnchor = VAnchor.ParentBottomTop; moreMenu.Margin = new BorderDouble(3, 3); moreMenu.AlignToRightEdge = true; topBarContainer.AddChild(moreMenu); SetMenuItems(moreMenu); moreMenu.SelectionChanged += new EventHandler(ItemMenu_SelectionChanged); } allControls.AddChild(topBarContainer); { // Ensure the form opens with no rows selected. //ActiveQueueList.Instance.ClearSelected(); allControls.AddChild(queueDataView); } FlowLayoutWidget buttonPanel1 = new FlowLayoutWidget(); buttonPanel1.HAnchor = HAnchor.ParentLeftRight; buttonPanel1.Padding = new BorderDouble(0, 3); buttonPanel1.MinimumSize = new Vector2(0, 46); { addToQueueButton = textImageButtonFactory.Generate(LocalizedString.Get("Add"), "icon_circle_plus.png"); buttonPanel1.AddChild(addToQueueButton); addToQueueButton.Margin = new BorderDouble(0, 0, 3, 0); addToQueueButton.Click += new EventHandler(addToQueueButton_Click); // put in the creator button { createButton = textImageButtonFactory.Generate(LocalizedString.Get("Create"), "icon_creator_white_32x32.png"); buttonPanel1.AddChild(createButton); createButton.Margin = new BorderDouble(0, 0, 3, 0); createButton.Click += (sender, e) => { OpenPluginChooserWindow(); }; } bool touchScreenMode = ActiveTheme.Instance.IsTouchScreen; if (!touchScreenMode) { if (OemSettings.Instance.ShowShopButton) { shopButton = textImageButtonFactory.Generate(LocalizedString.Get("Buy Materials"), "icon_shopping_cart_32x32.png"); buttonPanel1.AddChild(shopButton); shopButton.Margin = new BorderDouble(0, 0, 3, 0); shopButton.Click += (sender, e) => { double activeFilamentDiameter = 0; if (ActivePrinterProfile.Instance.ActivePrinter != null) { activeFilamentDiameter = 3; if (ActiveSliceSettings.Instance.FilamentDiameter < 2) { activeFilamentDiameter = 1.75; } } MatterControlApplication.Instance.LaunchBrowser("http://www.matterhackers.com/mc/store/redirect?d={0}&clk=mcs&a={1}".FormatWith(activeFilamentDiameter, OemSettings.Instance.AffiliateCode)); }; } } buttonPanel1.AddChild(new HorizontalSpacer()); queueMenuContainer = new FlowLayoutWidget(); queueMenuContainer.VAnchor = Agg.UI.VAnchor.ParentBottomTop; queueMenu = new QueueOptionsMenu(); queueMenuContainer.AddChild(queueMenu.MenuDropList); if (!touchScreenMode) { buttonPanel1.AddChild(queueMenuContainer); } ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent((object sender, EventArgs e) => { queueMenuContainer.RemoveAllChildren(); // the printer changed reload the queueMenue queueMenu = new QueueOptionsMenu(); queueMenuContainer.AddChild(queueMenu.MenuDropList); }, ref unregisterEvents); } allControls.AddChild(buttonPanel1); } allControls.AnchorAll(); this.AddChild(allControls); AddHandlers(); //enterEditModeButtonClick(null, null); }