| 299 | } |
| 300 | |
| 301 | bool Timeline::onProcessMessage(Message* msg) |
| 302 | { |
| 303 | switch (msg->type()) { |
| 304 | |
| 305 | case kFocusEnterMessage: |
| 306 | App::instance()->inputChain().prioritize(this); |
| 307 | break; |
| 308 | |
| 309 | case kTimerMessage: |
| 310 | if (static_cast<TimerMessage*>(msg)->timer() == &m_clipboard_timer) { |
| 311 | Document* clipboard_document; |
| 312 | DocumentRange clipboard_range; |
| 313 | clipboard::get_document_range_info( |
| 314 | &clipboard_document, |
| 315 | &clipboard_range); |
| 316 | |
| 317 | if (isVisible() && m_document && clipboard_document == m_document) { |
| 318 | // Set offset to make selection-movement effect |
| 319 | if (m_offset_count < 7) |
| 320 | m_offset_count++; |
| 321 | else |
| 322 | m_offset_count = 0; |
| 323 | } |
| 324 | else if (m_clipboard_timer.isRunning()) { |
| 325 | m_clipboard_timer.stop(); |
| 326 | } |
| 327 | |
| 328 | invalidate(); |
| 329 | } |
| 330 | break; |
| 331 | |
| 332 | case kMouseDownMessage: { |
| 333 | MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg); |
| 334 | |
| 335 | if (!m_document) |
| 336 | break; |
| 337 | |
| 338 | if (mouseMsg->middle() || she::is_key_pressed(kKeySpace)) { |
| 339 | captureMouse(); |
| 340 | m_state = STATE_SCROLLING; |
| 341 | m_oldPos = static_cast<MouseMessage*>(msg)->position(); |
| 342 | return true; |
| 343 | } |
| 344 | |
| 345 | // Update hot part (as the user might have left clicked with |
| 346 | // Ctrl on OS X, which it's converted to a right-click and it's |
| 347 | // interpreted as other action by the Timeline::hitTest()) |
| 348 | setHot(hitTest(msg, mouseMsg->position() - bounds().origin())); |
| 349 | |
| 350 | // Clicked-part = hot-part. |
| 351 | m_clk = m_hot; |
| 352 | |
| 353 | captureMouse(); |
| 354 | |
| 355 | switch (m_hot.part) { |
| 356 | case PART_SEPARATOR: |
| 357 | m_state = STATE_MOVING_SEPARATOR; |
| 358 | break; |
nothing calls this directly
no test coverage detected