Example #1
0
        public DesignerOptionsForm(Designer designer)
        {
            FDesigner     = designer;
            FOptionsPages = new List <DesignerOptionsPage>();
            InitializeComponent();
            Localize();

            // add default pages
            PluginsOptions pluginsOptions = new PluginsOptions(designer);

            AddPages(pluginsOptions);

            List <Type> processedPluginTypes = new List <Type>();

            foreach (IDesignerPlugin plugin in FDesigner.Plugins)
            {
                if (processedPluginTypes.IndexOf(plugin.GetType()) != -1)
                {
                    continue;
                }
                DesignerOptionsPage page = plugin.GetOptionsPage();
                AddPages(page);
                processedPluginTypes.Add(plugin.GetType());
            }

            int activePageIndex = 0;

            if (FDesigner.ActiveReportTab != null)
            {
                foreach (IDesignerPlugin plugin in FDesigner.ActiveReportTab.Plugins)
                {
                    if (processedPluginTypes.IndexOf(plugin.GetType()) != -1)
                    {
                        continue;
                    }
                    DesignerOptionsPage page = plugin.GetOptionsPage();
                    AddPages(page);
                    processedPluginTypes.Add(plugin.GetType());

                    if (plugin == FDesigner.ActiveReportTab.ActivePageDesigner)
                    {
                        activePageIndex = pageControl1.Controls.Count - 1;
                    }
                }
            }

            pageControl1.ActivePageIndex = activePageIndex;
        }
Example #2
0
        private void AddPages(DesignerOptionsPage page)
        {
            if (page != null)
            {
                foreach (TabPage tab in page.tc1.TabPages)
                {
                    PageControlPage panel = new PageControlPage();
                    panel.Text      = tab.Text;
                    panel.Dock      = DockStyle.Fill;
                    panel.BackColor = SystemColors.Window;
                    while (tab.Controls.Count > 0)
                    {
                        tab.Controls[0].Parent = panel;
                    }
                    pageControl1.Controls.Add(panel);
                }

                FOptionsPages.Add(page);
                page.Init();
            }
        }