예제 #1
0
		internal static bool IsCompletelySelected(GlyphRunViewModel placeholder)
		{
			Contract.Requires(placeholder != null);
			Contract.Requires(placeholder.IsPlaceholder);

			return placeholder.Box.Selections.Any(selection => selection.Contains(placeholder));
		}
예제 #2
0
		/// <summary> Selects the specified placeholder completely. Does not implement selecting from somewhere TO the placeholder. </summary>
		internal static void SelectCompletely(GlyphRunViewModel placeholder)
		{
			Contract.Requires(placeholder != null);
			Contract.Requires(placeholder.IsPlaceholder);

			if (IsCompletelySelected(placeholder))
				return;

			//TODO: whenever the caret is to disappear, so is the placeholder selection (probably). Design!

			//TODO: specifiy what happens if other selections are already present
			//start selection from end, such that caret ends at start
			Selection selection = placeholder.Box.Selections.GetCurrentOrCreate(placeholder.Box, 0);//0 due to new Placeholder.CaretPositionCount == 1 

			//set caret at start
			placeholder.Box.CaretPerTree.Set(placeholder.Box, new ExplicitIndex((ElementIndex)1));

			selection.Add(placeholder.Box.CaretPerTree);
		}
예제 #3
0
		public MathGlyphRun(GlyphRunViewModel viewModel)
		{
			this.DataContext = viewModel;

			//VIEW5
			viewModel.PropertyChanged += OnFontSizeChanged;
			this.Height = viewModel.FontSize;
			//VIEW3//VIEW4
			viewModel.Glyphs.CollectionChanged += OnGlyphsChanged;
			OnGlyphsChanged(viewModel.Glyphs, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, viewModel.Glyphs, 0));


			viewModel.PropertyChanged += OnIsPlaceholderChanged;
			//VIEW15
			this.Focusable = viewModel.Modifiable;


	//		viewModel.InputBindings.CollectionChanged += OnInputBindingsChanged;
			OnInputBindingsChanged(viewModel.InputBindings, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, viewModel.InputBindings));
			this.MakeSpacebarTriggerTextInput();

            TextBehaviour.SetTextInputCommand(this, viewModel.InsertCharacterCommand);
		}
예제 #4
0
		public KeyInputCommandParameter(GlyphRunViewModel glyphRun)
		{
			GlyphRun = glyphRun;
		}