From 5f439cbf64a2b09e4fcf7009c53fff47b4553201 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 21 Feb 2019 14:40:47 -0500 Subject: [PATCH] Rename font globals In a review of #580 @jsakkine pointed out that the font global names were not clear as to their purpose and unlike everything else, prefixed with "surge_". This commit renames the 3 global fonts to more descriptive names. Former-commit-id: bd014fabe73a1e954e0aca13b11adfff187c75ff [formerly 3705d7f875a4a07091588255ab2d240d6bb625d7] Former-commit-id: 3f1f49d1ef12c4b0bac87979b618dbaa547fc569 Former-commit-id: 8484174dc6ee402f0260663b03eb85753a0c99b7 --- src/common/gui/CEffectLabel.h | 4 ++-- src/common/gui/CLFOGui.cpp | 10 +++++----- src/common/gui/CModulationSourceButton.cpp | 4 ++-- src/common/gui/CNumberField.cpp | 4 ++-- src/common/gui/COscillatorDisplay.cpp | 4 ++-- src/common/gui/CPatchBrowser.cpp | 8 ++++---- src/common/gui/CSnapshotMenu.cpp | 4 ++-- src/common/gui/CSurgeSlider.cpp | 4 ++-- src/common/gui/RuntimeFont.h | 12 ++++++------ src/common/gui/SurgeGUIEditor.cpp | 22 +++++++++++----------- src/mac/RuntimeFontMac.cpp | 8 ++++---- src/windows/RuntimeFontWin.cpp | 8 ++++---- 12 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/common/gui/CEffectLabel.h b/src/common/gui/CEffectLabel.h index 68ca2d38b99..afa3595a1d2 100644 --- a/src/common/gui/CEffectLabel.h +++ b/src/common/gui/CEffectLabel.h @@ -4,7 +4,7 @@ #pragma once #include "vstcontrols.h" -extern VSTGUI::CFontRef surge_minifont; +extern VSTGUI::CFontRef displayFont; class CEffectLabel : public VSTGUI::CControl { @@ -22,7 +22,7 @@ class CEffectLabel : public VSTGUI::CControl dc->drawRect(bl, VSTGUI::kDrawFilled); dc->setFontColor(gray); // dc->setFont(kNormalFontSmaller,8,kBoldFace); - dc->setFont(surge_minifont); + dc->setFont(displayFont); dc->drawString(label.c_str(), size, VSTGUI::kLeftText, false); setDirty(false); } diff --git a/src/common/gui/CLFOGui.cpp b/src/common/gui/CLFOGui.cpp index fb11730c083..24dabb0e9f6 100644 --- a/src/common/gui/CLFOGui.cpp +++ b/src/common/gui/CLFOGui.cpp @@ -7,9 +7,9 @@ using namespace VSTGUI; using namespace std; -extern CFontRef surge_minifont; -extern CFontRef surge_patchfont; -extern CFontRef surge_lfofont; +extern CFontRef displayFont; +extern CFontRef patchNameFont; +extern CFontRef lfoTypeFont; void drawtri(CRect r, CDrawContext* context, int orientation) { @@ -297,7 +297,7 @@ void CLFOGui::draw(CDrawContext* dc) tr.y2 = tr.y + 50; CColor ctext = {224,126,0,0xff}; dc->setFontColor(ctext); - dc->setFont(surge_patchfont); + dc->setFont(patchNameFont); dc->drawString("LFO 1",tr,false,kCenterText); }*/ @@ -306,7 +306,7 @@ void CLFOGui::draw(CDrawContext* dc) CColor cselected = {0xfe, 0x98, 0x15, 0xff}; // CColor blackColor (0, 0, 0, 0); dc->setFrameColor(cskugga); - dc->setFont(surge_lfofont); + dc->setFont(lfoTypeFont); rect_shapes = leftpanel; for (int i = 0; i < n_lfoshapes; i++) diff --git a/src/common/gui/CModulationSourceButton.cpp b/src/common/gui/CModulationSourceButton.cpp index f93a63d908f..391f91fcbd3 100644 --- a/src/common/gui/CModulationSourceButton.cpp +++ b/src/common/gui/CModulationSourceButton.cpp @@ -9,7 +9,7 @@ using namespace VSTGUI; using namespace std; -extern CFontRef surge_minifont; +extern CFontRef displayFont; enum { @@ -154,7 +154,7 @@ void CModulationSourceButton::draw(CDrawContext* dc) CRect framer(sze); CRect fillr(framer); fillr.inset(1, 1); - dc->setFont(surge_minifont); + dc->setFont(displayFont); dc->setFontColor(FontCol); dc->setFrameColor(FrameCol); dc->setFillColor(FillCol); diff --git a/src/common/gui/CNumberField.cpp b/src/common/gui/CNumberField.cpp index 847dcc76d22..bce10161e3b 100644 --- a/src/common/gui/CNumberField.cpp +++ b/src/common/gui/CNumberField.cpp @@ -15,7 +15,7 @@ using namespace VSTGUI; const int width = 62, margin = 6, height = 8, vmargin = 1; -extern CFontRef surge_minifont; +extern CFontRef displayFont; using namespace std; @@ -273,7 +273,7 @@ void CNumberField::draw(CDrawContext* pContext) pContext->setFrameColor(lineColor); - pContext->setFont(surge_minifont); + pContext->setFont(displayFont); // tempContext->fillRect(sze); /*if(!altlook) { diff --git a/src/common/gui/COscillatorDisplay.cpp b/src/common/gui/COscillatorDisplay.cpp index 81617bb6fd8..51352a9d58f 100644 --- a/src/common/gui/COscillatorDisplay.cpp +++ b/src/common/gui/COscillatorDisplay.cpp @@ -21,7 +21,7 @@ namespace fs = std::experimental::filesystem; const float disp_pitch = 90.15f - 48.f; const int wtbheight = 12; -extern CFontRef surge_minifont; +extern CFontRef displayFont; void COscillatorDisplay::draw(CDrawContext* dc) { @@ -189,7 +189,7 @@ void COscillatorDisplay::draw(CDrawContext* dc) dc->setFillColor(fgcol); dc->drawRect(rmenu, kDrawFilled); dc->setFontColor(kBlackCColor); - dc->setFont(surge_minifont); + dc->setFont(displayFont); // strupr(wttxt); dc->drawString(wttxt, rmenu, kCenterText, false); diff --git a/src/common/gui/CPatchBrowser.cpp b/src/common/gui/CPatchBrowser.cpp index 1547aae055f..959abe3679a 100644 --- a/src/common/gui/CPatchBrowser.cpp +++ b/src/common/gui/CPatchBrowser.cpp @@ -8,8 +8,8 @@ using namespace VSTGUI; using namespace std; -extern CFontRef surge_minifont; -extern CFontRef surge_patchfont; +extern CFontRef displayFont; +extern CFontRef patchNameFont; void CPatchBrowser::draw(CDrawContext* dc) { @@ -34,10 +34,10 @@ void CPatchBrowser::draw(CDrawContext* dc) // al.top += 2; al.bottom = al.top + 12; dc->setFontColor(kBlackCColor); - dc->setFont(surge_patchfont); + dc->setFont(patchNameFont); dc->drawString(pname.c_str(), ar, kCenterText, true); - dc->setFont(surge_minifont); + dc->setFont(displayFont); dc->drawString(category.c_str(), al, kLeftText, true); al.offset(0, 12); dc->drawString(author.c_str(), al, kLeftText, true); diff --git a/src/common/gui/CSnapshotMenu.cpp b/src/common/gui/CSnapshotMenu.cpp index 90bbb298874..bd3828ea3f9 100644 --- a/src/common/gui/CSnapshotMenu.cpp +++ b/src/common/gui/CSnapshotMenu.cpp @@ -10,7 +10,7 @@ using namespace VSTGUI; -extern CFontRef surge_minifont; +extern CFontRef displayFont; // CSnapshotMenu @@ -253,7 +253,7 @@ void CFxMenu::draw(CDrawContext* dc) // dc->fillRect(f1); dc->fillRect(f2); dc->setFontColor(kBlackCColor); - dc->setFont(surge_minifont); + dc->setFont(displayFont); CRect txtbox(lbox); txtbox.inset(2, 2); dc->setFillColor(kWhiteCColor); diff --git a/src/common/gui/CSurgeSlider.cpp b/src/common/gui/CSurgeSlider.cpp index ec5ed65a726..c7a9b9b0369 100644 --- a/src/common/gui/CSurgeSlider.cpp +++ b/src/common/gui/CSurgeSlider.cpp @@ -10,7 +10,7 @@ using namespace VSTGUI; using namespace std; -extern CFontRef surge_minifont; +extern CFontRef displayFont; enum { @@ -205,7 +205,7 @@ void CSurgeSlider::draw(CDrawContext* dc) dc->setFontColor(kWhiteCColor); else dc->setFontColor(kBlackCColor); - dc->setFont(surge_minifont); + dc->setFont(displayFont); // int a = 'a' + (rand()&31); // label[1] = a; diff --git a/src/common/gui/RuntimeFont.h b/src/common/gui/RuntimeFont.h index aaf2afb4ffb..82ed021f2aa 100644 --- a/src/common/gui/RuntimeFont.h +++ b/src/common/gui/RuntimeFont.h @@ -14,9 +14,9 @@ namespace GUI * * The role of this function is to load a font from the bundle, dll, or some other * source. Once the font file is loaded, it is used to create the VSTGUI 9 and 14 point - * fonts in global variables "surge_minifont" and "surge_patchfont" if they are NULL - * at calltime. The "surge_minifont" is used for most text rendering and the - * "surge_patchfont" is used for the patchname. + * fonts in global variables "displayFont" and "patchNameFont" if they are NULL + * at calltime. The "displayFont" is used for most text rendering and the + * "patchNameFont" is used for the patchname. * * The implementation is OS Specific. */ @@ -29,6 +29,6 @@ void initializeRuntimeFont(); ** The two extern globals we need to initialize, which are defined/created ** in SurgeGuieditor */ -extern VSTGUI::CFontRef surge_minifont; -extern VSTGUI::CFontRef surge_patchfont; -extern VSTGUI::CFontRef surge_lfofont; +extern VSTGUI::CFontRef displayFont; +extern VSTGUI::CFontRef patchNameFont; +extern VSTGUI::CFontRef lfoTypeFont; diff --git a/src/common/gui/SurgeGUIEditor.cpp b/src/common/gui/SurgeGUIEditor.cpp index c0d22f8a784..b05ece6f322 100644 --- a/src/common/gui/SurgeGUIEditor.cpp +++ b/src/common/gui/SurgeGUIEditor.cpp @@ -49,9 +49,9 @@ using namespace std; #if USE_RUNTIME_LOADED_FONTS -CFontRef surge_minifont = NULL; -CFontRef surge_patchfont = NULL; -CFontRef surge_lfofont = NULL; +CFontRef displayFont = NULL; +CFontRef patchNameFont = NULL; +CFontRef lfoTypeFont = NULL; #else #if LINUX @@ -60,9 +60,9 @@ SharedPointer patchfont = new CFontDesc("sans-serif", 14); SharedPointer lfofont = new CFontDesc("sans-serif", 8); #endif -CFontRef surge_minifont = minifont; -CFontRef surge_patchfont = patchfont; -CFontRef surge_lfofont = lfofont; +CFontRef displayFont = minifont; +CFontRef patchNameFont = patchfont; +CFontRef lfoTypeFont = lfofont; #endif @@ -163,12 +163,12 @@ SurgeGUIEditor::SurgeGUIEditor(void* effect, SurgeSynthesizer* synth) : super(ef #if USE_RUNTIME_LOADED_FONTS /* ** As documented in RuntimeFonts.h, the contract of this function is to side-effect - ** onto globals surge_minifont and surge_patchfont with valid fonts from the runtime + ** onto globals displayFont and patchNameFont with valid fonts from the runtime ** distribution */ Surge::GUI::initializeRuntimeFont(); - if (surge_minifont == NULL) + if (displayFont == NULL) { /* ** OK the runtime load didn't work. Fall back to @@ -193,8 +193,8 @@ SurgeGUIEditor::SurgeGUIEditor(void* effect, SurgeSynthesizer* synth) : super(ef SharedPointer patchfont = new CFontDesc("Arial", 14); #endif - surge_minifont = minifont; - surge_patchfont = patchfont; + displayFont = minifont; + patchNameFont = patchfont; } #endif @@ -662,7 +662,7 @@ void SurgeGUIEditor::openOrRecreateEditor() CTextLabel *Comments = new CTextLabel(CommentsRect,synth->storage.getPatch().comment.c_str()); Comments->setTransparency(true); - Comments->setFont(surge_minifont); + Comments->setFont(displayFont); Comments->setHoriAlign(kMultiLineCenterText); frame->addView(Comments); }*/ diff --git a/src/mac/RuntimeFontMac.cpp b/src/mac/RuntimeFontMac.cpp index ebb3df49ebe..15aee8ac6ed 100644 --- a/src/mac/RuntimeFontMac.cpp +++ b/src/mac/RuntimeFontMac.cpp @@ -16,7 +16,7 @@ void initializeRuntimeFont() /* ** Someone may have already initialized the globals. Don't do it twice */ - if (surge_minifont != NULL || surge_patchfont != NULL) + if (displayFont != NULL || patchNameFont != NULL) return; /* @@ -38,9 +38,9 @@ void initializeRuntimeFont() VSTGUI::SharedPointer minifont = new VSTGUI::CFontDesc("Lato", 9); VSTGUI::SharedPointer patchfont = new VSTGUI::CFontDesc("Lato", 14); VSTGUI::SharedPointer lfofont = new VSTGUI::CFontDesc("Lato", 8); - surge_minifont = minifont; - surge_patchfont = patchfont; - surge_lfofont = lfofont; + displayFont = minifont; + patchNameFont = patchfont; + lfoTypeFont = lfofont; } } diff --git a/src/windows/RuntimeFontWin.cpp b/src/windows/RuntimeFontWin.cpp index 59a6fd6887f..2fdc7347fee 100644 --- a/src/windows/RuntimeFontWin.cpp +++ b/src/windows/RuntimeFontWin.cpp @@ -51,7 +51,7 @@ void initializeRuntimeFont() /* ** Someone may have already initialized the globals. Don't do it twice */ - if (surge_minifont != NULL || surge_patchfont != NULL) + if (displayFont != NULL || patchNameFont != NULL) return; /* @@ -103,9 +103,9 @@ void initializeRuntimeFont() VSTGUI::SharedPointer minifont = new VSTGUI::CFontDesc("Lato", 9); VSTGUI::SharedPointer patchfont = new VSTGUI::CFontDesc("Lato", 14); VSTGUI::SharedPointer lfofont = new VSTGUI::CFontDesc("Lato", 8); - surge_minifont = minifont; - surge_patchfont = patchfont; - surge_lfofont = lfofont; + displayFont = minifont; + patchNameFont = patchfont; + lfoTypeFont = lfofont; } }