Skip to content

Commit

Permalink
Support LabelTalkBarTime Click Jump
Browse files Browse the repository at this point in the history
  • Loading branch information
Manabu Tonosaki committed Oct 1, 2020
1 parent f050104 commit 6767ffd
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 17 deletions.
21 changes: 19 additions & 2 deletions TalkLoggerWinform/FeatureJumpToInputValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class FeatureJumpToInputValue : FeatureControlBridgeBase
{
private TextBox Box;
private IRichPane TarPane;
private Label ClickJump;

private DataHot Hot
{
get
Expand All @@ -37,6 +39,12 @@ public override void OnInitInstance()
Box.KeyDown += Box_KeyDown;
Box.Validated += Box_Validated;

ClickJump = (Label)GetControl("LabelTalkBarTime");
if( ClickJump != null)
{
ClickJump.Click += ClickJump_Click;
}

Box.FindForm().FormClosing += (s, e) =>
{
IsFormClosing = true;
Expand All @@ -45,6 +53,15 @@ public override void OnInitInstance()
Timer.AddTrigger(500, UpdateBoxValue);
}

private void ClickJump_Click(object sender, EventArgs e)
{
if (sender is Control co)
{
Box.Text = co.Tag.ToString();
Jump(120);
}
}

private void UpdateBoxValue()
{
if (!IsInput && !IsFormClosing)
Expand Down Expand Up @@ -179,7 +196,7 @@ private DateTime GetTime(string str1, string str2, string str3, DateTime tartime
}
}

private void Jump()
private void Jump(int offsetSx = 0)
{
Box.BackColor = BgColor;
var line = Box.Text;
Expand Down Expand Up @@ -216,7 +233,7 @@ private void Jump()
Box.SelectAll();

var spos = Hot.TimelineParts.GetScRect(TarPane, CodeRect.FromLTWH((int)(settime - Hot.FirstSpeech).TotalSeconds, 0, 0, 0));
Pane.Scroll = ScreenPos.FromInt(Pane.Scroll.X - spos.LT.X, Pane.Scroll.Y);
Pane.Scroll = ScreenPos.FromInt(Pane.Scroll.X - spos.LT.X + offsetSx, Pane.Scroll.Y);
Token.Add(FeatureAutoScroll.TokenAutoScrollOFF, this);
Pane.Invalidate(null);
GetRoot().FlushFeatureTriggers();
Expand Down
3 changes: 2 additions & 1 deletion TalkLoggerWinform/FeatureTalkTextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public override void OnInitInstance()
TextBox = GetControl("textBoxTalk") as RichTextBox;
TextBox?.ResetText();
TextBox.SelectionChanged += TextBox_SelectionChanged;
LabelTime = GetControl("labelTalkBarTime") as Label;
LabelTime = GetControl("LabelTalkBarTime") as Label;
}
private void TextBox_SelectionChanged(object sender, EventArgs e)
{
Expand Down Expand Up @@ -68,6 +68,7 @@ public void Update()
{
var dt = Hot.FirstSpeech + TimeSpan.FromSeconds(SelectedBar.Rect.LT.X);
LabelTime.Text = dt.ToString(TimeUtil.FormatHM);
LabelTime.Tag = dt.ToString(TimeUtil.FormatHMS);
}
}
}
Expand Down
26 changes: 13 additions & 13 deletions TalkLoggerWinform/FormMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion TalkLoggerWinform/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private void FormMain_Load(object sender, EventArgs e)
};
splitContainerMain.SplitterDistance = (int)ConfigRegister.Current["PaneSplitterY", 25];
textBoxTalk.Text = "";
labelTalkBarTime.Text = "";
LabelTalkBarTime.Text = "";

IsInInit = false;
}
Expand Down

0 comments on commit 6767ffd

Please sign in to comment.