[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso resources/keymap.xml src/core/InputEng...
From: |
Remon Sijrier |
Subject: |
[Traverso-commit] traverso resources/keymap.xml src/core/InputEng... |
Date: |
Thu, 12 Apr 2007 18:08:26 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Remon Sijrier <r_sijrier> 07/04/12 18:08:26
Modified files:
resources : keymap.xml
src/core : InputEngine.cpp InputEngine.h
src/traverso : Interface.cpp
Log message:
* Actions using modifier keys added to context menu
Modifier key actions obviously don't work from context menu's though :)
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/resources/keymap.xml?cvsroot=traverso&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/InputEngine.cpp?cvsroot=traverso&r1=1.45&r2=1.46
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/InputEngine.h?cvsroot=traverso&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/Interface.cpp?cvsroot=traverso&r1=1.59&r2=1.60
Patches:
Index: resources/keymap.xml
===================================================================
RCS file: /sources/traverso/traverso/resources/keymap.xml,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- resources/keymap.xml 12 Apr 2007 13:39:11 -0000 1.54
+++ resources/keymap.xml 12 Apr 2007 18:08:26 -0000 1.55
@@ -211,7 +211,6 @@
<Object objectname="DragNode"
slotsignature="move_up" modes="CurveMode" instantanious="1" />
<Object objectname="SongView"
slotsignature="scroll_up" modes="All" sortorder="1" submenu="Scroll"
instantanious="1" />
<Object objectname="Gain"
slotsignature="increase_gain" modes="All" instantanious="1" />
- <Object objectname="MoveClip"
slotsignature="prev_snap_pos" modes="All" sortorder="2" instantanious="1" />
<Object objectname="TrackPanelPan"
slotsignature="pan_right" modes="All" sortorder="1" instantanious="1" />
<Object objectname="TrackPanelGain"
slotsignature="gain_increment" modes="All" sortorder="1" instantanious="1" />
</Objects>
@@ -221,7 +220,6 @@
<Object objectname="DragNode"
slotsignature="move_down" modes="CurveMode" instantanious="1" />
<Object objectname="SongView"
slotsignature="scroll_down" modes="All" sortorder="2" submenu="Scroll"
instantanious="1" />
<Object objectname="Gain"
slotsignature="decrease_gain" modes="All" instantanious="1" />
- <Object objectname="MoveClip"
slotsignature="next_snap_pos" modes="All" sortorder="1" instantanious="1" />
<Object objectname="TrackPanelPan"
slotsignature="pan_left" modes="All" sortorder="2" instantanious="1" />
<Object objectname="TrackPanelGain"
slotsignature="gain_decrement" modes="All" sortorder="2" instantanious="1" />
</Objects>
@@ -339,11 +337,6 @@
<Object objectname="Track"
slotsignature="silence_others" modes="All" sortorder="20" instantanious="0" />
</Objects>
</keyfact>
- <keyfact type="HKEY" key1="C" >
- <Objects>
- <Object objectname="AudioClipView"
mousehint="LRUD" modes="Edit" sortorder="9" pluginname="TraversoCommands"
commandname="CopyClip" arguments="copy" />
- </Objects>
- </keyfact>
<keyfact type="HKEY" key1="MouseButtonLeft" >
<Objects>
<Object objectname="AudioClipView"
mousehint="LRUD" modes="All" pluginname="TraversoCommands"
commandname="MoveClip" arguments="move" />
@@ -355,6 +348,11 @@
<Object objectname="TrackPanelPan"
mousehint="LR" modes="All" sortorder="8" pluginname="TraversoCommands"
commandname="TrackPan" />
</Objects>
</keyfact>
+ <keyfact type="HKEY" key1="C" >
+ <Objects>
+ <Object objectname="AudioClipView"
mousehint="LRUD" modes="Edit" sortorder="9" pluginname="TraversoCommands"
commandname="CopyClip" arguments="copy" />
+ </Objects>
+ </keyfact>
<keyfact type="HKEY" key1="D" >
<Objects>
<Object objectname="AudioClipView"
mousehint="LRUD" modes="Edit" sortorder="3" pluginname="TraversoCommands"
commandname="MoveClip" arguments="move" />
Index: src/core/InputEngine.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/InputEngine.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- src/core/InputEngine.cpp 12 Apr 2007 17:06:57 -0000 1.45
+++ src/core/InputEngine.cpp 12 Apr 2007 18:08:26 -0000 1.46
@@ -241,16 +241,22 @@
}
}
+ if (keySequence.contains("++")) {
+ info().information(tr("Modifier key actions are not supported
from Context Menu"));
+ return -1;
+ }
+
if (! action) {
PERROR("ContextMenu keySequence doesn't apply to any
InputEngine knows off!! (%s)", QS_C(keySequence));
return -1;
}
- if ( action && (action->type == HOLDKEY) || (action->type == HKEY2) ) {
+ if ( action && (action->type == HOLDKEY) || (action->type == HKEY2)) {
info().information(tr("Hold actions are not supported from
Context Menu"));
return -1;
}
+
return broadcast_action(action, false, true);
}
@@ -1509,7 +1515,11 @@
for (int i=0; i<m_ieActions.size(); i++) {
IEAction* ieaction = m_ieActions.at(i);
- IEAction::Data* iedata =
ieaction->objects.value(classname);
+ QList<IEAction::Data*> datalist;
+ datalist.append(ieaction->objects.value(classname));
+
datalist.append(ieaction->objectUsingModifierKeys.value(classname));
+
+ foreach(IEAction::Data* iedata, datalist) {
if ( ! iedata ) {
continue;
@@ -1573,9 +1583,15 @@
menudata.iedata = ieaction->keySequence;
menudata.sortorder = iedata->sortorder;
menudata.submenu = iedata->submenu;
+ menudata.modifierkeys = iedata->modifierkeys;
+ if (menudata.modifierkeys.size()) {
+ menudata.iedata.prepend("++");
+ }
+
list.append(menudata);
}
+ }
contextitem = qobject_cast<ContextItem*>(item);
}
Index: src/core/InputEngine.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/InputEngine.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- src/core/InputEngine.h 12 Apr 2007 17:06:57 -0000 1.20
+++ src/core/InputEngine.h 12 Apr 2007 18:08:26 -0000 1.21
@@ -117,6 +117,7 @@
QString description;
QString submenu;
int sortorder;
+ QList<int > modifierkeys;
};
class InputEngine : public QObject
Index: src/traverso/Interface.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/Interface.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -b -r1.59 -r1.60
--- src/traverso/Interface.cpp 11 Apr 2007 15:56:35 -0000 1.59
+++ src/traverso/Interface.cpp 12 Apr 2007 18:08:26 -0000 1.60
@@ -510,6 +510,26 @@
return 0;
}
+QString create_keyfact_string(QString& keyfact, QList<int> modifiers)
+{
+ QString modifierkey = "";
+ foreach(int key, modifiers) {
+ if (key == Qt::Key_Alt) {
+ modifierkey += "ALT+";
+ } else if (key == Qt::Key_Control) {
+ modifierkey += "CTRL+";
+ } else {
+ QKeySequence seq(key);
+ modifierkey += seq.toString() + " +";
+ }
+ }
+ if (!modifierkey.isEmpty()) {
+ modifierkey.prepend("(");
+ modifierkey.append(")");
+ }
+ return modifierkey + " " + keyfact;
+}
+
QMenu* Interface::create_context_menu(QObject* item )
{
QMenu* menu = new QMenu();
@@ -541,7 +561,10 @@
// Merge entries with equall action, but different key facts.
for (int j=i+1; j<list.size(); ++j) {
if (list.at(j).description == data.description) {
- data.keysequence = data.keysequence + ", " +
list.at(j).keysequence;
+ QString mergestring = list.at(j).keysequence;
+ data.keysequence =
create_keyfact_string(data.keysequence, data.modifierkeys) +
+ " , " +
+
create_keyfact_string(mergestring, list.at(j).modifierkeys);
list.removeAt(j);
}
}
@@ -557,7 +580,8 @@
list = submenus.value(data.submenu);
list->append(data);
} else {
- QString text = QString(data.description + " " +
data.keysequence);
+ QString keyfact =
create_keyfact_string(data.keysequence, data.modifierkeys);
+ QString text = QString(data.description + " " +
keyfact);
QAction* action = new QAction(this);
action->setText(text);
action->setData(data.iedata);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Traverso-commit] traverso resources/keymap.xml src/core/InputEng...,
Remon Sijrier <=