Scrolling implemented for big pretty print outputs
This commit is contained in:
parent
ba4acfc4f4
commit
b2b9f343b4
76
console.c
76
console.c
|
@ -1077,23 +1077,81 @@ int Console_Disp()
|
|||
void Console_Draw_TeX_Popup(unsigned char* str, int width, int height)
|
||||
{
|
||||
DISPBOX popup;
|
||||
DISPBOX temp;
|
||||
unsigned char arrows[4*3] = {0xE6, 0x9A, '\0', 0xE6, 0x9B, '\0', 0xE6, 0x9C, '\0', 0xE6, 0x9D, '\0'};
|
||||
int margin = 2, border = 1;
|
||||
int scroll_lateral = 0, scroll_lateral_flag = 0, scroll_vertical = 0, scroll_vertical_flag = 0;
|
||||
int key;
|
||||
|
||||
popup.left = 64 - width/2 - margin - border;
|
||||
popup.right = 128 - popup.left;
|
||||
if(width > 115) {
|
||||
popup.left = 5;
|
||||
popup.right = 122;
|
||||
|
||||
popup.top = 32 - height/2 - margin - border;
|
||||
popup.bottom = 64 - popup.top;
|
||||
scroll_lateral_flag = 1;
|
||||
}
|
||||
else {
|
||||
popup.left = 64 - width/2 - margin - border;
|
||||
popup.right = 128 - popup.left;
|
||||
}
|
||||
|
||||
if(height > 50) {
|
||||
popup.top = 5;
|
||||
popup.bottom = 57;
|
||||
|
||||
scroll_vertical_flag = 1;
|
||||
}
|
||||
else {
|
||||
popup.top = 32 - height/2 - margin - border;
|
||||
popup.bottom = 64 - popup.top;
|
||||
}
|
||||
|
||||
/*temp.left = 0; temp.top = 0; temp.right = 128; temp.bottom = 64;
|
||||
Bdisp_ReadArea_VRAM (&temp, vram_copy);*/
|
||||
|
||||
Bdisp_AreaClr_VRAM(&popup);
|
||||
Bdisp_AreaReverseVRAM(popup.left, popup.top, popup.right, popup.bottom);
|
||||
while(key != KEY_CTRL_EXIT) {
|
||||
Bdisp_AreaClr_VRAM(&popup);
|
||||
Bdisp_AreaReverseVRAM(popup.left, popup.top, popup.right, popup.bottom);
|
||||
|
||||
Bdisp_AreaReverseVRAM(popup.left + border, popup.top + border, popup.right - border, popup.bottom - border);
|
||||
Bdisp_AreaReverseVRAM(popup.left + border, popup.top + border, popup.right - border, popup.bottom - border);
|
||||
|
||||
TeX_drawComplex((char*)str, popup.left+border+margin, popup.top+border+margin);
|
||||
TeX_drawComplex((char*)str, popup.left+border+margin + scroll_lateral, popup.top+border+margin + scroll_vertical);
|
||||
|
||||
GetKey(&key);
|
||||
if(scroll_lateral_flag ||scroll_vertical_flag) {
|
||||
temp.left = 0; temp.top = 0; temp.right = popup.left-1; temp.bottom = popup.bottom;
|
||||
Bdisp_AreaClr_VRAM(&temp);
|
||||
temp.left = 0; temp.top = popup.bottom+1; temp.right = 127; temp.bottom = 63;
|
||||
Bdisp_AreaClr_VRAM(&temp);
|
||||
temp.left = popup.left-1; temp.top = 0; temp.right = 127; temp.bottom = popup.top-1;
|
||||
Bdisp_AreaClr_VRAM(&temp);
|
||||
temp.left = popup.right+1; temp.top = popup.top-1; temp.right = 127; temp.bottom = 63;
|
||||
Bdisp_AreaClr_VRAM(&temp);
|
||||
|
||||
if(scroll_lateral < 0) PrintMini(1, 30, arrows, 0);
|
||||
if(scroll_lateral > -(width - 115)) PrintMini(123, 30, arrows + 3, 0);
|
||||
if(scroll_vertical < 0) PrintMini(61, 0, arrows + 6, 0);
|
||||
if(scroll_vertical > -(height - 47)) PrintMini(61, 58, arrows + 9, 0);
|
||||
|
||||
Bdisp_DrawLineVRAM(popup.left, popup.top, popup.left, popup.bottom);
|
||||
Bdisp_DrawLineVRAM(popup.left, popup.top, popup.right, popup.top);
|
||||
Bdisp_DrawLineVRAM(popup.left, popup.bottom, popup.right, popup.bottom);
|
||||
Bdisp_DrawLineVRAM(popup.right, popup.top, popup.right, popup.bottom);
|
||||
}
|
||||
|
||||
GetKey(&key);
|
||||
|
||||
if(scroll_lateral_flag) {
|
||||
if(key == KEY_CTRL_LEFT && scroll_lateral < 0) scroll_lateral += 5;
|
||||
if(key == KEY_CTRL_RIGHT && scroll_lateral > -(width - 115)) scroll_lateral -= 5;
|
||||
|
||||
if(scroll_lateral > 0) scroll_lateral = 0;
|
||||
}
|
||||
if(scroll_vertical_flag) {
|
||||
if(key == KEY_CTRL_UP && scroll_vertical < 0) scroll_vertical += 3;
|
||||
if(key == KEY_CTRL_DOWN && scroll_vertical > -(height - 47)) scroll_vertical -= 3;
|
||||
|
||||
if(scroll_vertical > 0) scroll_vertical = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -45,11 +45,11 @@ printline(U *p)
|
|||
print_expr(p);
|
||||
#ifdef TEX
|
||||
TeX_sizeComplex(edit_line, &width, &height, &baseline);
|
||||
if(width > MAX_TEX_WIDTH || height > MAX_TEX_HEIGHT) {
|
||||
/*if(width > MAX_TEX_WIDTH || height > MAX_TEX_HEIGHT) {
|
||||
tex_flag = 0;
|
||||
Console_Clear_EditLine();
|
||||
print_expr(p);
|
||||
}
|
||||
}*/
|
||||
|
||||
tex_flag = old_tex_flag;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue