private void SetActionInformation
        (
            IActionsEditorView view,
            WorkstationContainer container,
            MedicalViewerActionType action
        )
        {
            bool isNewAction;


            isNewAction = !__ActionsEditorState.CustomActions.Contains(action);

            if (isNewAction)
            {
                view.CanAddAction    = true;
                view.CanRemoveAction = false;

                view.ActionDisplayName   = action.ToString( );
                view.SelectedMouseButton = MedicalViewerMouseButtons.Left;

                view.CanEditToolstripButtons = true;

                view.FeatureId = action.ToString( ) + "FeatureId";

                view.ToolStipItemImage            = null;
                View.ToolStipItemAlternativeImage = null;
            }
            else
            {
                view.CanAddAction    = false;
                view.CanRemoveAction = true;

                var keyValuePair = container.State.MedicalViewerCellMouseButtonActions.Where(n => n.Value == action).FirstOrDefault( );

                view.ActionDisplayName   = container.State.WorkstationActionDisplayName [action];
                view.SelectedMouseButton = keyValuePair.Key;

                view.CanEditToolstripButtons = keyValuePair.Key == MedicalViewerMouseButtons.Left;

                if (__ActionsEditorState.ActionAssociatedFeature.ContainsKey(action))
                {
                    view.FeatureId = __ActionsEditorState.ActionAssociatedFeature [action];

                    if (!string.IsNullOrEmpty(view.FeatureId))
                    {
                        ToolStripItem[] items = container.StripItemFeatureExecuter.GetItems(view.FeatureId);

                        if (items.Length > 0 && items [0] is IToolStripItemItemProperties)
                        {
                            view.ToolStipItemImage            = (( IToolStripItemItemProperties )items [0]).ItemProperties.DefaultImage;
                            view.ToolStipItemAlternativeImage = (( IToolStripItemItemProperties )items [0]).ItemProperties.AlternativeImage;
                        }
                    }
                }
            }

            view.CanChangeDisplayName = view.CanAddAction;
            view.CanChangeFeatureId   = view.CanAddAction;
            view.CanChangeMouseButton = view.CanAddAction;
        }
示例#2
0
        public void Initialize(MainForm owner, MedicalViewerActionType actionType)
        {
            InitializeComponent();

            cell   = MainForm.DefaultCell;
            viewer = owner.Viewer;
            _owner = owner;


            _owner.CobbAngleStarted = false;


            _actionType = actionType;
            this.Text   = "Set " + GetSeparatedText(actionType.ToString()) + " Action";

            if (cell.IsValidForAction(actionType, MedicalViewerMouseButtons.Wheel))
            {
                _cmbMouseButton.Items.Insert(4, "Wheel");
            }

            if (cell.IsValidForAction(actionType, MedicalViewerActionFlags.Selected))
            {
                _cmbApplyTo.Items.Add("Selected Cells");
                _cmbApplyTo.Items.Add("All Cells");
            }

            if (cell.IsValidForAction(actionType, MedicalViewerActionFlags.Selected))
            {
                _cmbApplyingMethod.Items.Add("On Release");
            }

            MedicalViewerActionFlags actionFlags = cell.GetActionFlags(actionType);


            if ((actionFlags | MedicalViewerActionFlags.OnRelease) == actionFlags)
            {
                _cmbApplyingMethod.SelectedIndex = 1;
            }
            else
            {
                _cmbApplyingMethod.SelectedIndex = 0;
            }

            if ((actionFlags & MedicalViewerActionFlags.Selected) == MedicalViewerActionFlags.Selected)
            {
                _cmbApplyTo.SelectedIndex = 1;
            }
            else if ((actionFlags & MedicalViewerActionFlags.AllCells) == MedicalViewerActionFlags.AllCells)
            {
                _cmbApplyTo.SelectedIndex = 2;
            }
            else
            {
                _cmbApplyTo.SelectedIndex = 0;
            }

            _cmbMouseButton.SelectedIndex = (int)cell.GetActionButton(actionType);
        }
示例#3
0
        public SetActionDialog(MedicalViewer viewer, MedicalViewerActionType actionType)
        {
            _viewer = viewer;
            InitializeComponent();

            _actionType = actionType;
            this.Text   = "Set " + GetSeparatedText(actionType.ToString()) + " Action";

            if (_viewer.IsValidForAction(actionType, MedicalViewerMouseButtons.Wheel))
            {
                if (actionType != MedicalViewerActionType.WindowLevel && actionType != MedicalViewerActionType.Alpha)
                {
                    _cmbMouseButton.Items.Insert(4, "Wheel");
                }
            }

            if (_viewer.IsValidForAction(actionType, MedicalViewerActionFlags.Selected))
            {
                _cmbApplyTo.Items.Add("Selected Cells");
                _cmbApplyTo.Items.Add("All Cells");
            }

            if (_viewer.IsValidForAction(actionType, MedicalViewerActionFlags.Selected))
            {
                _cmbApplyingMethod.Items.Add("On Release");
            }

            MedicalViewerActionFlags actionFlags = _viewer.GetActionFlags(actionType);

            if ((actionFlags | MedicalViewerActionFlags.OnRelease) == actionFlags)
            {
                _cmbApplyingMethod.SelectedIndex = 1;
            }
            else
            {
                _cmbApplyingMethod.SelectedIndex = 0;
            }

            if ((actionFlags | MedicalViewerActionFlags.Selected) == actionFlags)
            {
                _cmbApplyTo.SelectedIndex = 1;
            }
            else if ((actionFlags | MedicalViewerActionFlags.AllCells) == actionFlags)
            {
                _cmbApplyTo.SelectedIndex = 2;
            }
            else
            {
                _cmbApplyTo.SelectedIndex = 0;
            }

            _cmbMouseButton.SelectedIndex = (int)_viewer.GetActionButton(actionType);
        }
 private void AddActionToCurrentCells(MedicalViewerActionType action)
 {
     foreach (StudiesViewer studyViewer in ViewerContainer.State.WorkstationHostViewers.OfType <StudiesViewer> ( ))
     {
         foreach (MedicalViewer.MedicalViewer medicalViewer in studyViewer.Viewers)
         {
             foreach (MedicalViewerCell cell in medicalViewer.Cells)
             {
                 cell.AddAction(action);
             }
         }
     }
 }
        void view_RemoveSelectedAction(object sender, EventArgs e)
        {
            MedicalViewerActionType action = View.SelectedAction;


            if (__ActionsEditorState.CustomActions.Contains(action))
            {
                if (ViewerContainer.State.MedicalViewerCellActions.Contains(action))
                {
                    ViewerContainer.State.MedicalViewerCellActions.Remove(action);
                }

                ViewerContainer.State.WorkstationActionDisplayName.Remove(action);

                __ActionsEditorState.CustomActions.Remove(action);
            }

            if (__ActionsEditorState.ActionAssociatedFeature.ContainsKey(action))
            {
                ToolStripItem [] items;


                items = ViewerContainer.StripItemFeatureExecuter.GetItems(__ActionsEditorState.ActionAssociatedFeature [action]);

                foreach (ToolStripItem item in items)
                {
                    if (item is ActivatedButton && ViewerContainer.State.ActiveWorkstation.IsToolbarActivatedButtonLeftAction(item))
                    {
                        ViewerContainer.State.ActiveWorkstation.RemoveToolbarActivatedButtonLeftAction(item, action);
                    }
                    else if (item.OwnerItem is ActivatedButton)
                    {
                        ViewerContainer.State.ActiveWorkstation.RemoveToolbarActivatedButtonLeftAction(item.OwnerItem, action);
                    }

                    ViewerContainer.StripItemFeatureExecuter.RemoveItemFeature(item);

                    if (null != item.OwnerItem)
                    {
                        (( ToolStripDropDownItem )item.OwnerItem).DropDownItems.Remove(item);
                    }
                    else
                    {
                        item.Owner.Items.Remove(item);
                    }
                }
            }

            SetActionInformation(View, ViewerContainer, action);
        }
 private ToolStripItem[] GetAnnotationOrRegionsParnetItems(MedicalViewerActionType action)
 {
     if (action.ToString( ).Contains("Annotation"))
     {
         return(ToolStripMenuProperties.Instance.AnnotationstoolStripSplitButton.AssociatedItems.OfType <ToolStripDropDownItem> ( ).ToArray( ));
     }
     else if (action.ToString( ).Contains("Region"))
     {
         return(ToolStripMenuProperties.Instance.RegionstoolStripSplitButton.AssociatedItems.OfType <ToolStripDropDownItem> ( ).ToArray( ));
     }
     else
     {
         return(null);
     }
 }
        private void AddDesignerItem
        (
            MedicalViewerActionType action,
            WorkstationMenuProperties newMenuProperties,
            ToolStripDropDownItem item
        )
        {
            DesignToolStripMenuItem newActionItem;


            newActionItem = new DesignToolStripMenuItem(newMenuProperties);

            item.DropDownItems.Add(newActionItem);

            ViewerContainer.StripItemFeatureExecuter.SetItemFeature(newActionItem);
        }
示例#8
0
        private void PushAnnotationIcon(MedicalViewerActionType actionType)
        {
            UnpushAllAnnotationIcons();

            MedicalViewerActionType buttonAction;

            foreach (ToolBarButton button in _owner.ManagerHelper.ToolBar.Buttons)
            {
                buttonAction = _owner.GetAnnotationActionId((int)button.Tag);
                if (buttonAction == actionType)
                {
                    button.Pushed = true;
                    _owner.CurrentToolBarButton = button;
                    return;
                }
            }
        }
        private void AddCustomButton
        (
            MedicalViewerActionType action,
            WorkstationMenuProperties newMenuProperties,
            ToolStripDropDownItem item
        )
        {
            CustomToolStripButton newActionItem;


            newActionItem = new CustomToolStripButton(newMenuProperties);

            item.DropDownItems.Add(newActionItem);

            ViewerContainer.State.ActiveWorkstation.AddToolbarActivatedButtonLeftAction(item, action);

            ViewerContainer.StripItemFeatureExecuter.SetItemFeature(newActionItem);
        }
示例#10
0
        public NudgeToolDialog(MainForm owner, MedicalViewerActionType actionType)
        {
            InitializeComponent();
            _type = actionType;
            if (_type == MedicalViewerActionType.ShrinkTool)
            {
                Text = "Shrink Tool Dialog";
            }
            else
            {
                Text = "Nudge Tool Dialog";
            }

            MedicalViewerNudgeTool nudgeToolProperties = (MedicalViewerNudgeTool)owner.Viewer.GetActionProperties(_type);

            _txtHeight.Text = nudgeToolProperties.Height.ToString();
            _txtWidth.Text  = nudgeToolProperties.Width.ToString();
            Type            = nudgeToolProperties.Shape;
        }
        private void AddCustomMenuItem
        (
            MedicalViewerActionType action,
            WorkstationMenuProperties newMenuProperties,
            ToolStripDropDownItem item
        )
        {
            CustomToolStripMenuItem newActionItem;



            newActionItem = new CustomToolStripMenuItem(newMenuProperties);


            item.DropDownItems.Insert(0, newActionItem);

            ViewerContainer.State.ActiveWorkstation.AddToolbarSplitButtonChildItemLeftAction((CustomToolStripSplitButton)item,
                                                                                             newActionItem,
                                                                                             action);

            ViewerContainer.StripItemFeatureExecuter.SetItemFeature(newActionItem);
        }
示例#12
0
文件: DROC.cs 项目: khaha2210/radio
 /// <summary>
 /// Thiết lập Action cho chuột thực hiện một số thao tác nhanh như phóng to thu nhỏ hoặc điều chỉnh windowlevel
 /// </summary>
 /// <param name="_Mecvwr"></param>
 /// <param name="_Idx"></param>
 /// <param name="sender"></param>
 /// <param name="actionType"></param>
 /// <param name="MouseButton"></param>
 void SetAction(MedicalViewer _Mecvwr, int _Idx, object sender, MedicalViewerActionType actionType, MedicalViewerMouseButtons MouseButton)
 {
     _DicomMedicalViewer.SetAction(_DicomMedicalViewer._CurrCell, sender,actionType, MouseButton);
     
 }
示例#13
0
 public SetActionDialog(MainForm owner, MedicalViewerActionType actionType)
 {
     Initialize(owner, actionType);
 }
示例#14
0
 public SetActionDialog(MainForm owner, MedicalViewerActionType actionType, bool annotationAction)
 {
     Initialize(owner, actionType);
     _annotationAction = annotationAction;
 }
        void view_AddSelectedAction(object sender, EventArgs e)
        {
            MedicalViewerActionType action = View.SelectedAction;
            ApplyActionCommand      actionCommand;

            if (!ViewerContainer.State.MedicalViewerCellActions.Contains(action))
            {
                AddActionToCurrentCells(action);

                ViewerContainer.State.MedicalViewerCellActions.Add(action);
            }

            ViewerContainer.State.WorkstationActionDisplayName [action] = View.ActionDisplayName;

            __ActionsEditorState.CustomActions.Add(action);

            actionCommand = new ApplyActionCommand(View.FeatureId, ViewerContainer, action, View.SelectedMouseButton, ApplyActionFlags.Viewer2D);

            if (View.SelectedMouseButton == MedicalViewerMouseButtons.Left)
            {
                WorkstationMenuProperties newMenuProperties;


                newMenuProperties           = new WorkstationMenuProperties(ViewerContainer.State.WorkstationActionDisplayName [action], View.ToolStipItemImage, View.ToolStipItemAlternativeImage);
                newMenuProperties.FeatureId = View.FeatureId;

                __ActionsEditorState.ActionAssociatedFeature [action] = View.FeatureId;

                ViewerContainer.FeaturesFactory.RegisterCommand(actionCommand);

                ToolStripItem[] parentItems = GetAnnotationOrRegionsParnetItems(action);

                if (null != parentItems)
                {
                    foreach (ToolStripDropDownItem item in parentItems)
                    {
                        if (ViewerContainer.State.ActiveWorkstation.IsToolbarActivatedButtonLeftAction(item))
                        {
                            if (item is CustomToolStripSplitButton)
                            {
                                AddCustomMenuItem(action, newMenuProperties, item);
                            }
                            else
                            {
                                AddCustomButton(action, newMenuProperties, item);
                            }
                        }
                        else
                        {
                            AddDesignerItem(action, newMenuProperties, item);
                        }
                    }
                }
                else
                {
                    CustomToolStripSplitButton annotationToolbarItem = null;
                    CustomToolStripButton      newActionItem;



                    newActionItem = new CustomToolStripButton(newMenuProperties);

                    foreach (CustomToolStripSplitButton annotationItem in ToolStripMenuProperties.Instance.AnnotationstoolStripSplitButton.AssociatedItems.OfType <CustomToolStripSplitButton> ( ))
                    {
                        if (annotationItem.Owner == ViewerContainer.State.ActiveWorkstation.ViewerToolbar)
                        {
                            annotationToolbarItem = annotationItem;

                            break;
                        }
                    }

                    if (null != annotationToolbarItem)
                    {
                        ViewerContainer.State.ActiveWorkstation.ViewerToolbar.Items.Insert(ViewerContainer.State.ActiveWorkstation.ViewerToolbar.Items.IndexOf(annotationToolbarItem) - 1,
                                                                                           newActionItem);
                    }
                    else
                    {
                        ViewerContainer.State.ActiveWorkstation.ViewerToolbar.Items.Add(newActionItem);
                    }

                    ViewerContainer.State.ActiveWorkstation.AddToolbarActivatedButtonLeftAction(newActionItem, action);

                    ViewerContainer.StripItemFeatureExecuter.SetItemFeature(newActionItem);
                }
            }

            if (actionCommand.CanExecute( ))
            {
                actionCommand.Execute( );
            }

            SetActionInformation(View, ViewerContainer, View.SelectedAction);
        }