Beispiel #1
0
        void annImageObject_PictureInfo_ValueChanged(object oldValue, object newValue)
        {
            AnnImageObject annImageObject = (AnnImageObject)_annObject;

            if (annImageObject != null)
            {
                annImageObject.Picture = (AnnPicture)newValue;

                if (OnPropertyChanged != null)
                {
                    OnPropertyChanged("ImagePicture", newValue);
                }
            }
        }
Beispiel #2
0
        public AnnObjectEditor(AnnObject annObject)
        {
            _annObject = annObject;
            if (annObject.SupportsFill && !(annObject is AnnHotspotObject))
            {
                AnnBrush        fill            = null;
                AnnHiliteObject annHiliteObject = _annObject as AnnHiliteObject;
                if (annHiliteObject != null)
                {
                    fill = AnnSolidColorBrush.Create(annHiliteObject.HiliteColor);
                }
                else
                {
                    fill = annObject.Fill;
                }

                AnnPropertyInfo fillPropertyInfo = new AnnPropertyInfo("Color", false, fill, "Fill", "Hilite Color", string.Empty, annObject.SupportsFill, typeof(AnnSolidColorBrushEditor));
                fillPropertyInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(fillPropertyInfo_ValueChanged);

                _properties["Color"] = fillPropertyInfo;
            }

            if (annObject.SupportsStroke && !(annObject is AnnHotspotObject))
            {
                AnnPropertyInfo strokePropertyInfo = new AnnPropertyInfo("Stroke", false, annObject.Stroke, "Stroke", "Stroke the object", string.Empty, annObject.SupportsStroke, typeof(AnnStrokeEditor));
                strokePropertyInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(strokePropertyInfo_ValueChanged);

                _properties["Stroke"] = strokePropertyInfo;
            }

            if (annObject.SupportsFont)
            {
                AnnPropertyInfo fontPropertyInfo = new AnnPropertyInfo(string.Empty, false, annObject.Font, "Font", "Select Font", string.Empty, annObject.SupportsFont, typeof(AnnFontEditor));
                fontPropertyInfo.ValueChanged += fontPropertyInfo_ValueChanged;
                _properties["Font"]            = fontPropertyInfo;
            }

            AnnPropertyInfo hyperlink = new AnnPropertyInfo(string.Empty, false, annObject.Hyperlink, "Hyperlink", "Hyperlink", "Hyperlink", true, typeof(AnnStringEditor));

            hyperlink.ValueChanged  += new AnnObjectEditorValueChangedHandler(hyperlink_ValueChanged);
            _properties["Hyperlink"] = hyperlink;

            if (annObject.SupportsOpacity)
            {
                AnnPropertyInfo opacity = new AnnPropertyInfo(string.Empty, false, annObject.Opacity, "Opacity", "Opacity", "Opacity", true, typeof(AnnDoubleEditor));
                opacity.ValueChanged  += opacity_ValueChanged;
                _properties["Opacity"] = opacity;
            }

            if (annObject is AnnCurveObject)
            {
                AnnCurveObject  closedCurveObject = annObject as AnnCurveObject;
                AnnPropertyInfo tensionInfo;
                if (closedCurveObject != null)
                {
                    tensionInfo = new AnnPropertyInfo(string.Empty, false, closedCurveObject.Tension, "Curve", "Tension", "Tension", true, typeof(AnnDoubleEditor));
                }
                else
                {
                    AnnCurveObject curveObject = annObject as AnnCurveObject;
                    tensionInfo = new AnnPropertyInfo(string.Empty, false, curveObject.Tension, "Curve", "Tension", "Tension", true, typeof(AnnDoubleEditor));
                }

                tensionInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(tensionInfo_ValueChanged);
                _properties["Tension"]    = tensionInfo;
            }

            if (annObject is AnnPolyRulerObject)
            {
                AnnPolyRulerObject annPolyRulerObject = annObject as AnnPolyRulerObject;

                AnnPropertyInfo showGauge = new AnnPropertyInfo(string.Empty, false, annPolyRulerObject.ShowGauge, "Ruler", "ShowGauge", "Show Gauge", true, typeof(AnnBooleanEditor));

                showGauge.Values["True"]  = true;
                showGauge.Values["False"] = false;

                showGauge.ValueChanged  += new AnnObjectEditorValueChangedHandler(showGauge_ValueChanged);
                _properties["ShowGauge"] = showGauge;

                AnnPropertyInfo gaugeLengthInfo = new AnnPropertyInfo("GaugeLength", false, annPolyRulerObject.GaugeLength, "Ruler", "GaugeLength", "Gauge Length", true, typeof(AnnLengthEditor));
                _properties["GaugeLength"] = gaugeLengthInfo;

                AnnPropertyInfo tickMarksLengthInfo = new AnnPropertyInfo("TickMarksLength", false, annPolyRulerObject.TickMarksLength, "Ruler", "TickMarksLength", "TickMarks Length", true, typeof(AnnLengthEditor));
                _properties["TickMarksLength"] = tickMarksLengthInfo;

                _polyRulerObj = annPolyRulerObject;
                gaugeLengthInfo.ValueChanged     += gaugeLengthInfo_ValueChanged;
                tickMarksLengthInfo.ValueChanged += tickMarksLengthInfo_ValueChanged;

                string          measurementUnit     = Enum.GetName(typeof(AnnUnit), (int)annPolyRulerObject.MeasurementUnit);
                AnnPropertyInfo measurementUnitInfo = new AnnPropertyInfo(string.Empty, false, measurementUnit, "Ruler", "MeasurementUnit", "Measurement Unit", true, typeof(AnnStringEditor));
                measurementUnitInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(measurementUnitInfo_ValueChanged);

                FillEnumValue(measurementUnitInfo, typeof(AnnUnit));
                _properties["MeasurementUnit"] = measurementUnitInfo;

                AnnPropertyInfo precisionInfo = new AnnPropertyInfo(string.Empty, false, annPolyRulerObject.Precision.ToString(), "Ruler", "Precision", "Precision", true, typeof(AnnStringEditor));
                precisionInfo.Values["0"] = 0;
                precisionInfo.Values["1"] = 1;
                precisionInfo.Values["2"] = 2;
                precisionInfo.Values["3"] = 3;
                precisionInfo.Values["4"] = 4;
                precisionInfo.Values["5"] = 5;
                precisionInfo.Values["6"] = 6;

                precisionInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(precisionInfo_ValueChanged);
                _properties["Precision"]    = precisionInfo;


                AnnPropertyInfo showTickMarksInfo = new AnnPropertyInfo(string.Empty, false, annPolyRulerObject.ShowTickMarks, "Ruler", "ShowTickMarks", "Show Tick Marks", true, typeof(AnnBooleanEditor));

                showTickMarksInfo.Values["True"]  = true;
                showTickMarksInfo.Values["False"] = false;

                showTickMarksInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(showTickMarksInfo_ValueChanged);
                _properties["ShowTickMarks"]    = showTickMarksInfo;
            }

            if (annObject is AnnProtractorObject)
            {
                AnnProtractorObject annProtractorObject = annObject as AnnProtractorObject;
                AnnPropertyInfo     acuteInfo           = new AnnPropertyInfo(string.Empty, false, annProtractorObject.Acute.ToString(), "Protractor", "Acute", "Acute", true, typeof(AnnStringEditor));
                acuteInfo.Values["True"]  = true;
                acuteInfo.Values["False"] = false;

                acuteInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(acuteInfo_ValueChanged);
                _properties["Acute"]    = acuteInfo;
                AnnPropertyInfo anglePrecisionInfo = new AnnPropertyInfo(string.Empty, false, annProtractorObject.AnglePrecision.ToString(), "Protractor", "Angle Precision", "Precision", true, typeof(AnnStringEditor));

                anglePrecisionInfo.Values["0"] = 0;
                anglePrecisionInfo.Values["1"] = 1;
                anglePrecisionInfo.Values["2"] = 2;
                anglePrecisionInfo.Values["3"] = 3;
                anglePrecisionInfo.Values["4"] = 4;
                anglePrecisionInfo.Values["5"] = 5;
                anglePrecisionInfo.Values["6"] = 6;

                anglePrecisionInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(anglePrecisionInfo_ValueChanged);
                _properties["AnglePrecision"]    = anglePrecisionInfo;

                string          angulartUnit    = Enum.GetName(typeof(AnnAngularUnit), (int)annProtractorObject.AngularUnit);
                AnnPropertyInfo angularUnitInfo = new AnnPropertyInfo(string.Empty, false, angulartUnit, "Protractor", "AngularUnit", "Angular Unit", true, typeof(AnnStringEditor));
                angularUnitInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(angularUnitInfo_ValueChanged);

                FillEnumValue(angularUnitInfo, typeof(AnnAngularUnit));
                _properties["AngularUnit"] = angularUnitInfo;
            }
            if (annObject is AnnRubberStampObject)
            {
                AnnRubberStampObject annRubberStampObject = annObject as AnnRubberStampObject;
                string rubberStamp = Enum.GetName(typeof(AnnRubberStampType), (int)annRubberStampObject.RubberStampType);
                if (rubberStamp.StartsWith("Stamp"))
                {
                    rubberStamp = rubberStamp.Replace("Stamp", "");
                }
                AnnPropertyInfo ruberStampTypeinfo = new AnnPropertyInfo(string.Empty, false, rubberStamp, "Rubber Stamp", "RuberStampType", "Rubber Stamp Type", true, typeof(AnnStringEditor));

                FillEnumValue(ruberStampTypeinfo, typeof(AnnRubberStampType));

                ruberStampTypeinfo.ValueChanged += new AnnObjectEditorValueChangedHandler(ruberStampTypeinfo_ValueChanged);
                _properties["RuberStampType"]    = ruberStampTypeinfo;
            }

            if (annObject is AnnTextObject)
            {
                AnnTextObject   annTextObject = annObject as AnnTextObject;
                AnnPropertyInfo textBackgroundPropertyInfo = new AnnPropertyInfo(string.Empty, false, annTextObject.TextBackground, "Text", "TextBackground", "Background", true, typeof(AnnSolidColorBrushEditor));
                _properties["TextBackground"]            = textBackgroundPropertyInfo;
                textBackgroundPropertyInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(textBackgroundPropertyInfo_ValueChanged);

                AnnPropertyInfo textForegroundPropertyInfo = new AnnPropertyInfo(string.Empty, false, annTextObject.TextForeground, "Text", "TextForeground", "Foreground", true, typeof(AnnSolidColorBrushEditor));
                textForegroundPropertyInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(textForegroundPropertyInfo_ValueChanged);
                _properties["TextForeground"]            = textForegroundPropertyInfo;

                AnnPropertyInfo text = new AnnPropertyInfo(string.Empty, false, annTextObject.Text, "Text", "Acute", "Text", true, typeof(AnnStringEditor));
                text.ValueChanged  += new AnnObjectEditorValueChangedHandler(text_ValueChanged);
                _properties["Text"] = text;

                string          vertical          = Enum.GetName(typeof(AnnVerticalAlignment), (int)annTextObject.VerticalAlignment);
                AnnPropertyInfo verticalAlignment = new AnnPropertyInfo(string.Empty, false, vertical, "Text", "VerticalAlignment", "Vertical Alignment", true, typeof(AnnStringEditor));
                verticalAlignment.ValueChanged += new AnnObjectEditorValueChangedHandler(verticalAlignment_ValueChanged);
                FillEnumValue(verticalAlignment, typeof(AnnVerticalAlignment));
                _properties["VerticalAlignment"] = verticalAlignment;


                string          horizontal          = Enum.GetName(typeof(AnnHorizontalAlignment), (int)annTextObject.HorizontalAlignment);
                AnnPropertyInfo horizontalAlignment = new AnnPropertyInfo(string.Empty, false, horizontal, "Text", "HorizontalAlignment", "Horizontal Alignment", true, typeof(AnnStringEditor));
                horizontalAlignment.ValueChanged += new AnnObjectEditorValueChangedHandler(horizontalAlignment_ValueChanged);

                FillEnumValue(horizontalAlignment, typeof(AnnHorizontalAlignment));

                _properties["HorizontalAlignment"] = horizontalAlignment;

                AnnPropertyInfo wordWrapInfo = new AnnPropertyInfo(string.Empty, false, annTextObject.WordWrap, "Text", "Word Wrap", "Word Wrap", true, typeof(AnnBooleanEditor));
                wordWrapInfo.Values["True"]  = true;
                wordWrapInfo.Values["False"] = false;

                _properties["WordWrap"] = wordWrapInfo;

                wordWrapInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(wordWrapInfo_ValueChanged);
            }

            if (annObject is AnnTextRollupObject)
            {
                AnnTextRollupObject annTextRollupObject = annObject as AnnTextRollupObject;
                AnnPropertyInfo     expandedInfo        = new AnnPropertyInfo(string.Empty, false, annTextRollupObject.Expanded, "TextRollup", "Expanded", "Expanded", true, typeof(AnnBooleanEditor));

                expandedInfo.Values["True"]  = true;
                expandedInfo.Values["False"] = false;

                expandedInfo.ValueChanged += expandedInfo_ValueChanged;
                _properties["Expanded"]    = expandedInfo;
            }

            if (annObject is AnnTextPointerObject)
            {
                AnnTextPointerObject annTextPointerObject = annObject as AnnTextPointerObject;
                AnnPropertyInfo      fixedPointerInfo     = new AnnPropertyInfo(string.Empty, false, annTextPointerObject.FixedPointer.ToString(), "Text Pointer", "FixedPointer", "Fixed", true, typeof(AnnStringEditor));
                fixedPointerInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(fixedPointerInfo_ValueChanged);

                fixedPointerInfo.Values["True"]  = true;
                fixedPointerInfo.Values["False"] = false;

                _properties["FixedPointer"] = fixedPointerInfo;
            }

            if (annObject is AnnStampObject)
            {
                AnnStampObject  annStampObject = annObject as AnnStampObject;
                AnnPropertyInfo pictureInfo    = new AnnPropertyInfo(string.Empty, false, annStampObject.Picture, "Picture", "Picture", "Picture", true, typeof(AnnPictureEditor));
                pictureInfo.ValueChanged += pictureInfo_ValueChanged;
                _properties["Picture"]    = pictureInfo;
            }

            if (annObject is AnnImageObject)
            {
                AnnImageObject  annImageObject = annObject as AnnImageObject;
                AnnPropertyInfo pictureInfo    = new AnnPropertyInfo(string.Empty, false, annImageObject.Picture, "Picture", "Picture", "Picture", true, typeof(AnnPictureEditor));
                pictureInfo.ValueChanged += annImageObject_PictureInfo_ValueChanged;
                _properties["Picture"]    = pictureInfo;
            }

            if (annObject is AnnFreehandHotspotObject)
            {
                AnnFreehandHotspotObject annFreehandHotspotObject = annObject as AnnFreehandHotspotObject;
                AnnPropertyInfo          pictureInfo = new AnnPropertyInfo(string.Empty, false, annFreehandHotspotObject.Picture, "Picture", "Picture", "Picture", true, typeof(AnnPictureEditor));
                pictureInfo.ValueChanged += freeHandPictureInfo_ValueChanged;
                _properties["Picture"]    = pictureInfo;
            }

            if (annObject is AnnPointObject)
            {
                AnnPointObject  annPointObject  = annObject as AnnPointObject;
                AnnPropertyInfo showPictureInfo = new AnnPropertyInfo(string.Empty, false, annPointObject.ShowPicture, "Point", "ShowPicture", "Show Picture", true, typeof(AnnBooleanEditor));

                showPictureInfo.Values["True"]  = true;
                showPictureInfo.Values["False"] = false;

                showPictureInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(showPictureInfo_ValueChanged);
                _properties["ShowPicture"]    = showPictureInfo;
            }

            if (annObject.Id == AnnObject.MediaObjectId || annObject.Id == AnnObject.AudioObjectId)
            {
                AnnMediaObject annMediaObject = annObject as AnnMediaObject;

                AnnPropertyInfo media = new AnnPropertyInfo(string.Empty, false, annMediaObject.Media, "Media", "Media", "Source", true, typeof(AnnMediaEditor));

                media.ValueChanged  += new AnnObjectEditorValueChangedHandler(media_ValueChanged);
                _properties["Media"] = media;
            }

            if (annObject.Id == AnnObject.EncryptObjectId)
            {
                AnnEncryptObject annEncryptObject = annObject as AnnEncryptObject;
                if (annEncryptObject != null)
                {
                    AnnPropertyInfo key = new AnnPropertyInfo(string.Empty, false, annEncryptObject.Key, "Encrypt", "", "Key", true, typeof(AnnIntegerEditor));
                    key.ValueChanged  += new AnnObjectEditorValueChangedHandler(encryptKey_ValueChanged);
                    _properties["Key"] = key;

                    if (!annEncryptObject.IsEncrypted)
                    {
                        AnnPropertyInfo encryptor = new AnnPropertyInfo(string.Empty, false, annEncryptObject.Encryptor, "Encrypt", "", "Encryptor", true, typeof(AnnBooleanEditor));

                        encryptor.Values["True"]  = true;
                        encryptor.Values["False"] = false;
                        encryptor.ValueChanged   += new AnnObjectEditorValueChangedHandler(encryptor_ValueChanged);
                        _properties["Encryptor"]  = encryptor;
                    }
                }
            }
        }