protected override void SetupHandler()
        {
            OptionGroup toplevelGroup = Handler.AddGroup(TOP_LEVEL);

            //the toplevel group will show neither in Table view nor in dialog view explicitely
            //it's children will be shown one level above
            toplevelGroup.SetAttribute(TableEditorFactory.RENDERING_HINTS_ATTRIBUTE,
                                       (int)TableEditorFactory.RenderingHints.Invisible);
            toplevelGroup.SetAttribute(DefaultEditorFactory.RENDERING_HINTS_ATTRIBUTE,
                                       (int)DefaultEditorFactory.RenderingHints.Invisible);

            OptionGroup spcg = toplevelGroup.AddGroup(SourcePortConstraints);

            spcg.AddGeneric(PortConstraintStr, PortConstraintType.Any).SetAttribute(OptionItem.SUPPORT_NULL_VALUE_ATTRIBUTE,
                                                                                    false);
            spcg.AddBool(StrongPortConstraint, false);
            OptionGroup tpcg = toplevelGroup.AddGroup(TargetPortConstraints);

            tpcg.AddGeneric(PortConstraintStr, PortConstraintType.Any).SetAttribute(OptionItem.SUPPORT_NULL_VALUE_ATTRIBUTE,
                                                                                    false);
            tpcg.AddBool(StrongPortConstraint, false);
            CollectionOptionItem <string> scopeItem = toplevelGroup.AddList(Scope, scopes, ScopeAllEdges);
            BoolOptionItem    clearItem             = toplevelGroup.AddBool(ClearAllConstraints, false);
            ConstraintManager cm = new ConstraintManager(Handler);

            cm.SetEnabledOnValueEquals(clearItem, false, spcg);
            cm.SetEnabledOnValueEquals(clearItem, false, scopeItem);
            cm.SetEnabledOnValueEquals(clearItem, false, tpcg);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes the option handler for the export
        /// </summary>
        private void SetupHandler()
        {
            handler = new OptionHandler(IMAGE_EXPORT);
            handler.PropertyChanged += handler_PropertyChanged;
            OptionGroup currentGroup = handler.AddGroup(OUTPUT);
            OptionItem  formatItem   = currentGroup.AddList(FORMAT, Formats.Keys, FORMAT_JPG);

            currentGroup.AddBool(HIDE_DECORATIONS, true);
            currentGroup.AddBool(EXPORT_RECTANGLE, true);
            currentGroup = handler.AddGroup(BOUNDS);


            OptionItem  sizeItem   = currentGroup.AddList(SIZE, SizeModes, USE_ORIGINAL_SIZE);
            IOptionItem widthItem  = currentGroup.AddInt(WIDTH, DefaultWidth, 1, int.MaxValue);
            IOptionItem heightItem = currentGroup.AddInt(HEIGHT, DefaultHeight, 1, Int32.MaxValue);

            currentGroup.AddDouble(SCALE, DefaultScale);
            currentGroup.AddDouble(ZOOM, DefaultZoom);

            currentGroup = handler.AddGroup(GRAPHICS);

            currentGroup.AddGeneric(SMOOTHING, SimpleSmoothingMode.HighSpeed).SetAttribute(
                OptionItem.SUPPORT_NULL_VALUE_ATTRIBUTE, false);
            currentGroup.AddGeneric(TEXTRENDERING, TextRenderingHint.SystemDefault).SetAttribute(
                OptionItem.SUPPORT_NULL_VALUE_ATTRIBUTE, false);
            currentGroup.AddGeneric(INTERPOLATION, InterpolationMode.Invalid).SetAttribute(
                OptionItem.SUPPORT_NULL_VALUE_ATTRIBUTE, false);
            currentGroup.AddGeneric(PIXELOFFSET, PixelOffsetMode.Invalid).SetAttribute(
                OptionItem.SUPPORT_NULL_VALUE_ATTRIBUTE, false);

            currentGroup = handler.AddGroup(MARGINS);

            currentGroup.AddInt(LEFT_MARGIN, DefaultMargins);
            currentGroup.AddInt(RIGHT_MARGIN, DefaultMargins);
            currentGroup.AddInt(TOP_MARGIN, DefaultMargins);
            currentGroup.AddInt(BOTTOM_MARGIN, DefaultMargins);

            currentGroup = handler.AddGroup(JPG);
            DoubleOptionItem qualityItem = currentGroup.AddDouble(QUALITY, DefaultQuality);

            currentGroup = handler.AddGroup(TIFF);
            OptionItem colorDepthItem  = currentGroup.AddList(COLOR_DEPTH, ColorDepthList.Keys, DefaultDepth);
            OptionItem compressionItem = currentGroup.AddList(COMPRESSION,
                                                              Compressions.Keys, DefaultCompression);


            currentGroup = handler.AddGroup(PNG);
            BoolOptionItem transparentPNGItem = currentGroup.AddBool(TRANSPARENT, false);

            currentGroup = handler.AddGroup(EMF);
            BoolOptionItem transparentEMFItem = currentGroup.AddBool(TRANSPARENT, false);


            var cm = new ConstraintManager(Handler);

            cm.SetEnabledOnValueEquals(sizeItem, SPECIFY_WIDTH, widthItem);
            cm.SetEnabledOnValueEquals(sizeItem, SPECIFY_HEIGHT, heightItem);

            cm.SetEnabledOnValueEquals(formatItem, FORMAT_EMF, transparentEMFItem);
            cm.SetEnabledOnValueEquals(formatItem, FORMAT_PNG, transparentPNGItem);

            cm.SetEnabledOnValueEquals(formatItem, FORMAT_JPG, qualityItem);
            cm.SetEnabledOnValueEquals(formatItem, FORMAT_TIFF, colorDepthItem);
            cm.SetEnabledOnValueEquals(formatItem, FORMAT_TIFF, compressionItem);

            // localization
            var rm =
                new ResourceManager("Demo.yFiles.ImageExport.ImageExport",
                                    Assembly.GetExecutingAssembly());
            var rmf = new ResourceManagerI18NFactory();

            rmf.AddResourceManager(Handler.Name, rm);
            Handler.I18nFactory = rmf;
        }