| 153 | } |
| 154 | |
| 155 | void TransactionControl::link(sp<TransactionControl> c1, sp<TransactionControl> c2) |
| 156 | { |
| 157 | if (c1->linked && c2->linked) |
| 158 | { |
| 159 | LogError("Cannot link two already linked transaction controls!"); |
| 160 | return; |
| 161 | } |
| 162 | if (!c2->linked) |
| 163 | { |
| 164 | if (!c1->linked) |
| 165 | { |
| 166 | c1->linked = mksp<std::list<wp<TransactionControl>>>(); |
| 167 | c1->linked->emplace_back(c1); |
| 168 | } |
| 169 | c1->linked->emplace_back(c2); |
| 170 | c2->linked = c1->linked; |
| 171 | } |
| 172 | if (!c1->linked && c2->linked) |
| 173 | { |
| 174 | c2->linked->emplace_back(c1); |
| 175 | c1->linked = c2->linked; |
| 176 | } |
| 177 | // we assume c1 is older than c2, so we update c2 to match c1 |
| 178 | c2->scrollBar->setValue(c1->scrollBar->getValue()); |
| 179 | c2->updateValues(); |
| 180 | } |
| 181 | |
| 182 | const sp<std::list<wp<TransactionControl>>> &TransactionControl::getLinked() const |
| 183 | { |
nothing calls this directly
no test coverage detected