text_offset_y 65 # from top of cell to top of text
text_width 75 # max width of the text
text_clip_x 5 # offset from cell edge to left edge of text, when the text width is being clipped to fit
+sel_offoffset_x -5 # so selection can be a little bigger than main cell, this is selection offset relative to top corner of icon
+sel_offoffset_y -5 # so selection can be a little bigger than main cell, this is selection offset relative to top corner of icon
cell_width 85 # cell location is grid_offset_x + ( cell_width * column_number )
cell_height 92 # cell location is grid_offset_y + ( cell_height * column_number )
col_max 5 # number of columns to render into grid
font Vera.ttf
font_ptsize 16
cell_offset_x 488 # left edge of text cell
-cell_offset_y 312 # top edge of text cell
+cell_offset_y 300 # top edge of text cell
cell_width 250 # width of cell (for text clipping)
[previewpic]
// fetch the full PXML and get all the details. But I think we got out of control here :)
// NOTE: We really need to rework disco-t so it can include non-english titles/desc; perhaps more info as optional,
// or a name/value pairing system so it can have extra data in it, without a complex structure.
+#define PND_DISCO_FLAG_OVR 1 // An ovr file was found for this app (not per subapp, just per .pnd)
typedef struct {
// base
unsigned char object_type; // see enum above
char *object_filename; // filename within object_path of the app: the PXML.xml or awesomeapp.pnd file itself
unsigned int pnd_icon_pos; // offset to the byte after end of PXML in a pnd file (should be icon if present)
unsigned char subapp_number; // # of app within PXML (ie: 0, 1, 2, 3, up to the number of apps within the PXML)
+ unsigned int object_flags;
// strdup'd from PXML -- hey, who was the idiot who thought it was a reat idea not to just re-use the pxml-struct?
char *title_en;
char *desc_en;
char key [ 100 ];
char *v;
+ // set the flag regardless, so its for all subapps
+ p -> object_flags |= PND_DISCO_FLAG_OVR;
+
// title
snprintf ( key, 100, "Application-%u.title", p -> subapp_number );
- pnd_log ( PND_LOG_DEFAULT, "find key %s\n", key );
if ( ( v = pnd_conf_get_as_char ( ovrh, key ) ) ) {
- pnd_log ( PND_LOG_DEFAULT, " find key %s\n", key );
if ( p -> title_en ) {
free ( p -> title_en );
}
- libpnd: appdata-dir-name?
-- note in .ovr, skip showing game category if got
-- upsize selection a little, so full-size icons are still hilighted
+- add font and fontcolour control to conf
- evmapperd.. no force off, if charging on /sys/class/power_supply/bq27500-0/current_now is +ve
- About screen and shoutouts // konami code?
- skinning .. mmenu.conf and then skin.conf in each skin dir?
+ - skin picker/saver
- some ultra primtive frame draw, so the 'detail menu' and any 'sub menus' can draw
their own frame rather than depand on skin frame to exist
extern pnd_conf_handle g_conf;
-unsigned char category_push ( char *catname, pnd_disco_t *app ) {
+unsigned char category_push ( char *catname, pnd_disco_t *app, pnd_conf_handle ovrh ) {
mm_category_t *c;
// check category list; if found, append app to the end of it.
bzero ( ar, sizeof(mm_appref_t) );
ar -> ref = app;
+ ar -> ovrh = ovrh;
// plug it into category
// and sort it on insert!
{
//pnd_log ( pndn_debug, "target(%s) from(%s)\n", k, buffer );
- category_push ( k, NULL );
+ category_push ( k, NULL, 0 );
g_catmaps [ g_catmapcount ].target = category_query ( k );
g_catmaps [ g_catmapcount ].from = strdup ( buffer );
g_catmapcount++;
return ( NULL );
}
-unsigned char category_meta_push ( char *catname, pnd_disco_t *app ) {
+unsigned char category_meta_push ( char *catname, pnd_disco_t *app, pnd_conf_handle ovrh ) {
mm_category_t *cat;
// do we honour cat mapping at all?
cat = category_map_query ( catname );
if ( cat ) {
- return ( category_push ( cat -> catname, app ) );
+ return ( category_push ( cat -> catname, app, ovrh ) );
}
// not mapped.. but default?
if ( pnd_conf_get_as_int_d ( g_conf, "categories.map_default_on", 0 ) ) {
char *def = pnd_conf_get_as_char ( g_conf, "categories.map_default_cat" );
if ( def ) {
- return ( category_push ( def, app ) );
+ return ( category_push ( def, app, ovrh ) );
}
}
} // cat map is desired?
// not default, just do it
- return ( category_push ( catname, app ) );
+ return ( category_push ( catname, app, ovrh ) );
}
typedef struct _mm_appref_t {
pnd_disco_t *ref;
+ pnd_conf_handle ovrh;
// anything else?
struct _mm_appref_t *next;
} mm_appref_t;
#define CATEGORY_ALL "All"
// try to populate as many cats as necessary
-unsigned char category_push ( char *catname, pnd_disco_t *app ); // catname is not pulled from app, so we can make them up on the fly (ie: "All")
+unsigned char category_push ( char *catname, pnd_disco_t *app, pnd_conf_handle ovrh ); // catname is not pulled from app, so we can make them up on the fly (ie: "All")
mm_category_t *category_query ( char *catname );
void category_dump ( void ); // sort the apprefs
void category_freeall ( void );
unsigned char category_map_setup ( void ); // set up the mappings
mm_category_t *category_map_query ( char *cat );
-unsigned char category_meta_push ( char *catname, pnd_disco_t *app );
+unsigned char category_meta_push ( char *catname, pnd_disco_t *app, pnd_conf_handle ovrh );
#endif
* c) user performsn some operation (set clock, copy files, whatever) -> probably stays within the menu
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <string.h>
-#include <ctype.h>
-#include <unistd.h>
+#include <stdio.h> /* for FILE etc */
+#include <stdlib.h> /* for malloc */
+#include <unistd.h> /* for unlink */
+#include <limits.h> /* for PATH_MAX */
#include <sys/types.h>
#include <sys/stat.h>
+#define __USE_GNU /* for strcasestr */
+#include <string.h> /* for making ftw.h happy */
+#include <strings.h>
+#include <ctype.h>
#include <sys/wait.h>
#include "pnd_logger.h"
#include "pnd_discovery.h"
#include "pnd_locate.h"
#include "pnd_device.h"
+#include "pnd_pndfiles.h"
#include "mmenu.h"
#include "mmwrapcmd.h"
// create all cat
if ( pnd_conf_get_as_int_d ( g_conf, "categories.do_all_cat", 1 ) ) {
- category_push ( g_x11_present ? CATEGORY_ALL " (X11)" : CATEGORY_ALL " (No X11)", NULL );
+ category_push ( g_x11_present ? CATEGORY_ALL " (X11)" : CATEGORY_ALL " (No X11)", NULL, 0 );
}
// set up category mappings
ui_cachescreen ( 0 /* clear screen */, IFNULL(iter->title_en,"No Name") );
}
+ // if an ovr was flagged by libpnd, lets go inhale it just so we've got the
+ // notes handy, since notes are not handled by libpnd proper
+ pnd_conf_handle ovrh = 0;
+ if ( iter -> object_flags & PND_DISCO_FLAG_OVR ) {
+ char ovrfile [ PATH_MAX ];
+ char *fixpxml;
+ sprintf ( ovrfile, "%s/%s", iter -> object_path, iter -> object_filename );
+ fixpxml = strcasestr ( ovrfile, PND_PACKAGE_FILEEXT );
+ strcpy ( fixpxml, PXML_SAMEPATH_OVERRIDE_FILEEXT );
+
+ ovrh = pnd_conf_fetch_by_path ( ovrfile );
+
+#if 0
+ if ( ovrh ) {
+ pnd_log ( pndn_debug, "Found ovr file for %s # %u\n", iter -> object_filename, iter -> subapp_number );
+ }
+#endif
+
+ } // ovr
+
// cache the icon, unless deferred
if ( pnd_conf_get_as_int_d ( g_conf, "minimenu.load_icons_later", 0 ) == 0 ) {
if ( iter -> pnd_icon_pos &&
// push to All category
// we do this first, so first category is always All
if ( pnd_conf_get_as_int_d ( g_conf, "categories.do_all_cat", 1 ) ) {
- if ( ! category_push ( g_x11_present ? CATEGORY_ALL " (X11)" : CATEGORY_ALL " (No X11)", iter ) ) {
+ if ( ! category_push ( g_x11_present ? CATEGORY_ALL " (X11)" : CATEGORY_ALL " (No X11)", iter, ovrh ) ) {
pnd_log ( pndn_warning, " Couldn't categorize to All: '%s'\n", IFNULL(iter -> title_en, "No Name") );
}
} // all?
// main categories
if ( iter -> main_category && pnd_conf_get_as_int_d ( g_conf, "tabs.top_maincat", 1 ) ) {
- if ( ! category_meta_push ( iter -> main_category, iter ) ) {
+ if ( ! category_meta_push ( iter -> main_category, iter, ovrh ) ) {
pnd_log ( pndn_warning, " Couldn't categorize to %s: '%s'\n", iter -> main_category, IFNULL(iter -> title_en, "No Name") );
}
}
if ( iter -> main_category1 && pnd_conf_get_as_int_d ( g_conf, "tabs.top_maincat1", 0 ) ) {
- if ( ! category_meta_push ( iter -> main_category1, iter ) ) {
+ if ( ! category_meta_push ( iter -> main_category1, iter, ovrh ) ) {
pnd_log ( pndn_warning, " Couldn't categorize to %s: '%s'\n", iter -> main_category1, IFNULL(iter -> title_en, "No Name") );
}
}
if ( iter -> main_category2 && pnd_conf_get_as_int_d ( g_conf, "tabs.top_maincat2", 0 ) ) {
- if ( ! category_meta_push ( iter -> main_category2, iter ) ) {
+ if ( ! category_meta_push ( iter -> main_category2, iter, ovrh ) ) {
pnd_log ( pndn_warning, " Couldn't categorize to %s: '%s'\n", iter -> main_category2, IFNULL(iter -> title_en, "No Name") );
}
}
// alt categories
if ( iter -> alt_category && pnd_conf_get_as_int_d ( g_conf, "tabs.top_altcat", 0 ) ) {
- if ( ! category_meta_push ( iter -> alt_category, iter ) ) {
+ if ( ! category_meta_push ( iter -> alt_category, iter, ovrh ) ) {
pnd_log ( pndn_warning, " Couldn't categorize to %s: '%s'\n", iter -> alt_category, IFNULL(iter -> title_en, "No Name") );
}
}
if ( iter -> alt_category1 && pnd_conf_get_as_int_d ( g_conf, "tabs.top_altcat1", 0 ) ) {
- if ( ! category_meta_push ( iter -> alt_category1, iter ) ) {
+ if ( ! category_meta_push ( iter -> alt_category1, iter, ovrh ) ) {
pnd_log ( pndn_warning, " Couldn't categorize to %s: '%s'\n", iter -> alt_category1, IFNULL(iter -> title_en, "No Name") );
}
}
if ( iter -> alt_category2 && pnd_conf_get_as_int_d ( g_conf, "tabs.top_altcat2", 0 ) ) {
- if ( ! category_meta_push ( iter -> alt_category2, iter ) ) {
+ if ( ! category_meta_push ( iter -> alt_category2, iter, ovrh ) ) {
pnd_log ( pndn_warning, " Couldn't categorize to %s: '%s'\n", iter -> alt_category2, IFNULL(iter -> title_en, "No Name") );
}
}
text_offset_y 65 # from top of cell to top of text
text_width 75 # max width of the text
text_clip_x 5 # offset from cell edge to left edge of text, when the text width is being clipped to fit
+sel_offoffset_x -5 # so selection can be a little bigger than main cell, this is selection offset relative to top corner of icon
+sel_offoffset_y -5 # so selection can be a little bigger than main cell, this is selection offset relative to top corner of icon
cell_width 85 # cell location is grid_offset_x + ( cell_width * column_number )
cell_height 92 # cell location is grid_offset_y + ( cell_height * column_number )
col_max 5 # number of columns to render into grid
font Vera.ttf
font_ptsize 16
cell_offset_x 488 # left edge of text cell
-cell_offset_y 312 # top edge of text cell
+cell_offset_y 300 # top edge of text cell
cell_width 250 # width of cell (for text clipping)
[previewpic]
//
// scale icons
- g_imagecache [ IMG_SELECTED_ALPHAMASK ].i = ui_scale_image ( g_imagecache [ IMG_SELECTED_ALPHAMASK ].i, pnd_conf_get_as_int_d ( g_conf, "grid.icon_max_width", 50 ), -1 );
g_imagecache [ IMG_ICON_MISSING ].i = ui_scale_image ( g_imagecache [ IMG_ICON_MISSING ].i, pnd_conf_get_as_int_d ( g_conf, "grid.icon_max_width", 50 ), -1 );
// scale text hilight
g_imagecache [ IMG_SELECTED_HILITE ].i = ui_scale_image ( g_imagecache [ IMG_SELECTED_HILITE ].i, pnd_conf_get_as_int_d ( g_conf, "grid.text_width", 50 ), -1 );
unsigned int icon_offset_y = pnd_conf_get_as_int ( g_conf, "grid.icon_offset_y" );
unsigned int icon_max_width = pnd_conf_get_as_int ( g_conf, "grid.icon_max_width" );
unsigned int icon_max_height = pnd_conf_get_as_int ( g_conf, "grid.icon_max_height" );
+ unsigned int sel_icon_offset_x = pnd_conf_get_as_int_d ( g_conf, "grid.sel_offoffset_x", 0 );
+ unsigned int sel_icon_offset_y = pnd_conf_get_as_int_d ( g_conf, "grid.sel_offoffset_y", 0 );
unsigned int text_width = pnd_conf_get_as_int ( g_conf, "grid.text_width" );
unsigned int text_clip_x = pnd_conf_get_as_int ( g_conf, "grid.text_clip_x" );
if ( ! ( render_jobs_b & R_BG ) ) {
if ( g_imagecache [ IMG_BACKGROUND_800480 ].i ) {
src.x = grid_offset_x;
- src.y = grid_offset_y;
+ src.y = grid_offset_y + sel_icon_offset_y;
src.w = col_max * cell_width;
src.h = row_max * cell_height;
dest -> x = grid_offset_x;
- dest -> y = grid_offset_y;
+ dest -> y = grid_offset_y + sel_icon_offset_y;
SDL_BlitSurface ( g_imagecache [ IMG_BACKGROUND_800480 ].i, &src, sdl_realscreen, dest );
dest++;
// selected? show hilights
if ( appiter == ui_selected ) {
+ SDL_Surface *s = g_imagecache [ IMG_SELECTED_ALPHAMASK ].i;
// icon
- dest -> x = grid_offset_x + ( col * cell_width ) + icon_offset_x;
- dest -> y = grid_offset_y + ( displayrow * cell_height ) + icon_offset_y;
- SDL_BlitSurface ( g_imagecache [ IMG_SELECTED_ALPHAMASK ].i, NULL /* all */, sdl_realscreen, dest );
+ //dest -> x = grid_offset_x + ( col * cell_width ) + icon_offset_x + ( ( icon_max_width - s -> w ) / 2 );
+ dest -> x = grid_offset_x + ( col * cell_width ) + icon_offset_x + sel_icon_offset_x;
+ //dest -> y = grid_offset_y + ( displayrow * cell_height ) + icon_offset_y + ( ( icon_max_height - s -> h ) / 2 );
+ dest -> y = grid_offset_y + ( displayrow * cell_height ) + icon_offset_y + sel_icon_offset_y;
+ SDL_BlitSurface ( s, NULL /* all */, sdl_realscreen, dest );
dest++;
// text
dest -> x = grid_offset_x + ( col * cell_width ) + text_clip_x;
}
// category
+#if 0
if ( ui_selected -> ref -> main_category ) {
sprintf ( buffer, "Category: %s", ui_selected -> ref -> main_category );
dest++;
desty += src.h;
}
+#endif
// clock
if ( ui_selected -> ref -> clockspeed ) {
}
// info hint
- if ( ui_selected -> ref -> clockspeed && ui_selected -> ref -> info_filename ) {
+#if 0 // merged into hint-line
+ if ( ui_selected -> ref -> info_filename ) {
sprintf ( buffer, "Documentation - hit Y" );
dest++;
desty += src.h;
}
+#endif
+
+ // notes
+ if ( ui_selected -> ovrh ) {
+ char *n;
+ unsigned char i;
+ char buffer [ 50 ];
+
+ desty += 5; // a touch of spacing can't hurt
+
+ for ( i = 1; i < 4; i++ ) {
+ sprintf ( buffer, "Application-%u.note-%u", ui_selected -> ref -> subapp_number, i );
+ n = pnd_conf_get_as_char ( ui_selected -> ovrh, buffer );
+
+ if ( n ) {
+ SDL_Surface *rtext;
+ SDL_Color tmpfontcolor = { font_rgba_r, font_rgba_g, font_rgba_b, font_rgba_a };
+ rtext = TTF_RenderText_Blended ( g_detailtext_font, n, tmpfontcolor );
+ src.x = 0;
+ src.y = 0;
+ src.w = rtext -> w < cell_width ? rtext -> w : cell_width;
+ src.h = rtext -> h;
+ dest -> x = cell_offset_x;
+ dest -> y = desty;
+ SDL_BlitSurface ( rtext, &src, sdl_realscreen, dest );
+ SDL_FreeSurface ( rtext );
+ dest++;
+ desty += rtext -> h;
+ }
+ } // for
+
+ } // r_detail -> notes
// preview pic
mm_cache_t *ic = cache_query_preview ( ui_selected -> ref -> unique_id );
dest++;
}
- } // selected?
+ } // r_detail && selected?
// extras
//
// battery
- if ( 1 ) {
+ if ( render_jobs_b & R_BG ) {
static int last_battlevel = 0;
static unsigned char batterylevel = 0;
char buffer [ 100 ];
// hints
if ( pnd_conf_get_as_char ( g_conf, "display.hintline" ) ) {
- char *buffer = pnd_conf_get_as_char ( g_conf, "display.hintline" );
+ char *buffer;
+ unsigned int hintx, hinty;
+ hintx = pnd_conf_get_as_int_d ( g_conf, "display.hint_x", 40 );
+ hinty = pnd_conf_get_as_int_d ( g_conf, "display.hint_y", 450 );
+ static unsigned int lastwidth = 3000;
+
+ if ( ui_selected && ui_selected -> ref -> info_filename ) {
+ buffer = "Documentation - hit Y";
+ } else {
+ buffer = pnd_conf_get_as_char ( g_conf, "display.hintline" );
+ }
+
SDL_Surface *rtext;
SDL_Color tmpfontcolor = { font_rgba_r, font_rgba_g, font_rgba_b, font_rgba_a };
rtext = TTF_RenderText_Blended ( g_grid_font, buffer, tmpfontcolor );
- dest -> x = pnd_conf_get_as_int_d ( g_conf, "display.hint_x", 40 );
- dest -> y = pnd_conf_get_as_int_d ( g_conf, "display.hint_y", 450 );
+
+ // clear bg
+ if ( ! ( render_jobs_b & R_BG ) ) {
+ src.x = hintx;
+ src.y = hinty;
+ src.w = lastwidth;
+ src.h = rtext -> h;
+ dest -> x = hintx;
+ dest -> y = hinty;
+ SDL_BlitSurface ( g_imagecache [ IMG_BACKGROUND_TABMASK ].i, &src, sdl_realscreen, dest );
+ dest++;
+ lastwidth = rtext -> w;
+ }
+
+ // now render text
+ dest -> x = hintx;
+ dest -> y = hinty;
SDL_BlitSurface ( rtext, NULL /* all */, sdl_realscreen, dest );
SDL_FreeSurface ( rtext );
dest++;
}
- // hints
- if ( pnd_conf_get_as_int_d ( g_conf, "display.clock_x", -1 ) != -1 ) {
+ // clock time
+ if ( render_jobs_b & R_BG &&
+ pnd_conf_get_as_int_d ( g_conf, "display.clock_x", -1 ) != -1 )
+ {
char buffer [ 50 ];
time_t t = time ( NULL );
}
// update all the rects and send it all to sdl
+ // - at this point, we could probably just do 1 rect, of the
+ // whole screen, and be faster :/
SDL_UpdateRects ( sdl_realscreen, dest - rects, rects );
} // ui_render
// set env to xfce
sprintf ( buffer, "echo startxfce4 > /tmp/gui.load" );
system ( buffer );
+ emit_and_quit ( buffer );
//sprintf ( buffer, "sudo poweroff" );
//system ( buffer );
exit ( 0 );
// set env to pmenu
sprintf ( buffer, "echo pmenu > /tmp/gui.load" );
system ( buffer );
+ emit_and_quit ( buffer );
//sprintf ( buffer, "sudo poweroff" );
//system ( buffer );
exit ( 0 );
[Application-1]
title HatariHack1
clockspeed 200
+note-1 Note Line One; Hello DaveC!
+note-2 We here have another 2 note line
+note-3 We here have another 3 note line