Magic Lantern Forum

Developing Magic Lantern => Modules Development => Topic started by: g3gg0 on July 04, 2013, 01:52:41 AM

Title: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: g3gg0 on July 04, 2013, 01:52:41 AM
with my last commit, i fixed the IME system to interwork cleanly with menu etc.
(see https://bitbucket.org/hudson/magic-lantern/commits/7225666a08fe3bcb39f1bc5e23d71b31736111e8 )

(http://i.imgur.com/0gGI8DM.png)
(http://i.imgur.com/KUSXJEG.png)

the function to be called is:

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:


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 (https://builds.magiclantern.fm/jenkins/view/ML%20Modules/job/ime_base/lastSuccessfulBuild/artifact/modules/ime_base/ime_base.mo)
ime_rot (https://builds.magiclantern.fm/jenkins/view/ML%20Modules/job/ime_rot/lastSuccessfulBuild/artifact/modules/ime_rot/ime_rot.mo)
ime_std (https://builds.magiclantern.fm/jenkins/view/ML%20Modules/job/ime_std/lastSuccessfulBuild/artifact/modules/ime_std/ime_std.mo)

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

Title: Re: IME (Text Input) System - first working version
Post by: gerk.raisen 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.
Title: Re: IME (Text Input) System - first working version
Post by: vroem 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... ?  ::)
(http://s22.postimg.org/fgsrv9p81/multi_tap.png)
But that would be 60D / 6D only because of the 8-way dial...
Title: Re: IME (Text Input) System - first working version
Post by: vroem on July 04, 2013, 03:41:56 PM
Dreaming on ...
(http://s23.postimg.org/fwqk1qngb/5_D3_multi_tap.png)[edit](http://s17.postimg.org/bqdanxefz/5_D3_multi_tap_2.png)
Title: Re: IME (Text Input) System - first working version
Post by: g3gg0 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
Title: Re: IME (Text Input) System - first working version
Post by: g3gg0 on July 05, 2013, 02:33:28 AM
like this:

(http://upload.g3gg0.de/pub_files/ff37289f824c2f9d5b117aa379ecd840/input.jpg)
Title: Re: IME (Text Input) System - first working version
Post by: driftwood on July 05, 2013, 03:02:21 AM
A nice input method at last.
Title: Re: IME (Text Input) System - first working version
Post by: dhilung on July 05, 2013, 03:47:09 AM
Nice! I like the audi idea.
Title: Re: IME (Text Input) System - first working version
Post by: ilguercio 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.
Title: Re: IME (Text Input) System - first working version
Post by: 1% on July 05, 2013, 06:30:29 AM
One usage off the top of my head: rename files in file manager.
Title: Re: IME (Text Input) System - first working version
Post by: g3gg0 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")
Title: Re: IME (Text Input) System - first working version
Post by: g3gg0 on July 05, 2013, 11:16:43 AM
Quote from: gerk.raisen on July 04, 2013, 03:21:28 PM
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. :)
Title: Re: IME (Text Input) System - first working version
Post by: gerk.raisen 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 :)
Title: Re: IME (Text Input) System - first working version
Post by: g3gg0 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.
Title: Re: IME (Text Input) System - first working version
Post by: g3gg0 on July 06, 2013, 06:08:33 PM
update:
(http://upload.g3gg0.de/pub_files/84f8420675599c76a7dc2a20380667e4/VRAM2.BMP)
Title: Re: IME (Text Input) System - first working version
Post by: noisyboy 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)
Title: Re: IME (Text Input) System - first working version
Post by: g3gg0 on July 07, 2013, 12:59:11 AM
yep that input system is made for such things.
Title: Re: IME (Text Input) System - first working version
Post by: Greg on July 07, 2013, 02:40:12 AM
500D :
(http://imageshack.us/a/img32/7547/5vfl.jpg)
Title: Re: IME (Text Input) System - first working version
Post by: g3gg0 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?
Title: Re: IME (Text Input) System - first working version
Post by: tin2tin on July 07, 2013, 10:55:58 AM
Maybe a prefix for filenames or embedded reelnameprefix in mov files?
Title: Re: IME (Text Input) System - first working version
Post by: g3gg0 on July 07, 2013, 11:26:56 AM
already said that this is an use case ;)

Quote from: g3gg0 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")

can be done with this code in the done cbr:

    char buf[8];
    memset(buf, 0x00, sizeof(buf));
    strncpy(buf, text, sizeof(buf));
    prop_request_change(PROP_FILE_PREFIX, buf, 8);
Title: Re: IME (Text Input) System - first working version
Post by: tin2tin 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?
Title: Re: IME (Text Input) System - first working version
Post by: g3gg0 on July 07, 2013, 12:25:57 PM
Quote from: tin2tin on July 07, 2013, 12:24:59 PMembedded reel names?
whats that?
Title: Re: IME (Text Input) System - first working version
Post by: g3gg0 on July 07, 2013, 02:55:12 PM
first prototype:

(http://upload.g3gg0.de/pub_files/99e700b43a0d742afd908b3b94604506/VRAM3.BMP)
Title: Re: IME (Text Input) System - first working version
Post by: dariSSight on July 07, 2013, 03:03:45 PM
Quote from: g3gg0 on July 07, 2013, 02:55:12 PM
first prototype:

(http://upload.g3gg0.de/pub_files/99e700b43a0d742afd908b3b94604506/VRAM3.BMP)

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?
Title: Re: IME (Text Input) System - first working version
Post by: g3gg0 on July 07, 2013, 03:29:05 PM
it is already working and in the source tree.
just compile it and you can test.
Title: Re: IME (Text Input) System - first working version
Post by: dariSSight on July 07, 2013, 03:40:11 PM
Quote from: g3gg0 on July 07, 2013, 03:29:05 PM
it is already working and in the source tree.
just compile it and you can test.

Forgive my Ignorance, but can you break that down a little more info on the source tree and how do I compile it to the build.
Title: Re: IME (Text Input) System - first working version
Post by: g3gg0 on July 07, 2013, 03:47:43 PM
just compile the source from https://bitbucket.org/hudson/magic-lantern
and compile the modules ime_base, ime_std and ime_rot in modules directory.

nothing special, standard procedure when building ML from source.

(see http://www.magiclantern.fm/forum/index.php?topic=991.0 if you are not aware how to do)
Title: Re: IME (Text Input) System - first working version
Post by: g3gg0 on July 08, 2013, 11:15:29 AM
btw - when pressing Q, the cursor will jump to the "OK" button.
at least in ime_rot, will add this to ime_std later tonight.
Title: Re: IME (Text Input) System - first working version
Post by: Greg on July 09, 2013, 01:43:19 AM
Do not check the code, bitbucket does not work.   :o

edit :

ok now works

(http://imageshack.us/a/img27/4568/j02m.jpg)

You can replace characters :
(http://imageshack.us/a/img818/7813/mrzs.jpg)

ime_null does not compile :
greg@ubuntu:~/magic-lantern/modules/ime_null$ make
[ CC       ]   ime_null.o
ime_null.c: In function 'ime_null_start':
ime_null.c:20:5: error: too few arguments to function 'update'
ime_null.c:24:5: warning: incompatible implicit declaration of built-in function 'strncpy' [enabled by default]
ime_null.c: At top level:
ime_null.c:34:5: warning: initialization from incompatible pointer type [enabled by default]
ime_null.c:34:5: warning: (near initialization for 'ime_null_descriptor.start') [enabled by default]
make: *** [ime_null.o] Error 1
Title: Re: IME (Text Input) System - first working version
Post by: g3gg0 on August 12, 2013, 11:31:24 AM
here (http://upload.g3gg0.de/pub_files/65d4d5cc43e5a2e6fe2069ba8cdd4546/ime_modules.zip) is the latest version of the IME modules.
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
Title: Re: IME (Text Input) System - first working version
Post by: pravdomil on August 17, 2013, 01:49:14 AM
Quote from: g3gg0 on July 05, 2013, 11:14:31 AM
- customize e.g. canon file prefixes MOV_, IMG_, etc
https://bitbucket.org/hudson/magic-lantern/pull-request/183/filepref-module
Title: Re: IME (Text Input) System - first working version
Post by: arrinkiiii on August 21, 2013, 02:33:27 PM
My test with ime_rot on 7D

-Configure method: Don't do nothing
-All chars: Allows me only to wright 8 characters
-Alpha : Infinite input, will pass the border of the GUI (no space, no files with space allowed?)
-Numeric: Infinite input
-Alphanumeric: Infinite input. Only show letters, no numbers
-Punctuation: Infinite input. The ? and ;  don't show up, it makes one empty space.
-Math: Infinite input
-File: Allows me only to wright 8 characters. The characters show up in red color.


Q button

-Cancel just make you return to the main screen of ime. If i input something then make cancel it will return to the main screen but the input i have made will stay there, if i start to input again.

-Delete option don't work

-Ok option or Cancel option, if i press one time and wait for a few seconds it work, makes me to return to the main screen of ime. But if i press the button 2 times it will stuck the image of ime with the main ML screen. Need to shut down the camera and connect again.

-Wend i shut down the camera, if im in the ime screen, the screen of ime will stay on and the routine of cleaning sensor will show up above the ime screen and after done the cleaning sensor thing everything will go off, as should be.

Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: g3gg0 on December 09, 2013, 10:54:56 PM
built for latest module interface.
updated download link.
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: Ottoga on March 05, 2014, 11:20:54 AM
Sorry, I may be missing something here. What is the purpose of this module?
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: dmilligan on March 05, 2014, 01:04:20 PM
Quote from: Ottoga on March 05, 2014, 11:20:54 AM
Sorry, I may be missing something here. What is the purpose of this module?
to allow the user to input text. This module does nothing on its own really. It's meant to be used by other modules that need to receive text input.
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: Ottoga on March 06, 2014, 05:54:35 AM
Thanks. Do we know what modules it interacts with or visa versa?
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: dmilligan on March 06, 2014, 02:27:52 PM
Quote from: Ottoga on March 06, 2014, 05:54:35 AM
Thanks. Do we know what modules it interacts with or visa versa?
IDK, you can check:

$ grep -R "ime_base_start" magic-lantern/modules/
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: DavidSh on March 08, 2014, 10:36:38 PM
got an orange message when trying to load ime_base says -  "v4.0, expect v5.0"
specs: 600d with latest build 2014.mar06
where can i find version 5?
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: ChadMuffin on March 31, 2014, 02:09:47 AM
I have gotten this error too.
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: g3gg0 on March 31, 2014, 03:44:13 PM
updated main post.
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: DavidSh on March 31, 2014, 04:35:25 PM
Quote from: g3gg0 on March 31, 2014, 03:44:13 PM
updated main post.
Thanks,
where to download from? and does it work with 5d3 1.2.3?

Cheers
David

Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: g3gg0 on April 01, 2014, 12:26:14 AM
well check the main post - there are download links....
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: ChadMuffin on April 06, 2014, 06:24:03 AM
Updated, works great! Thank you!
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: DavidSh on April 06, 2014, 12:03:17 PM
Quote from: ChadMuffin on April 06, 2014, 06:24:03 AM
Updated, works great! Thank you!
+1
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: DavidSh on April 06, 2014, 12:24:20 PM
Can it be used to change mlv file names?
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: beauchampy on August 13, 2014, 11:45:32 PM
Sorry for the noobish question (I'm not too clued up on compiling things).

I've downloaded the latest version of this module from the first post (the modules under "Update (12.08.13)")

Trying to get it to work on a 5D III 1.2.3 with the latest nightly (magiclantern-Nightly.2014Aug07.5D3123)

Getting "Wrong Version (v5.0 expected v6.0)

Can anyone point me in the direction of a version of this module that will work on this version of ML? It'd be awesome to add text information to the raw clips :)

Ta

Beauchampy
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: g3gg0 on August 14, 2014, 11:00:27 PM
i updated the modules, can you try if they work?
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: dpjpandone on August 16, 2014, 04:10:11 AM
IME_ROT has some issues on 7D, nothing is displayed at all until I scroll far enough clockwise to select "H" then I can see the rest of the characters, scrolling counterclockwise makes everything disappear again when I reach "G" so "A-G" can be selected, but I have to do it blind by counting. also, when I press "Q" and scroll counterclockwise the same disappearing behavior is exhibited.

IME_STD seems to work fine.

***UPDATE***

I compiled it myself and it seems to work fine.... don't know if the problem is with the pre-built module you posted in this thread, or if it was just a fluke, but compiled from main repository is working well, I really like this BTW!
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: mario1000 on August 16, 2014, 06:56:16 AM
Quote from: dpjpandone on August 16, 2014, 04:10:11 AM
IME_ROT has some issues on 7D, nothing is displayed at all until I scroll far enough clockwise to select "H" then I can see the rest of the characters, scrolling counterclockwise makes everything disappear again when I reach "G" so "A-G" can be selected, but I have to do it blind by counting. also, when I press "Q" and scroll counterclockwise the same disappearing behavior is exhibited.

IME_STD seems to work fine.

***UPDATE***

I compiled it myself and it seems to work fine.... don't know if the problem is with the pre-built module you posted in this thread, or if it was just a fluke, but compiled from main repository is working well, I really like this BTW!

I notoiced the same behaviour for a 5D3.113 together with the last nightly build. Would it be possible for you to recompile this module for a 5D3? Thanks in advance.
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: g3gg0 on August 17, 2014, 02:19:42 AM
updated, can you try?
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: mario1000 on August 17, 2014, 08:24:16 AM
It now works perfectly. Thamks a lot.
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: CoresNZ on April 15, 2015, 01:58:24 AM
So there are still no IME modules in current nightly builds?
It really would be useful to be able to tag files for an upcoming shoot. Any help would be greatly appreciated.

I am not able to compile this stuff myself so a link to the would be great.


Cheers,
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: vertigopix on April 15, 2015, 08:45:07 AM
QuoteI am not able to compile this stuff myself so a link to the would be great.

No need to compile, just download the modules from the 1st post and place it in the "modules" folder of your card et voilĂ  !
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: Walter Schulz on July 11, 2015, 03:08:16 PM
Those links are invalid now.
Someone able to share those modules?
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: ChadMuffin on July 25, 2015, 02:13:18 AM
Links no longer work...
Title: Re: IME (Text Input) System - first version (ime_base.mo ime_rot.mo ime_std.mo)
Post by: g3gg0 on January 12, 2016, 01:30:53 AM
they do ;)