MCPcopy Create free account
hub / github.com/TheOfficialFloW/VitaShell / contextMenuEnterCallback

Function contextMenuEnterCallback

text.c:358–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356}
357
358static int contextMenuEnterCallback(int sel, void *context) {
359 TextEditorState *state = (TextEditorState*) context;
360
361 switch (sel) {
362 case TEXT_MENU_ENTRY_SEARCH:
363 initImeDialog(language_container[ENTER_SEARCH_TERM], "", MAX_LINE_CHARACTERS, SCE_IME_TYPE_DEFAULT, 0, 0);
364 state->search_term_input = 1;
365 break;
366
367 case TEXT_MENU_ENTRY_HEX_EDITOR:
368 state->hex_viewer = 1;
369 if (state->changed) {
370 initMessageDialog(SCE_MSG_DIALOG_BUTTON_TYPE_YESNO, language_container[SAVE_MODIFICATIONS]);
371 }
372 break;
373
374 case TEXT_MENU_ENTRY_COPY:
375 state->n_copied_lines = 0;
376
377 // Sort the selection list
378 qsort(state->selection_list, state->n_selections, sizeof(int), cmp);
379
380 int i;
381 for (i = 0; i < state->n_selections; i++) {
382 copy_line(state, state->selection_list[i]);
383 }
384
385 state->n_selections = 0;
386 break;
387
388 case TEXT_MENU_ENTRY_CUT:
389 state->n_copied_lines = 0;
390
391 // Sort the selection list
392 qsort(state->selection_list, state->n_selections, sizeof(int), cmp);
393
394 // Cut the lines in reversed order to not break the offsets
395 for (i = state->n_selections - 1; i >= 0; i--) {
396 cut_line(state, state->selection_list[i]);
397 }
398
399 // Reverse the order of the copied lines
400 int j;
401 for (i = 0, j = state->n_selections - 1; i < j; i++, j--) {
402 CopyEntry tmp = state->copy_buffer[i];
403 state->copy_buffer[j] = state->copy_buffer[i];
404 state->copy_buffer[i] = tmp;
405 }
406
407 state->n_selections = 0;
408 break;
409
410 case TEXT_MENU_ENTRY_PASTE:
411 paste_lines(state, state->base_pos + state->rel_pos + 1);
412 break;
413
414 case TEXT_MENU_ENTRY_DELETE:
415 delete_line(state, state->base_pos + state->rel_pos);

Callers

nothing calls this directly

Calls 8

initImeDialogFunction · 0.85
initMessageDialogFunction · 0.85
copy_lineFunction · 0.85
cut_lineFunction · 0.85
paste_linesFunction · 0.85
delete_lineFunction · 0.85
insert_lineFunction · 0.85
updateTextEntriesFunction · 0.85

Tested by

no test coverage detected