A skinnable phone/desktop 42S emulator (aside from Free42/Plus42)
|
10-23-2023, 01:29 PM
(This post was last modified: 10-23-2023 01:45 PM by Nigel (UK).)
Post: #14
|
|||
|
|||
RE: A skinnable phone/desktop 42S emulator (aside from Free42/Plus42)
I see that your skin includes the "E" key; nothing in the notes says that a number with an exponent must not be followed by one of the prefix keys. If this is the way you want things to work, then this should be brought to your users' attention.
I can't help you to build Free42 on a Mac, or even on Windows. However, it is easy to build it on Linux and I have done so and played with the source code previously. To make the E key behave as you wish, this is what you need to do. In the source file core_keydown.cc (this is in a folder of code files called common/) locate the following code: Code:
It's in a function called keydown_number_entry; in the version of Free42 that I have it starts on line 387 of the file. This code decides what to do if the E key is pressed. If it hasn't been pressed yet (if exp_pos = -1), then character 24 (small E) is added to the cmdline buffer; if it has been pressed, it is ignored (return). Change the code to: Code:
Only the last four lines are different. The comment (the text following //) is optional, but comments are good. The first line shortens the cmdline buffer so that its final character is the first occurrence of "E"; the second line makes the following character zero, which is the standard way of showing the end of a string in C. The code then continues, without a return, to redraw the display. Isn't open-source great?! This builds, and for me at least it seems to work as you would wish it to. The usual disclaimers apply: I offer absolutely no guarantee that this will work consistently or that it will not cause problems elsewhere; this new code fragment is under the same open-source licence as the rest of Free42. I'm not offering you the complete modified file as (a) my version isn't the latest version, and (b) this way you should be able to update any new versions of Free42 that come out. If you are unable to build Free42 yourself on a Mac, this information should be helpful to whoever you find to build it on your behalf. I still think that implementing metric prefixes as multiplication by powers of 10 rather than by entering exponents is more straightforward and ultimately more useful (e.g., convert .22 microfarads to nanofarads by pressing .22 mu SHIFT n), but I accept that you disagree. Good luck! Nigel (UK) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)