selecting improved
This commit is contained in:
parent
9c2ac5c846
commit
6cdcb3bbfe
@ -446,7 +446,20 @@ public class FilePanelTab extends JPanel {
|
|||||||
}
|
}
|
||||||
// Toggle marked state if CTRL is pressed
|
// Toggle marked state if CTRL is pressed
|
||||||
if (e.isControlDown() && !item.getName().equals("..")) {
|
if (e.isControlDown() && !item.getName().equals("..")) {
|
||||||
|
int oldRow = fileTable.getSelectedRow();
|
||||||
|
int oldIndex = (oldRow >= 0) ? (briefCurrentColumn * tableModel.briefRowsPerColumn + oldRow) : -1;
|
||||||
|
|
||||||
|
if (oldIndex != -1 && oldIndex != index) {
|
||||||
|
// Clicked on a different item than the currently selected one: mark both
|
||||||
|
FileItem oldItem = tableModel.items.get(oldIndex);
|
||||||
|
if (oldItem != null && !oldItem.getName().equals("..")) {
|
||||||
|
oldItem.setMarked(true);
|
||||||
|
}
|
||||||
|
item.setMarked(true);
|
||||||
|
} else {
|
||||||
|
// Clicked on the same item or no previous selection: toggle
|
||||||
item.setMarked(!item.isMarked());
|
item.setMarked(!item.isMarked());
|
||||||
|
}
|
||||||
updateStatus();
|
updateStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,7 +494,18 @@ public class FilePanelTab extends JPanel {
|
|||||||
unselectAll();
|
unselectAll();
|
||||||
}
|
}
|
||||||
if (e.isControlDown() && !item.getName().equals("..")) {
|
if (e.isControlDown() && !item.getName().equals("..")) {
|
||||||
|
int oldRow = fileTable.getSelectedRow();
|
||||||
|
if (oldRow >= 0 && oldRow != row) {
|
||||||
|
// Clicked on a different item than the currently selected one: mark both
|
||||||
|
FileItem oldItem = tableModel.getItem(oldRow);
|
||||||
|
if (oldItem != null && !oldItem.getName().equals("..")) {
|
||||||
|
oldItem.setMarked(true);
|
||||||
|
}
|
||||||
|
item.setMarked(true);
|
||||||
|
} else {
|
||||||
|
// Clicked on the same item or no previous selection: toggle
|
||||||
item.setMarked(!item.isMarked());
|
item.setMarked(!item.isMarked());
|
||||||
|
}
|
||||||
updateStatus();
|
updateStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user