Search in sources :

Example 11 with LengthUnits

use of org.freeplane.core.ui.LengthUnits in project freeplane by freeplane.

the class MenuIconScaling method scaleIcon.

static void scaleIcon(final AbstractButton actionComponent) {
    final Icon icon = actionComponent.getIcon();
    final IconFactory imageIconFactory = IconFactory.getInstance();
    if (icon != null && imageIconFactory.canScaleIcon(icon)) {
        final Font font = actionComponent.getFont();
        final int fontHeight = actionComponent.getFontMetrics(font).getHeight();
        final Quantity<LengthUnits> iconHeight = new Quantity<LengthUnits>(1.2 * fontHeight, LengthUnits.px);
        actionComponent.setIcon(FreeplaneIconFactory.toImageIcon(imageIconFactory.getScaledIcon(icon, iconHeight)));
    }
}
Also used : LengthUnits(org.freeplane.core.ui.LengthUnits) Quantity(org.freeplane.core.util.Quantity) Icon(javax.swing.Icon) Font(java.awt.Font) IconFactory(org.freeplane.features.icon.factory.IconFactory) FreeplaneIconFactory(org.freeplane.core.ui.svgicons.FreeplaneIconFactory)

Example 12 with LengthUnits

use of org.freeplane.core.ui.LengthUnits in project freeplane by freeplane.

the class NodeShapeControlGroup method addControlGroup.

public void addControlGroup(DefaultFormBuilder formBuilder) {
    mSetNodeShape = new BooleanProperty(ControlGroup.SET_RESOURCE);
    mNodeShape = ComboProperty.of(NODE_SHAPE, NodeStyleModel.Shape.class);
    mShapeHorizontalMargin = new QuantityProperty<LengthUnits>(SHAPE_HORIZONTAL_MARGIN, 0, 1000, 0.1, LengthUnits.pt);
    mShapeVerticalMargin = new QuantityProperty<LengthUnits>(SHAPE_VERTICAL_MARGIN, 0, 1000, 0.1, LengthUnits.pt);
    mUniformShape = new BooleanProperty(UNIFORM_SHAPE);
    propertyChangeListener = new NodeShapeChangeListener(mSetNodeShape, mNodeShape, mShapeHorizontalMargin, mShapeVerticalMargin, mUniformShape);
    mSetNodeShape.addPropertyChangeListener(propertyChangeListener);
    mNodeShape.addPropertyChangeListener(propertyChangeListener);
    mShapeHorizontalMargin.addPropertyChangeListener(propertyChangeListener);
    mShapeVerticalMargin.addPropertyChangeListener(propertyChangeListener);
    mUniformShape.addPropertyChangeListener(propertyChangeListener);
    mSetNodeShape.layout(formBuilder);
    mNodeShape.layout(formBuilder);
    new NextColumnProperty(2).layout(formBuilder);
    mShapeHorizontalMargin.layout(formBuilder);
    new NextColumnProperty(2).layout(formBuilder);
    mShapeVerticalMargin.layout(formBuilder);
    new NextColumnProperty(2).layout(formBuilder);
    mUniformShape.layout(formBuilder);
}
Also used : LengthUnits(org.freeplane.core.ui.LengthUnits) Shape(org.freeplane.features.nodestyle.NodeStyleModel.Shape) NextColumnProperty(org.freeplane.core.resources.components.NextColumnProperty) BooleanProperty(org.freeplane.core.resources.components.BooleanProperty)

Example 13 with LengthUnits

use of org.freeplane.core.ui.LengthUnits in project freeplane by freeplane.

the class BorderWidthAndBorderWidthMatchesEdgeControlGroup method addBorderWidthControl.

private void addBorderWidthControl(DefaultFormBuilder formBuilder) {
    mSetBorderWidth = new BooleanProperty(ControlGroup.SET_RESOURCE);
    mBorderWidth = new QuantityProperty<LengthUnits>(BORDER_WIDTH, 0, 100000, 0.1, LengthUnits.px);
    borderWidthListener = new BorderWidthListener(mSetBorderWidth, mBorderWidth);
    mSetBorderWidth.addPropertyChangeListener(borderWidthListener);
    mBorderWidth.addPropertyChangeListener(borderWidthListener);
    mSetBorderWidth.layout(formBuilder);
    mBorderWidth.layout(formBuilder);
}
Also used : LengthUnits(org.freeplane.core.ui.LengthUnits) BooleanProperty(org.freeplane.core.resources.components.BooleanProperty)

Example 14 with LengthUnits

use of org.freeplane.core.ui.LengthUnits in project freeplane by freeplane.

the class ChildDistanceControlGroup method addControlGroup.

public void addControlGroup(DefaultFormBuilder formBuilder) {
    mSetChildDistance = new BooleanProperty(ControlGroup.SET_RESOURCE);
    mChildDistance = new QuantityProperty<LengthUnits>(VERTICAL_CHILD_GAP, 0, 1000, 0.1, LengthUnits.px);
    propertyChangeListener = new ChildDistanceChangeListener(mSetChildDistance, mChildDistance);
    mSetChildDistance.addPropertyChangeListener(propertyChangeListener);
    mChildDistance.addPropertyChangeListener(propertyChangeListener);
    mSetChildDistance.layout(formBuilder);
    mChildDistance.layout(formBuilder);
}
Also used : LengthUnits(org.freeplane.core.ui.LengthUnits) BooleanProperty(org.freeplane.core.resources.components.BooleanProperty)

Example 15 with LengthUnits

use of org.freeplane.core.ui.LengthUnits in project freeplane by freeplane.

the class IconController method getIconSize.

public Quantity<LengthUnits> getIconSize(NodeModel node) {
    final MapModel map = node.getMap();
    final ModeController modeController = Controller.getCurrentModeController();
    final LogicalStyleController styleController = LogicalStyleController.getController(modeController);
    final Collection<IStyle> styles = styleController.getStyles(node);
    final Quantity<LengthUnits> size = getStyleIconSize(map, styles);
    return size;
}
Also used : IStyle(org.freeplane.features.styles.IStyle) LengthUnits(org.freeplane.core.ui.LengthUnits) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) MapModel(org.freeplane.features.map.MapModel) ModeController(org.freeplane.features.mode.ModeController)

Aggregations

LengthUnits (org.freeplane.core.ui.LengthUnits)21 BooleanProperty (org.freeplane.core.resources.components.BooleanProperty)6 IStyle (org.freeplane.features.styles.IStyle)6 NodeModel (org.freeplane.features.map.NodeModel)5 IActor (org.freeplane.core.undo.IActor)4 MapStyleModel (org.freeplane.features.styles.MapStyleModel)4 MapController (org.freeplane.features.map.MapController)3 Icon (javax.swing.Icon)2 IconFactory (org.freeplane.features.icon.factory.IconFactory)2 MapModel (org.freeplane.features.map.MapModel)2 ModeController (org.freeplane.features.mode.ModeController)2 NodeSizeModel (org.freeplane.features.nodestyle.NodeSizeModel)2 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)2 Color (java.awt.Color)1 Font (java.awt.Font)1 NextColumnProperty (org.freeplane.core.resources.components.NextColumnProperty)1 FreeplaneIconFactory (org.freeplane.core.ui.svgicons.FreeplaneIconFactory)1 Quantity (org.freeplane.core.util.Quantity)1 DashVariant (org.freeplane.features.DashVariant)1 IconController (org.freeplane.features.icon.IconController)1