From 075bb0184c3db43fd681322f7af018aeaa9e08b0 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Tue, 3 Jul 2007 01:48:04 +0000 Subject: [PATCH] Layer and margin columns are no longer shown if all lines have default values for those. Originally committed to SVN as r1338. --- aegisub/base_grid.cpp | 19 ++++++++++++++----- aegisub/changelog.txt | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/aegisub/base_grid.cpp b/aegisub/base_grid.cpp index 20a73f699..9748db58b 100644 --- a/aegisub/base_grid.cpp +++ b/aegisub/base_grid.cpp @@ -769,6 +769,9 @@ void BaseGrid::SetColumnWidths() { } // O(n) widths + bool showMargin[3]; + showMargin[0] = showMargin[1] = showMargin[2] = false; + bool showLayer = false; int styleLen = 0; int actorLen = 0; int effectLen = 0; @@ -780,7 +783,10 @@ void BaseGrid::SetColumnWidths() { curDiag = GetDialogue(i); if (curDiag) { // Layer - if (curDiag->Layer > maxLayer) maxLayer = curDiag->Layer; + if (curDiag->Layer > maxLayer) { + maxLayer = curDiag->Layer; + showLayer = true; + } // Actor if (!curDiag->Actor.IsEmpty()) { @@ -800,6 +806,11 @@ void BaseGrid::SetColumnWidths() { if (fw > effectLen) effectLen = fw; } + // Margins + for (int j=0;j<3;j++) { + if (curDiag->Margin[j] != 0) showMargin[j] = true; + } + // Times if (byFrame) { int tmp = VFR_Output.GetFrameAtTime(curDiag->Start.GetMS(),true); @@ -841,15 +852,13 @@ void BaseGrid::SetColumnWidths() { // Set column widths colWidth[0] = labelLen; - colWidth[1] = layerLen; + colWidth[1] = showLayer ? layerLen : 0; colWidth[2] = startLen; colWidth[3] = endLen; colWidth[4] = styleLen; colWidth[5] = actorLen; colWidth[6] = effectLen; - colWidth[7] = marginLen; - colWidth[8] = marginLen; - colWidth[9] = marginLen; + for (int i=0;i<3;i++) colWidth[i+7] = showMargin[i] ? marginLen : 0; // Hide columns for (int i=0;i<10;i++) { diff --git a/aegisub/changelog.txt b/aegisub/changelog.txt index 30ee83129..32f35dec4 100644 --- a/aegisub/changelog.txt +++ b/aegisub/changelog.txt @@ -104,6 +104,7 @@ Please visit http://aegisub.net to download latest version o Added Paste Over function, which allows you to paste subtitle lines over others, overwriting the fields of your choice. (AMZ) o Scrollbar in grid didn't always allow scrolling through all the subs. (jfs) o Minor fix to the calculation of the grid's "Style" column width. (AMZ) + o Layer and margin columns are no longer shown if all lines have default values for those. (AMZ) - Subtitles edit box changes: o The whole layout has been tweaked. (AMZ) o Replaced wxTextCtrl with wxStyledTextCtrl, to solve many issues related to the Rich Text edit control. (AMZ)