Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

fix levelstrip inbetween text (#3766)

shun-iwasawac2def1b30f17
diff --git a/toonz/sources/toonz/Resources/filmstrip_inbetween.svg b/toonz/sources/toonz/Resources/filmstrip_inbetween.svg
deleted file mode 100644
index a83303d54..000000000
--- a/toonz/sources/toonz/Resources/filmstrip_inbetween.svg
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 21.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<svg version="1.1"
- id="svg2" inkscape:version="0.91 r13725" sodipodi:docname="filmstrip_inbetween.svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 9 57"
- style="enable-background:new 0 0 9 57;" xml:space="preserve">
-<style type="text/css">
- .st0{fill:#B4B4B4;}
-</style>
-<rect id="rect4" y="0" class="st0" width="9" height="57"/>
-<path id="path6" inkscape:connector-curvature="0" d="M3,54v-1h1v-1h1v-1H1v-1h7v1H7v1H6v1H5v1H4v1h4v1H1v-1h1v-1H3z M1,44h7v5H7v-4
- H5v4H4v-4H2v4H1V44z M1,38h7v5H7v-4H5v4H4v-4H2v4H1V38z M1,34h2v1h4v1h1v1H5v-1H2v-1H1V34z M3,31h4v1h1v1H7v1H3v-1h3v-1H3V31z M5,28
- h3v1H7v1H3v1H1v-1h1v-1h3V28z M1,24h6v-2h1v5H7v-2H1V24z M1,16h7v5H7v-4H5v4H4v-4H2v4H1V16z M1,10h7v4H7v-3H5v3H4v-3H2v3h2v1H1V10z
- M5,14h2v1H5V14z M1,3h7v1H7v1H6v1H5v1H4v1h4v1H1V8h1V7h1V6h1V5h1V4H1V3z M1,1h7v1H1V1z"/>
-</svg>
diff --git a/toonz/sources/toonz/filmstrip.cpp b/toonz/sources/toonz/filmstrip.cpp
index b7378a0a7..5fc90092c 100644
--- a/toonz/sources/toonz/filmstrip.cpp
+++ b/toonz/sources/toonz/filmstrip.cpp
@@ -780,21 +780,21 @@ void FilmstripFrames::drawFrameIcon(QPainter &p, const QRect &r, int index,
p.setPen(Qt::black);
p.drawLine(x0 - 1, y0, x0 - 1, y1);
- QPixmap inbetweenPixmap(
- svgToPixmap(":Resources/filmstrip_inbetween.svg"));
-
- if (r.height() - 6 < inbetweenPixmap.height()) {
- QSize rectSize(inbetweenPixmap.size());
- rectSize.setHeight(r.height() - 6);
- inbetweenPixmap = inbetweenPixmap.scaled(
- rectSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
- }
-
- p.drawPixmap(
- x0 + 2,
- y1 - inbetweenPixmap.height() / inbetweenPixmap.devicePixelRatio() -
- 3,
- inbetweenPixmap);
+ QRectF txtRect(y0 + 1, -x1, y1 - y0 - 1, x1 - x0 + 1);
+ QFontMetricsF tmpFm(p.font());
+ QRectF bbox = tmpFm.boundingRect(
+ txtRect, Qt::AlignBottom | Qt::AlignHCenter, tr("INBETWEEN"));
+ double ratio = std::min(1.0, txtRect.width() / bbox.width());
+
+ p.save();
+ p.setRenderHint(QPainter::TextAntialiasing);
+ p.rotate(90.0);
+ p.scale(ratio, 1.0);
+ p.drawText(QRectF(txtRect.left() / ratio, txtRect.top(),
+ txtRect.width() / ratio, txtRect.height()),
+ tr("INBETWEEN"),
+ QTextOption(Qt::AlignBottom | Qt::AlignHCenter));
+ p.restore();
} else {
int x1 = r.right();
int x0 = r.left();
diff --git a/toonz/sources/toonz/toonz.qrc b/toonz/sources/toonz/toonz.qrc
index af5a77bb4..29853005f 100644
--- a/toonz/sources/toonz/toonz.qrc
+++ b/toonz/sources/toonz/toonz.qrc
@@ -636,7 +636,6 @@
<file>Resources/plus.png</file>
<file>Resources/forbidden.png</file>
<file>Resources/init.js</file>
- <file>Resources/filmstrip_inbetween.svg</file>
<file>Resources/history_normal.png</file>
<file>Resources/history_brush.png</file>
<file>Resources/history_eraser.png</file>