コード例 #1
0
ファイル: Scope.cs プロジェクト: eldersantos/ravendb
		public void AddChild(Scope childScope)
		{
			if (childScope.Parent != null)
				throw new InvalidOperationException("The child scope already has a parent.");

			childScope.Parent = this;

			Children.Add(childScope);
		}
コード例 #2
0
ファイル: LanguageParser.cs プロジェクト: eldersantos/ravendb
		static void AddScopeToNestedScopes(Scope scope,
		                                   ref Scope currentScope,
		                                   ICollection<Scope> capturedStyleTree)
		{
			if (scope.Index >= currentScope.Index && (scope.Index + scope.Length <= currentScope.Index + currentScope.Length))
			{
				currentScope.AddChild(scope);
				currentScope = scope;
			}
			else
			{
				currentScope = currentScope.Parent;

				if (currentScope != null)
					AddScopeToNestedScopes(scope, ref currentScope, capturedStyleTree);
				else
					capturedStyleTree.Add(scope);
			}
		}
コード例 #3
0
ファイル: XamlFormatter.cs プロジェクト: eldersantos/ravendb
		static void BuildSpanForCapturedStyle(Scope scope,
		                                      IStyleSheet styleSheet)
		{
			Color foreground = Colors.Black;
			Color background = Colors.Transparent;

			if (styleSheet.Styles.Contains(scope.Name))
			{
				Style style = styleSheet.Styles[scope.Name];

				foreground = style.Foreground;
				background = style.Background;
			}

			WriteElementStart("span", foreground, background);
		}
コード例 #4
0
ファイル: XamlFormatter.cs プロジェクト: eldersantos/ravendb
		static void GetStyleInsertionsForCapturedStyle(Scope scope, ICollection<TextInsertion> styleInsertions)
		{
			styleInsertions.Add(new TextInsertion
			                    	{
			                    		Index = scope.Index,
			                    		Scope = scope
			                    	});

			foreach (Scope childScope in scope.Children)
				GetStyleInsertionsForCapturedStyle(childScope, styleInsertions);

			styleInsertions.Add(new TextInsertion
			                    	{
			                    		Index = scope.Index + scope.Length,
			                    		//                Text = ""
			                    	});
		}