X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Fgui_shell_src%2Fdisplay.c;h=bb07e39f6956950772f80f7f34579da872cda65e;hb=0e36d520741f85150354f37de3d6e087ee75066c;hp=4972ed138e0c552283a2be487e6b879fa7c8b613;hpb=8ca18a718af411a8391be8629e1201983044a88f;p=tpg%2Facess2.git diff --git a/Usermode/Applications/gui_shell_src/display.c b/Usermode/Applications/gui_shell_src/display.c index 4972ed13..bb07e39f 100644 --- a/Usermode/Applications/gui_shell_src/display.c +++ b/Usermode/Applications/gui_shell_src/display.c @@ -42,6 +42,9 @@ void Display_Init(int Cols, int Lines, int ExtraScrollbackLines) gasDisplayLines = calloc( sizeof(char*), (Lines + ExtraScrollbackLines) ); gaiDisplayLineSizes = calloc( sizeof(int), (Lines + ExtraScrollbackLines) ); gabDisplayLinesDirty = calloc( sizeof(char), (Lines + ExtraScrollbackLines) ); + + AxWin3_RichText_SetLineCount(gMainWindow, Lines+ExtraScrollbackLines); + AxWin3_RichText_SetCursorType(gMainWindow, 1); // TODO: enum } void Display_int_PushString(int Length, const char *Text) @@ -59,6 +62,7 @@ void Display_int_PushString(int Length, const char *Text) memcpy(gasDisplayLines[giCurrentLine]+giCurrentLinePos, Text, Length); gabDisplayLinesDirty[giCurrentLine] = 1; gasDisplayLines[giCurrentLine][giCurrentLinePos+Length] = 0; + giCurrentLinePos += Length; } @@ -75,14 +79,15 @@ void Display_AddText(int Length, const char *UTF8Text) { uint32_t cp; bytes += ReadUTF8(UTF8Text+bytes, &cp); - if( Unicode_IsPrinting(cp) ) + if( Unicode_IsPrinting(cp) ) { space --; + giCurrentCol ++; + } } Display_int_PushString(bytes, UTF8Text); UTF8Text += bytes; - _SysDebug("Length(%i) -= bytes(%i)", Length, bytes); Length -= bytes; if( Length != 0 ) { @@ -96,7 +101,7 @@ void Display_AddText(int Length, const char *UTF8Text) void Display_Newline(int bCarriageReturn) { - Display_Flush(); +// Display_Flush(); // Going down! giCurrentLine ++; @@ -142,7 +147,23 @@ void Display_SetCursor(int Row, int Col) void Display_MoveCursor(int RelRow, int RelCol) { - UNIMPLIMENTED(); + if( RelRow < 0 ) + { + for( ; RelRow < 0; RelRow ++ ) + { + uint32_t cp; + int delta = ReadUTF8Rev(gasDisplayLines[giCurrentLine], giCurrentLinePos, &cp); + if( !Unicode_IsPrinting(cp) ) + RelRow --; + else + giCurrentCol --; + giCurrentLinePos -= delta; + } + } + else + { + UNIMPLIMENTED(); + } } void Display_ClearLine(int Dir) // 0: All, 1: Forward, -1: Reverse @@ -192,12 +213,16 @@ void Display_ClearLines(int Dir) // 0: All, 1: Forward, -1: Reverse void Display_SetForeground(uint32_t RGB) { - UNIMPLIMENTED(); + char buf[7+1]; + sprintf(buf, "\1%06x", RGB&0xFFFFFF); + Display_int_PushString(7, buf); } void Display_SetBackground(uint32_t RGB) { - UNIMPLIMENTED(); + char buf[7+1]; + sprintf(buf, "\2%06x", RGB&0xFFFFFF); + Display_int_PushString(7, buf); } void Display_Flush(void) @@ -212,9 +237,7 @@ void Display_Flush(void) AxWin3_RichText_SendLine(gMainWindow, giFirstLine + i, gasDisplayLines[line] ); gabDisplayLinesDirty[line] = 0; } - - // force redraw? - AxWin3_FocusWindow(gMainWindow); + AxWin3_RichText_SetCursorPos(gMainWindow, giCurrentLine, giCurrentCol); } void Display_ShowAltBuffer(int AltBufEnabled)