menuinvertmode for Qt
Catch up with tty, curses, and X11. Items flagged as skip-invert will not be toggled On by select-all. If menuinvertmode is 2, they also won't be toggled Off by unselect-all.
This commit is contained in:
+15
-6
@@ -763,8 +763,11 @@ void NetHackQtMenuWindow::All()
|
|||||||
if (counting)
|
if (counting)
|
||||||
ClearCount(); // discard any pending count
|
ClearCount(); // discard any pending count
|
||||||
for (int row = 0; row < itemcount; ++row) {
|
for (int row = 0; row < itemcount; ++row) {
|
||||||
itemlist[row].selected = itemlist[row].preselected = false;
|
itemlist[row].preselected = false; // stale for all rows
|
||||||
if (!itemlist[row].Selectable())
|
// skip if not selectable or already selected or fails invert_test()
|
||||||
|
if (!itemlist[row].Selectable()
|
||||||
|
|| itemlist[row].selected
|
||||||
|
|| !menuitem_invert_test(1, itemlist[row].itemflags, FALSE))
|
||||||
continue;
|
continue;
|
||||||
itemlist[row].selected = true;
|
itemlist[row].selected = true;
|
||||||
|
|
||||||
@@ -792,9 +795,13 @@ void NetHackQtMenuWindow::ChooseNone()
|
|||||||
if (counting)
|
if (counting)
|
||||||
ClearCount(); // discard any pending count
|
ClearCount(); // discard any pending count
|
||||||
for (int row = 0; row < itemcount; ++row) {
|
for (int row = 0; row < itemcount; ++row) {
|
||||||
itemlist[row].selected = itemlist[row].preselected = false;
|
itemlist[row].preselected = false; // stale for all rows
|
||||||
if (!itemlist[row].Selectable())
|
// skip if not selectable or already unselected or fails invert_test()
|
||||||
|
if (!itemlist[row].Selectable()
|
||||||
|
|| !itemlist[row].selected
|
||||||
|
|| !menuitem_invert_test(2, itemlist[row].itemflags, TRUE))
|
||||||
continue;
|
continue;
|
||||||
|
itemlist[row].selected = false;
|
||||||
|
|
||||||
QTableWidgetItem *count = table->item(row, 0);
|
QTableWidgetItem *count = table->item(row, 0);
|
||||||
if (count != NULL) {
|
if (count != NULL) {
|
||||||
@@ -820,8 +827,10 @@ void NetHackQtMenuWindow::Invert()
|
|||||||
if (counting)
|
if (counting)
|
||||||
ClearCount(); // discard any pending count
|
ClearCount(); // discard any pending count
|
||||||
for (int row = 0; row < itemcount; ++row) {
|
for (int row = 0; row < itemcount; ++row) {
|
||||||
if (!menuitem_invert_test(0, itemlist[row].itemflags,
|
itemlist[row].preselected = false; // stale for all rows
|
||||||
itemlist[row].preselected))
|
if (!itemlist[row].Selectable()
|
||||||
|
|| !menuitem_invert_test(0, itemlist[row].itemflags,
|
||||||
|
itemlist[row].selected))
|
||||||
continue;
|
continue;
|
||||||
ToggleSelect(row, false);
|
ToggleSelect(row, false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user