Пример #1
0
        virtual public bool OnUpdateCommand(string MenuId, CommandState CommandState)
        {
            switch (MenuId)
            {
            case "MenuId.Reverse":
                CommandState.Enabled = (circle.IsArc);
                return(true);

            case "MenuId.CurveSplit":
                return(true);

            case "MenuId.Approximate":
                CommandState.Enabled = (Frame.ActiveAction is SelectObjectsAction) && (Frame.GetIntSetting("Approximate.Mode", 0) == 0);
                return(true);
            }
            return(false);
        }
Пример #2
0
        virtual public bool OnUpdateCommand(string MenuId, CommandState CommandState)
        {
            switch (MenuId)
            {
            case "MenuId.Reverse":
                CommandState.Enabled = (ellipse.IsArc);
                return(true);

            case "MenuId.CurveSplit":
                return(true);

            case "MenuId.Ellipse.ToLines":
                CommandState.Enabled = (Frame.ActiveAction is SelectObjectsAction);
                return(true);
            }
            return(false);
        }
Пример #3
0
        virtual public bool OnUpdateCommand(string MenuId, CommandState CommandState)
        {
            switch (MenuId)
            {
            case "MenuId.Reverse":
                return(true);

            //				case "MenuId.Polyline.ToPath":
            case "MenuId.Explode":
                CommandState.Enabled = (Frame.ActiveAction is SelectObjectsAction);
                return(true);

            case "MenuId.Path.Vertex.StartWithMe":     // kommt nicht dran
                CommandState.Enabled = polyline.IsClosed;
                return(true);
            }
            return(false);
        }
Пример #4
0
 bool ICommandHandler.OnUpdateCommand(string MenuId, CommandState CommandState)
 {
     if (FilterCommandEvent != null)
     {
         bool handled = false;
         FilterCommandEvent(this, MenuId, CommandState, ref handled);
         if (handled)
         {
             return(true);
         }
     }
     switch (MenuId)
     {
     case "MenuId.Vector.ModifyWithMouse":
         CommandState.Enabled = (ModifyWithMouse != null);
         return(true);
     }
     return(false);
 }
Пример #5
0
        bool ICommandHandler.OnUpdateCommand(string MenuId, CommandState CommandState)
        {
            if (FilterCommandEvent != null)
            {
                bool handled = false;
                FilterCommandEvent(this, MenuId, CommandState, ref handled);
                if (handled)
                {
                    return(true);
                }
            }
            // maybe this property is a subproperty (e.g. Multipoint) then use the parent commandhandler first
            ICommandHandler ch = propertyPage.GetParent(this) as ICommandHandler;

            if (ch != null)
            {
                if (ch.OnUpdateCommand(MenuId, CommandState))
                {
                    return(true);
                }
            }
            switch (MenuId)
            {
            case "MenuId.Point.ModifyWithMouse":
                //CommandState.Checked = isModifyingWithMouse;
                CommandState.Enabled = (!ReadOnly) && ((ModifyWithMouse != null) || autoModifyWithMouse);
                return(true);

            case "MenuId.Point.IntermediatePoint":
            case "MenuId.Point.ObjectPoint":
            case "MenuId.Point.IntersectionTwoCurves":
            case "MenuId.Point.OffsetByVector":
            case "MenuId.Point.Polar":
                CommandState.Enabled = !ReadOnly;
                return(true);

            case "MenuId.Point.NameVariable":
                return(true);
            }
            return(false);
        }
Пример #6
0
        bool ICommandHandler.OnUpdateCommand(string MenuId, CommandState CommandState)
        {
            switch (MenuId)
            {
            case "MenuId.Length.ModifyWithMouse":
                CommandState.Enabled = !ReadOnly;
                //CommandState.Checked = isModifyingWithMouse;
                return(true);

            case "MenuId.Length.DistanceOfCurve":
            case "MenuId.Length.DistanceTwoPoints":
            case "MenuId.Length.DistancePointCurve":
            case "MenuId.Length.DistanceTwoCurves":
            case "MenuId.Length.DoubleValue":
            case "MenuId.Length.HalfValue":
                CommandState.Enabled = !ReadOnly;
                return(true);

            case "MenuId.Length.NameVariable":
                return(false);
            }
            return(false);
        }
        bool ICommandHandler.OnUpdateCommand(string MenuId, CommandState CommandState)
        {
            PointSymbol pointSymbol = GetPointSymbol();

            switch (MenuId)
            {
            case "MenuId.PointSymbol.Empty":
                CommandState.Checked = ((int)pointSymbol & 0x07) == (int)PointSymbol.Empty;
                return(true);

            case "MenuId.PointSymbol.Dot":
                CommandState.Checked = ((int)pointSymbol & 0x07) == (int)PointSymbol.Dot;
                return(true);

            case "MenuId.PointSymbol.Plus":
                CommandState.Checked = ((int)pointSymbol & 0x07) == (int)PointSymbol.Plus;
                return(true);

            case "MenuId.PointSymbol.Cross":
                CommandState.Checked = ((int)pointSymbol & 0x07) == (int)PointSymbol.Cross;
                return(true);

            case "MenuId.PointSymbol.Line":
                CommandState.Checked = ((int)pointSymbol & 0x07) == (int)PointSymbol.Line;
                return(true);

            case "MenuId.PointSymbol.Square":
                CommandState.Checked = ((int)pointSymbol & (int)PointSymbol.Square) != 0;
                return(true);

            case "MenuId.PointSymbol.Circle":
                CommandState.Checked = ((int)pointSymbol & (int)PointSymbol.Circle) != 0;
                return(true);
            }
            return(false);
        }
Пример #8
0
 bool ICommandHandler.OnUpdateCommand(string MenuId, CommandState CommandState)
 {
     return(false);
 }
Пример #9
0
 virtual public bool OnUpdateCommand(string MenuId, CommandState CommandState)
 {
     return(((ICommandHandler)lengthProperty).OnUpdateCommand(MenuId, CommandState));
 }
Пример #10
0
        private void OnFilterSinglePointCommand(GeoPointProperty sender, string menuId, CommandState commandState, ref bool handled)
        {
            int index = (int)sender.UserData["Index"];

            if (commandState != null)
            {   // es wird nur nach der Menuedarstellung gefragt
                switch (menuId)
                {
                case "MenuId.IndexedPoint.InsertAfter":
                    if (index == controlledObject.GetGeoPointCount() - 1)
                    {
                        index = -1;
                    }
                    else
                    {
                        index += 1;
                    }
                    commandState.Enabled = controlledObject.MayInsert(index);
                    handled = true;
                    break;

                case "MenuId.IndexedPoint.InsertBefore":
                    commandState.Enabled = controlledObject.MayInsert(index);
                    handled = true;
                    break;

                case "MenuId.IndexedPoint.Delete":
                    commandState.Enabled = controlledObject.MayDelete(index);
                    handled = true;
                    break;
                }
            }
            else
            {
                try
                {
                    GeoPoint p = controlledObject.GetGeoPoint(index);
                    switch (menuId)
                    {
                    case "MenuId.IndexedPoint.InsertAfter":
                        if (index == controlledObject.GetGeoPointCount() - 1)
                        {
                            index = -1;
                        }
                        else
                        {
                            index += 1;
                        }
                        if (GetInsertionPointEvent != null)
                        {
                            p = GetInsertionPointEvent(this, index, true);
                        }
                        else if (index > 0)
                        {
                            p = new GeoPoint(controlledObject.GetGeoPoint(index - 1), controlledObject.GetGeoPoint(index));
                        }
                        controlledObject.InsertGeoPoint(index, p);
                        handled = true;
                        break;

                    case "MenuId.IndexedPoint.InsertBefore":
                        if (GetInsertionPointEvent != null)
                        {
                            p = GetInsertionPointEvent(this, index, false);
                        }
                        else if (index > 0)
                        {
                            p = new GeoPoint(controlledObject.GetGeoPoint(index - 1), controlledObject.GetGeoPoint(index));
                        }
                        controlledObject.InsertGeoPoint(index, p);
                        handled = true;
                        break;

                    case "MenuId.IndexedPoint.Delete":
                        controlledObject.RemoveGeoPoint(index);
                        handled = true;
                        break;

                    case "MenuId.Point.NameVariable":
                        if (Frame != null)
                        {
                            Frame.Project.SetNamedValue(null, p);
                            handled = true;
                        }
                        break;
                    }
                }
                catch (IndexOutOfRangeException e)
                {
                }
            }
        }