diff --git a/plugins/editor/CMakeLists.txt b/plugins/editor/CMakeLists.txt index 72ed7533..fa2e3b5d 100644 --- a/plugins/editor/CMakeLists.txt +++ b/plugins/editor/CMakeLists.txt @@ -3,6 +3,7 @@ include("cmake/Vstgui.cmake") set(EDITOR_RESOURCES logo.png + logo_orange.png logo_text.png logo_text_white.png logo_text_shaded.png @@ -17,6 +18,7 @@ set(EDITOR_RESOURCES knob48@2x.png Fonts/sfizz-fluentui-system-r20.ttf Fonts/sfizz-fluentui-system-f20.ttf + Fonts/sfizz-misc-icons.ttf Fonts/Roboto-Regular.ttf PARENT_SCOPE) @@ -28,6 +30,9 @@ function(copy_editor_resources SOURCE_DIR DESTINATION_DIR) endforeach() endfunction() +set(UI_FILES layout/main.fl layout/about.fl) +source_group("Editor UI" FILES ${UI_FILES}) + # editor add_library(sfizz_editor STATIC EXCLUDE_FROM_ALL src/editor/EditIds.h @@ -43,6 +48,8 @@ add_library(sfizz_editor STATIC EXCLUDE_FROM_ALL src/editor/GUIHelpers.cpp src/editor/GUIPiano.h src/editor/GUIPiano.cpp + src/editor/DlgAbout.h + src/editor/DlgAbout.cpp src/editor/ColorHelpers.h src/editor/ColorHelpers.cpp src/editor/ImageHelpers.h @@ -50,14 +57,18 @@ add_library(sfizz_editor STATIC EXCLUDE_FROM_ALL src/editor/NativeHelpers.h src/editor/NativeHelpers.cpp src/editor/layout/main.hpp + src/editor/layout/about.hpp src/editor/utility/vstgui_after.h src/editor/utility/vstgui_before.h src/editor/GitBuildId.h + ${UI_FILES} "${CMAKE_CURRENT_BINARY_DIR}/git-build-id/GitBuildId.c") add_library(sfizz::editor ALIAS sfizz_editor) target_include_directories(sfizz_editor PUBLIC "src") target_link_libraries(sfizz_editor PUBLIC sfizz::messaging sfizz::plugins-common) target_link_libraries(sfizz_editor PRIVATE sfizz::vstgui) +target_compile_definitions(sfizz_editor PRIVATE + "SFIZZ_VERSION=\"${CMAKE_PROJECT_VERSION}\"") if(APPLE) find_library(APPLE_APPKIT_LIBRARY "AppKit") find_library(APPLE_CORESERVICES_LIBRARY "CoreServices") @@ -101,12 +112,14 @@ if(NOT CMAKE_CROSSCOMPILING) "tools/layout-maker/sources/main.cpp") target_link_libraries(layout-maker PRIVATE absl::strings) - add_custom_command( - OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/src/editor/layout/main.hpp" - COMMAND "$" - "${CMAKE_CURRENT_SOURCE_DIR}/layout/main.fl" - > "${CMAKE_CURRENT_SOURCE_DIR}/src/editor/layout/main.hpp" - DEPENDS layout-maker "${CMAKE_CURRENT_SOURCE_DIR}/layout/main.fl") + foreach(_layout main about) + add_custom_command( + OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/src/editor/layout/${_layout}.hpp" + COMMAND "$" + "${CMAKE_CURRENT_SOURCE_DIR}/layout/${_layout}.fl" + > "${CMAKE_CURRENT_SOURCE_DIR}/src/editor/layout/${_layout}.hpp" + DEPENDS layout-maker "${CMAKE_CURRENT_SOURCE_DIR}/layout/${_layout}.fl") + endforeach() endif() # git build identifier diff --git a/plugins/editor/layout/about.fl b/plugins/editor/layout/about.fl new file mode 100644 index 00000000..b268da03 --- /dev/null +++ b/plugins/editor/layout/about.fl @@ -0,0 +1,50 @@ +# data file for the Fltk User Interface Designer (fluid) +version 1.0305 +header_name {.h} +code_name {.cxx} +widget_class aboutView { + label {About sfizz} open selected + xywh {536 183 800 475} type Double visible +} { + Fl_Box {} { + image {../resources/logo_orange.png} xywh {200 80 400 180} + class Logo + } + Fl_Button {} { + comment {tag=kTagButtonSfztools} + xywh {235 45 50 50} labelsize 30 + class ButtonSfztools + } + Fl_Button {} { + comment {tag=kTagButtonGithub} + xywh {305 45 50 50} labelsize 30 + class ButtonGithub + } + Fl_Button {} { + comment {tag=kTagButtonDiscord} + xywh {375 45 50 50} labelsize 30 + class ButtonDiscord + } + Fl_Button {} { + comment {tag=kTagButtonOpencollective} + xywh {445 45 50 50} labelsize 30 + class ButtonOpencollective + } + Fl_Button {} { + comment {tag=kTagButtonSfzformat} + xywh {515 45 50 50} labelsize 30 + class ButtonSfzformat + } + Fl_Box {} { + xywh {260 260 280 80} + class InfoBox + } + Fl_Box {} { + xywh {200 350 400 100} + class DescriptionBox + } + Fl_Box lblHover_ { + xywh {320 10 160 25} + class HoverBox + } +} diff --git a/plugins/editor/layout/main.fl b/plugins/editor/layout/main.fl index 79a81892..e1d0e7fa 100644 --- a/plugins/editor/layout/main.fl +++ b/plugins/editor/layout/main.fl @@ -3,7 +3,7 @@ version 1.0305 header_name {.h} code_name {.cxx} widget_class mainView {open - xywh {659 319 800 475} type Double + xywh {353 221 800 475} type Double class LogicalGroup visible } { Fl_Box imageContainer_ { @@ -20,9 +20,9 @@ widget_class mainView {open class RoundedGroup } { Fl_Box {} { - comment {tag=kTagFirstChangePanel+kPanelGeneral} + comment {tag=kTagAbout} selected image {../resources/logo_text_shaded.png} xywh {35 9 120 60} - class SfizzMainButton + class AboutButton } Fl_Button {} { comment {tag=kTagFirstChangePanel+kPanelGeneral} @@ -140,7 +140,7 @@ widget_class mainView {open } Fl_Box volumeCCKnob_ { label Volume - comment {tag=kTagSetCCVolume} selected + comment {tag=kTagSetCCVolume} xywh {580 10 70 90} box BORDER_BOX labelsize 12 align 17 class KnobCCBox } diff --git a/plugins/editor/resources/Fonts/sfizz-misc-icons.ttf b/plugins/editor/resources/Fonts/sfizz-misc-icons.ttf new file mode 100644 index 00000000..6f40464e Binary files /dev/null and b/plugins/editor/resources/Fonts/sfizz-misc-icons.ttf differ diff --git a/plugins/editor/resources/logo_orange.png b/plugins/editor/resources/logo_orange.png new file mode 100644 index 00000000..e765347b Binary files /dev/null and b/plugins/editor/resources/logo_orange.png differ diff --git a/plugins/editor/resources/logo_orange.svg b/plugins/editor/resources/logo_orange.svg new file mode 100644 index 00000000..bb249725 --- /dev/null +++ b/plugins/editor/resources/logo_orange.svg @@ -0,0 +1,246 @@ + + + sfizz logo + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + sfizz logo + 2020-05-16 + + + Tobiasz 'unfa' Karoń + + + + + CC-0 + + + + + + + + + + + + + + + diff --git a/plugins/editor/resources/logo_orange@2x.png b/plugins/editor/resources/logo_orange@2x.png new file mode 100644 index 00000000..fde46dda Binary files /dev/null and b/plugins/editor/resources/logo_orange@2x.png differ diff --git a/plugins/editor/src/editor/DlgAbout.cpp b/plugins/editor/src/editor/DlgAbout.cpp new file mode 100644 index 00000000..17157b12 --- /dev/null +++ b/plugins/editor/src/editor/DlgAbout.cpp @@ -0,0 +1,189 @@ +// SPDX-License-Identifier: BSD-2-Clause + +// This code is part of the sfizz library and is licensed under a BSD 2-clause +// license. You should have receive a LICENSE.md file along with the code. +// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz + +#include "DlgAbout.h" +#include "GUIComponents.h" +#include "GitBuildId.h" +#include "NativeHelpers.h" + +#include "utility/vstgui_before.h" +#include "vstgui/vstgui.h" +#include "utility/vstgui_after.h" + +#include + +SAboutDialog::SAboutDialog(const CRect& bounds) + : CViewContainer(bounds) +{ + SharedPointer logo = owned(new CBitmap("logo_orange.png")); + setBackgroundColor(CColor(0x00, 0x00, 0x00, 0xc0)); + + CView* aboutView = nullptr; + { + auto createaboutView = [](const CRect& bounds, int, const char*, CHoriTxtAlign, int) { + CViewContainer* container = new CViewContainer(bounds); + container->setBackgroundColor(CColor(0x00, 0x00, 0x00, 0x00)); + return container; + }; + + auto createLogo = [&logo](const CRect& bounds, int, const char*, CHoriTxtAlign, int) { + CViewContainer* container = new CViewContainer(bounds); + container->setBackgroundColor(CColor(0x00, 0x00, 0x00, 0x00)); + container->setBackground(logo); + return container; + }; + + auto createInfoBox = [](const CRect& bounds, int, const char*, CHoriTxtAlign align, int fontsize) { + CMultiLineTextLabel* lbl = new CMultiLineTextLabel(bounds); + auto font = makeOwned("Roboto", fontsize); + lbl->setFont(font); + lbl->setFontColor(CColor(0xff, 0xff, 0xff, 0xff)); + lbl->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00)); + lbl->setBackColor(CColor(0x00, 0x00, 0x00, 0x00)); + lbl->setHoriAlign(align); + + const char* version = SFIZZ_VERSION; + std::string versionBuf; + if (GitBuildId[0]) { + versionBuf = absl::StrCat(SFIZZ_VERSION ".", GitBuildId); + version = versionBuf.c_str(); + } + lbl->setText(absl::StrCat( + u8"Version ", version, u8"\n" + u8"Copyright 2019-2021 by SFZTools Team,\n" + u8"licensed under BSD 2-clause license.")); + return lbl; + }; + + auto createDescriptionBox = [](const CRect& bounds, int, const char*, CHoriTxtAlign align, int fontsize) { + CMultiLineTextLabel* lbl = new CMultiLineTextLabel(bounds); + auto font = makeOwned("Roboto", fontsize); + lbl->setFont(font); + lbl->setFontColor(CColor(0xff, 0xff, 0xff, 0xff)); + lbl->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00)); + lbl->setBackColor(CColor(0x00, 0x00, 0x00, 0x00)); + lbl->setHoriAlign(align); + lbl->setText(absl::StrCat( + u8"Maintainers: Paul Ferrand, Jean-Pierre Cimalando\n""" + u8"Contributors: Andrea Zanellato, Alexander Mitchell, Michael Willis,\n" + u8"Tobiasz \"unfa\" Karoń, Kinwie, Atsushi Eno, Dominique Würtz et al.")); + return lbl; + }; + + auto createHoverBox = [](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) { + CTextLabel* lbl = new CTextLabel(bounds, label); + auto font = makeOwned("Roboto", fontsize); + lbl->setFontColor(CColor(0xff, 0xff, 0xff, 0xff)); + lbl->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00)); + lbl->setBackColor(CColor(0x00, 0x00, 0x00, 0x00)); + lbl->setHoriAlign(align); + lbl->setFont(font); + return lbl; + }; + + auto createGlyphButton = [this](UTF8StringPtr glyph, const CRect& bounds, int tag, int fontsize) { + STextButton* btn = new STextButton(bounds, this, tag, glyph); + btn->setFont(makeOwned("Sfizz Misc Icons", fontsize)); + btn->setTextColor(kWhiteCColor); + btn->setHoverColor(CColor(0xfd, 0x98, 0x00, 0xff)); + btn->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00)); + btn->setFrameColorHighlighted(CColor(0x00, 0x00, 0x00, 0x00)); + btn->setGradient(nullptr); + btn->setGradientHighlighted(nullptr); + return btn; + }; + auto createButtonSfztools = [&createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) { + return createGlyphButton(u8"\ue000", bounds, tag, fontsize); + }; + auto createButtonGithub = [&createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) { + return createGlyphButton(u8"\ue001", bounds, tag, fontsize); + }; + auto createButtonDiscord = [&createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) { + return createGlyphButton(u8"\ue002", bounds, tag, fontsize); + }; + auto createButtonOpencollective = [&createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) { + return createGlyphButton(u8"\ue003", bounds, tag, fontsize); + }; + auto createButtonSfzformat = [&createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) { + return createGlyphButton(u8"\ue004", bounds, tag, fontsize); + }; + + #include "layout/about.hpp" + } + addView(aboutView); + + CRect aboutBounds = aboutView->getViewSize(); + aboutBounds.centerInside(CRect(bounds).originize()); + aboutView->setViewSize(aboutBounds); +} + +CMouseEventResult SAboutDialog::onMouseDown(CPoint& where, const CButtonState& buttons) +{ + CMouseEventResult result = CViewContainer::onMouseDown(where, buttons); + + if (result != kMouseEventHandled) { + setVisible(false); + result = kMouseEventHandled; + } + + return result; +} + +void SAboutDialog::valueChanged(CControl *ctl) +{ + int32_t tag = ctl->getTag(); + float value = ctl->getValue(); + + switch (tag) { + case kTagButtonSfztools: + if (value != 1) + break; + + Call::later([]() { + openURLWithExternalProgram("https://sfz.tools/sfizz/"); + }); + break; + + case kTagButtonGithub: + if (value != 1) + break; + + Call::later([]() { + openURLWithExternalProgram("https://github.com/sfztools/sfizz"); + }); + break; + + case kTagButtonDiscord: + if (value != 1) + break; + + Call::later([]() { + openURLWithExternalProgram("https://discord.gg/3ArE9Mw"); + }); + break; + + case kTagButtonOpencollective: + if (value != 1) + break; + + Call::later([]() { + openURLWithExternalProgram("https://opencollective.com/sfztools"); + }); + break; + + case kTagButtonSfzformat: + if (value != 1) + break; + + Call::later([]() { + openURLWithExternalProgram("https://sfzformat.com/"); + }); + break; + + default: + break; + } +} diff --git a/plugins/editor/src/editor/DlgAbout.h b/plugins/editor/src/editor/DlgAbout.h new file mode 100644 index 00000000..e7d621d8 --- /dev/null +++ b/plugins/editor/src/editor/DlgAbout.h @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: BSD-2-Clause + +// This code is part of the sfizz library and is licensed under a BSD 2-clause +// license. You should have receive a LICENSE.md file along with the code. +// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz + +#pragma once +#include "utility/vstgui_before.h" +#include "vstgui/lib/cviewcontainer.h" +#include "vstgui/vstgui.h" +#include "utility/vstgui_after.h" + +using namespace VSTGUI; + +class SAboutDialog : public CViewContainer, public IControlListener { + + enum { + kTagButtonSfztools, + kTagButtonGithub, + kTagButtonDiscord, + kTagButtonOpencollective, + kTagButtonSfzformat + }; + +public: + explicit SAboutDialog(const CRect& bounds); + +protected: + CMouseEventResult onMouseDown(CPoint& where, const CButtonState& buttons) override; + + // IControlListener + void valueChanged(CControl* ctl) override; + + CTextLabel* lblHover_ = {}; +}; diff --git a/plugins/editor/src/editor/Editor.cpp b/plugins/editor/src/editor/Editor.cpp index 58daba6c..e8bcf7b7 100644 --- a/plugins/editor/src/editor/Editor.cpp +++ b/plugins/editor/src/editor/Editor.cpp @@ -10,6 +10,7 @@ #include "GUIComponents.h" #include "GUIHelpers.h" #include "GUIPiano.h" +#include "DlgAbout.h" #include "ImageHelpers.h" #include "NativeHelpers.h" #include "BitArray.h" @@ -86,6 +87,7 @@ struct Editor::Impl : EditorController::Receiver, IControlListener { kTagSetCCVolume, kTagSetCCPan, kTagChooseUserFilesDir, + kTagAbout, kTagFirstChangePanel, kTagLastChangePanel = kTagFirstChangePanel + kNumPanels - 1, }; @@ -136,6 +138,8 @@ struct Editor::Impl : EditorController::Receiver, IControlListener { SKnobCCBox* volumeCCKnob_ = nullptr; SKnobCCBox* panCCKnob_ = nullptr; + SAboutDialog* aboutDialog_ = nullptr; + SharedPointer backgroundBitmap_; SharedPointer defaultBackgroundBitmap_; @@ -641,7 +645,7 @@ void Editor::Impl::createFrameContents() box->setTitleFont(font); return box; }; - auto createSfizzMainButton = [this, &iconShaded](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) { + auto createAboutButton = [this, &iconShaded](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) { return new CKickButton(bounds, this, tag, iconShaded); }; auto createLabel = [&theme](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) { @@ -886,6 +890,12 @@ void Editor::Impl::createFrameContents() mainView_ = owned(mainView); } + /// + SAboutDialog* aboutDialog = new SAboutDialog(mainView->getViewSize()); + mainView->addView(aboutDialog); + aboutDialog_ = aboutDialog; + aboutDialog->setVisible(false); + /// SharedPointer fileDropTarget = owned(new SFileDropTarget); @@ -1777,6 +1787,13 @@ void Editor::Impl::valueChanged(CControl* ctl) Call::later([this]() { chooseUserFilesDir(); }); break; + case kTagAbout: + if (value != 1) + break; + + Call::later([this]() { aboutDialog_->setVisible(true); }); + break; + default: if (tag >= kTagFirstChangePanel && tag <= kTagLastChangePanel) { int panelId = tag - kTagFirstChangePanel; diff --git a/plugins/editor/src/editor/NativeHelpers.cpp b/plugins/editor/src/editor/NativeHelpers.cpp index 393c3f8b..ab9af708 100644 --- a/plugins/editor/src/editor/NativeHelpers.cpp +++ b/plugins/editor/src/editor/NativeHelpers.cpp @@ -54,6 +54,21 @@ bool openDirectoryInExplorer(const char *filename) return ShellExecuteExW(&info); } +bool openURLWithExternalProgram(const char *url) +{ + std::wstring path = stringToWideChar(url); + + SHELLEXECUTEINFOW info; + memset(&info, 0, sizeof(info)); + + info.cbSize = sizeof(info); + info.lpVerb = L"open"; + info.lpFile = path.c_str(); + info.nShow = SW_SHOW; + + return ShellExecuteExW(&info); +} + bool askQuestion(const char *text) { int ret = MessageBoxW(nullptr, stringToWideChar(text), L"Question", MB_YESNO); @@ -97,6 +112,12 @@ bool openDirectoryInExplorer(const char *filename) return openFileByMimeType(filename, "inode/directory"); } +bool openURLWithExternalProgram(const char *url) +{ + gboolean success = g_app_info_launch_default_for_uri(url, nullptr, nullptr); + return success == TRUE; +} + static std::vector createForkEnviron() { std::vector newEnv; diff --git a/plugins/editor/src/editor/NativeHelpers.h b/plugins/editor/src/editor/NativeHelpers.h index 92201d85..41c52a72 100644 --- a/plugins/editor/src/editor/NativeHelpers.h +++ b/plugins/editor/src/editor/NativeHelpers.h @@ -8,6 +8,7 @@ bool openFileInExternalEditor(const char *filename); bool openDirectoryInExplorer(const char *filename); +bool openURLWithExternalProgram(const char *url); bool askQuestion(const char *text); #if !defined(_WIN32) && !defined(__APPLE__) diff --git a/plugins/editor/src/editor/NativeHelpers.mm b/plugins/editor/src/editor/NativeHelpers.mm index 56c1143d..0db886fd 100644 --- a/plugins/editor/src/editor/NativeHelpers.mm +++ b/plugins/editor/src/editor/NativeHelpers.mm @@ -32,6 +32,13 @@ bool openDirectoryInExplorer(const char *fileName) return openFileWithApplication(fileName, @"Finder"); } +bool openURLWithExternalProgram(const char *url) +{ + NSWorkspace* workspace = [NSWorkspace sharedWorkspace]; + NSURL* urlNs = [NSURL URLWithString:[NSString stringWithUTF8String:url]]; + return [workspace openURL:urlNs] == YES; +} + bool askQuestion(const char *text) { NSAlert *alert = [[NSAlert alloc] init]; diff --git a/plugins/editor/src/editor/layout/about.hpp b/plugins/editor/src/editor/layout/about.hpp new file mode 100644 index 00000000..80a487aa --- /dev/null +++ b/plugins/editor/src/editor/layout/about.hpp @@ -0,0 +1,22 @@ +/* This file is generated by the layout maker tool. */ +auto* const view__0 = createaboutView(CRect(0, 0, 800, 475), -1, "About sfizz", kCenterText, 14); +aboutView = view__0; +auto* const view__1 = createLogo(CRect(200, 80, 600, 260), -1, "", kCenterText, 14); +view__0->addView(view__1); +auto* const view__2 = createButtonSfztools(CRect(235, 45, 285, 95), kTagButtonSfztools, "", kCenterText, 30); +view__0->addView(view__2); +auto* const view__3 = createButtonGithub(CRect(305, 45, 355, 95), kTagButtonGithub, "", kCenterText, 30); +view__0->addView(view__3); +auto* const view__4 = createButtonDiscord(CRect(375, 45, 425, 95), kTagButtonDiscord, "", kCenterText, 30); +view__0->addView(view__4); +auto* const view__5 = createButtonOpencollective(CRect(445, 45, 495, 95), kTagButtonOpencollective, "", kCenterText, 30); +view__0->addView(view__5); +auto* const view__6 = createButtonSfzformat(CRect(515, 45, 565, 95), kTagButtonSfzformat, "", kCenterText, 30); +view__0->addView(view__6); +auto* const view__7 = createInfoBox(CRect(260, 260, 540, 340), -1, "", kCenterText, 14); +view__0->addView(view__7); +auto* const view__8 = createDescriptionBox(CRect(200, 350, 600, 450), -1, "", kCenterText, 14); +view__0->addView(view__8); +auto* const view__9 = createHoverBox(CRect(320, 10, 480, 35), -1, "", kCenterText, 14); +lblHover_ = view__9; +view__0->addView(view__9); diff --git a/plugins/editor/src/editor/layout/main.hpp b/plugins/editor/src/editor/layout/main.hpp index 49026627..e4d99bb5 100644 --- a/plugins/editor/src/editor/layout/main.hpp +++ b/plugins/editor/src/editor/layout/main.hpp @@ -9,7 +9,7 @@ auto* const view__2 = createLogicalGroup(CRect(0, 0, 800, 110), -1, "", kCenterT view__0->addView(view__2); auto* const view__3 = createRoundedGroup(CRect(5, 4, 180, 105), -1, "", kCenterText, 14); view__2->addView(view__3); -auto* const view__4 = createSfizzMainButton(CRect(30, 5, 150, 65), kTagFirstChangePanel+kPanelGeneral, "", kCenterText, 14); +auto* const view__4 = createAboutButton(CRect(30, 5, 150, 65), kTagAbout, "", kCenterText, 14); view__3->addView(view__4); auto* const view__5 = createHomeButton(CRect(31, 69, 63, 101), kTagFirstChangePanel+kPanelGeneral, "", kCenterText, 30); view__3->addView(view__5); diff --git a/scripts/generate_ui_fonts.sh b/scripts/generate_ui_fonts.sh index 9cb1555c..ff732e11 100755 --- a/scripts/generate_ui_fonts.sh +++ b/scripts/generate_ui_fonts.sh @@ -9,6 +9,11 @@ fi root="`pwd`" fonts="$root/plugins/editor/resources/Fonts" +cd scripts/misc-icons/ +./generate_icons_font.py +mv -f sfizz-misc-icons.ttf "$fonts" +cd ../../ + if test ! -d plugins/editor/external/fluentui-system-icons; then cd plugins/editor/external git clone https://github.com/sfztools/fluentui-system-icons.git diff --git a/scripts/innosetup.iss.in b/scripts/innosetup.iss.in index 70dc76d8..577376fa 100644 --- a/scripts/innosetup.iss.in +++ b/scripts/innosetup.iss.in @@ -64,6 +64,7 @@ Source: "sfizz.vst3\gpl-3.0.txt"; Components: main; DestDir: "{app}" ; Note(sfizz): OS older than Windows 10 require UI fonts to be installed system-wide Source: "sfizz.vst3\Contents\Resources\Fonts\sfizz-fluentui-system-r20.ttf"; DestDir: "{fonts}"; FontInstall: "Sfizz Fluent System R20"; Flags: uninsneveruninstall; OnlyBelowVersion: 6.4 Source: "sfizz.vst3\Contents\Resources\Fonts\sfizz-fluentui-system-f20.ttf"; DestDir: "{fonts}"; FontInstall: "Sfizz Fluent System F20"; Flags: uninsneveruninstall; OnlyBelowVersion: 6.4 +Source: "sfizz.vst3\Contents\Resources\Fonts\sfizz-misc-icons.ttf"; DestDir: "{fonts}"; FontInstall: "Sfizz Misc Icons"; Flags: uninsneveruninstall; OnlyBelowVersion: 6.4 Source: "sfizz.vst3\Contents\Resources\Fonts\Roboto-Regular.ttf"; DestDir: "{fonts}"; FontInstall: "Roboto Regular"; Flags: uninsneveruninstall; OnlyBelowVersion: 6.4 ;Source: "setup\vc_redist.x64.exe"; DestDir: {tmp}; Flags: deleteafterinstall ; NOTE: Don't use "Flags: ignoreversion" on any shared system files diff --git a/scripts/misc-icons/LICENSE.md b/scripts/misc-icons/LICENSE.md new file mode 100644 index 00000000..da5b8879 --- /dev/null +++ b/scripts/misc-icons/LICENSE.md @@ -0,0 +1,30 @@ +# CC0 1.0 Universal + +## Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an “owner”) of an original work of authorship and/or a database (each, a “Work”). + +Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works (“Commons”) that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the “Affirmer”), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights (“Copyright and Related Rights”). Copyright and Related Rights include, but are not limited to, the following: + 1. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; + 2. moral rights retained by the original author(s) and/or performer(s); + 3. publicity and privacy rights pertaining to a person’s image or likeness depicted in a Work; + 4. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(i), below; + 5. rights protecting the extraction, dissemination, use and reuse of data in a Work; + 6. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and + 7. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer’s Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the “Waiver”). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer’s heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer’s express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer’s express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer’s Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the “License”). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer’s express Statement of Purpose. + +4. Limitations and Disclaimers. + 1. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document. + 2. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law. + 3. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person’s Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work. + 4. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work. + +For more information, please see http://creativecommons.org/publicdomain/zero/1.0/. diff --git a/scripts/misc-icons/README.md b/scripts/misc-icons/README.md new file mode 100644 index 00000000..33061e0a --- /dev/null +++ b/scripts/misc-icons/README.md @@ -0,0 +1,14 @@ +# Misc Icons + +Currently these SVG icons are used in the about dialog, the script with the json +to generate the related truetype font. + +The GitHub, Discord and Open Collective SVG comes from the [Simple Icons] +collection. + +All the icons are licensed under the [Creative Common 0 License], +see the included [license] file. + +[license]: LICENSE.md +[Simple Icons]: https://github.com/simple-icons/simple-icons/ +[Creative Common 0 License]: https://creativecommons.org/publicdomain/zero/1.0/ diff --git a/scripts/misc-icons/generate_icons_font.json b/scripts/misc-icons/generate_icons_font.json new file mode 100644 index 00000000..ea09d7a1 --- /dev/null +++ b/scripts/misc-icons/generate_icons_font.json @@ -0,0 +1,9 @@ +{ + "glyph_map": { + "0xe000": "sfztools", + "0xe001": "github", + "0xe002": "discord", + "0xe003": "opencollective", + "0xe004": "sfzformat" + } +} diff --git a/scripts/misc-icons/generate_icons_font.py b/scripts/misc-icons/generate_icons_font.py new file mode 100755 index 00000000..a17d5a48 --- /dev/null +++ b/scripts/misc-icons/generate_icons_font.py @@ -0,0 +1,54 @@ +#!/usr/bin/fontforge + +import fontforge +import optparse +import json +import os +import sys + +CONFIG_FILE = os.path.splitext(__file__)[0] + '.json' +DATA = json.load(open(CONFIG_FILE)) + +def main(): + parser = optparse.OptionParser() + parser.add_option("-o", dest="output", + help="set the output file", + metavar="output") + parser.add_option("-n", dest="name", + help="set the font name", + metavar="name") + + (options, args) = parser.parse_args() + + output = options.output + name = options.name + + if output is None: + output = 'sfizz-misc-icons.ttf' + if name is None: + name = 'Sfizz Misc Icons' + + ### + sys.stderr.write('* Font name: %s\n' % (name)) + sys.stderr.write('* Output to: %s\n' % (output)) + + ### + font = fontforge.font() + font.familyname = name + font.fullname = name + font.descent = 0 + + for (unicode, asset_name) in DATA['glyph_map'].items(): + unicode = int(unicode, 16) + asset_path = 'icons/%s.svg' % (asset_name) + + glyph = font.createChar(unicode) + glyph.importOutlines(asset_path) + glyph.width = 800 + glyph.vwidth = 800 + + #font.save('sfizz-misc-icons.sfd') + font.generate(output) + +if __name__ == '__main__': + main() diff --git a/scripts/misc-icons/icons/discord.svg b/scripts/misc-icons/icons/discord.svg new file mode 100644 index 00000000..85d98498 --- /dev/null +++ b/scripts/misc-icons/icons/discord.svg @@ -0,0 +1 @@ +Discord icon \ No newline at end of file diff --git a/scripts/misc-icons/icons/github.svg b/scripts/misc-icons/icons/github.svg new file mode 100644 index 00000000..38997125 --- /dev/null +++ b/scripts/misc-icons/icons/github.svg @@ -0,0 +1 @@ +GitHub icon \ No newline at end of file diff --git a/scripts/misc-icons/icons/opencollective.svg b/scripts/misc-icons/icons/opencollective.svg new file mode 100644 index 00000000..ba98a24c --- /dev/null +++ b/scripts/misc-icons/icons/opencollective.svg @@ -0,0 +1 @@ +Open Collective icon \ No newline at end of file diff --git a/scripts/misc-icons/icons/sfzformat.svg b/scripts/misc-icons/icons/sfzformat.svg new file mode 100644 index 00000000..490e15d7 --- /dev/null +++ b/scripts/misc-icons/icons/sfzformat.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/scripts/misc-icons/icons/sfztools.svg b/scripts/misc-icons/icons/sfztools.svg new file mode 100644 index 00000000..67f62bdf --- /dev/null +++ b/scripts/misc-icons/icons/sfztools.svg @@ -0,0 +1,11 @@ + + + + + + + + + + +