summaryrefslogtreecommitdiff
path: root/core/apps/embeddedkonsole/TEScreen.cpp
Unidiff
Diffstat (limited to 'core/apps/embeddedkonsole/TEScreen.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEScreen.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/core/apps/embeddedkonsole/TEScreen.cpp b/core/apps/embeddedkonsole/TEScreen.cpp
index 1db34d2..30ff49d 100644
--- a/core/apps/embeddedkonsole/TEScreen.cpp
+++ b/core/apps/embeddedkonsole/TEScreen.cpp
@@ -66,15 +66,15 @@
66*/ 66*/
67 67
68TEScreen::TEScreen(int lines, int columns) 68TEScreen::TEScreen(int _lines, int _columns) :
69 lines(_lines),
70 columns(_columns),
71 tabstops(0),
72 histCursor(0),
73 horzCursor(0)
69{ 74{
70 this->lines = lines;
71 this->columns = columns;
72// odebug << "Columns " << columns << "" << oendl; 75// odebug << "Columns " << columns << "" << oendl;
73 76
74 image = (ca*) malloc(lines*columns*sizeof(ca)); 77 image = new ca[lines*columns];
75 tabstops = NULL; initTabStops(); 78 initTabStops();
76
77 histCursor = 0;
78 horzCursor = 0;
79 79
80 clearSelection(); 80 clearSelection();
@@ -87,6 +87,6 @@ TEScreen::TEScreen(int lines, int columns)
87TEScreen::~TEScreen() 87TEScreen::~TEScreen()
88{ 88{
89 free(image); 89 delete [] image;
90 if (tabstops) free(tabstops); 90 delete [] tabstops;
91} 91}
92 92
@@ -397,5 +397,5 @@ void TEScreen::resizeImage(int new_lines, int new_columns)
397 397
398 // make new image 398 // make new image
399 ca* newimg = (ca*)malloc( new_lines * new_columns * sizeof( ca)); 399 ca* newimg = new ca[new_lines * new_columns];
400 400
401 clearSelection(); 401 clearSelection();
@@ -419,5 +419,5 @@ void TEScreen::resizeImage(int new_lines, int new_columns)
419 newimg[y*new_columns+x].r = image[loc(x,y)].r; 419 newimg[y*new_columns+x].r = image[loc(x,y)].r;
420 } 420 }
421 free(image); 421 delete [] image;
422 image = newimg; 422 image = newimg;
423 lines = new_lines; 423 lines = new_lines;
@@ -508,5 +508,5 @@ ca* TEScreen::getCookedImage()
508{ 508{
509 int x,y; 509 int x,y;
510 ca* merged = (ca*)malloc(lines*columns*sizeof(ca)); 510 ca* merged = new ca[lines*columns];
511 ca dft(' ',DEFAULT_FORE_COLOR,DEFAULT_BACK_COLOR,DEFAULT_RENDITION); 511 ca dft(' ',DEFAULT_FORE_COLOR,DEFAULT_BACK_COLOR,DEFAULT_RENDITION);
512 512
@@ -624,6 +624,8 @@ void TEScreen::changeTabStop(bool set)
624void TEScreen::initTabStops() 624void TEScreen::initTabStops()
625{ 625{
626 if (tabstops) free(tabstops); 626 if (tabstops)
627 tabstops = (bool*)malloc(columns*sizeof(bool)); 627 delete [] tabstops;
628
629 tabstops = new bool[columns];
628 // Arrg! The 1st tabstop has to be one longer than the other. 630 // Arrg! The 1st tabstop has to be one longer than the other.
629 // i.e. the kids start counting from 0 instead of 1. 631 // i.e. the kids start counting from 0 instead of 1.