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)