mirror of
https://git.planet-casio.com/Lephenixnoir/JustUI.git
synced 2024-12-28 20:43:40 +01:00
don't use FX9860G/FXCG50 and slightly more unified APIs
We still have a few platform-specific occurrences that I'll want to get rid of in the future. This should ultimately leave me with only one version of the library (but this also precludes the use of macros like DWIDTH/DHEIGHT which will require further changes).
This commit is contained in:
parent
0e5ccf4cc3
commit
e324f9a3a2
9 changed files with 114 additions and 130 deletions
|
@ -11,6 +11,7 @@ configure_file(include/justui/config.h.in include/justui/config.h)
|
||||||
|
|
||||||
set(ASSETS_fx
|
set(ASSETS_fx
|
||||||
assets/input-modes-fx.png
|
assets/input-modes-fx.png
|
||||||
|
assets/font-fkeys-fx.png
|
||||||
)
|
)
|
||||||
set(ASSETS_cg
|
set(ASSETS_cg
|
||||||
assets/input-modes-cg.png
|
assets/input-modes-cg.png
|
||||||
|
|
BIN
assets/font-fkeys-fx.png
Normal file
BIN
assets/font-fkeys-fx.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
|
@ -6,3 +6,13 @@ input-modes-cg.png:
|
||||||
name: j_img_input_modes
|
name: j_img_input_modes
|
||||||
type: bopti-image
|
type: bopti-image
|
||||||
profile: p4
|
profile: p4
|
||||||
|
|
||||||
|
font-fkeys-fx.png:
|
||||||
|
name: j_font_fkeys_fx
|
||||||
|
type: font
|
||||||
|
charset: print
|
||||||
|
grid.size: 5x6
|
||||||
|
grid.padding: 1
|
||||||
|
grid.border: 0
|
||||||
|
proportional: true
|
||||||
|
height: 6
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <justui/jwidget.h>
|
#include <justui/jwidget.h>
|
||||||
|
|
||||||
#include <gint/display.h>
|
#include <gint/display.h>
|
||||||
|
#include <gint/config.h>
|
||||||
|
|
||||||
/* jfkeys: Functions keys indicating functions for the F1..F6 keys
|
/* jfkeys: Functions keys indicating functions for the F1..F6 keys
|
||||||
|
|
||||||
|
@ -32,8 +33,8 @@
|
||||||
that should catch attention, or particularly unsafe actions. They are
|
that should catch attention, or particularly unsafe actions. They are
|
||||||
round white keys.
|
round white keys.
|
||||||
|
|
||||||
On fx-CG 50, the keys are drawn dynamically using gint's default font, and
|
The more flexible option to draw the keys is dynamically with text. In that
|
||||||
specified using 6 strings that give the type and name of the keys:
|
case each key are specified with a strings that combines a type and name:
|
||||||
|
|
||||||
* "/NAME" for a menu key;
|
* "/NAME" for a menu key;
|
||||||
* ".NAME" for an entry key;
|
* ".NAME" for an entry key;
|
||||||
|
@ -45,20 +46,22 @@
|
||||||
instance, "/F1;#F2|/F1" represents a function bar where the F2
|
instance, "/F1;#F2|/F1" represents a function bar where the F2
|
||||||
function can be hidden by switching from level 0 to level 1.
|
function can be hidden by switching from level 0 to level 1.
|
||||||
|
|
||||||
On fx-9860G, there is not enough space to generate keys on-the-fly, so the
|
The other option is to draw the keys with an image. This is most useful at
|
||||||
full specification is just an image. The convention for the image is to be
|
small resolutions where hand-drawn keys often look better. On the fx-9860G
|
||||||
128x8 pixels, with each function key (i) positioned at (x = 21*i + 2) of
|
with its 128x64 resolution, the convention is that the image is 128x8, and
|
||||||
width 19. Several levels can be stacked up (n levels in an image of height
|
key #i is positioned at x = 21i+2 with width 19. The equivalent of "|"-
|
||||||
9n-1) and selected independently. */
|
separated levels is allowed by stacking up rows of keys (in which case the
|
||||||
|
image is of height 9n-1 for n rows). */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
jwidget widget;
|
jwidget widget;
|
||||||
int8_t level;
|
int8_t level;
|
||||||
|
|
||||||
#ifdef FX9860G
|
/* Image version; if specified this overrides all text parameters */
|
||||||
bopti_image_t const *img;
|
|
||||||
#endif
|
bopti_image_t const *img;
|
||||||
|
|
||||||
|
/* Text version */
|
||||||
|
|
||||||
#ifdef FXCG50
|
|
||||||
char const *labels;
|
char const *labels;
|
||||||
char const *overrides[6];
|
char const *overrides[6];
|
||||||
|
|
||||||
|
@ -66,39 +69,29 @@ typedef struct {
|
||||||
int text_color, text_special_color;
|
int text_color, text_special_color;
|
||||||
|
|
||||||
font_t const *font;
|
font_t const *font;
|
||||||
#endif
|
|
||||||
|
|
||||||
} jfkeys;
|
} jfkeys;
|
||||||
|
|
||||||
/* jfkeys_create(): Create a set of function keysed
|
/* jfkeys_create2(): Create a set of function keys
|
||||||
|
|
||||||
The arguments are obviously different on fx-9860G and fx-CG 50. If your
|
Both the image and text specification are provided; one of them should
|
||||||
application supports both, you might want to specify arguments for both
|
generally be NULL (if both are non-NULL, the image takes precedence). For
|
||||||
platforms in a single call with jfkeys_create2() which will filter them out
|
historical reasons the name fkeys_create() is a one-argument version with
|
||||||
for you. Referencing an image unavailable on fx-CG 50 in jfkeys_create2() is
|
either the text or image depending on the platform. */
|
||||||
safe since the preprocessor will remove that text. */
|
jfkeys *jfkeys_create2(
|
||||||
|
bopti_image_t const *img, char const *labels, void *parent);
|
||||||
|
|
||||||
#ifdef FX9860G
|
/* jfkeys_set2(): Replace the definition of function keys
|
||||||
jfkeys *jfkeys_create(bopti_image_t const *img, void *parent);
|
|
||||||
#define jfkeys_create2(img, labels, parent) jfkeys_create(img, parent)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FXCG50
|
|
||||||
jfkeys *jfkeys_create(char const *labels, void *parent);
|
|
||||||
#define jfkeys_create2(img, labels, parent) jfkeys_create(labels, parent)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* jfkeys_set(): Replace functions
|
|
||||||
This will also reset the level to 0. */
|
This will also reset the level to 0. */
|
||||||
|
void jfkeys_set2(jfkeys *keys, bopti_image_t const *img, char const *labels);
|
||||||
|
|
||||||
#ifdef FX9860G
|
/* Deprecated platform-specific shortcuts */
|
||||||
void jfkeys_set(jfkeys *keys, bopti_image_t const *img);
|
#if GINT_RENDER_MONO
|
||||||
#define jfkeys_set2(keys, img, labels) jfkeys_set(keys, img)
|
# define jfkeys_create(img, parent) jfkeys_create2(img, NULL, parent)
|
||||||
#endif
|
# define jfkeys_set(keys, img) jfkeys_set2(keys, img, NULL)
|
||||||
|
#elif GINT_RENDER_RGB
|
||||||
#ifdef FXCG50
|
# define jfkeys_create(labels, parent) jfkeys_create2(NULL, labels, parent)
|
||||||
void jfkeys_set(jfkeys *keys, char const *labels);
|
# define jfkeys_set(keys, labels) jfkeys_set2(keys, NULL, labels)
|
||||||
#define jfkeys_set2(keys, img, labels) jfkeys_set(keys, labels)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* jfkeys_level(): Return the current function key level */
|
/* jfkeys_level(): Return the current function key level */
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <gint/display.h>
|
#include <gint/display.h>
|
||||||
#include <gint/gint.h>
|
#include <gint/gint.h>
|
||||||
|
#include <gint/config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -14,6 +15,16 @@
|
||||||
/* Type identifier for jfileselect */
|
/* Type identifier for jfileselect */
|
||||||
static int jfileselect_type_id = -1;
|
static int jfileselect_type_id = -1;
|
||||||
|
|
||||||
|
#if GINT_RENDER_MONO
|
||||||
|
# define JFILESELECT_LINE_SPACING 1
|
||||||
|
# define JFILESELECT_SCROLLBAR_WIDTH 1
|
||||||
|
# define JFILESELECT_INFO_SHORT 1
|
||||||
|
#elif GINT_RENDER_RGB
|
||||||
|
# define JFILESELECT_LINE_SPACING 4
|
||||||
|
# define JFILESELECT_SCROLLBAR_WIDTH 2
|
||||||
|
# define JFILESELECT_INFO_SHORT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Events */
|
/* Events */
|
||||||
uint16_t JFILESELECT_LOADED;
|
uint16_t JFILESELECT_LOADED;
|
||||||
uint16_t JFILESELECT_VALIDATED;
|
uint16_t JFILESELECT_VALIDATED;
|
||||||
|
@ -59,20 +70,14 @@ jfileselect *jfileselect_create(void *parent)
|
||||||
fs->saveas_input = input;
|
fs->saveas_input = input;
|
||||||
fs->saveas = false;
|
fs->saveas = false;
|
||||||
fs->input_mode = false;
|
fs->input_mode = false;
|
||||||
|
fs->scrollbar_width = JFILESELECT_SCROLLBAR_WIDTH;
|
||||||
fs->filter_function = jfileselect_default_filter;
|
fs->filter_function = jfileselect_default_filter;
|
||||||
|
|
||||||
fs->cursor = -1;
|
fs->cursor = -1;
|
||||||
fs->scroll = 0;
|
fs->scroll = 0;
|
||||||
fs->visible_lines = 0;
|
fs->visible_lines = 0;
|
||||||
|
|
||||||
#ifdef FX9860G
|
fs->line_spacing = JFILESELECT_LINE_SPACING;
|
||||||
fs->line_spacing = 1;
|
|
||||||
fs->scrollbar_width = 1;
|
|
||||||
#else
|
|
||||||
fs->line_spacing = 4;
|
|
||||||
fs->scrollbar_width = 2;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fs->font = dfont_default();
|
fs->font = dfont_default();
|
||||||
fs->show_file_size = false;
|
fs->show_file_size = false;
|
||||||
|
|
||||||
|
@ -373,7 +378,7 @@ static void jfileselect_poly_layout(void *fs0)
|
||||||
|
|
||||||
static void generate_info_string(char *str, bool isfolder, int size)
|
static void generate_info_string(char *str, bool isfolder, int size)
|
||||||
{
|
{
|
||||||
#ifdef FX9860G
|
#if JFILESELECT_INFO_SHORT
|
||||||
if(size < 0)
|
if(size < 0)
|
||||||
sprintf(str, "E%d", -size);
|
sprintf(str, "E%d", -size);
|
||||||
else if(isfolder)
|
else if(isfolder)
|
||||||
|
|
91
src/jfkeys.c
91
src/jfkeys.c
|
@ -7,45 +7,39 @@
|
||||||
/* Type identified for jfkeys */
|
/* Type identified for jfkeys */
|
||||||
static int jfkeys_type_id = -1;
|
static int jfkeys_type_id = -1;
|
||||||
|
|
||||||
#ifdef FX9860G
|
extern font_t j_font_fkeys_fx;
|
||||||
jfkeys *jfkeys_create(bopti_image_t const *img, void *parent)
|
|
||||||
|
#if GINT_RENDER_MONO
|
||||||
|
# define JFKEYS_HEIGHT 8
|
||||||
|
#elif GINT_RENDER_RGB
|
||||||
|
# define JFKEYS_HEIGHT 17
|
||||||
|
#endif
|
||||||
|
|
||||||
|
jfkeys *jfkeys_create2(
|
||||||
|
bopti_image_t const *img, char const *labels, void *parent)
|
||||||
{
|
{
|
||||||
if(jfkeys_type_id < 0) return NULL;
|
if(jfkeys_type_id < 0) return NULL;
|
||||||
|
|
||||||
jfkeys *f = malloc(sizeof *f);
|
jfkeys *f = malloc(sizeof *f);
|
||||||
jwidget_init(&f->widget, jfkeys_type_id, parent);
|
jwidget_init(&f->widget, jfkeys_type_id, parent);
|
||||||
jfkeys_set(f, img);
|
jfkeys_set2(f, img, labels);
|
||||||
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
|
|
||||||
void jfkeys_set(jfkeys *f, bopti_image_t const *img)
|
|
||||||
{
|
|
||||||
f->img = img;
|
|
||||||
f->level = 0;
|
|
||||||
f->widget.update = true;
|
|
||||||
}
|
|
||||||
#endif /* FX9860G */
|
|
||||||
|
|
||||||
#ifdef FXCG50
|
|
||||||
jfkeys *jfkeys_create(char const *labels, void *parent)
|
|
||||||
{
|
|
||||||
if(jfkeys_type_id < 0) return NULL;
|
|
||||||
|
|
||||||
jfkeys *f = malloc(sizeof *f);
|
|
||||||
jwidget_init(&f->widget, jfkeys_type_id, parent);
|
|
||||||
jfkeys_set(f, labels);
|
|
||||||
for(int i = 0; i < 6; i++) f->overrides[i] = NULL;
|
for(int i = 0; i < 6; i++) f->overrides[i] = NULL;
|
||||||
f->bg_color = C_BLACK;
|
f->bg_color = C_BLACK;
|
||||||
f->bg_special_color = C_WHITE;
|
f->bg_special_color = C_WHITE;
|
||||||
f->text_color = C_WHITE;
|
f->text_color = C_WHITE;
|
||||||
f->text_special_color = C_BLACK;
|
f->text_special_color = C_BLACK;
|
||||||
|
|
||||||
|
#if GINT_RENDER_MONO
|
||||||
|
f->font = &j_font_fkeys_fx;
|
||||||
|
#else
|
||||||
f->font = dfont_default();
|
f->font = dfont_default();
|
||||||
|
#endif
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void jfkeys_set(jfkeys *f, char const *labels)
|
void jfkeys_set2(jfkeys *f, bopti_image_t const *img, char const *labels)
|
||||||
{
|
{
|
||||||
|
f->img = img;
|
||||||
f->labels = labels;
|
f->labels = labels;
|
||||||
f->level = 0;
|
f->level = 0;
|
||||||
f->widget.update = true;
|
f->widget.update = true;
|
||||||
|
@ -90,7 +84,6 @@ static char const *get_label(char const *level, int key, size_t *len)
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif /* FXCG50 */
|
|
||||||
|
|
||||||
//---
|
//---
|
||||||
// Polymorphic widget operations
|
// Polymorphic widget operations
|
||||||
|
@ -99,37 +92,27 @@ static char const *get_label(char const *level, int key, size_t *len)
|
||||||
static void jfkeys_poly_csize(void *f0)
|
static void jfkeys_poly_csize(void *f0)
|
||||||
{
|
{
|
||||||
jfkeys *f = f0;
|
jfkeys *f = f0;
|
||||||
|
f->widget.w = DWIDTH;
|
||||||
#ifdef FX9860G
|
f->widget.h = JFKEYS_HEIGHT;
|
||||||
f->widget.w = 128;
|
|
||||||
f->widget.h = 8;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FXCG50
|
|
||||||
f->widget.w = 396;
|
|
||||||
f->widget.h = 17;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void jfkeys_poly_render(void *f0, int base_x, int y)
|
static void jfkeys_poly_render(void *f0, int base_x, int y)
|
||||||
{
|
{
|
||||||
jfkeys *f = f0;
|
jfkeys *f = f0;
|
||||||
|
|
||||||
#ifdef FX9860G
|
if(f->img) {
|
||||||
dsubimage(base_x, y, f->img, 0, 9*f->level, f->img->width, 8, DIMAGE_NONE);
|
dsubimage(base_x, y, f->img, 0, (JFKEYS_HEIGHT+1) * f->level,
|
||||||
#endif
|
f->img->width, JFKEYS_HEIGHT, DIMAGE_NONE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef FXCG50
|
|
||||||
font_t const *old_font = dfont(f->font);
|
font_t const *old_font = dfont(f->font);
|
||||||
char const *level = get_level(f->labels, f->level);
|
char const *level = get_level(f->labels, f->level);
|
||||||
if(!level) return;
|
if(!level) return;
|
||||||
|
|
||||||
for(int position = 0; position < 6; position++) {
|
for(int position = 0; position < 6; position++) {
|
||||||
size_t length = 0;
|
size_t length = 0;
|
||||||
char const *text = NULL;
|
char const *text = f->overrides[position];
|
||||||
#ifdef FXCG50
|
|
||||||
text = f->overrides[position];
|
|
||||||
#endif
|
|
||||||
if(!text) text = get_label(level, position, &length);
|
if(!text) text = get_label(level, position, &length);
|
||||||
if(!text || (*text != '.' && *text != '/' && *text != '@'
|
if(!text || (*text != '.' && *text != '/' && *text != '@'
|
||||||
&& *text != '#')) continue;
|
&& *text != '#')) continue;
|
||||||
|
@ -168,7 +151,6 @@ static void jfkeys_poly_render(void *f0, int base_x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
dfont(old_font);
|
dfont(old_font);
|
||||||
#endif /* FXCG50 */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int jfkeys_level(jfkeys *f)
|
int jfkeys_level(jfkeys *f)
|
||||||
|
@ -183,41 +165,30 @@ void jfkeys_set_level(jfkeys *f, int level)
|
||||||
f->widget.update = 1;
|
f->widget.update = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char const *jfkeys_override(GUNUSED jfkeys *keys, GUNUSED int key)
|
char const *jfkeys_override(jfkeys *keys, int key)
|
||||||
{
|
{
|
||||||
#ifdef FXCG50
|
|
||||||
if(key < 1 || key > 6) return NULL;
|
if(key < 1 || key > 6) return NULL;
|
||||||
return keys->overrides[key - 1];
|
return keys->overrides[key - 1];
|
||||||
#endif
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void jfkeys_set_override(GUNUSED jfkeys *keys, GUNUSED int key,
|
void jfkeys_set_override(jfkeys *keys, int key, char const *override)
|
||||||
GUNUSED char const *override)
|
|
||||||
{
|
{
|
||||||
#ifdef FXCG50
|
|
||||||
if(key < 1 || key > 6) return;
|
if(key < 1 || key > 6) return;
|
||||||
keys->overrides[key - 1] = override;
|
keys->overrides[key - 1] = override;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void jfkeys_set_color(GUNUSED jfkeys *keys, GUNUSED int bg,
|
void jfkeys_set_color(
|
||||||
GUNUSED int bg_special, GUNUSED int text, GUNUSED int text_special)
|
jfkeys *keys, int bg, int bg_special, int text, int text_special)
|
||||||
{
|
{
|
||||||
#ifdef FXCG50
|
|
||||||
keys->bg_color = bg;
|
keys->bg_color = bg;
|
||||||
keys->bg_special_color = bg_special;
|
keys->bg_special_color = bg_special;
|
||||||
keys->text_color = text;
|
keys->text_color = text;
|
||||||
keys->text_special_color = text_special;
|
keys->text_special_color = text_special;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void jfkeys_set_font(GUNUSED jfkeys *keys, GUNUSED font_t const *font)
|
void jfkeys_set_font(jfkeys *keys, font_t const *font)
|
||||||
{
|
{
|
||||||
#ifdef FXCG50
|
|
||||||
keys->font = font;
|
keys->font = font;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* jfkeys type definition */
|
/* jfkeys type definition */
|
||||||
|
|
27
src/jframe.c
27
src/jframe.c
|
@ -4,18 +4,28 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include <gint/display.h>
|
#include <gint/display.h>
|
||||||
|
#include <gint/config.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
/* Type identifier for jframe */
|
/* Type identifier for jframe */
|
||||||
static int jframe_type_id = -1;
|
static int jframe_type_id = -1;
|
||||||
|
|
||||||
|
#if GINT_RENDER_MONO
|
||||||
|
# define JFRAME_SCROLLBAR_WIDTH 1
|
||||||
|
# define JFRAME_SCROLLBAR_SPACING 1
|
||||||
|
# define JFRAME_DEFAULT_MARGIN 4
|
||||||
|
#elif GINT_RENDER_RGB
|
||||||
|
# define JFRAME_SCROLLBAR_WIDTH 2
|
||||||
|
# define JFRAME_SCROLLBAR_SPACING 2
|
||||||
|
# define JFRAME_DEFAULT_MARGIN 8
|
||||||
|
#endif
|
||||||
|
|
||||||
jframe *jframe_create(void *parent)
|
jframe *jframe_create(void *parent)
|
||||||
{
|
{
|
||||||
if(jframe_type_id < 0)
|
if(jframe_type_id < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
jframe *f = malloc(sizeof *f);
|
jframe *f = malloc(sizeof *f);
|
||||||
if(!f)
|
if(!f)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -30,18 +40,11 @@ jframe *jframe_create(void *parent)
|
||||||
f->keyboard_control = false;
|
f->keyboard_control = false;
|
||||||
f->match_width = false;
|
f->match_width = false;
|
||||||
f->match_height = false;
|
f->match_height = false;
|
||||||
|
f->scrollbar_width = JFRAME_SCROLLBAR_WIDTH;
|
||||||
|
f->scrollbar_spacing = JFRAME_SCROLLBAR_SPACING;
|
||||||
|
|
||||||
#ifdef FX9860G
|
f->visibility_margin_x = JFRAME_DEFAULT_MARGIN;
|
||||||
f->scrollbar_width = 1;
|
f->visibility_margin_y = JFRAME_DEFAULT_MARGIN;
|
||||||
f->scrollbar_spacing = 1;
|
|
||||||
f->visibility_margin_x = 4;
|
|
||||||
f->visibility_margin_y = 4;
|
|
||||||
#else
|
|
||||||
f->scrollbar_width = 2;
|
|
||||||
f->scrollbar_spacing = 2;
|
|
||||||
f->visibility_margin_x = 8;
|
|
||||||
f->visibility_margin_y = 8;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
f->scroll_x = 0;
|
f->scroll_x = 0;
|
||||||
f->scroll_y = 0;
|
f->scroll_y = 0;
|
||||||
|
|
19
src/jinput.c
19
src/jinput.c
|
@ -5,7 +5,8 @@
|
||||||
|
|
||||||
#include <gint/display.h>
|
#include <gint/display.h>
|
||||||
#include <gint/keyboard.h>
|
#include <gint/keyboard.h>
|
||||||
#include <gint/std/stdlib.h>
|
#include <gint/config.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
/* Type identifier for jinput */
|
/* Type identifier for jinput */
|
||||||
static int jinput_type_id = -1;
|
static int jinput_type_id = -1;
|
||||||
|
@ -28,11 +29,12 @@ enum {
|
||||||
|
|
||||||
/* Mode indicators and their size */
|
/* Mode indicators and their size */
|
||||||
extern bopti_image_t j_img_input_modes;
|
extern bopti_image_t j_img_input_modes;
|
||||||
#ifdef FX9860G
|
#if GINT_RENDER_MONO
|
||||||
#define JINPUT_INDICATOR 9
|
# define JINPUT_INDICATOR 9
|
||||||
#endif
|
# define JINPUT_CURSOR_WIDTH 1
|
||||||
#ifdef FXCG50
|
#elif GINT_RENDER_RGB
|
||||||
#define JINPUT_INDICATOR 12
|
# define JINPUT_INDICATOR 12
|
||||||
|
# define JINPUT_CURSOR_WIDTH 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
jinput *jinput_create(char const *prompt, size_t length, void *parent)
|
jinput *jinput_create(char const *prompt, size_t length, void *parent)
|
||||||
|
@ -218,10 +220,7 @@ static void jinput_poly_render(void *i0, int x, int y)
|
||||||
else cursor_w = 0;
|
else cursor_w = 0;
|
||||||
|
|
||||||
int cursor_x = x + prompt_w + cursor_w;
|
int cursor_x = x + prompt_w + cursor_w;
|
||||||
dline(cursor_x, y, cursor_x, y + h - 1, i->color);
|
drect(cursor_x, y, cursor_x+JINPUT_CURSOR_WIDTH-1, y + h - 1, i->color);
|
||||||
#ifdef FXCG50
|
|
||||||
dline(cursor_x + 1, y, cursor_x + 1, y + h - 1, i->color);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dfont(old_font);
|
dfont(old_font);
|
||||||
|
|
|
@ -233,12 +233,14 @@ jevent jscene_run(jscene *s)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef FX9860G
|
// TODO: Temporarily disabled to allow build-fxg3a, will put back when
|
||||||
|
// gint's generic video interface is available
|
||||||
|
/* #ifdef FX9860G
|
||||||
if(k.type == KEYEV_DOWN && k.key == KEY_OPTN && k.shift && !k.alpha) {
|
if(k.type == KEYEV_DOWN && k.key == KEY_OPTN && k.shift && !k.alpha) {
|
||||||
t6k11_backlight(-1);
|
t6k11_backlight(-1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif */
|
||||||
|
|
||||||
getkey_feature_t feat = getkey_feature_function();
|
getkey_feature_t feat = getkey_feature_function();
|
||||||
if((k.type == KEYEV_DOWN || k.type == KEYEV_HOLD) && feat && feat(k))
|
if((k.type == KEYEV_DOWN || k.type == KEYEV_HOLD) && feat && feat(k))
|
||||||
|
|
Loading…
Reference in a new issue