On Sat, 26, Jul, 2003 at 11:25:54AM +0200, Guillaume Laurent spoke thus..
> On Thursday 24 July 2003 23:48, Silvan wrote:
> >
> > I agree with all the fuss about needing a default color map. It took me a
> > bit to figure out how to work it so I could give myself stuff to choose
> > from.
>
> Yes, having to go to document properties just for this is somewhat tedious.
> Could it be possible to append a "Add new color" choice to the color combo
> box ?
Yes. Does this seem a reasonable way of doing it? (it doesn't add any
extra space to the Segment parameter box)
Mark
--
Mark Hymers <markh at linuxfromscratch dot org>
"I've had people claim that they actually make the sun rise rise every
morning. I've offered to test them by shooting them. So far all these
people have not responded to my endeavours."
James Randi on BBCi Live Chat
? gui/docs/de/Makefile
? gui/docs/de/Makefile.in
Index: gui/segmentparameterbox.cpp
===================================================================
RCS file: /cvsroot/rosegarden/gui/segmentparameterbox.cpp,v
retrieving revision 1.62
diff -u -p -r1.62 segmentparameterbox.cpp
--- gui/segmentparameterbox.cpp 25 Jul 2003 21:54:10 -0000 1.62
+++ gui/segmentparameterbox.cpp 26 Jul 2003 15:00:23 -0000
@@ -26,6 +26,7 @@
#include <klocale.h>
#include <kcommand.h>
#include <kcombobox.h>
+#include <kcolordialog.h>
#include "Segment.h"
#include "Quantizer.h"
@@ -288,6 +289,9 @@ SegmentParameterBox::slotDocColoursChang
++i;
}
+ m_addColourPos = i;
+ m_colourValue->insertItem(i18n("Add New Color"), m_addColourPos);
+
m_colourValue->setCurrentItem(0);
}
@@ -716,26 +720,55 @@ SegmentParameterBox::slotDelaySelected(i
void
SegmentParameterBox::slotColourSelected(int value)
{
- unsigned int temp;
+ if (value != m_addColourPos)
+ {
+ unsigned int temp;
- RosegardenColourTable::ColourList::const_iterator pos = m_colourList.find(value);
+ 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;
+ 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;
+ Rosegarden::SegmentSelection segments;
+ std::vector<Rosegarden::Segment*>::iterator it;
- for (it = m_segments.begin(); it != m_segments.end(); ++it)
- {
- segments.insert(*it);
+ for (it = m_segments.begin(); it != m_segments.end(); ++it)
+ {
+ segments.insert(*it);
+ }
+
+ SegmentColourCommand *command = new SegmentColourCommand(segments, temp);
+
+ addCommandToHistory(command);
}
+ else
+ {
+ Rosegarden::ColourMap newMap =
m_view->getDocument()->getComposition().getSegmentColourMap();
+ QColor newColour;
+ bool ok = false;
+ QString newName = QInputDialog::getText(i18n("New Color Name"), i18n("Enter
new name"),
+ QLineEdit::Normal, i18n("New"), &ok);
+ if ((ok == true) && (!newName.isEmpty()))
+ {
+ KColorDialog box(this, "", true);
- SegmentColourCommand *command = new SegmentColourCommand(segments, temp);
+ int result = box.getColor(newColour);
+
+ if (result == KColorDialog::Accepted)
+ {
+ Rosegarden::Colour newRColour =
RosegardenGUIColours::convertColour(newColour);
+ newMap.addItem(newRColour, qstrtostr(newName));
+ SegmentColourMapCommand *command = new
SegmentColourMapCommand(m_view->getDocument(), newMap);
+ addCommandToHistory(command);
+ slotDocColoursChanged();
+ }
+ }
+ // Else we don't do anything as they either didn't give a name�
+ // or didn't give a colour
+ }
- addCommandToHistory(command);
}
Index: gui/segmentparameterbox.h
===================================================================
RCS file: /cvsroot/rosegarden/gui/segmentparameterbox.h,v
retrieving revision 1.32
diff -u -p -r1.32 segmentparameterbox.h
--- gui/segmentparameterbox.h 22 Jul 2003 07:40:16 -0000 1.32
+++ gui/segmentparameterbox.h 26 Jul 2003 15:00:23 -0000
@@ -109,6 +109,8 @@ protected:
RosegardenComboBox *m_delayValue;
KComboBox *m_colourValue;
+ int m_addColourPos;
+
std::vector<Rosegarden::Segment*> m_segments;
std::vector<Rosegarden::timeT> m_standardQuantizations;
std::vector<Rosegarden::timeT> m_delays;