summaryrefslogtreecommitdiff
authorjosef <josef>2002-10-26 14:23:48 (UTC)
committer josef <josef>2002-10-26 14:23:48 (UTC)
commit2bd985c4f5a5c27260e6057a1ca8a2e0e586acbb (patch) (unidiff)
treef31bed6961ee2cea8b0412adc80fc5c60cadaefb
parent2de7003cd700685e0c3696d51656f54d54c81f43 (diff)
downloadopie-2bd985c4f5a5c27260e6057a1ca8a2e0e586acbb.zip
opie-2bd985c4f5a5c27260e6057a1ca8a2e0e586acbb.tar.gz
opie-2bd985c4f5a5c27260e6057a1ca8a2e0e586acbb.tar.bz2
- reduce number of lines correctly (fixes problems with small fonts)
- when using fullscreen, move corner widget into lower right corner :)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/TEWidget.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/TEWidget.cpp b/noncore/apps/opie-console/TEWidget.cpp
index 2db214c..d1ff85e 100644
--- a/noncore/apps/opie-console/TEWidget.cpp
+++ b/noncore/apps/opie-console/TEWidget.cpp
@@ -1137,48 +1137,52 @@ void TEWidget::clearImage()
1137 for (int x = 0; x < columns; x++) 1137 for (int x = 0; x < columns; x++)
1138 { 1138 {
1139 image[loc(x,y)].c = 0xff; //' '; 1139 image[loc(x,y)].c = 0xff; //' ';
1140 image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR; 1140 image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR;
1141 image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR; 1141 image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR;
1142 image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION; 1142 image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION;
1143 } 1143 }
1144} 1144}
1145 1145
1146// Create Image /////////////////////////////////////////////////////// 1146// Create Image ///////////////////////////////////////////////////////
1147 1147
1148void TEWidget::calcGeometry() 1148void TEWidget::calcGeometry()
1149{ 1149{
1150 //FIXME: set rimX == rimY == 0 when running in full screen mode. 1150 //FIXME: set rimX == rimY == 0 when running in full screen mode.
1151 1151
1152 int showhscrollbar = 1; 1152 int showhscrollbar = 1;
1153 int hwidth = 0; 1153 int hwidth = 0;
1154 1154
1155 if(vcolumns == 0) showhscrollbar = 0; 1155 if(vcolumns == 0) showhscrollbar = 0;
1156 if(showhscrollbar == 1) hwidth = QApplication::style().scrollBarExtent().width(); 1156 if(showhscrollbar == 1) hwidth = QApplication::style().scrollBarExtent().width();
1157 1157
1158 scrollbar->resize(QApplication::style().scrollBarExtent().width(), 1158 scrollbar->resize(QApplication::style().scrollBarExtent().width(),
1159 contentsRect().height() - hwidth); 1159 contentsRect().height() - hwidth);
1160 1160
1161 if(!showhscrollbar) cornerButton()->move(0, 0);
1162 else cornerButton()->move(contentsRect().width() - hwidth, contentsRect().height() - hwidth);
1163
1164
1161 if(showhscrollbar == 1) 1165 if(showhscrollbar == 1)
1162 { 1166 {
1163 hscrollbar->resize(contentsRect().width() - hwidth, hwidth); 1167 hscrollbar->resize(contentsRect().width() - hwidth, hwidth);
1164 hscrollbar->setRange(0, 40); 1168 hscrollbar->setRange(0, 40);
1165 1169
1166 QPoint p = contentsRect().bottomLeft(); 1170 QPoint p = contentsRect().bottomLeft();
1167 hscrollbar->move(QPoint(p.x(), p.y() - hwidth)); 1171 hscrollbar->move(QPoint(p.x(), p.y() - hwidth));
1168 hscrollbar->show(); 1172 hscrollbar->show();
1169 } 1173 }
1170 else hscrollbar->hide(); 1174 else hscrollbar->hide();
1171 1175
1172 switch(scrollLoc) 1176 switch(scrollLoc)
1173 { 1177 {
1174 case SCRNONE : 1178 case SCRNONE :
1175 columns = ( contentsRect().width() - 2 * rimX ) / font_w; 1179 columns = ( contentsRect().width() - 2 * rimX ) / font_w;
1176 if(vcolumns) columns = vcolumns; 1180 if(vcolumns) columns = vcolumns;
1177 blX = (contentsRect().width() - (columns*font_w) ) / 2; 1181 blX = (contentsRect().width() - (columns*font_w) ) / 2;
1178 if(showhscrollbar) 1182 if(showhscrollbar)
1179 blX = -hposition * font_w; 1183 blX = -hposition * font_w;
1180 brX = blX; 1184 brX = blX;
1181 scrollbar->hide(); 1185 scrollbar->hide();
1182 break; 1186 break;
1183 case SCRLEFT : 1187 case SCRLEFT :
1184 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; 1188 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w;
@@ -1186,50 +1190,50 @@ void TEWidget::calcGeometry()
1186 brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; 1190 brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2;
1187 if(showhscrollbar) 1191 if(showhscrollbar)
1188 brX = -hposition * font_w; 1192 brX = -hposition * font_w;
1189 blX = brX + scrollbar->width(); 1193 blX = brX + scrollbar->width();
1190 scrollbar->move(contentsRect().topLeft()); 1194 scrollbar->move(contentsRect().topLeft());
1191 scrollbar->show(); 1195 scrollbar->show();
1192 break; 1196 break;
1193 case SCRRIGHT: 1197 case SCRRIGHT:
1194 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; 1198 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w;
1195 if(vcolumns) columns = vcolumns; 1199 if(vcolumns) columns = vcolumns;
1196 blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; 1200 blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2;
1197 if(showhscrollbar) 1201 if(showhscrollbar)
1198 blX = -hposition * font_w; 1202 blX = -hposition * font_w;
1199 brX = blX; 1203 brX = blX;
1200 scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0)); 1204 scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0));
1201 scrollbar->show(); 1205 scrollbar->show();
1202 break; 1206 break;
1203 } 1207 }
1204 //FIXME: support 'rounding' styles 1208 //FIXME: support 'rounding' styles
1205 lines = ( contentsRect().height() - 2 * rimY ) / font_h; 1209 lines = ( contentsRect().height() - 2 * rimY ) / font_h;
1206 bY = (contentsRect().height() - (lines *font_h)) / 2; 1210 bY = (contentsRect().height() - (lines *font_h)) / 2;
1207 1211
1208 if(showhscrollbar == 1) 1212 if(showhscrollbar == 1)
1209 { 1213 {
1210 //bY = bY - 10; 1214 lines = lines - (hwidth / font_h) - 1;
1211 lines = lines - 1; 1215 if(lines < 1) lines = 1;
1212 } 1216 }
1213} 1217}
1214 1218
1215void TEWidget::makeImage() 1219void TEWidget::makeImage()
1216//FIXME: rename 'calcGeometry? 1220//FIXME: rename 'calcGeometry?
1217{ 1221{
1218 calcGeometry(); 1222 calcGeometry();
1219 image = (ca*) malloc(lines*columns*sizeof(ca)); 1223 image = (ca*) malloc(lines*columns*sizeof(ca));
1220 clearImage(); 1224 clearImage();
1221} 1225}
1222 1226
1223// calculate the needed size 1227// calculate the needed size
1224QSize TEWidget::calcSize(int cols, int lins) const 1228QSize TEWidget::calcSize(int cols, int lins) const
1225{ 1229{
1226 int frw = width() - contentsRect().width(); 1230 int frw = width() - contentsRect().width();
1227 int frh = height() - contentsRect().height(); 1231 int frh = height() - contentsRect().height();
1228 int scw = (scrollLoc==SCRNONE?0:scrollbar->width()); 1232 int scw = (scrollLoc==SCRNONE?0:scrollbar->width());
1229 return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh ); 1233 return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh );
1230} 1234}
1231 1235
1232QSize TEWidget::sizeHint() const 1236QSize TEWidget::sizeHint() const
1233{ 1237{
1234 return size(); 1238 return size();
1235} 1239}