ensure run segment rows display top-aligned within the segments list
This commit is contained in:
parent
7870670ce0
commit
d718323976
|
@ -328,14 +328,25 @@ public class History extends JPanel {
|
||||||
segmentRows.clear();
|
segmentRows.clear();
|
||||||
// At most, we need as much segments as the run has or as much as
|
// At most, we need as much segments as the run has or as much as
|
||||||
// is demanded by the user.
|
// is demanded by the user.
|
||||||
int count = Settings.historyRowCount.get();
|
int count = Math.max(Settings.historyRowCount.get(), run.getRowCount());
|
||||||
count = Math.max(count, run.getRowCount());
|
|
||||||
// Create and place the rows.
|
// Create and place the rows.
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
SegmentRow row = new SegmentRow();
|
SegmentRow row = new SegmentRow();
|
||||||
add(row, GBC.grid(0, i).fill(GBC.HORIZONTAL).weight(1.0, 0.0));
|
add(row, GBC.grid(0, i).fill(GBC.HORIZONTAL).anchor(GBC.NORTH).weight(1.0, 0.0));
|
||||||
segmentRows.add(i, row);
|
segmentRows.add(i, row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HACK: if we're to display a set number of rows (even if blank, if the run has less then this number)
|
||||||
|
// we place an additional filler row that has vertical weight which pushes up the actual run rows so
|
||||||
|
// that all the rows appear top-aligned.
|
||||||
|
// jesus christ, why is layouting so shit that this is even required!?
|
||||||
|
if (Settings.historyBlankRows.get()) {
|
||||||
|
if (run.getRowCount() < count) {
|
||||||
|
JPanel filler = new JPanel();
|
||||||
|
filler.setOpaque(false);
|
||||||
|
add(filler, GBC.grid(0, count).fill(GBC.BOTH).anchor(GBC.NORTH).weight(1.0, 1.0));
|
||||||
|
}
|
||||||
|
}
|
||||||
// Fill the rows with the segment data and colorize.
|
// Fill the rows with the segment data and colorize.
|
||||||
updateValues(ALL);
|
updateValues(ALL);
|
||||||
updateColors(ALL);
|
updateColors(ALL);
|
||||||
|
@ -380,9 +391,8 @@ public class History extends JPanel {
|
||||||
}
|
}
|
||||||
// Set the visibility of every segments accordingly.
|
// Set the visibility of every segments accordingly.
|
||||||
for (int i = 0; i < segmentRows.size(); i++) {
|
for (int i = 0; i < segmentRows.size(); i++) {
|
||||||
segmentRows.get(i).setVisible(
|
boolean visible = (i > lastSeg - realCount) && (i <= lastSeg);
|
||||||
(i > lastSeg - realCount) && (i <= lastSeg)
|
segmentRows.get(i).setVisible(visible);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
// Display the last segment if the setting is enabled.
|
// Display the last segment if the setting is enabled.
|
||||||
if (Settings.historyAlwaysShowLast.get() && run.getRowCount() > 0) {
|
if (Settings.historyAlwaysShowLast.get() && run.getRowCount() > 0) {
|
||||||
|
@ -687,19 +697,13 @@ public class History extends JPanel {
|
||||||
private void placeComponents(boolean multiline) {
|
private void placeComponents(boolean multiline) {
|
||||||
if (!multiline) {
|
if (!multiline) {
|
||||||
add(icon , GBC.grid(0, 0).anchor(GBC.CENTER));
|
add(icon , GBC.grid(0, 0).anchor(GBC.CENTER));
|
||||||
add(
|
add(name, GBC.grid(1, 0).insets(0, INSET, 0, 0).anchor(GBC.LINE_START).fill(GBC.HORIZONTAL).weight(1.0, 0.0));
|
||||||
name, GBC.grid(1, 0).insets(0, INSET, 0, 0).anchor(GBC.LINE_START)
|
|
||||||
.fill(GBC.HORIZONTAL).weight(1.0, 0.0)
|
|
||||||
);
|
|
||||||
add(time , GBC.grid(2, 0).insets(0, INSET, 0, 0).anchor(GBC.LINE_END));
|
add(time , GBC.grid(2, 0).insets(0, INSET, 0, 0).anchor(GBC.LINE_END));
|
||||||
add(live , GBC.grid(3, 0).insets(0, INSET, 0, 0).anchor(GBC.LINE_END));
|
add(live , GBC.grid(3, 0).insets(0, INSET, 0, 0).anchor(GBC.LINE_END));
|
||||||
add(delta, GBC.grid(4, 0).insets(0, INSET, 0, 0).anchor(GBC.LINE_END));
|
add(delta, GBC.grid(4, 0).insets(0, INSET, 0, 0).anchor(GBC.LINE_END));
|
||||||
} else {
|
} else {
|
||||||
add(icon, GBC.grid(0, 0, 1, 2).anchor(GBC.CENTER));
|
add(icon, GBC.grid(0, 0, 1, 2).anchor(GBC.CENTER));
|
||||||
add(
|
add(name, GBC.grid(1, 0, 3, 1).anchor(GBC.LINE_START).fill(GBC.HORIZONTAL).weight(1.0, 0.0).insets(0, INSET, 0, 0));
|
||||||
name, GBC.grid(1, 0, 3, 1).anchor(GBC.LINE_START).fill(GBC.HORIZONTAL)
|
|
||||||
.weight(1.0, 0.0).insets(0, INSET, 0, 0)
|
|
||||||
);
|
|
||||||
add(time, GBC.grid(1, 1).anchor(GBC.LINE_END).insets(0, INSET, 0, 0));
|
add(time, GBC.grid(1, 1).anchor(GBC.LINE_END).insets(0, INSET, 0, 0));
|
||||||
add(live, GBC.grid(2, 1).anchor(GBC.LINE_END).insets(0, INSET, 0, 0));
|
add(live, GBC.grid(2, 1).anchor(GBC.LINE_END).insets(0, INSET, 0, 0));
|
||||||
add(delta, GBC.grid(3, 1).anchor(GBC.LINE_END));
|
add(delta, GBC.grid(3, 1).anchor(GBC.LINE_END));
|
||||||
|
|
|
@ -292,7 +292,7 @@ public class RunPane extends JPanel {
|
||||||
add(subTitle, GBC.grid(0, 1).insets(3, 0, 0, 0).fill(GBC.BOTH));
|
add(subTitle, GBC.grid(0, 1).insets(3, 0, 0, 0).fill(GBC.BOTH));
|
||||||
add(attemptCounter, GBC.grid(0, 2).insets(1, 0, 1, 3).anchor(GBC.LINE_END));
|
add(attemptCounter, GBC.grid(0, 2).insets(1, 0, 1, 3).anchor(GBC.LINE_END));
|
||||||
add(createSeparator(), GBC.grid(0, 3).insets(3, 0).fill(GBC.HORIZONTAL));
|
add(createSeparator(), GBC.grid(0, 3).insets(3, 0).fill(GBC.HORIZONTAL));
|
||||||
add(history, GBC.grid(0, 4).fill(GBC.HORIZONTAL).insets(0, 5));
|
add(history, GBC.grid(0, 4).fill(GBC.HORIZONTAL).anchor(GBC.NORTH).insets(0, 5));
|
||||||
add(createSeparator(), GBC.grid(0, 5).insets(3, 0).fill(GBC.HORIZONTAL));
|
add(createSeparator(), GBC.grid(0, 5).insets(3, 0).fill(GBC.HORIZONTAL));
|
||||||
add(createSeparator(), GBC.grid(0, 7).insets(3, 0, 0, 0).fill(GBC.HORIZONTAL));
|
add(createSeparator(), GBC.grid(0, 7).insets(3, 0, 0, 0).fill(GBC.HORIZONTAL));
|
||||||
|
|
||||||
|
|
Reference in a new issue