-rw-r--r-- | noncore/apps/opie-console/TEWidget.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/noncore/apps/opie-console/TEWidget.cpp b/noncore/apps/opie-console/TEWidget.cpp index 1c83710..3d010cb 100644 --- a/noncore/apps/opie-console/TEWidget.cpp +++ b/noncore/apps/opie-console/TEWidget.cpp | |||
@@ -1149,57 +1149,50 @@ void TEWidget::clearImage() | |||
1149 | void TEWidget::calcGeometry() | 1149 | void TEWidget::calcGeometry() |
1150 | { | 1150 | { |
1151 | //FIXME: set rimX == rimY == 0 when running in full screen mode. | 1151 | //FIXME: set rimX == rimY == 0 when running in full screen mode. |
1152 | 1152 | ||
1153 | int showhscrollbar = 1; | 1153 | int showhscrollbar = 1; |
1154 | int hwidth = 0; | 1154 | int hwidth = 0; |
1155 | int dcolumns; | ||
1155 | 1156 | ||
1156 | if(vcolumns == 0) showhscrollbar = 0; | 1157 | if(vcolumns == 0) showhscrollbar = 0; |
1157 | if(showhscrollbar == 1) hwidth = QApplication::style().scrollBarExtent().width(); | 1158 | if(showhscrollbar == 1) hwidth = QApplication::style().scrollBarExtent().width(); |
1158 | 1159 | ||
1159 | scrollbar->resize(QApplication::style().scrollBarExtent().width(), | 1160 | scrollbar->resize(QApplication::style().scrollBarExtent().width(), |
1160 | contentsRect().height() - hwidth); | 1161 | contentsRect().height() - hwidth); |
1161 | 1162 | ||
1162 | if(!showhscrollbar) cornerButton()->move(0, 0); | 1163 | if(!showhscrollbar) cornerButton()->move(0, 0); |
1163 | else cornerButton()->move(contentsRect().width() - hwidth, contentsRect().height() - hwidth); | 1164 | else cornerButton()->move(contentsRect().width() - hwidth, contentsRect().height() - hwidth); |
1164 | 1165 | ||
1165 | 1166 | ||
1166 | if(showhscrollbar == 1) | ||
1167 | { | ||
1168 | hscrollbar->resize(contentsRect().width() - hwidth, hwidth); | ||
1169 | hscrollbar->setRange(0, 40); | ||
1170 | |||
1171 | QPoint p = contentsRect().bottomLeft(); | ||
1172 | hscrollbar->move(QPoint(p.x(), p.y() - hwidth)); | ||
1173 | hscrollbar->show(); | ||
1174 | } | ||
1175 | else hscrollbar->hide(); | ||
1176 | |||
1177 | switch(scrollLoc) | 1167 | switch(scrollLoc) |
1178 | { | 1168 | { |
1179 | case SCRNONE : | 1169 | case SCRNONE : |
1180 | columns = ( contentsRect().width() - 2 * rimX ) / font_w; | 1170 | columns = ( contentsRect().width() - 2 * rimX ) / font_w; |
1171 | dcolumns = columns; | ||
1181 | if(vcolumns) columns = vcolumns; | 1172 | if(vcolumns) columns = vcolumns; |
1182 | blX = (contentsRect().width() - (columns*font_w) ) / 2; | 1173 | blX = (contentsRect().width() - (columns*font_w) ) / 2; |
1183 | if(showhscrollbar) | 1174 | if(showhscrollbar) |
1184 | blX = -hposition * font_w; | 1175 | blX = -hposition * font_w; |
1185 | brX = blX; | 1176 | brX = blX; |
1186 | scrollbar->hide(); | 1177 | scrollbar->hide(); |
1187 | break; | 1178 | break; |
1188 | case SCRLEFT : | 1179 | case SCRLEFT : |
1189 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; | 1180 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; |
1181 | dcolumns = columns; | ||
1190 | if(vcolumns) columns = vcolumns; | 1182 | if(vcolumns) columns = vcolumns; |
1191 | brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; | 1183 | brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; |
1192 | if(showhscrollbar) | 1184 | if(showhscrollbar) |
1193 | brX = -hposition * font_w; | 1185 | brX = -hposition * font_w; |
1194 | blX = brX + scrollbar->width(); | 1186 | blX = brX + scrollbar->width(); |
1195 | scrollbar->move(contentsRect().topLeft()); | 1187 | scrollbar->move(contentsRect().topLeft()); |
1196 | scrollbar->show(); | 1188 | scrollbar->show(); |
1197 | break; | 1189 | break; |
1198 | case SCRRIGHT: | 1190 | case SCRRIGHT: |
1199 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; | 1191 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; |
1192 | dcolumns = columns; | ||
1200 | if(vcolumns) columns = vcolumns; | 1193 | if(vcolumns) columns = vcolumns; |
1201 | blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; | 1194 | blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; |
1202 | if(showhscrollbar) | 1195 | if(showhscrollbar) |
1203 | blX = -hposition * font_w; | 1196 | blX = -hposition * font_w; |
1204 | brX = blX; | 1197 | brX = blX; |
1205 | scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0)); | 1198 | scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0)); |
@@ -1209,12 +1202,23 @@ void TEWidget::calcGeometry() | |||
1209 | //FIXME: support 'rounding' styles | 1202 | //FIXME: support 'rounding' styles |
1210 | lines = ( contentsRect().height() - 2 * rimY ) / font_h; | 1203 | lines = ( contentsRect().height() - 2 * rimY ) / font_h; |
1211 | bY = (contentsRect().height() - (lines *font_h)) / 2; | 1204 | bY = (contentsRect().height() - (lines *font_h)) / 2; |
1212 | 1205 | ||
1213 | if(showhscrollbar == 1) | 1206 | if(showhscrollbar == 1) |
1214 | { | 1207 | { |
1208 | hscrollbar->resize(contentsRect().width() - hwidth, hwidth); | ||
1209 | hscrollbar->setRange(0, vcolumns - dcolumns); | ||
1210 | |||
1211 | QPoint p = contentsRect().bottomLeft(); | ||
1212 | hscrollbar->move(QPoint(p.x(), p.y() - hwidth)); | ||
1213 | hscrollbar->show(); | ||
1214 | } | ||
1215 | else hscrollbar->hide(); | ||
1216 | |||
1217 | if(showhscrollbar == 1) | ||
1218 | { | ||
1215 | lines = lines - (hwidth / font_h) - 1; | 1219 | lines = lines - (hwidth / font_h) - 1; |
1216 | if(lines < 1) lines = 1; | 1220 | if(lines < 1) lines = 1; |
1217 | } | 1221 | } |
1218 | } | 1222 | } |
1219 | 1223 | ||
1220 | void TEWidget::makeImage() | 1224 | void TEWidget::makeImage() |