Hi all,
Attached is the first colouring patch designed (hopefully) to be
applied. It applies (with a couple of lines fuzz but perfectly well)
against AnonCVS with the mmap changes.
I've started using commands (thanks Rich) and sorted out the update
problems (thanks Chris). Therefore we have undo/redo and correct
updating for both changes to Segments and when the map is updated from
Edit Document Properties.
The only major missing feature at this point is the saving and loading
of the colour information - Expect a patch to do this within 24/48
hours.
Cheers,
Mark
PS - This patch adds three files in total. One of them
(base/test/colour.output) is from the original Colour code a few months
ago - it got missed then. The other two are gui/colorwidgets.{cpp,h}
--
Mark Hymers <markh at linuxfromscratch dot org>
"I told you I was ill"
The epitaph of Spike Milligan (1918-2002)
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/base/ColourMap.C rosegarden-colour/base/ColourMap.C
--- rosegarden-pristine2/base/ColourMap.C 2003-07-06 18:15:32.000000000 +0100
+++ rosegarden-colour/base/ColourMap.C 2003-07-21 19:32:15.000000000 +0100
@@ -197,4 +197,19 @@
return ret;
}
+ColourMap&
+ColourMap::operator=(const ColourMap& input)
+{
+ if (this != &input)
+ m_map = input.m_map;
+
+ return *this;
+}
+
+int
+ColourMap::size() const
+{
+ return m_map.size();
+}
+
}
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/base/ColourMap.h rosegarden-colour/base/ColourMap.h
--- rosegarden-pristine2/base/ColourMap.h 2003-07-06 18:15:32.000000000 +0100
+++ rosegarden-colour/base/ColourMap.h 2003-07-21 19:35:35.000000000 +0100
@@ -31,10 +31,10 @@
#ifndef _BASE_COLOURMAP_H_
#define _BASE_COLOURMAP_H_
-// These is the default default colour
-#define COLOUR_DEF_R 230
-#define COLOUR_DEF_B 230
-#define COLOUR_DEF_G 230
+// These are the default, default colour
+#define COLOUR_DEF_R 197
+#define COLOUR_DEF_B 125
+#define COLOUR_DEF_G 211
namespace Rosegarden
{
@@ -105,6 +105,8 @@
*/
bool swapItems(unsigned int item_1, unsigned int item_2);
+// void replace(ColourMap &input);
+
/**
* This returns a const iterator pointing to m_map.begin()
*/
@@ -115,6 +117,10 @@
*/
RCMap::const_iterator end();
+ ColourMap& operator=(const ColourMap& input);
+
+ int size() const;
+
private:
RCMap m_map;
};
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/base/Composition.C rosegarden-colour/base/Composition.C
--- rosegarden-pristine2/base/Composition.C 2003-07-15 20:58:39.000000000 +0100
+++ rosegarden-colour/base/Composition.C 2003-07-21 19:35:19.000000000 +0100
@@ -1259,7 +1259,13 @@
return false;
}
+void
+Composition::setSegmentColourMap(Rosegarden::ColourMap &newmap)
+{
+ m_segmentColourMap = newmap;
+ updateRefreshStatuses();
+}
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/base/Composition.h rosegarden-colour/base/Composition.h
--- rosegarden-pristine2/base/Composition.h 2003-07-15 20:58:44.000000000 +0100
+++ rosegarden-colour/base/Composition.h 2003-07-21 19:35:13.000000000 +0100
@@ -568,6 +568,9 @@
static const std::string TempoEventType;
static const PropertyName TempoProperty; // stored in beats per hour
+ // Colour stuff
+ ColourMap& getSegmentColourMap() { return m_segmentColourMap; }
+ void setSegmentColourMap(Rosegarden::ColourMap &newmap);
//////
//
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/base/Segment.C rosegarden-colour/base/Segment.C
--- rosegarden-pristine2/base/Segment.C 2003-07-06 15:23:25.000000000 +0100
+++ rosegarden-colour/base/Segment.C 2003-07-21 14:51:42.000000000 +0100
@@ -913,6 +913,14 @@
}
+void
+Segment::setColourIndex(const unsigned int input)
+{
+ m_colourIndex = input;
+ updateRefreshStatuses(getStartTime(), getEndTime());
+ if (m_composition) m_composition->updateRefreshStatuses();
+}
+
SegmentHelper::~SegmentHelper() { }
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/base/test/colour.output rosegarden-colour/base/test/colour.output
--- rosegarden-pristine2/base/test/colour.output 1970-01-01 01:00:00.000000000
+0100
+++ rosegarden-colour/base/test/colour.output 2003-05-15 23:02:11.000000000 +0100
@@ -0,0 +1,68 @@
+TEST: Colour.C
+
+Can we create an Colour with the right default values?
+red: 0 green: 0 blue: 0
+Can we set values; green here is invalid - it should be set to 0 instead
+Testing the copy constructor
+red: 210 green: 0 blue: 100
+Check operator= works
+red: 210 green: 0 blue: 100
+Check the setColour routine
+red: 1 green: 2 blue: 3
+Check the getColour routine
+red: 1 green: 2 blue: 3
+
+TEST: ColourMap.C
+
+Can we create a ColourMap with the right default Colour + String
+Can we get the default colour back out of it?
+name: red: 230 green: 230 blue: 230
+Can we create a ColourMap with a specified default Colour?
+Can we get the information back out of it?
+name: red: 210 green: 0 blue: 100
+Can we add a Colour
+Can we get the info back out?
+name: TEST1 red: 100 green: 101 blue: 102
+Add a couple more colours
+index: 0 name: red: 210 green: 0 blue: 100
+index: 1 name: TEST1 red: 100 green: 101 blue: 102
+index: 2 name: TEST2 red: 101 green: 102 blue: 103
+index: 3 name: TEST3 red: 102 green: 103 blue: 104
+index: 4 name: TEST4 red: 103 green: 104 blue: 105
+Now try deleting the third item
+index: 0 name: red: 210 green: 0 blue: 100
+index: 1 name: TEST1 red: 100 green: 101 blue: 102
+index: 2 name: TEST2 red: 101 green: 102 blue: 103
+index: 4 name: TEST4 red: 103 green: 104 blue: 105
+Make sure we get false when we try and modify item number 3
+Check we can modify a colour which *is* there
+index: 0 name: red: 210 green: 0 blue: 100
+index: 1 name: TEST1 red: 100 green: 101 blue: 102
+index: 2 name: TEST2 red: 101 green: 102 blue: 103
+index: 4 name: YES red: 233 green: 233 blue: 233
+Now try adding another item - it should take the place of the one we removed.
+index: 0 name: red: 210 green: 0 blue: 100
+index: 1 name: TEST1 red: 100 green: 101 blue: 102
+index: 2 name: TEST2 red: 101 green: 102 blue: 103
+index: 3 name: NEW red: 211 green: 212 blue: 213
+index: 4 name: YES red: 233 green: 233 blue: 233
+Try swapping two items:
+index: 0 name: red: 210 green: 0 blue: 100
+index: 1 name: TEST1 red: 100 green: 101 blue: 102
+index: 2 name: TEST2 red: 101 green: 102 blue: 103
+index: 3 name: YES red: 233 green: 233 blue: 233
+index: 4 name: NEW red: 211 green: 212 blue: 213
+
+TEST: Generic Colour routines
+
+Try getting a contrasting colour:
+Original colour:
+red: 210 green: 0 blue: 100
+Contrast colour:
+red: 45 green: 255 blue: 155
+Try getting a combination colour:
+Original colours:
+red: 45 green: 255 blue: 155
+red: 100 green: 101 blue: 102
+Combination colour:
+red: 72 green: 178 blue: 128
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/gui/Makefile.am rosegarden-colour/gui/Makefile.am
--- rosegarden-pristine2/gui/Makefile.am 2003-07-06 15:25:19.000000000 +0100
+++ rosegarden-colour/gui/Makefile.am 2003-07-15 20:29:53.000000000 +0100
@@ -11,6 +11,7 @@
basiccommand.cpp \
chordnameruler.cpp \
colours.cpp \
+ colourwidgets.cpp \
constants.cpp \
controleditor.cpp \
controlruler.cpp \
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/gui/colours.cpp rosegarden-colour/gui/colours.cpp
--- rosegarden-pristine2/gui/colours.cpp 2003-05-18 18:17:19.000000000 +0100
+++ rosegarden-colour/gui/colours.cpp 2003-07-16 21:12:43.000000000 +0100
@@ -28,14 +28,10 @@
const QColor ActiveRecordTrack = Qt::red;
const QColor SegmentCanvas = QColor(230, 230, 230);
- const QColor SegmentBlock = QColor(197, 211, 125);
const QColor SegmentBorder = Qt::black;
- const QColor SegmentHighlightBlock = QColor(98, 102, 78);
- const QColor SegmentIntersectBlock = SegmentBlock.dark(150);
const QColor RecordingSegmentBlock = QColor(255, 182, 193);
const QColor RecordingSegmentBorder = Qt::black;
- const QColor RepeatSegmentBlock = QColor(238, 238, 205);
const QColor RepeatSegmentBorder = QColor(130, 133, 170);
const QColor SegmentAudioPreview = QColor(39, 71, 22);
@@ -49,7 +45,9 @@
const QColor LoopRulerBackground = QColor(120, 120, 120);
const QColor LoopRulerForeground = Qt::white;
const QColor LoopHighlight = Qt::white;
-
+
+ const QColor TempoBase = QColor(197, 211, 125);
+
//const QColor TextRulerBackground = QColor(60, 205, 230, QColor::Hsv);
// const QColor TextRulerBackground = QColor(120, 90, 238, QColor::Hsv);
// const QColor TextRulerBackground = QColor(210, 220, 140);
@@ -108,7 +106,7 @@
const QColor RotaryPlugin = QColor(185, 255, 248);
Rosegarden::Colour
-convertColour (const QColor& input)
+convertColour (const QColor &input)
{
int r,g,b;
input.rgb(&r, &g, &b);
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/gui/colours.h rosegarden-colour/gui/colours.h
--- rosegarden-pristine2/gui/colours.h 2003-05-18 18:17:19.000000000 +0100
+++ rosegarden-colour/gui/colours.h 2003-07-16 21:12:55.000000000 +0100
@@ -39,14 +39,10 @@
extern const QColor SegmentCanvas;
extern const QColor SegmentBorder;
- extern const QColor SegmentBlock;
- extern const QColor SegmentHighlightBlock;
- extern const QColor SegmentIntersectBlock;
extern const QColor RecordingSegmentBlock;
extern const QColor RecordingSegmentBorder;
- extern const QColor RepeatSegmentBlock;
extern const QColor RepeatSegmentBorder;
extern const QColor SegmentAudioPreview;
@@ -61,6 +57,8 @@
extern const QColor LoopRulerForeground;
extern const QColor LoopHighlight;
+ extern const QColor TempoBase;
+
extern const QColor TextRulerBackground;
extern const QColor TextRulerForeground;
@@ -113,8 +111,8 @@
extern const QColor RotaryPlugin;
- Rosegarden::Colour convertColour(QColor input);
- QColor convertColour(Rosegarden::Colour input);
+ Rosegarden::Colour convertColour(const QColor &input);
+ QColor convertColour(const Rosegarden::Colour &input);
}
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/gui/colourwidgets.cpp rosegarden-colour/gui/colourwidgets.cpp
--- rosegarden-pristine2/gui/colourwidgets.cpp 1970-01-01 01:00:00.000000000 +0100
+++ rosegarden-colour/gui/colourwidgets.cpp 2003-07-16 22:57:23.000000000 +0100
@@ -0,0 +1,144 @@
+
+// -*- c-basic-offset: 4 -*-
+
+/*
+ Rosegarden-4
+ A sequencer and musical notation editor.
+
+ This program is Copyright 2000-2003
+ Guillaume Laurent <[EMAIL PROTECTED]>,
+ Chris Cannam <[EMAIL PROTECTED]>,
+ Richard Bown <[EMAIL PROTECTED]>
+
+ Portions of this file Copyright 2003
+ Mark Hymers <[EMAIL PROTECTED]>
+
+ The moral right of the authors to claim authorship of this work
+ has been asserted.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version. See the file
+ COPYING included with this distribution for more information.
+*/
+
+#include <qtable.h>
+#include <qinputdialog.h>
+
+#include <kcolordialog.h>
+#include <klocale.h>
+
+#include "colours.h"
+#include "colourwidgets.h"
+
+/*
+ * RosegardenColourTable
+ * To be documented.
+ */
+RosegardenColourTable::RosegardenColourTable
+ (QWidget *parent, Rosegarden::ColourMap &input, ColourList &list)
+ : QTable(1, 2, parent, "RColourTable")
+{
+ setSorting(FALSE);
+ setSelectionMode(QTable::SingleRow);
+ horizontalHeader()->setLabel(0, i18n("Name"));
+ horizontalHeader()->setLabel(1, i18n("Colour"));
+ populate_table(input, list);
+ connect(this, SIGNAL(doubleClicked(int, int, int, const QPoint&)),
+ SLOT(slotEditEntry(int, int)));
+
+}
+
+void
+RosegardenColourTable::slotEditEntry(int row, int col)
+{
+
+ switch(col)
+ {
+ case 0:
+ {
+ if (row == 0) return;
+ bool ok = false;
+ QString newName = QInputDialog::getText(i18n("Modify Colour Name"),
i18n("Enter new name"),
+ QLineEdit::Normal, item(row,
col)->text(), &ok);
+
+ if ((ok == true) && (!newName.isEmpty()))
+ {
+ emit entryTextChanged(row, newName);
+ return;
+ }
+ }
+ break;
+ case 1:
+ {
+ QColor temp = m_colours[row];
+ KColorDialog box(this, "", true);
+
+ int result = box.getColor(temp);
+
+ if (result == KColorDialog::Accepted)
+ {
+ emit entryColourChanged(row, temp);
+ return;
+ }
+ }
+ break;
+ default: // Should never happen
+ break;
+ }
+
+}
+
+void
+RosegardenColourTable::populate_table(Rosegarden::ColourMap &input, ColourList &list)
+{
+ m_colours.reserve(input.size());
+ setNumRows(input.size());
+
+ unsigned int i=0;
+
+ for (Rosegarden::RCMap::const_iterator it=input.begin(); it!=input.end(); ++it)
+ {
+ if (it->second.second == std::string(""))
+ {
+ QTableItem *text = new QTableItem(this, QTableItem::Never, i18n("Default
Colour"));
+ setItem(i, 0, text);
+ }
+ else
+ {
+ QTableItem *text = new QTableItem(this, QTableItem::OnTyping,
it->second.second);
+ setItem(i, 0, text);
+ }
+
+ list[i] = it->first;
+ m_colours[i] = RosegardenGUIColours::convertColour(it->second.first);
+
+ RosegardenColourTableItem *temp = new RosegardenColourTableItem(this,
m_colours[i]);
+ setItem(i, 1, temp);
+
+ verticalHeader()->setLabel(i, QString::number(it->first));
+
+ ++i;
+ }
+
+}
+
+/*
+ * RosegardenColourTableItem
+ * To be documented.
+ */
+void
+RosegardenColourTableItem::setColor(QColor &input)
+{
+ currentColour = input;
+}
+
+void
+RosegardenColourTableItem::paint(QPainter *p, const QColorGroup &cg, const QRect &cr,
bool selected)
+{
+ QColorGroup g(cg);
+ g.setColor(QColorGroup::Base, currentColour);
+ selected = false;
+ QTableItem::paint(p, g, cr, selected);
+}
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/gui/colourwidgets.h rosegarden-colour/gui/colourwidgets.h
--- rosegarden-pristine2/gui/colourwidgets.h 1970-01-01 01:00:00.000000000 +0100
+++ rosegarden-colour/gui/colourwidgets.h 2003-07-16 22:56:48.000000000 +0100
@@ -0,0 +1,74 @@
+
+// -*- c-basic-offset: 4 -*-
+
+/*
+ Rosegarden-4
+ A sequencer and musical notation editor.
+
+ This program is Copyright 2000-2003
+ Guillaume Laurent <[EMAIL PROTECTED]>,
+ Chris Cannam <[EMAIL PROTECTED]>,
+ Richard Bown <[EMAIL PROTECTED]>
+
+ Portions of this file Copyright 2003
+ Mark Hymers <[EMAIL PROTECTED]>
+
+ The moral right of the authors to claim authorship of this work
+ has been asserted.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version. See the file
+ COPYING included with this distribution for more information.
+*/
+
+#ifndef _COLOURWIDGETS_H_
+#define _COLOURWIDGETS_H_
+
+#include <vector>
+
+#include <qtable.h>
+#include <qsignalmapper.h>
+#include <qcolor.h>
+
+#include "ColourMap.h"
+
+
+class RosegardenColourTable : public QTable
+{
+ Q_OBJECT
+
+public:
+ typedef std::map<unsigned int, unsigned int, std::less<unsigned int> > ColourList;
+ RosegardenColourTable(QWidget *parent, Rosegarden::ColourMap &input, ColourList
&list);
+ void populate_table(Rosegarden::ColourMap &input, ColourList &list);
+
+
+signals:
+ void entryTextChanged(unsigned int, QString);
+ void entryColourChanged(unsigned int, QColor);
+
+public slots:
+ void slotEditEntry (int, int);
+
+protected:
+ std::vector<QColor> m_colours;
+
+};
+
+class RosegardenColourTableItem : public QTableItem
+{
+public:
+ RosegardenColourTableItem(QTable *t, const QColor &input)
+ : QTableItem(t, QTableItem::Never, ""),
+ currentColour(input) {}
+ void setColor(QColor &input);
+ void paint(QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected);
+
+protected:
+ QColor currentColour;
+};
+
+
+#endif // _COLOURWIDGETS_H_
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/gui/rosegardenconfigurationpage.h
rosegarden-colour/gui/rosegardenconfigurationpage.h
--- rosegarden-pristine2/gui/rosegardenconfigurationpage.h 2003-07-06
15:27:34.000000000 +0100
+++ rosegarden-colour/gui/rosegardenconfigurationpage.h 2003-07-21 18:18:15.000000000
+0100
@@ -22,6 +22,10 @@
#ifndef _ROSEGARDENCONFIGUREPAGE_H_
#define _ROSEGARDENCONFIGUREPAGE_H_
+#include <map>
+#include <utility>
+#include <vector>
+
#include <qspinbox.h>
#include <qcombobox.h>
#include <qcheckbox.h>
@@ -29,11 +33,16 @@
#include <qlineedit.h>
#include <klocale.h>
+#include <kcolordialog.h>
+#include <kcolorbutton.h>
#include <string>
+#include "ColourMap.h"
#include "Device.h"
#include "config.h"
+#include "widgets.h"
+#include "colourwidgets.h"
class RosegardenGUIDoc;
class QTabWidget;
@@ -42,8 +51,9 @@
class QRadioButton;
class QLabel;
class QCheckBox;
-class KListView;
class RosegardenQuantizeParameters;
+class KListView;
+class QTable;
namespace Rosegarden
{
@@ -390,6 +400,41 @@
};
/**
+ * Colour Configuration Page
+ *
+ * (document-wide settings)
+ */
+class ColourConfigurationPage : public TabbedConfigurationPage
+{
+ Q_OBJECT
+public:
+ ColourConfigurationPage(RosegardenGUIDoc *doc,
+ QWidget *parent=0, const char *name=0);
+ virtual void apply();
+
+ void populate_table();
+
+ static QString iconLabel() { return i18n("Colour"); }
+ static QString title() { return i18n("Colour Settings"); }
+
+signals:
+ void docColoursChanged();
+
+protected slots:
+ void slotAddNew();
+ void slotDelete();
+ void slotTextChanged(unsigned int, QString);
+ void slotColourChanged(unsigned int, QColor);
+
+protected:
+ RosegardenColourTable *m_colourtable;
+
+ ColourMap m_map;
+ RosegardenColourTable::ColourList m_listmap;
+
+};
+
+/**
* Metronome Configuration page
*
* (document-wide settings)
@@ -415,7 +460,6 @@
};
-
// ----------- SequencerConfigurationage -----------------
//
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/gui/rosegardenconfiguredialog.cpp
rosegarden-colour/gui/rosegardenconfiguredialog.cpp
--- rosegarden-pristine2/gui/rosegardenconfiguredialog.cpp 2003-07-06
15:27:40.000000000 +0100
+++ rosegarden-colour/gui/rosegardenconfiguredialog.cpp 2003-07-21 19:28:46.000000000
+0100
@@ -45,6 +45,8 @@
#include <qtooltip.h>
#include <qvbox.h>
#include <qstringlist.h>
+#include <qtable.h>
+#include <qheader.h>
#include <kcombobox.h>
#include <klistview.h>
@@ -52,8 +54,10 @@
#include <kiconloader.h>
#include <kmessagebox.h>
#include <kprocess.h>
+#include <kcolordialog.h>
#include "constants.h"
+#include "colours.h"
#include "rosestrings.h"
#include "rosegardenconfiguredialog.h"
#include "rosegardenconfigurationpage.h"
@@ -72,8 +76,10 @@
#include "editcommands.h"
#include "studiocontrol.h"
#include "widgets.h"
+#include "colourwidgets.h"
#include "audiopluginmanager.h"
#include "diskspace.h"
+#include "segmentcommands.h"
namespace Rosegarden
{
@@ -909,6 +915,7 @@
}
+
// ------------------- SequencerConfigurationPage ---------------------
//
@@ -1689,6 +1696,102 @@
}
}
+ColourConfigurationPage::ColourConfigurationPage(RosegardenGUIDoc *doc,
+ QWidget *parent,
+ const char *name)
+ : TabbedConfigurationPage(doc, parent, name)
+{
+ QFrame *frame = new QFrame(m_tabWidget);
+ QGridLayout *layout = new QGridLayout(frame, 2, 2,
+ 10, 5);
+
+ m_map = m_doc->getComposition().getSegmentColourMap();
+
+ m_colourtable = new RosegardenColourTable(frame, m_map, m_listmap);
+
+ layout->addMultiCellWidget(m_colourtable, 0, 0, 0, 1);
+
+ QPushButton* addColourButton = new QPushButton(i18n("Add New Colour"),
+ frame);
+ layout->addWidget(addColourButton, 1, 0, Qt::AlignHCenter);
+
+ QPushButton* deleteColourButton = new QPushButton(i18n("Delete Colour"),
+ frame);
+ layout->addWidget(deleteColourButton, 1, 1, Qt::AlignHCenter);
+
+ connect(addColourButton, SIGNAL(clicked()),
+ this, SLOT(slotAddNew()));
+
+ connect(deleteColourButton, SIGNAL(clicked()),
+ this, SLOT(slotDelete()));
+
+ connect(this, SIGNAL(docColoursChanged()),
+ m_doc, SLOT(slotDocColoursChanged()));
+
+ connect(m_colourtable, SIGNAL(entryTextChanged(unsigned int, QString)),
+ this, SLOT(slotTextChanged(unsigned int, QString)));
+
+ connect(m_colourtable, SIGNAL(entryColourChanged(unsigned int, QColor)),
+ this, SLOT(slotColourChanged(unsigned int, QColor)));
+
+ addTab(frame, i18n("Colour Map"));
+
+}
+
+void
+ColourConfigurationPage::slotTextChanged(unsigned int index, QString string)
+{
+ m_map.modifyNameByIndex(m_listmap[index], string.ascii());
+ m_colourtable->populate_table(m_map, m_listmap);
+}
+
+void
+ColourConfigurationPage::slotColourChanged(unsigned int index, QColor color)
+{
+ m_map.modifyColourByIndex(m_listmap[index],
RosegardenGUIColours::convertColour(color));
+ m_colourtable->populate_table(m_map, m_listmap);
+}
+
+void
+ColourConfigurationPage::apply()
+{
+ SegmentColourMapCommand *command = new SegmentColourMapCommand(m_doc, m_map);
+ m_doc->getCommandHistory()->addCommand(command);
+ emit docColoursChanged();
+}
+
+void
+ColourConfigurationPage::slotAddNew()
+{
+ QColor temp;
+
+ KColorDialog box(this, "", true);
+
+ int result = box.getColor( temp );
+
+ if (result == KColorDialog::Accepted)
+ {
+ Rosegarden::Colour temp2 = RosegardenGUIColours::convertColour(temp);
+ m_map.addItem(temp2, i18n("New").ascii());
+ m_colourtable->populate_table(m_map, m_listmap);
+ }
+
+}
+
+void
+ColourConfigurationPage::slotDelete()
+{
+ QTableSelection temp = m_colourtable->selection(0);
+
+ if ((!temp.isActive()) || (temp.topRow()==0))
+ return;
+
+ unsigned int toDel = temp.topRow();
+
+ m_map.deleteItemByIndex(m_listmap[toDel]);
+ m_colourtable->populate_table(m_map, m_listmap);
+
+}
//------------------------------------------------------------
@@ -1837,6 +1940,17 @@
page->setPageIndex(pageIndex(pageWidget));
m_configurationPages.push_back(page);
+ // Colour Page
+ pageWidget = addPage(ColourConfigurationPage::iconLabel(),
+ ColourConfigurationPage::title(),
+ loadIcon(ColourConfigurationPage::iconName()));
+
+ vlay = new QVBoxLayout(pageWidget, 0, spacingHint());
+ page = new ColourConfigurationPage(doc, pageWidget);
+ vlay->addWidget(page);
+ page->setPageIndex(pageIndex(pageWidget));
+ m_configurationPages.push_back(page);
+
// Metronome Page
//
pageWidget = addPage(MetronomeConfigurationPage::iconLabel(),
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/gui/rosegardenguidoc.cpp
rosegarden-colour/gui/rosegardenguidoc.cpp
--- rosegarden-pristine2/gui/rosegardenguidoc.cpp 2003-07-15 21:01:21.000000000
+0100
+++ rosegarden-colour/gui/rosegardenguidoc.cpp 2003-07-21 19:34:03.000000000 +0100
@@ -2106,4 +2106,13 @@
return app->getClipboard();
}
+void RosegardenGUIDoc::slotDocColoursChanged()
+{
+ RG_DEBUG << "RosegardenGUIDoc::slotDocColoursChanged()\n";
+ // XXX: WE NEED TO UPDATE THE WHOLE TRACK DISPLAY HERE
+ // (AS THE SEGMENT COLOUR MAP HAS CHANGED)
+ // I can't get it to work (ARGH) - MH
+ emit docColoursChanged();
+}
+
const unsigned int RosegardenGUIDoc::MinNbOfTracks = 64;
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/gui/rosegardenguidoc.h rosegarden-colour/gui/rosegardenguidoc.h
--- rosegarden-pristine2/gui/rosegardenguidoc.h 2003-07-15 21:01:22.000000000 +0100
+++ rosegarden-colour/gui/rosegardenguidoc.h 2003-07-15 23:12:30.000000000 +0100
@@ -419,6 +419,8 @@
//
void slotNewRecordButton();
+ void slotDocColoursChanged();
+
signals:
/**
* Emitted when document is modified or saved
@@ -428,6 +430,7 @@
void pointerPositionChanged(Rosegarden::timeT);
void playPositionChanged(Rosegarden::timeT);
void loopChanged(Rosegarden::timeT, Rosegarden::timeT);
+ void docColoursChanged();
protected:
/**
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/gui/segmentcanvas.cpp rosegarden-colour/gui/segmentcanvas.cpp
--- rosegarden-pristine2/gui/segmentcanvas.cpp 2003-07-06 15:27:59.000000000 +0100
+++ rosegarden-colour/gui/segmentcanvas.cpp 2003-07-21 17:56:32.000000000 +0100
@@ -33,6 +33,8 @@
#include <kapp.h>
#include <kconfig.h>
+#include "Colour.h"
+#include "ColourMap.h"
#include "Composition.h"
#include "NotationTypes.h"
#include "BaseProperties.h"
@@ -54,13 +56,17 @@
using Rosegarden::SnapGrid;
using Rosegarden::TrackId;
using Rosegarden::timeT;
+using Rosegarden::Colour;
+using Rosegarden::ColourMap;
+using Rosegarden::getCombinationColour;
class SegmentRepeatRectangle : public QCanvasRectangle
{
public:
SegmentRepeatRectangle(QCanvas *,
Rosegarden::Segment *,
- SnapGrid *);
+ SnapGrid *,
+ RosegardenGUIDoc *);
void setRepeatInterval(unsigned int i) { m_repeatInterval = i; }
@@ -75,17 +81,20 @@
Rosegarden::Segment *m_segment;
unsigned int m_repeatInterval;
SnapGrid *m_snapGrid;
+ RosegardenGUIDoc *m_doc;
};
SegmentRepeatRectangle::SegmentRepeatRectangle(QCanvas *canvas,
Rosegarden::Segment *segment,
- SnapGrid *snapGrid)
+ SnapGrid *snapGrid,
+ RosegardenGUIDoc *doc)
: QCanvasRectangle(canvas),
m_segment(segment),
m_repeatInterval(0),
- m_snapGrid(snapGrid)
+ m_snapGrid(snapGrid),
+ m_doc(doc)
{
- setBrush(RosegardenGUIColours::RepeatSegmentBlock);
+
setBrush(RosegardenGUIColours::convertColour(m_doc->getComposition().getSegmentColourMap().getColourByIndex(m_segment->getColourIndex())).light(150));
setPen(RosegardenGUIColours::RepeatSegmentBorder);
}
@@ -113,7 +122,7 @@
int rWidth = int(m_snapGrid->getRulerScale()->
getXForTime(m_repeatInterval));
- painter.setBrush(RosegardenGUIColours::RepeatSegmentBlock);
+
setBrush(RosegardenGUIColours::convertColour(m_doc->getComposition().getSegmentColourMap().getColourByIndex(m_segment->getColourIndex())).light(150));
painter.setPen(RosegardenGUIColours::RepeatSegmentBorder);
while (pos < width + rWidth)
@@ -513,10 +522,20 @@
QCanvasItemList items = canvas()->allItems();
painter.save();
- painter.setBrush(RosegardenGUIColours::SegmentIntersectBlock);
-
+
+ bool colourset = false;
+
for (QCanvasItemList::Iterator it=items.begin(); it!=items.end(); ++it) {
+ if (!colourset)
+ {
+ if (m_segment)
+
painter.setBrush(RosegardenGUIColours::convertColour(m_doc->getComposition().getSegmentColourMap().getColourByIndex(m_segment->getColourIndex())).dark(125));
+ else
+
painter.setBrush(RosegardenGUIColours::convertColour(m_doc->getComposition().getSegmentColourMap().getColourByIndex(0)).dark(125));
+ colourset = true;
+ }
+
if ((*it) == this) continue; // skip ourselves
SegmentItem *item = dynamic_cast<SegmentItem*>(*it);
@@ -577,6 +596,13 @@
{
canvas()->setChanged(rect());
+ // Get our segment colour
+ QColor brush;
+ if (m_segment)
+ brush =
RosegardenGUIColours::convertColour(m_doc->getComposition().getSegmentColourMap().getColourByIndex(m_segment->getColourIndex()));
+ else
+ brush =
RosegardenGUIColours::convertColour(m_doc->getComposition().getSegmentColourMap().getColourByIndex(0));
+
// Compute repeat rectangle if any
//
if (m_segment && inheritFromSegment) {
@@ -588,11 +614,13 @@
m_label = strtoqstr(m_segment->getLabel());
if (m_segment->isRepeating()) {
-
if (!m_repeatRectangle)
m_repeatRectangle = new SegmentRepeatRectangle(canvas(),
getSegment(),
- m_snapGrid);
+ m_snapGrid, m_doc);
+
+ // Set the colour for the repeat rectangle
+ m_repeatRectangle->setBrush(brush.light(150));
timeT repeatStart = m_endTime;
timeT repeatEnd = m_segment->getRepeatEndTime();
@@ -622,6 +650,12 @@
setX(m_snapGrid->getRulerScale()->getXForTime(m_startTime));
setY(m_snapGrid->getYBinCoordinate(m_trackPosition));
+ // Set our segment brush colour
+ if (m_selected)
+ setBrush(brush.dark(200));
+ else
+ setBrush(brush);
+
int h = m_snapGrid->getYSnap();
double w = m_snapGrid->getRulerScale()->getWidthForDuration
(m_startTime, m_endTime - m_startTime);
@@ -758,8 +792,6 @@
m_currentItem(0),
m_recordingSegment(0),
m_splitLine(0),
- m_brush(RosegardenGUIColours::SegmentBlock),
- m_highlightBrush(RosegardenGUIColours::SegmentHighlightBlock),
m_pen(RosegardenGUIColours::SegmentBorder),
m_fineGrain(false),
m_showPreviews(true),
@@ -1051,7 +1083,7 @@
(track, startTime, endTime, m_showPreviews, &m_grid, canvas(), m_doc);
newItem->setPen(m_pen);
- newItem->setBrush(m_brush);
+
newItem->setBrush(RosegardenGUIColours::convertColour(m_doc->getComposition().getSegmentColourMap().getColourByIndex(0)));
newItem->setVisible(true);
newItem->setZ(1); // Segment at Z=1, Pointer at Z=10 [rwb]
@@ -1065,7 +1097,7 @@
(segment, m_showPreviews, &m_grid, canvas(), m_doc);
newItem->setPen(m_pen);
- newItem->setBrush(m_brush);
+
newItem->setBrush(RosegardenGUIColours::convertColour(m_doc->getComposition().getSegmentColourMap().getColourByIndex(segment->getColourIndex())));
newItem->setVisible(true);
newItem->setZ(1); // Segment at Z=1, Pointer at Z=10 [rwb]
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/gui/segmentcanvas.h rosegarden-colour/gui/segmentcanvas.h
--- rosegarden-pristine2/gui/segmentcanvas.h 2003-05-31 19:38:44.000000000 +0100
+++ rosegarden-colour/gui/segmentcanvas.h 2003-07-17 00:16:56.000000000 +0100
@@ -213,9 +213,6 @@
Rosegarden::SnapGrid &grid() { return m_grid; }
- /// Return the brush used by all SegmentItem objects (normally, solid blue)
- const QBrush& brush() const { return m_brush; }
-
/// Return the pen used by all SegmentItem objects
const QPen& pen() const { return m_pen; }
@@ -253,16 +250,6 @@
SegmentRepeatRectangle* findRepeatClickedOn(QPoint);
- /**
- * get the highlight brush from the canvas
- */
- QBrush getHighlightBrush() const { return m_highlightBrush; }
-
- /**
- * Get the normal segment brush
- */
- QBrush getSegmentBrush() const { return m_brush; }
-
SegmentToolBox* getToolBox() { return m_toolBox; }
/**
@@ -378,8 +365,6 @@
SegmentSplitLine *m_splitLine;
- QBrush m_brush;
- QBrush m_highlightBrush;
QPen m_pen;
bool m_fineGrain;
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/gui/segmentcommands.cpp rosegarden-colour/gui/segmentcommands.cpp
--- rosegarden-pristine2/gui/segmentcommands.cpp 2003-07-15 21:01:28.000000000
+0100
+++ rosegarden-colour/gui/segmentcommands.cpp 2003-07-21 19:33:55.000000000 +0100
@@ -2070,3 +2070,66 @@
}
+// Alter colour
+
+SegmentColourCommand::SegmentColourCommand(
+ const Rosegarden::SegmentSelection &segments,
+ const unsigned int index):
+ KNamedCommand(i18n("Change Segment Colour")),
+ m_newColourIndex(index)
+{
+ for (Rosegarden::SegmentSelection::iterator i = segments.begin(); i !=
segments.end(); ++i)
+ m_segments.push_back(*i);
+}
+
+SegmentColourCommand::~SegmentColourCommand()
+{
+}
+
+void
+SegmentColourCommand::execute()
+{
+ for (unsigned int i = 0; i < m_segments.size(); ++i)
+ {
+ m_oldColourIndexes.push_back(m_segments[i]->getColourIndex());
+ m_segments[i]->setColourIndex(m_newColourIndex);
+ }
+}
+
+void
+SegmentColourCommand::unexecute()
+{
+ for (unsigned int i = 0; i < m_segments.size(); ++i)
+ m_segments[i]->setColourIndex(m_oldColourIndexes[i]);
+}
+
+// Alter ColourMap
+SegmentColourMapCommand::SegmentColourMapCommand(
+ RosegardenGUIDoc *doc,
+ const Rosegarden::ColourMap &map):
+ KNamedCommand(i18n("Change Segment Colour Map")),
+ m_doc(doc),
+ m_oldMap(m_doc->getComposition().getSegmentColourMap()),
+ m_newMap(map)
+{
+
+}
+
+SegmentColourMapCommand::~SegmentColourMapCommand()
+{
+}
+
+void
+SegmentColourMapCommand::execute()
+{
+ m_doc->getComposition().setSegmentColourMap(m_newMap);
+ m_doc->slotDocColoursChanged();
+}
+
+void
+SegmentColourMapCommand::unexecute()
+{
+ m_doc->getComposition().setSegmentColourMap(m_oldMap);
+ m_doc->slotDocColoursChanged();
+}
+
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/gui/segmentcommands.h rosegarden-colour/gui/segmentcommands.h
--- rosegarden-pristine2/gui/segmentcommands.h 2003-07-15 21:01:29.000000000 +0100
+++ rosegarden-colour/gui/segmentcommands.h 2003-07-21 15:46:04.000000000 +0100
@@ -32,6 +32,7 @@
#include "rosegardenguidoc.h"
#include "AudioFileManager.h"
#include "Selection.h"
+#include "basiccommand.h"
/**
* Base class for commands from the SegmentParameterBox
@@ -657,7 +658,6 @@
bool m_executed;
};
-
class SegmentLabelCommand : public KNamedCommand
{
public:
@@ -677,4 +677,43 @@
QString m_newLabel;
};
+
+class SegmentColourCommand : public KNamedCommand
+{
+public:
+ SegmentColourCommand(const Rosegarden::SegmentSelection &segments,
+ const unsigned int index);
+ virtual ~SegmentColourCommand();
+
+ static QString getGlobalName()
+ { return i18n("Change Segment Colour..."); }
+
+ virtual void execute();
+ virtual void unexecute();
+protected:
+
+ std::vector<Rosegarden::Segment*> m_segments;
+ std::vector<unsigned int> m_oldColourIndexes;
+ unsigned int m_newColourIndex;
+};
+
+class SegmentColourMapCommand : public KNamedCommand
+{
+public:
+ SegmentColourMapCommand( RosegardenGUIDoc* doc,
+ const Rosegarden::ColourMap& map);
+ virtual ~SegmentColourMapCommand();
+
+ static QString getGlobalName()
+ { return i18n("Change Segment Colour Map..."); }
+
+ virtual void execute();
+ virtual void unexecute();
+protected:
+ RosegardenGUIDoc * m_doc;
+ Rosegarden::ColourMap m_oldMap;
+ Rosegarden::ColourMap m_newMap;
+};
+
+
#endif // _SEGMENTCOMMANDS_H_
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/gui/segmentparameterbox.cpp
rosegarden-colour/gui/segmentparameterbox.cpp
--- rosegarden-pristine2/gui/segmentparameterbox.cpp 2003-07-06 15:28:08.000000000
+0100
+++ rosegarden-colour/gui/segmentparameterbox.cpp 2003-07-21 14:44:39.000000000
+0100
@@ -31,6 +31,7 @@
#include "Quantizer.h"
#include "NotationTypes.h"
+#include "colours.h"
#include "notepixmapfactory.h"
#include "segmentcommands.h"
#include "rosestrings.h"
@@ -60,6 +61,7 @@
delete m_quantizeValue;
delete m_transposeValue;
delete m_delayValue;
+ delete m_colourValue;
}
void
@@ -71,13 +73,14 @@
// magic numbers: 13 is the height of the menu pixmaps, 10 is just 10
int comboHeight = std::max(fontMetrics.height(), 13) + 10;
- QGridLayout *gridLayout = new QGridLayout(this, 5, 2, 8, 1);
+ QGridLayout *gridLayout = new QGridLayout(this, 6, 2, 8, 1);
QLabel *label = new QLabel(i18n("Label"), this);
QLabel *repeatLabel = new QLabel(i18n("Repeat"), this);
QLabel *quantizeLabel = new QLabel(i18n("Quantize"), this);
QLabel *transposeLabel = new QLabel(i18n("Transpose"), this);
QLabel *delayLabel = new QLabel(i18n("Delay"), this);
+ QLabel *colourLabel = new QLabel(i18n("Colour"), this);
// HBox for label
//
@@ -133,16 +136,32 @@
// handle delay combo changes
connect(m_delayValue, SIGNAL(activated(int)),
SLOT(slotDelaySelected(int)));
- //
+
+ // Detect when the document colours are updated
+ connect (m_view->getDocument(), SIGNAL(docColoursChanged()),
+ this, SLOT(slotDocColoursChanged()));
+
// handle text changes for delay
connect(m_delayValue, SIGNAL(textChanged(const QString&)),
SLOT(slotDelayTextChanged(const QString &)));
+ // set up combo box for colours
+ m_colourValue = new KComboBox(false, this);
+ m_colourValue->setFont(font);
+ m_colourValue->setFixedHeight(comboHeight);
+
+ // handle colour combo changes
+ connect(m_colourValue, SIGNAL(activated(int)),
+ SLOT(slotColourSelected(int)));
+
+
+
label->setFont(font);
repeatLabel->setFont(font);
quantizeLabel->setFont(font);
transposeLabel->setFont(font);
delayLabel->setFont(font);
+ colourLabel->setFont(font);
gridLayout->addRowSpacing(0, 8);
@@ -161,6 +180,9 @@
gridLayout->addWidget(delayLabel, 5, 0, AlignLeft);
gridLayout->addWidget(m_delayValue, 5, 1);
+ gridLayout->addWidget(colourLabel, 6, 0, AlignLeft);
+ gridLayout->addWidget(m_colourValue, 6, 1);
+
// populate the quantize combo
//
NotePixmapFactory npf;
@@ -220,6 +242,9 @@
// set delay blank initially
m_delayValue->setCurrentItem(-1);
+ // populate m_colourValue
+ slotDocColoursChanged();
+
}
void
@@ -241,6 +266,31 @@
populateBoxFromSegments();
}
+void
+SegmentParameterBox::slotDocColoursChanged()
+{
+ m_colourValue->clear();
+ m_colourList.clear();
+ // Populate it from composition.m_segmentColourMap
+ Rosegarden::ColourMap temp =
m_view->getDocument()->getComposition().getSegmentColourMap();
+
+ unsigned int i=0;
+
+ for (Rosegarden::RCMap::const_iterator it=temp.begin(); it != temp.end(); ++it)
+ {
+ QPixmap colour(15,15);
+ colour.fill(RosegardenGUIColours::convertColour(it->second.first));
+ if (it->second.second == std::string(""))
+ m_colourValue->insertItem(colour, i18n("Default Colour"), i);
+ else
+ m_colourValue->insertItem(colour, (QString)it->second.second, i);
+ m_colourList[it->first] = i;
+ ++i;
+ }
+
+ m_colourValue->setCurrentItem(0);
+}
+
void SegmentParameterBox::update()
{
RG_DEBUG << "SegmentParameterBox::update()\n";
@@ -261,6 +311,8 @@
Tristate quantized = NotApplicable;
Tristate transposed = NotApplicable;
Tristate delayed = NotApplicable;
+ Tristate diffcolours = NotApplicable;
+ unsigned int myCol = 0;
Rosegarden::timeT qntzLevel = 0;
// At the moment we have no negative delay, so we use negative
@@ -280,6 +332,7 @@
if (quantized == NotApplicable) quantized = None;
if (transposed == NotApplicable) transposed = None;
if (delayed == NotApplicable) delayed = None;
+ if (diffcolours == NotApplicable) diffcolours = None;
// Set label to "*" when multiple labels don't match
//
@@ -381,6 +434,18 @@
delayed = Some;
}
+ // Colour
+
+ if (it == m_segments.begin())
+ {
+ myCol = (*it)->getColourIndex();
+ }
+ else
+ {
+ if (myCol != (*it)->getColourIndex());
+ diffcolours = All;
+ }
+
}
switch(repeated)
@@ -493,6 +558,27 @@
m_delayValue->setEnabled(delayed != NotApplicable);
m_delayValue->blockSignals(false);
+
+ switch(diffcolours)
+ {
+ case None:
+ if (m_colourList.find(myCol) != m_colourList.end())
+ m_colourValue->setCurrentItem(m_colourList[myCol]);
+ else
+ m_colourValue->setCurrentItem(0);
+ break;
+
+
+ case All:
+ case NotApplicable:
+ default:
+ m_colourValue->setCurrentItem(0);
+ break;
+
+ }
+
+ m_colourValue->setEnabled(diffcolours != NotApplicable);
+
}
void SegmentParameterBox::slotRepeatPressed()
@@ -627,6 +713,32 @@
}
}
+void
+SegmentParameterBox::slotColourSelected(int value)
+{
+ unsigned int temp;
+
+ RosegardenColourTable::ColourList::const_iterator pos = m_colourList.find(value);
+
+ if (pos != m_colourList.end())
+ temp = pos->first;
+ else // Somehow we are trying to set a colour which doesn't exist
+ temp = 0;
+
+ Rosegarden::SegmentSelection segments;
+ std::vector<Rosegarden::Segment*>::iterator it;
+
+ for (it = m_segments.begin(); it != m_segments.end(); ++it)
+ {
+ segments.insert(*it);
+ }
+
+ SegmentColourCommand *command = new SegmentColourCommand(segments, temp);
+
+ addCommandToHistory(command);
+
+}
+
MultiViewCommandHistory*
SegmentParameterBox::getCommandHistory()
{
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/gui/segmentparameterbox.h
rosegarden-colour/gui/segmentparameterbox.h
--- rosegarden-pristine2/gui/segmentparameterbox.h 2003-07-06 15:28:10.000000000
+0100
+++ rosegarden-colour/gui/segmentparameterbox.h 2003-07-16 22:59:15.000000000 +0100
@@ -31,6 +31,7 @@
#include "Quantizer.h"
#include "Selection.h"
+#include "colourwidgets.h"
#include "widgets.h"
@@ -87,10 +88,14 @@
void slotEditSegmentLabel();
+ void slotColourSelected(int);
+ void slotDocColoursChanged();
+
virtual void update();
signals:
void documentModified();
+ void canvasModified();
protected:
void initBox();
@@ -102,11 +107,13 @@
KComboBox *m_quantizeValue;
RosegardenComboBox *m_transposeValue;
RosegardenComboBox *m_delayValue;
+ KComboBox *m_colourValue;
std::vector<Rosegarden::Segment*> m_segments;
std::vector<Rosegarden::timeT> m_standardQuantizations;
std::vector<Rosegarden::timeT> m_delays;
std::vector<int> m_realTimeDelays;
+ RosegardenColourTable::ColourList m_colourList;
RosegardenGUIView *m_view;
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/gui/segmenttool.cpp rosegarden-colour/gui/segmenttool.cpp
--- rosegarden-pristine2/gui/segmenttool.cpp 2003-07-06 15:28:11.000000000 +0100
+++ rosegarden-colour/gui/segmenttool.cpp 2003-07-16 23:26:20.000000000 +0100
@@ -26,6 +26,7 @@
#include "segmenttool.h"
+#include "Colour.h"
#include "SnapGrid.h"
#include "NotationTypes.h"
@@ -41,6 +42,7 @@
using Rosegarden::SnapGrid;
using Rosegarden::Note;
using Rosegarden::SegmentSelection;
+using RosegardenGUIColours::convertColour;
//////////////////////////////////////////////////////////////////////
// Segment Tools
@@ -656,7 +658,9 @@
it++)
{
it->second->disconnect(this);
- it->second->setSelected(false, m_canvas->getSegmentBrush());
+ it->second->setSelected(false,
+ convertColour(m_doc->getComposition().getSegmentColourMap()
+
.getColourByIndex(it->second->getSegment()->getColourIndex())));
}
// now clear the selection
@@ -787,7 +791,9 @@
// If we're selecting a Segment through this method
// then don't set the m_currentItem
//
- selectedItem->setSelected(true, m_canvas->getHighlightBrush());
+ selectedItem->setSelected(true,
+ convertColour(m_doc->getComposition().getSegmentColourMap()
+ .getColourByIndex(selectedItem->getSegment()->getColourIndex())).dark(200));
addToSelection(selectedItem);
m_canvas->canvas()->update();
}
@@ -967,7 +973,10 @@
{
removeFromSelection(*oIt);
m_canvas->getSegmentItem(*oIt)->
- setSelected(false, m_canvas->getSegmentBrush());
+ setSelected(false, convertColour(
+ m_doc->getComposition().getSegmentColourMap().
+ getColourByIndex(m_canvas->getSegmentItem(*oIt)
+ ->getSegment()->getColourIndex())));
}
}
diff --exclude-from=rosegarden-colour/.cvsignore --exclude-from=exclude -Naur
rosegarden-pristine2/gui/tempocolour.cpp rosegarden-colour/gui/tempocolour.cpp
--- rosegarden-pristine2/gui/tempocolour.cpp 2003-04-22 16:15:24.000000000 +0100
+++ rosegarden-colour/gui/tempocolour.cpp 2003-07-16 21:11:58.000000000 +0100
@@ -27,7 +27,7 @@
TempoColour::getColour(double tempo)
{
int h, s, v;
- RosegardenGUIColours::SegmentBlock.hsv(&h, &s, &v);
+ RosegardenGUIColours::TempoBase.hsv(&h, &s, &v);
v += 20;
if (v > 255) v = 255;