summaryrefslogtreecommitdiff
path: root/muse2/muse
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2013-02-13 17:52:07 +0000
committerRobert Jonsson <spamatica@gmail.com>2013-02-13 17:52:07 +0000
commit36dadcd27189f0a6fc3d4b5d981c227c1f4992e0 (patch)
treea48f42a3eba57c2320da9d2bf5cdc871197bd82d /muse2/muse
parentb21d6741a77f8b34858c91bd222fb27a70823fa5 (diff)
dark theme
Diffstat (limited to 'muse2/muse')
-rw-r--r--muse2/muse/appearance.cpp72
-rw-r--r--muse2/muse/conf.cpp21
-rw-r--r--muse2/muse/conf.h1
-rw-r--r--muse2/muse/gconfig.cpp4
-rw-r--r--muse2/muse/gconfig.h5
-rw-r--r--muse2/muse/widgets/appearancebase.ui34
-rw-r--r--muse2/muse/widgets/mtscale.cpp24
-rw-r--r--muse2/muse/widgets/mtscale.h1
-rw-r--r--muse2/muse/widgets/mtscale_flo.cpp18
-rw-r--r--muse2/muse/widgets/mtscale_flo.h1
10 files changed, 144 insertions, 37 deletions
diff --git a/muse2/muse/appearance.cpp b/muse2/muse/appearance.cpp
index 0ae3bf6b..f148e752 100644
--- a/muse2/muse/appearance.cpp
+++ b/muse2/muse/appearance.cpp
@@ -177,6 +177,8 @@ Appearance::Appearance(Arranger* a, QWidget* parent)
new IdListViewItem(0x400 + i, id, MusEGlobal::config.partColorNames[i]);
new IdListViewItem(0x41c, aid, "part canvas background");
+ new IdListViewItem(0x41f, aid, "Ruler background");
+ new IdListViewItem(0x420, aid, "Ruler text");
id = new IdListViewItem(0, aid, "Track List");
new IdListViewItem(0x411, id, "background");
new IdListViewItem(0x412, id, "midi background");
@@ -190,7 +192,7 @@ Appearance::Appearance(Arranger* a, QWidget* parent)
new IdListViewItem(0x419, id, "synth background");
new IdListViewItem(0x41a, id, "selected track background");
new IdListViewItem(0x41b, id, "selected track foreground");
- // 0x41e is already used (between 413 and 414)
+ // 0x41c - 0x420 is already used (see above)
id = new IdListViewItem(0, itemList, "BigTime");
new IdListViewItem(0x100, id, "background");
new IdListViewItem(0x101, id, "foreground");
@@ -463,31 +465,63 @@ void Appearance::updateFonts()
void Appearance::apply()
{
+
+ // Changing color themes overrides all other configurations
+
+ if (colorSchemeComboBox->currentIndex()==1) // light theme
+ {
+ // load standard light theme
+ backgroundTree->reset();
+ styleSheetPath->setText("");
+ MusEGlobal::muse->loadStyleSheetFile("");
+ MusEGlobal::config.styleSheetFile = "";
+ QString configPath = MusEGlobal::museGlobalShare +"/lightbase.cfg";
+ MusECore::readConfiguration(configPath.toLatin1().constData());
+ colorSchemeComboBox->setCurrentIndex(0);
+ MusEGlobal::muse->changeConfig(true);
+ return;
+
+ }
+ else if (colorSchemeComboBox->currentIndex()==2) // dark theme
+ {
+ // load standard dark theme
+ backgroundTree->reset();
+ styleSheetPath->setText(MusEGlobal::museGlobalShare +"/darkbase.qss");
+ MusEGlobal::config.styleSheetFile = styleSheetPath->text();
+ QString configPath = MusEGlobal::museGlobalShare +"/darkbase.cfg";
+ MusECore::readConfiguration(configPath.toLatin1().constData());
+ colorSchemeComboBox->setCurrentIndex(0);
+ MusEGlobal::muse->changeConfig(true);
+ return;
+ }
+
+//
+//
int showPartEvent = 0;
int showPartType = 0;
- if (partShownames->isChecked())
+ if (partShownames->isChecked())
showPartType |= 1;
- if (partShowevents->isChecked())
+ if (partShowevents->isChecked())
showPartType |= 2;
- if (partCakeStretch->isChecked())
+ if (partCakeStretch->isChecked())
showPartType |= 4;
config->canvasShowPartType = showPartType;
- if (eventNoteon->isChecked())
+ if (eventNoteon->isChecked())
showPartEvent |= (1 << 0);
- if (eventPolypressure->isChecked())
+ if (eventPolypressure->isChecked())
showPartEvent |= (1 << 1);
- if (eventController->isChecked())
+ if (eventController->isChecked())
showPartEvent |= (1 << 2);
- if (eventProgramchange->isChecked())
+ if (eventProgramchange->isChecked())
showPartEvent |= (1 << 3);
- if (eventAftertouch->isChecked())
+ if (eventAftertouch->isChecked())
showPartEvent |= (1 << 4);
- if (eventPitchbend->isChecked())
+ if (eventPitchbend->isChecked())
showPartEvent |= (1 << 5);
- if (eventSpecial->isChecked())
+ if (eventSpecial->isChecked())
showPartEvent |= (1 << 6);
config->canvasShowPartEvent = showPartEvent;
@@ -502,11 +536,11 @@ void Appearance::apply()
config->canvasCustomBgList = QStringList();
for (int i = 0; i < user_bg->childCount(); ++i)
config->canvasCustomBgList << user_bg->child(i)->data(0, Qt::UserRole).toString();
-
+
config->styleSheetFile = styleSheetPath->text();
-
+
config->fonts[0].setFamily(fontName0->text());
-
+
config->fonts[0].setPointSize(fontSize0->value());
config->fonts[0].setItalic(italic0->isChecked());
config->fonts[0].setBold(bold0->isChecked());
@@ -543,15 +577,15 @@ void Appearance::apply()
config->fonts[6].setBold(bold6->isChecked());
config->style = themeComboBox->currentIndex() == 0 ? QString() : themeComboBox->currentText();
- // setting up a new theme might change the fontsize, so re-read
+ // setting up a new theme might change the fontsize, so re-read
fontSize0->setValue(QApplication::font().pointSize());
config->canvasShowGrid = arrGrid->isChecked();
-
+
config->globalAlphaBlend = globalAlphaVal->value();
-
// set colors...
MusEGlobal::config = *config;
+
MusEGlobal::muse->changeConfig(true);
}
@@ -706,8 +740,12 @@ void Appearance::colorItemSelectionChanged()
case 0x41b: color = &config->selectTrackFg; break;
case 0x41c: color = &config->partCanvasBg; break;
case 0x41d: color = &config->ctrlGraphFg; break;
+
// 0x41e is already used (between 413 and 414)
+ case 0x41f: color = &config->rulerBg; break;
+ case 0x420: color = &config->rulerFg; break;
+
case 0x500: color = &config->mixerBg; break;
case 0x501: color = &config->midiTrackLabelBg; break;
case 0x502: color = &config->drumTrackLabelBg; break;
diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp
index cff98bdd..417345c0 100644
--- a/muse2/muse/conf.cpp
+++ b/muse2/muse/conf.cpp
@@ -859,6 +859,11 @@ void readConfiguration(Xml& xml, bool doReadMidiPortConfig, bool doReadGlobalCon
MusEGlobal::config.transportHandleColor = readColor(xml);
else if (tag == "waveEditBackgroundColor")
MusEGlobal::config.waveEditBackgroundColor = readColor(xml);
+ else if (tag == "rulerBackgroundColor")
+ MusEGlobal::config.rulerBg = readColor(xml);
+ else if (tag == "rulerForegroundColor")
+ MusEGlobal::config.rulerFg = readColor(xml);
+
//else if (tag == "midiSyncInfo")
// readConfigMidiSyncInfo(xml);
/* Obsolete. done by song's toplevel list. arrangerview also handles arranger.
@@ -1026,13 +1031,21 @@ void readConfiguration(Xml& xml, bool doReadMidiPortConfig, bool doReadGlobalCon
//---------------------------------------------------------
// readConfiguration
//---------------------------------------------------------
-
bool readConfiguration()
+{
+ return readConfiguration(NULL);
+}
+
+bool readConfiguration(const char *configFile)
{
- FILE* f = fopen(MusEGlobal::configName.toLatin1().constData(), "r");
+ if (configFile == NULL)
+ configFile = MusEGlobal::configName.toLatin1().constData();
+
+ printf("Config File <%s>\n", configFile);
+ FILE* f = fopen(configFile, "r");
if (f == 0) {
if (MusEGlobal::debugMsg || MusEGlobal::debugMode)
- fprintf(stderr, "NO Config File <%s> found\n", MusEGlobal::configName.toLatin1().constData());
+ fprintf(stderr, "NO Config File <%s> found\n", configFile);
if (MusEGlobal::config.userInstrumentsDir.isEmpty())
MusEGlobal::config.userInstrumentsDir = MusEGlobal::configPath + "/instruments";
@@ -1398,6 +1411,8 @@ void MusE::writeGlobalConfiguration(int level, MusECore::Xml& xml) const
xml.colorTag(level, "bigtimeForegroundcolor", MusEGlobal::config.bigTimeForegroundColor);
xml.colorTag(level, "bigtimeBackgroundcolor", MusEGlobal::config.bigTimeBackgroundColor);
xml.colorTag(level, "waveEditBackgroundColor", MusEGlobal::config.waveEditBackgroundColor);
+ xml.colorTag(level, "rulerBackgroundColor", MusEGlobal::config.rulerBg);
+ xml.colorTag(level, "rulerForegroundColor", MusEGlobal::config.rulerFg);
MusEGlobal::writePluginGroupConfiguration(level, xml);
diff --git a/muse2/muse/conf.h b/muse2/muse/conf.h
index 0813ed3e..0b301829 100644
--- a/muse2/muse/conf.h
+++ b/muse2/muse/conf.h
@@ -54,6 +54,7 @@ class MidiFileConfig : public QDialog, public Ui::ConfigMidiFileBase {
namespace MusECore {
class Xml;
extern bool readConfiguration();
+extern bool readConfiguration(const char *configFile);
extern void readConfiguration(Xml&, bool doReadMidiPorts, bool doReadGlobalConfig);
}
diff --git a/muse2/muse/gconfig.cpp b/muse2/muse/gconfig.cpp
index ac7c50a6..0dc92c7a 100644
--- a/muse2/muse/gconfig.cpp
+++ b/muse2/muse/gconfig.cpp
@@ -125,6 +125,9 @@ GlobalConfigValues config = {
QColor(255, 170, 0), // ctrlGraphFg; Medium orange
QColor(0, 0, 0), // mixerBg;
+ QColor(0xe0, 0xe0, 0xe0), // Ruler background
+ QColor(0, 0, 0), // Ruler text
+
384, // division;
1024, // rtcTicks
true, // midiSendInit Send instrument initialization sequences
@@ -207,6 +210,7 @@ GlobalConfigValues config = {
MusEGlobal::PREFER_NEW, // drumTrackPreference
true, // smartFocus
20, // trackHeight
+
};
} // namespace MusEGlobal
diff --git a/muse2/muse/gconfig.h b/muse2/muse/gconfig.h
index d8e52e6e..52763032 100644
--- a/muse2/muse/gconfig.h
+++ b/muse2/muse/gconfig.h
@@ -24,7 +24,7 @@
#ifndef __CONFIG_H__
#define __CONFIG_H__
-#define NUM_PARTCOLORS 17
+#define NUM_PARTCOLORS 19
#define NUM_FONTS 7
#include <QColor>
@@ -134,6 +134,9 @@ struct GlobalConfigValues {
QColor ctrlGraphFg;
QColor mixerBg;
+ QColor rulerBg;
+ QColor rulerFg;
+
int division;
int rtcTicks;
bool midiSendInit; // Send instrument initialization sequences
diff --git a/muse2/muse/widgets/appearancebase.ui b/muse2/muse/widgets/appearancebase.ui
index 887f3834..3f270d36 100644
--- a/muse2/muse/widgets/appearancebase.ui
+++ b/muse2/muse/widgets/appearancebase.ui
@@ -23,7 +23,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
- <number>0</number>
+ <number>2</number>
</property>
<widget class="QWidget" name="tab1">
<attribute name="title">
@@ -189,9 +189,6 @@
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
- <attribute name="headerVisible">
- <bool>false</bool>
- </attribute>
<column>
<property name="text">
<string notr="true">1</string>
@@ -1202,6 +1199,35 @@
</layout>
</item>
<item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>MusE color scheme</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="colorSchemeComboBox">
+ <item>
+ <property name="text">
+ <string>current settings</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>light theme (changing overrides all other settings)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>dark theme (changing overrides all other settings)</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item>
<spacer name="spacer3">
<property name="orientation">
<enum>Qt::Vertical</enum>
diff --git a/muse2/muse/widgets/mtscale.cpp b/muse2/muse/widgets/mtscale.cpp
index 00947f6f..e15d22fa 100644
--- a/muse2/muse/widgets/mtscale.cpp
+++ b/muse2/muse/widgets/mtscale.cpp
@@ -27,6 +27,7 @@
#include "mtscale.h"
#include "song.h"
+#include "app.h"
#include "icons.h"
#include "gconfig.h"
@@ -60,9 +61,19 @@ MTScale::MTScale(int* r, QWidget* parent, int xs, bool _mode)
connect(MusEGlobal::song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(setPos(int, unsigned, bool)));
connect(MusEGlobal::song, SIGNAL(songChanged(MusECore::SongChangedFlags_t)), SLOT(songChanged(MusECore::SongChangedFlags_t)));
connect(MusEGlobal::song, SIGNAL(markerChanged(int)), SLOT(redraw()));
-
+ connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(configChanged()));
+
setFixedHeight(28);
- setBg(QColor(0xe0, 0xe0, 0xe0));
+
+ setBg(MusEGlobal::config.rulerBg);
+ //setBg(QColor(0xe0, 0xe0, 0xe0));
+ }
+
+void MTScale::configChanged()
+ {
+ setBg(MusEGlobal::config.rulerBg);
+
+
}
//---------------------------------------------------------
@@ -234,7 +245,7 @@ void MTScale::pdraw(QPainter& p, const QRect& r)
//---------------------------------------------------
int y = 12;
- p.setPen(Qt::black);
+ p.setPen(MusEGlobal::config.rulerFg);
p.setFont(MusEGlobal::config.fonts[5]);
p.drawLine(r.x(), y+1, r.x() + r.width(), y+1);
QRect tr(r);
@@ -270,8 +281,7 @@ void MTScale::pdraw(QPainter& p, const QRect& r)
{
if (m->second.current())
{
- //p.fillRect(tr, white);
- p.fillRect(wr, Qt::white);
+ p.fillRect(tr, Qt::white);
}
int x2;
@@ -303,7 +313,7 @@ void MTScale::pdraw(QPainter& p, const QRect& r)
if(xp >= -1023)
{
QRect r = QRect(xp+10, 0, x2-xp, 12);
- p.setPen(Qt::black);
+ p.setPen(MusEGlobal::config.rulerFg);
p.drawText(r, Qt::AlignLeft|Qt::AlignVCenter, m->second.name());
}
@@ -343,7 +353,7 @@ void MTScale::pdraw(QPainter& p, const QRect& r)
}
}
}
- p.setPen(Qt::black);
+ p.setPen(MusEGlobal::config.rulerFg);
if (pos[3] != INT_MAX) {
int xp = mapx(pos[3]);
if (xp >= x && xp < x+w)
diff --git a/muse2/muse/widgets/mtscale.h b/muse2/muse/widgets/mtscale.h
index 4f76dcc2..db873e7f 100644
--- a/muse2/muse/widgets/mtscale.h
+++ b/muse2/muse/widgets/mtscale.h
@@ -44,6 +44,7 @@ class MTScale : public View {
private slots:
void songChanged(MusECore::SongChangedFlags_t);
+ void configChanged();
protected:
virtual void pdraw(QPainter&, const QRect&);
diff --git a/muse2/muse/widgets/mtscale_flo.cpp b/muse2/muse/widgets/mtscale_flo.cpp
index 9eb0253a..3b6ea502 100644
--- a/muse2/muse/widgets/mtscale_flo.cpp
+++ b/muse2/muse/widgets/mtscale_flo.cpp
@@ -27,6 +27,7 @@
#include "mtscale_flo.h"
#include "song.h"
+#include "app.h"
#include "icons.h"
#include "gconfig.h"
#include "scoreedit.h"
@@ -53,13 +54,20 @@ MTScaleFlo::MTScaleFlo(ScoreCanvas* parent_editor, QWidget* parent_widget)
connect(MusEGlobal::song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(setPos(int, unsigned, bool)));
connect(MusEGlobal::song, SIGNAL(songChanged(MusECore::SongChangedFlags_t)), SLOT(songChanged(MusECore::SongChangedFlags_t)));
connect(MusEGlobal::song, SIGNAL(markerChanged(int)), SLOT(redraw()));
-
+ connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(configChanged()));
+
parent=parent_editor;
setFixedHeight(28);
- setBg(QColor(0xe0, 0xe0, 0xe0));
+ setBg(MusEGlobal::config.rulerBg);
}
+void MTScaleFlo::configChanged()
+ {
+ setBg(MusEGlobal::config.rulerBg);
+
+
+ }
//---------------------------------------------------------
// songChanged
//---------------------------------------------------------
@@ -193,7 +201,7 @@ void MTScaleFlo::draw(QPainter& p, const QRect& r)
//---------------------------------------------------
int y = 12;
- p.setPen(Qt::black);
+ p.setPen(MusEGlobal::config.rulerFg);
p.setFont(MusEGlobal::config.fonts[5]);
p.drawLine(r.x(), y+1, r.x() + r.width(), y+1);
QRect tr(r);
@@ -230,7 +238,7 @@ void MTScaleFlo::draw(QPainter& p, const QRect& r)
if(xp >= -1023)
{
QRect r = QRect(xp+10, 0, x2-xp, 12);
- p.setPen(Qt::black);
+ p.setPen(MusEGlobal::config.rulerFg);
p.drawText(r, Qt::AlignLeft|Qt::AlignVCenter, m->second.name());
}
@@ -262,7 +270,7 @@ void MTScaleFlo::draw(QPainter& p, const QRect& r)
//---------------------------------------------------
- p.setPen(Qt::black);
+ p.setPen(MusEGlobal::config.rulerFg);
unsigned ctick;
int bar1, bar2, beat;
diff --git a/muse2/muse/widgets/mtscale_flo.h b/muse2/muse/widgets/mtscale_flo.h
index 4b089f5e..caadc994 100644
--- a/muse2/muse/widgets/mtscale_flo.h
+++ b/muse2/muse/widgets/mtscale_flo.h
@@ -46,6 +46,7 @@ class MTScaleFlo : public View {
private slots:
void songChanged(MusECore::SongChangedFlags_t);
+ void configChanged();
protected:
virtual void draw(QPainter&, const QRect&);