Expand on text field keyboard shortcuts

- Clipboard support
- Text will now wrap when a word is longer than the width of the destination rect (doesn't just apply to text fields, but is most relevant there)
- Edit menu stub added in scenario editor code
- Rich text keys (eg cut, copy, paste, select all) are no longer processed by the dialog itself; only the text field processes them; this just means that if they were set as button equivalents they would no longer work (you'd have to set the raw equivalent instead, eg ctrl+C instead of copy).
- Text fields now rely on SFML's TextEntered event for actual input - the practical result of this is that your keyboard layout is honoured (though non-ASCII characters just display as boxes).
- In a similar vein, shift is not auto-applied to the input keys, so you'd have to set shift+2 instead of @ as the key equivalent (this actually fixes some stuff, such as in the spellcasting dialog, since I was already setting shift+2 instead of @).
This commit is contained in:
2014-12-19 03:44:18 -05:00
parent 8e26881331
commit 728c294d0e
10 changed files with 257 additions and 131 deletions

View File

@@ -58,6 +58,7 @@ void Handle_Update();
void handle_menu_choice(long choice);
void handle_apple_menu(int item_hit);
void handle_file_menu(int item_hit);
void handle_edit_menu(int item_hit);
void handle_scenario_menu(int item_hit);
void handle_town_menu(int item_hit);
void handle_outdoor_menu(int item_hit);
@@ -269,6 +270,25 @@ void handle_file_menu(int item_hit) {
}
}
void handle_edit_menu(int item_hit) {
// Currently, this merely passes appropriate input to the frontmost dialog.
// TODO: Handle edit menu operations when no dialog is onscreen.
cKey key = {true};
switch(item_hit) {
case 1: key.k = key_undo; break;
case 2: key.k = key_redo; break;
case 4: key.k = key_cut; break;
case 5: key.k = key_copy; break;
case 6: key.k = key_paste; break;
case 7: key.k = key_del; break;
case 8: key.k = key_selectall; break;
}
if(!cDialog::sendInput(key)) {
// Handle non-dialog edit operations here.
switch(key.k) {}
}
}
void handle_scenario_menu(int item_hit) {
short i;
fs::path file;