static int open_note_tab(widget_list* UNUSED(w), int UNUSED(mx), int UNUSED(my), Uint32 flags) { int i = 0; // only handle mouse button clicks, not scroll wheels moves if ( (flags & ELW_MOUSE_BUTTON) == 0) return -1; for(i = 0; i < nr_notes; i++) { if (w->id == note_list[i].button_id) { if (note_list[i].window < 0) { open_note_tab_continued(i); } else { int tab = tab_collection_get_tab_nr(notepad_win, note_tabcollection_id, note_list[i].window); tab_collection_select_tab(notepad_win, note_tabcollection_id, tab); } return 1; } } // Button not found, shouldn't get here return 0; }
static void notepad_add_continued(const char *name, void* UNUSED(data)) { int i = nr_notes++; int potential_id, next_id = 0; if (i >= note_list_size) increase_note_storage(); for (potential_id = 0; potential_id < nr_notes; potential_id++) { int test_id; int found_id = 0; for (test_id=0; test_id<nr_notes; test_id++) { widget_list *w = widget_find(main_note_tab_id, note_list[test_id].button_id); if (w && w->id == potential_id) { found_id = 1; break; } } if (!found_id) { next_id = potential_id; break; } } init_note (i, name, NULL); note_button_add (i, next_id); open_note_tab_continued (i); }