Flexible info screen

Started by g3gg0, January 10, 2013, 12:34:19 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

g3gg0

i added a new file lately: flexinfo.c

background:
the late updates to all models photo info screen are very good and i like the changes.
unfortunately it gets complex and hackish the more models are updated.

before it gets a real mess, i decided to set up a flexible info screen that separates the code from model-specific settings and positions.
we now can also configure the positions via menu (for developers or power users) and add routines to load/save the setup into ini files.
stuff only interesting for real power users, like CF/SD card names, copyright strings etc etc will go into code, but not be printed or added to menu.
users can later load their power-user screen config and make ML fit their needs.


how does it work:
at the moment the function info_print_screen() called from display_shooting_info().
it uses the configuration in info_config[] that is model specific.
the configuration is an array of "elements" that will be printed on screen at given coordinates.

it looks like this:

    /* print ISO range */
    { .string = { { INFO_TYPE_STRING, { ISO_RANGE_POS_X, ISO_RANGE_POS_Y, 2 }}, INFO_STRING_ISO_MINMAX, COLOR_YELLOW, INFO_COL_FIELD, INFO_FONT_MEDIUM } },

    /* entry 2 and 3, WB strings */
    { .string = { { INFO_TYPE_STRING, { WBS_POS_X, WBS_POS_Y, 2 }}, INFO_STRING_WBS_BA, COLOR_YELLOW, INFO_COL_FIELD, INFO_FONT_LARGE } },
    { .string = { { INFO_TYPE_STRING, { WBS_POS_X + 40, WBS_POS_Y, 2 }}, INFO_STRING_WBS_GM, COLOR_YELLOW, INFO_COL_FIELD, INFO_FONT_LARGE } },
   
    /* entry 4, battery_icon referenced as anchor */
    { .battery_icon = { { INFO_TYPE_BATTERY_ICON, { DISPLAY_BATTERY_POS_X, DISPLAY_BATTERY_POS_Y, 2 }}, DISPLAY_BATTERY_LEVEL_2, DISPLAY_BATTERY_LEVEL_1 } },
    { .battery_perf = { { INFO_TYPE_BATTERY_PERF, { -14, 0, 3, INFO_ANCHOR_LEFT | INFO_ANCHOR_TOP, 4 }}, /* 0=vert,1=horizontal */ 0, /* x size */ 12, /* y size */ 12 } },
    { .string = { { INFO_TYPE_STRING, { 0, 2, 2, INFO_ANCHOR_HCENTER | INFO_ANCHOR_BOTTOM, 4, INFO_ANCHOR_HCENTER | INFO_ANCHOR_TOP }}, INFO_STRING_BATTERY_PCT, COLOR_YELLOW, INFO_COL_FIELD, INFO_FONT_LARGE } },
    { .string = { { INFO_TYPE_STRING, { 0, 0, 2, INFO_ANCHOR_RIGHT | INFO_ANCHOR_TOP, 4 }}, INFO_STRING_BATTERY_ID, COLOR_YELLOW, INFO_COL_FIELD, INFO_FONT_LARGE } },

    /* entry 8, MLU string */
    { .string = { { INFO_TYPE_STRING, { MLU_STATUS_POS_X, MLU_STATUS_POS_Y, 2 }}, INFO_STRING_MLU, COLOR_YELLOW, INFO_COL_FIELD, INFO_FONT_MEDIUM } },
   
    /* entry 9, kelvin */
    { .string = { { INFO_TYPE_STRING, { WB_KELVIN_POS_X, WB_KELVIN_POS_Y, 2 }}, INFO_STRING_KELVIN, COLOR_YELLOW, INFO_COL_FIELD, INFO_FONT_MEDIUM_SHADOW } },
   
    /* entry 10, pictures */
    { .fill = { { INFO_TYPE_FILL, { 540, 390, 1, 0, 0, 0, 150, 60 }}, INFO_COL_FIELD } },
    { .string = { { INFO_TYPE_STRING, { 550, 402, 2 }}, INFO_STRING_PICTURES_4, COLOR_FG_NONLV, INFO_COL_FIELD, INFO_FONT_CANON } },


lets look closer at the first entry:

/* print ISO range */
{
    /* we are defining a new string to be printed */
    .string =
    {
        {
            /* it must be of the type STRING and match the .string initializer above */
            INFO_TYPE_STRING,
            /* print it at X, Y and Z. Z is the layer - the higher the number, the later it gets drawn and overwrites other items (like fills or other strings) */
            { ISO_RANGE_POS_X, ISO_RANGE_POS_Y, 2 }
        },
        /* print the ISO_MINMAX string there. we have dozens of other strings, see the header */
        INFO_STRING_ISO_MINMAX,
        /* foreground color */
        COLOR_YELLOW,
        /* background color is "FIELD" or "BG" or any other COLOR_ define */
        INFO_COL_FIELD,
        /* medium font size */
        INFO_FONT_MEDIUM
    }
},


there is not just ".string", but some other interface items that can be drawn.
this is the current list of defined elements:

.string / INFO_TYPE_STRING
print some string like ISO, Kelvin, WB, picture count, time, date, etc.
if the element is not available, like we print the "MLU" string and MLU is disabled, the item will *not* get drawn.

.fill / INFO_TYPE_FILL
fill some area with specified color. useful for clearing some canon strings or symbols.
use the lowest Z values for such things and print the strings with higher Z values over it.

.battery_icon / INFO_TYPE_BATTERY_ICON
the battery icon Pelican made with some little changes to make it a bit more flexible.
in the initializer you can specify the red/yellow pct values.

.battery_perf / INFO_TYPE_BATTERY_PERF
also from Pelican the battery performance dots that tell you the battery health.
it is also a bit more flexible and can get configured to be printed horizontal/vertical and with custom dot sizes.

.icon / INFO_TYPE_ICON
not implemented yet, but why not put some code to paint icons from a file on screen.


(to be continued)
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

nanomad

One quick question, I'm porting this to the 1100D but there's no Kelvin icon that i'm aware of...any suggestions?
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

g3gg0

hm i would implement the ICON code and draw an icon from a png/bmp/pnm file (http://en.wikipedia.org/wiki/Netpbm_format)
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

Pelican

The idea is good, I like it but I think it needs a little more work to be usable.

For example the avail_shot needs to show if it is above 999. You can program this condition to INFO_STRING_PICTURES but the INFO_TYPE_FILL have no condition so it will always clear the area. It would be a better solution if every item has a fill property which execute only when necessary (when the programmed condition is true).


Also it could be useful if every item has a show/hide property to easily turn on/off so you can put all the available options, and everybody can customize it (so you can display infos in the header/footer).


Also instead of using ifdefs in flexinfo.c I would put the camera specific info_config definition to a file in the platform folder (to 'misc' or a new file) so if two or more developer works on the info screen of the different cameras there is no conflict when they merge into the main repo.


EOS 7D Mark II, EOS 7D, EOS 5, EOS 100 + lenses (10mm to 300mm), 600EX, 550EX, YN600EX x 3
EOScard, EOS DSLR firmwares, ARMu, NiControl, etc.: http://pel.hu/down

scrax

Quote from: Pelican on January 18, 2013, 12:30:05 AM
Also it could be useful if every item has a show/hide property to easily turn on/off so you can put all the available options, and everybody can customize it (so you can display infos in the header/footer).


Also instead of using ifdefs in flexinfo.c I would put the camera specific info_config definition to a file in the platform folder (to 'misc' or a new file) so if two or more developer works on the info screen of the different cameras there is no conflict when they merge into the main repo.

agree.
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

g3gg0

Quote from: Pelican on January 18, 2013, 12:30:05 AM
For example the avail_shot needs to show if it is above 999. You can program this condition to INFO_STRING_PICTURES but the INFO_TYPE_FILL have no condition so it will always clear the area. It would be a better solution if every item has a fill property which execute only when necessary (when the programmed condition is true).

already implemented. choose the string field as anchor item in the clear item.
then the clear item will only get drawn if the string item is printed (i.e. length > 0)

set hdr.pos.anchor to the index of your string item, but keep positioning absolute (hdr.pos.anchor_flags = 0)

Quote from: Pelican on January 18, 2013, 12:30:05 AM
Also it could be useful if every item has a show/hide property to easily turn on/off so you can put all the available options, and everybody can customize it (so you can display infos in the header/footer).

already planned. field hdr.pos.user_disable is the one you talk about.
just no code behind it yet.

Quote from: Pelican on January 18, 2013, 12:30:05 AM
Also instead of using ifdefs in flexinfo.c I would put the camera specific info_config definition to a file in the platform folder (to 'misc' or a new file) so if two or more developer works on the info screen of the different cameras there is no conflict when they merge into the main repo.

with mercural this is basically no problem. you can merge file changes without any fuzz.
i would keep it in one place for a special reason: its simpler to make all models look similar.
if it gets spread over multiple files, copy-paste and merge different models is not that easy.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

scrax

It worked for me on 600D until last changes, I've made a pull request for 600D, but maybe I've miss something that need to be added for showing items on the info screen?
Something to define maybe?
I can go in the editor submenu and they are shown right in position there. But If out of ML menu they are not shown in the photo info screen.

EDIT: also already put on consts.h WB_K_ICON_POS_X and WB_K_ICON_POS_Y for position of K icon.
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

scrax

Ok, alex commit fixed it, now about items in the upped and lower corners, should we place them here and remove the Info screen settings item from Prefs menu?
Actually on 600d I have the menu but nothing is shown cause it was removed from ph_info_disp.c (#if 0)
I've changed it to this for showing it up:

-#if 0
+#ifdef DISPLAY_HEADER_FOOTER_INFO
+    int col_bg = bmp_getpixel(20,10);
+    int col_field = bmp_getpixel(20,10); //to check
+    int fnt;
    extern int header_left_info;
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

Pelican

Quote from: g3gg0 on January 18, 2013, 12:57:46 AM
already implemented. choose the string field as anchor item in the clear item.
then the clear item will only get drawn if the string item is printed (i.e. length > 0)
It doesn't work for me.

The aligning also doesn't work as I imagine. If the anchor is center or right it puts to left side of the string to the center or right instead of the center of the string or right side of the string.
For exmaple:
item 1: abcdefghijkl
item 2: 1234
item 2's anchor  is item 1,

anchor type: left
abcdefghijkl
1234


anchor type: center
abcdefghijkl
      1234


anchor type: right
abcdefghijkl
            1234

Instead of

anchor type: left
abcdefghijkl
1234


anchor type: center
abcdefghijkl
    1234


anchor type: right
abcdefghijkl
        1234

And now  the aligning is different for the different fonts.
EOS 7D Mark II, EOS 7D, EOS 5, EOS 100 + lenses (10mm to 300mm), 600EX, 550EX, YN600EX x 3
EOScard, EOS DSLR firmwares, ARMu, NiControl, etc.: http://pel.hu/down

g3gg0

i see, will inspect that issue
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

g3gg0

offsets at least should be fixed.

behavior:

anchor specified, but no anchor flags:
-> when the anchor item is not displayed, hide this item too (not tested)
-> positioning absolute from top left corner

anchor specified, flags specify some anchor position:
-> X and Y offsets are calculated separately - if just INFO_ANCHOR_LEFT is specified, X is relative to anchor item, Y is absolute (screen corrdinate)

in any case when anchor_flags_self is set:
-> X and Y coordinates, no matter if relative or absolute are for the specified anchor.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

g3gg0

i added he coded needed to load and save the screen configuration to a XML file.
where the data is saved: see flexinfo.h
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

Pelican

The INFO_COL_BG is the same black as the INFO_COL_FIELD (instead of gray on 7D).
The INFO_TYPE_FILL still doesn't work for me (it always clears the area even if the anchored string doesn't displayed).
I would like to display the avail_shot only when it is over 999, because the original Canon font is bigger (easier to read).

In the menu it could be better if you don't display all the options which you cannot reach (because it goes to the gray screen) just make an info like X: 100, Y: 200, Z: 2, etc. so it can fit on the screen. The option to change the string type would be great too.
EOS 7D Mark II, EOS 7D, EOS 5, EOS 100 + lenses (10mm to 300mm), 600EX, 550EX, YN600EX x 3
EOScard, EOS DSLR firmwares, ARMu, NiControl, etc.: http://pel.hu/down

g3gg0

meanwhile i have improved the edit screen:


Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

Pelican

Could you check the background color and the fill bug please?
EOS 7D Mark II, EOS 7D, EOS 5, EOS 100 + lenses (10mm to 300mm), 600EX, 550EX, YN600EX x 3
EOScard, EOS DSLR firmwares, ARMu, NiControl, etc.: http://pel.hu/down

g3gg0

well, no idea whats wrong with the version you have - here it works without problems.
maybe you should revert all changes?


    { .fill = { { INFO_TYPE_FILL, { 10, 10, 1, 0, 1, 0, 30, 30, .name = "(clear)" }}, .color = INFO_COL_FIELD } },
    { .fill = { { INFO_TYPE_FILL, { 10, 40, 1, 0, 1, 0, 30, 30, .name = "(clear)" }}, .color = INFO_COL_BG } },
    { .fill = { { INFO_TYPE_FILL, { 10, 70, 1, 0, 1, 0, 30, 30, .name = "(clear)" }}, .color = COLOR_WHITE } },


it hides correctly when the anchor element is not shown.

Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

Pelican

Quote from: g3gg0 on February 09, 2013, 10:33:13 PM
well, no idea whats wrong with the version you have - here it works without problems.
Thanks, the bg color works here too now.
I still cannot use the INFO_TYPE_FILL for avail_shot because it's clearing the rectangle even if no text displayed.
EOS 7D Mark II, EOS 7D, EOS 5, EOS 100 + lenses (10mm to 300mm), 600EX, 550EX, YN600EX x 3
EOScard, EOS DSLR firmwares, ARMu, NiControl, etc.: http://pel.hu/down

g3gg0

Quote from: Pelican on February 18, 2013, 09:20:04 PM
Thanks, the bg color works here too now.
I still cannot use the INFO_TYPE_FILL for avail_shot because it's clearing the rectangle even if no text displayed.

is this element referencing the text as anchor?
if you manually hide the text element (using editor) the filling disappears?

can you send me the config array?
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

Pelican

Quote from: g3gg0 on February 18, 2013, 10:21:18 PM
is this element referencing the text as anchor?
Yes.
Quote from: g3gg0 on February 18, 2013, 10:21:18 PM
if you manually hide the text element (using editor) the filling disappears?
No.
Quote from: g3gg0 on February 18, 2013, 10:21:18 PM
can you send me the config array?
<fill name="Pics (clear)" x=540 y=390 z=1 w=150 h=60 anchor=11 color=-33554432 />
<string name="Pics" y=-1 z=2 w=78 h=40 anchor_flags=10 anchor=10 anchor_flags_self=10 string_type=36 fgcolor=1 bgcolor=-33554432 font_type=6 />

Also the 'Save config' is useless because it doesn't read back the saved xml at the start.
EOS 7D Mark II, EOS 7D, EOS 5, EOS 100 + lenses (10mm to 300mm), 600EX, 550EX, YN600EX x 3
EOScard, EOS DSLR firmwares, ARMu, NiControl, etc.: http://pel.hu/down

Marsu42

Is this only available for the INFO screen or also for Q settings where but you can actually change the settings and not just view them...

scrax

I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

cbob

I enabled flexinfo for the 550D: clock, free space, MLU, kelvin and bracketing.

Pull request: https://bitbucket.org/hudson/magic-lantern/pull-request/97/added-550d-flexinfo/diff



The clock is restored at the same font/position as before, but the other items have moved. I particularly like the new free space display.

A few comments/questions about flexinfo:

1) It's very flexible(!) and works great, but perhaps allows too much scope for making ML look entirely different on each model.

Just from the code, it's difficult to visualise how other camera models look without having familiarity/access to such bodies. e.g. the 7D seems to have a very complete flexinfo, including colours, but I have no idea how those features sit within the Canon 7D info screen. Making the 550D look consistent with that was impossible for me.

2) I presume the platform-specific X, Y coordinates defines can now be magic numbers in flexinfo.c rather than platform/consts.h? Lines from the platform-specific code islands at the top of flexinfo.c can never be shared between models anyway due to the need to hard code anchor references.

3) I added replications of some 7D info string types, with different padding and postfix (GB). Doing this could result in a lot of replicated code to suit different models. There's probably a better way to do this?

g3gg0

Quote from: cbob on May 27, 2013, 01:17:09 AM
1) It's very flexible(!) and works great, but perhaps allows too much scope for making ML look entirely different on each model.
this was one of my goals since some features might not be necessary or just no space on screen for it.
also you might want to clear some areas on some model and on other models not.
it also allows to edit/provide XML files with all items or even profiles by selecting XMLs (not implemented)

Quote from: cbob on May 27, 2013, 01:17:09 AM
2) I presume the platform-specific X, Y coordinates defines can now be magic numbers in flexinfo.c rather than platform/consts.h?
yep, absolutely

Quote from: cbob on May 27, 2013, 01:17:09 AM
3) I added replications of some 7D info string types, with different padding and postfix (GB). Doing this could result in a lot of replicated code to suit different models. There's probably a better way to do this?
why did you have to add nopad versions? i would keep the old ones. you can use anchors to align left right or center.

the renaming of the free space items is okay, just the unit should not be there.
see the other models:
{ .text = { { INFO_TYPE_TEXT, { 144, 162, 2, .anchor_flags_self = (INFO_ANCHOR_RIGHT | INFO_ANCHOR_BOTTOM), .name = "GB" }}, "GB", COLOR_CYAN, INFO_COL_PEEK, INFO_FONT_MEDIUM } },

the unit "GB" is a string that is being anchored to the free space item.

thanks for supporting!
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

cbob

I see what you mean about the GB postfix. I've updated the code and pull request. GB is anchored to the right of the self-centered free space. The INFO_STRING with GB included is no longer present.

I still can't see how to properly center Kelvin (or free photos) when it's padded with %Xd though. The raw Kelvin value can be 4 or 5 chars long, but the %5d means the centering routine always centers for 5 chars and the text is only properly centered for > 10,000 K?

Greg