diff --git a/DMX-2.0/DMX-2.0.sln b/DMX-2.0/DMX-2.0.sln
new file mode 100644
index 0000000..d4878bd
--- /dev/null
+++ b/DMX-2.0/DMX-2.0.sln
@@ -0,0 +1,17 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DMX-2.0", "DMX-2.0.csproj", "{2CB55300-0A5B-4DFA-8984-B7EC4C455962}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {2CB55300-0A5B-4DFA-8984-B7EC4C455962}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2CB55300-0A5B-4DFA-8984-B7EC4C455962}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2CB55300-0A5B-4DFA-8984-B7EC4C455962}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2CB55300-0A5B-4DFA-8984-B7EC4C455962}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/DMX-2.0/MidiEventProvider.cs b/DMX-2.0/MidiEventProvider.cs
index b17b684..337a5f7 100644
--- a/DMX-2.0/MidiEventProvider.cs
+++ b/DMX-2.0/MidiEventProvider.cs
@@ -498,7 +498,7 @@ namespace DMX2
value = 255;
break;
case AlsaSeqLib.snd_seq_event_type_t.SND_SEQ_EVENT_PGMCHANGE:
- CurrentPage = (uint)evS.data_ev_ctrl.value;
+ //CurrentPage = (uint)evS.data_ev_ctrl.value;
continue;
case AlsaSeqLib.snd_seq_event_type_t.SND_SEQ_EVENT_PORT_START:
PortDetected(
diff --git a/DMX-2.0/SeqMidiUI.cs b/DMX-2.0/SeqMidiUI.cs
index da8c0d6..06c2710 100644
--- a/DMX-2.0/SeqMidiUI.cs
+++ b/DMX-2.0/SeqMidiUI.cs
@@ -33,8 +33,6 @@ namespace DMX2
ListStore lsEffets=null; /* liste des effets */
//TreeViewColumn nomCol; /* inutile dans le contexte macro */
- ListStore lsDest = null;
-
bool effetChange = false;
public void EffetChange ()
{
@@ -210,7 +208,10 @@ namespace DMX2
new ContextMenuHelper(frame1,RenamePopup);
new ContextMenuHelper(evBBox,CompteurPopup);
- /*lsDest = new ListStore(typeof(string));
+ txtPerif.Text = s.Destination;
+ btnPerif.Clicked += BtnPerif_Clicked;
+
+ /*lsDest = new ListStore(typeof(string));
lsDest.AppendValues("TEST 1");
lsDest.AppendValues("TEST 2");
@@ -219,11 +220,16 @@ namespace DMX2
cbDest.SetCellDataFunc(cbDest.Cells[0], HandleCellLayoutDataFunc);*/
- }
+ }
+
+ void BtnPerif_Clicked(object sender, EventArgs e)
+ {
+ sequenceur.Destination = txtPerif.Text;
+ }
- void CompteurPopup (object sender, ContextMenuEventArgs e)
+ void CompteurPopup (object sender, ContextMenuEventArgs e)
{
Menu m = new Menu();
diff --git a/DMX-2.0/SequenceurMidi.cs b/DMX-2.0/SequenceurMidi.cs
index 227b187..683960e 100644
--- a/DMX-2.0/SequenceurMidi.cs
+++ b/DMX-2.0/SequenceurMidi.cs
@@ -18,13 +18,13 @@
using System;
using System.Collections.Generic;
-using System.Xml;
using System.Collections.ObjectModel;
using System.Threading;
+using System.Xml;
namespace DMX2
{
- public class SequenceurMidi : Sequenceur , IDisposable
+ public class SequenceurMidi : Sequenceur , IDisposable
{
public class Ligne {
public Ligne(){}
@@ -108,23 +108,10 @@ namespace DMX2
AlsaSeqLib.MidiPort midiport;
static int portnum=0;
- public class DestListItem {
- public DestListItem(string _name, AlsaSeqLib.Port _port){
- name = _name;
- port = _port;
- }
- string name;
- public string Name{
- get { return name; }
- }
- AlsaSeqLib.Port port;
- public AlsaSeqLib.Port Port{
- get { return port; }
- }
- }
+
- DestListItem destination;
- public DestListItem Destination
+ String destination;
+ public String Destination
{
get{
return destination;
@@ -252,12 +239,23 @@ namespace DMX2
return 0;
}
- public override void Tick (TimeSpan time)
+ TimeSpan autoconnectTimer = TimeSpan.Zero;
+ readonly TimeSpan acInterval = TimeSpan.FromSeconds(5);
+
+
+ public override void Tick (TimeSpan time)
{
if (paused)
return;
timeStamp += time;
+ autoconnectTimer += time;
+ if (autoconnectTimer > acInterval)
+ {
+ AutoConnect();
+ autoconnectTimer = TimeSpan.Zero;
+ }
+
if (Monitor.TryEnter (this)) {
try {
while (topPresent &&(timeStamp >= topSuivant)) {
@@ -269,7 +267,29 @@ namespace DMX2
}
}
- public void LigneSuivante ()
+ private void AutoConnect()
+ {
+ if (Destination.Length < 3) return;
+ System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(
+ destination, System.Text.RegularExpressions.RegexOptions.Compiled | System.Text.RegularExpressions.RegexOptions.IgnoreCase
+ );
+ foreach (var cli in AlsaSeqLib.EnumClients())
+ {
+ foreach (var p in cli.Ports)
+ {
+ string fullportname = cli.Name + ':' + p.Name;
+ if (r.IsMatch (fullportname ))
+ {
+ // midiport.ConnectFrom(p);
+ midiport.ConnectTo(p);
+ }
+
+ }
+ }
+
+ }
+
+ public void LigneSuivante ()
{
lock (this) {
if(lignes.Count==0) return;
@@ -347,14 +367,14 @@ namespace DMX2
foreach (System.Text.RegularExpressions.Match match in matches) {
if (match.Groups [2].Success) {
- midiCh = int.Parse (match.Groups [2].Value);
+ midiCh = int.Parse (match.Groups [2].Value)-1;
continue;
}
if (match.Groups [4].Success) {
ev = new AlsaSeqLib.snd_seq_event_t ();
ev.type = AlsaSeqLib.snd_seq_event_type_t.SND_SEQ_EVENT_CONTROLLER;
ev.data_ev_ctrl.channel = (byte)midiCh;
- ev.data_ev_ctrl.param = uint.Parse (match.Groups [4].Value);
+ ev.data_ev_ctrl.param = uint.Parse (match.Groups [4].Value)-0;
ev.data_ev_ctrl.value = int.Parse (match.Groups [5].Value);
midiport.SendEvent (ev);
}
@@ -363,7 +383,7 @@ namespace DMX2
ev = new AlsaSeqLib.snd_seq_event_t ();
ev.type = AlsaSeqLib.snd_seq_event_type_t.SND_SEQ_EVENT_PGMCHANGE;
ev.data_ev_ctrl.channel = (byte)midiCh;
- ev.data_ev_ctrl.value = int.Parse (match.Groups [7].Value);
+ ev.data_ev_ctrl.value = int.Parse (match.Groups [7].Value)-1;
midiport.SendEvent (ev);
}
@@ -409,6 +429,7 @@ namespace DMX2
parent.AppendChild (el);
el.SetAttribute ("id", ID.ToString ());
el.SetAttribute ("name", Name);
+ el.SetAttribute("destination", Destination);
//el.SetAttribute ("master", master.ToString ());
xmlEl = parent.OwnerDocument.CreateElement ("EffetSuivant");
@@ -470,6 +491,7 @@ namespace DMX2
{
ID = int.Parse (el.GetAttribute ("id"));
Name = el.GetAttribute ("name");
+ Destination = el.TryGetAttribute("destination", String.Empty);
XmlElement xmlE;
diff --git a/DMX-2.0/gtk-gui/DMX2.SeqMidiUI.cs b/DMX-2.0/gtk-gui/DMX2.SeqMidiUI.cs
index c57243b..c8261c4 100644
--- a/DMX-2.0/gtk-gui/DMX2.SeqMidiUI.cs
+++ b/DMX-2.0/gtk-gui/DMX2.SeqMidiUI.cs
@@ -44,7 +44,13 @@ namespace DMX2
private global::Gtk.Label timeLabel;
- private global::Gtk.ComboBox cbDest;
+ private global::Gtk.HBox hbox3;
+
+ private global::Gtk.Label label1;
+
+ private global::Gtk.Entry txtPerif;
+
+ private global::Gtk.Button btnPerif;
private global::Gtk.Toolbar toolbar;
@@ -156,13 +162,41 @@ namespace DMX2
w7.Expand = false;
w7.Fill = false;
// Container child vbox3.Gtk.Box+BoxChild
- this.cbDest = global::Gtk.ComboBox.NewText();
- this.cbDest.Name = "cbDest";
- this.vbox3.Add(this.cbDest);
- global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox3[this.cbDest]));
- w8.Position = 1;
+ this.hbox3 = new global::Gtk.HBox();
+ this.hbox3.Name = "hbox3";
+ this.hbox3.Spacing = 6;
+ // Container child hbox3.Gtk.Box+BoxChild
+ this.label1 = new global::Gtk.Label();
+ this.label1.Name = "label1";
+ this.label1.LabelProp = "Nom du périphérique :";
+ this.hbox3.Add(this.label1);
+ global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.hbox3[this.label1]));
+ w8.Position = 0;
w8.Expand = false;
w8.Fill = false;
+ // Container child hbox3.Gtk.Box+BoxChild
+ this.txtPerif = new global::Gtk.Entry();
+ this.txtPerif.CanFocus = true;
+ this.txtPerif.Name = "txtPerif";
+ this.txtPerif.IsEditable = true;
+ this.txtPerif.InvisibleChar = '●';
+ this.hbox3.Add(this.txtPerif);
+ global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.hbox3[this.txtPerif]));
+ w9.Position = 1;
+ // Container child hbox3.Gtk.Box+BoxChild
+ this.btnPerif = new global::Gtk.Button();
+ this.btnPerif.CanFocus = true;
+ this.btnPerif.Name = "btnPerif";
+ this.btnPerif.UseUnderline = true;
+ this.btnPerif.Label = "Ok";
+ this.hbox3.Add(this.btnPerif);
+ global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.hbox3[this.btnPerif]));
+ w10.Position = 2;
+ w10.Expand = false;
+ w10.Fill = false;
+ this.vbox3.Add(this.hbox3);
+ global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.vbox3[this.hbox3]));
+ w11.Position = 1;
// Container child vbox3.Gtk.Box+BoxChild
this.UIManager.AddUiFromString(@"");
this.toolbar = ((global::Gtk.Toolbar)(this.UIManager.GetWidget("/toolbar")));
@@ -171,13 +205,13 @@ namespace DMX2
this.toolbar.ToolbarStyle = ((global::Gtk.ToolbarStyle)(0));
this.toolbar.IconSize = ((global::Gtk.IconSize)(2));
this.vbox3.Add(this.toolbar);
- global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.vbox3[this.toolbar]));
- w9.Position = 2;
- w9.Expand = false;
- w9.Fill = false;
+ global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(this.vbox3[this.toolbar]));
+ w12.Position = 2;
+ w12.Expand = false;
+ w12.Fill = false;
this.hbox1.Add(this.vbox3);
- global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.vbox3]));
- w10.Position = 0;
+ global::Gtk.Box.BoxChild w13 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.vbox3]));
+ w13.Position = 0;
// Container child hbox1.Gtk.Box+BoxChild
this.UIManager.AddUiFromString("<" +
"/toolbar>");
@@ -188,16 +222,16 @@ namespace DMX2
this.toolbar1.ToolbarStyle = ((global::Gtk.ToolbarStyle)(0));
this.toolbar1.IconSize = ((global::Gtk.IconSize)(2));
this.hbox1.Add(this.toolbar1);
- global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.toolbar1]));
- w11.PackType = ((global::Gtk.PackType)(1));
- w11.Position = 1;
- w11.Expand = false;
- w11.Fill = false;
+ global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.toolbar1]));
+ w14.PackType = ((global::Gtk.PackType)(1));
+ w14.Position = 1;
+ w14.Expand = false;
+ w14.Fill = false;
this.vbox2.Add(this.hbox1);
- global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.hbox1]));
- w12.Position = 0;
- w12.Expand = false;
- w12.Fill = false;
+ global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.hbox1]));
+ w15.Position = 0;
+ w15.Expand = false;
+ w15.Fill = false;
// Container child vbox2.Gtk.Box+BoxChild
this.scrolledwindow1 = new global::Gtk.ScrolledWindow();
this.scrolledwindow1.CanFocus = true;
@@ -210,8 +244,8 @@ namespace DMX2
this.cmdList.RulesHint = true;
this.scrolledwindow1.Add(this.cmdList);
this.vbox2.Add(this.scrolledwindow1);
- global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.scrolledwindow1]));
- w14.Position = 1;
+ global::Gtk.Box.BoxChild w17 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.scrolledwindow1]));
+ w17.Position = 1;
// Container child vbox2.Gtk.Box+BoxChild
this.lblText = new global::Gtk.Label();
this.lblText.Name = "lblText";
@@ -220,10 +254,10 @@ namespace DMX2
"(ex: N64+127 ou N12-)\nGT : Go To (ex: GT4)\nr: loop";
this.lblText.UseMarkup = true;
this.vbox2.Add(this.lblText);
- global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.lblText]));
- w15.Position = 2;
- w15.Expand = false;
- w15.Fill = false;
+ global::Gtk.Box.BoxChild w18 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.lblText]));
+ w18.Position = 2;
+ w18.Expand = false;
+ w18.Fill = false;
this.alignment1.Add(this.vbox2);
this.GtkAlignment.Add(this.alignment1);
this.frame1.Add(this.GtkAlignment);
diff --git a/DMX-2.0/gtk-gui/gui.stetic b/DMX-2.0/gtk-gui/gui.stetic
index cd2d6e5..886c62e 100644
--- a/DMX-2.0/gtk-gui/gui.stetic
+++ b/DMX-2.0/gtk-gui/gui.stetic
@@ -5,7 +5,7 @@
2.12
-
+
@@ -2168,7 +2168,7 @@ au sequenceur
- label1
+ Nom du périphérique :
0
@@ -2178,20 +2178,24 @@ au sequenceur
-
+
- True
-
+ True
+ True
+ ●
1
- False
+ True
-
+
- label2
+ True
+ TextOnly
+ Ok
+ True
2