diff options
Diffstat (limited to 'attic/muse2-oom/muse2/muse/master')
-rw-r--r-- | attic/muse2-oom/muse2/muse/master/CMakeLists.txt | 81 | ||||
-rw-r--r-- | attic/muse2-oom/muse2/muse/master/lmaster.cpp | 750 | ||||
-rw-r--r-- | attic/muse2-oom/muse2/muse/master/lmaster.h | 146 | ||||
-rw-r--r-- | attic/muse2-oom/muse2/muse/master/master.cpp | 338 | ||||
-rw-r--r-- | attic/muse2-oom/muse2/muse/master/master.h | 68 | ||||
-rw-r--r-- | attic/muse2-oom/muse2/muse/master/masteredit.cpp | 406 | ||||
-rw-r--r-- | attic/muse2-oom/muse2/muse/master/masteredit.h | 86 | ||||
-rw-r--r-- | attic/muse2-oom/muse2/muse/master/tscale.cpp | 61 | ||||
-rw-r--r-- | attic/muse2-oom/muse2/muse/master/tscale.h | 35 |
9 files changed, 0 insertions, 1971 deletions
diff --git a/attic/muse2-oom/muse2/muse/master/CMakeLists.txt b/attic/muse2-oom/muse2/muse/master/CMakeLists.txt deleted file mode 100644 index bf2cebb7..00000000 --- a/attic/muse2-oom/muse2/muse/master/CMakeLists.txt +++ /dev/null @@ -1,81 +0,0 @@ -#============================================================================= -# MusE -# Linux Music Editor -# $Id:$ -# -# Copyright (C) 2002-2006 by 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. -#============================================================================= - -## -## Expand Qt macros in source files -## -QT4_WRAP_CPP ( master_mocs - lmaster.h - masteredit.h - master.h - tscale.h - ) - -## -## List of source files to compile -## -file (GLOB master_source_files - lmaster.cpp - masteredit.cpp - master.cpp - tscale.cpp - ) - -## -## Define target -## -add_library ( master SHARED - ${master_source_files} - ${master_mocs} - ) - -## -## Append to the list of translations -## -set (FILES_TO_TRANSLATE - ${FILES_TO_TRANSLATE} - ${master_source_files} - CACHE INTERNAL "" - ) - -## -## Compilation flags and target name -## -set_target_properties( master - PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC" - OUTPUT_NAME muse_master - ) - -## -## Linkage -## -target_link_libraries ( master - ${QT_LIBRARIES} - al - awl - widgets - ) - -## -## Install location -## -install(TARGETS master - DESTINATION ${MusE_MODULES_DIR} - ) diff --git a/attic/muse2-oom/muse2/muse/master/lmaster.cpp b/attic/muse2-oom/muse2/muse/master/lmaster.cpp deleted file mode 100644 index 00a09d13..00000000 --- a/attic/muse2-oom/muse2/muse/master/lmaster.cpp +++ /dev/null @@ -1,750 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: lmaster.cpp,v 1.2.2.8 2009/03/09 02:05:18 terminator356 Exp $ -// (C) Copyright 2000 Werner Schweer (ws@seh.de) -//========================================================= - -#include "awl/posedit.h" -#include "awl/sigedit.h" - -#include "lmaster.h" -#include "xml.h" -#include "song.h" -#include "globals.h" -#include "audio.h" -///#include "posedit.h" -///#include "sigedit.h" -#include "shortcuts.h" -#include "debug.h" - -#include <QCloseEvent> -#include <QGridLayout> -#include <QHeaderView> -#include <QLineEdit> -#include <QMenu> -#include <QMenuBar> -#include <QMessageBox> -#include <QSignalMapper> -#include <QStyle> -#include <QToolBar> -#include <QToolButton> -#include <QTreeWidget> - -#define LMASTER_BEAT_COL 0 -#define LMASTER_TIME_COL 1 -#define LMASTER_TYPE_COL 2 -#define LMASTER_VAL_COL 3 - -#define LMASTER_MSGBOX_STRING "MusE: List Editor" -//--------------------------------------------------------- -// closeEvent -//--------------------------------------------------------- - -void LMaster::closeEvent(QCloseEvent* e) - { - emit deleted((unsigned long)this); - e->accept(); - } - -//--------------------------------------------------------- -// songChanged -//--------------------------------------------------------- - -void LMaster::songChanged(int type) - { - if (type & (SC_SIG | SC_TEMPO)) - updateList(); - } - -//--------------------------------------------------------- -// LMaster -//--------------------------------------------------------- - -LMaster::LMaster() - : MidiEditor(0, 0, 0) - { - pos_editor = 0; - editor = 0; - sig_editor = 0; - editedItem = 0; - editingNewItem = false; - setWindowTitle(tr("MusE: Mastertrack")); - setMinimumHeight(100); - setFixedWidth(400); - - //---------Pulldown Menu---------------------------- - menuEdit = menuBar()->addMenu(tr("&Edit")); - QSignalMapper *signalMapper = new QSignalMapper(this); - menuEdit->addActions(undoRedo->actions()); - menuEdit->addSeparator(); - tempoAction = menuEdit->addAction(tr("Insert Tempo")); - signAction = menuEdit->addAction(tr("Insert Signature")); - posAction = menuEdit->addAction(tr("Edit Positon")); - valAction = menuEdit->addAction(tr("Edit Value")); - delAction = menuEdit->addAction(tr("Delete Event")); - delAction->setShortcut(Qt::Key_Delete); - - connect(tempoAction, SIGNAL(triggered()), signalMapper, SLOT(map())); - connect(signAction, SIGNAL(triggered()), signalMapper, SLOT(map())); - connect(posAction, SIGNAL(triggered()), signalMapper, SLOT(map())); - connect(valAction, SIGNAL(triggered()), signalMapper, SLOT(map())); - connect(delAction, SIGNAL(triggered()), signalMapper, SLOT(map())); - - signalMapper->setMapping(tempoAction, CMD_INSERT_TEMPO); - signalMapper->setMapping(signAction, CMD_INSERT_SIG); - signalMapper->setMapping(posAction, CMD_EDIT_BEAT); - signalMapper->setMapping(valAction, CMD_EDIT_VALUE); - signalMapper->setMapping(delAction, CMD_DELETE); - - connect(signalMapper, SIGNAL(mapped(int)), SLOT(cmd(int))); - - //---------ToolBar---------------------------------- - tools = addToolBar(tr("Master tools")); - tools->addActions(undoRedo->actions()); - - //QToolBar* edit = new QToolBar(this, "edit tools"); - QToolBar* edit = addToolBar(tr("Edit tools")); - //QToolButton* tempoButton = new QToolButton(edit); - QToolButton* tempoButton = new QToolButton(); - //QToolButton* timeSigButton = new QToolButton(edit); - QToolButton* timeSigButton = new QToolButton(); - tempoButton->setText(tr("Tempo")); - timeSigButton->setText(tr("Timesig")); - tempoButton->setToolTip(tr("new tempo")); - timeSigButton->setToolTip(tr("new signature")); - edit->addWidget(tempoButton); - edit->addWidget(timeSigButton); - - ///Q3Accel* qa = new Q3Accel(this); - ///qa->connectItem(qa->insertItem(Qt::CTRL+Qt::Key_Z), song, SLOT(undo())); - ///qa->connectItem(qa->insertItem(Qt::CTRL+Qt::Key_Y), song, SLOT(redo())); - - //--------------------------------------------------- - // master - //--------------------------------------------------- - - view = new QTreeWidget; - view->setAllColumnsShowFocus(true); - view->setSelectionMode(QAbstractItemView::SingleSelection); - QStringList columnnames; - columnnames << tr("Meter") - << tr("Time") - << tr("Type") - << tr("Value"); - view->setHeaderLabels(columnnames); - view->setColumnWidth(2,80); - view->header()->setStretchLastSection(true); - - //--------------------------------------------------- - // Rest - //--------------------------------------------------- - -// QSizeGrip* corner = new QSizeGrip(mainw); - - mainGrid->setRowStretch(0, 100); - mainGrid->setColumnStretch(0, 100); - - mainGrid->addWidget(view, 0, 0); -// mainGrid->addWidget(corner, 1, 1, AlignBottom | AlignRight); - updateList(); - - connect(view, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), SLOT(select(QTreeWidgetItem*, QTreeWidgetItem*))); - connect(view, SIGNAL(itemPressed(QTreeWidgetItem*, int)), SLOT(itemPressed(QTreeWidgetItem*, int))); - connect(view, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), SLOT(itemDoubleClicked(QTreeWidgetItem*))); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - connect(tempoButton, SIGNAL(clicked()), SLOT(tempoButtonClicked())); - connect(timeSigButton, SIGNAL(clicked()), SLOT(timeSigButtonClicked())); - - initShortcuts(); - } - -//--------------------------------------------------------- -// ~LMaster -//--------------------------------------------------------- - -LMaster::~LMaster() - { - //undoRedo->removeFrom(tools); // p4.0.6 Removed - } - -//--------------------------------------------------------- -// insertSig -//--------------------------------------------------------- - -void LMaster::insertSig(const AL::SigEvent* ev) - { - new LMasterSigEventItem(view, ev); - } - -//--------------------------------------------------------- -// insertTempo -//--------------------------------------------------------- - -void LMaster::insertTempo(const TEvent* ev) - { - new LMasterTempoItem(view, ev); - } - -//--------------------------------------------------------- -// updateList -//--------------------------------------------------------- - -void LMaster::updateList() - { - LMasterLViewItem* selected = (LMasterLViewItem*) view->currentItem(); - LMASTER_LVTYPE type = LMASTER_TEMPO; - unsigned tick = 0; - - if (selected) { - type = selected->getType(); - tick = selected->tick(); - } - - view->clear(); - const TempoList* t = &tempomap; - const AL::SigList* s = &AL::sigmap; - - criTEvent it = t->rbegin(); - AL::criSigEvent is = s->rbegin(); - for (;;) { - if (it == t->rend()) { - while(is != s->rend()) { - insertSig(is->second); - ++is; - } - break; - } - if (is == s->rend()) { - while (it != t->rend()) { - insertTempo(it->second); - ++it; - } - break; - } - if (is->second->tick > it->second->tick) { - insertSig(is->second); - ++is; - } - else { - insertTempo(it->second); - ++it; - } - } - - // Try to reselect the previous selection: - if(selected) - { - LMasterLViewItem* tmp = getItemAtPos(tick, type); - if (tmp) { - view->clearSelection(); - view->setCurrentItem(tmp); - } - } - } - -//--------------------------------------------------------- -// readStatus -//--------------------------------------------------------- - -void LMaster::readStatus(Xml& xml) - { - for (;;) { - Xml::Token token = xml.parse(); - const QString& tag = xml.s1(); - if (token == Xml::Error || token == Xml::End) - break; - switch (token) { - case Xml::TagStart: - if (tag == "midieditor") - MidiEditor::readStatus(xml); - else - xml.unknown("LMaster"); - break; - case Xml::TagEnd: - if (tag == "lmaster") - return; - default: - break; - } - } - } - -//--------------------------------------------------------- -// writeStatus -//--------------------------------------------------------- - -void LMaster::writeStatus(int level, Xml& xml) const - { - xml.tag(level++, "lmaster"); - MidiEditor::writeStatus(level, xml); - xml.tag(level, "/lmaster"); - } - -//--------------------------------------------------------- -// select -//--------------------------------------------------------- - -void LMaster::select(QTreeWidgetItem* /*item*/, QTreeWidgetItem* /*previous_item*/) - { -// printf("select %x\n", unsigned(item)); - } - -//--------------------------------------------------------- -// cmd -//--------------------------------------------------------- - -void LMaster::cmd(int cmd) - { - switch(cmd) { - case CMD_DELETE: { - LMasterLViewItem* l = (LMasterLViewItem*) view->currentItem(); - if (!l) - return; - // Delete item: - if (l->tick() != 0) { - if (l == view->topLevelItem(view->topLevelItemCount() - 1)) - view->setCurrentItem(view->itemAbove(l)); - else - view->setCurrentItem(view->itemBelow(l)); - - switch (l->getType()) { - case LMASTER_TEMPO: - { - LMasterTempoItem* t = (LMasterTempoItem*) l; - audio->msgDeleteTempo(t->tick(), t->tempo(), true); - break; - } - case LMASTER_SIGEVENT: - { - LMasterSigEventItem* s = (LMasterSigEventItem*) l; - audio->msgRemoveSig(s->tick(), s->z(), s->n()); - break; - } - default: - M_ERROR("Default switch statement reached"); - break; - } - } - break; - } - case CMD_INSERT_TEMPO: - tempoButtonClicked(); - break; - case CMD_INSERT_SIG: - timeSigButtonClicked(); - break; - case CMD_EDIT_BEAT: - case CMD_EDIT_VALUE: - cmd == CMD_EDIT_VALUE ? editorColumn = LMASTER_VAL_COL : editorColumn = LMASTER_BEAT_COL; - if (view->currentItem() && !editedItem) { - itemDoubleClicked(view->currentItem()); - } - break; - } - } - -/*! - \fn LMaster::itemPressed(QListViewItem* i, const QPoint& p, int column) - */ -void LMaster::itemPressed(QTreeWidgetItem* i, int column) - { - //printf("itemPressed, column: %d\n", column); - if (editedItem) { - if (editorColumn != column || editedItem != i) - returnPressed(); - } - else - editorColumn = column; - } - -//--------------------------------------------------------- -// itemDoubleClicked(QListViewItem* item) -//! Sets lmaster in edit mode, and opens editor for selected value -//--------------------------------------------------------- -void LMaster::itemDoubleClicked(QTreeWidgetItem* i) - { - //printf("itemDoubleClicked\n"); - - if (!editedItem && editorColumn == LMASTER_VAL_COL) { - editedItem = (LMasterLViewItem*) i; - QRect itemRect = view->visualItemRect(editedItem); - int x1 = view->columnWidth(LMASTER_BEAT_COL) + view->columnWidth(LMASTER_TIME_COL) - + view->columnWidth(LMASTER_TYPE_COL); - itemRect.setX(x1); - //Qt makes crazy things with itemRect if this is called directly.. - if (editingNewItem) { - QFontMetrics fm(font()); - int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth,0 , this); // ddskrjo 0 - int h = fm.height() + fw * 2; - itemRect.setWidth(view->columnWidth(LMASTER_VAL_COL)); - itemRect.setY(1); - itemRect.setHeight(h); - } - - - // Edit tempo value: - if (editedItem->getType() == LMASTER_TEMPO) { - if (!editor) - editor = new QLineEdit(view->viewport()); - editor->setText(editedItem->text(LMASTER_VAL_COL)); - editor->setGeometry(itemRect); - editor->show(); - editor->setFocus(); - editor->selectAll(); - connect(editor, SIGNAL(returnPressed()), SLOT(returnPressed())); - } - else { // Edit signatur value: - if (!sig_editor) - sig_editor = new SigEdit(view->viewport()); - sig_editor->setValue(editedItem->text(LMASTER_VAL_COL)); - sig_editor->setGeometry(itemRect); - sig_editor->show(); - sig_editor->setFocus(); - connect(sig_editor, SIGNAL(returnPressed()), SLOT(returnPressed())); - } - } - // Edit tempo or signal position: - else if (!editedItem && editorColumn == LMASTER_BEAT_COL) { - editedItem = (LMasterLViewItem*) i; - // Don't allow movement of initial values: - if (editedItem->tick() == 0) { - QMessageBox::information(this, tr(LMASTER_MSGBOX_STRING), - tr("Reposition of the initial tempo and signature events is not allowed") ); - editedItem = 0; - } - // Everything OK - else { - if (!pos_editor) - ///pos_editor = new PosEdit(view->viewport()); - pos_editor = new Awl::PosEdit(view->viewport()); - pos_editor->setValue(editedItem->tick()); - QRect itemRect = view->visualItemRect(editedItem); - itemRect.setX(0); - itemRect.setWidth(view->columnWidth(LMASTER_BEAT_COL)); - pos_editor->setGeometry(itemRect); - pos_editor->show(); - pos_editor->setFocus(); - connect(pos_editor, SIGNAL(returnPressed()), SLOT(returnPressed())); - } - } - } - -//--------------------------------------------------------- -// returnPressed() -//! called when editor is closed -//--------------------------------------------------------- - -void LMaster::returnPressed() - { - if (!editedItem) - return; - - setFocus(); - // Tempo event: - if (editedItem->getType() == LMASTER_TEMPO && editorColumn == LMASTER_VAL_COL) { - QString input = editor->text(); - editor->hide(); - repaint(); - LMasterTempoItem* e = (LMasterTempoItem*) editedItem; - const TEvent* t = e->getEvent(); - unsigned tick = t->tick; - bool conversionOK; - double dbl_input = input.toDouble(&conversionOK); - if (conversionOK && dbl_input < 250.0) { - int tempo = (int) ((1000000.0 * 60.0)/dbl_input); - - if (!editingNewItem) { - song->startUndo(); - audio->msgDeleteTempo(tick, e->tempo(), false); - audio->msgAddTempo(tick, tempo, false); - song->endUndo(SC_TEMPO); - } - // - // New item edited: - // - else { - audio->msgAddTempo(tick, tempo, true); - } - } - else { - QMessageBox::warning(this, tr("MusE: List Editor"), - tr("Input error, conversion not OK or value out of range"), - QMessageBox::Ok, Qt::NoButton - ); - } - } - // - // Beat column, change position of a particular tempo or signature event - // - else if (editorColumn == LMASTER_BEAT_COL) { - int oldtick = editedItem->tick(); - int newtick = pos_editor->pos().tick(); - if (newtick == 0) { // Do not allow change of position to beginning of song - QMessageBox::warning(this, tr(LMASTER_MSGBOX_STRING), - tr("Reposition of tempo and signature events to start position is not allowed!"), - QMessageBox::Ok, Qt::NoButton - ); - } - else if (oldtick != newtick) { // Ignore if tick hasn't changed - if (editedItem->getType() == LMASTER_TEMPO) { - LMasterTempoItem* t = (LMasterTempoItem*) editedItem; - int tempo = t->tempo(); - song->startUndo(); - audio->msgDeleteTempo(oldtick, tempo, false); - audio->msgAddTempo(newtick, tempo, false); - song->endUndo(SC_TEMPO); - // Select the item: - QTreeWidgetItem* newSelected = (QTreeWidgetItem*) getItemAtPos(newtick, LMASTER_TEMPO); - if (newSelected) { - view->clearSelection(); - view->setCurrentItem(newSelected); - } - } - else if (editedItem->getType() == LMASTER_SIGEVENT) { - LMasterSigEventItem* t = (LMasterSigEventItem*) editedItem; - int z = t->z(); - int n = t->n(); - if (!editingNewItem) { - song->startUndo(); - audio->msgRemoveSig(oldtick, z, n, false); //Delete first, in order to get sane tick-value - newtick = pos_editor->pos().tick(); - audio->msgAddSig(newtick, z, n, false); - song->endUndo(SC_SIG); - } - else - audio->msgAddSig(newtick, z, n, false); - //audio->msgAddSig(newtick, z, n, true); - - // Select the item: - QTreeWidgetItem* newSelected = (QTreeWidgetItem*) getItemAtPos(newtick, LMASTER_SIGEVENT); - if (newSelected) { - view->clearSelection(); - view->setCurrentItem(newSelected); - } - } - - } - pos_editor->hide(); - repaint(); - } - // - // SigEvent, value changed: - // - else if (editedItem->getType() == LMASTER_SIGEVENT && editorColumn == LMASTER_VAL_COL) - { - ///Sig newSig = sig_editor->sig(); - AL::TimeSignature newSig = sig_editor->sig(); - - sig_editor->hide(); - - // Added p3.3.43 Prevents aborting with 0 z or n. - if(newSig.isValid()) - { - - LMasterSigEventItem* e = (LMasterSigEventItem*) editedItem; - int tick = e->tick(); - if (!editingNewItem) { - song->startUndo(); - if (tick > 0) - audio->msgRemoveSig(tick, e->z(), e->n(), false); - audio->msgAddSig(tick, newSig.z, newSig.n, false); - song->endUndo(SC_SIG); - } - else - audio->msgAddSig(tick, newSig.z, newSig.n, true); - } - } - - view->setFocus(); - // No item edited now: - editedItem = 0; - editorColumn = -1; - editingNewItem = false; - - } - - -/*! - \fn LMasterLViewItem::text(int column) - \brief Returns the initialized text to the View - */ -QString LMasterLViewItem::text(int column) const - { - QString ret = "?"; - switch (column) { - case LMASTER_BEAT_COL: - ret = c1; - break; - case LMASTER_TIME_COL: - ret = c2; - break; - case LMASTER_TYPE_COL: - ret = c3; - break; - case LMASTER_VAL_COL: - ret = c4; - break; - default: - fprintf(stderr,"LMasterLViewItem::text(int): Default switch statement reached... Unknown column.\n"); - break; - } - return ret; - } - -//--------------------------------------------------------- -// LMasterTempoItem -//! Initializes a LMasterTempoItem with a TEvent -//--------------------------------------------------------- -LMasterTempoItem::LMasterTempoItem(QTreeWidget* parent, const TEvent* ev) - : LMasterLViewItem(parent) - { - tempoEvent = ev; - unsigned t = ev->tick; - //QString c1, c2, c3, c4; - int bar, beat; - unsigned tick; - AL::sigmap.tickValues(t, &bar, &beat, &tick); - c1.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick); - - double time = double(ev->frame) / double(sampleRate); - int min = int(time) / 60; - int sec = int(time) % 60; - int msec = int((time - (min*60 + sec)) * 1000.0); - c2.sprintf("%03d:%02d:%03d", min, sec, msec); - c3 = "Tempo"; - double dt = (1000000.0 * 60.0)/ev->tempo; - c4.setNum(dt, 'f', 3); - setText(0, c1); - setText(1, c2); - setText(2, c3); - setText(3, c4); - } - -//--------------------------------------------------------- -// LMasterSigEventItem -//! Initializes a ListView item with a SigEvent -//--------------------------------------------------------- -LMasterSigEventItem::LMasterSigEventItem(QTreeWidget* parent, const AL::SigEvent* ev) - : LMasterLViewItem(parent) - { - sigEvent = ev; - unsigned t = ev->tick; - int bar, beat; - unsigned tick; - AL::sigmap.tickValues(t, &bar, &beat, &tick); - c1.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick); - - double time = double(tempomap.tick2frame(t)) / double (sampleRate); - int min = int(time) / 60; - int sec = int(time) % 60; - int msec = int((time - (min*60 + sec)) * 1000.0); - c2.sprintf("%03d:%02d:%03d", min, sec, msec); - c3 = "Timesig"; - c4.sprintf("%d/%d", ev->sig.z, ev->sig.n); - setText(0, c1); - setText(1, c2); - setText(2, c3); - setText(3, c4); - } - -//--------------------------------------------------------- -// tempoButtonClicked() -//! inserts a new tempo-item in the list and starts the editor for it -//--------------------------------------------------------- -void LMaster::tempoButtonClicked() - { - LMasterTempoItem* lastTempo = (LMasterTempoItem*) getLastOfType(LMASTER_TEMPO); - QString beatString = ((LMasterLViewItem*)lastTempo)->text(LMASTER_BEAT_COL); - int m, b, t; - Pos p = Pos(beatString); - p.mbt(&m, &b, &t); - m++; //Next bar - int newTick = AL::sigmap.bar2tick(m, b, t); - TEvent* ev = new TEvent(lastTempo->tempo(), newTick); - new LMasterTempoItem(view, ev); - QTreeWidgetItem* newTempoItem = view->topLevelItem(0); - //LMasterTempoItem* newTempoItem = new LMasterTempoItem(view, ev); - - editingNewItem = true; // State - editorColumn = LMASTER_VAL_COL; // Set that we edit editorColumn - view->clearSelection(); - view->setCurrentItem(newTempoItem); - itemDoubleClicked(newTempoItem); - } - - -//--------------------------------------------------------- -// tempoButtonClicked() -//! inserts a new sig-item in the list and starts the editor for it -//--------------------------------------------------------- -void LMaster::timeSigButtonClicked() - { - LMasterSigEventItem* lastSig = (LMasterSigEventItem*) getLastOfType(LMASTER_SIGEVENT); - QString beatString = ((LMasterLViewItem*)lastSig)->text(LMASTER_BEAT_COL); - int m, b, t; - Pos p = Pos(beatString); - p.mbt(&m, &b, &t); - m++; - int newTick = AL::sigmap.bar2tick(m, b, t); - AL::SigEvent* ev = new AL::SigEvent(AL::TimeSignature(lastSig->z(), lastSig->n()), newTick); - new LMasterSigEventItem(view, ev); - QTreeWidgetItem* newSigItem = view->topLevelItem(0); - //LMasterSigEventItem* newSigItem = new LMasterSigEventItem(view, ev); - - editingNewItem = true; // State - editorColumn = LMASTER_VAL_COL; // Set that we edit editorColumn - view->clearSelection(); - view->setCurrentItem(newSigItem); - itemDoubleClicked(newSigItem); - } - - -/*! - \fn LMaster::getLastOfType(LMASTER_LVTYPE t) - */ -LMasterLViewItem* LMaster::getLastOfType(LMASTER_LVTYPE t) - { - LMasterLViewItem* tmp = (LMasterLViewItem*) view->topLevelItem(view->topLevelItemCount() - 1); - while (tmp->getType() != t) { - tmp = (LMasterLViewItem*) view->itemAbove(tmp); - } - return tmp; - } - - -/*! - \fn LMaster::getItemAtPos(unsigned tick, LMASTER_LVTYPE t) - */ -LMasterLViewItem* LMaster::getItemAtPos(unsigned tick, LMASTER_LVTYPE t) - { - LMasterLViewItem* tmp = (LMasterLViewItem*) view->topLevelItem(0); - while (tmp) { - if (tmp->getType() == t && tmp->tick() == tick) - return tmp; - tmp = (LMasterLViewItem*) view->itemBelow(tmp); - } - - return 0; - } - - -/*! - \fn LMaster::configChanged() - */ -void LMaster::configChanged() - { - initShortcuts(); - } - - -/*! - \fn LMaster::initShortcuts() - */ -void LMaster::initShortcuts() - { - tempoAction->setShortcut(shortcuts[SHRT_LM_INS_TEMPO].key); - signAction->setShortcut(shortcuts[SHRT_LM_INS_SIG].key); - posAction->setShortcut(shortcuts[SHRT_LM_EDIT_BEAT].key); - valAction->setShortcut(shortcuts[SHRT_LM_EDIT_VALUE].key); - } diff --git a/attic/muse2-oom/muse2/muse/master/lmaster.h b/attic/muse2-oom/muse2/muse/master/lmaster.h deleted file mode 100644 index cd687e45..00000000 --- a/attic/muse2-oom/muse2/muse/master/lmaster.h +++ /dev/null @@ -1,146 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: lmaster.h,v 1.1.1.1.2.5 2005/12/11 21:29:23 spamatica Exp $ -// (C) Copyright 2000 Werner Schweer (ws@seh.de) -//========================================================= - -#ifndef __LMASTER_EDIT_H__ -#define __LMASTER_EDIT_H__ - -#include "midieditor.h" -#include "noteinfo.h" -#include "cobject.h" -#include "tempo.h" -///#include "sig.h" -//#include "al/sig.h" - -#include <QTreeWidgetItem> - -namespace AL { - class SigEvent; - }; -using AL::SigEvent; - -namespace Awl { - class PosEdit; - class SigEdit; - }; -using Awl::PosEdit; -using Awl::SigEdit; - -class QLineEdit; - -enum LMASTER_LVTYPE - { - LMASTER_TEMPO = 0, - LMASTER_SIGEVENT - }; - -//--------------------------------------------------------- -// LMasterLViewItem -//! QListViewItem base class for LMasterTempoItem and LMasterSigEventItem -//--------------------------------------------------------- -class LMasterLViewItem : public QTreeWidgetItem { - protected: - QString c1, c2, c3, c4; - - public: - LMasterLViewItem(QTreeWidget* parent) - : QTreeWidgetItem(QTreeWidgetItem::UserType) {parent->insertTopLevelItem(0, this);} - virtual QString text(int column) const; - virtual LMASTER_LVTYPE getType() = 0; - virtual unsigned tick() = 0; - }; - -//--------------------------------------------------------- -// LMasterTempoItem -//! QListViewItem which holds data for a TEvent -//--------------------------------------------------------- -class LMasterTempoItem : public LMasterLViewItem { - - private: - const TEvent* tempoEvent; - - public: - LMasterTempoItem(QTreeWidget* parent, const TEvent* t); - virtual LMASTER_LVTYPE getType() { return LMASTER_TEMPO; } - const TEvent* getEvent() { return tempoEvent; } - virtual unsigned tick() { return tempoEvent->tick; } - int tempo() { return tempoEvent->tempo; } - }; - -//--------------------------------------------------------- -// LMasterTempoItem -//! QListViewItem which holds data for a SigEvent -//--------------------------------------------------------- -class LMasterSigEventItem : public LMasterLViewItem { - - private: - const SigEvent* sigEvent; - - public: - LMasterSigEventItem(QTreeWidget* parent, const SigEvent* s); - virtual LMASTER_LVTYPE getType() { return LMASTER_SIGEVENT; } - const SigEvent* getEvent() { return sigEvent; } - virtual unsigned tick() { return sigEvent->tick; } - int z() { return sigEvent->sig.z; } - int n() { return sigEvent->sig.n; } - }; - - -//--------------------------------------------------------- -// LMaster -//--------------------------------------------------------- - -class LMaster : public MidiEditor { - QTreeWidget* view; - QToolBar* tools; - QMenu* menuEdit; - - enum { CMD_DELETE, CMD_INSERT_SIG, CMD_INSERT_TEMPO, CMD_EDIT_BEAT, CMD_EDIT_VALUE }; - - Q_OBJECT - virtual void closeEvent(QCloseEvent*); - void updateList(); - void insertTempo(const TEvent*); - void insertSig(const SigEvent*); - LMasterLViewItem* getItemAtPos(unsigned tick, LMASTER_LVTYPE t); - void initShortcuts(); - QLineEdit* editor; - PosEdit* pos_editor; - // State-like members: - LMasterLViewItem* editedItem; - SigEdit* sig_editor; - int editorColumn; - bool editingNewItem; - - QAction *tempoAction, *signAction, *posAction, *valAction, *delAction; - - private slots: - void select(QTreeWidgetItem*, QTreeWidgetItem*); - void itemDoubleClicked(QTreeWidgetItem* item); - void returnPressed(); - void itemPressed(QTreeWidgetItem* i, int column); - void tempoButtonClicked(); - void timeSigButtonClicked(); - void cmd(int cmd); - - public slots: - void songChanged(int); - void configChanged(); - - signals: - void deleted(unsigned long); - - public: - LMaster(); - ~LMaster(); - virtual void readStatus(Xml&); - virtual void writeStatus(int, Xml&) const; - LMasterLViewItem* getLastOfType(LMASTER_LVTYPE t); - }; - - -#endif - diff --git a/attic/muse2-oom/muse2/muse/master/master.cpp b/attic/muse2-oom/muse2/muse/master/master.cpp deleted file mode 100644 index 4a33a8c4..00000000 --- a/attic/muse2-oom/muse2/muse/master/master.cpp +++ /dev/null @@ -1,338 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: master.cpp,v 1.3 2004/04/11 13:03:32 wschweer Exp $ -// (C) Copyright 2000 Werner Schweer (ws@seh.de) -//========================================================= - -#include <stdio.h> -#include <values.h> - -#include <QCursor> -#include <QEvent> -#include <QMouseEvent> -#include <QPainter> - -#include "globals.h" -#include "master.h" -#include "song.h" -#include "scrollscale.h" -#include "midi.h" -#include "midieditor.h" -#include "icons.h" -#include "audio.h" - -extern void drawTickRaster(QPainter& p, int x, int y, - int w, int h, int quant); - -//--------------------------------------------------------- -// Master -//--------------------------------------------------------- - -Master::Master(MidiEditor* e, QWidget* parent, int xmag, int ymag) - : View(parent, xmag, ymag) - { - editor = e; - setBg(Qt::white); - vscroll = 0; - pos[0] = 0; - pos[1] = 0; - pos[2] = 0; - setFocusPolicy(Qt::StrongFocus); // Tim. - setMouseTracking(true); - connect(song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool))); - connect(song, SIGNAL(songChanged(int)), this, SLOT(redraw())); - } - -//--------------------------------------------------------- -// setPos -//--------------------------------------------------------- - -void Master::setPos(int idx, unsigned val, bool adjustScrollbar) - { - if (pos[idx] == val) - return; - - int opos = mapx(pos[idx]); - int npos = mapx(val); - - if (adjustScrollbar && idx == 0) { - switch (song->follow()) { - case Song::NO: - break; - case Song::JUMP: - if (npos >= width()) { - int ppos = val - rmapxDev(width()/8); - if (ppos < 0) - ppos = 0; - emit followEvent(ppos); - opos = mapx(pos[idx]); - npos = mapx(val); - } - else if (npos < 0) { - int ppos = val - rmapxDev(width()*3/4); - if (ppos < 0) - ppos = 0; - emit followEvent(ppos); - opos = mapx(pos[idx]); - npos = mapx(val); - } - break; - case Song::CONTINUOUS: - if (npos > (width()/2)) { - int ppos = pos[idx] - rmapxDev(width()/2); - if (ppos < 0) - ppos = 0; - emit followEvent(ppos); - opos = mapx(pos[idx]); - npos = mapx(val); - } - else if (npos < (width()/2)) { - int ppos = pos[idx] - rmapxDev(width()/2); - if (ppos < 0) - ppos = 0; - emit followEvent(ppos); - opos = mapx(pos[idx]); - npos = mapx(val); - } - break; - } - } - - int x; - int w = 1; - if (opos > npos) { - w += opos - npos; - x = npos; - } - else { - w += npos - opos; - x = opos; - } - pos[idx] = val; - redraw(QRect(x-1, 0, w+2, height())); - } - -//--------------------------------------------------------- -// leaveEvent -//--------------------------------------------------------- - -void Master::leaveEvent(QEvent*) - { - emit tempoChanged(-1); - emit timeChanged(MAXINT); - } - -//--------------------------------------------------------- -// pdraw -//--------------------------------------------------------- - -void Master::pdraw(QPainter& p, const QRect& rect) - { - View::pdraw(p, rect); // calls draw() - p.resetTransform(); - - int x = rect.x(); - int y = rect.y(); - int w = rect.width() + 2; - int h = rect.height(); - - int wh = height(); - //--------------------------------------------------- - // draw Canvas Items - //--------------------------------------------------- - - const TempoList* tl = &tempomap; - for (ciTEvent i = tl->begin(); i != tl->end(); ++i) { - TEvent* e = i->second; - int etick = mapx(i->first); - int stick = mapx(i->second->tick); - int tempo = mapy(280000 - int(60000000000.0/(e->tempo))); - - if (tempo < 0) - tempo = 0; - if (tempo < wh) { - p.fillRect(stick, tempo, etick-stick, wh, Qt::blue); - } - } - - //--------------------------------------------------- - // draw marker - //--------------------------------------------------- - - int xp = mapx(pos[0]); - if (xp >= x && xp < x+w) { - p.setPen(Qt::red); - p.drawLine(xp, y, xp, y+h); - } - xp = mapx(pos[1]); - if (xp >= x && xp < x+w) { - p.setPen(Qt::blue); - p.drawLine(xp, y, xp, y+h); - } - xp = mapx(pos[2]); - if (xp >= x && xp < x+w) { - p.setPen(Qt::blue); - p.drawLine(xp, y, xp, y+h); - } - } - -//--------------------------------------------------------- -// draw -//--------------------------------------------------------- - -void Master::draw(QPainter& p, const QRect& rect) - { - drawTickRaster(p, rect.x(), rect.y(), - rect.width(), rect.height(), 0); - } - -//--------------------------------------------------------- -// viewMousePressEvent -//--------------------------------------------------------- - -void Master::viewMousePressEvent(QMouseEvent* event) - { - start = event->pos(); - Tool activeTool = tool; -// bool shift = event->state() & ShiftButton; - - switch (activeTool) { - case PointerTool: - drag = DRAG_LASSO_START; - break; - - case PencilTool: - drag = DRAG_NEW; - song->startUndo(); - newVal(start.x(), start.x(), start.y()); - break; - - case RubberTool: - drag = DRAG_DELETE; - song->startUndo(); - deleteVal(start.x(), start.x()); - break; - - default: - break; - } - } - -//--------------------------------------------------------- -// viewMouseMoveEvent -//--------------------------------------------------------- - -void Master::viewMouseMoveEvent(QMouseEvent* event) - { - QPoint pos = event->pos(); -// QPoint dist = pos - start; -// bool moving = dist.y() >= 3 || dist.y() <= 3 || dist.x() >= 3 || dist.x() <= 3; - - switch (drag) { - case DRAG_NEW: - newVal(start.x(), pos.x(), pos.y()); - start = pos; - break; - - case DRAG_DELETE: - deleteVal(start.x(), pos.x()); - start = pos; - break; - - default: - break; - } - emit tempoChanged(280000 - event->y()); - int x = pos.x(); - if (x < 0) - x = 0; - emit timeChanged(editor->rasterVal(x)); - } - -//--------------------------------------------------------- -// viewMouseReleaseEvent -//--------------------------------------------------------- - -void Master::viewMouseReleaseEvent(QMouseEvent*) - { - switch (drag) { - case DRAG_RESIZE: - case DRAG_NEW: - case DRAG_DELETE: - song->endUndo(SC_TEMPO); - break; - default: - break; - } - drag = DRAG_OFF; - } - -//--------------------------------------------------------- -// deleteVal -//--------------------------------------------------------- - -bool Master::deleteVal1(unsigned int x1, unsigned int x2) - { - bool songChanged = false; - - TempoList* tl = &tempomap; - for (iTEvent i = tl->begin(); i != tl->end(); ++i) { - if (i->first < x1) - continue; - if (i->first >= x2) - break; - iTEvent ii = i; - ++ii; - if (ii != tl->end()) { - int tempo = ii->second->tempo; - audio->msgDeleteTempo(i->first, tempo, false); - songChanged = true; - } - } - return songChanged; - } - -void Master::deleteVal(int x1, int x2) - { - if (deleteVal1(editor->rasterVal1(x1), x2)) - redraw(); - } - -//--------------------------------------------------------- -// setTool -//--------------------------------------------------------- - -void Master::setTool(int t) - { - if (tool == Tool(t)) - return; - tool = Tool(t); - switch(tool) { - case PencilTool: - setCursor(QCursor(*pencilIcon, 4, 15)); - break; - default: - setCursor(QCursor(Qt::ArrowCursor)); - break; - } - } - -//--------------------------------------------------------- -// newVal -//--------------------------------------------------------- - -void Master::newVal(int x1, int x2, int y) - { - int xx1 = editor->rasterVal1(x1); - int xx2 = editor->rasterVal2(x2); - - if (xx1 > xx2) { - int tmp = xx2; - xx2 = xx1; - xx1 = tmp; - } - deleteVal1(xx1, xx2); - audio->msgAddTempo(xx1, int(60000000000.0/(280000 - y)), false); - redraw(); - } diff --git a/attic/muse2-oom/muse2/muse/master/master.h b/attic/muse2-oom/muse2/muse/master/master.h deleted file mode 100644 index 52040aeb..00000000 --- a/attic/muse2-oom/muse2/muse/master/master.h +++ /dev/null @@ -1,68 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: master.h,v 1.3 2004/04/11 13:03:32 wschweer Exp $ -// (C) Copyright 1999 Werner Schweer (ws@seh.de) -//========================================================= - -#ifndef __MASTER_H__ -#define __MASTER_H__ - -#include "view.h" -#include "song.h" -#include "tools.h" - -class QMouseEvent; -class QPainter; -class QPoint; -class QRect; -class QToolBar; - -class MidiEditor; -class ScrollScale; - -//--------------------------------------------------------- -// Master -//--------------------------------------------------------- - -class Master : public View { - enum DragMode { DRAG_OFF, DRAG_NEW, DRAG_MOVE_START, DRAG_MOVE, - DRAG_DELETE, DRAG_COPY_START, DRAG_COPY, - DRAG_RESIZE, DRAG_LASSO_START, DRAG_LASSO - }; - ScrollScale* vscroll; - unsigned pos[3]; - QPoint start; - Tool tool; - DragMode drag; - MidiEditor* editor; - - Q_OBJECT - virtual void pdraw(QPainter&, const QRect&); - virtual void viewMouseMoveEvent(QMouseEvent* event); - virtual void leaveEvent(QEvent*e); - virtual void viewMousePressEvent(QMouseEvent* event); - virtual void viewMouseReleaseEvent(QMouseEvent*); - - void draw(QPainter&, const QRect&); - void newVal(int x1, int x2, int y); - bool deleteVal1(unsigned int x1, unsigned int x2); - void deleteVal(int x1, int x2); - - signals: - void followEvent(int); - void xposChanged(int); - void yposChanged(int); - void timeChanged(unsigned); - void tempoChanged(int); - - public slots: - void setPos(int, unsigned, bool adjustScrollbar); - void setTool(int t); - - public: - Master(MidiEditor*, QWidget* parent, int xmag, int ymag); - }; - -#endif - diff --git a/attic/muse2-oom/muse2/muse/master/masteredit.cpp b/attic/muse2-oom/muse2/muse/master/masteredit.cpp deleted file mode 100644 index 2b91ae90..00000000 --- a/attic/muse2-oom/muse2/muse/master/masteredit.cpp +++ /dev/null @@ -1,406 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: masteredit.cpp,v 1.4.2.5 2009/07/01 22:14:56 spamatica Exp $ -// (C) Copyright 1999 Werner Schweer (ws@seh.de) -//========================================================= - -#include "awl/sigedit.h" - -#include "masteredit.h" -#include "mtscale.h" -#include "hitscale.h" -#include "sigscale.h" -#include "scrollscale.h" -#include "poslabel.h" -#include "master.h" -#include "utils.h" -#include "tscale.h" -#include "tempolabel.h" -#include "xml.h" -#include "lcombo.h" -#include "doublelabel.h" -///#include "sigedit.h" -#include "globals.h" - -#include <values.h> - -#include <QActionGroup> -#include <QCloseEvent> -#include <QGridLayout> -#include <QLabel> -#include <QToolBar> -#include <QToolButton> - -int MasterEdit::_rasterInit = 0; - -//--------------------------------------------------------- -// closeEvent -//--------------------------------------------------------- - -void MasterEdit::closeEvent(QCloseEvent* e) - { - emit deleted((unsigned long)this); - e->accept(); - } - -//--------------------------------------------------------- -// songChanged -//--------------------------------------------------------- - -void MasterEdit::songChanged(int type) - { - if (type & SC_TEMPO) { - int tempo = tempomap.tempo(song->cpos()); - curTempo->blockSignals(true); - curTempo->setValue(double(60000000.0/tempo)); - - curTempo->blockSignals(false); - } - if (type & SC_SIG) { - int z, n; - AL::sigmap.timesig(song->cpos(), z, n); - curSig->blockSignals(true); - curSig->setValue(AL::TimeSignature(z, n)); - curSig->blockSignals(false); - sign->redraw(); - } - if (type & SC_MASTER) { - enableButton->blockSignals(true); - enableButton->setChecked(song->masterFlag()); - enableButton->blockSignals(false); - } - } - -//--------------------------------------------------------- -// MasterEdit -//--------------------------------------------------------- - -MasterEdit::MasterEdit() - : MidiEditor(0, _rasterInit, 0) - { - setWindowTitle(tr("MusE: Mastertrack")); - _raster = 0; // measure - setMinimumSize(400, 300); - resize(500, 350); - - //---------Pulldown Menu---------------------------- -// QPopupMenu* file = new QPopupMenu(this); -// menuBar()->insertItem("&File", file); - - //---------ToolBar---------------------------------- - - tools = addToolBar(tr("Master tools")); - tools->addActions(undoRedo->actions()); - - EditToolBar* tools2 = new EditToolBar(this, PointerTool | PencilTool | RubberTool); - addToolBar(tools2); - - QToolBar* enableMaster = addToolBar(tr("Enable master")); - enableButton = new QToolButton(); - enableButton->setCheckable(true); - enableButton->setText(tr("Enable")); - enableButton->setToolTip(tr("Enable usage of master track")); - enableButton->setChecked(song->masterFlag()); - enableMaster->addWidget(enableButton); - connect(enableButton, SIGNAL(toggled(bool)), song, SLOT(setMasterFlag(bool))); - - QToolBar* info = addToolBar(tr("Info")); - QLabel* label = new QLabel(tr("Cursor")); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); - label->setIndent(3); - info->addWidget(label); - - cursorPos = new PosLabel(0); - cursorPos->setFixedHeight(22); - cursorPos->setToolTip(tr("time at cursor position")); - info->addWidget(cursorPos); - tempo = new TempoLabel(0); - tempo->setFixedHeight(22); - tempo->setToolTip(tr("tempo at cursor position")); - info->addWidget(tempo); - - const char* rastval[] = { - QT_TRANSLATE_NOOP("@default", "Off"), "Bar", "1/2", "1/4", "1/8", "1/16" - }; - rasterLabel = new LabelCombo(tr("Snap"), 0); - rasterLabel->setFocusPolicy(Qt::NoFocus); - for (int i = 0; i < 6; i++) - rasterLabel->insertItem(i, tr(rastval[i])); - rasterLabel->setCurrentIndex(1); - info->addWidget(rasterLabel); - connect(rasterLabel, SIGNAL(activated(int)), SLOT(_setRaster(int))); - - //---------values for current position--------------- - info->addWidget(new QLabel(tr("CurPos "))); - curTempo = new TempoEdit(0); - curSig = new SigEdit(0); - curSig->setValue(AL::TimeSignature(4, 4)); - curTempo->setToolTip(tr("tempo at current position")); - curSig->setToolTip(tr("time signature at current position")); - info->addWidget(curTempo); - info->addWidget(curSig); - ///connect(curSig, SIGNAL(valueChanged(int,int)), song, SLOT(setSig(int,int))); - connect(curSig, SIGNAL(valueChanged(const AL::TimeSignature&)), song, SLOT(setSig(const AL::TimeSignature&))); - - ///connect(curTempo, SIGNAL(valueChanged(double)), song, SLOT(setTempo(double))); - connect(curTempo, SIGNAL(tempoChanged(double)), song, SLOT(setTempo(double))); - - //--------------------------------------------------- - // master - //--------------------------------------------------- - - int xscale = -20; - int yscale = -500; - hscroll = new ScrollScale(-100, -2, xscale, song->len(), Qt::Horizontal, mainw); - vscroll = new ScrollScale(-1000, -100, yscale, 120000, Qt::Vertical, mainw); - vscroll->setRange(30000, 250000); - time1 = new MTScale(&_raster, mainw, xscale); - sign = new SigScale(&_raster, mainw, xscale); -// thits = new HitScale(&_raster, mainw, xscale); - - canvas = new Master(this, mainw, xscale, yscale); - -// zhits = new HitScale(&_raster, mainw, xscale); - time2 = new MTScale(&_raster, mainw, xscale); - tscale = new TScale(mainw, yscale); - time2->setBarLocator(true); - - //--------------------------------------------------- - // Rest - //--------------------------------------------------- - -// QSizeGrip* corner = new QSizeGrip(mainw); - - mainGrid->setRowStretch(5, 100); - mainGrid->setColumnStretch(1, 100); - - mainGrid->addWidget(hLine(mainw), 0, 1); - mainGrid->addWidget(time1, 1, 1); - mainGrid->addWidget(hLine(mainw), 2, 1); - mainGrid->addWidget(sign, 3, 1); - mainGrid->addWidget(hLine(mainw), 4, 1); -// mainGrid->addWidget(thits, 5, 1); -// mainGrid->addWidget(hLine(mainw), 6, 1); - mainGrid->addWidget(canvas, 5, 1); - mainGrid->addWidget(tscale, 5, 0); - mainGrid->addWidget(hLine(mainw), 6, 1); -// mainGrid->addWidget(zhits, 9, 1); -// mainGrid->addWidget(hLine(mainw), 7, 1); - mainGrid->addWidget(time2, 7, 1); - mainGrid->addWidget(hscroll, 8, 1); - mainGrid->addWidget(vscroll, 0, 2, 10, 1); -// mainGrid->addWidget(corner, 9, 2, AlignBottom | AlignRight); - - canvas->setFocus(); // Tim. - - connect(tools2, SIGNAL(toolChanged(int)), canvas, SLOT(setTool(int))); - connect(vscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setYPos(int))); - connect(vscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setYMag(int))); - - connect(vscroll, SIGNAL(scrollChanged(int)), tscale, SLOT(setYPos(int))); - connect(vscroll, SIGNAL(scaleChanged(int)), tscale, SLOT(setYMag(int))); - - connect(hscroll, SIGNAL(scrollChanged(int)), time1, SLOT(setXPos(int))); - connect(hscroll, SIGNAL(scrollChanged(int)), sign, SLOT(setXPos(int))); -// connect(hscroll, SIGNAL(scrollChanged(int)), thits, SLOT(setXPos(int))); - connect(hscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setXPos(int))); -// connect(hscroll, SIGNAL(scrollChanged(int)), zhits, SLOT(setXPos(int))); - connect(hscroll, SIGNAL(scrollChanged(int)), time2, SLOT(setXPos(int))); - - connect(hscroll, SIGNAL(scaleChanged(int)), time1, SLOT(setXMag(int))); - connect(hscroll, SIGNAL(scaleChanged(int)), sign, SLOT(setXMag(int))); -// connect(hscroll, SIGNAL(scaleChanged(int)), thits, SLOT(setXMag(int))); - connect(hscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setXMag(int))); -// connect(hscroll, SIGNAL(scaleChanged(int)), zhits, SLOT(setXMag(int))); - connect(hscroll, SIGNAL(scaleChanged(int)), time2, SLOT(setXMag(int))); - - connect(time1, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned))); -// connect(sign, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned))); -// connect(thits, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned))); -// connect(canvas, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned))); -// connect(zhits, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned))); - connect(time2, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned))); - - connect(tscale, SIGNAL(tempoChanged(int)), SLOT(setTempo(int))); - connect(canvas, SIGNAL(tempoChanged(int)), SLOT(setTempo(int))); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - connect(song, SIGNAL(posChanged(int,unsigned,bool)), SLOT(posChanged(int,unsigned,bool))); - - connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int))); - connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned))); - } - -//--------------------------------------------------------- -// ~MasterEdit -//--------------------------------------------------------- - -MasterEdit::~MasterEdit() - { - //undoRedo->removeFrom(tools); // p4.0.6 Removed - } - -//--------------------------------------------------------- -// readStatus -//--------------------------------------------------------- - -void MasterEdit::readStatus(Xml& xml) - { - for (;;) { - Xml::Token token = xml.parse(); - const QString& tag = xml.s1(); - switch (token) { - case Xml::Error: - case Xml::End: - return; - case Xml::TagStart: - if (tag == "midieditor") - MidiEditor::readStatus(xml); - else if (tag == "ypos") - vscroll->setPos(xml.parseInt()); - else if (tag == "ymag") { - // vscroll->setMag(xml.parseInt()); - int mag = xml.parseInt(); - vscroll->setMag(mag); - } - else - xml.unknown("MasterEdit"); - break; - case Xml::TagEnd: - if (tag == "master") { - // raster setzen - int item = 0; - switch(_raster) { - case 1: item = 0; break; - case 0: item = 1; break; - case 768: item = 2; break; - case 384: item = 3; break; - case 192: item = 4; break; - case 96: item = 5; break; - } - _rasterInit = _raster; - rasterLabel->setCurrentIndex(item); - return; - } - default: - break; - } - } - } - -//--------------------------------------------------------- -// writeStatus -//--------------------------------------------------------- - -void MasterEdit::writeStatus(int level, Xml& xml) const - { - xml.tag(level++, "master"); - xml.intTag(level, "ypos", vscroll->pos()); - xml.intTag(level, "ymag", vscroll->mag()); - MidiEditor::writeStatus(level, xml); - xml.tag(level, "/master"); - } - -//--------------------------------------------------------- -// readConfiguration -//--------------------------------------------------------- - -void MasterEdit::readConfiguration(Xml& xml) - { - for (;;) { - Xml::Token token = xml.parse(); - const QString& tag = xml.s1(); - switch (token) { - case Xml::Error: - case Xml::End: - return; - case Xml::TagStart: - if (tag == "raster") - _rasterInit = xml.parseInt(); - else - xml.unknown("MasterEdit"); - break; - case Xml::TagEnd: - if (tag == "masteredit") - return; - default: - break; - } - } - } - -//--------------------------------------------------------- -// writeConfiguration -//--------------------------------------------------------- - -void MasterEdit::writeConfiguration(int level, Xml& xml) - { - xml.tag(level++, "masteredit"); - xml.intTag(level, "raster", _rasterInit); - xml.tag(level, "/masteredit"); - } - -//--------------------------------------------------------- -// _setRaster -//--------------------------------------------------------- - -void MasterEdit::_setRaster(int index) - { - static int rasterTable[] = { - 1, 0, 768, 384, 192, 96 - }; - _raster = rasterTable[index]; - _rasterInit = _raster; - } - -//--------------------------------------------------------- -// posChanged -//--------------------------------------------------------- - -void MasterEdit::posChanged(int idx, unsigned val, bool) - { - if (idx == 0) { - int z, n; - int tempo = tempomap.tempo(val); - AL::sigmap.timesig(val, z, n); - curTempo->blockSignals(true); - curSig->blockSignals(true); - - curTempo->setValue(double(60000000.0/tempo)); - curSig->setValue(AL::TimeSignature(z, n)); - - curTempo->blockSignals(false); - curSig->blockSignals(false); - } - } - -//--------------------------------------------------------- -// setTime -//--------------------------------------------------------- - -void MasterEdit::setTime(unsigned tick) - { - if (tick == MAXINT) - cursorPos->setEnabled(false); - else { - cursorPos->setEnabled(true); - cursorPos->setValue(tick); - time1->setPos(3, tick, false); - time2->setPos(3, tick, false); - } - } - -//--------------------------------------------------------- -// setTempo -//--------------------------------------------------------- - -void MasterEdit::setTempo(int val) - { - if (val == -1) - tempo->setEnabled(false); - else { - tempo->setEnabled(true); - tempo->setValue(val); - } - } - diff --git a/attic/muse2-oom/muse2/muse/master/masteredit.h b/attic/muse2-oom/muse2/muse/master/masteredit.h deleted file mode 100644 index af43c7b0..00000000 --- a/attic/muse2-oom/muse2/muse/master/masteredit.h +++ /dev/null @@ -1,86 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: masteredit.h,v 1.3.2.2 2009/04/01 01:37:11 terminator356 Exp $ -// (C) Copyright 1999 Werner Schweer (ws@seh.de) -//========================================================= - -#ifndef __MASTER_EDIT_H__ -#define __MASTER_EDIT_H__ - -#include "midieditor.h" -#include "noteinfo.h" -#include "cobject.h" - -namespace Awl { - class SigEdit; - }; -using Awl::SigEdit; - -class QCloseEvent; -class QToolBar; -class QToolButton; - -class Master; -class ScrollScale; -class MTScale; -class SigScale; -class HitScale; -class TScale; -class TempoEdit; -class LabelCombo; -class PosLabel; -class TempoLabel; - -//--------------------------------------------------------- -// MasterEdit -//--------------------------------------------------------- - -class MasterEdit : public MidiEditor { - Master* canvas; - ScrollScale* hscroll; - ScrollScale* vscroll; - MTScale* time1; - MTScale* time2; - SigScale* sign; - HitScale* thits; - HitScale* zhits; - TScale* tscale; - - TempoEdit* curTempo; - SigEdit* curSig; - LabelCombo* rasterLabel; - QToolBar* tools; - PosLabel* cursorPos; - TempoLabel* tempo; - QToolButton* enableButton; - - static int _rasterInit; - - Q_OBJECT - virtual void closeEvent(QCloseEvent*); - - private slots: - void _setRaster(int); - void posChanged(int,unsigned,bool); - void setTime(unsigned); - void setTempo(int); - - public slots: - void songChanged(int); -// void tempoChanged(double); - - signals: - void deleted(unsigned long); - - public: - MasterEdit(); - ~MasterEdit(); - virtual void readStatus(Xml&); - virtual void writeStatus(int, Xml&) const; - static void readConfiguration(Xml&); - static void writeConfiguration(int, Xml&); - }; - -#endif - diff --git a/attic/muse2-oom/muse2/muse/master/tscale.cpp b/attic/muse2-oom/muse2/muse/master/tscale.cpp deleted file mode 100644 index d37d5924..00000000 --- a/attic/muse2-oom/muse2/muse/master/tscale.cpp +++ /dev/null @@ -1,61 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: tscale.cpp,v 1.2 2003/12/17 11:04:14 wschweer Exp $ -// (C) Copyright 1999 Werner Schweer (ws@seh.de) -//========================================================= - -#include <stdio.h> -#include "tscale.h" -#include "globals.h" -#include "gconfig.h" - -#include <QMouseEvent> -#include <QPainter> - -//--------------------------------------------------------- -// TScale -//--------------------------------------------------------- - -TScale::TScale(QWidget* parent, int ymag) - : View(parent, 1, ymag) - { - setFont(config.fonts[3]); - int w = 4 * QFontMetrics(config.fonts[4]).width('0'); - setFixedWidth(w); - setMouseTracking(true); - } - -//--------------------------------------------------------- -// draw -//--------------------------------------------------------- - -void TScale::pdraw(QPainter& p, const QRect& r) - { - int y = r.y(); - int h = r.height(); - p.setFont(config.fonts[4]); - QString s; - for (int i = 30000; i <= 250000; i += 10000) { - int yy = mapy(280000 - i); - if (yy < y) - break; - if (yy-15 > y+h) - continue; - p.drawLine(0, yy, width(), yy); - s.setNum(i/1000); - QFontMetrics fm(config.fonts[4]); - p.drawText(width() - fm.width(s) - 1, yy-2, s); - } - } - -void TScale::viewMouseMoveEvent(QMouseEvent* event) - { - emit tempoChanged(280000 - event->y()); - } - -void TScale::leaveEvent(QEvent*) - { - emit tempoChanged(-1); - } - diff --git a/attic/muse2-oom/muse2/muse/master/tscale.h b/attic/muse2-oom/muse2/muse/master/tscale.h deleted file mode 100644 index 35fa39f2..00000000 --- a/attic/muse2-oom/muse2/muse/master/tscale.h +++ /dev/null @@ -1,35 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: tscale.h,v 1.1.1.1 2003/10/27 18:52:36 wschweer Exp $ -// (C) Copyright 1999 Werner Schweer (ws@seh.de) -//========================================================= - -#ifndef __TSCALE_H__ -#define __TSCALE_H__ - -#include "view.h" - -//--------------------------------------------------------- -// Tscale -//--------------------------------------------------------- - -class TScale : public View { - double curTempo; - Q_OBJECT - - virtual void viewMouseMoveEvent(QMouseEvent* event); - virtual void leaveEvent(QEvent*e); - - protected: - virtual void pdraw(QPainter&, const QRect&); - - signals: - void tempoChanged(int); - - public: - TScale(QWidget*, int); - }; - -#endif - |