private void CreateBasicLayout() { DockTreeView formTV = new DockTreeView() { CloseButtonVisible = false }; formTV.SetMain(this); formTV.SelectionChanged += UpdateToolCommands; formTV.Show(dockPanel, DockState.Document); dockPanel.ResumeLayout(true, true); FormDownload.DatabaseModified += formTV.OnToolStripButtonRoot; toolStripButtonSearch.Click += formTV.OnToolStripButtonSearch; _cleanUp.Add(() => toolStripButtonSearch.Click -= formTV.OnToolStripButtonSearch); toolStripButtonCotationsAuto.Click += formTV.OnShowHideCotationsAuto; _cleanUp.Add(() => toolStripButtonCotationsAuto.Click -= formTV.OnShowHideCotationsAuto); toolStripButtonCotationsCode.Click += formTV.OnShowHideCotationsCode; _cleanUp.Add(() => toolStripButtonCotationsCode.Click -= formTV.OnShowHideCotationsCode); toolStripButtonAxes.Click += formTV.OnShowHideAxes; _cleanUp.Add(() => toolStripButtonAxes.Click -= formTV.OnShowHideAxes); toolStripButtonReflectionX.Click += formTV.OnToolStripReflectionX; _cleanUp.Add(() => toolStripButtonReflectionX.Click -= formTV.OnToolStripReflectionX); toolStripButtonReflectionY.Click += formTV.OnToolStripReflectionY; _cleanUp.Add(() => toolStripButtonReflectionY.Click -= formTV.OnToolStripReflectionY); toolStripButtonLayout.Click += formTV.OnToolStripLayout; _cleanUp.Add(() => toolStripButtonLayout.Click -= formTV.OnToolStripLayout); toolStripButtonEditParameters.Click += formTV.OnToolStripEditParameters; _cleanUp.Add(() => toolStripButtonEditParameters.Click -= formTV.OnToolStripEditParameters); toolStripEditComponentCode.Click += formTV.OnToolStripEditComponentCode; _cleanUp.Add(() => toolStripEditComponentCode.Click -= formTV.OnToolStripEditComponentCode); toolStripButtonExport.Click += formTV.OnExportFile; _cleanUp.Add(() => toolStripButtonExport.Click -= formTV.OnExportFile); #if TREEDIMEXPORT toolStripMI_ExportApp.Click += formTV.OnExportPicGEOM; _cleanUp.Add(() => toolStripMI_ExportApp.Click -= formTV.OnExportPicGEOM); toolStripMI_PicGEOM.Click += formTV.OnExportPicGEOM; _cleanUp.Add(() => toolStripMI_PicGEOM.Click -= formTV.OnExportPicGEOM); toolStripMI_Picador3D.Click += formTV.OnExportPicador3D; _cleanUp.Add(() => toolStripMI_Picador3D.Click -= formTV.OnExportPicador3D); toolStripMI_PicDecoup.Click += formTV.OnExportPicDecoup; _cleanUp.Add(() => toolStripMI_PicDecoup.Click -= formTV.OnExportPicDecoup); #endif #if PROCESSOR toolStripButtonSUMMA.Click += formTV.OnToolStripButtonShowProcessor; _cleanUp.Add(() => toolStripButtonSUMMA.Click -= formTV.OnToolStripButtonShowProcessor); toolStripButtonARISTO.Click += formTV.OnToolStripButtonShowProcessor; _cleanUp.Add(() => toolStripButtonARISTO.Click -= formTV.OnToolStripButtonShowProcessor); toolStripButtonOceProCut.Click += formTV.OnToolStripButtonShowProcessor; _cleanUp.Add(() => toolStripButtonOceProCut.Click -= formTV.OnToolStripButtonShowProcessor); toolStripButtonZUND.Click += formTV.OnToolStripButtonShowProcessor; _cleanUp.Add(() => toolStripButtonZUND.Click -= formTV.OnToolStripButtonShowProcessor); #endif #if STACKBUILDER toolStripMIOptimalCase.Click += formTV.OnToolStripStackBuilderCaseOptimization; _cleanUp.Add(() => toolStripMIOptimalCase.Click -= formTV.OnToolStripStackBuilderCaseOptimization); toolStripMICasePalletAnalysis.Click += formTV.OnToolStripStackBuilderCasePallet; _cleanUp.Add(() => toolStripMICasePalletAnalysis.Click -= formTV.OnToolStripStackBuilderCasePallet); toolStripMIBundlePalletAnalysis.Click += formTV.OnToolStripStackBuilderBundlePallet; _cleanUp.Add(() => toolStripMIBundlePalletAnalysis.Click -= formTV.OnToolStripStackBuilderBundlePallet); toolStripMIBundleCaseAnalysis.Click += formTV.OnToolStripStackBuilderBundleCase; _cleanUp.Add(() => toolStripMIBundleCaseAnalysis.Click -= formTV.OnToolStripStackBuilderBundleCase); #endif }
private void UpdateToolCommands(DockTreeView formTV) { try { toolStripSBPalletization.Visible = Settings.Default.ShowButtonPalletization; toolStripButtonLayout.Visible = Settings.Default.ShowButtonLayout; toolStripEditComponentCode.Visible = Settings.Default.ShowButtonEditCode; toolStripButtonHelp.Visible = Settings.Default.ShowButtonHelp; // for some unknown reasons these data may be changed to 'False' in the user.config file toolStripMain.Visible = true; menuStripMain.Visible = true; statusStripMain.Visible = true; // enable toolbar buttons bool buttonsEnabled = false, palletisationAllowed = false, flatPalletisationAllowed = false; if (null != formTV) { buttonsEnabled = formTV.TSButtonsEnabled; palletisationAllowed = formTV.AllowPalletisation; flatPalletisationAllowed = formTV.AllowFlatPalletisation; } toolStripButtonCotationsAuto.Enabled = buttonsEnabled; toolStripMenuItemCotationsAuto.Enabled = buttonsEnabled; toolStripButtonReflectionX.Enabled = buttonsEnabled; reflectionXToolStripMenuItem.Enabled = buttonsEnabled; toolStripButtonReflectionY.Enabled = buttonsEnabled; reflectionYToolStripMenuItem.Enabled = buttonsEnabled; toolStripButtonLayout.Enabled = buttonsEnabled; toolStripMenuItemCotationShortLines.Enabled = buttonsEnabled; toolStripButtonCotationsCode.Enabled = buttonsEnabled; toolStripMenuItemCotationsCode.Enabled = buttonsEnabled; toolStripButtonAxes.Enabled = buttonsEnabled; toolStripMenuItemAxes.Enabled = buttonsEnabled; toolStripButtonExport.Enabled = buttonsEnabled; // only allow palletization / case optimisation when a component is selected if (Settings.Default.ShowButtonPalletization) { toolStripMICasePalletAnalysis.Enabled = palletisationAllowed; toolStripMIOptimalCase.Enabled = palletisationAllowed; toolStripMIBundleCaseAnalysis.Enabled = flatPalletisationAllowed; toolStripMIBundlePalletAnalysis.Enabled = flatPalletisationAllowed; } // enable export toolbar buttons toolStripButtonExport.Enabled = true;//buttonsEnabled || _webBrowser4PDF.Visible; // "File" menu items exportToolStripMenuItem.Enabled = buttonsEnabled; toolStripButtonEditParameters.Enabled = buttonsEnabled; if (null != formTV) { IToolInterface currentTool = formTV.CurrentTool; if (null != currentTool) { // cotation auto toolStripButtonCotationsAuto.CheckState = currentTool.ShowCotationsAuto ? CheckState.Checked : CheckState.Unchecked; toolStripMenuItemCotationsAuto.CheckState = currentTool.ShowCotationsAuto ? CheckState.Checked : CheckState.Unchecked; // cotation code toolStripButtonCotationsCode.CheckState = currentTool.ShowCotationsCode ? CheckState.Checked : CheckState.Unchecked; toolStripMenuItemCotationsCode.CheckState = currentTool.ShowCotationsCode ? CheckState.Checked : CheckState.Unchecked; // axes toolStripButtonAxes.CheckState = currentTool.ShowAxes ? CheckState.Checked : CheckState.Unchecked; toolStripMenuItemAxes.CheckState = currentTool.ShowAxes ? CheckState.Checked : CheckState.Unchecked; // reflectionX toolStripButtonReflectionX.CheckState = currentTool.ReflectionX ? CheckState.Checked : CheckState.Unchecked; reflectionXToolStripMenuItem.CheckState = currentTool.ReflectionX ? CheckState.Checked : CheckState.Unchecked; // reflectionY toolStripButtonReflectionY.CheckState = currentTool.ReflectionY ? CheckState.Checked : CheckState.Unchecked; reflectionYToolStripMenuItem.CheckState = currentTool.ReflectionY ? CheckState.Checked : CheckState.Unchecked; toolStripEditComponentCode.Enabled = currentTool.IsPluginViewer; toolStripButtonEditParameters.Enabled = currentTool.HasDependancies; // PDF3D button bool tools3DGenerate = currentTool.IsSupportingAutomaticFolding && File.Exists(formTV.Pic3DExporterPath); } } else { _log.Error("FormTV == null"); } } catch (Exception ex) { _log.Error(ex.ToString()); } }
public FormGeneratePDF3D(DockTreeView form) { InitializeComponent(); formTreeView = form; }