From 402d761f25837310da17061b56182aa3e1f4b4b9 Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Sun, 24 Feb 2013 12:10:19 +0000 Subject: color fixes --- muse2/ChangeLog | 4 + muse2/muse/appearance.cpp | 90 ++++--- muse2/muse/appearance.h | 1 + muse2/muse/conf.cpp | 14 ++ muse2/muse/ctrl/ctrlcanvas.cpp | 2 +- muse2/muse/gconfig.cpp | 6 +- muse2/muse/gconfig.h | 4 + muse2/muse/midiedit/dlist.cpp | 3 +- muse2/muse/midiedit/ecanvas.cpp | 3 +- muse2/muse/midiedit/prcanvas.cpp | 2 +- muse2/muse/midiedit/scoreedit.cpp | 2 +- muse2/muse/widgets/CMakeLists.txt | 4 +- muse2/muse/widgets/appearancebase.ui | 441 ++++++++++++++++++----------------- muse2/muse/widgets/colorframe.cpp | 17 ++ muse2/muse/widgets/colorframe.h | 23 ++ muse2/muse/widgets/mtscale.cpp | 2 +- muse2/muse/widgets/mtscale_flo.cpp | 2 +- 17 files changed, 360 insertions(+), 260 deletions(-) create mode 100644 muse2/muse/widgets/colorframe.cpp create mode 100644 muse2/muse/widgets/colorframe.h (limited to 'muse2') diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 4b7acfba..83ad8da6 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,7 @@ +24.02.2013: + - Improved dark theme, midi editors now set background color, the current part of the ruler is darker. + Theme setting separated from the regular Ok button in the Appearance settings. Also fixed the color + viewer in the color selector when using the dark theme. (rj) 23.02.2013: - Added missing line draw shortcut (F) to drum editor. (Tim) 22.02.2013: diff --git a/muse2/muse/appearance.cpp b/muse2/muse/appearance.cpp index f148e752..2b696c7b 100644 --- a/muse2/muse/appearance.cpp +++ b/muse2/muse/appearance.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include "icons.h" #include "appearance.h" @@ -145,7 +146,7 @@ Appearance::Appearance(Arranger* a, QWidget* parent) global_bg->setFlags(Qt::ItemIsEnabled); user_bg = new QTreeWidgetItem(backgroundTree, QStringList(tr("Custom")), 0); user_bg->setFlags(Qt::ItemIsEnabled); - colorframe->setAutoFillBackground(true); + colorwidget->setAutoFillBackground(true); aPalette = new QButtonGroup(aPaletteBox); aPalette->addButton(palette0, 0); @@ -179,6 +180,7 @@ Appearance::Appearance(Arranger* a, QWidget* parent) new IdListViewItem(0x41c, aid, "part canvas background"); new IdListViewItem(0x41f, aid, "Ruler background"); new IdListViewItem(0x420, aid, "Ruler text"); + new IdListViewItem(0x424, aid, "Ruler current marker space"); id = new IdListViewItem(0, aid, "Track List"); new IdListViewItem(0x411, id, "background"); new IdListViewItem(0x412, id, "midi background"); @@ -199,7 +201,11 @@ Appearance::Appearance(Arranger* a, QWidget* parent) id = new IdListViewItem(0, itemList, "Transport"); new IdListViewItem(0x200, id, "handle"); id = new IdListViewItem(0, itemList, "Midi Editor"); - new IdListViewItem(0x41d, id, "controller graph"); + new IdListViewItem(0x41d, id, "controller graph color"); + new IdListViewItem(0x423, id, "controller graph background"); + new IdListViewItem(0x421, id, "background"); + new IdListViewItem(0x422, id, "drum list"); + id = new IdListViewItem(0, itemList, "Wave Editor"); new IdListViewItem(0x300, id, "background"); id = new IdListViewItem(0, itemList, "Mixer"); @@ -235,6 +241,7 @@ Appearance::Appearance(Arranger* a, QWidget* parent) connect(hval, SIGNAL(valueChanged(int)), SLOT(hsliderChanged(int))); connect(sval, SIGNAL(valueChanged(int)), SLOT(ssliderChanged(int))); connect(vval, SIGNAL(valueChanged(int)), SLOT(vsliderChanged(int))); + connect(changeThemeButton, SIGNAL(clicked()), SLOT(changeTheme())); connect(addToPalette, SIGNAL(clicked()), SLOT(addToPaletteClicked())); @@ -460,41 +467,52 @@ void Appearance::updateFonts() } //--------------------------------------------------------- -// apply +// changeTheme +// +// Simple theme selector that over time should +// be exchanged for a more dynamic solution //--------------------------------------------------------- -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); +void Appearance::changeTheme() +{ + if(QMessageBox::question(MusEGlobal::muse, QString("Muse"), + tr("Do you really want to reset colors to theme default?"), tr("&Ok"), tr("&Cancel"), + QString::null, 0, 1 ) == 1) + { return; + } + + 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); + } + 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); + } + close(); +} +//--------------------------------------------------------- +// apply +//--------------------------------------------------------- - } - else if (colorSchemeComboBox->currentIndex()==2) // dark theme +void Appearance::apply() { - // 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; @@ -745,6 +763,10 @@ void Appearance::colorItemSelectionChanged() case 0x41f: color = &config->rulerBg; break; case 0x420: color = &config->rulerFg; break; + case 0x421: color = &config->midiCanvasBg; break; + case 0x422: color = &config->drumListBg; break; + case 0x423: color = &config->midiControllerViewBg; break; + case 0x424: color = &config->rulerCurrent; break; case 0x500: color = &config->mixerBg; break; case 0x501: color = &config->midiTrackLabelBg; break; @@ -790,8 +812,8 @@ void Appearance::updateColor() QPalette pal; QColor cfc(*color); - pal.setColor(colorframe->backgroundRole(), cfc); - colorframe->setPalette(pal); + colorwidget->setColor(cfc); + color->getRgb(&r, &g, &b); color->getHsv(&h, &s, &v); diff --git a/muse2/muse/appearance.h b/muse2/muse/appearance.h index 8b746cfd..f6023f22 100644 --- a/muse2/muse/appearance.h +++ b/muse2/muse/appearance.h @@ -61,6 +61,7 @@ class Appearance : public QDialog, public Ui::AppearanceDialogBase { private slots: void apply(); void ok(); + void changeTheme(); void cancel(); void addBackground(); void removeBackground(); diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp index 1f20d79b..535b6dbc 100644 --- a/muse2/muse/conf.cpp +++ b/muse2/muse/conf.cpp @@ -863,6 +863,16 @@ void readConfiguration(Xml& xml, bool doReadMidiPortConfig, bool doReadGlobalCon MusEGlobal::config.rulerBg = readColor(xml); else if (tag == "rulerForegroundColor") MusEGlobal::config.rulerFg = readColor(xml); + else if (tag == "rulerCurrentColor") { + MusEGlobal::config.rulerCurrent = readColor(xml); + printf ("Read ruler current color!!!!!\n"); + } + else if (tag == "midiCanvasBackgroundColor") + MusEGlobal::config.midiCanvasBg = readColor(xml); + else if (tag == "midiControllerViewBackgroundColor") + MusEGlobal::config.midiControllerViewBg = readColor(xml); + else if (tag == "drumListBackgroundColor") + MusEGlobal::config.drumListBg = readColor(xml); //else if (tag == "midiSyncInfo") // readConfigMidiSyncInfo(xml); @@ -1416,6 +1426,10 @@ void MusE::writeGlobalConfiguration(int level, MusECore::Xml& xml) const xml.colorTag(level, "waveEditBackgroundColor", MusEGlobal::config.waveEditBackgroundColor); xml.colorTag(level, "rulerBackgroundColor", MusEGlobal::config.rulerBg); xml.colorTag(level, "rulerForegroundColor", MusEGlobal::config.rulerFg); + xml.colorTag(level, "rulerCurrentColor", MusEGlobal::config.rulerCurrent); + xml.colorTag(level, "midiCanvasBackgroundColor", MusEGlobal::config.midiCanvasBg); + xml.colorTag(level, "midiControllerViewBackgroundColor", MusEGlobal::config.midiControllerViewBg); + xml.colorTag(level, "drumListBackgroundColor", MusEGlobal::config.drumListBg); MusEGlobal::writePluginGroupConfiguration(level, xml); diff --git a/muse2/muse/ctrl/ctrlcanvas.cpp b/muse2/muse/ctrl/ctrlcanvas.cpp index 1825d75d..d5adbc4f 100644 --- a/muse2/muse/ctrl/ctrlcanvas.cpp +++ b/muse2/muse/ctrl/ctrlcanvas.cpp @@ -188,7 +188,7 @@ void CEventList::clearDelete() CtrlCanvas::CtrlCanvas(MidiEditor* e, QWidget* parent, int xmag, const char* name, CtrlPanel* pnl) : View(parent, xmag, 1, name) { - setBg(Qt::white); + setBg(MusEGlobal::config.midiControllerViewBg); setFont(MusEGlobal::config.fonts[3]); editor = e; _panel = pnl; diff --git a/muse2/muse/gconfig.cpp b/muse2/muse/gconfig.cpp index 79bad91d..15938f1c 100644 --- a/muse2/muse/gconfig.cpp +++ b/muse2/muse/gconfig.cpp @@ -125,8 +125,12 @@ GlobalConfigValues config = { QColor(255, 170, 0), // ctrlGraphFg; Medium orange QColor(0, 0, 0), // mixerBg; - QColor(0xe0, 0xe0, 0xe0), // Ruler background + QColor(0xe0, 0xe0, 0xe0), // Ruler background QColor(0, 0, 0), // Ruler text + QColor(255, 255, 255), // Midi editor canvas + QColor(255, 255, 255), // midiControllerViewBg + QColor(255, 255, 255), // drumListBg + QColor(255, 255, 255), // rulerCurrent 384, // division; 1024, // rtcTicks diff --git a/muse2/muse/gconfig.h b/muse2/muse/gconfig.h index 44e982ab..93052427 100644 --- a/muse2/muse/gconfig.h +++ b/muse2/muse/gconfig.h @@ -136,6 +136,10 @@ struct GlobalConfigValues { QColor rulerBg; QColor rulerFg; + QColor midiCanvasBg; + QColor midiControllerViewBg; + QColor drumListBg; + QColor rulerCurrent; int division; int rtcTicks; diff --git a/muse2/muse/midiedit/dlist.cpp b/muse2/muse/midiedit/dlist.cpp index 58345ba9..09b33735 100644 --- a/muse2/muse/midiedit/dlist.cpp +++ b/muse2/muse/midiedit/dlist.cpp @@ -31,6 +31,7 @@ #include "globals.h" #include "globaldefs.h" +#include "gconfig.h" #include "app.h" #include "audio.h" #include "pitchedit.h" @@ -1202,7 +1203,7 @@ void DList::songChanged(MusECore::SongChangedFlags_t flags) void DList::init(QHeaderView* h, QWidget* parent) { - setBg(Qt::white); + setBg(MusEGlobal::config.drumListBg); if (!h) h = new QHeaderView(Qt::Horizontal, parent); diff --git a/muse2/muse/midiedit/ecanvas.cpp b/muse2/muse/midiedit/ecanvas.cpp index d2456283..492727cb 100644 --- a/muse2/muse/midiedit/ecanvas.cpp +++ b/muse2/muse/midiedit/ecanvas.cpp @@ -44,6 +44,7 @@ #include "audio.h" #include "functions.h" #include "midi.h" +#include "gconfig.h" namespace MusEGui { @@ -67,7 +68,7 @@ EventCanvas::EventCanvas(MidiEditor* pr, QWidget* parent, int sx, playedPitchPort = -1; playedVelocity = 0; - setBg(Qt::white); + setBg(MusEGlobal::config.midiCanvasBg); setAcceptDrops(true); setFocusPolicy(Qt::StrongFocus); setMouseTracking(true); diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp index 83c20a1a..92ed3758 100644 --- a/muse2/muse/midiedit/prcanvas.cpp +++ b/muse2/muse/midiedit/prcanvas.cpp @@ -736,7 +736,7 @@ void PianoCanvas::drawCanvas(QPainter& p, const QRect& rect) p.drawLine(x, yy, x + w, yy); break; default: - p.fillRect(x, yy-3, w, 6, QBrush(QColor(230,230,230))); + p.fillRect(x, yy-3, w, 6, MusEGlobal::config.midiCanvasBg.darker(110)); break; } --key; diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 3e4fd5c8..543e86aa 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -1271,7 +1271,7 @@ ScoreCanvas::ScoreCanvas(ScoreEdit* pr, QWidget* parent_widget) : View(parent_wi { parent = pr; setFocusPolicy(Qt::StrongFocus); - setBg(Qt::white); + setBg(MusEGlobal::config.midiCanvasBg); setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt index 8c407525..a4db13af 100644 --- a/muse2/muse/widgets/CMakeLists.txt +++ b/muse2/muse/widgets/CMakeLists.txt @@ -36,7 +36,8 @@ QT4_WRAP_CPP (widget_mocs action.h bigtime.h canvas.h - checkbox.h + checkbox.h + colorframe.h comboQuant.h combobox.h comment.h @@ -158,6 +159,7 @@ file (GLOB widgets_source_files canvas.cpp checkbox.cpp citem.cpp + colorframe.cpp comboQuant.cpp combobox.cpp comment.cpp diff --git a/muse2/muse/widgets/appearancebase.ui b/muse2/muse/widgets/appearancebase.ui index b82ff182..0468cef7 100644 --- a/muse2/muse/widgets/appearancebase.ui +++ b/muse2/muse/widgets/appearancebase.ui @@ -6,8 +6,8 @@ 0 0 - 558 - 531 + 519 + 517 @@ -23,7 +23,7 @@ - 0 + 2 @@ -776,19 +776,13 @@ - + 0 0 - - QFrame::StyledPanel - - - QFrame::Sunken - @@ -1084,15 +1078,9 @@ - QT Theme + Themes - - - 6 - - - 11 - + @@ -1209,23 +1197,34 @@ - - - - current settings - - + - - light theme (changing overrides all other settings) - + + + + current settings + + + + + light theme (changing overrides all other settings) + + + + + dark theme (changing overrides all other settings) + + + - - dark theme (changing overrides all other settings) - + + + Change + + - + @@ -1258,33 +1257,47 @@ 6 - - + + - Family + Italic - - false + + + + + + Italic - - + + - Size + Italic - - false + + + + + + + 0 + 0 + - - - - Font 1 + + + + + 0 + 0 + - - false + + ... @@ -1298,28 +1311,28 @@ - - + + - Font 3 + Family false - - - - - 0 - 0 - + + + + Font 5 + + + false - - + + 0 @@ -1328,216 +1341,205 @@ - - - - - 0 - 0 - + + + + Bold - - + + + + Italic + + + + + - + 0 0 + + ... + - - + + - Font 0 + Font 3 false - - + + - + 0 0 - - + + - + 0 0 - - - - - 0 - 0 - + + + + Bold - - + + - + 0 0 - - - - - - Bold - - - - - - Bold + ... - - - - Bold + + + + + 0 + 0 + - - - - Bold + + + + + 0 + 0 + - - - - - Italic + ... - - + + - Italic + Font 0 - - - - - - Italic + + false - - - - Italic + + + + + 0 + 0 + - - + + - + 0 0 - - ... - - - + + - + 0 0 - - ... - - - + + - + 0 0 + + + + - ... + Bold - - + + - + 0 0 - - ... - - - + + - Font 4 + Font 1 false - - + + - + 0 0 - - - - Font 5 - - - false + + + + + 0 + 0 + - - + + 0 @@ -1556,24 +1558,37 @@ - - + + + + Bold + + + + + - + 0 0 + + ... + - - + + - + 0 0 + + ... + @@ -1583,97 +1598,81 @@ - - + + Italic - - - - - 0 - 0 - - + + - ... + Bold - - + + - + 0 0 - - - - - - - 0 - 0 - + + ... - - + + - Bold + Italic - - + + Bold - - + + - Italic + Font 4 + + + false - - + + Italic - - + + - + 0 0 - - ... - - - - - - 0 - 0 - - + + - ... + Size + + + false @@ -1737,6 +1736,14 @@ + + + ColorFrame + QWidget +
colorframe.h
+ 1 +
+
TabWidget2 itemList diff --git a/muse2/muse/widgets/colorframe.cpp b/muse2/muse/widgets/colorframe.cpp new file mode 100644 index 00000000..8e61ae4b --- /dev/null +++ b/muse2/muse/widgets/colorframe.cpp @@ -0,0 +1,17 @@ +#include +#include + +#include "colorframe.h" + +ColorFrame::ColorFrame(QWidget *parent) : + QWidget(parent) +{ +} + +void ColorFrame::paintEvent(QPaintEvent *e) +{ + QRect r(e->rect()); + QPainter p(this); + p.fillRect(r, color); +} + diff --git a/muse2/muse/widgets/colorframe.h b/muse2/muse/widgets/colorframe.h new file mode 100644 index 00000000..8dc940f5 --- /dev/null +++ b/muse2/muse/widgets/colorframe.h @@ -0,0 +1,23 @@ +#ifndef COLORFRAME_H +#define COLORFRAME_H + +#include + +class ColorFrame : public QWidget +{ + Q_OBJECT + virtual void paintEvent(QPaintEvent*); + +public: + explicit ColorFrame(QWidget *parent = 0); + void setColor(QColor c) {color = c; update();} + +signals: + +public slots: + +private: + QColor color; +}; + +#endif // COLORFRAME_H diff --git a/muse2/muse/widgets/mtscale.cpp b/muse2/muse/widgets/mtscale.cpp index e15d22fa..bcf6ad0c 100644 --- a/muse2/muse/widgets/mtscale.cpp +++ b/muse2/muse/widgets/mtscale.cpp @@ -281,7 +281,7 @@ void MTScale::pdraw(QPainter& p, const QRect& r) { if (m->second.current()) { - p.fillRect(tr, Qt::white); + p.fillRect(tr, MusEGlobal::config.rulerCurrent); } int x2; diff --git a/muse2/muse/widgets/mtscale_flo.cpp b/muse2/muse/widgets/mtscale_flo.cpp index 3b6ea502..f043d461 100644 --- a/muse2/muse/widgets/mtscale_flo.cpp +++ b/muse2/muse/widgets/mtscale_flo.cpp @@ -224,7 +224,7 @@ void MTScaleFlo::draw(QPainter& p, const QRect& r) if(!wr.isEmpty()) { if (m->second.current()) - p.fillRect(wr, Qt::white); + p.fillRect(wr, MusEGlobal::config.rulerCurrent); int x2; if (mm != marker->end()) -- cgit v1.2.3