public Project AddNewProject(ResourceFolder parentResourceItem, IList <ResourceItem> selectesItem = null)
        {
            IMainTool mainTool = MainWindowPartFactory.GetMainTool();

            if (mainTool == null)
            {
                throw new MissingMethodException("Can not find GetMainTool...");
            }
            FilePath         baseDirectory    = parentResourceItem.BaseDirectory;
            FileDialogResult fileDialogResult = new NewFileDialog((Window)Services.MainWindow, (string)parentResourceItem.BaseDirectory, mainTool.CanvasSize).ShowDialog();

            if (fileDialogResult == null)
            {
                return((Project)null);
            }
            return(this.AddNewProject(parentResourceItem, new ProjectCreateInformation((FilePath)Path.Combine((string)baseDirectory, fileDialogResult.FileName), (IProjectContent)null, selectesItem, (float)fileDialogResult.Size.Width, (float)fileDialogResult.Size.Height)
            {
                ContentType = fileDialogResult.FileType.ToString()
            }));
        }
        public Project CreateDefalutSceneProject(bool isUpdateUI = true)
        {
            IMainTool      mainTool   = MainWindowPartFactory.GetMainTool();
            float          width      = mainTool == null ? 480f : (float)mainTool.CanvasSize.Width;
            float          height     = mainTool == null ? 320f : (float)mainTool.CanvasSize.Height;
            ResourceFolder rootFolder = this.CurrentResourceGroup.RootFolder;
            Project        project    = this.AddNewProject(rootFolder, new ProjectCreateInformation((FilePath)Path.Combine(rootFolder.FullPath, "MainScene.csd"), (IProjectContent)null, (IList <ResourceItem>)null, width, height)
            {
                ContentType = "Scene"
            });

            if (isUpdateUI)
            {
                Services.EventsService.GetEvent <AddResourcesEvent>().Publish(new AddResourcesArgs(rootFolder, (IEnumerable <ResourceItem>) new List <ResourceItem>()
                {
                    (ResourceItem)project
                }, true));
                Services.Workbench.OpenDocument(project);
            }
            return(project);
        }
Exemple #3
0
 private void CreateMenuBar()
 {
     this.topMenu = MainWindowPartFactory.CreateMainMenu();
     GlobalCommand.GlobalCmdManager.SetMultiRootWindow((Gtk.Window) this);
 }
Exemple #4
0
        private void CreateComponents()
        {
            this.fullViewVBox = new VBox(false, 0);
            this.rootWidget   = (Gtk.Container) this.fullViewVBox;
            this.Realize();
            this.toolbar = MainWindowPartFactory.CreateMainToolbarWidget();
            HBox hbox1 = new HBox(false, 0);

            this.fullViewVBox.PackStart((Widget)hbox1, false, false, 0U);
            this.toolbarFrame = new DockToolbarFrame();
            this.fullViewVBox.PackStart((Widget)this.toolbarFrame, true, true, 0U);
            this.dock = new DockFrame();
            this.dock.DefaultItemWidth = (int)byte.MaxValue;
            this.dock.CompactGuiLevel  = 2;
            this.toolbarFrame.ModifyBg(StateType.Normal, new Gdk.Color(byte.MaxValue, (byte)0, (byte)0));
            this.toolbarFrame.AddContent((Widget)this.dock);
            this.tabControl = new MonoDevelop.Components.DockNotebook.DockNotebook();
            this.tabControl.NavigationButtonsVisible = false;
            this.tabControl.SwitchPage    += new EventHandler(this.OnActiveWindowChanged);
            this.tabControl.PageRemoved   += new EventHandler(this.OnActiveWindowChanged);
            this.tabControl.PageAdded     += new EventHandler(this.OnActiveWindowChanged);
            this.tabControl.TabClosed     += new EventHandler <TabEventArgs>(this.CloseClicked);
            this.tabControl.TabActivated  += (EventHandler <TabEventArgs>)((sender, e) => this.ToggleFullViewMode());
            this.tabControl.DoPopupMenu    = new System.Action <MonoDevelop.Components.DockNotebook.DockNotebook, int, EventButton>(this.ShowPopup);
            this.tabControl.TabsReordered += new TabsReorderedHandler(this.OnTabsReordered);
            MonoDevelop.Components.DockNotebook.DockNotebook.ActiveNotebookChanged += (EventHandler)((param0, param1) => this.OnActiveWindowChanged((object)null, (EventArgs)null));
            this.Add((Widget)this.fullViewVBox);
            this.fullViewVBox.ShowAll();
            HBox hbox2 = new HBox(false, 0);

            this.bottomBar = MainWindowPartFactory.CreateMainStatus();
            this.bottomBar.Show();
            hbox2.PackStart(this.bottomBar, true, true, 0U);
            this.fullViewVBox.PackEnd((Widget)hbox2, false, false, 0U);
            hbox2.ShowAll();
            hbox1.PackStart(this.toolbar, true, true, 0U);
            this.tabControl.InitSize();
            int barHeight = this.tabControl.BarHeight;

            this.documentDockItem                        = this.dock.AddItem("Documents");
            this.documentDockItem.Behavior               = DockItemBehavior.Locked;
            this.documentDockItem.Expand                 = true;
            this.documentDockItem.DrawFrame              = false;
            this.documentDockItem.Label                  = "Documents";
            this.documentDockItem.Content                = (Widget)this.tabControl;
            this.documentDockItem.ContentVisibleChanged += new EventHandler(this.DockTabControlVisibleChanged);
            this.dock.DefaultVisualStyle                 = new DockVisualStyle()
            {
                PadTitleLabelColor         = new Gdk.Color?(Styles.PadLabelColor),
                PadBackgroundColor         = new Gdk.Color?(Styles.PadBackground),
                InactivePadBackgroundColor = new Gdk.Color?(Styles.InactivePadBackground),
                PadTitleHeight             = new int?(barHeight)
            };
            DockVisualStyle style1 = new DockVisualStyle();

            style1.PadTitleLabelColor         = new Gdk.Color?(Styles.PadLabelColor);
            style1.PadTitleHeight             = new int?(barHeight);
            style1.ShowPadTitleIcon           = new bool?(false);
            style1.UppercaseTitles            = new bool?(false);
            style1.ExpandedTabs               = new bool?(true);
            style1.PadBackgroundColor         = new Gdk.Color?(Styles.BrowserPadBackground);
            style1.InactivePadBackgroundColor = new Gdk.Color?(Styles.InactiveBrowserPadBackground);
            style1.TreeBackgroundColor        = new Gdk.Color?(Styles.BrowserPadBackground);
            this.dock.SetDockItemStyle("ProjectPad", style1);
            this.dock.SetDockItemStyle("ClassPad", style1);
            this.dock.SetRegionStyle("Documents/Left", style1);
            this.dock.SetRegionStyle("Documents/Right", style1);
            DockVisualStyle style2 = new DockVisualStyle();

            style2.SingleColumnMode = new bool?(true);
            this.dock.SetRegionStyle("Documents/Left;Documents/Right", style2);
            this.dock.SetDockItemStyle("Documents", style2);
            DockItem dockItem1 = this.dock.AddItem("__left");

            dockItem1.DefaultLocation = "Documents/Left";
            dockItem1.Behavior        = DockItemBehavior.Locked;
            dockItem1.DefaultVisible  = false;
            DockItem dockItem2 = this.dock.AddItem("__bottom");

            dockItem2.DefaultLocation = "Documents/Bottom";
            dockItem2.Behavior        = DockItemBehavior.Locked;
            dockItem2.DefaultVisible  = false;
            DockItem dockItem3 = this.dock.AddItem("__right");

            dockItem3.DefaultLocation = "Documents/Right";
            dockItem3.Behavior        = DockItemBehavior.Locked;
            dockItem3.DefaultVisible  = false;
            DockItem dockItem4 = this.dock.AddItem("__top");

            dockItem4.DefaultLocation = "Documents/Top";
            dockItem4.Behavior        = DockItemBehavior.Locked;
            dockItem4.DefaultVisible  = false;
            foreach (ExtensionNode extensionNode in AddinManager.GetExtensionNodes("/CocoStudio/Ide/Pads"))
            {
                this.ShowPadNode(extensionNode);
            }
            this.InitializeLayout("DefaultLayout");
            this.LoadLayoutFromFile(MainWindow.configFile);
        }