Browse Source

Cleanup

master
cancel 5 years ago
parent
commit
f865e35cc2
  1. 29
      tui_main.c

29
tui_main.c

@ -3450,33 +3450,27 @@ int main(int argc, char **argv) {
break; break;
} }
} }
if (optind == argc - 1) { if (optind == argc - 1) {
osoput(&t.file_name, argv[optind]); osoput(&t.file_name, argv[optind]);
} else if (optind < argc - 1) { } else if (optind < argc - 1) {
fprintf(stderr, "Expected only 1 file argument.\n"); fprintf(stderr, "Expected only 1 file argument.\n");
exit(1); exit(1);
} }
qnav_init(); // Initialize the menu/navigation global state
qnav_init(); // Initialize the 'Grid EDitor' stuff. This sits underneath the TUI.
ged_init(&t.ged, (Usz)t.undo_history_limit, (Usz)init_bpm, (Usz)init_seed); ged_init(&t.ged, (Usz)t.undo_history_limit, (Usz)init_bpm, (Usz)init_seed);
// This will need to be changed to work with conf/menu // This will need to be changed to work with conf/menu
if (osolen(t.osc_midi_bidule_path) > 0) { if (osolen(t.osc_midi_bidule_path) > 0) {
midi_mode_deinit(&t.ged.midi_mode); midi_mode_deinit(&t.ged.midi_mode);
midi_mode_init_osc_bidule(&t.ged.midi_mode, osoc(t.osc_midi_bidule_path)); midi_mode_init_osc_bidule(&t.ged.midi_mode, osoc(t.osc_midi_bidule_path));
} }
stm_setup(); // Set up timer lib
// Set up timer lib
stm_setup();
// Enable UTF-8 by explicitly initializing our locale before initializing // Enable UTF-8 by explicitly initializing our locale before initializing
// ncurses. Only needed (maybe?) if using libncursesw/wide-chars or UTF-8. // ncurses. Only needed (maybe?) if using libncursesw/wide-chars or UTF-8.
// Using it unguarded will mess up box drawing chars in Linux virtual // Using it unguarded will mess up box drawing chars in Linux virtual
// consoles unless using libncursesw. // consoles unless using libncursesw.
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
// Initialize ncurses initscr(); // Initialize ncurses
initscr();
// Allow ncurses to control newline translation. Fine to use with any modern // Allow ncurses to control newline translation. Fine to use with any modern
// terminal, and will let ncurses run faster. // terminal, and will let ncurses run faster.
nonl(); nonl();
@ -3489,16 +3483,11 @@ int main(int argc, char **argv) {
// to do this even with wtimeout() if we don't want ctrl+z etc. to interrupt // to do this even with wtimeout() if we don't want ctrl+z etc. to interrupt
// the program. // the program.
raw(); raw();
// Don't echo keyboard input noecho(); // Don't echo keyboard input
noecho(); keypad(stdscr, TRUE); // Also receive arrow keys, etc.
// Also receive arrow keys, etc. curs_set(0); // Hide the terminal cursor
keypad(stdscr, TRUE); set_escdelay(1); // Short delay before triggering escape
// Hide the terminal cursor term_util_init_colors(); // Our color init routine
curs_set(0);
// Short delay before triggering escape
set_escdelay(1);
// Our color init routine
term_util_init_colors();
mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL); mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL);
if (has_mouse()) { if (has_mouse()) {

Loading…
Cancel
Save