Usermode/Applications - Added -Wall to make config
[tpg/acess2.git] / Usermode / Applications / gui_shell_src / display.c
index 4972ed1..bb07e39 100644 (file)
@@ -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)

UCC git Repository :: git.ucc.asn.au