Skip to content

Commit

Permalink
menu::repeat_boundary_items, fix debug break
Browse files Browse the repository at this point in the history
* SDL3 was installing an unwanted signal handler. Stop that from happening so that ctrl+c works in the debugger again.

* Fix highly embarrassing spelling error in form.nvgt, set_list_propertyes > set_list_properties.

* menu.nvgt now has new property bool repeat_boundary_items = false.
  • Loading branch information
samtupy committed Oct 20, 2024
1 parent 261f923 commit c3ce369
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion release/include/form.nvgt
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ class audio_form {
set_cancel(control_index, cancel, overwrite);
return true;
}
bool set_list_propertyes(int control_index, bool multiselect=false, bool repeat_boundary_items=false) {
bool set_list_properties(int control_index, bool multiselect=false, bool repeat_boundary_items=false) {
form_error = 0;
if (!active) {
form_error = form_error_no_window;
Expand Down
4 changes: 3 additions & 1 deletion release/include/menu.nvgt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class menu {
string background_callback_data;
bool wrap = false; // If the user moves beyond an edge of the menu, set this to true to jump them to the other edge, or false to play an edge sound and repeat the last item.
uint wrap_delay = 10; // How much time should the menu block when wrapping.
bool repeat_boundary_items = false; // Menu items will not speak when the user repeatedly hits the edge of a non-wrapping menu if this is set to false.
bool focus_first_item = false; // If this is false, the user will be required to press an arrow key to focus either the first or last item of the menu after the intro function has been called. Otherwise they will be focused on the first item.
bool automatic_intro = true; // If this is true, the intro function will be automatically called the first time the monitor method is invoqued, then the variable will be set to false. It can be set to true again at any time to cause the intro sequence to repeat, or the intro function can be called manually.
pack@ pack_file; // Optionally set this to a pack containing sounds.
Expand Down Expand Up @@ -151,6 +152,7 @@ class menu {
}
private int on_form_list_event(audio_form@ f, int c, control_event_type event, dictionary@ args) {
if (event != event_list_cursor) return 0;
f.set_list_properties(f_list, false, repeat_boundary_items);
if (args.exists("boundary")) {
if (!wrap) {
play(edge_sound);
Expand All @@ -159,7 +161,7 @@ class menu {
play(wrap_sound);
stop_speech();
wait(wrap_delay);
f.set_list_position(0, int(args["key"]) == KEY_DOWN? 0 : f.get_list_count(0) -1, true);
f.set_list_position(f_list, int(args["key"]) == KEY_DOWN? 0 : f.get_list_count(0) -1, true);
return 1;
}
play(click_sound);
Expand Down
3 changes: 2 additions & 1 deletion src/nvgt_angelscript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,13 +927,14 @@ std::string Vector3ToString(void* obj, int expandMembers, CDebugger* dbg) {
}
#ifdef _WIN32
BOOL WINAPI debugger_ctrlc(DWORD event) {
if (event != CTRL_C_EVENT || !g_dbg || g_dbg->IsTakingCommands()) return FALSE;
if ((event != CTRL_C_EVENT && event != CTRL_BREAK_EVENT) || !g_dbg || g_dbg->IsTakingCommands()) return FALSE;
g_ASDebugBreak = true;
return TRUE;
}
#endif
void InitializeDebugger(asIScriptEngine* engine) {
#ifdef _WIN32
SDL_SetHint(SDL_HINT_NO_SIGNAL_HANDLERS, "1");
SetConsoleCtrlHandler(debugger_ctrlc, TRUE);;
#endif
g_dbg = new CDebugger();
Expand Down

0 comments on commit c3ce369

Please sign in to comment.