summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-04-24 12:39:59 +0000
committerFlorian Jung <flo@windfisch.org>2011-04-24 12:39:59 +0000
commit57ffdd0790adc1460ea60310f1a3698e51b0248b (patch)
tree66bdf6e508d73932f303b23c6dacd0b6a00c9051
parentcf6951a578be0e6c5d4b550a3f2f294c33f27548 (diff)
parentefac864c25429cdb853fba82484606f94fb6d4ec (diff)
ScoreEdit doesn't inherit from MidiEditor any more, which solves
all that partlist-stuff merged with trunk
-rw-r--r--muse2/ChangeLog5
-rw-r--r--muse2/muse/app.cpp2
-rw-r--r--muse2/muse/master/lmaster.cpp13
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp26
-rw-r--r--muse2/muse/midiedit/scoreedit.h11
-rw-r--r--muse2/muse/mixer/rack.cpp11
-rw-r--r--muse2/muse/songfile.cpp4
7 files changed, 53 insertions, 19 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 0a3f6c74..a3e4706c 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,8 @@
+24.04.2011:
+ - Improved master list editor editing of keys, dropdown should not 'stay behind' anymore (rj)
+21.04.2011:
+ - Fixed drag&drop plugin instantantiation (again), was using a string pointer to private data
+ now copies the data before use (rj)
19.04.2011:
- Added undo/redo to master list editor for key editing, should implicitly
mean that SC_KEY is emitted to detect song change (not tested) (rj)
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index efa6b86d..9bbe8736 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -3521,7 +3521,7 @@ void MusE::openInScoreEdit(ScoreEdit* destination, PartList* pl, bool allInOne)
{
if (destination==NULL) // if no destination given, create a new one
{
- destination = new ScoreEdit(pl, this, 0, arranger->cursorValue());
+ destination = new ScoreEdit(this, 0, arranger->cursorValue());
destination->show();
toplevels.push_back(Toplevel(Toplevel::SCORE, (unsigned long)(destination), destination));
connect(destination, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long)));
diff --git a/muse2/muse/master/lmaster.cpp b/muse2/muse/master/lmaster.cpp
index 295dfb52..5c767060 100644
--- a/muse2/muse/master/lmaster.cpp
+++ b/muse2/muse/master/lmaster.cpp
@@ -79,10 +79,12 @@ QString keyToString(key_enum key) //flo
case KEY_B_BEGIN:
case KEY_B_END:
printf("ILLEGAL FUNCTION CALL: keyToString called with key_sharp_begin etc.\n");
+ return "";
break;
default:
printf("ILLEGAL FUNCTION CALL: keyToString called with illegal key value (not in enum)\n");
+ return "";
}
return keyStrs[index];
}
@@ -457,8 +459,12 @@ void LMaster::itemPressed(QTreeWidgetItem* i, int column)
if (editorColumn != column || editedItem != i)
returnPressed();
}
- else
+ else {
+ if (key_editor)
+ key_editor->hide();
+ setFocus();
editorColumn = column;
+ }
}
//---------------------------------------------------------
@@ -514,9 +520,11 @@ void LMaster::itemDoubleClicked(QTreeWidgetItem* i)
key_editor->addItems(keyStrs);
}
//key_editor->setText(editedItem->text(LMASTER_VAL_COL));
- key_editor->setCurrentIndex(keyStrs.indexOf(editedItem->text(LMASTER_VAL_COL)));
+ //key_editor->setCurrentIndex(keyStrs.indexOf(editedItem->text(LMASTER_VAL_COL)));
+ //key_editor->setCurrentIndex(-1);
key_editor->setGeometry(itemRect);
key_editor->show();
+ key_editor->showPopup();
key_editor->setFocus();
//key_editor->selectAll();
connect(key_editor, SIGNAL(currentIndexChanged(int)), SLOT(returnPressed()));
@@ -782,6 +790,7 @@ LMasterKeyEventItem::LMasterKeyEventItem(QTreeWidget* parent, const KeyEvent& ev
setText(1, c2);
setText(2, c3);
setText(3, c4);
+
}
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index 47773687..ee3f658c 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -147,9 +147,24 @@ set<QString> ScoreEdit::names;
// ScoreEdit
//---------------------------------------------------------
-ScoreEdit::ScoreEdit(PartList* pl, QWidget* parent, const char* name, unsigned initPos)
- : MidiEditor(0, 0, pl, parent, name)
+ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos)
+ : TopWin(parent, name)
{
+ setAttribute(Qt::WA_DeleteOnClose);
+
+ mainw = new QWidget(this);
+
+ mainGrid = new QGridLayout();
+ mainw->setLayout(mainGrid);
+
+ mainGrid->setContentsMargins(0, 0, 0, 0);
+ mainGrid->setSpacing(0);
+ setCentralWidget(mainw);
+
+
+
+
+
score_canvas=new ScoreCanvas(this, mainw, 1, 1);
xscroll = new QScrollBar(Qt::Horizontal, mainw);
yscroll = new QScrollBar(Qt::Vertical, mainw);
@@ -237,6 +252,7 @@ ScoreEdit::ScoreEdit(PartList* pl, QWidget* parent, const char* name, unsigned i
QToolBar* quant_toolbar = addToolBar(tr("Quantisation settings"));
+ newnote_toolbar->setObjectName("Quantisation settings");
quant_toolbar->addWidget(new QLabel(tr("Quantisation:"), quant_toolbar));
QComboBox* quant_combobox = new QComboBox(this);
quant_combobox->addItem("2"); // if you add or remove items from
@@ -479,7 +495,7 @@ void ScoreCanvas::add_staves(PartList* pl, bool all_in_one)
}
-ScoreCanvas::ScoreCanvas(MidiEditor* pr, QWidget* parent_widget,
+ScoreCanvas::ScoreCanvas(ScoreEdit* pr, QWidget* parent_widget,
int sx, int sy) : View(parent_widget, sx, sy)
{
parent = pr;
@@ -3382,16 +3398,12 @@ set<Part*> staff_t::parts_at_tick(unsigned tick)
* o do all the song_changed(SC_EVENT_INSERTED) properly
* o emit a "song-changed" signal instead of calling our
* internal song_changed() function
- * o must add_parts() update the part-list?
* o support different keys in different tracks at the same time
* calc_pos_add_list and calc_item_pos will be affected by this
* calc_pos_add_list must be called before calc_item_pos then,
* and calc_item_pos must respect the pos_add_list instead of
* keeping its own pos_add variable (which is only an optimisation)
- * o use nearest part instead of curr_part, maybe expand
* o draw measure numbers
- * o when moving or resizing a note, so that its end is out-of-part,
- * there's strange behaviour
* o tied notes don't work properly when there's a key-change in
* between, for example, when a cis is tied to a des
* o use timesig_t in all timesig-stuff
diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h
index 339bf1d8..367aac5e 100644
--- a/muse2/muse/midiedit/scoreedit.h
+++ b/muse2/muse/midiedit/scoreedit.h
@@ -60,12 +60,15 @@ class ScoreCanvas;
// ScoreEdit
//---------------------------------------------------------
-class ScoreEdit : public MidiEditor
+class ScoreEdit : public TopWin
{
Q_OBJECT
private:
virtual void closeEvent(QCloseEvent*);
+
+ QGridLayout* mainGrid;
+ QWidget* mainw;
QScrollBar* xscroll;
QScrollBar* yscroll;
@@ -94,7 +97,7 @@ class ScoreEdit : public MidiEditor
void viewport_height_changed(int);
public:
- ScoreEdit(PartList*, QWidget* parent = 0, const char* name = 0, unsigned initPos = MAXINT);
+ ScoreEdit(QWidget* parent = 0, const char* name = 0, unsigned initPos = MAXINT);
~ScoreEdit();
static void readConfiguration(Xml&){}; //TODO does nothing
static void writeConfiguration(int, Xml&){}; //TODO does nothing
@@ -649,7 +652,7 @@ class ScoreCanvas : public View
protected:
virtual void draw(QPainter& p, const QRect& rect);
- MidiEditor* parent;
+ ScoreEdit* parent;
virtual void mousePressEvent (QMouseEvent* event);
virtual void mouseMoveEvent (QMouseEvent* event);
@@ -657,7 +660,7 @@ class ScoreCanvas : public View
virtual void resizeEvent(QResizeEvent*);
public:
- ScoreCanvas(MidiEditor*, QWidget*, int, int);
+ ScoreCanvas(ScoreEdit*, QWidget*, int, int);
~ScoreCanvas(){};
void add_staves(PartList* pl, bool all_in_one);
diff --git a/muse2/muse/mixer/rack.cpp b/muse2/muse/mixer/rack.cpp
index afb8ae49..c2333e9d 100644
--- a/muse2/muse/mixer/rack.cpp
+++ b/muse2/muse/mixer/rack.cpp
@@ -417,6 +417,7 @@ void EffectRack::startDrag(int idx)
xml.dump(xmlconf);
QByteArray data(xmlconf.toLatin1().constData());
+ //printf("sending %d [%s]\n", data.length(), xmlconf.toLatin1().constData());
QMimeData* md = new QMimeData();
md->setData("text/x-muse-plugin", data);
@@ -482,9 +483,11 @@ void EffectRack::dropEvent(QDropEvent *event)
if(event->mimeData()->hasFormat("text/x-muse-plugin"))
{
- QString outxml;
- Xml xml(event->mimeData()->data("text/x-muse-plugin").data());
+ char *tmpStr = new char[event->mimeData()->data("text/x-muse-plugin").size()];
+ strcpy(tmpStr, event->mimeData()->data("text/x-muse-plugin").data());
+ Xml xml(tmpStr);
initPlugin(xml, idx);
+ delete tmpStr;
}
else
if (event->mimeData()->hasUrls())
@@ -577,7 +580,9 @@ void EffectRack::initPlugin(Xml xml, int idx)
if (tag == "plugin") {
PluginI* plugi = new PluginI();
if (plugi->readConfiguration(xml, false)) {
- printf("cannot instantiate plugin\n");
+ //QString d;
+ //xml.dump(d);
+ //printf("cannot instantiate plugin [%s]\n", d.toLatin1().data());
delete plugi;
}
else {
diff --git a/muse2/muse/songfile.cpp b/muse2/muse/songfile.cpp
index 7a690f74..3841a204 100644
--- a/muse2/muse/songfile.cpp
+++ b/muse2/muse/songfile.cpp
@@ -33,7 +33,7 @@
#include "wave.h"
#include "midictrl.h"
#include "amixer.h"
-//#include "mixer/amixer.h" // p4.0.2
+#include "audiodev.h"
#include "conf.h"
#include "driver/jackmidi.h"
#include "keyevent.h"
@@ -1250,7 +1250,7 @@ void Song::read(Xml& xml)
_follow = FollowMode(xml.parseInt());
else if (tag == "sampleRate") {
int sRate = xml.parseInt();
- if (sRate != sampleRate)
+ if (audioDevice->deviceType() != AudioDevice::DUMMY_AUDIO && sRate != sampleRate)
QMessageBox::warning(muse,"Wrong sample rate", "The sample rate in this project and the current system setting differs, the project may not work as intended!");
}
else if (tag == "tempolist") {