示例#1
0
        public void EstablishTab()
        {
            //Add Ribbon
            RibbonControl ribbon = ComponentManager.Ribbon;

            // If the RibbonControl is established, then initialize our tab.
            if (ribbon != null)
            {
                // If the Ribbon already exists, don't create another.
                RibbonTab rtab = ribbon.FindTab("HNHSurvey");
                if (rtab != null)
                {
                    return;
                }

                rtab = new RibbonTab
                {
                    Title = "H & H Survey",
                    Id    = "HNHSurvey"
                };
                rtab.Panels.Add(AddProMgmtPanel()); // Project Management Group
                rtab.Panels.Add(AddCompPanel());    // Computations Group
                rtab.Panels.Add(HelpPanel());       // Help Group

                // Display tab in the RibbonControl for the user.
                ribbon.Tabs.Add(rtab);

                // Let the user know this succeeded.
                AcApp.DocumentManager.MdiActiveDocument.Editor.WriteMessage("Panel loaded successfully..." + Environment.NewLine);
            }
        }
        public static void CreateSharedElements()
        {
            if (HousingConceptTab == null)
            {
                HousingConceptTab       = new RibbonTab();
                HousingConceptTab.Title = Resources.ExtensionApplication_UI_HousingContextTabTitle;
            }
            if (!GeneralDesignCreated)
            {
                RibbonPanel       generalPanel  = new RibbonPanel();
                RibbonPanelSource generalSource = new RibbonPanelSource();

                RibbonRowPanel hcolumn1 = new RibbonRowPanel();
                hcolumn1.IsTopJustified = true;
                var cmdNewPlotMaster = UIHelper.GetCommandGlobalName(typeof(SharedHouseCommands), nameof(SharedHouseCommands.CreateDetailPlotMaster));
                var btnNewPlotMaster = UIHelper.CreateButton(Resources.SharedUIHelper_UI_NewPlotMaster, Resources.Houses_Small, RibbonItemSize.Standard, cmdNewPlotMaster);
                hcolumn1.Items.Add(btnNewPlotMaster);

                generalSource.Items.Add(hcolumn1);
                generalSource.Title = Resources.ExtensionApplication_UI_HousingDesignTabTitle;
                generalPanel.Source = generalSource;

                RibbonControl rc         = Autodesk.Windows.ComponentManager.Ribbon;
                RibbonTab     primaryTab = rc.FindTab(Jpp.Ironstone.Core.Constants.IronstoneTabId);
                primaryTab.Panels.Add(generalPanel);

                GeneralDesignCreated = true;
            }

            CreateBlockTab();
        }
示例#3
0
        public void Initialize()
        {
            RibbonControl rc     = Autodesk.Windows.ComponentManager.Ribbon;
            RibbonTab     JPPTab = rc.FindTab("JPPCORE_JPP_TAB");

            if (JPPTab == null)
            {
                JPPTab = JPP.Core.JPPMain.CreateTab();
            }

            RibbonPanel       Panel        = new RibbonPanel();
            RibbonPanelSource source       = new RibbonPanelSource();
            RibbonRowPanel    StructureRow = new RibbonRowPanel();

            source.Title = "Civil Structures";

            Dictionary <string, UserControl> ucs = new Dictionary <string, UserControl>();

            ucs.Add("Site Settings", new SiteFoundationControl());
            foundationUI = new UIPanelToggle(StructureRow, JPP.CivilStructures.Properties.Resources.spade, "Foundations", new Guid("4bcb33a2-0771-4d96-a2f0-9a96229ff393"), ucs);

            //Build the UI hierarchy
            source.Items.Add(StructureRow);
            Panel.Source = source;

            JPPTab.Panels.Add(Panel);
        }
示例#4
0
        /// <summary>
        /// Hierarchy:
        /// Tab can have many Panels
        /// Each Panel can have many Items.
        /// </summary>

        public static void CreateRibbonTab(UIControlledApplication application, string ribbonTabName)
        {
            RibbonControl ribbon = ComponentManager.Ribbon;
            RibbonTab     tab    = ribbon.FindTab(ribbonTabName);

            if (tab == null)
            {
                application.CreateRibbonTab(ribbonTabName);
            }
        }
        public void EnableRibbon()
        {
            RibbonControl ribbon = ComponentManager.Ribbon;

            if (ribbon != null)
            {
                RibbonTab rtab = ribbon.FindTab("TESTME");
                if (rtab != null)
                {
                    ribbon.Tabs.Remove(rtab);
                }
                rtab       = new RibbonTab();
                rtab.Title = "Drawing manager";
                rtab.Id    = "Drawing manager";
                //Add the Tab
                ribbon.Tabs.Add(rtab);
                addContent(rtab);
            }
        }
示例#6
0
        public void Start()
        {
            RibbonControl rbCont = ComponentManager.Ribbon;

            if (rbCont != null)
            {
                RibbonTab rbTab = rbCont.FindTab("MyCad");

                if (rbTab != null)
                {
                    rbCont.Tabs.Remove(rbTab);
                }
                rbTab       = new RibbonTab();
                rbTab.Title = "MyCad";
                rbTab.Id    = "MyCad";
                rbCont.Tabs.Add(rbTab);
                addContent(rbTab);
            }
        }
示例#7
0
        public void Initialize()
        {
            RibbonControl ribbon = ComponentManager.Ribbon;

            if (ribbon != null)
            {
                RibbonTab rtab = ribbon.FindTab("FazHidraulica");
                if (rtab != null)
                {
                    ribbon.Tabs.Remove(rtab);
                }
                rtab       = new RibbonTab();
                rtab.Title = "FazHidraulica";
                rtab.Id    = "FazHidraulica";
                //Add the Tab
                ribbon.Tabs.Add(rtab);
                AddContent(rtab);
            }
        }
示例#8
0
        public void BHKBimObject()
        {
            this.userinterface = new AppUI(this);

            RibbonControl ribbon = ComponentManager.Ribbon;

            if (ribbon != null)
            {
                //초기화할 때, 호출하지 않으면 비정상적인 접근이라는 예외가 호출된다.
                //RibbonTab addin = ribbon.Tabs.First(tab => tab.Name.Equals("Add-ins"));

                RibbonTab addin = ribbon.FindTab("TEST");
                if (addin != null)
                {
                    ribbon.Tabs.Remove(addin);
                }
                addin       = new RibbonTab();
                addin.Title = "TEST";
                addin.Id    = "test";
                //Add the Tab
                ribbon.Tabs.Add(addin);

                RibbonPanel panel = new RibbonPanel();

                RibbonPanelSource rps = new RibbonPanelSource();
                rps.Title    = "BHK's Bim Object";
                panel.Source = rps;

                RibbonButton rb = new RibbonButton();
                rb.Name     = "Open Browser";
                rb.Text     = "Open Browser";
                rb.ShowText = true;

                rb.CommandHandler   = new MyRibbonButtonCommandHandler();
                rb.CommandParameter = this.userinterface;

                //Add the Button to the Tab
                rps.Items.Add(rb);

                addin.Panels.Add(panel);
            }
        }
示例#9
0
        private static void CreateRibbon(IEnumerable <IRibbonElement> elements, string tabName)
        {
            try
            {
                if (ribbon == null)
                {
                    ribbon = ComponentManager.Ribbon;
                }
                ribbon.Tabs.CollectionChanged -= Tabs_CollectionChanged;
                if (ribbon.FindTab(tabName) != null)
                {
                    return;
                }

                // группировка элементов по вкладкам
                var tabsOpt = elements.GroupBy(g => g.Tab).Select(t => CreateTab(t.Key, t.ToList())).ToList();
                foreach (var tabOpt in tabsOpt)
                {
                    var tab = (RibbonTab)tabOpt.Item;
                    if (tab == null)
                    {
                        continue;
                    }
                    AddItem(tabOpt.Index, tab, ribbon.Tabs);
                    tab.Panels.CollectionChanged += Panels_CollectionChanged;
                    tab.PropertyChanged          += Tab_PropertyChanged;
                }

                var activeTab = (RibbonTab)ribbonOptions.Data.Tabs.FirstOrDefault(t => t.UID == ribbonOptions.Data.ActiveTab)?.Item;
                if (activeTab != null)
                {
                    ribbon.ActiveTab = activeTab;
                }

                ribbon.Tabs.CollectionChanged += Tabs_CollectionChanged;
            }
            catch (Exception ex)
            {
                Logger.Log.Error(ex, "CreateRibbon");
            }
        }
示例#10
0
        public void CreateUI()
        {
            RibbonControl rc         = Autodesk.Windows.ComponentManager.Ribbon;
            RibbonTab     primaryTab = rc.FindTab(Jpp.Ironstone.Core.Constants.IRONSTONE_TAB_ID);

            RibbonPanel       Panel  = new RibbonPanel();
            RibbonPanelSource source = new RibbonPanelSource();

            source.Title = Properties.Resources.ExtensionApplication_UI_PanelTitle;

            RibbonRowPanel column1 = new RibbonRowPanel();

            column1.IsTopJustified = true;
            RibbonButton addRevision = UIHelper.CreateButton(Properties.Resources.ExtensionApplication_UI_RevisionButton,
                                                             Properties.Resources.Revise_Small, RibbonItemSize.Standard, String.Empty);

            RibbonButton finaliseRevisions = UIHelper.CreateButton(Properties.Resources.ExtensionApplication_UI_FinaliseRevisionButton,
                                                                   Properties.Resources.Revise_Small, RibbonItemSize.Standard, String.Empty);

            RibbonSplitButton revisionSplitButton = new RibbonSplitButton();

            /*revisionSplitButton.Text = "RibbonSplit";*/
            revisionSplitButton.ShowText = true;
            revisionSplitButton.Items.Add(addRevision);
            revisionSplitButton.Items.Add(finaliseRevisions);
            //TODO: Enable once the backing code is in place
            revisionSplitButton.IsEnabled = false;

            column1.Items.Add(revisionSplitButton);
            column1.Items.Add(new RibbonRowBreak());
            column1.Items.Add(UIHelper.CreateButton(Properties.Resources.ExtensionApplication_UI_ImportDrawing,
                                                    Properties.Resources.DocumentType, RibbonItemSize.Standard, "DM_ImportDrawing"));

            //Build the UI hierarchy
            source.Items.Add(column1);

            Panel.Source = source;

            primaryTab.Panels.Add(Panel);
        }
示例#11
0
        public bool RibbonLoad()
        {
            try
            {
                #region Ribbon Load

                #region Ribbon Tab Load Control

                //RibbonTabLoadControl = false;

                RibbonTab fintab = AcadRibbonControl.FindTab(TabId);
                if (fintab == null)
                {
                    AcadRibbonControl.Tabs.Add(ArizaAnalizTab);
                    ArizaAnalizTab.IsActive = true;
                }
                else
                {
                    return(true);
                }

                #endregion Ribbon Tab Load Control

                RibbonPanel RibPan1Promagis = new RibbonPanel();
                // RibbonPanel RibPan2Promagis = new RibbonPanel();
                RibbonRowPanel RibRowPan1Promagis = new RibbonRowPanel();
                // RibbonRowPanel RibRowPan2Promagis = new RibbonRowPanel();

                ArizaAnalizTab.Panels.Add(RibPan1Promagis); // Autocad Tab
                // ArizaAnalizTab.Panels.Add(RibPan2Promagis); // Autocad Tab
                RibbonPanelSource RibPanSrc1Promagis = new RibbonPanelSource();
                //RibbonPanelSource RibPanSrc2Promagis = new RibbonPanelSource();
                RibPanSrc1Promagis.Title = "Arıza Analiz";
                //RibPanSrc2Promagis.Title = "Ayarlar";
                RibPanSrc1Promagis.Items.Add(RibRowPan1Promagis);
                //RibPanSrc2Promagis.Items.Add(RibRowPan2Promagis);
                RibPan1Promagis.Source = RibPanSrc1Promagis;
                //RibPan2Promagis.Source = RibPanSrc2Promagis;

                #region Hat Ribbon Button Elemanının Tüm Özellikleri Ayarlanıyor

                PromagisRibbonButton RibBtn1 = new PromagisRibbonButton(true)
                {
                    Text             = "Paneli Aç",
                    CommandParameter = "pp ",
                    Image            = getBitmap(Kaynak.Settings),
                    LargeImage       = getBitmap(Kaynak.Settings),
                    Description      = "Aktarım Formunu ve Dosya Ayarları Formunu Açar",
                };
                RibBtn1.Clicked += RibBtn1_Clicked;
                RibRowPan1Promagis.Items.Add(RibBtn1);

                #endregion Hat Ribbon Button Elemanının Tüm Özellikleri Ayaralnıyor

                //#region Direk Ribbon Button Elemanının Tüm Özellikleri Ayarlanıyor

                //PromagisRibbonButton RibBtn2Direk = new PromagisRibbonButton(true);
                //RibBtn2Direk.Text = "Direk";
                //RibBtn2Direk.Image = getBitmap(Kaynak.Direk32);
                //RibBtn2Direk.LargeImage = getBitmap(Kaynak.Direk32);
                //RibBtn2Direk.Description = "Direk Çizim Formunu Açar";
                //RibBtn2Direk.Clicked += this.RibBtn2Direk_Clicked;
                //RibRowPan1Promagis.Items.Add(RibBtn2Direk);

                //#endregion Direk Ribbon Button Elemanının Tüm Özellikleri Ayarlanıyor

                //#region GPS Ribbon Button Elemanının Tüm Özellikleri Ayaralnıyor

                //PromagisRibbonButton RibBtn3GPS = new PromagisRibbonButton(true);
                //RibBtn3GPS.Text = "GPS";
                //RibBtn3GPS.Image = getBitmap(Kaynak.location);
                //RibBtn3GPS.LargeImage = getBitmap(Kaynak.location);
                //RibBtn3GPS.Description = "GPS Bağla";
                //RibBtn3GPS.Clicked += RibBtn3GPS_Clicked;
                //RibRowPan1Promagis.Items.Add(RibBtn3GPS);

                //#endregion GPS Ribbon Button Elemanının Tüm Özellikleri Ayaralnıyor

                //#region Ayarlar

                //PromagisRibbonButton RibBtn4Ayarlar = new PromagisRibbonButton(true);
                //RibBtn4Ayarlar.Text = "Ayarlar";
                //RibBtn4Ayarlar.CommandParameter = "AY ";
                //RibBtn4Ayarlar.Image = getBitmap(Kaynak.Settings);
                //RibBtn4Ayarlar.LargeImage = getBitmap(Kaynak.Settings);
                //RibBtn4Ayarlar.Description = "Ayarlar Formunu Açar";
                //RibBtn4Ayarlar.Clicked += RibBtn4Ayarlar_Clicked;
                //RibRowPan2Promagis.Items.Add(RibBtn4Ayarlar);


                //PromagisRibbonButton RibBtn5DurumTespit = new PromagisRibbonButton(true);
                //RibBtn5DurumTespit.Text = "DurumTespit";
                //RibBtn5DurumTespit.CommandParameter = "DR ";

                ////var imgs = DevExpress.Images.ImageResourceCache.Default.GetAllResourceKeys(); //.GetImage("images/actions/add_16x16.png");
                //// File.WriteAllLines("deneme.csv", imgs);
                //RibBtn5DurumTespit.LargeImage = GetBitmapImageFromStream(PromagisCad.Properties.PromagisCad_Images.images_reports_report_32x32_png); ; // getBitmap((Bitmap)DevExpress.Images.ImageResourceCache.Default.GetImage("images/actions/add_16x16.png"));
                //RibBtn5DurumTespit.Image = GetBitmapImageFromStream(PromagisCad.Properties.PromagisCad_Images.images_reports_report_16x16_png); ; // getBitmap((Bitmap)DevExpress.Images.ImageResourceCache.Default.GetImage("images/actions/add_16x16.png"));
                //RibBtn5DurumTespit.Description = "DurumTespit Formunu Açar";
                //RibBtn5DurumTespit.Clicked += RibBtn5DurumTespit_Clicked;
                //RibRowPan2Promagis.Items.Add(RibBtn5DurumTespit);
                //#endregion Ayarlar

                //RibbonItem rbitm1 = new RibbonItem();
                //rbitm1.Description = "deneme1";
                //rbitm1.ShowImage = true;
                //rbitm1.Text = "deneme1";
                //rbitm1.Image = getBitmap ( Kaynak.Direk32 );
                //rbitm1.ShowText = true;

                //RibbonCheckBox RibChcBx = new RibbonCheckBox();
                //RibChcBx.Description = "checkboxdeneme";
                //RibChcBx.ShowImage = true;
                //RibChcBx.Text = "checkboxdeneme";
                //RibChcBx.Image = getBitmap ( Kaynak.Kablo16 );
                //RibChcBx.ShowText = true;
                //RibChcBx.IsCheckable = true;
                //RibChcBx.IsChecked = true;

                //MyRibbonCombo RibCombo = new MyRibbonCombo();
                //RibCombo.Items.Add ( rbitm1 );
                //RibCombo.Items.Add ( RibChcBx );
                //RibCombo.Items.Add ( RibBtn1Hat );
                //RibCombo.Items.Add ( RibBtn2Direk );
                //RibCombo.Items.Add ( RibBtn3GPS );

                //RibbonListButton RibList = new   MyRibbonListButton();
                //RibList.Items.Add ( RibBtn1Hat );
                //RibList.Items.Add ( RibBtn2Direk );
                //RibList.Items.Add ( RibBtn3GPS );
                //RibList.Items.Add ( RibBtn4Ayarlar );
                //RibList.Width = 200;
                //RibList.Height = 200;
                //RibList.Text = "deneme";
                //RibList.ShowImage = true;
                //RibList.ShowText = true;
                //RibList.ListButtonStyle = Autodesk.Private.Windows.RibbonListButtonStyle.SplitButton;



                ArizaAnalizTab.IsActive = true;
                Loded = true;
                return(true);

                #endregion Ribbon Load
            }
            catch (Exception)
            {
                Loded = false;
                return(false);
            }
        }
示例#12
0
        /// <summary>
        /// Implement the Autocad extension api to load the core elements of the civil api
        /// </summary>
        public void Initialize()
        {
            Logger.Log("Loading Civil module...");
            PtLibrary = new Library <PlotType>("M:\\ML\\CAD-Library\\Library\\PlotTypes");

            //Check if running under Civil3D by trying to load dll
            try
            {
                AttemptC3DLoad();
                C3DActive = true;
            }
            catch (System.Exception)
            {
                C3DActive = false;
            }
            Logger.Log("Civil 3d checked\n", Logger.Severity.Debug);

            //Add the menu options
            RibbonControl rc     = ComponentManager.Ribbon;
            RibbonTab     jppTab = rc.FindTab(Core.Constants.Jpp_Tab_Id);

            if (jppTab == null)
            {
                Logger.Log("No tabs has been created by core\n", Logger.Severity.Warning);
                jppTab = JPPMain.CreateTab();
            }

            //Create Drainage UI
            RibbonPanel       drainagePanel         = new RibbonPanel();
            RibbonPanelSource drainagePanelSource   = new RibbonPanelSource();
            RibbonRowPanel    drainageVerticalStack = new RibbonRowPanel();

            drainagePanelSource.Title = "Civil Drainage";

            RibbonButton layPipeButton = Core.Utilities.CreateButton("Lay Pipe", Properties.Resources.pipeIcon_small, RibbonItemSize.Standard, "._LayPipe");

            layPipeButton.IsEnabled = false;
            drainageVerticalStack.Items.Add(layPipeButton);
            drainageVerticalStack.Items.Add(new RibbonRowBreak());

            RibbonButton annotatePipeButton = Core.Utilities.CreateButton("Annotate Pipe", Properties.Resources.pipeAnnotate_small, RibbonItemSize.Standard, "._AnnotatePipe");

            annotatePipeButton.IsEnabled = false;
            drainageVerticalStack.Items.Add(annotatePipeButton);

            drainagePanelSource.Items.Add(drainageVerticalStack);
            drainagePanel.Source = drainagePanelSource;
            jppTab.Panels.Add(drainagePanel);

            //Create the Utilities UI
            RibbonPanel       utilitiesPanel       = new RibbonPanel();
            RibbonPanelSource utilitiesPanelSource = new RibbonPanelSource();
            RibbonRowPanel    plotStack            = new RibbonRowPanel();
            RibbonRowPanel    utilitiesStack       = new RibbonRowPanel();
            RibbonRowPanel    utilitiesStack2      = new RibbonRowPanel();

            utilitiesPanelSource.Title = "Civil Utilities";

            //Add button to import xref
            _plotButton = new RibbonToggleButton
            {
                //RibbonButton plotButton = new RibbonButton();
                ShowText  = true,
                ShowImage = true,
                Text      = "Housing Scheme",
                Name      = "Import As Xref"
            };
            _plotButton.CheckStateChanged += PlotButton_CheckStateChanged;
            _plotButton.LargeImage         = Core.Utilities.LoadImage(Properties.Resources.housingscheme);
            _plotButton.Size        = RibbonItemSize.Large;
            _plotButton.Orientation = System.Windows.Controls.Orientation.Vertical;
            plotStack.Items.Add(_plotButton);
            SetHousingSchemeRequirements();

            //Add button to import xref
            RibbonButton importXrefButton = Core.Utilities.CreateButton("Import as Xref", Properties.Resources.importXref, RibbonItemSize.Large, "._ImportAsXref");

            importXrefButton.Orientation = System.Windows.Controls.Orientation.Vertical;
            utilitiesStack.Items.Add(importXrefButton);

            //Add button to level polyline
            RibbonButton levelPLineButtone = Core.Utilities.CreateButton("Level Polyline", Properties.Resources.importXref, RibbonItemSize.Standard, "._LevelPolyline");

            levelPLineButtone.IsEnabled   = false;
            levelPLineButtone.Orientation = System.Windows.Controls.Orientation.Vertical;
            utilitiesStack2.Items.Add(levelPLineButtone);
            utilitiesStack2.Items.Add(new RibbonRowBreak());

            utilitiesPanelSource.Items.Add(plotStack);
            utilitiesPanelSource.Items.Add(utilitiesStack);
            utilitiesPanelSource.Items.Add(utilitiesStack2);
            utilitiesPanel.Source = utilitiesPanelSource;

            jppTab.Panels.Add(utilitiesPanel);
            Logger.Log("UI created\n", Logger.Severity.Debug);


            _ps = new PaletteSet("JPP", new Guid("8bc0c89e-3be0-4e30-975e-1a4e09cb0524"))
            {
                Size        = new Size(600, 800),
                Style       = (PaletteSetStyles)((int)PaletteSetStyles.ShowAutoHideButton + (int)PaletteSetStyles.ShowCloseButton),
                DockEnabled = (DockSides)((int)DockSides.Left + (int)DockSides.Right)
            };

            _uc2 = new PlotUserControl();
            ElementHost host2 = new ElementHost
            {
                AutoSize = true,
                Dock     = DockStyle.Fill,
                Child    = _uc2
            };

            _uc3 = new PlotTypeUserControl();
            ElementHost host3 = new ElementHost
            {
                AutoSize = true,
                Dock     = DockStyle.Fill,
                Child    = _uc3
            };

            _ps.Add("Plot Types", host3);
            _ps.Add("Plots", host2);

            // Display our palette set
            _ps.KeepFocus = false;

            //Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.DocumentActivationChanged += DocumentManager_DocumentActivationChanged;
            Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.DocumentActivated += PlotButton_CheckStateChanged;
            Logger.Log("Dock created\n", Logger.Severity.Debug);

            Application.Idle += Application_Idle;

            //Load click overrides
            //TODO: Fix and re-enable
            //ClickOverride.Current.Add(new LevelClickHandler());
            Logger.Log("Civil module loaded.\n");
        }
示例#13
0
 public Tab GetModifyTab()
 {
     return(Tab(ribbonControl.FindTab(ContextualTabHelper.IdModifyTab)));
 }