Example #1
0
        public StudioView()
        {
            Content.style.position = IStyle.PositionEnum.absolute;
            Content.style.left     = "0px";
            Content.style.right    = "0px";
            Content.style.top      = "0px";
            Content.style.bottom   = "0px";

            new TwentyTenWorkspace().ToBackground(Content.style, true);

            var WorkspaceHeader = default(IHTMLSpan);

            @"jsc-solutions.net studio".ToDocumentTitle().With(
                title =>
            {
                WorkspaceHeader = new IHTMLSpan {
                    innerText = title
                };

                WorkspaceHeader.AttachTo(Content);
                WorkspaceHeader.style.SetLocation(16, 8);
                WorkspaceHeader.style.color = Color.White;

                // http://www.quirksmode.org/css/textshadow.html
                WorkspaceHeader.style.textShadow = "#808080 4px 2px 2px";
            }
                );

            // em + px :)
            var Workspace0 = new IHTMLDiv().With(
                div =>
            {
                div.style.position = IStyle.PositionEnum.absolute;
                div.style.left     = "0px";
                div.style.right    = "0px";
                div.style.bottom   = "0px";
                div.style.top      = "3em";
            }
                ).AttachTo(Content);

            // workspace contains the split views
            var Workspace = new IHTMLDiv().With(
                div =>
            {
                div.style.position = IStyle.PositionEnum.absolute;
                div.style.left     = "6px";
                div.style.right    = "6px";
                div.style.bottom   = "6px";
                div.style.top      = "6px";
            }
                ).AttachTo(Workspace0);


            Action <HorizontalSplit> ApplyStyle =
                t =>
            {
                t.Split.Splitter.style.backgroundColor = Color.None;
                t.SplitImageContainer.Orphanize();
                t.SplitArea.Target.style.borderLeft  = "0";
                t.SplitArea.Target.style.borderRight = "0";
                t.SplitArea.Target.style.width       = "6px";
                t.SplitArea.Target.style.Opacity     = 0.7;

                // should we obselete JSColor already?
                t.SelectionColor = JSColor.Black;
            };

            var Split = new HorizontalSplit
            {
                Minimum = 0,
                Maximum = 1,
                Value   = 0.2,
            };

            Split.With(ApplyStyle);

            Split.Split.Splitter.style.backgroundColor = Color.None;

            Split.Container.AttachTo(Workspace);



            var SolutionToolbox = new SolutionDockWindowPage();

            SolutionToolbox.HeaderText.innerText          = "Toolbox";
            SolutionToolbox.Content.style.backgroundColor = Color.White;
            SolutionToolbox.Content.style.padding         = "2px";
            SolutionToolbox.Content.style.overflow        = IStyle.OverflowEnum.auto;
            SolutionToolbox.Content.Clear();


            var vv = new SolutionToolboxListView();

            vv.Container.AttachTo(SolutionToolbox.Content);

            var items = new StockToolboxTabsForHTMLDocument();

            items.WithEach(vv.Add);


            var Viewer = new SolutionDocumentViewer();
            SolutionDocumentViewerTab AboutTab = "About";

            Viewer.Add(AboutTab);

            var CurrentDesigner = new SolutionFileDesigner();



            var HTMLDesigner = new SolutionFileDesignerHTMLElementTabs();

            CurrentDesigner.Add(HTMLDesigner);

            #region CodeSource
            var CodeSourceTab =
                new SolutionFileDesignerTab
            {
                Image = new ScriptCoreLib.Ultra.Components.HTML.Images.FromAssets.ClassViewer(),
                Text  = "XDefaultPage"
            };

            var CodeSourceView = new SolutionFileView();


            CodeSourceView.Container.style.position = IStyle.PositionEnum.absolute;
            CodeSourceView.Container.style.left     = "0px";
            CodeSourceView.Container.style.right    = "0px";
            CodeSourceView.Container.style.top      = "0px";
            CodeSourceView.Container.style.bottom   = "0px";

            CodeSourceView.Container.style.display = IStyle.DisplayEnum.none;
            CodeSourceView.Container.AttachTo(CurrentDesigner.Content);

            CodeSourceTab.Deactivated +=
                delegate
            {
                CodeSourceView.Container.style.display = IStyle.DisplayEnum.none;
            };

            CodeSourceTab.Activated +=
                delegate
            {
                HTMLDesigner.HTMLDesignerContent.WhenContentReady(
                    body =>
                {
                    var CodeSourceFile = new SolutionFile();

                    var Type = new SolutionProjectLanguageType
                    {
                        Namespace   = "HTML.Pages",
                        Name        = "IDefaultPage",
                        IsInterface = true,
                    };

                    (from n in body.AsXElement().DescendantsAndSelf()
                     let id = n.Attribute("id")
                              where id != null
                              select new { n, id }
                    ).WithEach(
                        k =>
                    {
                        Type.Properties.Add(
                            new SolutionProjectLanguageProperty
                        {
                            Name         = k.id.Value,
                            GetMethod    = new SolutionProjectLanguageMethod(),
                            SetMethod    = new SolutionProjectLanguageMethod(),
                            PropertyType = new SolutionProjectLanguageType
                            {
                                Namespace = "ScriptCoreLib.JavaScript.DOM.HTML",
                                Name      = "IHTMLElement"
                            }
                        }
                            );
                    }
                        );

                    KnownLanguages.VisualCSharp.WriteType(CodeSourceFile, Type, null);

                    CodeSourceView.File = CodeSourceFile;

                    CodeSourceView.Container.style.display = IStyle.DisplayEnum.empty;
                }
                    );
            };


            #endregion


            CurrentDesigner.Add(CodeSourceTab);



            CurrentDesigner.First().RaiseActivated();

            AboutTab.Activated +=
                delegate
            {
                Viewer.Content.ReplaceContentWith(CurrentDesigner.Container);
            };

            Viewer.First().Activate();

            Split.Split.LeftScrollable  = SolutionToolbox.Container;
            Split.Split.RightScrollable = Viewer.Container;
        }
		public StudioView()
		{
			Content.style.position = IStyle.PositionEnum.absolute;
			Content.style.left = "0px";
			Content.style.right = "0px";
			Content.style.top = "0px";
			Content.style.bottom = "0px";

			new TwentyTenWorkspace().ToBackground(Content.style, true);

			var WorkspaceHeader = default(IHTMLSpan);

			@"jsc-solutions.net studio".ToDocumentTitle().With(
				title =>
				{
					WorkspaceHeader = new IHTMLSpan { innerText = title };

					WorkspaceHeader.AttachTo(Content);
					WorkspaceHeader.style.SetLocation(16, 8);
					WorkspaceHeader.style.color = Color.White;

					// http://www.quirksmode.org/css/textshadow.html
					WorkspaceHeader.style.textShadow = "#808080 4px 2px 2px";

				}
			);

			// em + px :)
			var Workspace0 = new IHTMLDiv().With(
				div =>
				{
					div.style.position = IStyle.PositionEnum.absolute;
					div.style.left = "0px";
					div.style.right = "0px";
					div.style.bottom = "0px";
					div.style.top = "3em";
				}
			).AttachTo(Content);

			// workspace contains the split views
			var Workspace = new IHTMLDiv().With(
				div =>
				{
					div.style.position = IStyle.PositionEnum.absolute;
					div.style.left = "6px";
					div.style.right = "6px";
					div.style.bottom = "6px";
					div.style.top = "6px";
				}
			).AttachTo(Workspace0);


			Action<HorizontalSplit> ApplyStyle =
			t =>
			{
				t.Split.Splitter.style.backgroundColor = Color.None;
				t.SplitImageContainer.Orphanize();
				t.SplitArea.Target.style.borderLeft = "0";
				t.SplitArea.Target.style.borderRight = "0";
				t.SplitArea.Target.style.width = "6px";
				t.SplitArea.Target.style.Opacity = 0.7;

				// should we obselete JSColor already?
				t.SelectionColor = JSColor.Black;
			};

			var Split = new HorizontalSplit
			{
				Minimum = 0,
				Maximum = 1,
				Value = 0.2,
			};

			Split.With(ApplyStyle);

			Split.Split.Splitter.style.backgroundColor = Color.None;

			Split.Container.AttachTo(Workspace);



			var SolutionToolbox = new SolutionDockWindowPage();

			SolutionToolbox.HeaderText.innerText = "Toolbox";
			SolutionToolbox.Content.style.backgroundColor = Color.White;
			SolutionToolbox.Content.style.padding = "2px";
			SolutionToolbox.Content.style.overflow = IStyle.OverflowEnum.auto;
			SolutionToolbox.Content.Clear();


			var vv = new SolutionToolboxListView();

			vv.Container.AttachTo(SolutionToolbox.Content);

			var items = new StockToolboxTabsForHTMLDocument();

			items.WithEach(vv.Add);


			var Viewer = new SolutionDocumentViewer();
			SolutionDocumentViewerTab AboutTab = "About";
			Viewer.Add(AboutTab);

			var CurrentDesigner = new SolutionFileDesigner();




			var HTMLDesigner = new SolutionFileDesignerHTMLElementTabs();

			CurrentDesigner.Add(HTMLDesigner);

			#region CodeSource
			var CodeSourceTab =
				new SolutionFileDesignerTab
				{
					Image = new ScriptCoreLib.Ultra.Components.HTML.Images.FromAssets.ClassViewer(),
					Text = "XDefaultPage"
				};

			var CodeSourceView = new SolutionFileView();


			CodeSourceView.Container.style.position = IStyle.PositionEnum.absolute;
			CodeSourceView.Container.style.left = "0px";
			CodeSourceView.Container.style.right = "0px";
			CodeSourceView.Container.style.top = "0px";
			CodeSourceView.Container.style.bottom = "0px";

			CodeSourceView.Container.style.display = IStyle.DisplayEnum.none;
			CodeSourceView.Container.AttachTo(CurrentDesigner.Content);

			CodeSourceTab.Deactivated +=
				delegate
				{
					CodeSourceView.Container.style.display = IStyle.DisplayEnum.none;
				};

			CodeSourceTab.Activated +=
				delegate
				{
					HTMLDesigner.HTMLDesignerContent.WhenContentReady(
						body =>
						{
							var CodeSourceFile = new SolutionFile();

							var Type = new SolutionProjectLanguageType
							{
								Namespace = "HTML.Pages",
								Name = "IDefaultPage",
								IsInterface = true,
							};

							(from n in body.AsXElement().DescendantsAndSelf()
							 let id = n.Attribute("id")
							 where id != null
							 select new { n, id }
							).WithEach(
								k =>
								{
									Type.Properties.Add(
										new SolutionProjectLanguageProperty
										{
											Name = k.id.Value,
											GetMethod = new SolutionProjectLanguageMethod(),
											SetMethod = new SolutionProjectLanguageMethod(),
											PropertyType = new SolutionProjectLanguageType
											{
												Namespace = "ScriptCoreLib.JavaScript.DOM.HTML",
												Name = "IHTMLElement"
											}
										}
									);
								}
							);

							KnownLanguages.VisualCSharp.WriteType(CodeSourceFile, Type, null);

							CodeSourceView.File = CodeSourceFile;

							CodeSourceView.Container.style.display = IStyle.DisplayEnum.empty;
						}
					);
				};


			#endregion


			CurrentDesigner.Add(CodeSourceTab);




			CurrentDesigner.First().RaiseActivated();

			AboutTab.Activated +=
				delegate
				{
					Viewer.Content.ReplaceContentWith(CurrentDesigner.Container);
				};

			Viewer.First().Activate();

			Split.Split.LeftScrollable = SolutionToolbox.Container;
			Split.Split.RightScrollable = Viewer.Container;
		}