Commit eaf09317 authored by Tusooa Zhu's avatar Tusooa Zhu 🅱

Port fill and shape stroke to the new system

parent 64274b57
......@@ -44,8 +44,6 @@
#include <KoShape.h>
#include <KoShapeController.h>
#include <KoShapeBackground.h>
#include <KoShapeBackgroundCommand.h>
#include <KoShapeStrokeCommand.h>
#include <KoShapeStroke.h>
#include <KoSelectedShapesProxy.h>
#include <KoColorBackground.h>
......
......@@ -54,14 +54,13 @@
#include <KoShapeStroke.h>
#include <KoPathShape.h>
#include <KoMarkerCollection.h>
#include <KoPathShapeMarkerCommand.h>
#include <KoCanvasBase.h>
#include <KoCanvasStrokeHelperBase.h>
#include <KoCanvasController.h>
#include <KoCanvasResourceProvider.h>
#include <KoDocumentResourceManager.h>
#include <KoSelection.h>
#include <KoShapeController.h>
#include <KoShapeStrokeCommand.h>
#include <KoShapeStrokeModel.h>
#include <KoSelectedShapesProxy.h>
#include "ui_KoStrokeConfigWidget.h"
......@@ -581,30 +580,40 @@ void KoStrokeConfigWidget::applyMarkerChanges(int rawPosition)
KoFlake::MarkerPosition position = KoFlake::MarkerPosition(rawPosition);
QScopedPointer<KoMarker> marker;
KoMarker *marker = 0;
switch (position) {
case KoFlake::StartMarker:
if (d->startMarkerSelector->marker()) {
marker.reset(new KoMarker(*d->startMarkerSelector->marker()));
marker = new KoMarker(*d->startMarkerSelector->marker());
}
break;
case KoFlake::MidMarker:
if (d->midMarkerSelector->marker()) {
marker.reset(new KoMarker(*d->midMarkerSelector->marker()));
marker = new KoMarker(*d->midMarkerSelector->marker());
}
break;
case KoFlake::EndMarker:
if (d->endMarkerSelector->marker()) {
marker.reset(new KoMarker(*d->endMarkerSelector->marker()));
marker = new KoMarker(*d->endMarkerSelector->marker());
}
break;
}
KUndo2Command* command = new KoPathShapeMarkerCommand(pathShapes, marker.take(), position);
d->canvas->addCommand(command);
d->canvas->strokeHelper()->run(kundo2_i18n("Set marker"),
[pathShapes, marker, position, this]() {
Q_FOREACH (KoPathShape* shape, pathShapes) {
shape->update();
shape->setMarker(marker, position);
emit sigStrokeChanged();
// we have no GUI for selection auto-filling yet! So just enable it!
shape->setAutoFillMarkers(true);
shape->update();
}
emit sigStrokeChanged();
return true;
});
}
// ----------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment