Author Topic: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)  (Read 57557 times)

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3190
with my last commit, i fixed the IME system to interwork cleanly with menu etc.
(see https://bitbucket.org/hudson/magic-lantern/commits/7225666a08fe3bcb39f1bc5e23d71b31736111e8 )




the function to be called is:
Code: [Select]
extern void *ime_base_start (char *caption, char *text, int max_length, int codepage, int charset, t_ime_update_cbr update_cbr, t_ime_done_cbr done_cbr, int x, int y, int w, int h );

if a module wants to have a text enterd by the user, it can now call the ime code like that:

Code: [Select]
static char text_buffer[100];

IME_UPDATE_FUNC(ime_base_test_update)
{
    //bmp_printf(FONT_MED, 30, 90, "ime_base: CBR: <%s>, %d, %d", text, caret_pos, selection_length);
    return IME_OK;
}

IME_DONE_FUNC(ime_base_test_done)
{
    for(int loops = 0; loops < 50; loops++)
    {
        bmp_printf(FONT_MED, 30, 120, "ime_base: done: <%s>, %d", text, status);
        msleep(100);
    }
    return IME_OK;
}

static MENU_SELECT_FUNC(ime_base_test)
{
    strcpy(text_buffer, "test");
   
    ime_base_start("Enter something:", text_buffer, sizeof(text_buffer), IME_UTF8, IME_CHARSET_ANY, &ime_base_test_update, &ime_base_test_done, 0, 0, 0, 0);
}

the whole thing is running asynchronously. this means you call ime_base_start and that function immediately returns.
it captures all key events and prevents the ML menu to paint.
instead it is showing you a dialog to enter your text.

the specified update CBR (CallBackRoutine) is called periodically with the current string. it should return IME_OK if the string is acceptable.
(as soon its implemented fully, you can check if it is an valid string, e.g. an email address etc and return a value != IME_OK to grey out the OK button)
 
when the user selects OK or Cancel, the done CBR is called with the string and the status IME_OK or IME_CANCEL.

the x, y, w, h parameters are planned to specify the location where the caller code prints the text that is passed via update_cbr.
this way the caller code can care for displaying the text somewhere and the IME just cares for the character selection.
but it is not implemented yet.


the code is still very fragile ;)
i planned to support different charsets, but not sure yet how to implement, or if it is necessary at all.
also the way the characters are displayed and the menu is drawn isnt final yet.
i think i should use canon fonts as they look better.
also the "DEL" function cuts the string at the deleted character. that can be fixed easily by using strncpy.

please test that code and improve it where it needs improvement.

Update (17.08.14)
ime_base
ime_rot
ime_std

you can place both ime_std and ime_rot in your module dir, or one of them - which ever you prefer.
ime_base is always needed for both

Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

gerk.raisen

  • Member
  • ***
  • Posts: 161
Re: IME (Text Input) System - first working version
« Reply #1 on: July 04, 2013, 03:21:28 PM »
Nice,

Well done g3gg0  :)


I already have an idea for when will have some sort of scripting module... :P
It would be nice to have the possibility to edit and change some script value directly on-camera from the file_viewer module.

vroem

  • New to the forum
  • *
  • Posts: 41
Re: IME (Text Input) System - first working version
« Reply #2 on: July 04, 2013, 03:28:38 PM »
This is really cool g3gg0!

You gave me this idea to speed up typing:
Good old multi-tap from the mobile phone days... ?  ::)

But that would be 60D / 6D only because of the 8-way dial...

vroem

  • New to the forum
  • *
  • Posts: 41
Re: IME (Text Input) System - first working version
« Reply #3 on: July 04, 2013, 03:41:56 PM »
Dreaming on ...
[edit]

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3190
Re: IME (Text Input) System - first working version
« Reply #4 on: July 04, 2013, 04:31:48 PM »
Very good ideas.
I have another one. Its based on the audi navigation input system.

Will post a photo when i am at home
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3190
Re: IME (Text Input) System - first working version
« Reply #5 on: July 05, 2013, 02:33:28 AM »
like this:

Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

driftwood

  • Freshman
  • **
  • Posts: 70
Re: IME (Text Input) System - first working version
« Reply #6 on: July 05, 2013, 03:02:21 AM »
A nice input method at last.
Canon 60D, Canon 5DMK3, Lexar 1000x 128GB CF, Panasonic (shhhh!) GH2s & GH3s. :-)

dhilung

  • New to the forum
  • *
  • Posts: 27
Re: IME (Text Input) System - first working version
« Reply #7 on: July 05, 2013, 03:47:09 AM »
Nice! I like the audi idea.
5D2 | 40D

ilguercio

  • Hero Member
  • *****
  • Posts: 845
Re: IME (Text Input) System - first working version
« Reply #8 on: July 05, 2013, 05:26:15 AM »
Ok, i am a bit clueless about possible usages of this implementation.
Suggestions? :D
Nice job, g3gg0, and i like all your ideas about making it work.
Canon EOS 6D, 60D, 50D.
Sigma 70-200 EX OS HSM, Sigma 70-200 Apo EX HSM, Samyang 14 2.8, Samyang 35 1.4, Samyang 85 1.4.
Proud supporter of Magic Lantern.

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: IME (Text Input) System - first working version
« Reply #9 on: July 05, 2013, 06:30:29 AM »
One usage off the top of my head: rename files in file manager.

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3190
Re: IME (Text Input) System - first working version
« Reply #10 on: July 05, 2013, 11:14:31 AM »
use cases:
 - file manager file and folder renaming
 - enter direct numbers in menu instead of scrolling (e.g. timelapse, number of frames, fps, ...)
 - customize e.g. canon file prefixes MOV_, IMG_, etc
 - editing files
 - for modules that add "shooting session" infos to a group of files (like "wedding sandra, church" and "wedding sandra, party" or "shoot #2 Customer #53")
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3190
Re: IME (Text Input) System - first working version
« Reply #11 on: July 05, 2013, 11:16:43 AM »
It would be nice to have the possibility to edit and change some script value directly on-camera from the file_viewer module.

that can be done with a text editor module.
it can integrate into file_man by registering as file handler.

so it should be possible without touching any of the existing modules. :)
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

gerk.raisen

  • Member
  • ***
  • Posts: 161
Re: IME (Text Input) System - first working version
« Reply #12 on: July 05, 2013, 12:02:46 PM »
If I remember correctly CHDK already have something maybe it can't be too difficult to port it :)

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3190
Re: IME (Text Input) System - first working version
« Reply #13 on: July 05, 2013, 01:10:52 PM »
porting is harder than implementing on your own as we do not use the same or similar APIs.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3190
Re: IME (Text Input) System - first working version
« Reply #14 on: July 06, 2013, 06:08:33 PM »
update:
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

noisyboy

  • Guest
Re: IME (Text Input) System - first working version
« Reply #15 on: July 06, 2013, 06:18:23 PM »
Ooo! Maybe that will help when I (eventually) find someone nice enough to help me with my feature idea ;)

http://www.magiclantern.fm/forum/index.php?topic=5410.msg34883#msg34883

Niiiice  8)

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3190
Re: IME (Text Input) System - first working version
« Reply #16 on: July 07, 2013, 12:59:11 AM »
yep that input system is made for such things.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

Greg

  • Contributor
  • Hero Member
  • *****
  • Posts: 607
Re: IME (Text Input) System - first working version
« Reply #17 on: July 07, 2013, 02:40:12 AM »
500D :

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3190
Re: IME (Text Input) System - first working version
« Reply #18 on: July 07, 2013, 09:34:33 AM »
does it work well on 500D?
can you navigate both in the text box where your entered text is and in the character selection box?
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

tin2tin

  • Member
  • ***
  • Posts: 158
Re: IME (Text Input) System - first working version
« Reply #19 on: July 07, 2013, 10:55:58 AM »
Maybe a prefix for filenames or embedded reelnameprefix in mov files?

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3190
Re: IME (Text Input) System - first working version
« Reply #20 on: July 07, 2013, 11:26:56 AM »
already said that this is an use case ;)

use cases:
 - file manager file and folder renaming
 - enter direct numbers in menu instead of scrolling (e.g. timelapse, number of frames, fps, ...)
 - customize e.g. canon file prefixes MOV_, IMG_, etc
 - editing files
 - for modules that add "shooting session" infos to a group of files (like "wedding sandra, church" and "wedding sandra, party" or "shoot #2 Customer #53")

can be done with this code in the done cbr:
Code: [Select]
    char buf[8];
    memset(buf, 0x00, sizeof(buf));
    strncpy(buf, text, sizeof(buf));
    prop_request_change(PROP_FILE_PREFIX, buf, 8);
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

tin2tin

  • Member
  • ***
  • Posts: 158
Re: IME (Text Input) System - first working version
« Reply #21 on: July 07, 2013, 12:24:59 PM »
As we say in danish: the first place you'll go blind is the eyes   8)

What about prefix in embedded reel names?

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3190
Re: IME (Text Input) System - first working version
« Reply #22 on: July 07, 2013, 12:25:57 PM »
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3190
Re: IME (Text Input) System - first working version
« Reply #23 on: July 07, 2013, 02:55:12 PM »
first prototype:

Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

dariSSight

  • Member
  • ***
  • Posts: 163
Re: IME (Text Input) System - first working version
« Reply #24 on: July 07, 2013, 03:03:45 PM »
first prototype:



When do you think we will be able to test out your IME (TEXT INPUT), will it be a module or incorporated in a new build?
Canon 5D Mark II