diff options
Diffstat (limited to 'src/mo_edit.c')
| -rw-r--r-- | src/mo_edit.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/src/mo_edit.c b/src/mo_edit.c index 134da15..bbd12ee 100644 --- a/src/mo_edit.c +++ b/src/mo_edit.c @@ -9,16 +9,12 @@ // TODO(Aldrik): option to disable menu item // TODO(Aldrik): move the delete button for term to edit panel on the topright and put a exclamation mark at the old spot to indicate a missing translation -// TODO(Aldrik): language name validation // TODO(Aldrik): language mo file name preview when entering name // TODO(Aldrik): option to mark languages with colors // TODO(Aldrik): change save icon -// TODO(Aldrik): press tab to go to next translation textbox // TODO(Aldrik): scissor on textbox in scroll // TODO(Aldrik): delete file of language when deleting language -// TODO(Aldrik): confirmation on deletion of term and language -// TODO(Aldrik): creating a new term when term name textbox is selected doesnt overwrite new name -// TODO(Aldrik): deleting the term selected doesnt select a valid term +// TODO(Aldrik): confirmation on deletion of term and language (replace delete button with "Confirm" button to confirm deletion) // TODO(Aldrik): reset textbox vertical scroll when new term is selected // TODO(Aldrik): ctrl+x to select+delete selection // TODO(Aldrik): ctrl+del to delete up to space char @@ -179,6 +175,16 @@ s32 add_language_to_project(char *buffer) return -1; } + for (s32 i = 0; i < current_project->languages.length; i++) + { + language *lang = array_at(¤t_project->languages, i); + if (string_equals(lang->name, buffer)) + { + platform_show_message(main_window, "Language already added", "Invalid info"); + return -1; + } + } + char *val = mem_alloc(MAX_INPUT_LENGTH); string_copyn(val, buffer, MAX_INPUT_LENGTH); @@ -314,6 +320,8 @@ s32 add_term_to_project() array_push(&t.translations, &tr); } + ui_set_textbox_active(&tb_new_term); + return array_push(¤t_project->terms, &t); } @@ -579,6 +587,7 @@ int main(int argc, char **argv) { remove_term_from_project(i); --i; + if (i >= 0) select_term(i); if (current_project->selected_term_index >= 0) current_project->selected_term_index--; @@ -641,7 +650,7 @@ int main(int argc, char **argv) ui_push_text(localize("no_languages_added")); } else - { + { for (s32 i = 0; i < t->translations.length; i++) { translation *tr = array_at(&t->translations, i); @@ -669,6 +678,21 @@ int main(int argc, char **argv) global_ui_context.layout.offset_y += TEXTBOX_HEIGHT + WIDGET_PADDING; global_ui_context.layout.offset_x = 310; + + if (keyboard_is_key_pressed(&keyboard, KEY_TAB) && tb_translation_list[i].state) + { + keyboard.input_keys[KEY_TAB] = false; + tb_translation_list[i].state = false; + + if (i+1 < t->translations.length) + { + ui_set_textbox_active(&tb_translation_list[i+1]); + } + else + { + ui_set_textbox_active(&tb_translation_list[0]); + } + } } } } |
