[kwave] /: - re-activated the "label" menu

Thomas Eschenbacher null at kde.org
Sat Feb 25 09:10:35 UTC 2017


Git commit ae8afc101ca932bb0c3bb7eff09ee4f64562bec4 by Thomas Eschenbacher.
Committed on 25/02/2017 at 09:09.
Pushed by eschenbacher into branch 'master'.

- re-activated the "label" menu
- renamed command "add_label"    -> "label:add"
- renamed command "delete_label" -> "label:delete"
- renamed command "edit_label"   -> "label:edit"

M  +4    -0    CHANGES
M  +0    -2    TODO
M  +64   -64   doc/en/index.docbook
M  +9    -34   kwave/MainWidget.cpp
M  +21   -3    kwave/TopWidget.cpp
M  +13   -22   kwave/menus.config
M  +2    -2    libgui/LabelItem.cpp
M  +8    -5    libgui/MenuManager.cpp
M  +5    -1    libgui/MenuManager.h
M  +1    -1    libgui/TrackView.cpp
M  +1    -1    libkwave/SignalManager.cpp
M  +3    -3    scripts/create-testfile.kwave
M  +1    -1    scripts/screenshots.kwave

https://commits.kde.org/kwave/ae8afc101ca932bb0c3bb7eff09ee4f64562bec4

diff --git a/CHANGES b/CHANGES
index 9078fb7b..dd83bf08 100644
--- a/CHANGES
+++ b/CHANGES
@@ -39,6 +39,10 @@
   * saveblocks: use the block title (description of the left side label) as
     tile of saved block
   * bugfix: file was left in "modified" state after adding a label and canceling
+  * re-activated the "label" menu
+  * renamed command "add_label"    -> "label:add"
+  * renamed command "delete_label" -> "label:delete"
+  * renamed command "edit_label"   -> "label:edit"
 
 0.9.2 [2016-06-26]
 
diff --git a/TODO b/TODO
index 7374926b..9ef771ab 100644
--- a/TODO
+++ b/TODO
@@ -76,8 +76,6 @@ o JACK audio support
 
 o maybe some effects from soundtouch
 
-o re-activate the "label" menu
-
 o use some xml file for the menu instead of a macro
 
 o support for Speex codec: http://www.speex.org/
diff --git a/doc/en/index.docbook b/doc/en/index.docbook
index db841109..59403a03 100644
--- a/doc/en/index.docbook
+++ b/doc/en/index.docbook
@@ -48,7 +48,6 @@
   <!ENTITY no-i18n-tag "">
   <!-- @COMMAND_ENTITIES_START@ -->
   <!ENTITY no-i18n-cmd_about_kde "about_kde">
-  <!ENTITY no-i18n-cmd_add_label "add_label">
   <!ENTITY no-i18n-cmd_add_track "add_track">
   <!ENTITY no-i18n-cmd_clipboard_flush "clipboard_flush">
   <!ENTITY no-i18n-cmd_close "close">
@@ -58,16 +57,17 @@
   <!ENTITY no-i18n-cmd_cut "cut">
   <!ENTITY no-i18n-cmd_delayed "delayed">
   <!ENTITY no-i18n-cmd_delete "delete">
-  <!ENTITY no-i18n-cmd_delete_label "delete_label">
   <!ENTITY no-i18n-cmd_delete_track "delete_track">
   <!ENTITY no-i18n-cmd_dump_metadata "dump_metadata">
-  <!ENTITY no-i18n-cmd_edit_label "edit_label">
   <!ENTITY no-i18n-cmd_expandtolabel "expandtolabel">
   <!ENTITY no-i18n-cmd_fileinfo "fileinfo">
   <!ENTITY no-i18n-cmd_forward "forward">
   <!ENTITY no-i18n-cmd_goto "goto">
   <!ENTITY no-i18n-cmd_insert_at "insert_at">
   <!ENTITY no-i18n-cmd_insert_track "insert_track">
+  <!ENTITY no-i18n-cmd_label_add "label:add">
+  <!ENTITY no-i18n-cmd_label_delete "label:delete">
+  <!ENTITY no-i18n-cmd_label_edit "label:edit">
   <!ENTITY no-i18n-cmd_loadbatch "loadbatch">
   <!ENTITY no-i18n-cmd_loop "loop">
   <!ENTITY no-i18n-cmd_menu "menu">
@@ -3014,7 +3014,6 @@
 	    <!-- @COMMAND_INDEX_START@ -->
 	    <indexdiv><title>a</title>
 		<indexentry><primaryie><link linkend="cmd_sect_about_kde" endterm="cmd_title_about_kde"/></primaryie></indexentry>
-		<indexentry><primaryie><link linkend="cmd_sect_add_label" endterm="cmd_title_add_label"/></primaryie></indexentry>
 		<indexentry><primaryie><link linkend="cmd_sect_add_track" endterm="cmd_title_add_track"/></primaryie></indexentry>
 	    </indexdiv>
 	    <indexdiv><title>c</title>
@@ -3028,12 +3027,11 @@
 	    <indexdiv><title>d</title>
 		<indexentry><primaryie><link linkend="cmd_sect_delayed" endterm="cmd_title_delayed"/></primaryie></indexentry>
 		<indexentry><primaryie><link linkend="cmd_sect_delete" endterm="cmd_title_delete"/></primaryie></indexentry>
-		<indexentry><primaryie><link linkend="cmd_sect_delete_label" endterm="cmd_title_delete_label"/></primaryie></indexentry>
 		<indexentry><primaryie><link linkend="cmd_sect_delete_track" endterm="cmd_title_delete_track"/></primaryie></indexentry>
 		<indexentry><primaryie><link linkend="cmd_sect_dump_metadata" endterm="cmd_title_dump_metadata"/></primaryie></indexentry>
 	    </indexdiv>
 	    <indexdiv><title>e</title>
-		<indexentry><primaryie><link linkend="cmd_sect_edit_label" endterm="cmd_title_edit_label"/></primaryie></indexentry>
+		<indexentry><primaryie><link linkend="cmd_sect_label_edit" endterm="cmd_title_label_edit"/></primaryie></indexentry>
 		<indexentry><primaryie><link linkend="cmd_sect_expandtolabel" endterm="cmd_title_expandtolabel"/></primaryie></indexentry>
 	    </indexdiv>
 	    <indexdiv><title>f</title>
@@ -3048,6 +3046,8 @@
 		<indexentry><primaryie><link linkend="cmd_sect_insert_track" endterm="cmd_title_insert_track"/></primaryie></indexentry>
 	    </indexdiv>
 	    <indexdiv><title>l</title>
+		<indexentry><primaryie><link linkend="cmd_sect_label_add" endterm="cmd_title_label_add"/></primaryie></indexentry>
+		<indexentry><primaryie><link linkend="cmd_sect_label_delete" endterm="cmd_title_label_delete"/></primaryie></indexentry>
 		<indexentry><primaryie><link linkend="cmd_sect_loadbatch" endterm="cmd_title_loadbatch"/></primaryie></indexentry>
 		<indexentry><primaryie><link linkend="cmd_sect_loop" endterm="cmd_title_loop"/></primaryie></indexentry>
 	    </indexdiv>
@@ -3160,22 +3160,6 @@
 	</simplesect>
 	</sect2>
 
-	<!-- @COMMAND@ add_label(pos,[text]) -->
-	<sect2 id="cmd_sect_add_label"><title id="cmd_title_add_label">&no-i18n-cmd_add_label;</title>
-	<simplesect>
-	    <title>&i18n-cmd_syntax;<command>&no-i18n-cmd_add_label;</command>(<replaceable>pos</replaceable>[,<replaceable>text</replaceable>])</title>
-	    <para>
-		Add a new label at a given position. If the given position already
-		contains a label, then this command does nothing. The label can
-		be given an optional description.
-	    </para>
-	</simplesect>
-	<simplesect><title>Parameters</title><informaltable frame='none'><tgroup cols='2'><tbody>
-	    <row><entry><parameter>pos</parameter>:</entry><entry>position in samples where to insert the label</entry></row>
-	    <row><entry><parameter>text</parameter>:</entry><entry>some descriptive text (optional)</entry></row>
-	</tbody></tgroup></informaltable></simplesect>
-	</sect2>
-
 	<!-- @COMMAND@ add_track() -->
 	<sect2 id="cmd_sect_add_track"><title id="cmd_title_add_track">&no-i18n-cmd_add_track;</title>
 	<simplesect>
@@ -3333,24 +3317,10 @@
 	</simplesect>
 	</sect2>
 
-	<!-- @COMMAND@ delete_label(index) -->
-	<sect2 id="cmd_sect_delete_label"><title id="cmd_title_delete_label">&no-i18n-cmd_delete_label;</title>
-	<simplesect>
-	    <title>&i18n-cmd_syntax;<command>&no-i18n-cmd_delete_label;</command>(<replaceable>index</replaceable>)</title>
-	    <para>
-		Deletes a label, identified by its index (starting from zero).
-		If no label with the given index exists, this command does nothing.
-	    </para>
-	</simplesect>
-	<simplesect><title>Parameters</title><informaltable frame='none'><tgroup cols='2'><tbody>
-	    <row><entry><parameter>index</parameter>:</entry><entry>index of the label to delete, starting with 0</entry></row>
-	</tbody></tgroup></informaltable></simplesect>
-	</sect2>
-
 	<!-- @COMMAND@ delete_track(index) -->
 	<sect2 id="cmd_sect_delete_track"><title id="cmd_title_delete_track">&no-i18n-cmd_delete_track;</title>
 	<simplesect>
-	    <title>&i18n-cmd_syntax;<command>&no-i18n-cmd_delete_label;</command>(<replaceable>index</replaceable>)</title>
+	    <title>&i18n-cmd_syntax;<command>&no-i18n-cmd_label_delete;</command>(<replaceable>index</replaceable>)</title>
 	    <para>
 		Deletes a track, identified by its index (starting from zero).
 		If no track with the given index exists, this command exits with an error.
@@ -3376,33 +3346,6 @@
 
     <sect1 id="commands_e"><title>&no-i18n-tag;e</title>
 
-	<!-- @COMMAND@ edit_label(index) -->
-	<sect2 id="cmd_sect_edit_label"><title id="cmd_title_edit_label">&no-i18n-cmd_edit_label;</title>
-	<screenshot>
-	    <screeninfo>Screenshot</screeninfo>
-	    <mediaobject>
-		<imageobject>
-		    <imagedata fileref="kwave-edit-label.png" format="PNG"/>
-		</imageobject>
-		<textobject>
-		    <phrase>Screenshot of the label editing dialog</phrase>
-		</textobject>
-	    </mediaobject>
-	</screenshot>
-	<simplesect>
-	    <title>&i18n-cmd_syntax;<command>&no-i18n-cmd_edit_label;</command>(<replaceable>index</replaceable>)</title>
-	    <para>
-		Opens a window in which the user can edit the position and the
-		description of a label, which is identified by its index
-		(starting from zero). If no label with the given index exists,
-		this command does nothing.
-	    </para>
-	</simplesect>
-	<simplesect><title>Parameters</title><informaltable frame='none'><tgroup cols='2'><tbody>
-	    <row><entry><parameter>index</parameter>:</entry><entry>index of the label to edit, starting with 0</entry></row>
-	</tbody></tgroup></informaltable></simplesect>
-	</sect2>
-
 	<!-- @COMMAND@ expandtolabel() -->
 	<sect2 id="cmd_sect_expandtolabel"><title id="cmd_title_expandtolabel">&no-i18n-cmd_expandtolabel;</title>
 	<simplesect>
@@ -3519,6 +3462,63 @@
 
     <sect1 id="commands_l"><title>&no-i18n-tag;l</title>
 
+	<!-- @COMMAND@ label:add(pos,[text]) -->
+	<sect2 id="cmd_sect_label_add"><title id="cmd_title_label_add">&no-i18n-cmd_label_add;</title>
+	    <simplesect>
+		<title>&i18n-cmd_syntax;<command>&no-i18n-cmd_label_add;</command>(<replaceable>pos</replaceable>[,<replaceable>text</replaceable>])</title>
+		<para>
+		    Add a new label at a given position. If the given position already
+		    contains a label, then this command does nothing. The label can
+		    be given an optional description.
+		</para>
+	    </simplesect>
+	    <simplesect><title>Parameters</title><informaltable frame='none'><tgroup cols='2'><tbody>
+			    <row><entry><parameter>pos</parameter>:</entry><entry>position in samples where to insert the label</entry></row>
+			    <row><entry><parameter>text</parameter>:</entry><entry>some descriptive text (optional)</entry></row>
+			    </tbody></tgroup></informaltable></simplesect>
+	</sect2>
+
+	<!-- @COMMAND@ label:delete(index) -->
+	<sect2 id="cmd_sect_label_delete"><title id="cmd_title_label_delete">&no-i18n-cmd_label_delete;</title>
+	    <simplesect>
+		<title>&i18n-cmd_syntax;<command>&no-i18n-cmd_label_delete;</command>(<replaceable>index</replaceable>)</title>
+		<para>
+		    Deletes a label, identified by its index (starting from zero).
+		    If no label with the given index exists, this command does nothing.
+		</para>
+	    </simplesect>
+	    <simplesect><title>Parameters</title><informaltable frame='none'><tgroup cols='2'><tbody>
+			    <row><entry><parameter>index</parameter>:</entry><entry>index of the label to delete, starting with 0</entry></row>
+			    </tbody></tgroup></informaltable></simplesect>
+	</sect2>
+
+	<!-- @COMMAND@ label:edit(index) -->
+	<sect2 id="cmd_sect_label_edit"><title id="cmd_title_label_edit">&no-i18n-cmd_label_edit;</title>
+	    <screenshot>
+		<screeninfo>Screenshot</screeninfo>
+		<mediaobject>
+		    <imageobject>
+			<imagedata fileref="kwave-edit-label.png" format="PNG"/>
+		    </imageobject>
+		    <textobject>
+			<phrase>Screenshot of the label editing dialog</phrase>
+		    </textobject>
+		</mediaobject>
+	    </screenshot>
+	    <simplesect>
+		<title>&i18n-cmd_syntax;<command>&no-i18n-cmd_label_edit;</command>(<replaceable>index</replaceable>)</title>
+		<para>
+		    Opens a window in which the user can edit the position and the
+		    description of a label, which is identified by its index
+		    (starting from zero). If no label with the given index exists,
+		    this command does nothing.
+		</para>
+	    </simplesect>
+	    <simplesect><title>Parameters</title><informaltable frame='none'><tgroup cols='2'><tbody>
+			    <row><entry><parameter>index</parameter>:</entry><entry>index of the label to edit, starting with 0</entry></row>
+			    </tbody></tgroup></informaltable></simplesect>
+	</sect2>
+
 	<!-- @COMMAND@ loadbatch(filename) -->
 	<sect2 id="cmd_sect_loadbatch"><title id="cmd_title_loadbatch">&no-i18n-cmd_loadbatch;</title>
 	<simplesect>
diff --git a/kwave/MainWidget.cpp b/kwave/MainWidget.cpp
index b8f71f69..69172fc1 100644
--- a/kwave/MainWidget.cpp
+++ b/kwave/MainWidget.cpp
@@ -462,7 +462,7 @@ int Kwave::MainWidget::executeCommand(const QString &command)
 	signal_manager->selectRange(m_offset, 0);
 
     // label handling
-    CASE_COMMAND("add_label")
+    CASE_COMMAND("label:add")
 	sample_index_t pos = parser.toSampleIndex();
 	if (!parser.isDone()) {
 	    // 2 parameters: position + description
@@ -472,7 +472,7 @@ int Kwave::MainWidget::executeCommand(const QString &command)
 	    // 1 parameter only: open dialog for editing the description
 	    addLabel(pos, QString());
 	}
-    CASE_COMMAND("edit_label")
+    CASE_COMMAND("label:edit")
 	int index = parser.toInt();
 	Kwave::LabelList labels(signal_manager->metaData());
 	if ((index >= labels.count()) || (index < 0))
@@ -480,23 +480,16 @@ int Kwave::MainWidget::executeCommand(const QString &command)
 	Kwave::Label label = labels.at(index);
 	labelProperties(label);
 
-//    CASE_COMMAND("chooselabel")
-//	Kwave::Parser parser(command);
-//	markertype = globals.markertypes.at(parser.toInt());
-//    CASE_COMMAND("amptolabel")
-//	markSignal(command);
-//    CASE_COMMAND("pitch")
-//	markPeriods(command);
-//    CASE_COMMAND("labeltopitch")
-//      convertMarkstoPitch(command);
-//    CASE_COMMAND("loadlabel")  -> plugin
+//    CASE_COMMAND("label:load")
 //	loadLabel();
-//    CASE_COMMAND("savelabel")  -> plugin
+//    CASE_COMMAND("label:save")
 //	saveLabel(command);
-//    CASE_COMMAND("markperiod")
+//    CASE_COMMAND("label:by_intensity")
+//	markSignal(command);
+//    CASE_COMMAND("label:to_pitch")
+//      convertMarkstoPitch(command);
+//    CASE_COMMAND("label:by_period")
 //	markPeriods(command);
-//    CASE_COMMAND("saveperiods")
-//	savePeriods();
 
     } else {
 	return (signal_manager) ?
@@ -923,24 +916,6 @@ void Kwave::MainWidget::addLabel(sample_index_t pos, const QString &description)
 // //	Kwave::Label *tmp;
 // //	LabelType *act;
 // //
-// //	const char *actstring = parser.getFirstParam();
-// //
-// //	while (actstring) {
-// //	    printf ("selecting %s\n", actstring);
-// //	    for (act = globals.markertypes.first(); act; act = globals.markertypes.next())
-// //		if (strcmp(act->name, actstring) == 0) {
-// //		    printf ("selected\n");
-// //		    act->selected = true;
-// //		    break;
-// //		}
-// //	    actstring = parser.getNextParam();
-// //	}
-// //
-// //	for (act = globals.markertypes.first(); act; act = globals.markertypes.next())
-// //	    //write out all selected label types
-// //	    if (act->selected)
-// //		fprintf (out, "%s\n", act->getCommand());
-// //
 // //	//ended writing of types, so go on with the labels...
 // //
 // //	for (tmp = labels().first(); tmp; tmp = labels().next())  //write out labels
diff --git a/kwave/TopWidget.cpp b/kwave/TopWidget.cpp
index 47cdf63b..0593d485 100644
--- a/kwave/TopWidget.cpp
+++ b/kwave/TopWidget.cpp
@@ -1324,7 +1324,7 @@ void Kwave::TopWidget::updateRecentFiles()
 
     foreach (const QString &file, m_application.recentFiles())
 	m_menu_manager->addNumberedMenuEntry(
-	    _("ID_FILE_OPEN_RECENT"), file);
+	    _("ID_FILE_OPEN_RECENT"), file, QString());
 
     // enable/disable the "clear" menu entry in Files / Open Recent
     m_menu_manager->setItemEnabled(_("ID_FILE_OPEN_RECENT_CLEAR"),
@@ -1384,7 +1384,8 @@ void Kwave::TopWidget::updateMenu()
 	    if (!context) continue;
 	    QString caption = context->windowCaption(false);
 	    if (!caption.length()) continue;
-	    m_menu_manager->addNumberedMenuEntry(_("ID_WINDOW_LIST"), caption);
+	    m_menu_manager->addNumberedMenuEntry(_("ID_WINDOW_LIST"),
+	        caption, QString());
 	    ++win_count;
 	}
 
@@ -1401,10 +1402,27 @@ void Kwave::TopWidget::updateMenu()
     m_menu_manager->setItemEnabled(_("@NOT_CLOSED"), have_file);
 
     // enable/disable all items that depend on having a label
+    // and update the label menu
     bool have_labels = false;
     if (signal_manager) {
 	Kwave::LabelList labels(signal_manager->metaData());
 	have_labels = !labels.isEmpty();
+
+	m_menu_manager->clearNumberedMenu(_("ID_LABEL_DELETE"));
+	unsigned int index = 0;
+	foreach (const Kwave::Label &label, labels) {
+	    QString name = label.name();
+
+	    QString desc = (name.length()) ?
+	    i18nc("list menu entry of a label, %1=index, %2=description/name",
+		  "#%1 (%2)", index, name) :
+		  i18nc("list menue entry of a label, "
+		        "without description, %1=index",
+			"#%1", index);
+	    m_menu_manager->addNumberedMenuEntry(
+	        _("ID_LABEL_DELETE"), desc, name.setNum(index));
+	    index++;
+	}
     }
     m_menu_manager->setItemEnabled(_("@LABELS"), have_labels);
 
@@ -1414,7 +1432,7 @@ void Kwave::TopWidget::updateMenu()
     QString buf;
     for (unsigned int i = 0; i < tracks; i++) {
 	m_menu_manager->addNumberedMenuEntry(
-	    _("ID_EDIT_TRACK_DELETE"), buf.setNum(i));
+	    _("ID_EDIT_TRACK_DELETE"), buf.setNum(i), buf.setNum(i));
     }
 
     // enable/disable all items that depend on having a signal
diff --git a/kwave/menus.config b/kwave/menus.config
index a655a557..4dfbe1ca 100644
--- a/kwave/menus.config
+++ b/kwave/menus.config
@@ -143,29 +143,20 @@ menu (ignore(),Record)
     menu (plugin:setup(record),Record/Prepare...)
     menu (plugin:setup(record,start_now),Record/Start Now!)
 
-# menu (ignore(),Labels/#group(@SIGNAL),,ID_LABELS)
-# menu (ignore(),Labels/#disabled)
-#    menu (label(),Labels/Add/#disabled,A)
-#    menu (deletelabel(),Labels/Delete/#disabled,D)
-#    menu (ignore(),Labels/#separator)
-#
+menu (ignore(),Labels/#group(@SIGNAL),,ID_LABELS)
+    menu (label:add(),Labels/Add.../#icon(list-add))
+    menu (label:delete(),Labels/Delete/#listmenu(ID_LABEL_DELETE, delete_label(%1)))
+    menu (label:delete(),Labels/Delete/-/#hidden) # workaround to protect the separator
+    menu (label:delete(),Labels/Delete/#group(@LABELS))
+    menu (label:delete(),Labels/Delete/#icon(list-remove))
+    menu (ignore(),Labels/Delete/#separator)
+    menu (label:load(),Labels/Load.../#icon(document-open))
+    menu (label:save(),Labels/Save.../#group(@LABELS))
+    menu (label:save(),Labels/Save.../#icon(document-save))
 #    menu (ignore(),Labels/Generate/#disabled)
-#        menu (dialog(amptolabel),Labels/Generate/Label by Intensity/#disabled)
-#        menu (dialog(pitch),Labels/Generate/Label by Period/#disabled)
-#        menu (loadlabel(),Labels/Load Labels.../#disabled)
-#        menu (insertlabel(),Labels/Insert Labels.../#disabled)
-#    menu (ignore(),Labels/#separator)
-#
-#    menu (ignore(),Labels/Save/#disabled)
-#        menu (dialog(savelabel),Labels/Save/Labels.../#disabled)
-#        menu (saveperiods(),Labels/Save/Periods.../#disabled)
-#    menu (ignore(),Labels/#separator)
-#
-#    menu (labeltopitch(),Labels/Convert Label Distance to Pitch/#disabled)
-#    menu (ignore(),Labels/#separator)
-#
-#    menu (dialog (labeltype),Labels/Create type/#disabled)
-#    menu (ignore(),Labels/Choose Type/#listmenu(ID_LABEL_LIST, label_choose(%1)),,ID_LABELS_TYPE)
+#        menu (label:by_intensity,Labels/Generate/Label by Intensity/#disabled)
+#        menu (label:by_period,Labels/Generate/Label by Period/#disabled)
+#    menu (label:to_pitch(),Labels/Convert Label Distance to Pitch/#disabled)
 
 menu (ignore(),Fx/#group(@SIGNAL),,ID_FX)
 #   menu (dialog (distort),Fx/Distort/#disabled,SHIFT+D)
diff --git a/libgui/LabelItem.cpp b/libgui/LabelItem.cpp
index 5a6766a1..87b7bc62 100644
--- a/libgui/LabelItem.cpp
+++ b/libgui/LabelItem.cpp
@@ -126,13 +126,13 @@ void Kwave::LabelItem::appendContextMenu(QMenu *parent)
 //***************************************************************************
 void Kwave::LabelItem::contextMenuLabelDelete()
 {
-    emit sigCommand(_("delete_label(%1)").arg(m_index));
+    emit sigCommand(_("label:delete(%1)").arg(m_index));
 }
 
 //***************************************************************************
 void Kwave::LabelItem::contextMenuLabelProperties()
 {
-    emit sigCommand(_("nomacro:edit_label(%1)").arg(m_index));
+    emit sigCommand(_("nomacro:label:edit(%1)").arg(m_index));
 }
 
 //***************************************************************************
diff --git a/libgui/MenuManager.cpp b/libgui/MenuManager.cpp
index 1a3c77da..16b8c0b3 100644
--- a/libgui/MenuManager.cpp
+++ b/libgui/MenuManager.cpp
@@ -220,7 +220,8 @@ void Kwave::MenuManager::clearNumberedMenu(const QString &uid)
 
 //***************************************************************************
 void Kwave::MenuManager::addNumberedMenuEntry(const QString &uid,
-                                              const QString &entry)
+                                              const QString &entry,
+                                              const QString &param)
 {
     Q_ASSERT(entry.length());
     if (!entry.length()) return;
@@ -229,10 +230,12 @@ void Kwave::MenuManager::addNumberedMenuEntry(const QString &uid,
     Kwave::MenuNode *node = (m_menu_root) ? m_menu_root->findUID(uid) : 0;
     Kwave::MenuNode *parent = (node) ? node->parentNode() : 0;
     if (parent) {
-	QString cmd     = node->command();
-	QString command = cmd.contains(_("%1")) ?
-	    cmd.arg(Kwave::Parser::escape(entry)) : cmd;
-	node->insertLeaf(entry, command, 0, uid);
+	QString cmd = node->command();
+	if (cmd.contains(_("%1"))) {
+	    QString p = (param.length()) ? param : entry;
+	    cmd = cmd.arg(Kwave::Parser::escape(p));
+	}
+	node->insertLeaf(entry, cmd, 0, uid);
     } else
 	qWarning("MenuManager: could not find numbered Menu '%s'", DBG(uid));
 
diff --git a/libgui/MenuManager.h b/libgui/MenuManager.h
index fc64d395..918f355a 100644
--- a/libgui/MenuManager.h
+++ b/libgui/MenuManager.h
@@ -75,8 +75,12 @@ namespace Kwave
 	 * Add an entry to a numbered menu
 	 * @param uid unique id string of the numbered menu
 	 * @param entry name of the new entry (non-localized)
+	 * @param param a parameter to use when the entry is
+	 *              activated (optional, pass QString() when using
+	 *              the text of the menu entry as parameter)
 	 */
-	void addNumberedMenuEntry(const QString &uid, const QString &entry);
+	void addNumberedMenuEntry(const QString &uid, const QString &entry,
+				  const QString &param);
 
 	/**
 	 * Selects an menu item within a group of menu items. All other
diff --git a/libgui/TrackView.cpp b/libgui/TrackView.cpp
index 899da1e7..5079a17e 100644
--- a/libgui/TrackView.cpp
+++ b/libgui/TrackView.cpp
@@ -229,7 +229,7 @@ void Kwave::TrackView::handleContextMenu(const QPoint &pos, QMenu *menu)
 //***************************************************************************
 void Kwave::TrackView::contextMenuLabelNew()
 {
-    emit sigCommand(_("add_label(%1)").arg(m_mouse_click_position));
+    emit sigCommand(_("label:add(%1)").arg(m_mouse_click_position));
 }
 
 //***************************************************************************
diff --git a/libkwave/SignalManager.cpp b/libkwave/SignalManager.cpp
index 426746f2..a21ad8e9 100644
--- a/libkwave/SignalManager.cpp
+++ b/libkwave/SignalManager.cpp
@@ -722,7 +722,7 @@ int Kwave::SignalManager::executeCommand(const QString &command)
 //	    }
 //	}
 
-    CASE_COMMAND("delete_label")
+    CASE_COMMAND("label:delete")
 	int index = parser.toInt();
 	deleteLabel(index, true);
 
diff --git a/scripts/create-testfile.kwave b/scripts/create-testfile.kwave
index 8f498ccb..0839696c 100644
--- a/scripts/create-testfile.kwave
+++ b/scripts/create-testfile.kwave
@@ -23,9 +23,9 @@ view:zoom_all()
 selectall()
 plugin:execute(normalize)
 add_track()
-add_label(10478, Beethoven - Symphony No. 5)
-add_label(151500, right)
-add_label(80000, middle)
+label:add(10478, Beethoven - Symphony No. 5)
+label:add(151500, right)
+label:add(80000, middle)
 select_track:off(1)
 copy()
 select_track:invert()
diff --git a/scripts/screenshots.kwave b/scripts/screenshots.kwave
index 1d6ec3c7..0de3ff83 100644
--- a/scripts/screenshots.kwave
+++ b/scripts/screenshots.kwave
@@ -129,7 +129,7 @@ main:
 edit-label:
     delayed(1000,window:screenshot(Kwave::LabelPropertiesWidget, /var/tmp/screenshots/${LANG}/kwave-edit-label.png))
     delayed(100,window:close(Kwave::LabelPropertiesWidget))
-    edit_label(0)
+    label:edit(0)
     sync()
 
 #


More information about the kde-doc-english mailing list