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

Method onProcessMessage

src/ui/entry.cpp:194–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194bool Entry::onProcessMessage(Message* msg)
195{
196 switch (msg->type()) {
197 case kTimerMessage:
198 if (hasFocus() && static_cast<TimerMessage*>(msg)->timer() == &m_timer) {
199 // Blinking caret
200 m_state = m_state ? false: true;
201 invalidate();
202 }
203 break;
204
205 case kFocusEnterMessage: {
206 m_got_focus_message = true;
207 View* view = View::getView(this);
208 gfx::Rect rect = view ? view->viewportBounds() : bounds();
209 int scale = 2*guiscale();
210 rect.x *= scale;
211 rect.y *= scale;
212 rect.h *= scale;
213 rect.w *= scale;
214 if (!isReadOnly() && showsKeyboard())
215 she::set_input_rect(rect);
216
217 m_timer.start();
218
219 m_state = true;
220 invalidate();
221
222 if (m_lock_selection) {
223 m_lock_selection = false;
224 }
225 else {
226 selectAllText();
227 m_recent_focused = true;
228 }
229 break;
230 }
231
232 case kFocusLeaveMessage:
233 invalidate();
234
235 m_timer.stop();
236
237 if (!m_lock_selection)
238 deselectText();
239
240 m_recent_focused = false;
241 m_got_focus_message = false;
242 she::set_input_rect({});
243 break;
244
245 case kKeyDownMessage:
246 if (hasFocus() && !isReadOnly()) {
247 if (!m_got_focus_message)
248 return true;
249
250 // Command to execute
251 EntryCmd cmd = EntryCmd::NoOp;

Callers

nothing calls this directly

Calls 15

guiscaleFunction · 0.85
set_input_rectFunction · 0.85
utf8_const_iteratorClass · 0.85
utf8_lengthFunction · 0.85
timerMethod · 0.80
viewportBoundsMethod · 0.80
startMethod · 0.80
ctrlPressedMethod · 0.80
altPressedMethod · 0.80
cmdPressedMethod · 0.80
shiftPressedMethod · 0.80
onlyCmdPressedMethod · 0.80

Tested by

no test coverage detected