| 1145 | // Message handler for the editor |
| 1146 | |
| 1147 | bool Editor::onProcessMessage(Message* msg) |
| 1148 | { |
| 1149 | switch (msg->type()) { |
| 1150 | |
| 1151 | case kTimerMessage: |
| 1152 | if (static_cast<TimerMessage*>(msg)->timer() == &m_antsTimer) { |
| 1153 | if (isVisible() && m_sprite) { |
| 1154 | drawMaskSafe(); |
| 1155 | |
| 1156 | // Set offset to make selection-movement effect |
| 1157 | if (m_antsOffset < 7) |
| 1158 | m_antsOffset++; |
| 1159 | else |
| 1160 | m_antsOffset = 0; |
| 1161 | } |
| 1162 | else if (m_antsTimer.isRunning()) { |
| 1163 | m_antsTimer.stop(); |
| 1164 | } |
| 1165 | } |
| 1166 | break; |
| 1167 | |
| 1168 | case kMouseEnterMessage: |
| 1169 | updateToolLoopModifiersIndicators(); |
| 1170 | updateQuicktool(); |
| 1171 | break; |
| 1172 | |
| 1173 | case kMouseLeaveMessage: |
| 1174 | m_brushPreview.hide(); |
| 1175 | StatusBar::instance()->clearText(); |
| 1176 | break; |
| 1177 | |
| 1178 | case kMouseDownMessage: |
| 1179 | if (m_sprite) { |
| 1180 | MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg); |
| 1181 | |
| 1182 | m_oldPos = mouseMsg->position(); |
| 1183 | updateToolByTipProximity(mouseMsg->pointerType()); |
| 1184 | |
| 1185 | if (!m_secondaryButton && mouseMsg->right()) { |
| 1186 | m_secondaryButton = mouseMsg->right(); |
| 1187 | |
| 1188 | updateToolLoopModifiersIndicators(); |
| 1189 | updateQuicktool(); |
| 1190 | setCursor(mouseMsg->position()); |
| 1191 | } |
| 1192 | |
| 1193 | App::instance()->activeToolManager() |
| 1194 | ->pressButton(pointer_from_msg(this, mouseMsg)); |
| 1195 | |
| 1196 | EditorStatePtr holdState(m_state); |
| 1197 | return m_state->onMouseDown(this, mouseMsg); |
| 1198 | } |
| 1199 | break; |
| 1200 | |
| 1201 | case kMouseMoveMessage: |
| 1202 | if (m_sprite) { |
| 1203 | EditorStatePtr holdState(m_state); |
| 1204 | MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg); |
nothing calls this directly
no test coverage detected