Ejemplo n.º 1
0
        public AnatomyContextWindowManager(SceneViewController sceneViewController, AnatomyController anatomyController, LayerController layerController, AnatomyFinder anatomyFinder, AnatomyTaskManager anatomyTaskManager)
        {
            this.sceneViewController = sceneViewController;
            this.anatomyController   = anatomyController;
            this.anatomyController.SelectedAnatomy.SelectedAnatomyChanged += anatomyController_SelectedAnatomyChanged;
            this.anatomyFinder      = anatomyFinder;
            this.layerController    = layerController;
            this.anatomyTaskManager = anatomyTaskManager;

            liveThumbnailController             = new LiveThumbnailController("ContextWindows_", new IntSize2(ThumbRenderSize, ThumbRenderSize), sceneViewController);
            liveThumbnailController.MaxPoolSize = 1;
        }
Ejemplo n.º 2
0
        public AnatomyFinder(AnatomyController anatomyController, SceneViewController sceneViewController, LayerController layerController, AnatomyTaskManager anatomyTaskManager)
            : base("Medical.GUI.Anatomy.AnatomyFinder.layout")
        {
            this.anatomyController                       = anatomyController;
            anatomyController.AnatomyChanged            += anatomyController_AnatomyChanged;
            anatomyController.ShowPremiumAnatomyChanged += anatomyController_ShowPremiumAnatomyChanged;
            anatomyController.ClearDisplayedAnatomy     += anatomyController_ClearDisplayedAnatomy;
            if (PlatformConfig.UnrestrictedEnvironment)
            {
                anatomyController.DisplayAnatomy += anatomyController_DisplayAnatomy;
            }
            else
            {
                anatomyController.DisplayAnatomy += anatomyController_DisplayAnatomy_Restricted;
            }
            anatomyController.SelectedAnatomy.SelectedAnatomyChanged += anatomyController_SelectedAnatomyChanged;
            anatomyController.SearchStarted        += anatomyController_SearchStarted;
            anatomyController.SearchEnded          += anatomyController_SearchEnded;
            anatomyController.SuggestSearchCaption += anatomyController_SuggestSearchCaption;

            this.sceneViewController = sceneViewController;

            this.layerController               = layerController;
            this.layerController               = layerController;
            layerController.OnRedo            += updateUndoRedo;
            layerController.OnUndo            += updateUndoRedo;
            layerController.OnUndoRedoChanged += updateUndoRedo;
            layerController.OnActiveTransparencyStateChanged += updateUndoRedo;

            anatomyWindowManager = new AnatomyContextWindowManager(sceneViewController, anatomyController, layerController, this, anatomyTaskManager);
            anatomyFilter        = new AnatomyFilter(anatomyController);
            anatomyFilter.refreshCategories();
            anatomyFilter.FilterChanged          += anatomyFilter_FilterChanged;
            anatomyFilter.TopLevelAnatomyChanged += anatomyFilter_TopLevelAnatomyChanged;

            Button filter = window.findWidget("Filter") as Button;

            filter.MouseButtonClick += filter_MouseButtonClick;

            ScrollView anatomyScroll = (ScrollView)window.findWidget("AnatomyList");

            anatomyList = new HashSetMultiSelectButtonGrid(anatomyScroll, new ButtonGridListLayout(), naturalSort);
            anatomyList.ItemActivated += anatomyList_ItemActivated;
            anatomyList.ItemAdded     += anatomyList_ItemAdded;
            anatomyList.ItemRemoved   += anatomyList_ItemRemoved;
            anatomyList.ItemChosen    += anatomyList_ItemChosen;

            buttonGridThumbs = new ButtonGridLiveThumbnailController <Anatomy>("AnatomyFinder_", new IntSize2(ThumbRenderSize, ThumbRenderSize), sceneViewController, anatomyList, anatomyScroll);

            searchBox = (EditBox)window.findWidget("SearchBox");
            searchBox.EventEditTextChange += new MyGUIEvent(searchBox_EventEditTextChange);
            clearButton = (Button)searchBox.findWidgetChildSkin("Clear");
            clearButton.MouseButtonClick += new MyGUIEvent(clearButton_MouseButtonClick);
            clearButton.NeedToolTip       = true;
            clearButton.EventToolTip     += button_UserObject_EventToolTip;
            clearButton.UserObject        = "Clear Search";

            Button unhideAll = window.findWidget("UnhideAll") as Button;

            unhideAll.MouseButtonClick += (s, e) =>
            {
                LayerState undo = LayerState.CreateAndCapture();
                this.layerController.unhideAll();
                this.layerController.pushUndoState(undo);
            };

            undoButton = window.findWidget("Undo") as Button;
            undoButton.MouseButtonClick += (s, e) => layerController.undo();

            redoButton = window.findWidget("Redo") as Button;
            redoButton.MouseButtonClick += (s, e) => layerController.redo();

            PickAnatomy.FirstFrameDownEvent     += PickAnatomy_FirstFrameDownEvent;
            PickAnatomy.OnHeldDown              += PickAnatomy_OnHeldDown;
            PickAnatomy.FirstFrameUpEvent       += pickAnatomy_FirstFrameUpEvent;
            OpenAnatomyFinder.FirstFrameUpEvent += openAnatomyFinder_FirstFrameUpEvent;

            if (!PlatformConfig.UnrestrictedEnvironment && !anatomyController.ShowPremiumAnatomy)
            {
                filter.Visible  = false;
                searchBox.Width = filter.Right - searchBox.Left;
            }

            this.Resized += new EventHandler(AnatomyFinder_Resized);
            fixListItemWidth();

            updateSearch();
        }