Ajout dialogue sauvegarde et declaration des fonctions

This commit is contained in:
tzim 2013-10-02 08:12:56 +00:00
parent 453b8ddd1a
commit aaa450523a
8 changed files with 101 additions and 10 deletions

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Collections.ObjectModel;
using System.Threading;
using System.Xml;
namespace DMX2
@ -179,6 +180,25 @@ namespace DMX2
}
#endregion
#region Sauvegarde
public XmlDocument Save ()
{
XmlDocument doc = new XmlDocument();
return doc;
}
public static Conduite Load (XmlDocument doc)
{
return null;
}
#endregion
}

View file

@ -2,6 +2,7 @@ using System;
using Gtk;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
namespace DMX2
@ -10,7 +11,8 @@ namespace DMX2
{
static MainWindow win;
static object circuitKey = new object();
ListStore lsMatrice;
ListStore lsMatrice = null;
FileInfo conduiteFile=null;
public static MainWindow Win {
get { return win; }
@ -338,7 +340,51 @@ namespace DMX2
}
protected void OnSaveActionActivated (object sender, EventArgs e)
{
if(conduiteFile==null)
SaveFileAs();
else
SaveFile();
}
protected void OnSaveAsActionActivated (object sender, EventArgs e)
{
SaveFileAs();
}
void SaveFileAs ()
{
FileChooserDialog fcd = new FileChooserDialog("Sauver sous ...",this,FileChooserAction.Save,
"Annuler",ResponseType.Cancel,
"Ouvrir",ResponseType.Accept);
fcd.Filter = new FileFilter();
fcd.Filter.AddPattern("*.dmx2");
if ((ResponseType)fcd.Run() == ResponseType.Cancel)
{
fcd.Destroy();
return;
}
string file = fcd.Filename;
if(!file.EndsWith(".dmx2"))
file+=".dmx2";
conduiteFile = new FileInfo(fcd.Filename);
if (conduiteFile.Exists);
fcd.Destroy();
}
void SaveFile()
{
if(conduiteFile==null)return;
}
}
}

View file

@ -371,7 +371,6 @@ namespace DMX2
protected void OnSeqMasterScaleValueChanged (object sender, EventArgs e)
{
if (fullUpdFlag)return;
sequenceur.Master = (int)(seqMasterScale.Value);
}

View file

@ -55,6 +55,9 @@ namespace DMX2
}
public abstract XmlElement Save ();
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Xml;
namespace DMX2
{
@ -55,5 +56,17 @@ namespace DMX2
{
lignes.Add(new Ligne());
}
public XmlElement Save ()
{
return null;
}
public static SequenceurMaitre Load (XmlElement doc)
{
return null;
}
}
}

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Xml;
namespace DMX2
{
@ -52,12 +53,6 @@ namespace DMX2
}
}
public void Save ()
{
}
public void Load ()
{
}
public void CalculUnivers(byte[] valeurs, int offset, int count)
{
@ -89,6 +84,17 @@ namespace DMX2
}
}
public XmlElement Save ()
{
return null;
}
public static UniversDMX Load (XmlElement doc)
{
return null;
}
}
}

View file

@ -375,6 +375,8 @@ namespace DMX2
this.DefaultHeight = 709;
this.Show ();
this.DeleteEvent += new global::Gtk.DeleteEventHandler (this.OnDeleteEvent);
this.saveAction.Activated += new global::System.EventHandler (this.OnSaveActionActivated);
this.saveAsAction.Activated += new global::System.EventHandler (this.OnSaveAsActionActivated);
this.quitAction.Activated += new global::System.EventHandler (this.OnQuitActionActivated);
this.closeAction.Activated += new global::System.EventHandler (this.OnCloseActionActivated);
this.circAction.Activated += new global::System.EventHandler (this.OnCircuitsActionActivated);

View file

@ -75,12 +75,14 @@
<property name="Label" translatable="yes" />
<property name="Sensitive">False</property>
<property name="StockId">gtk-save</property>
<signal name="Activated" handler="OnSaveActionActivated" />
</action>
<action id="saveAsAction">
<property name="Type">Action</property>
<property name="Label" translatable="yes" />
<property name="Sensitive">False</property>
<property name="StockId">gtk-save-as</property>
<signal name="Activated" handler="OnSaveAsActionActivated" />
</action>
<action id="quitAction">
<property name="Type">Action</property>