private OptionHandler CreateOptionHandler() { var handler = new OptionHandler(PreferredPlacement); IOptionItem item; handler.AddString(LabelText, "Label").PropertyChanged += OptionHandlerPropertyChanged; handler.AddDouble(PlacementDistance, 5.0).PropertyChanged += OptionHandlerPropertyChanged; item = handler.AddList(PlacementAlongEdge, PlacementsAlongEdge, PlacementsAlongEdge[0]); item.PropertyChanged += OptionHandlerPropertyChanged; item = handler.AddList(PlacementSideOfEdge, PlacementsSideOfEdge, PlacementsSideOfEdge[0]); item.PropertyChanged += OptionHandlerPropertyChanged; item = handler.AddList(PlacementSideReference, SideReferences, SideReferences[0]); item.PropertyChanged += OptionHandlerPropertyChanged; handler.AddDouble(Angle, 0.0).PropertyChanged += OptionHandlerPropertyChanged; item = handler.AddList(AngleReference, AngleReferences, AngleReferences[0]); item.PropertyChanged += OptionHandlerPropertyChanged; item = handler.AddList(AngleRotation, AngleRotations, AngleRotations[0]); item.PropertyChanged += OptionHandlerPropertyChanged; handler.AddBool(AngleAdd180Degree, false).PropertyChanged += OptionHandlerPropertyChanged; var rm = new ResourceManager("Demo.yFiles.Layout.PreferredLabelPlacement.PreferredLabelPlacement", Assembly.GetExecutingAssembly()); var rmf = new ResourceManagerI18NFactory(); rmf.AddResourceManager(handler.Name, rm); handler.I18nFactory = rmf; return(handler); }
/// <summary> /// Initializes the option handler for the export /// </summary> private void SetupHandler() { handler = new OptionHandler(PRINTING); OptionGroup currentGroup = handler.AddGroup(OUTPUT); currentGroup.AddBool(HIDE_DECORATIONS, true); currentGroup.AddBool(EXPORT_RECTANGLE, true); currentGroup = handler.AddGroup(DOCUMENT_SETTINGS); var item = currentGroup.AddDouble(SCALE, 1.0); currentGroup.AddBool(CENTER_CONTENT, false); currentGroup.AddBool(PAGE_MARK_PRINTING, false); currentGroup.AddBool(SCALE_DOWN_TO_FIT_PAGE, false); currentGroup.AddBool(SCALE_UP_TO_FIT_PAGE, false); // localization var rm = new ResourceManager("Demo.yFiles.Printing.Printing", Assembly.GetExecutingAssembly()); var rmf = new ResourceManagerI18NFactory(); rmf.AddResourceManager(Handler.Name, rm); Handler.I18nFactory = rmf; }
static DefaultsEditor() { i18NFactory = new ResourceManagerI18NFactory(); ResourceManager rm = new ResourceManager("Demo.yFiles.GraphEditor.I18N.DefaultsEditorI18N", Assembly.GetExecutingAssembly()); i18NFactory.AddResourceManager("DEFAULTS", rm); }
/// <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 = 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); IOptionItem qualityItem = currentGroup.AddDouble(QUALITY, DefaultQuality); currentGroup = handler.AddGroup(TIFF); OptionItem compressionItem = currentGroup.AddList(COMPRESSION, Compressions.Keys, DefaultCompression); currentGroup = handler.AddGroup(PNG); var transparentItem = 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_PNG, transparentItem); cm.SetEnabledOnValueEquals(formatItem, FORMAT_JPG, qualityItem); 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; }
/// <summary> /// Initializes the option handler for the export /// </summary> private void SetupHandler() { handler = new OptionHandler(NODE_LABELING); OptionGroup currentGroup = handler; //Trigger an automatic relayout whenever an option changes currentGroup.AddList(LABEL_MODEL, LabelModels.Keys, "LABEL_MODEL_EXTERIOR").PropertyChanged += HandlerPropertyChanged; currentGroup.AddInt(LABEL_SIZE, 8).PropertyChanged += HandlerPropertyChanged; // localization var rm = new ResourceManager("Demo.yFiles.Layout.NodeLabeling.NodeLabeling", Assembly.GetExecutingAssembly()); var rmf = new ResourceManagerI18NFactory(); rmf.AddResourceManager(Handler.Name, rm); Handler.I18nFactory = rmf; }
/// <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; }