Skip to content

Commit 615fedf

Browse files
committed
Merge branch 'main' into designer
2 parents 6a0146d + 85776bd commit 615fedf

26 files changed

+351
-55
lines changed

.github/workflows/mac.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: macOS
1+
name: macOS (x86_64)
22

33
on: workflow_dispatch
44

55
jobs:
66
release:
77
runs-on: macos-13
88
steps:
9-
- uses: actions/checkout@v3
9+
- uses: actions/checkout@v4
1010
- name: Build
1111
run: ./src/scripts/build_mac_ci.sh
1212
- name: Artifact

.github/workflows/macos.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: macOS (arm64)
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
release:
7+
runs-on: macos-15
8+
steps:
9+
- uses: actions/checkout@v4
10+
- name: Build
11+
run: ./src/scripts/build_mac_ci.sh
12+
- name: Artifact
13+
uses: actions/upload-artifact@v4
14+
with:
15+
name: friction-ci-macOS-arm64
16+
path: build-release/*.dmg

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ src/scripts/flatpak/export
3535
src/scripts/flatpak/builder
3636
src/scripts/flatpak/repo
3737
src/scripts/flatpak/remote
38+
*.app
3839

src/app/GUI/mainwindow.cpp

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
#include <QSpacerItem>
4040
#include <QMargins>
4141
#include <iostream>
42+
#include <QClipboard>
43+
#include <QMimeData>
4244

4345
#include "GUI/edialogs.h"
4446
#include "dialogs/applyexpressiondialog.h"
@@ -570,6 +572,23 @@ void MainWindow::setupMenuBar()
570572
cmdAddAction(qAct);
571573
}
572574

575+
{ // import (paste) SVG from clipboard
576+
mEditMenu->addAction(QIcon::fromTheme("paste"),
577+
tr("Paste from Clipboard"),
578+
[this]() {
579+
const auto clipboard = QGuiApplication::clipboard();
580+
if (clipboard) {
581+
const auto mime = clipboard->mimeData();
582+
qDebug() << mime->formats() << mime->text();
583+
if (mime->hasText() && mime->text().contains("<svg")) {
584+
const QString svg = mime->text();
585+
try { mActions.importClipboard(svg); }
586+
catch (const std::exception& e) { gPrintExceptionCritical(e); }
587+
}
588+
}
589+
}, QKeySequence(tr("Ctrl+Shift+V")));
590+
}
591+
573592
{
574593
const auto qAct = new NoShortcutAction(tr("Duplicate", "MenuBar_Edit"));
575594
mEditMenu->addAction(qAct);
@@ -1120,7 +1139,9 @@ void MainWindow::setupMenuBar()
11201139
help->addAction(QIcon::fromTheme("renderlayers"),
11211140
tr("Reinstall default Expressions Presets"),
11221141
this, &MainWindow::askInstallExpressionsPresets);
1123-
1142+
help->addAction(QIcon::fromTheme("color"),
1143+
tr("Restore default fill and stroke"),
1144+
this, &MainWindow::askRestoreFillStrokeDefault);
11241145

11251146
// toolbar actions
11261147
mToolbar->addAction(newAct);
@@ -1402,6 +1423,21 @@ void MainWindow::askInstallExpressionsPresets()
14021423
AppSupport::setSettings("settings", "firstRunExprPresets", true);
14031424
}
14041425

1426+
void MainWindow::askRestoreFillStrokeDefault()
1427+
{
1428+
const auto result = QMessageBox::question(this,
1429+
tr("Restore default fill and stroke?"),
1430+
tr("Are you sure you want to restore fill and stroke defaults?"));
1431+
if (result != QMessageBox::Yes) { return; }
1432+
1433+
auto settings = eSettings::sInstance;
1434+
settings->fLastFillFlatEnabled = false;
1435+
settings->fLastStrokeFlatEnabled = true;
1436+
settings->fLastUsedFillColor = Qt::white;
1437+
settings->fLastUsedStrokeColor = ThemeSupport::getThemeObjectColor();
1438+
settings->fLastUsedStrokeWidth = 10.;
1439+
}
1440+
14051441
void MainWindow::openWelcomeDialog()
14061442
{
14071443
mStackWidget->setCurrentIndex(mStackIndexWelcome);
@@ -1786,6 +1822,18 @@ void MainWindow::writeSettings()
17861822
AppSupport::setSettings("ui", "geometry", saveGeometry());
17871823
AppSupport::setSettings("ui", "maximized", isMaximized());
17881824
AppSupport::setSettings("ui", "fullScreen", isFullScreen());
1825+
1826+
AppSupport::setSettings("FillStroke", "LastStrokeColor",
1827+
eSettings::instance().fLastUsedStrokeColor);
1828+
AppSupport::setSettings("FillStroke", "LastStrokeWidth",
1829+
eSettings::instance().fLastUsedStrokeWidth);
1830+
AppSupport::setSettings("FillStroke", "LastStrokeFlat",
1831+
eSettings::instance().fLastStrokeFlatEnabled);
1832+
1833+
AppSupport::setSettings("FillStroke", "LastFillColor",
1834+
eSettings::instance().fLastUsedFillColor);
1835+
AppSupport::setSettings("FillStroke", "LastFillFlat",
1836+
eSettings::instance().fLastFillFlatEnabled);
17891837
}
17901838

17911839
bool MainWindow::isEnabled()

src/app/GUI/mainwindow.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ class MainWindow : public QMainWindow
398398
void initRenderPresets(const bool reinstall = false);
399399
void askInstallRenderPresets();
400400
void askInstallExpressionsPresets();
401+
void askRestoreFillStrokeDefault();
401402

402403
QLabel *mColorPickLabel;
403404

src/core/Animators/outlinesettingsanimator.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525

2626
#ifndef OUTLINESETTINGSANIMATOR_H
2727
#define OUTLINESETTINGSANIMATOR_H
28+
2829
#include "paintsettingsanimator.h"
2930
#include "Animators/brushsettingsanimator.h"
31+
#include "Private/esettings.h"
3032

3133
class CORE_EXPORT OutlineSettingsAnimator : public PaintSettingsAnimator {
3234
typedef qCubicSegment1DAnimator::Action SegAction;
@@ -129,6 +131,7 @@ class CORE_EXPORT OutlineSettingsAnimator : public PaintSettingsAnimator {
129131
qsptr<BrushSettingsAnimator> mBrushSettings =
130132
enve::make_shared<BrushSettingsAnimator>();
131133
qsptr<QrealAnimator> mLineWidth =
132-
enve::make_shared<QrealAnimator>(10, 0, 999, 1, "thickness");
134+
enve::make_shared<QrealAnimator>(eSettings::instance().fLastUsedStrokeWidth,
135+
0, 999, 1, "thickness");
133136
};
134137
#endif // OUTLINESETTINGSANIMATOR_H

src/core/Animators/paintsettingsanimator.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,9 @@ void PaintSettingsAnimator::showHideChildrenBeforeChangingPaintType(
410410
ca_addChild(mColor);
411411
}
412412

413-
void PaintSettingsAnimator::setPaintType(const PaintType paintType) {
414-
if(paintType == mPaintType) return;
413+
void PaintSettingsAnimator::setPaintType(const PaintType paintType)
414+
{
415+
if (paintType == mPaintType) { return; }
415416
{
416417
UndoRedo ur;
417418
const auto oldValue = mPaintType;
@@ -433,6 +434,8 @@ void PaintSettingsAnimator::setPaintType(const PaintType paintType) {
433434
prp_afterWholeInfluenceRangeChanged();
434435

435436
SWT_setDisabled(paintType == PaintType::NOPAINT);
437+
438+
emit paintTypeChanged(mPaintType);
436439
}
437440

438441
ColorAnimator *PaintSettingsAnimator::getColorAnimator() {

src/core/Animators/paintsettingsanimator.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class AdvancedTransformAnimator;
4747
struct UpdatePaintSettings;
4848

4949
class CORE_EXPORT PaintSettingsAnimator : public ComplexAnimator {
50+
Q_OBJECT
5051
protected:
5152
PaintSettingsAnimator(const QString &name,
5253
BoundingBox * const parent);
@@ -86,6 +87,10 @@ class CORE_EXPORT PaintSettingsAnimator : public ComplexAnimator {
8687
UpdatePaintSettings& settings);
8788
void duplicatePaintSettingsNotAnim(PaintSettingsAnimator * const settings);
8889
void applyTransform(const QMatrix& transform);
90+
91+
signals:
92+
void paintTypeChanged(const PaintType &type);
93+
8994
protected:
9095
void saveSVG(SvgExporter& exp,
9196
QDomElement& parent,

src/core/Boxes/pathbox.cpp

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,35 @@
4343
#include "Boxes/smartvectorpath.h"
4444
#include "themesupport.h"
4545

46-
PathBox::PathBox(const QString &name, const eBoxType type) :
47-
BoxWithPathEffects(name, type) {
48-
connect(this, &eBoxOrSound::parentChanged, this, [this]() {
46+
PathBox::PathBox(const QString &name,
47+
const eBoxType type)
48+
: BoxWithPathEffects(name, type)
49+
{
50+
connect(this, &eBoxOrSound::parentChanged,
51+
this, [this]() {
4952
setPathsOutdated(UpdateReason::userChange);
5053
});
5154

52-
connect(mPathEffectsAnimators.get(), &Property::prp_currentFrameChanged,
55+
connect(mPathEffectsAnimators.get(),
56+
&Property::prp_currentFrameChanged,
5357
this, [this](const UpdateReason reason) {
5458
setPathsOutdated(reason);
5559
});
5660

57-
connect(mFillPathEffectsAnimators.get(), &Property::prp_currentFrameChanged,
61+
connect(mFillPathEffectsAnimators.get(),
62+
&Property::prp_currentFrameChanged,
5863
this, [this](const UpdateReason reason) {
5964
setFillPathOutdated(reason);
6065
});
6166

62-
connect(mOutlineBasePathEffectsAnimators.get(), &Property::prp_currentFrameChanged,
67+
connect(mOutlineBasePathEffectsAnimators.get(),
68+
&Property::prp_currentFrameChanged,
6369
this, [this](const UpdateReason reason) {
6470
setOutlinePathOutdated(reason);
6571
});
6672

67-
connect(mOutlinePathEffectsAnimators.get(), &Property::prp_currentFrameChanged,
73+
connect(mOutlinePathEffectsAnimators.get(),
74+
&Property::prp_currentFrameChanged,
6875
this, [this](const UpdateReason reason) {
6976
setOutlinePathOutdated(reason);
7077
});
@@ -74,8 +81,24 @@ PathBox::PathBox(const QString &name, const eBoxType type) :
7481
mStrokeSettings = enve::make_shared<OutlineSettingsAnimator>(this);
7582
mStrokeGradientPoints = mFillSettings->getGradientPoints();
7683

77-
mStrokeSettings->setPaintType(PaintType::FLATPAINT);
78-
mStrokeSettings->setCurrentColor(ThemeSupport::getThemeObjectColor());
84+
bool fillFlat = eSettings::instance().fLastFillFlatEnabled;
85+
bool strokeFlat = eSettings::instance().fLastStrokeFlatEnabled;
86+
if (!fillFlat && !strokeFlat) { strokeFlat = true; }
87+
88+
switch (type) {
89+
case eBoxType::circle:
90+
case eBoxType::rectangle:
91+
mFillSettings->setPaintType(fillFlat ?
92+
PaintType::FLATPAINT : PaintType::NOPAINT);
93+
mStrokeSettings->setPaintType(strokeFlat ?
94+
PaintType::FLATPAINT : PaintType::NOPAINT);
95+
break;
96+
default:
97+
mStrokeSettings->setPaintType(PaintType::FLATPAINT);
98+
}
99+
100+
mFillSettings->setCurrentColor(eSettings::instance().fLastUsedFillColor);
101+
mStrokeSettings->setCurrentColor(eSettings::instance().fLastUsedStrokeColor);
79102

80103
ca_prependChild(mPathEffectsAnimators.get(), mFillSettings);
81104
ca_prependChild(mPathEffectsAnimators.get(), mStrokeSettings);
@@ -90,6 +113,29 @@ PathBox::PathBox(const QString &name, const eBoxType type) :
90113
const auto brushSettings = mStrokeSettings->getBrushSettings();
91114
connect(brushSettings, &BrushSettingsAnimator::brushChanged,
92115
this, &BoundingBox::brushChanged);
116+
117+
connect(mFillSettings.get(),
118+
&PaintSettingsAnimator::paintTypeChanged,
119+
this, [this](const PaintType &type) {
120+
switch (getBoxType()) {
121+
case eBoxType::circle:
122+
case eBoxType::rectangle:
123+
eSettings::sInstance->fLastFillFlatEnabled = (type == PaintType::FLATPAINT);
124+
break;
125+
default:;
126+
}
127+
});
128+
connect(mStrokeSettings.get(),
129+
&PaintSettingsAnimator::paintTypeChanged,
130+
this, [this](const PaintType &type) {
131+
switch (getBoxType()) {
132+
case eBoxType::circle:
133+
case eBoxType::rectangle:
134+
eSettings::sInstance->fLastStrokeFlatEnabled = (type == PaintType::FLATPAINT);
135+
break;
136+
default:;
137+
}
138+
});
93139
}
94140

95141
HardwareSupport PathBox::hardwareSupport() const {

src/core/Boxes/textbox.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@
3939
#include "svgexporter.h"
4040
#include "Private/esettings.h"
4141

42-
TextBox::TextBox() : PathBox("Text", eBoxType::text) {
42+
TextBox::TextBox()
43+
: PathBox("Text", eBoxType::text)
44+
{
4345
mFillSettings->setPaintType(PaintType::FLATPAINT);
44-
mFillSettings->setCurrentColor(QColor(Qt::white));
4546
mStrokeSettings->setPaintType(PaintType::NOPAINT);
4647

4748
const auto pathsUpdater = [this](const UpdateReason reason) {

0 commit comments

Comments
 (0)