Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Screen Keyboard, fully configurable #1846

Closed
DorpsGek opened this issue Mar 11, 2008 · 10 comments
Closed

On Screen Keyboard, fully configurable #1846

DorpsGek opened this issue Mar 11, 2008 · 10 comments
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay

Comments

@DorpsGek
Copy link
Member

Dominik opened the ticket and wrote:

The On Screen Keyboard is activated when you click on a edit box. (Probably should be made optional.)
The layout is dependent on the language or can be changed in the config file.

Attachments

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/1846
@DorpsGek
Copy link
Member Author

Dominik wrote:

New revision of the patch. I separated the code into a new file osk_gui.cpp. I also added a couple of strings for the keyboard window caption.

A note concerning keyboard layouts: I strongly suggest that several keyboard layouts should be included in OpenTTD when this patch goes live. The majority of the player-base doesn't speak English as their native language and they will want a keyboard layout that suits their language (just like with town names and currencies).
From a design-perspective it is probably not the best thing to tie the keyboard to a language. But the language maintainers are probably the best people to decide what special characters people playing in that specific language will need. It's the same with most operating systems: Depending on your system language a keyboard layout is chosen.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/1846#comment3713

@DorpsGek
Copy link
Member Author

Rubidium wrote:

Could you add a patch (diff + changed pcx file) for /branches/ottd_grf so we can keep that up-to-date and generate the grf from there?


This comment was imported from FlySpray: https://bugs.openttd.org/task/1846#comment3747

@DorpsGek
Copy link
Member Author

Dominik wrote:

I didn't even know that branch existed. Found it now. :) Where should I put the new sprites? In openttdgui.pcx, chars.pcx or in a new file osk.pcx? I'd say openttdgui.


This comment was imported from FlySpray: https://bugs.openttd.org/task/1846#comment3748

@DorpsGek
Copy link
Member Author

yorick wrote:

I guess you should put them at openttdgui.pcx


This comment was imported from FlySpray: https://bugs.openttd.org/task/1846#comment3749

@DorpsGek
Copy link
Member Author

Dominik wrote:

Ok, here's the diff and a modified pcx. I hope it's correct, because I couldn't get the makefile to work on my system.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/1846#comment3750

@DorpsGek
Copy link
Member Author

Rubidium wrote:

I've commited some stuff from your diff and changed a few things to make it a little better (IMO):
- buttons that should not be pressed like the special button, unassigned buttons and characters that cannot be used due to a filter will be shown disabled.
- added the { and } to the english one.
- added a proper upper bound for _keyboard_opt and friends.
- some coding style.

The following issues remain:
- the warning message in GetKeyboardLayout can cause nasty things to happen: out of bound reads for the first and last character, reading uninitialized data for each character (the next character is not yet read when showing the warning). This needs to be made more robust in some way, though I couldn't think of an easy way to do so.
- where to define the keyboard layout and how? The current way is the easiest way that allows some configuration. However, I could think of people who want to change the location of buttons and the like. If that is 'needed' then we would need to make a language-type file for each of the keyboard layouts. So the real question is: how much configurability do we want to give people? In my opinion the current way looks ok.

Anyway, I've added the updated diffs.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/1846#comment3754

@DorpsGek
Copy link
Member Author

Dominik wrote:

In this version I only did a few minor tweaks:
- fixed a error in GetKeyboardLayout which could cause problems when loading from config file
- moved DisabledState stuff to an own function
- for the warning message in GetKeyboardLayout I came up with the idea to show a litte ^ in the line below the keyboard to indicate an invalid character. No more out-of-bounds reads. But I'm not sure if some systems might output characters which are two columns wide in which case the ^ wouldn't be aligned properly any more.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/1846#comment3763

@DorpsGek
Copy link
Member Author

Rubidium wrote:

I'm missing the most interesting part (osk_gui.cpp) in the last diff.


This comment was imported from FlySpray: https://bugs.openttd.org/task/1846#comment3764

@DorpsGek
Copy link
Member Author

Dominik wrote:

lol, you're right of course.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/1846#comment3765

@DorpsGek
Copy link
Member Author

Rubidium closed the ticket.

Reason for closing: Implemented

In r12425.


This comment was imported from FlySpray: https://bugs.openttd.org/task/1846

@DorpsGek DorpsGek added component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay labels Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay
Projects
None yet
Development

No branches or pull requests

1 participant