MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / onProcessMessage

Method onProcessMessage

src/app/ui/editor/editor.cpp:1147–1306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1145// Message handler for the editor
1146
1147bool 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);

Callers

nothing calls this directly

Calls 15

instanceFunction · 0.85
pointer_from_msgFunction · 0.85
clear_keyboard_bufferFunction · 0.85
timerMethod · 0.80
hideMethod · 0.80
clearTextMethod · 0.80
activeToolManagerMethod · 0.80
releaseButtonsMethod · 0.80
typeMethod · 0.45
isRunningMethod · 0.45
stopMethod · 0.45
positionMethod · 0.45

Tested by

no test coverage detected