Exemple #1
0
        public void OnShowHideCotationsAuto(object sender, EventArgs e)
        {
            IToolInterface currentView = CurrentTool;

            if (null == currentView)
            {
                return;
            }
            currentView.ShowCotationsAuto = !currentView.ShowCotationsAuto;
            SelectionChanged?.Invoke(this);
        }
Exemple #2
0
        public void OnToolStripReflectionY(object sender, EventArgs e)
        {
            IToolInterface currentView = CurrentTool;

            if (null == currentView)
            {
                return;
            }
            currentView.ReflectionY = !currentView.ReflectionY;
            SelectionChanged?.Invoke(this);
        }
Exemple #3
0
        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());
            }
        }