Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: be384c532f
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 162 lines (153 sloc) 4.8 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
//=============================================================================
// MuseScore
// Linux Music Score Editor
// $Id: icons.cpp 5246 2012-01-24 18:48:55Z wschweer $
//
// Copyright (C) 2002-2007 Werner Schweer and others
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================

#include "globals.h"
#include "icons.h"
#include "libmscore/score.h"
#include "libmscore/style.h"
#include "preferences.h"
#include "libmscore/sym.h"
#include "libmscore/mscore.h"

extern QString iconPath, iconGroup;
QIcon* icons[ICONS];

//---------------------------------------------------------
// genIcons
// create some icons
//---------------------------------------------------------

static const char* iconNames[] = {
      "longaUp.svg",
      "brevis.svg",
      "note.svg",
      "note2.svg",
      "note4.svg",
      "note8.svg",
      "note16.svg",
      "note32.svg",
      "note64.svg",
      "note128.svg",
      "natural.svg",
      "sharp.svg",
      "sharpsharp.svg",
      "flat.svg",
      "flatflat.svg",
      "staccato.svg",
      "quartrest.svg",
      "dot.svg",
      "dotdot.svg",
      "sforzatoaccent.svg",
      "tenuto.svg",
      "plus.svg",
      "flip.svg",
      "undo.svg",
      "redo.svg",
      "editcut.svg",
      "editcopy.svg",
      "editpaste.svg",
      "fileprint.svg",
      "clef.svg",
      "midiin.svg",
      "speaker.svg",
      "start.svg",
      "play.svg",
      "repeat.svg",
      "pan.svg",
      "sbeam.svg",
      "mbeam.svg",
      "nbeam.svg",
      "beam32.svg",
      "beam64.svg",
      "abeam.svg",
      "fbeam1.svg",
      "fbeam2.svg",
      "fileopen.svg",
      "filenew.svg",
      "filesave.svg",
      "filesaveas.svg",
      "exit.svg",
      "viewmag.svg",
      "mscore.png",
      "acciaccatura.svg",
      "appoggiatura.svg",
      "grace4.svg",
      "grace8b.svg",
      "grace16.svg",
      "grace32.svg",
      "noteentry.svg",
      "keyboard.svg",
      "tie.svg",
      "format_text_bold.svgz",
      "format_text_italic.svgz",
      "format_text_underline.svgz",
      "text_left.svg",
      "text_center.svg",
      "text_right.svg",
      "text_top.svg",
      "text_bottom.svg",
      "text_vcenter.svg",
      "format_text_superscript.svgz",
      "format_text_subscript.svgz",
      "fotomode.svg",
      "hraster.svg",
      "vraster.svg",
      "repitch.svg",
      "format_list_unordered.svgz",
      "format_list_ordered.svgz",
      "format_indent_more.svgz",
      "format_indent_less.svgz",
      "community.svg",
      "metronome.svg",
      "vframe.svg",
      "hframe.svg",
      "tframe.svg",
      "fframe.svg",
      "measure.svg",
      };

void genIcons()
      {
// qDebug("genIcons <%s>\n", qPrintable(iconPath + iconGroup));
      for (int i = 0; i < voice1_ICON; ++i) {
            icons[i] = new QIcon(iconPath + iconGroup + iconNames[i]);
            if (icons[i]->isNull() || icons[i]->pixmap(12).isNull()) {
                  qDebug("cannot load Icon <%s>\n", qPrintable(iconPath + iconGroup + iconNames[i]));
                  }
            }

      static const char* vtext[VOICES] = { "1","2","3","4" };
      int iw = preferences.iconHeight * 2 / 3; // 16;
      int ih = preferences.iconHeight; // 24;
      for (int i = 0; i < VOICES; ++i) {
            icons[voice1_ICON + i] = new QIcon;
            QPixmap image(iw, ih);
            QColor c(MScore::selectColor[i].light(180));
            image.fill(c);
            QPainter painter(&image);
            painter.setFont(QFont("FreeSans", 8));
            painter.setRenderHint(QPainter::Antialiasing);
            painter.setPen(QPen(Qt::black));
            painter.drawText(QRect(0, 0, iw, ih), Qt::AlignCenter, vtext[i]);
            painter.end();
            icons[voice1_ICON +i]->addPixmap(image);

            painter.begin(&image);
            c = QColor(MScore::selectColor[i].light(140));
            painter.fillRect(0, 0, iw, ih, c);
            painter.setPen(QPen(Qt::black));
            painter.drawText(QRect(0, 0, iw, ih), Qt::AlignCenter, vtext[i]);
            painter.end();
            icons[voice1_ICON + i]->addPixmap(image, QIcon::Normal, QIcon::On);
            }
      }

Something went wrong with that request. Please try again.