tastudio: dynamically resize usertext column
This commit is contained in:
parent
2fa40bac04
commit
a9cda4a21f
|
@ -193,7 +193,6 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
bl.GetLump(nusertext, false, delegate(TextReader tr)
|
bl.GetLump(nusertext, false, delegate(TextReader tr)
|
||||||
{
|
{
|
||||||
string line;
|
string line;
|
||||||
|
|
|
@ -26,6 +26,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public TasBranch BackupBranch;
|
public TasBranch BackupBranch;
|
||||||
private enum BranchUndo { Load, Update, Text, Remove, None }
|
private enum BranchUndo { Load, Update, Text, Remove, None }
|
||||||
private BranchUndo _branchUndo = BranchUndo.None;
|
private BranchUndo _branchUndo = BranchUndo.None;
|
||||||
|
private int LongestBranchText = 0;
|
||||||
public int HoverInterval {
|
public int HoverInterval {
|
||||||
get { return BranchView.HoverInterval; }
|
get { return BranchView.HoverInterval; }
|
||||||
set { BranchView.HoverInterval = value; }
|
set { BranchView.HoverInterval = value; }
|
||||||
|
@ -464,6 +465,32 @@ namespace BizHawk.Client.EmuHawk
|
||||||
BranchView.Refresh();
|
BranchView.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateTextColumnWidth()
|
||||||
|
{
|
||||||
|
int temp = 0;
|
||||||
|
foreach (TasBranch b in Movie.Branches)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(b.UserText))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (temp < b.UserText.Length)
|
||||||
|
temp = b.UserText.Length;
|
||||||
|
}
|
||||||
|
LongestBranchText = temp;
|
||||||
|
|
||||||
|
int textWidth = LongestBranchText * 12 + 14; // sorry for magic numbers. see TAStudio.SetUpColumns()
|
||||||
|
InputRoll.RollColumn column = BranchView.AllColumns.Where(c => c.Name == UserTextColumnName).SingleOrDefault();
|
||||||
|
|
||||||
|
if (textWidth < 90)
|
||||||
|
textWidth = 90;
|
||||||
|
|
||||||
|
if (column.Width != textWidth)
|
||||||
|
{
|
||||||
|
column.Width = textWidth;
|
||||||
|
BranchView.AllColumns.ColumnsChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool EditBranchTextPopUp(int index)
|
public bool EditBranchTextPopUp(int index)
|
||||||
{
|
{
|
||||||
TasBranch branch = Movie.GetBranch(index);
|
TasBranch branch = Movie.GetBranch(index);
|
||||||
|
@ -485,6 +512,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (result == DialogResult.OK)
|
if (result == DialogResult.OK)
|
||||||
{
|
{
|
||||||
branch.UserText = i.PromptText;
|
branch.UserText = i.PromptText;
|
||||||
|
UpdateTextColumnWidth();
|
||||||
UpdateValues();
|
UpdateValues();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
LoadFile(new FileInfo(ofd.FileName));
|
LoadFile(new FileInfo(ofd.FileName));
|
||||||
}
|
}
|
||||||
else if (ofd.FileName.EndsWith(".bkm") || ofd.FileName.EndsWith(".bk2")) // was loaded using "All Files" filter. todo: proper extention iteration
|
else if (ofd.FileName.EndsWith(".bkm") || ofd.FileName.EndsWith(".bk2")) // todo: proper extention iteration
|
||||||
{
|
{
|
||||||
Mainform.StartNewMovie(MovieService.Get(ofd.FileName), false);
|
Mainform.StartNewMovie(MovieService.Get(ofd.FileName), false);
|
||||||
|
|
||||||
|
|
|
@ -449,7 +449,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
type = InputRoll.RollColumn.InputType.Boolean;
|
type = InputRoll.RollColumn.InputType.Boolean;
|
||||||
digits = kvp.Value.Length;
|
digits = kvp.Value.Length;
|
||||||
}
|
}
|
||||||
AddColumn(kvp.Key, kvp.Value, (digits * 6) + 14, type);
|
AddColumn(kvp.Key, kvp.Value, (digits * 6) + 14, type); // magic numbers reused in EditBranchTextPopUp()
|
||||||
}
|
}
|
||||||
|
|
||||||
var columnsToHide = TasView.AllColumns
|
var columnsToHide = TasView.AllColumns
|
||||||
|
@ -578,6 +578,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
CurrentTasMovie.PropertyChanged += new PropertyChangedEventHandler(this.TasMovie_OnPropertyChanged);
|
CurrentTasMovie.PropertyChanged += new PropertyChangedEventHandler(this.TasMovie_OnPropertyChanged);
|
||||||
CurrentTasMovie.CurrentBranch = CurrentTasMovie.Session.CurrentBranch;
|
CurrentTasMovie.CurrentBranch = CurrentTasMovie.Session.CurrentBranch;
|
||||||
|
BookMarkControl.UpdateTextColumnWidth();
|
||||||
|
|
||||||
// clear all selections
|
// clear all selections
|
||||||
TasView.DeselectAll();
|
TasView.DeselectAll();
|
||||||
|
@ -644,13 +645,19 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private bool StartNewMovieWrapper(bool record, IMovie movie = null)
|
private bool StartNewMovieWrapper(bool record, IMovie movie = null)
|
||||||
{
|
{
|
||||||
_initializing = true;
|
_initializing = true;
|
||||||
|
|
||||||
if (movie == null)
|
if (movie == null)
|
||||||
movie = CurrentTasMovie;
|
movie = CurrentTasMovie;
|
||||||
|
|
||||||
SetTasMovieCallbacks(movie as TasMovie);
|
SetTasMovieCallbacks(movie as TasMovie);
|
||||||
|
|
||||||
bool result = Mainform.StartNewMovie(movie, record);
|
bool result = Mainform.StartNewMovie(movie, record);
|
||||||
if (result)
|
if (result)
|
||||||
CurrentTasMovie.TasStateManager.Capture(); // Capture frame 0 always.
|
CurrentTasMovie.TasStateManager.Capture(); // Capture frame 0 always.
|
||||||
|
|
||||||
TastudioPlayMode();
|
TastudioPlayMode();
|
||||||
|
BookMarkControl.UpdateTextColumnWidth();
|
||||||
|
|
||||||
_initializing = false;
|
_initializing = false;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue