/// <summary>
		/// Fired when the graphic builder is also done setting text in the graphic, and thus we can decide if we want to unexecute
		/// the insert or save the command into the history.
		/// </summary>
		private void OnGraphicFinalCancelled(object sender, GraphicEventArgs e)
		{
			InteractiveTextGraphicBuilder graphicBuilder = sender as InteractiveTextGraphicBuilder;
			if (graphicBuilder != null)
			{
				graphicBuilder.GraphicFinalComplete -= OnGraphicFinalComplete;
				graphicBuilder.GraphicFinalCancelled -= OnGraphicFinalCancelled;
			}

			_undoableCommand.Unexecute();
			_undoableCommand = null;
		}
		/// <summary>
		/// Fired when the graphic builder is done placing the graphic, and hence does not need mouse capture anymore, but in the
		/// text graphic is not technically complete yet and thus we do not insert into the command history yet.
		/// </summary>
		private void OnGraphicBuilderInitiallyDone(object sender, GraphicEventArgs e)
		{
			_graphicBuilder.GraphicComplete -= OnGraphicBuilderInitiallyDone;
			_graphicBuilder.GraphicCancelled -= OnGraphicBuilderInitiallyDone;
			_graphicBuilder = null;
		}
		/// <summary>
		/// Fired when the graphic builder is also done setting text in the graphic, and thus we can decide if we want to unexecute
		/// the insert or save the command into the history.
		/// </summary>
		private void OnGraphicFinalComplete(object sender, GraphicEventArgs e)
		{
			// fired 
			InteractiveTextGraphicBuilder graphicBuilder = sender as InteractiveTextGraphicBuilder;
			if (graphicBuilder != null)
			{
				graphicBuilder.GraphicFinalComplete -= OnGraphicFinalComplete;
				graphicBuilder.GraphicFinalCancelled -= OnGraphicFinalCancelled;
			}

			ImageViewer.CommandHistory.AddCommand(_undoableCommand);
			_undoableCommand = null;
		}
Beispiel #4
0
			private void OnGraphicBuilderCancelled(object sender, GraphicEventArgs e)
			{
				_resliceToolGroup.ToolGroupState.SetMemento(_originalResliceToolsState);

				_originalResliceToolsState = null;

				RemoveGraphicBuilder();

				this.ImageViewer.PhysicalWorkspace.Draw();
			}
Beispiel #5
0
			private void OnGraphicBuilderDone(object sender, GraphicEventArgs e)
			{
				if (base.ImageViewer.CommandHistory != null)
				{
					DrawableUndoableCommand compositeCommand = new DrawableUndoableCommand(this.ImageViewer.PhysicalWorkspace);
					compositeCommand.Name = SR.CommandMprReslice;

					MemorableUndoableCommand toolGroupStateCommand = new MemorableUndoableCommand(_resliceToolGroup.ToolGroupState);
					toolGroupStateCommand.BeginState = _originalResliceToolsState;
					toolGroupStateCommand.EndState = _resliceToolGroup.ToolGroupState.CreateMemento();
					compositeCommand.Enqueue(toolGroupStateCommand);

					base.ImageViewer.CommandHistory.AddCommand(compositeCommand);
				}

				_originalResliceToolsState = null;

				RemoveGraphicBuilder();

				_lastTopLeftPresentationImageIndex = this.SliceImageBox.TopLeftPresentationImageIndex;
			}
		private void OnGraphicComplete(object sender, GraphicEventArgs e)
		{
			_graphicBuilder.GraphicCancelled -= OnGraphicCancelled;
			_graphicBuilder.GraphicComplete -= OnGraphicComplete;
			_graphicBuilder = null;

			if (_primitiveGraphic != null)
			{
				bool boundingBoxTooSmall = false;
				_primitiveGraphic.CoordinateSystem = CoordinateSystem.Destination;
				if (_primitiveGraphic.BoundingBox.Width < 50 || _primitiveGraphic.BoundingBox.Height < 50)
					boundingBoxTooSmall = true;
				_primitiveGraphic.ResetCoordinateSystem();

				if (boundingBoxTooSmall)
				{
					RemoveDrawShutterGraphic();
					base.SelectedPresentationImage.Draw();
				}
				else
				{
					GeometricShutter shutter = ConvertToGeometricShutter();
					GeometricShuttersGraphic shuttersGraphic =
						GetGeometricShuttersGraphic((IDicomPresentationImage) base.SelectedPresentationImage, true);
					DrawableUndoableCommand command = new DrawableUndoableCommand(shuttersGraphic);
					command.Name = SR.CommandDrawShutter;
					command.Enqueue(new AddGeometricShutterUndoableCommand(shuttersGraphic, shutter));
					command.Execute();

					base.ImageViewer.CommandHistory.AddCommand(command);
				}
			}
		}
Beispiel #7
0
		private void OnGraphicBuilderCancelled(object sender, GraphicEventArgs e)
		{
			_graphicBuilder.GraphicComplete -= OnGraphicBuilderComplete;
			_graphicBuilder.GraphicCancelled -= OnGraphicBuilderCancelled;

			_undoableCommand.Unexecute();
			_undoableCommand = null;

			_graphicBuilder = null;
		}
Beispiel #8
0
		private void OnGraphicBuilderComplete(object sender, GraphicEventArgs e)
		{
			_graphicBuilder.GraphicComplete -= OnGraphicBuilderComplete;
			_graphicBuilder.GraphicCancelled -= OnGraphicBuilderCancelled;

			_graphicBuilder.Graphic.ImageViewer.CommandHistory.AddCommand(_undoableCommand);
			_graphicBuilder.Graphic.Draw();

			_undoableCommand = null;

			_graphicBuilder = null;
		}