use of net.sf.latexdraw.command.ModifyEditingMode in project latexdraw by arnobl.
the class EditingSelector method configureBindings.
@Override
protected void configureBindings() {
final var shapeBaseBinder = toggleButtonBinder().on(getShapeButtons()).end(() -> canvas.requestFocus());
toggleButtonBinder().toProduce(() -> new AddShape(ShapeFactory.INST.createText(ShapeFactory.INST.createPoint(textSetter.getPosition()), textSetter.getTextField().getText()), canvas.getDrawing())).on(handB).when(() -> textSetter.isActivated() && !textSetter.getTextField().getText().isEmpty()).end(() -> canvas.requestFocus()).bind();
shapeBaseBinder.on(handB).toProduce(i -> new ModifyEditingMode(editing, (EditionChoice) i.getWidget().getUserData())).bind();
toggleButtonBinder().toProduce(ActivateInactivateInstruments::new).on(handB).first(c -> {
final boolean noSelection = canvas.getDrawing().getSelection().isEmpty();
c.setActivateFirst(false);
c.addInstrumentToActivate(hand);
if (!noSelection) {
c.addInstrumentToActivate(deleter);
}
c.addInstrumentToInactivate(pencil);
if (noSelection) {
c.addInstrumentToInactivate(metaShapeCustomiser);
c.addInstrumentToInactivate(border);
} else {
c.addInstrumentToActivate(metaShapeCustomiser);
c.addInstrumentToActivate(border);
}
}).end(i -> canvas.requestFocus()).bind();
shapeBaseBinder.toProduce(ActivateInactivateInstruments::new).first((i, c) -> {
c.setActivateFirst(false);
if (i.getWidget() != textB) {
c.addInstrumentToInactivate(textSetter);
}
c.addInstrumentToInactivate(hand);
c.addInstrumentToInactivate(border);
c.addInstrumentToInactivate(deleter);
c.addInstrumentToActivate(pencil);
c.addInstrumentToActivate(metaShapeCustomiser);
}).bind();
buttonBinder().toProduce(ActivateInactivateInstruments::new).on(codeB).first(c -> c.addInstrumentToActivate(codeInserter)).end(() -> canvas.requestFocus()).bind();
}
Aggregations