Fix hardcoded fonts scaling issues (#7493)
* changed font sizes to better values * rename gui_templates.h to FontHelper.h * replace hardcoded values with constants * make knob labels use small font * code review from michael * more consolidation * Fix text problem in Vectorscope Fix a problem with cutoff text in Vectorscope. During the constructor call of `LedCheckBox` the method `LedCheckBox::onTextUpdated` is triggered which sets a fixed size that fits the pixmap and the text. After instantiating the two instances in `VecControlsDialog` the constructor then set a minimum size which overrode the fixed size that was previously set. This then led to text that was cutoff. --------- Co-authored-by: Michael Gregorius <michael.gregorius.git@arcor.de>
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
|
||||
#include "ComboBox.h"
|
||||
#include "DataFile.h"
|
||||
#include "gui_templates.h"
|
||||
#include "FontHelper.h"
|
||||
#include "PixmapButton.h"
|
||||
#include "SampleLoader.h"
|
||||
#include "Song.h"
|
||||
@@ -227,7 +227,7 @@ void AudioFileProcessorView::paintEvent(QPaintEvent*)
|
||||
|
||||
int idx = a->sample().sampleFile().length();
|
||||
|
||||
p.setFont(adjustedToPixelSize(font(), 8));
|
||||
p.setFont(adjustedToPixelSize(font(), SMALL_FONT_SIZE));
|
||||
|
||||
QFontMetrics fm(p.font());
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "AudioFileProcessorWaveView.h"
|
||||
|
||||
#include "ConfigManager.h"
|
||||
#include "gui_templates.h"
|
||||
#include "FontHelper.h"
|
||||
#include "SampleWaveform.h"
|
||||
|
||||
#include <QPainter>
|
||||
@@ -279,7 +279,7 @@ void AudioFileProcessorWaveView::paintEvent(QPaintEvent * pe)
|
||||
p.fillRect(s_padding, s_padding, m_graph.width(), 14, g);
|
||||
|
||||
p.setPen(QColor(255, 255, 255));
|
||||
p.setFont(adjustedToPixelSize(font(), 8));
|
||||
p.setFont(adjustedToPixelSize(font(), SMALL_FONT_SIZE));
|
||||
|
||||
QString length_text;
|
||||
const int length = m_sample->sampleDuration().count();
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "Knob.h"
|
||||
#include "MidiEventToByteSeq.h"
|
||||
#include "MainWindow.h"
|
||||
#include "gui_templates.h"
|
||||
#include "FontHelper.h"
|
||||
#include "Song.h"
|
||||
|
||||
#include <QApplication>
|
||||
@@ -627,7 +627,7 @@ CarlaInstrumentView::CarlaInstrumentView(CarlaInstrument* const instrument, QWid
|
||||
m_toggleUIButton->setCheckable( true );
|
||||
m_toggleUIButton->setChecked( false );
|
||||
m_toggleUIButton->setIcon( embed::getIconPixmap( "zoom" ) );
|
||||
m_toggleUIButton->setFont(adjustedToPixelSize(m_toggleUIButton->font(), 8));
|
||||
m_toggleUIButton->setFont(adjustedToPixelSize(m_toggleUIButton->font(), SMALL_FONT_SIZE));
|
||||
connect( m_toggleUIButton, SIGNAL( clicked(bool) ), this, SLOT( toggleUI( bool ) ) );
|
||||
|
||||
m_toggleUIButton->setToolTip(
|
||||
@@ -637,7 +637,7 @@ CarlaInstrumentView::CarlaInstrumentView(CarlaInstrument* const instrument, QWid
|
||||
m_toggleParamsWindowButton = new QPushButton(tr("Params"), this);
|
||||
m_toggleParamsWindowButton->setIcon(embed::getIconPixmap("controller"));
|
||||
m_toggleParamsWindowButton->setCheckable(true);
|
||||
m_toggleParamsWindowButton->setFont(adjustedToPixelSize(m_toggleParamsWindowButton->font(), 8));
|
||||
m_toggleParamsWindowButton->setFont(adjustedToPixelSize(m_toggleParamsWindowButton->font(), SMALL_FONT_SIZE));
|
||||
#if CARLA_VERSION_HEX < CARLA_MIN_PARAM_VERSION
|
||||
m_toggleParamsWindowButton->setEnabled(false);
|
||||
m_toggleParamsWindowButton->setToolTip(tr("Available from Carla version 2.1 and up."));
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "AudioEngine.h"
|
||||
#include "embed.h"
|
||||
#include "Engine.h"
|
||||
#include "FontHelper.h"
|
||||
#include "lmms_constants.h"
|
||||
#include "lmms_math.h"
|
||||
|
||||
@@ -148,9 +149,7 @@ void EqHandle::paint( QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
res = tr( "BW: " ) + QString::number( getResonance() );
|
||||
}
|
||||
|
||||
QFont painterFont = painter->font();
|
||||
painterFont.setPointSizeF( painterFont.pointSizeF() * 0.7 );
|
||||
painter->setFont( painterFont );
|
||||
painter->setFont(adjustedToPixelSize(painter->font(), SMALL_FONT_SIZE));
|
||||
painter->setPen( Qt::black );
|
||||
painter->drawRect( textRect );
|
||||
painter->fillRect( textRect, QBrush( QColor( 6, 106, 43, 180 ) ) );
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "LcdFloatSpinBox.h"
|
||||
#include "Knob.h"
|
||||
#include "GuiApplication.h"
|
||||
#include "gui_templates.h"
|
||||
#include "PixmapButton.h"
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "endian_handling.h"
|
||||
#include "Engine.h"
|
||||
#include "FileDialog.h"
|
||||
#include "gui_templates.h"
|
||||
#include "FontHelper.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "NotePlayHandle.h"
|
||||
#include "PathUtil.h"
|
||||
@@ -545,7 +545,7 @@ void PatmanView::updateFilename()
|
||||
m_displayFilename = "";
|
||||
int idx = m_pi->m_patchFile.length();
|
||||
|
||||
QFontMetrics fm(adjustedToPixelSize(font(), 8));
|
||||
QFontMetrics fm(adjustedToPixelSize(font(), SMALL_FONT_SIZE));
|
||||
|
||||
// simple algorithm for creating a text from the filename that
|
||||
// matches in the white rectangle
|
||||
@@ -615,7 +615,7 @@ void PatmanView::paintEvent( QPaintEvent * )
|
||||
{
|
||||
QPainter p( this );
|
||||
|
||||
p.setFont(adjustedToPixelSize(font() ,8));
|
||||
p.setFont(adjustedToPixelSize(font(), SMALL_FONT_SIZE));
|
||||
p.drawText( 8, 116, 235, 16,
|
||||
Qt::AlignLeft | Qt::TextSingleLine | Qt::AlignVCenter,
|
||||
m_displayFilename );
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <QWidget>
|
||||
|
||||
#include "Engine.h"
|
||||
#include "FontHelper.h"
|
||||
#include "SamplePlayHandle.h"
|
||||
#include "Song.h"
|
||||
#include "TapTempo.h"
|
||||
@@ -47,11 +48,10 @@ TapTempoView::TapTempoView(TapTempo* plugin)
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
|
||||
auto font = QFont();
|
||||
font.setPointSize(24);
|
||||
|
||||
m_tapButton = new QPushButton();
|
||||
m_tapButton->setFixedSize(200, 200);
|
||||
m_tapButton->setFont(font);
|
||||
m_tapButton->setFont(adjustedToPixelSize(font, 32));
|
||||
m_tapButton->setText(tr("0"));
|
||||
|
||||
auto precisionCheckBox = new QCheckBox(tr("Precision"));
|
||||
|
||||
@@ -64,7 +64,6 @@ VecControlsDialog::VecControlsDialog(VecControls *controls) :
|
||||
auto highQualityButton = new LedCheckBox(tr("HQ"), this);
|
||||
highQualityButton->setToolTip(tr("Double the resolution and simulate continuous analog-like trace."));
|
||||
highQualityButton->setCheckable(true);
|
||||
highQualityButton->setMinimumSize(70, 12);
|
||||
highQualityButton->setModel(&controls->m_highQualityModel);
|
||||
switch_layout->addWidget(highQualityButton);
|
||||
|
||||
@@ -72,7 +71,6 @@ VecControlsDialog::VecControlsDialog(VecControls *controls) :
|
||||
auto logarithmicButton = new LedCheckBox(tr("Log. scale"), this);
|
||||
logarithmicButton->setToolTip(tr("Display amplitude on logarithmic scale to better see small values."));
|
||||
logarithmicButton->setCheckable(true);
|
||||
logarithmicButton->setMinimumSize(70, 12);
|
||||
logarithmicButton->setModel(&controls->m_logarithmicModel);
|
||||
switch_layout->addWidget(logarithmicButton);
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#include "ColorChooser.h"
|
||||
#include "GuiApplication.h"
|
||||
#include "FontHelper.h"
|
||||
#include "MainWindow.h"
|
||||
#include "VecControls.h"
|
||||
|
||||
@@ -89,7 +90,6 @@ void VectorView::paintEvent(QPaintEvent *event)
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
|
||||
QFont normalFont, boldFont;
|
||||
boldFont.setPixelSize(26);
|
||||
boldFont.setBold(true);
|
||||
const int labelWidth = 26;
|
||||
const int labelHeight = 26;
|
||||
@@ -264,7 +264,7 @@ void VectorView::paintEvent(QPaintEvent *event)
|
||||
painter.drawLine(QPointF(centerX, centerY), QPointF(displayRight - gridCorner, displayTop + gridCorner));
|
||||
|
||||
painter.setPen(QPen(m_controls->m_colorLabels, 1, Qt::SolidLine, Qt::RoundCap, Qt::BevelJoin));
|
||||
painter.setFont(boldFont);
|
||||
painter.setFont(adjustedToPixelSize(boldFont, 26));
|
||||
painter.drawText(displayLeft + margin, displayTop,
|
||||
labelWidth, labelHeight, Qt::AlignLeft | Qt::AlignTop | Qt::TextDontClip,
|
||||
QString("L"));
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#include "Engine.h"
|
||||
#include "FileDialog.h"
|
||||
#include "GuiApplication.h"
|
||||
#include "gui_templates.h"
|
||||
#include "FontHelper.h"
|
||||
#include "InstrumentPlayHandle.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "LocaleHelper.h"
|
||||
@@ -583,12 +583,10 @@ VestigeInstrumentView::VestigeInstrumentView( Instrument * _instrument,
|
||||
|
||||
m_selPresetButton->setMenu(menu);
|
||||
|
||||
constexpr int buttonFontSize = 12;
|
||||
|
||||
m_toggleGUIButton = new QPushButton( tr( "Show/hide GUI" ), this );
|
||||
m_toggleGUIButton->setGeometry( 20, 130, 200, 24 );
|
||||
m_toggleGUIButton->setIcon( embed::getIconPixmap( "zoom" ) );
|
||||
m_toggleGUIButton->setFont(adjustedToPixelSize(m_toggleGUIButton->font(), buttonFontSize));
|
||||
m_toggleGUIButton->setFont(adjustedToPixelSize(m_toggleGUIButton->font(), LARGE_FONT_SIZE));
|
||||
connect( m_toggleGUIButton, SIGNAL( clicked() ), this,
|
||||
SLOT( toggleGUI() ) );
|
||||
|
||||
@@ -597,7 +595,7 @@ VestigeInstrumentView::VestigeInstrumentView( Instrument * _instrument,
|
||||
this);
|
||||
note_off_all_btn->setGeometry( 20, 160, 200, 24 );
|
||||
note_off_all_btn->setIcon( embed::getIconPixmap( "stop" ) );
|
||||
note_off_all_btn->setFont(adjustedToPixelSize(note_off_all_btn->font(), buttonFontSize));
|
||||
note_off_all_btn->setFont(adjustedToPixelSize(note_off_all_btn->font(), LARGE_FONT_SIZE));
|
||||
connect( note_off_all_btn, SIGNAL( clicked() ), this,
|
||||
SLOT( noteOffAll() ) );
|
||||
|
||||
@@ -882,7 +880,7 @@ void VestigeInstrumentView::paintEvent( QPaintEvent * )
|
||||
tr( "No VST plugin loaded" );
|
||||
QFont f = p.font();
|
||||
f.setBold( true );
|
||||
p.setFont(adjustedToPixelSize(f, 10));
|
||||
p.setFont(adjustedToPixelSize(f, DEFAULT_FONT_SIZE));
|
||||
p.setPen( QColor( 255, 255, 255 ) );
|
||||
p.drawText( 10, 100, plugin_name );
|
||||
|
||||
@@ -894,7 +892,7 @@ void VestigeInstrumentView::paintEvent( QPaintEvent * )
|
||||
{
|
||||
p.setPen( QColor( 0, 0, 0 ) );
|
||||
f.setBold( false );
|
||||
p.setFont(adjustedToPixelSize(f, 8));
|
||||
p.setFont(adjustedToPixelSize(f, SMALL_FONT_SIZE));
|
||||
p.drawText( 10, 114, tr( "by " ) +
|
||||
m_vi->m_plugin->vendorString() );
|
||||
p.setPen( QColor( 255, 255, 255 ) );
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "PixmapButton.h"
|
||||
#include "embed.h"
|
||||
|
||||
#include "gui_templates.h"
|
||||
#include "FontHelper.h"
|
||||
#include <QToolBar>
|
||||
#include <QLabel>
|
||||
|
||||
@@ -246,7 +246,7 @@ VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) :
|
||||
tb->addWidget(space1);
|
||||
|
||||
tbLabel = new QLabel( tr( "Effect by: " ), this );
|
||||
tbLabel->setFont(adjustedToPixelSize(f, 7));
|
||||
tbLabel->setFont(adjustedToPixelSize(f, SMALL_FONT_SIZE));
|
||||
tbLabel->setTextFormat(Qt::RichText);
|
||||
tbLabel->setAlignment( Qt::AlignTop | Qt::AlignLeft );
|
||||
tb->addWidget( tbLabel );
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "Clipboard.h"
|
||||
|
||||
#include "embed.h"
|
||||
#include "FontHelper.h"
|
||||
#include "plugin_export.h"
|
||||
|
||||
namespace lmms
|
||||
@@ -546,8 +547,7 @@ ZynAddSubFxView::ZynAddSubFxView( Instrument * _instrument, QWidget * _parent )
|
||||
m_toggleUIButton->setChecked( false );
|
||||
m_toggleUIButton->setIcon( embed::getIconPixmap( "zoom" ) );
|
||||
QFont f = m_toggleUIButton->font();
|
||||
f.setPointSizeF(12);
|
||||
m_toggleUIButton->setFont(f);
|
||||
m_toggleUIButton->setFont(adjustedToPixelSize(f, DEFAULT_FONT_SIZE));
|
||||
|
||||
connect( m_toggleUIButton, SIGNAL( toggled( bool ) ), this,
|
||||
SLOT( toggleUI() ) );
|
||||
|
||||
Reference in New Issue
Block a user