author | josef <josef> | 2002-10-28 09:47:21 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-28 09:47:21 (UTC) |
commit | 54b9d51694242a1f2e0c1898b05c56114827ca10 (patch) (unidiff) | |
tree | 8352d4a219d2547a87662206e4dccb6f1d36f907 | |
parent | 33834e447ef1313da826c64c6c09953eb3502b69 (diff) | |
download | opie-54b9d51694242a1f2e0c1898b05c56114827ca10.zip opie-54b9d51694242a1f2e0c1898b05c56114827ca10.tar.gz opie-54b9d51694242a1f2e0c1898b05c56114827ca10.tar.bz2 |
- ugh, showstopper:
Display is one character wider than expected.
While changing this, also replace 40 with vcolumns - dcolumns, so 120 chars
etc. could now also be used (once there is a config option for this)
-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 | |||
@@ -1139,92 +1139,96 @@ void TEWidget::clearImage() | |||
1139 | { | 1139 | { |
1140 | image[loc(x,y)].c = 0xff; //' '; | 1140 | image[loc(x,y)].c = 0xff; //' '; |
1141 | image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR; | 1141 | image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR; |
1142 | image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR; | 1142 | image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR; |
1143 | image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION; | 1143 | image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION; |
1144 | } | 1144 | } |
1145 | } | 1145 | } |
1146 | 1146 | ||
1147 | // Create Image /////////////////////////////////////////////////////// | 1147 | // Create Image /////////////////////////////////////////////////////// |
1148 | 1148 | ||
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)); |
1206 | scrollbar->show(); | 1199 | scrollbar->show(); |
1207 | break; | 1200 | break; |
1208 | } | 1201 | } |
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() |
1221 | //FIXME: rename 'calcGeometry? | 1225 | //FIXME: rename 'calcGeometry? |
1222 | { | 1226 | { |
1223 | calcGeometry(); | 1227 | calcGeometry(); |
1224 | image = (ca*) malloc(lines*columns*sizeof(ca)); | 1228 | image = (ca*) malloc(lines*columns*sizeof(ca)); |
1225 | clearImage(); | 1229 | clearImage(); |
1226 | } | 1230 | } |
1227 | 1231 | ||
1228 | // calculate the needed size | 1232 | // calculate the needed size |
1229 | QSize TEWidget::calcSize(int cols, int lins) const | 1233 | QSize TEWidget::calcSize(int cols, int lins) const |
1230 | { | 1234 | { |