]> granicus.if.org Git - nethack/commitdiff
Unhide the "click-to-the-left-to-set-count" feature, since it's a FAQ.
authorwarwick <warwick>
Thu, 22 Aug 2002 05:10:29 +0000 (05:10 +0000)
committerwarwick <warwick>
Thu, 22 Aug 2002 05:10:29 +0000 (05:10 +0000)
win/Qt/qt_win.cpp

index 61dade8b17c4c7e4fe3a799dc07a251ee7b61494..f8fb70842121978dd766db5dd712103508abbf67 100644 (file)
@@ -2734,9 +2734,9 @@ int NetHackQtMenuWindow::cellWidth(int col)
 {
     switch (col) {
      case 0:
-       return 20;
+       return fontMetrics().width("All ");
     break; case 1:
-       return 16;
+       return fontMetrics().width(" m ");
     break; case 2:
        return qt_settings->glyphs().width();
     break; case 3:
@@ -2983,6 +2983,8 @@ void NetHackQtMenuWindow::ToggleSelect(int i)
 {
     if (item[i].Selectable()) {
        item[i].selected = !item[i].selected;
+       if ( !item[i].selected )
+           item[i].count=-1;
        updateCell(i,3);
        if (how==PICK_ONE) {
            dialog->Accept();
@@ -3006,11 +3008,20 @@ void NetHackQtMenuWindow::paintCell(QPainter* painter, int row, int col)
 
     switch (col) {
      case 0:
-       if (i.count>=0) {
-           char text[16];
-           sprintf(text,"%d",i.count);
+       if ( i.ch || i.attr!=ATR_INVERSE ) {
+           QString text;
+           if ( i.selected && i.count == -1 ) {
+               if ( i.str[0]>='0' && i.str[0]<='9' )
+                   text = "All";
+               else
+                   text = "*";
+           } else if ( i.count<0 ) {
+               text = "-";
+           } else {
+               text.sprintf("%d",i.count);
+           }
            painter->drawText(0,0,cellWidth(col),cellHeight(),
-               AlignHCenter|AlignVCenter,text);
+           AlignHCenter|AlignVCenter,text);
        }
     break; case 1:
        if ((signed char)i.ch >= 0) {
@@ -3088,6 +3099,7 @@ void NetHackQtMenuWindow::mousePressEvent(QMouseEvent* event)
            pressed=row;
            was_sel=item[row].selected;
            ToggleSelect(row);
+           updateCell(row,0);
        }
     }
 }