Example #1
0
        protected override void ioParameterStatusChanged(bool input, int index, NodeParameterStatusChange status)
        {
            switch (index)
            {
                case (int)Params.throttle:
                    if (image != null)
                    {
                        if (status == NodeParameterStatusChange.ParameterArkAdded ||
                            status == NodeParameterStatusChange.ParameterArkRemoved)
                        {
                            bool st = isInputDefaulting(imageParams[Params.throttle].paramIndex);
                            image.sensitizeThrottleDialog(st);
                        }
                        else if (status == NodeParameterStatusChange.ParameterValueChanged ||
                            status == NodeParameterStatusChange.PatemeterSetValueChanged)
                        {
                            double t;

                            getThrottle(out t);
                            image.updateThrottleDialog(t);
                        }
                    }
                    break;

                case (int)Params.recenable:
                case (int)Params.recfile:
                case (int)Params.recformat:
                case (int)Params.recresolution:
                case (int)Params.recaspect:
                    if (image != null)
                    {
                        // This used to say isRecFileInputSet() instead of TRUE
                        // but it always worked because isRecFileInputSet always returns
                        // the wrong value.  Nowdays, we only want to revisit the sensitivity
                        // of the dialogs, not the sensitivity of the command anyway.
                        image.sensitizePrintImageDialog(true);
                        image.sensitizeSaveImageDialog(true);
                    }
                    break;

                case (int)Params.backgroundColor:
                    if (image != null)
                    {
                        if ((long)(status & NodeParameterStatusChange.ParameterArkAdded) > 0 ||
                            (long)(status & NodeParameterStatusChange.ParameterArkRemoved) > 0)
                        {
                            image.sensitizeBackgroundColorDialog(!IsBGColorConnected);
                        }
                        else if ((long)(status & NodeParameterStatusChange.ParameterValueChanged) > 0 ||
                            (long)(status & NodeParameterStatusChange.PatemeterSetValueChanged) > 0)
                        {
                            String color;
                            getBackgroundColor(out color);
                            image.updateBGColorDialog(color);
                        }
                    }
                    break;

                case (int)Params.aaenabled:
                    if (image != null)
                        image.setAutoAxesDialogEnable();
                    break;

                case (int)Params.aalabel:
                    if (image != null)
                        image.setAutoAxesDialogLabels();
                    break;

                case (int)Params.aatick:
                    if (image != null)
                        image.setAutoAxesDialogTicks();
                    break;

                case (int)Params.aaxticklocs:
                    if (image != null)
                        image.setAutoAxesDialogXTickLocs();
                    break;

                case (int)Params.aayticklocs:
                    if (image != null)
                        image.setAutoAxesDialogYTickLocs();
                    break;

                case (int)Params.aazticklocs:
                    if (image != null)
                        image.setAutoAxesDialogZTickLocs();
                    break;

                case (int)Params.aaxticklabels:
                    if (image != null)
                        image.setAutoAxesDialogXTickLabels();
                    break;

                case (int)Params.aayticklabels:
                    if (image != null)
                        image.setAutoAxesDialogYTickLabels();
                    break;

                case (int)Params.aazticklabels:
                    if (image != null)
                        image.setAutoAxesDialogZTickLabels();
                    break;

                case (int)Params.aacorners:
                    if (image != null)
                        image.setAutoAxesDialogCorners();
                    break;

                case (int)Params.aaframe:
                    if (image != null)
                        image.setAutoAxesDialogFrame();
                    break;

                case (int)Params.aaadjust:
                    if (image != null)
                        image.setAutoAxesDialogAdjust();
                    break;

                case (int)Params.aacursor:
                    if (image != null)
                        image.setAutoAxesDialogCursor();
                    break;

                case (int)Params.aagrid:
                    if (image != null)
                        image.setAutoAxesDialogGrid();
                    break;

                case (int)Params.aacolor:
                    if (image != null)
                        image.setAutoAxesDialogAnnotationColors();
                    break;

                case (int)Params.aaannotation:
                    if (image != null)
                        image.setAutoAxesDialogAnnotationColors();
                    break;

                case (int)Params.aalabelscale:
                    if (image != null)
                        image.setAutoAxesDialogLabelScale();
                    break;

                case (int)Params.aafont:
                    if(image != null)
                        image.setAutoAxesDialogFont();
                    break;

                case (int)Params.interactionmode:
                    if (image != null)
                    {
                        bool stat = IsInteractionModeConnected;
                        image.sensitizeViewControl(!stat);
                    }
                    break;

                case (int)Params.imageName:
                    if (image != null)
                    {
                        bool stat = isInputConnected(imageParams[Params.imageName].paramIndex);
                        if ((!stat) && (isInputDefaulting(imageParams[Params.imageName].paramIndex)))
                            setTitle(null);
                        else
                            setTitle(getInputValueString(imageParams[Params.imageName].paramIndex));
                        image.sensitizeChangeImageName(!stat);
                    }
                    break;

                case (int)Params.render_mode:
                    if (image != null)
                    {
                        if (status == NodeParameterStatusChange.ParameterArkAdded)
                            image.sensitizeRenderMode(false);
                        else if (status == NodeParameterStatusChange.ParameterArkRemoved)
                            image.sensitizeRenderMode(true);
                        else if ((long)(status & (NodeParameterStatusChange.ParameterValueChanged |
                       NodeParameterStatusChange.PatemeterSetValueChanged)) > 0)
                            image.updateRenderingOptionsDialog();
                    }
                    break;

                case (int)Params.button_up_approx:
                    if (image != null)
                    {
                        if (status == NodeParameterStatusChange.ParameterArkAdded)
                            image.sensitizeButtonUpApprox(false);
                        else if (status == NodeParameterStatusChange.ParameterArkRemoved)
                            image.sensitizeButtonUpApprox(true);
                        else if ((long)(status & (NodeParameterStatusChange.ParameterValueChanged |
                            NodeParameterStatusChange.PatemeterSetValueChanged)) > 0)
                            image.updateRenderingOptionsDialog();
                    }
                    break;

                case (int)Params.button_down_approx:
                    if (image != null)
                    {
                        if (status == NodeParameterStatusChange.ParameterArkAdded)
                            image.sensitizeButtonDownApprox(false);
                        else if (status == NodeParameterStatusChange.ParameterArkRemoved)
                            image.sensitizeButtonDownApprox(true);
                        else if ((long)(status & (NodeParameterStatusChange.ParameterValueChanged |
                            NodeParameterStatusChange.PatemeterSetValueChanged)) > 0)
                            image.updateRenderingOptionsDialog();
                    }
                    break;

                case (int)Params.button_up_density:
                    if (image != null)
                    {
                        if (status == NodeParameterStatusChange.ParameterArkAdded)
                            image.sensitizeButtonUpDensity(false);
                        else if (status == NodeParameterStatusChange.ParameterArkRemoved)
                            image.sensitizeButtonUpDensity(true);
                        else if ((long)(status & (NodeParameterStatusChange.ParameterValueChanged |
                            NodeParameterStatusChange.PatemeterSetValueChanged)) > 0)
                            image.updateRenderingOptionsDialog();
                    }
                    break;

                case (int)Params.button_down_density:
                    if (image != null)
                    {
                        if (status == NodeParameterStatusChange.ParameterArkAdded)
                            image.sensitizeButtonDownDensity(false);
                        else if (status == NodeParameterStatusChange.ParameterArkRemoved)
                            image.sensitizeButtonDownDensity(true);
                        else if ((long)(status & (NodeParameterStatusChange.ParameterValueChanged |
                            NodeParameterStatusChange.PatemeterSetValueChanged)) > 0)
                            image.updateRenderingOptionsDialog();
                    }
                    break;
                default:
                    break;
            }
            base.ioParameterStatusChanged(input, index, status);
        }
        /// <summary>
        /// Notify anybody that needs to know that a parameter has changed its arcs.
        /// At this class level, we just check changes in output arcs that may
        /// change the label associated with the Interactor.  If it may have 
        /// changed the label, then we notify all instances with 
        /// notifyVisualsOfStateChange().
        /// </summary>
        /// <param name="input"></param>
        /// <param name="index"></param>
        /// <param name="status"></param>
        /// 
        protected override void ioParameterStatusChanged(bool input, int index, 
            NodeParameterStatusChange status)
        {
            bool doit = false;

            deferVisualNotification();
            if ((int)(status & NodeParameterStatusChange.ParameterArkChanged) > 0)
            {
                if (input)
                {
                    if (index == getLabelParameterIndex())
                        doit = true;

                    // If we become un data driven, then we must make sure the
                    // outputs get sent on the next execution.

                    if (!IsDataDriven)
                    {
                        for (int i = 1; i <= OutputCount; i++)
                            setOutputDirty(i);
                        // Don't need to send them because the network will get marked
                        // dirty as a result of an arc change.
                    }
                }
                else
                {
                    int narcs = 0;
                    // Count the number of output arcs.
                    for (int i = 1; i <= OutputCount; i++)
                    {
                        List<Ark> arcs = getOutputArks(i);
                        narcs += arcs.Count;
                    }
                    // If the number of arcs has changed in such a way that the label
                    // may have to change then notify the instances to reset their
                    // labels.
                    // Labels can change if we ADD an arc and change from having...
                    //	a) 0 to having 1 arc
                    //	b) 1 to having 2 arcs
                    // or we REMOVE an arc and we change from having...
                    //   	a) 1 to having 0 arcs
                    //	b) 2 to having 1 arc

                    bool added = (status == NodeParameterStatusChange.ParameterArkAdded);
                    if ((narcs <= 1) || (added && narcs == 2))
                        doit = true;
                }
                if (doit)
                    notifyVisualsOfStateChange();
            }
            base.ioParameterStatusChanged(input, index, status);
            undeferVisualNotification();
        }
        /// <summary>
        /// A node that has its first parameter set or its last parameter unset
        /// must mark the network dirty so that is resent with/without the module
        /// in the network.  
        /// </summary>
        /// <param name="input"></param>
        /// <param name="index"></param>
        /// <param name="status"></param>
        protected override void ioParameterStatusChanged(bool input, int index, 
            NodeParameterStatusChange status)
        {
            if (input && isInputViewable(index))
            {
                int icnt = InputCount;
                int connections, settabs, i;
                bool became_non_dd = false;

                if ((status & NodeParameterStatusChange.ParameterValueChanged) > 0 &&
                    (status != NodeParameterStatusChange.PatemeterSetValueChanged))
                {
                    for (connections = 0, settabs = 0, i = 1; connections == 0 && settabs < 2 && i <= icnt;
                        i++)
                    {
                        if (isInputViewable(i))
                        {
                            if (isInputConnected(i))
                                connections++;
                            else if (!isInputDefaulting(i))
                                settabs++;
                        }
                    }
                    if (connections != 0 && (settabs < 2))
                    {
                        // Either a parameter was just given a set value or just
                        // set to the default value.  If just set to the default value
                        // and the number of set tabs is now 0 then the user just made
                        // the last tab up so mark the network dirty.  If just given a
                        // set value and it is the only (first) parameter with a set
                        // value then mark the network dirty.
                        if (settabs == 0 &&
                            status == NodeParameterStatusChange.ParameterSetValueToDefaulting)
                        {
                            //Tool went from data-driven to non-data-driven.
                            became_non_dd = true;
                        }
                        else if (settabs == 1 && !isInputDefaulting(index))
                        {
                            // Tool went from non-data-driven to data-driven
                            getNetwork().setDirty();
                        }
                    }
                }
                if (became_non_dd)
                {
                    getNetwork().setDirty();
                }
            }
            base.ioParameterStatusChanged(input, index, status);
        }
 /// <summary>
 /// If either of the list inputs has changed, we must determine the size
 /// of the smaller of the two lists and reset this->optionCount to that 
 /// value.  
 /// NOTE: If this routine is being called, then one of the values must 
 ///    have a set value (even though both are allowed not too). 
 /// </summary>
 /// <param name="input"></param>
 /// <param name="index"></param>
 /// <param name="status"></param>
 protected override void ioParameterStatusChanged(bool input, int index, NodeParameterStatusChange status)
 {
     throw new Exception("Not Yet Implemented");
     base.ioParameterStatusChanged(input, index, status);
 }
Example #5
0
 /// <summary>
 /// notifyIo is the same as io sort of.  notifyIo adds a check to see
 /// if the network is in the process of going away.  That avoids useless work.
 /// </summary>
 /// <param name="input"></param>
 /// <param name="index"></param>
 /// <param name="status"></param>
 protected void notifyIoParameterStatusChanged(bool input, int index,
     NodeParameterStatusChange status)
 {
     if (!network.IsDeleted)
         ioParameterStatusChanged(input, index, status);
 }
Example #6
0
        /// <summary>
        /// Notify anybody that needs to know that a parameter has changed its
        /// value or arcs.
        /// </summary>
        /// <param name="input"></param>
        /// <param name="index"></param>
        /// <param name="status"></param>
        protected virtual void ioParameterStatusChanged(bool input, int index,
            NodeParameterStatusChange status)
        {
            // If we have Configuration Dialog, let it know the value, arc or
            // visibility was changed.
            if (cdb != null)
            {
                if (input)
                    cdb.changeInput(index);
                else
                    cdb.changeOutput(index);
            }

            // Now notify all nodes receiving this output that the value has changed.
            if (!input && ((long)(status & NodeParameterStatusChange.ParameterValueChanged) > 0))
            {
                foreach (Ark a in getOutputArks(index))
                {
                    int in_index = 0;
                    Node n = a.getDestinationNode(out in_index);
                    n.notifyIoParameterStatusChanged(true, in_index, status);
                }
            }

            // Let the standin know about this. We don't notify StandIns about
            // arc changes since they are the ones that generate them.
            if (standin != null && ((long)(status & NodeParameterStatusChange.ParameterArkChanged) == 0))
                standin.ioStatusChange(index, !input, status);

            // Tell the network that it has changed.

            // If this is an input and the tool is in a macro, then we must always
            // resend the macro defnition because input values are contained within
            // the macro definition.  Otherwise we only need to mark the network
            // dirty if an arc has changed.
            if (input && network.IsMacro)
                network.setDirty();
            else
            {
                if ((long)(status & NodeParameterStatusChange.ParameterArkChanged) > 0)
                    network.setDirty();
                else
                    network.setFileDirty();
            }
        }