mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
Some listview column resizing
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@280 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
0f80f040a6
commit
fbbd2a3b86
@ -79,6 +79,46 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
GridLines = true;
|
||||
}
|
||||
|
||||
public void AutoSizeAllColumns(Form parentForm)
|
||||
{
|
||||
Columns[ColumnIndexNumber].Width = 55;
|
||||
InitializeTimeStampColumWidths(parentForm);
|
||||
|
||||
int length = Columns[ColumnIndexNumber].Width + Columns[ColumnIndexStart].Width + Columns[ColumnIndexEnd].Width + Columns[ColumnIndexDuration].Width;
|
||||
int lengthAvailable = Width - length;
|
||||
|
||||
int numberOfRestColumns = 1;
|
||||
if (IsAlternateTextColumnVisible)
|
||||
numberOfRestColumns++;
|
||||
if (IsExtraColumnVisible)
|
||||
numberOfRestColumns++;
|
||||
|
||||
if (IsAlternateTextColumnVisible && !IsExtraColumnVisible)
|
||||
{
|
||||
int restWidth = (lengthAvailable / 2) - 15;
|
||||
Columns[ColumnIndexText].Width = restWidth;
|
||||
Columns[ColumnIndexTextAlternate].Width = restWidth;
|
||||
}
|
||||
else if (!IsAlternateTextColumnVisible && !IsExtraColumnVisible)
|
||||
{
|
||||
int restWidth = lengthAvailable - 15;
|
||||
Columns[ColumnIndexText].Width = restWidth;
|
||||
}
|
||||
else if (!IsAlternateTextColumnVisible && IsExtraColumnVisible)
|
||||
{
|
||||
int restWidth = lengthAvailable - 15;
|
||||
Columns[ColumnIndexText].Width = (int) (restWidth * 0.6);
|
||||
Columns[ColumnIndexExtra].Width = (int)(restWidth * 0.4);
|
||||
}
|
||||
else
|
||||
{
|
||||
int restWidth = lengthAvailable - 15;
|
||||
Columns[ColumnIndexText].Width = (int)(restWidth * 0.4);
|
||||
Columns[ColumnIndexTextAlternate].Width = (int)(restWidth * 0.4);
|
||||
Columns[ColumnIndexExtra].Width = (int)(restWidth * 0.2);
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowAlternateTextColumn(string text)
|
||||
{
|
||||
if (!IsAlternateTextColumnVisible)
|
||||
|
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Controls
|
||||
{
|
||||
@ -239,7 +239,6 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
Graphics graphics = e.Graphics;
|
||||
int begin = SecondsToXPosition(StartPositionSeconds);
|
||||
int beginNoZoomFactor = (int)Math.Round(StartPositionSeconds * _wavePeaks.Header.SampleRate); // do not use zoom factor here!
|
||||
|
||||
|
||||
int start = -1;
|
||||
int end = -1;
|
||||
@ -250,12 +249,11 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
}
|
||||
int imageHeight = Height;
|
||||
int maxHeight = (int)(Math.Max(Math.Abs(_wavePeaks.DataMinValue), Math.Abs(_wavePeaks.DataMaxValue)) + 0.5);
|
||||
Pen pen = new System.Drawing.Pen(System.Drawing.Color.GreenYellow);
|
||||
Pen pen = new System.Drawing.Pen(Color);
|
||||
|
||||
DrawBackground(graphics);
|
||||
int x = 0;
|
||||
int y = Height / 2;
|
||||
|
||||
if (_zoomFactor == 1.0)
|
||||
{
|
||||
for (int i = 0; i < _wavePeaks.AllSamples.Count && i < Width; i++)
|
||||
@ -264,6 +262,8 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
{
|
||||
int newY = CalculateHeight(_wavePeaks.AllSamples[begin + i], imageHeight, maxHeight);
|
||||
graphics.DrawLine(pen, x, y, i, newY);
|
||||
//graphics.FillRectangle(new SolidBrush(Color), x, y, 1, 1); - draw pixel instead of line
|
||||
|
||||
x = i;
|
||||
y = newY;
|
||||
if (begin + i > end || begin + i < start)
|
||||
|
18
src/Forms/Main.Designer.cs
generated
18
src/Forms/Main.Designer.cs
generated
@ -69,9 +69,9 @@
|
||||
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator20 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.openOriginalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.saveOriginalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.saveOriginalAstoolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.openOriginalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.removeOriginalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.toolStripMenuItemOpenContainingFolder = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@ -722,9 +722,9 @@
|
||||
this.saveToolStripMenuItem,
|
||||
this.saveAsToolStripMenuItem,
|
||||
this.toolStripSeparator20,
|
||||
this.openOriginalToolStripMenuItem,
|
||||
this.saveOriginalToolStripMenuItem,
|
||||
this.saveOriginalAstoolStripMenuItem,
|
||||
this.openOriginalToolStripMenuItem,
|
||||
this.removeOriginalToolStripMenuItem,
|
||||
this.toolStripSeparator12,
|
||||
this.toolStripMenuItemOpenContainingFolder,
|
||||
@ -786,6 +786,13 @@
|
||||
this.toolStripSeparator20.Name = "toolStripSeparator20";
|
||||
this.toolStripSeparator20.Size = new System.Drawing.Size(331, 6);
|
||||
//
|
||||
// openOriginalToolStripMenuItem
|
||||
//
|
||||
this.openOriginalToolStripMenuItem.Name = "openOriginalToolStripMenuItem";
|
||||
this.openOriginalToolStripMenuItem.Size = new System.Drawing.Size(334, 22);
|
||||
this.openOriginalToolStripMenuItem.Text = "Open original (translator mode)...";
|
||||
this.openOriginalToolStripMenuItem.Click += new System.EventHandler(this.openOriginalToolStripMenuItem_Click);
|
||||
//
|
||||
// saveOriginalToolStripMenuItem
|
||||
//
|
||||
this.saveOriginalToolStripMenuItem.Name = "saveOriginalToolStripMenuItem";
|
||||
@ -800,13 +807,6 @@
|
||||
this.saveOriginalAstoolStripMenuItem.Text = "Save original as...";
|
||||
this.saveOriginalAstoolStripMenuItem.Click += new System.EventHandler(this.saveOriginalAstoolStripMenuItem_Click);
|
||||
//
|
||||
// openOriginalToolStripMenuItem
|
||||
//
|
||||
this.openOriginalToolStripMenuItem.Name = "openOriginalToolStripMenuItem";
|
||||
this.openOriginalToolStripMenuItem.Size = new System.Drawing.Size(334, 22);
|
||||
this.openOriginalToolStripMenuItem.Text = "Open original (translator mode)...";
|
||||
this.openOriginalToolStripMenuItem.Click += new System.EventHandler(this.openOriginalToolStripMenuItem_Click);
|
||||
//
|
||||
// removeOriginalToolStripMenuItem
|
||||
//
|
||||
this.removeOriginalToolStripMenuItem.Name = "removeOriginalToolStripMenuItem";
|
||||
|
@ -105,7 +105,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (versionInfo.Length >= 3 && versionInfo[2] != "0")
|
||||
_title += "." + versionInfo[2];
|
||||
}
|
||||
return _title + " Beta 10";
|
||||
return _title + " Beta 11";
|
||||
}
|
||||
}
|
||||
|
||||
@ -2769,6 +2769,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
ShowSource();
|
||||
|
||||
SubtitleListview1.ShowAlternateTextColumn(Configuration.Settings.Language.General.OriginalText);
|
||||
SubtitleListview1.AutoSizeAllColumns(this);
|
||||
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
|
||||
|
||||
RestoreSubtitleListviewIndexes();
|
||||
@ -2856,6 +2857,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
ShowSource();
|
||||
SubtitleListview1.ShowAlternateTextColumn(Configuration.Settings.Language.General.OriginalText);
|
||||
SubtitleListview1.AutoSizeAllColumns(this);
|
||||
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
|
||||
ShowStatus(_language.TranslationFromSwedishToDanishComplete);
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(firstSelectedIndex);
|
||||
@ -6166,6 +6168,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (SubtitleListview1.IsAlternateTextColumnVisible)
|
||||
{
|
||||
SubtitleListview1.HideAlternateTextColumn();
|
||||
SubtitleListview1.AutoSizeAllColumns(this);
|
||||
_subtitleAlternate = new Subtitle();
|
||||
_subtitleAlternateFileName = null;
|
||||
|
||||
@ -6187,6 +6190,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
OpenAlternateSubtitle();
|
||||
}
|
||||
SetTitle();
|
||||
}
|
||||
|
||||
private void OpenAlternateSubtitle()
|
||||
@ -6265,6 +6269,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
|
||||
SubtitleListview1.ShowAlternateTextColumn(Configuration.Settings.Language.General.OriginalText);
|
||||
SubtitleListview1.AutoSizeAllColumns(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -8051,6 +8056,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
toolStripStatusNetworking.Text = _language.NetworkMode;
|
||||
EnableDisableControlsNotWorkingInNetworkMode(false);
|
||||
SubtitleListview1.ShowExtraColumn(_language.UserAndAction);
|
||||
SubtitleListview1.AutoSizeAllColumns(this);
|
||||
TimerWebServiceTick(null, null);
|
||||
}
|
||||
else
|
||||
@ -8079,12 +8085,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
EnableDisableControlsNotWorkingInNetworkMode(false);
|
||||
_networkSession.AppendToLog(_networkSession.CurrentUser.UserName + ": Joined session " + _networkSession.SessionId + " at " + DateTime.Now.ToLongTimeString());
|
||||
SubtitleListview1.ShowExtraColumn("User/action");
|
||||
SubtitleListview1.AutoSizeAllColumns(this);
|
||||
_subtitleListViewIndex = -1;
|
||||
_oldSelectedParagraph = null;
|
||||
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(0);
|
||||
_change = true;
|
||||
TimerWebServiceTick(null, null);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -8876,6 +8884,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (removeFromListView)
|
||||
{
|
||||
SubtitleListview1.HideAlternateTextColumn();
|
||||
SubtitleListview1.AutoSizeAllColumns(this);
|
||||
_subtitleAlternate = new Subtitle();
|
||||
_subtitleAlternateFileName = null;
|
||||
}
|
||||
|
@ -580,9 +580,6 @@
|
||||
<metadata name="toolStripWaveControls.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>208, 56</value>
|
||||
</metadata>
|
||||
<metadata name="toolStripWaveControls.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>208, 56</value>
|
||||
</metadata>
|
||||
<data name="toolStripButtonWaveFormZoomOut.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
@ -687,7 +684,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAAZgBAAGYAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAAbABAAGwAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
|
Loading…
Reference in New Issue
Block a user