Mercurial > hg > svcore
comparison base/PropertyContainer.cpp @ 46:5364a9d338a2
* Add Insert Instant function in main window
* Ensure selections and window geometry are saved in session file
* Add wait cursor on session file save
* Various improvements to display of texts in pane (clearer readability)
* Use commands for setting properties on layers and panes
(still need to batch up multiple sets on the same property)
* Fix failure of spectrogram to refresh when initial part became visible
* Some fixes & paint optimisations in View &c
* Make curve mode for time value layers work properly when resolution == 1
* Some vague improvements for time value layer vertical scale
author | Chris Cannam |
---|---|
date | Thu, 16 Mar 2006 18:46:00 +0000 |
parents | d86891498eef |
children | bac8b14ab355 |
comparison
equal
deleted
inserted
replaced
45:b11edc8b8ea0 | 46:5364a9d338a2 |
---|---|
6 | 6 |
7 This is experimental software. Not for distribution. | 7 This is experimental software. Not for distribution. |
8 */ | 8 */ |
9 | 9 |
10 #include "PropertyContainer.h" | 10 #include "PropertyContainer.h" |
11 #include "CommandHistory.h" | |
12 | |
13 #include <iostream> | |
11 | 14 |
12 PropertyContainer::PropertyList | 15 PropertyContainer::PropertyList |
13 PropertyContainer::getProperties() const | 16 PropertyContainer::getProperties() const |
14 { | 17 { |
15 return PropertyList(); | 18 return PropertyList(); |
40 { | 43 { |
41 return QString(); | 44 return QString(); |
42 } | 45 } |
43 | 46 |
44 void | 47 void |
45 PropertyContainer::setProperty(const PropertyName &, int) | 48 PropertyContainer::setProperty(const PropertyName &name, int) |
49 { | |
50 std::cerr << "WARNING: PropertyContainer[" << getPropertyContainerName().toStdString() << "]::setProperty(" << name.toStdString() << "): no implementation in subclass!" << std::endl; | |
51 } | |
52 | |
53 void | |
54 PropertyContainer::setPropertyWithCommand(const PropertyName &name, int value) | |
55 { | |
56 int currentValue = getPropertyRangeAndValue(name, 0, 0); | |
57 if (value == currentValue) return; | |
58 | |
59 CommandHistory::getInstance()->addCommand | |
60 (new SetPropertyCommand(this, name, value)); | |
61 } | |
62 | |
63 PropertyContainer::SetPropertyCommand::SetPropertyCommand(PropertyContainer *pc, | |
64 const PropertyName &pn, | |
65 int value) : | |
66 m_pc(pc), | |
67 m_pn(pn), | |
68 m_value(value), | |
69 m_oldValue(0) | |
46 { | 70 { |
47 } | 71 } |
48 | 72 |
73 void | |
74 PropertyContainer::SetPropertyCommand::execute() | |
75 { | |
76 m_oldValue = m_pc->getPropertyRangeAndValue(m_pn, 0, 0); | |
77 m_pc->setProperty(m_pn, m_value); | |
78 } | |
79 | |
80 void | |
81 PropertyContainer::SetPropertyCommand::unexecute() | |
82 { | |
83 m_pc->setProperty(m_pn, m_oldValue); | |
84 } | |
85 | |
86 QString | |
87 PropertyContainer::SetPropertyCommand::getName() const | |
88 { | |
89 return m_pc->tr("Set %1 Property").arg(m_pn); | |
90 } | |
91 |