[gnome-subtitles] Allow to manually edit times in spinbuttons (fixes #549060)
- From: Pedro Daniel da Rocha Melo e Castro <pcastro src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-subtitles] Allow to manually edit times in spinbuttons (fixes #549060)
- Date: Sat, 13 Feb 2010 03:09:07 +0000 (UTC)
commit 4313dad9be25dc1a6628d4685fd79570bb64562f
Author: Pedro Castro <mail>
Date: Sat Feb 13 02:51:57 2010 +0000
Allow to manually edit times in spinbuttons (fixes #549060)
Spin buttons, when in times mode, now have their text freely editable. The text
is validated and converted to the time value when editing is finished (focus lost).
src/GnomeSubtitles/Core/Util.cs | 4 ++--
.../Ui/Edit/SubtitleEditSpinButtons.cs | 13 +++++++------
2 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/src/GnomeSubtitles/Core/Util.cs b/src/GnomeSubtitles/Core/Util.cs
index 4aa5e95..fd7c35f 100644
--- a/src/GnomeSubtitles/Core/Util.cs
+++ b/src/GnomeSubtitles/Core/Util.cs
@@ -99,18 +99,18 @@ public class Util {
public static void OnTimeOutput (object o, OutputArgs args) {
SpinButton spinButton = o as SpinButton;
- spinButton.Numeric = false;
spinButton.Text = MillisecondsToTimeText((int)spinButton.Value);
- spinButton.Numeric = true;
args.RetVal = 1;
}
public static void SetSpinButtonTimingMode (SpinButton spinButton, TimingMode timingMode) {
if (timingMode == TimingMode.Frames) {
+ spinButton.Numeric = true;
spinButton.Input -= OnTimeInput;
spinButton.Output -= OnTimeOutput;
}
else {
+ spinButton.Numeric = false;
spinButton.Input += OnTimeInput;
spinButton.Output += OnTimeOutput;
}
diff --git a/src/GnomeSubtitles/Ui/Edit/SubtitleEditSpinButtons.cs b/src/GnomeSubtitles/Ui/Edit/SubtitleEditSpinButtons.cs
index d995c4c..91407b5 100644
--- a/src/GnomeSubtitles/Ui/Edit/SubtitleEditSpinButtons.cs
+++ b/src/GnomeSubtitles/Ui/Edit/SubtitleEditSpinButtons.cs
@@ -1,6 +1,6 @@
/*
* This file is part of Gnome Subtitles.
- * Copyright (C) 2006-2009 Pedro Castro
+ * Copyright (C) 2006-2010 Pedro Castro
*
* Gnome Subtitles is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -100,16 +100,17 @@ public class SubtitleEditSpinButtons {
}
private void SetTimesMode (SpinButton spinButton, bool allowNegatives) {
- spinButton.Input += Util.OnTimeInput;
- spinButton.Output += Util.OnTimeOutput;
+ Util.SetSpinButtonTimingMode(spinButton, TimingMode.Times);
+
spinButton.Adjustment.StepIncrement = timeStepIncrement;
spinButton.Adjustment.Upper = maxTime;
spinButton.Adjustment.Lower = (allowNegatives ? -maxTime : 0);
}
-
+
+ //TODO use Util.SetSpinButtonAdjustment
private void SetFramesMode (SpinButton spinButton, bool allowNegatives) {
- spinButton.Input -= Util.OnTimeInput;
- spinButton.Output -= Util.OnTimeOutput;
+ Util.SetSpinButtonTimingMode(spinButton, TimingMode.Frames);
+
spinButton.Adjustment.StepIncrement = framesStepIncrement;
spinButton.Adjustment.Upper = maxFrames;
spinButton.Adjustment.Lower = (allowNegatives ? -maxFrames : 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]