gnome-subtitles r1083 - trunk/src/GnomeSubtitles/Ui
- From: pcastro svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-subtitles r1083 - trunk/src/GnomeSubtitles/Ui
- Date: Sun, 23 Nov 2008 18:31:01 +0000 (UTC)
Author: pcastro
Date: Sun Nov 23 18:31:00 2008
New Revision: 1083
URL: http://svn.gnome.org/viewvc/gnome-subtitles?rev=1083&view=rev
Log:
Improved removal of "Video" tag from the "VideoFrameRate" menu.
Modified:
trunk/src/GnomeSubtitles/Ui/Menus.cs
Modified: trunk/src/GnomeSubtitles/Ui/Menus.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/Menus.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/Menus.cs Sun Nov 23 18:31:00 2008
@@ -173,20 +173,24 @@
SetMenuItemText(menuItemName, menuItemText);
}
- public void RemoveFrameRateVideoTag (float frameRate) {
- if (frameRate <= 0)
- return;
-
- string menuItemName = FrameRateToMenuItem(frameRate, "Video");
- string menuItemText = GetMenuItemText(menuItemName);
-
- int lastSpaceIndex = menuItemText.LastIndexOf(' ');
- if (lastSpaceIndex < 0)
- return;
-
- string frameRateText = menuItemText.Substring(0, lastSpaceIndex);
- SetMenuItemText(menuItemName, frameRateText);
+ public void RemoveFrameRateVideoTag () {
+ Menu menu = Base.GetWidget(WidgetNames.TimingsVideoFrameRateMenu) as Menu;
+ foreach (Widget child in menu.Children) {
+ if (!(child is MenuItem))
+ continue;
+
+ MenuItem menuItem = child as MenuItem;
+ string text = GetMenuItemText(menuItem);
+ string videoTagSuffix = GetVideoTagSuffix();
+
+ int tagIndex = text.LastIndexOf(videoTagSuffix);
+ if (tagIndex > 0) {
+ text = text.Substring(0, tagIndex);
+ SetMenuItemText(menuItem, text);
+ }
+ }
}
+
/* Static members */
@@ -285,7 +289,7 @@
SetSensitivity(WidgetNames.FileTranslationNew, true);
SetSensitivity(WidgetNames.FileTranslationOpen, true);
/* Edit Menu */
- SetMenuSensitivity(WidgetNames.EditInsertSubtitle, true);
+ SetMenuSensitivity(WidgetNames.EditInsertSubtitleMenu, true);
SetSensitivity(WidgetNames.EditDeleteSubtitles, true);
/* View Menu */
SetSensitivity(WidgetNames.ViewTimes, true);
@@ -344,12 +348,12 @@
private void SetFrameRateMenus () {
if (Base.TimingMode == TimingMode.Frames) {
- SetMenuSensitivity(WidgetNames.TimingsInputFrameRate, true);
- SetMenuSensitivity(WidgetNames.TimingsVideoFrameRate, true);
+ SetMenuSensitivity(WidgetNames.TimingsInputFrameRateMenu, true);
+ SetMenuSensitivity(WidgetNames.TimingsVideoFrameRateMenu, true);
}
else {
- SetMenuSensitivity(WidgetNames.TimingsInputFrameRate, false);
- SetMenuSensitivity(WidgetNames.TimingsVideoFrameRate, true);
+ SetMenuSensitivity(WidgetNames.TimingsInputFrameRateMenu, false);
+ SetMenuSensitivity(WidgetNames.TimingsVideoFrameRateMenu, true);
}
UpdateActiveInputFrameRateMenuItem();
@@ -450,9 +454,8 @@
widget.Sensitive = isSensitive;
}
- private void SetMenuSensitivity (string menuItemName, bool sensitivity) {
- MenuItem menuItem = Base.GetWidget(menuItemName) as MenuItem;
- Menu menu = menuItem.Submenu as Menu;
+ private void SetMenuSensitivity (string menuName, bool sensitivity) {
+ Menu menu = Base.GetWidget(menuName) as Menu;
foreach (Widget widget in menu)
widget.Sensitive = sensitivity;
}
@@ -499,16 +502,28 @@
private string GetMenuItemText (string menuItemName) {
MenuItem menuItem = Base.GetWidget(menuItemName) as MenuItem;
+ return GetMenuItemText(menuItem);
+ }
+
+ private string GetMenuItemText (MenuItem menuItem) {
Label label = menuItem.Child as Label;
return label.Text;
}
private void SetMenuItemText (string menuItemName, string text) {
MenuItem menuItem = Base.GetWidget(menuItemName) as MenuItem;
+ SetMenuItemText(menuItem, text);
+ }
+
+ private void SetMenuItemText (MenuItem menuItem, string text) {
Label label = menuItem.Child as Label;
label.Text = text;
}
+ private string GetVideoTagSuffix () {
+ return " (" + videoTagText + ")";
+ }
+
private void SetToolbarHomogeneity () {
Toolbar toolbar = Base.GetWidget(WidgetNames.Toolbar) as Toolbar;
Widget[] toolItems = toolbar.Children;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]