Skip to content

Commit

Permalink
Merge pull request #1510 from pavelbraginskiy/rowshading
Browse files Browse the repository at this point in the history
Improve readability of tables
  • Loading branch information
Sleet01 authored May 22, 2024
2 parents ce00161 + c235a8a commit 5b1e7c7
Show file tree
Hide file tree
Showing 40 changed files with 135,301 additions and 54,668 deletions.
3,828 changes: 2,602 additions & 1,226 deletions megameklab/data/images/recordsheets/templates_iso/battle_armor_default.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3,077 changes: 2,104 additions & 973 deletions megameklab/data/images/recordsheets/templates_iso/conventional_infantry_tables.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5,516 changes: 3,960 additions & 1,556 deletions megameklab/data/images/recordsheets/templates_iso/fighter_conventional_default.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,515 changes: 4,646 additions & 1,869 deletions megameklab/data/images/recordsheets/templates_iso/naval_dualturret_standard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,512 changes: 4,646 additions & 1,866 deletions megameklab/data/images/recordsheets/templates_iso/naval_dualturret_superheavy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,578 changes: 4,695 additions & 1,883 deletions megameklab/data/images/recordsheets/templates_iso/naval_noturret_standard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,436 changes: 4,583 additions & 1,853 deletions megameklab/data/images/recordsheets/templates_iso/naval_noturret_superheavy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,469 changes: 4,609 additions & 1,860 deletions megameklab/data/images/recordsheets/templates_iso/naval_turret_standard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,475 changes: 4,611 additions & 1,864 deletions megameklab/data/images/recordsheets/templates_iso/naval_turret_superheavy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,814 changes: 4,882 additions & 1,932 deletions ...meklab/data/images/recordsheets/templates_iso/submarine_dualturret_standard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,811 changes: 4,882 additions & 1,929 deletions ...klab/data/images/recordsheets/templates_iso/submarine_dualturret_superheavy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,877 changes: 4,931 additions & 1,946 deletions megameklab/data/images/recordsheets/templates_iso/submarine_noturret_standard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,735 changes: 4,819 additions & 1,916 deletions ...meklab/data/images/recordsheets/templates_iso/submarine_noturret_superheavy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,768 changes: 4,845 additions & 1,923 deletions megameklab/data/images/recordsheets/templates_iso/submarine_turret_standard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,774 changes: 4,847 additions & 1,927 deletions megameklab/data/images/recordsheets/templates_iso/submarine_turret_superheavy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,312 changes: 929 additions & 383 deletions megameklab/data/images/recordsheets/templates_iso/tables_tank.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,467 changes: 1,052 additions & 415 deletions megameklab/data/images/recordsheets/templates_iso/tables_vtol.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3,823 changes: 2,597 additions & 1,226 deletions megameklab/data/images/recordsheets/templates_us/battle_armor_default.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3,074 changes: 2,101 additions & 973 deletions megameklab/data/images/recordsheets/templates_us/conventional_infantry_tables.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5,511 changes: 3,955 additions & 1,556 deletions megameklab/data/images/recordsheets/templates_us/fighter_conventional_default.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,517 changes: 4,646 additions & 1,871 deletions megameklab/data/images/recordsheets/templates_us/naval_dualturret_standard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,514 changes: 4,646 additions & 1,868 deletions megameklab/data/images/recordsheets/templates_us/naval_dualturret_superheavy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,580 changes: 4,695 additions & 1,885 deletions megameklab/data/images/recordsheets/templates_us/naval_noturret_standard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,438 changes: 4,583 additions & 1,855 deletions megameklab/data/images/recordsheets/templates_us/naval_noturret_superheavy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,471 changes: 4,609 additions & 1,862 deletions megameklab/data/images/recordsheets/templates_us/naval_turret_standard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6,477 changes: 4,611 additions & 1,866 deletions megameklab/data/images/recordsheets/templates_us/naval_turret_superheavy.svg

Large diffs are not rendered by default.

6,816 changes: 4,882 additions & 1,934 deletions megameklab/data/images/recordsheets/templates_us/submarine_dualturret_standard.svg

Large diffs are not rendered by default.

6,813 changes: 4,882 additions & 1,931 deletions ...eklab/data/images/recordsheets/templates_us/submarine_dualturret_superheavy.svg

Large diffs are not rendered by default.

6,879 changes: 4,931 additions & 1,948 deletions megameklab/data/images/recordsheets/templates_us/submarine_noturret_standard.svg

Large diffs are not rendered by default.

6,737 changes: 4,819 additions & 1,918 deletions megameklab/data/images/recordsheets/templates_us/submarine_noturret_superheavy.svg

Large diffs are not rendered by default.

6,770 changes: 4,845 additions & 1,925 deletions megameklab/data/images/recordsheets/templates_us/submarine_turret_standard.svg

Large diffs are not rendered by default.

6,776 changes: 4,847 additions & 1,929 deletions megameklab/data/images/recordsheets/templates_us/submarine_turret_superheavy.svg

Large diffs are not rendered by default.

1,311 changes: 928 additions & 383 deletions megameklab/data/images/recordsheets/templates_us/tables_tank.svg

Large diffs are not rendered by default.

1,468 changes: 1,052 additions & 416 deletions megameklab/data/images/recordsheets/templates_us/tables_vtol.svg

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions megameklab/resources/megameklab/resources/Dialogs.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ ConfigurationDialog.cbPaper.text=Paper Size:
ConfigurationDialog.cbPaper.tooltip=<html>The dimensions of the page to use when exporting to PDF.<br/>When printing, this can be changed in the print dialog.</html>
ConfigurationDialog.chkColor.text=Use color
ConfigurationDialog.chkColor.tooltip=Use color on the record sheet.
ConfigurationDialog.chkRowShading.text=Improve table readability
ConfigurationDialog.chkRowShading.tooltip=<html>Add grey shading to alternating rows of certain tables to make them more readable.<br/>\
WARNING: Significantly slows down record sheet export.</html>
ConfigurationDialog.cbFont.text=Font Family:
ConfigurationDialog.cbFont.tooltip=<html>Select the typeface to use when printing record sheets.<br/>\
Additional truetype fonts can be made available to MML by placing the font file in the data/fonts directory.</html>
Expand Down
1 change: 1 addition & 0 deletions megameklab/src/megameklab/printing/IdConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public interface IdConstants {
String COPYRIGHT = "tspanCopyright";
String TITLE = "title";
String UNIT_SCALE = "unitScale";
String ROW_SHADING = "tableshading";

String TYPE = "type";
String TYPE2 = "type2";
Expand Down
5 changes: 5 additions & 0 deletions megameklab/src/megameklab/printing/PrintRecordSheet.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ private void subColorElements() {
}
}

private void shadeTableRows() {
hideElement(ROW_SHADING, !options.useRowShading());
}

/**
* Creates a {@link Document} from an svg image file
*
Expand Down Expand Up @@ -290,6 +294,7 @@ protected boolean createDocument(int pageIndex, PageFormat pageFormat, boolean a
}
subFonts((SVGDocument) getSVGDocument());
subColorElements();
shadeTableRows();
SVGGeneratorContext context = SVGGeneratorContext.createDefault(getSVGDocument());
svgGenerator = new SVGGraphics2D(context, false);
double ratio = Math.min(pageFormat.getImageableWidth() / (options.getPaperSize().pxWidth - 36),
Expand Down
11 changes: 11 additions & 0 deletions megameklab/src/megameklab/printing/RecordSheetOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class RecordSheetOptions {
private boolean eraBasedProgression;
private boolean referenceCharts;
private boolean condensedReferenceCharts;
private boolean rowShading;

public RecordSheetOptions() {
String paper = CConfig.getParam(CConfig.RS_PAPER_SIZE, PaperSize.US_LETTER.name());
Expand All @@ -52,6 +53,7 @@ public RecordSheetOptions() {
this.eraBasedProgression = CConfig.getBooleanParam(CConfig.TECH_PROGRESSION);
this.referenceCharts = CConfig.getBooleanParam(CConfig.RS_REFERENCE);
this.condensedReferenceCharts = CConfig.getBooleanParam(CConfig.RS_CONDENSED_REFERENCE);
this.rowShading = CConfig.getBooleanParam(CConfig.RS_ROW_SHADING);
}

public RecordSheetOptions(RecordSheetOptions options) {
Expand All @@ -66,6 +68,7 @@ public RecordSheetOptions(RecordSheetOptions options) {
eraBasedProgression = options.eraBasedProgression;
referenceCharts = options.referenceCharts;
condensedReferenceCharts = options.condensedReferenceCharts;
rowShading = options.rowShading;
}

public PaperSize getPaperSize() {
Expand Down Expand Up @@ -116,6 +119,10 @@ public boolean showCondensedReferenceCharts() {
return condensedReferenceCharts;
}

public boolean useRowShading() {
return rowShading;
}

public void setPaperSize(PaperSize paperSize) {
this.paperSize = paperSize;
}
Expand Down Expand Up @@ -151,4 +158,8 @@ public void setReferenceCharts(boolean charts) {
public void setCondensedReferenceCharts(boolean charts) {
this.condensedReferenceCharts = charts;
}

public void setRowShading(boolean rowShading) {
this.rowShading = rowShading;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class ExportSettingsPanel extends JPanel {
private final IntRangeTextField txtScale = new IntRangeTextField(3);
private final MMComboBox<MekChassisArrangement> mekChassis =
new MMComboBox<>("Mek Names", MekChassisArrangement.values());
private final JCheckBox chkRowShading = new JCheckBox();

ExportSettingsPanel() {
ResourceBundle resourceMap = ResourceBundle.getBundle("megameklab.resources.Dialogs");
Expand Down Expand Up @@ -102,6 +103,10 @@ class ExportSettingsPanel extends JPanel {
chkColor.setToolTipText(resourceMap.getString("ConfigurationDialog.chkColor.tooltip"));
chkColor.setSelected(CConfig.getBooleanParam(CConfig.RS_COLOR));

chkRowShading.setText(resourceMap.getString("ConfigurationDialog.chkRowShading.text"));
chkRowShading.setToolTipText(resourceMap.getString("ConfigurationDialog.chkRowShading.tooltip"));
chkRowShading.setSelected(CConfig.getBooleanParam(CConfig.RS_ROW_SHADING));

chkShowReferenceTables.setText(resourceMap.getString("ConfigurationDialog.chkShowReferenceTables.text"));
chkShowReferenceTables.setToolTipText(resourceMap.getString("ConfigurationDialog.chkShowReferenceTables.tooltip"));
chkShowReferenceTables.setSelected(CConfig.getBooleanParam(CConfig.RS_REFERENCE));
Expand Down Expand Up @@ -169,6 +174,7 @@ class ExportSettingsPanel extends JPanel {
gridPanel.add(paperPanel);
gridPanel.add(fontPanel);
gridPanel.add(chkColor);
gridPanel.add(chkRowShading);
gridPanel.add(chkShowReferenceTables);
gridPanel.add(chkShowCondensedTables);
gridPanel.add(chkShowQuirks);
Expand All @@ -179,7 +185,7 @@ class ExportSettingsPanel extends JPanel {
gridPanel.add(chkTacOpsHeat);
gridPanel.add(mekNameLine);
gridPanel.add(scalePanel);
SpringUtilities.makeCompactGrid(gridPanel, 14, 1, 0, 0, 15, 10);
SpringUtilities.makeCompactGrid(gridPanel, 15, 1, 0, 0, 15, 8);
gridPanel.setBorder(new EmptyBorder(20, 30, 20, 30));
setLayout(new FlowLayout(FlowLayout.LEFT));
add(gridPanel);
Expand All @@ -191,6 +197,7 @@ Map<String, String> getRecordSheetSettings() {
recordSheetSettings.put(CConfig.RS_FONT, (String) cbFont.getSelectedItem());
recordSheetSettings.put(CConfig.RS_PROGRESS_BAR, String.valueOf(chkProgressBar.isSelected()));
recordSheetSettings.put(CConfig.RS_COLOR, Boolean.toString(chkColor.isSelected()));
recordSheetSettings.put(CConfig.RS_ROW_SHADING, Boolean.toString(chkRowShading.isSelected()));
recordSheetSettings.put(CConfig.RS_REFERENCE, Boolean.toString(chkShowReferenceTables.isSelected()));
recordSheetSettings.put(CConfig.RS_CONDENSED_REFERENCE, Boolean.toString(chkShowCondensedTables.isSelected()));
recordSheetSettings.put(CConfig.RS_SHOW_QUIRKS, Boolean.toString(chkShowQuirks.isSelected()));
Expand Down
1 change: 1 addition & 0 deletions megameklab/src/megameklab/util/CConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public final class CConfig {

public static final String RS_PAPER_SIZE = "rs_paper_size";
public static final String RS_COLOR = "rs_color";
public static final String RS_ROW_SHADING = "rs_row_shading";
public static final String RS_FONT = "rs_font";
public static final String RS_PROGRESS_BAR = "rs_progress_bar";
public static final String RS_SHOW_QUIRKS = "rs_show_quirks";
Expand Down

0 comments on commit 5b1e7c7

Please sign in to comment.