Add of the Fmenus icons drawing at the bottom of the screen
This commit is contained in:
parent
5789c43255
commit
42bb534499
|
@ -9,7 +9,7 @@ Height=7095
|
|||
Width=9090
|
||||
State=0
|
||||
Flags=00000020
|
||||
Setting=16:1:console.c
|
||||
Setting=32:1:console.c
|
||||
OptionA=0
|
||||
|
||||
[_2]
|
||||
|
@ -18,7 +18,7 @@ Order=3
|
|||
Top=0
|
||||
Left=13035
|
||||
Height=4785
|
||||
Width=5610
|
||||
Width=5490
|
||||
State=0
|
||||
Flags=00000001
|
||||
OptionA=15
|
||||
|
@ -153,7 +153,7 @@ Top=7515
|
|||
Left=3045
|
||||
Height=9570
|
||||
Width=24855
|
||||
State=0
|
||||
State=1
|
||||
Flags=00000020
|
||||
OptionA=0
|
||||
|
||||
|
|
73
console.c
73
console.c
|
@ -4,6 +4,8 @@
|
|||
#include "syscalls.h"
|
||||
#include "memory.h"
|
||||
|
||||
extern void run(char *s);
|
||||
|
||||
static struct line Line[LINE_MAX];
|
||||
static struct FMenu FMenu_entries[6];
|
||||
static struct location Cursor;
|
||||
|
@ -562,6 +564,8 @@ unsigned char *Console_Make_Entry(const unsigned char* str)
|
|||
int Console_Draw_FMenu(int key, struct FMenu* menu)
|
||||
{
|
||||
int i, nb_entries = 0, selector = 0, position_number, position_x, ret, longest = 0;
|
||||
unsigned char quick[] = "[*]: ";
|
||||
int quick_len = 4;
|
||||
unsigned char **entries;
|
||||
DISPBOX box;
|
||||
|
||||
|
@ -574,29 +578,38 @@ int Console_Draw_FMenu(int key, struct FMenu* menu)
|
|||
if(strlen(entries[i]) > longest) longest = strlen(entries[i]);
|
||||
|
||||
position_x = 21*position_number;
|
||||
if(position_x + longest*4 > 115) position_x = 115 - longest*4;
|
||||
if(position_x + longest*4 + quick_len*4 > 115) position_x = 115 - longest*4 - quick_len*4;
|
||||
|
||||
box.left = position_x+3;
|
||||
box.right = position_x + longest*4 + 7;
|
||||
box.bottom = 50+7;
|
||||
box.top = 50+7- nb_entries*7;
|
||||
box.left = position_x;
|
||||
box.right = position_x + longest*4 + quick_len*4 + 6;
|
||||
box.bottom = 63-9;
|
||||
box.top = 63-9-nb_entries*7;
|
||||
|
||||
Bdisp_AreaClr_VRAM(&box);
|
||||
|
||||
Bdisp_DrawLineVRAM(3+position_x, 50+7, 3+position_x, 50+7-nb_entries*7);
|
||||
Bdisp_DrawLineVRAM(7+position_x + longest*4, 50+7, 7+position_x+longest*4, 50+7-nb_entries*7);
|
||||
Bdisp_DrawLineVRAM(box.left, box.bottom, box.left, box.top);
|
||||
Bdisp_DrawLineVRAM(box.right, box.bottom, box.right, box.top);
|
||||
|
||||
//If the cursor is flashing on the opening box, disable it.
|
||||
if(((Cursor.x*(128/21)<box.right && Cursor.x*(128/21)>box.left))
|
||||
&& ((Cursor.y*(64/8)<box.bottom) && (Cursor.y*(64/8)>box.top))) Cursor_SetFlashOff();
|
||||
|
||||
while(key != KEY_CTRL_EXE || key != KEY_CTRL_EXIT) {
|
||||
for(i=0; i<nb_entries; i++) {
|
||||
PrintMini(5+position_x, 50-7*i, entries[i], MINI_OVER);
|
||||
quick[1] = '0'+(i+1);
|
||||
PrintMini(3+position_x, box.bottom-7*(i+1), quick, MINI_OVER);
|
||||
PrintMini(3+position_x+quick_len*4, box.bottom-7*(i+1), entries[i], MINI_OVER);
|
||||
}
|
||||
PrintMini(5+position_x,50-7*selector, entries[selector], MINI_REV);
|
||||
PrintMini(3+position_x+quick_len*4,box.bottom-7*(selector+1), entries[selector], MINI_REV);
|
||||
GetKey(&key);
|
||||
|
||||
if (key == KEY_CTRL_UP && selector < nb_entries-1) selector++;
|
||||
if (key == KEY_CTRL_DOWN && selector > 0) selector--;
|
||||
|
||||
if (key == KEY_CTRL_EXE) return Console_Input(entries[selector]);
|
||||
|
||||
if (key >= KEY_CHAR_1 && key < KEY_CHAR_1 + nb_entries) return Console_Input(entries[key-KEY_CHAR_1]);
|
||||
|
||||
if (key == KEY_CTRL_EXIT) return Console_Input((const unsigned char *)"");
|
||||
|
||||
if (key >= KEY_CTRL_F1 && key <= KEY_CTRL_F6) {
|
||||
|
@ -636,6 +649,7 @@ int Console_Init()
|
|||
Case = LOWER_CASE;
|
||||
|
||||
for(i = 0; i < 6; i++) {
|
||||
FMenu_entries[i].name = NULL;
|
||||
FMenu_entries[i].count = 0;
|
||||
}
|
||||
|
||||
|
@ -657,7 +671,7 @@ void Console_FMenu_Init()
|
|||
// Does the file exists ?
|
||||
// Todo : check the error codes...
|
||||
if(!cfg) {
|
||||
unsigned char conf_standard[] = {"F2\ncos(\nsin(\ntan(\nF1\ntest(\ntest(\nF4\nje(\nsuis(\nvivant(\nF5\nabdibol(\ngeorges(\ngali(\npom(\npom(\nde(\natol(\nF6\nreturn(\nsolve(\nF3solve(\nfactor(\nsimplify(\nmatrix(\nd("};
|
||||
unsigned char conf_standard[] = {"F2 trig\ncos(\nsin(\ntan(\nF1\ntest(\ntest(\nF4\nje(\nsuis(\nvivant(\nF5\nabdibol(\ngeorges(\ngali(\npom(\npom(\nde(\natol(\nF6\nreturn(\nsolve(\nF3\nsolve(\nfactor(\nsimplify(\nmatrix(\nd("};
|
||||
memory_createfile("\\\\fls0\\FMENU.cfg", strlen(conf_standard)+1);
|
||||
handle = memory_openfile("\\\\fls0\\FMENU.cfg", _OPENMODE_READWRITE);
|
||||
memory_writefile(handle, conf_standard, strlen(conf_standard)+1);
|
||||
|
@ -674,10 +688,20 @@ void Console_FMenu_Init()
|
|||
temp[i] = *cfg;
|
||||
}
|
||||
|
||||
//If starting by 'F', adjust the number of the menu
|
||||
if(temp[0] == 'F' && temp[1]>='1' && temp[1]<='6') number = temp[1]-'0' - 1;
|
||||
//If starting by 'F', adjust the number and eventually set the name of the menu
|
||||
if(temp[0] == 'F' && temp[1]>='1' && temp[1]<='6') {
|
||||
number = temp[1]-'0' - 1;
|
||||
if(temp[3] && FMenu_entries[number].name == NULL) {
|
||||
FMenu_entries[number].name = malloc(sizeof(unsigned char)*(4+1));
|
||||
if(FMenu_entries[number].name != NULL) {
|
||||
strncpy(FMenu_entries[number].name, temp+3, 4);
|
||||
FMenu_entries[number].name[4] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Else, fill the current menu
|
||||
else if(temp[0]) {
|
||||
else if(temp[0] && FMenu_entries[number].count < MAX_FMENU_ITEMS) {
|
||||
//Alloc a new string a copy current data into it
|
||||
tmp_realloc=FMenu_entries[number].str;
|
||||
FMenu_entries[number].str = realloc(tmp_realloc, sizeof(unsigned char*)*(FMenu_entries[number].count+1));
|
||||
|
@ -715,10 +739,15 @@ void Console_FMenu_Init()
|
|||
|
||||
int Console_Disp()
|
||||
{
|
||||
unsigned int* pBitmap;
|
||||
int i, alpha_shift_status;
|
||||
DISPBOX ficon;
|
||||
|
||||
Bdisp_AllClr_VRAM();
|
||||
|
||||
//GetFKeyIconPointer( 0x01BE, &ficon );
|
||||
//DisplayFKeyIcon( i, ficon);
|
||||
|
||||
for (i = 0; (i < LINE_DISP_MAX) && (i + Start_Line <= Last_Line); i++)
|
||||
{
|
||||
if (i == Cursor.y)
|
||||
|
@ -839,6 +868,24 @@ int Console_Disp()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Draw the "fkeys icons"
|
||||
|
||||
for(i=0; i<6; i++) {
|
||||
ficon.bottom = 64;
|
||||
ficon.top = 64-8;
|
||||
if (FMenu_entries[i].count > 0) {
|
||||
ficon.left = 1+i*21;
|
||||
ficon.right = ficon.left + (127-2)/6 - 1;
|
||||
Bdisp_AreaClr_VRAM(&ficon);
|
||||
Bdisp_AreaReverseVRAM(ficon.left, ficon.top, ficon.right, ficon.bottom);
|
||||
|
||||
if(FMenu_entries[i].name != NULL) {
|
||||
PrintMini(ficon.left + 2, ficon.top +2, FMenu_entries[i].name, MINI_REV);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bdisp_PutDisp_DD();
|
||||
return CONSOLE_SUCCEEDED;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ extern "C"{
|
|||
};
|
||||
|
||||
struct FMenu{
|
||||
unsigned char* name;
|
||||
unsigned char** str;
|
||||
unsigned char count;
|
||||
};
|
||||
|
@ -64,7 +65,7 @@ extern "C"{
|
|||
int y;
|
||||
};
|
||||
|
||||
#define MAX_MENU_ITEMS 10
|
||||
#define MAX_FMENU_ITEMS 7
|
||||
|
||||
#define is_wchar(c) ((c == 0x7F) || (c == 0xF7) || (c == 0xF9) || (c == 0xE5) || (c == 0xE6) || (c == 0xE7))
|
||||
#define printf(s) Console_Output((const unsigned char *)s);
|
||||
|
|
Loading…
Reference in New Issue