예제 #1
0
        public GenericEditorComponent(MyGUIViewHost viewHost, GenericEditorView view, bool horizontalAlignment = true)
            : base(horizontalAlignment ? "Medical.GUI.Editor.GenericEditor.GenericEditorComponent.layout" : "Medical.GUI.Editor.GenericEditor.GenericEditorVerticalComponent.layout", viewHost)
        {
            this.name             = view.Name;
            this.editorController = view.EditorController;
            this.uiCallback       = view.EditUICallback;

            tree         = new Tree((ScrollView)widget.findWidget("TreeScroller"));
            editTreeView = new EditInterfaceTreeView(tree, view.EditUICallback);

            tableScroller = (ScrollView)widget.findWidget("TableScroller");
            table         = new ResizingTable(tableScroller);

            addRemoveButtons = new AddRemoveButtons((Button)widget.findWidget("Add"), (Button)widget.findWidget("Remove"), widget.findWidget("AddRemovePanel"));
            addRemoveButtons.VisibilityChanged += addRemoveButtons_VisibilityChanged;
            propTable = new PropertiesTable(table, view.EditUICallback, addRemoveButtons);

            objectEditor = new ObjectEditor(editTreeView, propTable, view.EditUICallback);

            gap = tableScroller.Bottom - addRemoveButtons.Top;

            EditInterfaceHandler editInterfaceHandler = viewHost.Context.getModel <EditInterfaceHandler>(EditInterfaceHandler.DefaultName);

            if (editInterfaceHandler != null)
            {
                editInterfaceHandler.setEditInterfaceConsumer(this);
            }

            widget.RootKeyChangeFocus += new MyGUIEvent(widget_RootKeyChangeFocus);

            splitter = new Splitter(widget.findWidget("Splitter"));
            splitter.Widget1Resized += split => tree.layout();
            splitter.Widget2Resized += split => table.layout();
        }
예제 #2
0
 /// <summary>
 /// Fire the add property callback from the ui to the object.
 /// </summary>
 public void fireAddPropertyCallback(EditUICallback uiCallback)
 {
     if (addPropertyCallback != null)
     {
         addPropertyCallback.Invoke(uiCallback);
     }
 }
예제 #3
0
        public PropertiesFormTextBoxBrowser(EditableProperty property, Widget parent, EditUICallback uiCallback)
            : base(property, parent, "Anomalous.GuiFramework.Editor.GUI.PropertiesForm.PropertiesFormTextBoxBrowser.layout")
        {
            this.uiCallback = uiCallback;

            widget.ForwardMouseWheelToParent = true;

            TextBox textBox = (TextBox)widget.findWidget("TextBox");

            textBox.Caption = property.getValue(0);
            textBox.ForwardMouseWheelToParent = true;
            if (textBox.ClientWidget != null)
            {
                textBox.ClientWidget.ForwardMouseWheelToParent = true;
            }

            editBox          = (EditBox)widget.findWidget("EditBox");
            editBox.OnlyText = property.getValue(1);
            editBox.ForwardMouseWheelToParent = true;
            if (property.readOnly(1))
            {
                editBox.EditReadOnly = true;
            }
            else
            {
                editBox.KeyLostFocus          += new MyGUIEvent(editBox_KeyLostFocus);
                editBox.EventEditSelectAccept += new MyGUIEvent(editBox_EventEditSelectAccept);
            }

            Button browseButton = (Button)widget.findWidget("Browse");

            browseButton.ForwardMouseWheelToParent = true;
            browseButton.MouseButtonClick         += new MyGUIEvent(browseButton_MouseButtonClick);
        }
예제 #4
0
        protected override Browser buildBrowser(EditUICallback uiCallback)
        {
            Browser browser = uiCallback.runSyncCustomQuery <Browser, IEnumerable <String>, String>(CustomQueries.BuildBrowser, searchPatterns, prompt);

            browser.Hint = displayHint;
            return(browser);
        }
예제 #5
0
 /// <summary>
 /// Fire the remove property callback from the ui to the object.
 /// </summary>
 public void fireRemovePropertyCallback(EditUICallback uiCallback, EditableProperty property)
 {
     if (removePropertyCallback != null)
     {
         removePropertyCallback.Invoke(uiCallback, property);
     }
 }
예제 #6
0
 private void removeBinding(EditUICallback callback, EditableProperty property)
 {
     bindings.Remove((SimSubSceneBinding)property);
     if (editInterface != null)
     {
         editInterface.removeEditableProperty(property);
     }
 }
 public Browser getBrowser(int column, EditUICallback uiCallback)
 {
     if (column == VALUE_COL)
     {
         return(variable.ItemBrowser);
     }
     return(null);
 }
 public Browser getBrowser(int column, EditUICallback uiCallback)
 {
     if (getBrowserFunc != null)
     {
         return(getBrowserFunc(uiCallback));
     }
     return(null);
 }
예제 #9
0
 public void captureEndState(EditUICallback callback)
 {
     captureSceneStateTo(callback,
                         () => layersCommand.EndLayers.captureState(),
                         () => muscleCommand.EndPosition.captureState(),
                         camPos => cameraCommand.CameraEndPosition = camPos,
                         state => medicalStateCommand.captureEndFromMedicalState(state));
 }
예제 #10
0
 public EditInterfaceTreeView(Tree tree, EditUICallback editUICallback)
 {
     this.tree                  = tree;
     this.editUICallback        = editUICallback;
     tree.AfterSelect          += new EventHandler <TreeEventArgs>(tree_AfterSelect);
     tree.BeforeSelect         += new EventHandler <TreeCancelEventArgs>(tree_BeforeSelect);
     tree.NodeMouseReleased    += new EventHandler <TreeMouseEventArgs>(tree_NodeMouseReleased);
     tree.NodeMouseDoubleClick += new EventHandler <TreeEventArgs>(tree_NodeMouseDoubleClick);
 }
예제 #11
0
        private void addBinding(EditUICallback callback)
        {
            SimSubSceneBinding binding = new SimSubSceneBinding(this);

            bindings.AddLast(binding);
            if (editInterface != null)
            {
                editInterface.addEditableProperty(binding);
            }
        }
예제 #12
0
        private void destroySimObjectCallback(EditUICallback callback)
        {
            EditInterface selected = callback.getSelectedEditInterface();

            if (selected.hasEditableProperties())
            {
                InstanceFileInterface instanceFile = this.editInterface.resolveSourceObject <InstanceFileInterface>(selected);
                removeInstanceFile(instanceFile.Name);
            }
        }
예제 #13
0
 /// <summary>
 /// Callback to add a LightDefinition.
 /// </summary>
 /// <param name="callback"></param>
 /// <param name="command"></param>
 private void addLight(EditUICallback callback)
 {
     callback.getInputString("Enter a name.", delegate(String input, ref String errorPrompt)
     {
         if (validateMovableName(input, ref errorPrompt))
         {
             addMovableObjectDefinition(new LightDefinition(input));
             return(true);
         }
         return(false);
     });
 }
예제 #14
0
        private void hideAllCallback(EditUICallback callback)
        {
            foreach (InstanceFileInterface instance in instanceFiles.Values)
            {
                instance.setVisible(false);
            }

            foreach (InstanceGroup group in groups.Values)
            {
                group.hideAllCallback(callback);
            }
        }
예제 #15
0
        public Browser getBrowser(int column, EditUICallback uiCallback)
        {
            switch (column)
            {
            case 0:
                return(null);

            case 1:
                return(browserBuildCallback(uiCallback));
            }
            return(null);
        }
예제 #16
0
 public PropertiesTable(Table propertiesTable, EditUICallback uiCallback, AddRemoveButtons buttons)
 {
     this.uiCallback                   = uiCallback;
     this.propertiesTable              = propertiesTable;
     propertiesTable.CellValidating   += new EventHandler <TableCellValidationEventArgs>(propertiesTable_CellValidating);
     propertiesTable.CellValueChanged += new EventHandler(propertiesTable_CellValueChanged);
     addRemoveButtons                  = buttons;
     if (addRemoveButtons != null)
     {
         addRemoveButtons.AddButtonClicked    += addRemoveButtons_AddButtonClicked;
         addRemoveButtons.RemoveButtonClicked += addRemoveButtons_RemoveButtonClicked;
     }
 }
예제 #17
0
        public Browser getBrowser(int column, EditUICallback uiCallback)
        {
            switch (column)
            {
            case 0:
                return(null);

            case 1:
                return(buildBrowser(uiCallback));

            default:
                return(null);
            }
        }
예제 #18
0
                public Browser getBrowser(int column, EditUICallback uiCallback)
                {
                    switch (dataElementEditor.DataType)
                    {
                    case DataDisplayType.volume:
                        return(VolumeController.Browser);

                    case DataDisplayType.measurement:
                        return(MeasurementController.Browser);

                    default:
                        throw new NotImplementedException();
                    }
                }
        private void remove(EditUICallback callback, EditableProperty property)
        {
            var listProp = property as ReflectedListItemEditableProperty <T>;
            int index    = properties.IndexOf(listProp);

            //Remove the item from the real list
            var item = list[index];

            removed(item);
            list.RemoveAt(index);

            //Remove the property from the edit interface and local listing.
            removeEditableProperty(listProp);
            properties.Remove(listProp);
        }
        private void addAction(EditUICallback callback)
        {
            var browser = callback.runSyncCustomQuery <Browser>(CustomQueries.BuildActionBrowser);

            if (browser != null)
            {
                callback.showBrowser(browser, delegate(Object result, ref String errorMessage)
                {
                    Type createType = (Type)result;
                    TimelineInstantAction action = (TimelineInstantAction)Activator.CreateInstance(createType);
                    timeline.addPreAction(action);
                    return(true);
                });
            }
        }
예제 #21
0
 /// <summary>
 /// Static create function.
 /// </summary>
 /// <param name="name">The name of the Definition to create.</param>
 /// <param name="callback">A UICallback.</param>
 /// <returns></returns>
 internal static void Create(String name, EditUICallback callback, CompositeSimObjectDefinition simObjectDef)
 {
     if (behaviorBrowser == null)
     {
         behaviorBrowser = new TypeBrowser("Behaviors", "Choose Behavior", typeof(Behavior));
     }
     callback.showBrowser <Type>(behaviorBrowser, delegate(Type behaviorType, ref String errorMessage)
     {
         if (behaviorType != null)
         {
             simObjectDef.addElement(new BehaviorDefinition(name, (Behavior)Activator.CreateInstance(behaviorType)));
             return(true);
         }
         return(false);
     });
 }
예제 #22
0
        /// <summary>
        /// Callback to create a resource group.
        /// </summary>
        /// <param name="callback"></param>
        /// <param name="caller"></param>
        private void addResourceGroup(EditUICallback callback)
        {
            callback.getInputString("Enter a name for the group.", delegate(String input, ref String errorPrompt)
            {
                if (input == null || input == "")
                {
                    errorPrompt = "Please enter a non empty name.";
                    return(false);
                }
                if (resourceGroups.ContainsKey(input))
                {
                    errorPrompt = "That name is already in use. Please provide another.";
                    return(false);
                }

                this.addResourceGroup(input);
                return(true);
            });
        }
예제 #23
0
 private void importPositionsCallback(EditUICallback callback)
 {
     callback.showOpenFileDialog("*.positions|*.positions", delegate(String file, ref String errorPrompt)
     {
         try
         {
             using (var stream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
             {
                 PositionCollection positions = new PositionCollection(stream);
                 this.updatePositions(positions);
             }
         }
         catch (Exception e)
         {
             Log.Error("Could not load positions file {0} because:\n{1}", file, e.Message);
         }
         return(true);
     });
 }
예제 #24
0
        /// <summary>
        /// Callback to add a child node.
        /// </summary>
        /// <param name="callback"></param>
        /// <param name="command"></param>
        private void addChildNode(EditUICallback callback)
        {
            callback.getInputString("Enter a name.", delegate(String input, ref String errorPrompt)
            {
                if (input == null || input == "")
                {
                    errorPrompt = "Please enter a non empty name.";
                    return(false);
                }
                SceneNodeDefinition topLevel = findTopLevelNode();
                if (input == topLevel.Name || topLevel.isNodeNameTaken(input))
                {
                    errorPrompt = "That name is already in use. Please provide another.";
                    return(false);
                }

                addChildNode(new SceneNodeDefinition(input));
                return(true);
            });
        }
예제 #25
0
        /// <summary>
        /// Callback to create a SimSubSceneDefinition.
        /// </summary>
        /// <param name="callback">The EditUICallback to get more info from the user.</param>
        /// <param name="caller">The command that initiated this funciton call.</param>
        private void createSimSubSceneDefinition(EditUICallback callback)
        {
            callback.getInputString("Enter a name.", delegate(String input, ref String errorPrompt)
            {
                if (input == null || input == "")
                {
                    errorPrompt = "Please enter a non empty name.";
                    return(false);
                }
                if (this.hasSimSubSceneDefinition(input))
                {
                    errorPrompt = "That name is already in use. Please provide another.";
                    return(false);
                }

                SimSubSceneDefinition def = new SimSubSceneDefinition(input);
                this.addSimSubSceneDefinition(def);
                return(true);
            });
        }
예제 #26
0
        private void addTrack(EditUICallback callback)
        {
            callback.getInputString("Enter a name for the track.", delegate(String trackName, ref String trackErrorPrompt)
            {
                if (String.IsNullOrEmpty(trackName))
                {
                    trackErrorPrompt = "You must enter a name for the track.";
                    return(false);
                }

                TypeBrowser browser = new TypeBrowser("Track Types", "Choose a track type", typeof(ShowPropSubAction));
                callback.showBrowser(browser, delegate(Type resultType, ref String typeBrowseErrorPrompt)
                {
                    addTrack(new ShowPropSubActionPrototype(resultType, trackName));
                    return(true);
                });

                return(true);
            });
        }
예제 #27
0
        private void createGroupCallback(EditUICallback callback)
        {
            callback.getInputString("Enter a name.", delegate(String input, ref String errorPrompt)
            {
                if (input == null || input == "")
                {
                    errorPrompt = "Please enter a non empty name.";
                    return(false);
                }
                if (this.groups.ContainsKey(input))
                {
                    errorPrompt = "That name is already in use. Please provide another.";
                    return(false);
                }

                InstanceGroup group = new InstanceGroup(input, Path.Combine(path, input));
                this.addGroup(group);
                return(true);
            });
        }
예제 #28
0
        private void remove(EditUICallback callback, EditableProperty property)
        {
            var listProp = property as ListItemEditableProperty <T>;
            int index    = listProp.Index;

            //Remove the item from the real list
            var item = list[index];

            removed(item);
            list.RemoveAt(index);

            //Reindex the remaining properties
            foreach (var reindex in properties.Skip(index))
            {
                reindex.Index--;
            }

            //Remove the property from the edit interface and local listing.
            removeEditableProperty(listProp);
            properties.Remove(listProp);
        }
예제 #29
0
        private void createSimObjectCallback(EditUICallback callback)
        {
            callback.getInputString("Enter a name.", delegate(String input, ref String errorPrompt)
            {
                if (input == null || input == "")
                {
                    errorPrompt = "Please enter a non empty name.";
                    return(false);
                }
                InstanceGroup groupWithInstance = findInstanceGroup(input);
                if (groupWithInstance != null)
                {
                    errorPrompt = String.Format("The name {0} is already in use in group {1}. Please provide another.", input, groupWithInstance.Name);
                    return(false);
                }

                SimObjectDefinition simObject = new GenericSimObjectDefinition(input);
                createInstance(simObject);
                return(true);
            });
        }
예제 #30
0
        public void captureSceneState(EditUICallback callback)
        {
            action.clear();
            if (Layers)
            {
                ChangeLayersCommand changeLayers = new ChangeLayersCommand();
                changeLayers.Layers.captureState();
                action.addCommand(changeLayers);
            }

            if (MusclePosition)
            {
                SetMusclePositionCommand musclePosition = new SetMusclePositionCommand();
                musclePosition.MusclePosition.captureState();
                action.addCommand(musclePosition);
            }

            if (Camera)
            {
                MoveCameraCommand moveCamera = new MoveCameraCommand();
                callback.runOneWayCustomQuery(CameraPosition.CustomEditQueries.CaptureCameraPosition, moveCamera.CameraPosition);
                action.addCommand(moveCamera);
            }

            if (MedicalState)
            {
                ChangeMedicalStateCommand medicalState = new ChangeMedicalStateCommand();
                MedicalState medState = new MedicalState("");
                medState.update();
                medicalState.captureFromMedicalState(medState);
                action.addCommand(medicalState);
            }

            if (HighlightTeeth)
            {
                action.addCommand(new ChangeTeethHighlightsCommand(TeethController.HighlightContacts));
            }
        }