Ejemplo n.º 1
0
TextPalette::TextPalette(QWidget* parent)
   : QWidget(parent)
      {
      setWindowFlags(Qt::Tool);
      setupUi(this);

      codePage->setEnabled(false);

      pCommon = new Palette;
      pCommon->setName(QT_TRANSLATE_NOOP("Palette", "common symbols"));
      pCommon->setMag(0.8);
      pCommon->setGrid(33, 60);
      pCommon->setReadOnly(true);

      pAll = new Palette;
      pAll->setName(QT_TRANSLATE_NOOP("Palette", "all font symbols"));
      pAll->setMag(0.8);
      pAll->setGrid(33, 60);
      pAll->setReadOnly(true);

      PaletteScrollArea* psa = new PaletteScrollArea(pCommon);
      psa->setRestrictHeight(false);
      stack->addWidget(psa);

      psa = new PaletteScrollArea(pAll);
      psa->setRestrictHeight(false);
      stack->addWidget(psa);

      connect(commonButton,  SIGNAL(toggled(bool)),       SLOT(commonToggled(bool)));
      connect(stack,         SIGNAL(currentChanged(int)), SLOT(pageChanged(int)));
      connect(codePage,      SIGNAL(valueChanged(int)),   SLOT(populateAll()));
      setFocusPolicy(Qt::NoFocus);
      }
Ejemplo n.º 2
0
void MasterPalette::addPalette(Palette* sp)
      {
      sp->setReadOnly(true);
      PaletteScrollArea* psa = new PaletteScrollArea(sp);
      psa->setRestrictHeight(false);
      stack->addWidget(psa);
      }
Ejemplo n.º 3
0
void MasterPalette::addPalette(Palette* sp)
      {
      sp->setReadOnly(true);
      PaletteScrollArea* psa = new PaletteScrollArea(sp);
      psa->setRestrictHeight(false);
      QTreeWidgetItem* item = new QTreeWidgetItem(QStringList(sp->name()));
      item->setData(0, Qt::UserRole, stack->count());
      stack->addWidget(psa);
      treeWidget->addTopLevelItem(item);
      }
Ejemplo n.º 4
0
Palette* MasterPalette::createPalette(int w, int h, bool grid, double mag)
      {
      Palette* sp = new Palette;
      PaletteScrollArea* psa = new PaletteScrollArea(sp);
      psa->setRestrictHeight(false);
      sp->setMag(mag);
      sp->setGrid(w, h);
      sp->setDrawGrid(grid);
      sp->setReadOnly(true);
      stack->addWidget(psa);
      return sp;
      }
Ejemplo n.º 5
0
void ChordStyleEditor::setChordList(ChordList* cl)
      {
      harmonyList->clear();
      foreach (const ChordDescription& d, *cl) {
            QTreeWidgetItem* item = new QTreeWidgetItem;
            item->setData(0, Qt::UserRole, QVariant::fromValue<void*>((void*)&d));
            item->setText(0, QString("%1").arg(d.id));
            if (!d.names.isEmpty())
                  item->setText(1, QString("%1").arg(d.names.front()));
            harmonyList->addTopLevelItem(item);
            }
      delete chordList;
      chordList = new ChordList(*cl);
      canvas->setChordDescription(0, 0);

      paletteTab->clear();
      foreach(const ChordFont& f, chordList->fonts) {
            // create symbol palette
            Palette* p = new Palette();
            PaletteScrollArea* accPalette = new PaletteScrollArea(p);
            QSizePolicy policy1(QSizePolicy::Expanding, QSizePolicy::Expanding);
            accPalette->setSizePolicy(policy1);
            accPalette->setRestrictHeight(false);
            p->setGrid(50, 50);
            paletteTab->addTab(accPalette, f.family);
            QFont qf(f.family);
            qf.setStyleStrategy(QFont::NoFontMerging);
            int size = lrint(20.0 * DPI / PPI);
            qf.setPixelSize(size);

            QFontMetricsF fi(qf);
            for (int i = 0; i < 255; ++i) {
                  if (fi.inFont(QChar(i))) {
                        FSymbol* s = new FSymbol(gscore);
                        s->setFont(qf);
                        s->setCode(i);
                        p->append(s, "??");
                        }
                  }
            }
      raise();
      }
Ejemplo n.º 6
0
TextPalette::TextPalette(QWidget* parent)
   : QWidget(parent)
      {
      setWindowFlags(Qt::Tool);
      setupUi(this);

      pCommon = new Palette;
      pCommon->setMag(0.8);
      pCommon->setGrid(33, 60);
      pCommon->setReadOnly(true);

      pSmufl = new Palette;
      pSmufl->setMag(0.8);
      pSmufl->setGrid(33, 60);
      pSmufl->setReadOnly(true);

      pUnicode = new Palette;
      pUnicode->setMag(0.8);
      pUnicode->setGrid(33, 60);
      pUnicode->setReadOnly(true);

      PaletteScrollArea* psa = new PaletteScrollArea(pCommon);
      psa->setRestrictHeight(false);

      tabWidget->clear();
      tabWidget->addTab(psa, tr("Common Symbols"));

      psa = new PaletteScrollArea(pSmufl);
      psa->setRestrictHeight(false);

      QSplitter* ws = new QSplitter;
      lws = new QListWidget;

      ScoreFont* scoreFont = ScoreFont::fontFactory("Bravura");
      QFile fi(scoreFont->fontPath() + "ranges.json");
      if (!fi.open(QIODevice::ReadOnly))
            qDebug("ScoreFont: open ranges file <%s> failed", qPrintable(fi.fileName()));
      QJsonParseError error;
      QJsonObject o = QJsonDocument::fromJson(fi.readAll(), &error).object();
      if (error.error != QJsonParseError::NoError)
            qDebug("Json parse error in <%s>(offset: %d): %s", qPrintable(fi.fileName()),
               error.offset, qPrintable(error.errorString()));
	int i = 0;
      QStringList smuflRangeNames;
      for (auto s : o.keys()) {
            QJsonObject range = o.value(s).toObject();
            QString desc = range.value("description").toString();
            QJsonArray glyphs = range.value("glyphs").toArray();
            if (glyphs.size() > 0) {
                  for (QJsonValue g : glyphs)
                        smuflMap[i].append(g.toString());
                  smuflRangeNames.append(desc);
                  i++;
                  }
            }

      lws->addItems(smuflRangeNames);
      lws->setCurrentRow(0);

      ws->addWidget(lws);
      ws->addWidget(psa);

      tabWidget->addTab(ws, tr("Musical Symbols"));

      psa = new PaletteScrollArea(pUnicode);
      psa->setRestrictHeight(false);

      QSplitter* wu = new QSplitter;
      lwu = new QListWidget;
      lwu->setSortingEnabled(true);
      for (i = 0; i < unicodeRangeNames.length(); i++) {
            QListWidgetItem* newItem = new QListWidgetItem(qApp->translate("accidental", unicodeRangeNames.at(i).toUtf8().constData()));
            newItem->setData(Qt::UserRole, i);
            lwu->addItem(newItem);
            if (i == 0)
                  lwu->setCurrentItem(newItem);
            }

      wu->addWidget(lwu);
      wu->addWidget(psa);

      tabWidget->addTab(wu, tr("Unicode Symbols"));

      connect(lws, SIGNAL(currentRowChanged(int)), SLOT(populateSmufl()));
      connect(lwu, SIGNAL(currentRowChanged(int)), SLOT(populateUnicode()));

	// others are done in setFont
      populateSmufl();

      setFocusPolicy(Qt::NoFocus);
      }
Ejemplo n.º 7
0
TextPalette::TextPalette(QWidget* parent)
   : QWidget(parent)
      {
      setWindowFlags(Qt::Tool);
      setupUi(this);

      pCommon = new Palette;
      pCommon->setMag(0.8);
      pCommon->setGrid(33, 60);
      pCommon->setReadOnly(true);

      pSmufl = new Palette;
      pSmufl->setMag(0.8);
      pSmufl->setGrid(33, 60);
      pSmufl->setReadOnly(true);

      pUnicode = new Palette;
      pUnicode->setMag(0.8);
      pUnicode->setGrid(33, 60);
      pUnicode->setReadOnly(true);

      PaletteScrollArea* psa = new PaletteScrollArea(pCommon);
      psa->setRestrictHeight(false);

      tabWidget->clear();
      tabWidget->addTab(psa, tr("Common Symbols"));

      psa = new PaletteScrollArea(pSmufl);
      psa->setRestrictHeight(false);

      QSplitter* ws = new QSplitter;
      lws = new QListWidget;

      lws->addItems(smuflRanges()->keys());
      lws->setCurrentRow(0);

      ws->addWidget(lws);
      ws->addWidget(psa);

      tabWidget->addTab(ws, tr("Musical Symbols"));

      psa = new PaletteScrollArea(pUnicode);
      psa->setRestrictHeight(false);

      QSplitter* wu = new QSplitter;
      lwu = new QListWidget;
      lwu->setSortingEnabled(true);
      for (int i = 0; i < unicodeRangeNames.length(); i++) {
            QListWidgetItem* newItem = new QListWidgetItem(qApp->translate("accidental", unicodeRangeNames.at(i).toUtf8().constData()));
            newItem->setData(Qt::UserRole, i);
            lwu->addItem(newItem);
            if (i == 0)
                  lwu->setCurrentItem(newItem);
            }

      wu->addWidget(lwu);
      wu->addWidget(psa);

      tabWidget->addTab(wu, tr("Unicode Symbols"));

      connect(lws, SIGNAL(currentRowChanged(int)), SLOT(populateSmufl()));
      connect(lwu, SIGNAL(currentRowChanged(int)), SLOT(populateUnicode()));

	// others are done in setFont
      populateSmufl();

      setFocusPolicy(Qt::NoFocus);
      }