author | llornkcor <llornkcor> | 2002-11-08 13:40:06 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-08 13:40:06 (UTC) |
commit | 2aa75fdaeb219fffef86af1a2ca0aac0ac6731ce (patch) (unidiff) | |
tree | 568d62e648000ac4d8f0c909a0157af03de04298 | |
parent | ada5be67fec81ed8845a6f358bbf7e3b181d417e (diff) | |
download | opie-2aa75fdaeb219fffef86af1a2ca0aac0ac6731ce.zip opie-2aa75fdaeb219fffef86af1a2ca0aac0ac6731ce.tar.gz opie-2aa75fdaeb219fffef86af1a2ca0aac0ac6731ce.tar.bz2 |
change horz scroll position for when using left scroll
-rw-r--r-- | core/apps/embeddedkonsole/TEWidget.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp index c220e11..23720cd 100644 --- a/core/apps/embeddedkonsole/TEWidget.cpp +++ b/core/apps/embeddedkonsole/TEWidget.cpp | |||
@@ -1108,193 +1108,197 @@ void TEWidget::Bell() | |||
1108 | { | 1108 | { |
1109 | //#ifdef QT_QWS_SHARP | 1109 | //#ifdef QT_QWS_SHARP |
1110 | //# ifndef QT_NO_COP | 1110 | //# ifndef QT_NO_COP |
1111 | if(useBeep) | 1111 | if(useBeep) |
1112 | QCopEnvelope( "QPE/TaskBar", "soundAlarm()" ); | 1112 | QCopEnvelope( "QPE/TaskBar", "soundAlarm()" ); |
1113 | 1113 | ||
1114 | //# endif | 1114 | //# endif |
1115 | //#else | 1115 | //#else |
1116 | //# ifndef QT_NO_SOUND | 1116 | //# ifndef QT_NO_SOUND |
1117 | // QSound::play(Resource::findSound("alarm")); | 1117 | // QSound::play(Resource::findSound("alarm")); |
1118 | //# endif | 1118 | //# endif |
1119 | //#endif | 1119 | //#endif |
1120 | 1120 | ||
1121 | // QApplication::beep(); | 1121 | // QApplication::beep(); |
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | /* ------------------------------------------------------------------------- */ | 1124 | /* ------------------------------------------------------------------------- */ |
1125 | /* */ | 1125 | /* */ |
1126 | /* Auxiluary */ | 1126 | /* Auxiluary */ |
1127 | /* */ | 1127 | /* */ |
1128 | /* ------------------------------------------------------------------------- */ | 1128 | /* ------------------------------------------------------------------------- */ |
1129 | 1129 | ||
1130 | void TEWidget::clearImage() | 1130 | void TEWidget::clearImage() |
1131 | // initialize the image | 1131 | // initialize the image |
1132 | // for internal use only | 1132 | // for internal use only |
1133 | { | 1133 | { |
1134 | for (int y = 0; y < lines; y++) | 1134 | for (int y = 0; y < lines; y++) |
1135 | for (int x = 0; x < columns; x++) | 1135 | for (int x = 0; x < columns; x++) |
1136 | { | 1136 | { |
1137 | image[loc(x,y)].c = 0xff; //' '; | 1137 | image[loc(x,y)].c = 0xff; //' '; |
1138 | image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR; | 1138 | image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR; |
1139 | image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR; | 1139 | image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR; |
1140 | image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION; | 1140 | image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION; |
1141 | } | 1141 | } |
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | // Create Image /////////////////////////////////////////////////////// | 1144 | // Create Image /////////////////////////////////////////////////////// |
1145 | 1145 | ||
1146 | void TEWidget::calcGeometry() | 1146 | void TEWidget::calcGeometry() |
1147 | { | 1147 | { |
1148 | int showhscrollbar = 1; | 1148 | int showhscrollbar = 1; |
1149 | int hwidth = 0; | 1149 | int hwidth = 0; |
1150 | int dcolumns; | 1150 | int dcolumns; |
1151 | Config cfg("Konsole"); | 1151 | Config cfg("Konsole"); |
1152 | cfg.setGroup("ScrollBar"); | 1152 | cfg.setGroup("ScrollBar"); |
1153 | useHorzScroll=cfg.readBoolEntry("HorzScroll",0); | 1153 | useHorzScroll=cfg.readBoolEntry("HorzScroll",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 | switch(scrollLoc) { | 1161 | switch(scrollLoc) { |
1162 | case SCRNONE : | 1162 | case SCRNONE : |
1163 | columns = ( contentsRect().width() - 2 * rimX ) / font_w; | 1163 | columns = ( contentsRect().width() - 2 * rimX ) / font_w; |
1164 | dcolumns = columns; | 1164 | dcolumns = columns; |
1165 | if(vcolumns) columns = vcolumns; | 1165 | if(vcolumns) columns = vcolumns; |
1166 | blX = (contentsRect().width() - (columns*font_w) ) / 2; | 1166 | blX = (contentsRect().width() - (columns*font_w) ) / 2; |
1167 | if(showhscrollbar) | 1167 | if(showhscrollbar) |
1168 | blX = -hposition * font_w; | 1168 | blX = -hposition * font_w; |
1169 | brX = blX; | 1169 | brX = blX; |
1170 | scrollbar->hide(); | 1170 | scrollbar->hide(); |
1171 | break; | 1171 | break; |
1172 | case SCRLEFT : | 1172 | case SCRLEFT : |
1173 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; | 1173 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; |
1174 | dcolumns = columns; | 1174 | dcolumns = columns; |
1175 | if(vcolumns) columns = vcolumns; | 1175 | if(vcolumns) columns = vcolumns; |
1176 | brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; | 1176 | brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; |
1177 | if(showhscrollbar) | 1177 | if(showhscrollbar) |
1178 | brX = -hposition * font_w; | 1178 | brX = -hposition * font_w; |
1179 | blX = brX + scrollbar->width(); | 1179 | blX = brX + scrollbar->width(); |
1180 | scrollbar->move(contentsRect().topLeft()); | 1180 | scrollbar->move(contentsRect().topLeft()); |
1181 | scrollbar->show(); | 1181 | scrollbar->show(); |
1182 | break; | 1182 | break; |
1183 | case SCRRIGHT: | 1183 | case SCRRIGHT: |
1184 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; | 1184 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; |
1185 | dcolumns = columns; | 1185 | dcolumns = columns; |
1186 | if(vcolumns) columns = vcolumns; | 1186 | if(vcolumns) columns = vcolumns; |
1187 | blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; | 1187 | blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; |
1188 | if(showhscrollbar) | 1188 | if(showhscrollbar) |
1189 | blX = -hposition * font_w; | 1189 | blX = -hposition * font_w; |
1190 | brX = blX; | 1190 | brX = blX; |
1191 | scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0)); | 1191 | scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0)); |
1192 | scrollbar->show(); | 1192 | scrollbar->show(); |
1193 | break; | 1193 | break; |
1194 | } | 1194 | } |
1195 | //FIXME: support 'rounding' styles | 1195 | //FIXME: support 'rounding' styles |
1196 | lines = ( contentsRect().height() - 2 * rimY ) / font_h; | 1196 | lines = ( contentsRect().height() - 2 * rimY ) / font_h; |
1197 | bY = (contentsRect().height() - (lines *font_h)) / 2; | 1197 | bY = (contentsRect().height() - (lines *font_h)) / 2; |
1198 | 1198 | ||
1199 | if(showhscrollbar == 1) { | 1199 | if(showhscrollbar == 1) { |
1200 | hScrollbar->resize(contentsRect().width() - hwidth, hwidth); | 1200 | hScrollbar->resize(contentsRect().width() - hwidth, hwidth); |
1201 | hScrollbar->setRange(0, vcolumns - dcolumns); | 1201 | hScrollbar->setRange(0, vcolumns - dcolumns); |
1202 | 1202 | ||
1203 | QPoint p = contentsRect().bottomLeft(); | 1203 | QPoint p = contentsRect().bottomLeft(); |
1204 | hScrollbar->move(QPoint(p.x(), p.y() - hwidth)); | 1204 | if(scrollLoc == SCRLEFT) |
1205 | hScrollbar->move(QPoint(p.x()+hwidth, p.y() - hwidth)); | ||
1206 | else | ||
1207 | hScrollbar->move(QPoint(p.x(), p.y() - hwidth)); | ||
1208 | |||
1205 | hScrollbar->show(); | 1209 | hScrollbar->show(); |
1206 | } | 1210 | } |
1207 | else hScrollbar->hide(); | 1211 | else hScrollbar->hide(); |
1208 | 1212 | ||
1209 | if(showhscrollbar == 1) { | 1213 | if(showhscrollbar == 1) { |
1210 | lines = lines - (hwidth / font_h) - 1; | 1214 | lines = lines - (hwidth / font_h) - 1; |
1211 | if(lines < 1) lines = 1; | 1215 | if(lines < 1) lines = 1; |
1212 | } | 1216 | } |
1213 | //FIXME: support 'rounding' styles | 1217 | //FIXME: support 'rounding' styles |
1214 | } | 1218 | } |
1215 | 1219 | ||
1216 | void TEWidget::makeImage() | 1220 | void TEWidget::makeImage() |
1217 | //FIXME: rename 'calcGeometry? | 1221 | //FIXME: rename 'calcGeometry? |
1218 | { | 1222 | { |
1219 | calcGeometry(); | 1223 | calcGeometry(); |
1220 | image = (ca*) malloc(lines*columns*sizeof(ca)); | 1224 | image = (ca*) malloc(lines*columns*sizeof(ca)); |
1221 | clearImage(); | 1225 | clearImage(); |
1222 | } | 1226 | } |
1223 | 1227 | ||
1224 | // calculate the needed size | 1228 | // calculate the needed size |
1225 | QSize TEWidget::calcSize(int cols, int lins) const | 1229 | QSize TEWidget::calcSize(int cols, int lins) const |
1226 | { | 1230 | { |
1227 | int frw = width() - contentsRect().width(); | 1231 | int frw = width() - contentsRect().width(); |
1228 | int frh = height() - contentsRect().height(); | 1232 | int frh = height() - contentsRect().height(); |
1229 | int scw = (scrollLoc==SCRNONE?0:scrollbar->width()); | 1233 | int scw = (scrollLoc==SCRNONE?0:scrollbar->width()); |
1230 | return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh ); | 1234 | return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh ); |
1231 | } | 1235 | } |
1232 | 1236 | ||
1233 | QSize TEWidget::sizeHint() const | 1237 | QSize TEWidget::sizeHint() const |
1234 | { | 1238 | { |
1235 | return size(); | 1239 | return size(); |
1236 | } | 1240 | } |
1237 | 1241 | ||
1238 | void TEWidget::styleChange(QStyle &) | 1242 | void TEWidget::styleChange(QStyle &) |
1239 | { | 1243 | { |
1240 | propagateSize(); | 1244 | propagateSize(); |
1241 | } | 1245 | } |
1242 | 1246 | ||
1243 | #ifndef QT_NO_DRAGANDDROP | 1247 | #ifndef QT_NO_DRAGANDDROP |
1244 | 1248 | ||
1245 | /* --------------------------------------------------------------------- */ | 1249 | /* --------------------------------------------------------------------- */ |
1246 | /* */ | 1250 | /* */ |
1247 | /* Drag & Drop */ | 1251 | /* Drag & Drop */ |
1248 | /* */ | 1252 | /* */ |
1249 | /* --------------------------------------------------------------------- */ | 1253 | /* --------------------------------------------------------------------- */ |
1250 | 1254 | ||
1251 | 1255 | ||
1252 | void TEWidget::dragEnterEvent(QDragEnterEvent* e) | 1256 | void TEWidget::dragEnterEvent(QDragEnterEvent* e) |
1253 | { | 1257 | { |
1254 | e->accept(QTextDrag::canDecode(e) || | 1258 | e->accept(QTextDrag::canDecode(e) || |
1255 | QUriDrag::canDecode(e)); | 1259 | QUriDrag::canDecode(e)); |
1256 | } | 1260 | } |
1257 | 1261 | ||
1258 | void TEWidget::dropEvent(QDropEvent* event) | 1262 | void TEWidget::dropEvent(QDropEvent* event) |
1259 | { | 1263 | { |
1260 | // The current behaviour when url(s) are dropped is | 1264 | // The current behaviour when url(s) are dropped is |
1261 | // * if there is only ONE url and if it's a LOCAL one, ask for paste or cd | 1265 | // * if there is only ONE url and if it's a LOCAL one, ask for paste or cd |
1262 | // * in all other cases, just paste | 1266 | // * in all other cases, just paste |
1263 | // (for non-local ones, or for a list of URLs, 'cd' is nonsense) | 1267 | // (for non-local ones, or for a list of URLs, 'cd' is nonsense) |
1264 | QStrList strlist; | 1268 | QStrList strlist; |
1265 | int file_count = 0; | 1269 | int file_count = 0; |
1266 | dropText = ""; | 1270 | dropText = ""; |
1267 | bool bPopup = true; | 1271 | bool bPopup = true; |
1268 | 1272 | ||
1269 | if(QUriDrag::decode(event, strlist)) { | 1273 | if(QUriDrag::decode(event, strlist)) { |
1270 | if (strlist.count()) { | 1274 | if (strlist.count()) { |
1271 | for(const char* p = strlist.first(); p; p = strlist.next()) { | 1275 | for(const char* p = strlist.first(); p; p = strlist.next()) { |
1272 | if(file_count++ > 0) { | 1276 | if(file_count++ > 0) { |
1273 | dropText += " "; | 1277 | dropText += " "; |
1274 | bPopup = false; // more than one file, don't popup | 1278 | bPopup = false; // more than one file, don't popup |
1275 | } | 1279 | } |
1276 | 1280 | ||
1277 | /* | 1281 | /* |
1278 | KURL url(p); | 1282 | KURL url(p); |
1279 | if (url.isLocalFile()) { | 1283 | if (url.isLocalFile()) { |
1280 | dropText += url.path(); // local URL : remove protocol | 1284 | dropText += url.path(); // local URL : remove protocol |
1281 | } | 1285 | } |
1282 | else { | 1286 | else { |
1283 | dropText += url.prettyURL(); | 1287 | dropText += url.prettyURL(); |
1284 | bPopup = false; // a non-local file, don't popup | 1288 | bPopup = false; // a non-local file, don't popup |
1285 | } | 1289 | } |
1286 | */ | 1290 | */ |
1287 | 1291 | ||
1288 | } | 1292 | } |
1289 | 1293 | ||
1290 | if (bPopup) | 1294 | if (bPopup) |
1291 | // m_drop->popup(pos() + event->pos()); | 1295 | // m_drop->popup(pos() + event->pos()); |
1292 | m_drop->popup(mapToGlobal(event->pos())); | 1296 | m_drop->popup(mapToGlobal(event->pos())); |
1293 | else | 1297 | else |
1294 | { | 1298 | { |
1295 | if (currentSession) { | 1299 | if (currentSession) { |
1296 | currentSession->getEmulation()->sendString(dropText.local8Bit()); | 1300 | currentSession->getEmulation()->sendString(dropText.local8Bit()); |
1297 | } | 1301 | } |
1298 | // kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; | 1302 | // kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; |
1299 | } | 1303 | } |
1300 | } | 1304 | } |