Commit 27ae872f by Pascal Bigot

--no commit message

parent 8d944ba2
......@@ -21,14 +21,6 @@ namespace CommonLib
// message notifiant le renomage (symbol) d'un objet
MESS_ITEM_RENAMED,
// message indiquant que des paramètres ont changés
// utilisé pr mettre ajour le modified flag
MESS_CHANGE,
// Message spécifique a SmartCommand
// demande la mise a jour des controls en fonction de la donnée associée
MESS_UPDATE_FROM_DATA,
// message run mode Commande
MESS_CMD_RUN,
......
......@@ -21,6 +21,7 @@ namespace CommonLib
public delegate void DocumentModifiedEvent();
public delegate void RunStateChangeEvent(BTDoc doc);
public delegate void DocComStateChange(BTDoc doc);
public delegate void MessageTreat(BTDoc sender, MESSAGE Mess, object Param, TYPE_APP TypeApp);
/// <summary>
///
/// </summary>
......@@ -68,6 +69,8 @@ namespace CommonLib
public event NeedRefreshHMI UpdateDocumentFrame;
public event DocComStateChange OnCommStateChange;
public event RunStateChangeEvent OnRunStateChange;
public event MessageTreat BeforeMessageTreat;
public event MessageTreat EndMessageTreat;
#endregion
#region donnée spécifiques aux fonctionement en mode Command
......@@ -329,6 +332,8 @@ namespace CommonLib
/// <param name="TypeApp">type d'application </param>
public void TraiteMessage(MESSAGE Mess, object Param, TYPE_APP TypeApp)
{
if (BeforeMessageTreat != null)
BeforeMessageTreat(this, Mess, Param, TypeApp);
switch (Mess)
{
// les message suivant sont rerouté vers tout les objets
......@@ -365,15 +370,6 @@ namespace CommonLib
Modified = true;
}
break;
// ce message n'as pas a être transféré
case MESSAGE.MESS_CHANGE:
Modified = true;
break;
case MESSAGE.MESS_UPDATE_FROM_DATA:
// le message sera transféré du gestionaire, vers les ecrans,
// puis des ecrans vers les gestionaires de control, et donc vers les controles
GestScreen.TraiteMessage(Mess, Param, TypeApp);
break;
case MESSAGE.MESS_PRE_PARSE:
if (!m_Executer.PreParsedDone)
{
......@@ -384,6 +380,8 @@ namespace CommonLib
}
break;
}
if (EndMessageTreat != null)
EndMessageTreat(this, Mess, Param, TypeApp);
}
#endregion
......@@ -919,7 +917,7 @@ namespace CommonLib
/// <summary>
///
/// </summary>
public void BuildStatFileInfo()
public void BuildStatInfo()
{
int iNbData = m_GestData.Count;
int iNbScreen = m_GestScreen.Count;
......
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Xml;
using System.Windows.Forms;
namespace CommonLib
{
/// <summary>
///
/// </summary>
public class BridgeDoc : BaseDoc
{
/*
internal class DataBridgeInfo
SolutionGest m_solution;
List<DataBridgeInfo> m_ListDataBridge = new List<DataBridgeInfo>();
/// <summary>
///
/// </summary>
/// <param name="TypeApp"></param>
/// <param name="gestSolution"></param>
public BridgeDoc(TYPE_APP TypeApp, SolutionGest gestSolution) : base (TypeApp)
{
public string docSrc;
public string dataSrc;
public string docDst;
public string dataDst;
m_solution = gestSolution;
}
SolutionGest m_solution;*/
//List<DataBridgeInfo> m_ListDataBridge = new List<DataBridgeInfo>();
public List<DataBridgeInfo> DocumentBridges
{
get { return m_ListDataBridge; }
}
public BridgeDoc(TYPE_APP TypeApp) :base (TypeApp)
/// <summary>
///
/// </summary>
/// <param name="bShowError"></param>
/// <returns></returns>
public override bool WriteConfigDocument(bool bShowError)
{
return WriteOut(m_strfileFullName, bShowError);
}
/// <summary>
///
/// </summary>
/// <param name="filename"></param>
/// <returns></returns>
public bool ReadIn(string filename)
{
m_strfileFullName = filename;
XmlDocument XmlDoc = new XmlDocument();
try
{
XmlDoc.Load(filename);
}
catch (Exception e)
{
Traces.LogAddDebug(TraceCat.Document, "Le fichier est corrompu");
Console.WriteLine(e.Message);
return false;
}
XmlNode RootNode = XmlDoc.DocumentElement;
if (RootNode.Name != XML_CF_TAG.Root.ToString())
return false;
foreach (XmlNode Node in RootNode.ChildNodes)
{
if (Node.Name == "DataBridge")
{
DataBridgeInfo bridge = new DataBridgeInfo();
if (bridge.ReadIn(Node))
this.m_ListDataBridge.Add(bridge);
}
}
return true;
}
/// <summary>
///
/// </summary>
/// <param name="filename"></param>
/// <param name="bShowError"></param>
/// <returns></returns>
public bool WriteOut(string filename, bool bShowError)
{
m_strfileFullName = filename;
XmlDocument XmlDoc = new XmlDocument();
XmlDoc.LoadXml("<Root/>");
foreach (DataBridgeInfo bridge in m_ListDataBridge)
{
bridge.WriteOut(XmlDoc, XmlDoc.DocumentElement);
}
XmlDoc.Save(m_strfileFullName);
return true;
}
/// <summary>
///
/// </summary>
public void FinalizeRead()
{
foreach (DataBridgeInfo bridgeInfo in m_ListDataBridge)
{
bridgeInfo.FinalizeRead(m_solution);
}
}
/// <summary>
///
/// </summary>
/// <param name="Mess"></param>
/// <param name="Param"></param>
/// <param name="TypeApp"></param>
public void TraiteMessage(BTDoc sender, MESSAGE Mess, object Param, TYPE_APP TypeApp)
{
foreach (DataBridgeInfo bridgeInfo in m_ListDataBridge)
{
bridgeInfo.TraiteMessage(sender, Mess, Param, TypeApp);
}
switch (Mess)
{
// les message suivant sont rerouté vers tout les objets
case MESSAGE.MESS_ASK_ITEM_DELETE:
case MESSAGE.MESS_ITEM_DELETED:
case MESSAGE.MESS_ITEM_RENAMED:
case MESSAGE.MESS_CMD_RUN:
case MESSAGE.MESS_CMD_STOP:
case MESSAGE.MESS_PRE_PARSE:
break;
}
}
}
}
......@@ -82,6 +82,7 @@
<Compile Include="ConfigForms\TwoColorProperties.Designer.cs">
<DependentUpon>TwoColorProperties.cs</DependentUpon>
</Compile>
<Compile Include="DataBridgeInfo.cs" />
<Compile Include="Data\BaseObject.cs" />
<Compile Include="BTDoc.cs" />
<Compile Include="Data\BasePluginBTControl.cs" />
......
......@@ -16,6 +16,7 @@ namespace CommonLib
int m_iPeriod = 1000;
private bool m_bAutoStart = true;
#endregion
#region donnée spécifiques aux fonctionement en mode Command
......
......@@ -67,7 +67,7 @@ namespace CommonLib
/// <summary>
/// identifiant quickscript utilisé par les objets scriptables
/// </summary>
protected int m_iQuickScriptID;
protected int m_iQuickScriptID = -1;
#endregion
#region events
......@@ -138,7 +138,6 @@ namespace CommonLib
set { }
}
public int QuickScriptID
{
get
......@@ -237,7 +236,7 @@ namespace CommonLib
/// <param name="Mess">Type de message</param>
/// <param name="obj">objet contenant les paramètres du messages</param>
/// <param name="TypeApp">Type d'application courante</param>
public abstract void TraiteMessage(MESSAGE Mess, object obj, TYPE_APP TypeApp);
public virtual void TraiteMessage(MESSAGE Mess, object obj, TYPE_APP TypeApp) {}
/// <summary>
/// effectue l'envoie d'un message vers les objet s'étant enregistré comme récépeteur (i.e. les gestionnaires)
......
......@@ -87,18 +87,40 @@ namespace CommonLib
{
if (!this.ContainsKey(strFilePath))
{
BTDoc openedDoc = new BTDoc(m_TypeApp);
if (openedDoc.ReadConfigDocument(strFilePath, m_TypeApp, m_GestDLL))
if (Path.GetExtension(strFilePath) == ".saf")
{
openedDoc.BuildStatFileInfo();
this.Add(strFilePath, openedDoc);
Modified = true;
openedDoc.OnDocumentModified += new DocumentModifiedEvent(OnDocumentModified);
if (OnDocOpened != null)
BTDoc openedDoc = new BTDoc(m_TypeApp);
if (openedDoc.ReadConfigDocument(strFilePath, m_TypeApp, m_GestDLL))
{
OnDocOpened(openedDoc);
//openedDoc.BuildStatInfo();
this.Add(strFilePath, openedDoc);
Modified = true;
openedDoc.OnDocumentModified += new DocumentModifiedEvent(OnDocumentModified);
if (OnDocOpened != null)
{
OnDocOpened(openedDoc);
}
return openedDoc;
}
return openedDoc;
else
return null;
}
else if (Path.GetExtension(strFilePath) == ".sab")
{
BridgeDoc openedDoc = new BridgeDoc(m_TypeApp, this);
if (openedDoc.ReadIn(strFilePath))
{
this.Add(strFilePath, openedDoc);
Modified = true;
openedDoc.OnDocumentModified += new DocumentModifiedEvent(OnDocumentModified);
if (OnDocOpened != null)
{
OnDocOpened(openedDoc);
}
return openedDoc;
}
else
return null;
}
else
return null;
......@@ -121,6 +143,11 @@ namespace CommonLib
this.Add(doc.FileName, doc);
Modified = true;
doc.OnDocumentModified += new DocumentModifiedEvent(OnDocumentModified);
if (doc is BTDoc)
{
BTDoc btdoc = doc as BTDoc;
btdoc.EndMessageTreat += new MessageTreat(Doc_EndMessageTreat);
}
if (OnDocOpened != null)
{
OnDocOpened(doc);
......@@ -131,6 +158,26 @@ namespace CommonLib
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="Mess"></param>
/// <param name="Param"></param>
/// <param name="TypeApp"></param>
void Doc_EndMessageTreat(BTDoc sender, MESSAGE Mess, object Param, TYPE_APP TypeApp)
{
foreach (BaseDoc doc in this.Values)
{
if (doc is BridgeDoc)
{
BridgeDoc brdoc = doc as BridgeDoc;
brdoc.TraiteMessage(sender, Mess, Param, TypeApp);
}
}
}
/// <summary>
///
/// </summary>
void OnDocumentModified()
{
if (this.OnDocumentChanged != null)
......@@ -311,9 +358,7 @@ namespace CommonLib
{
foreach (BaseDoc doc in this.Values)
{
if (doc is BTDoc)
((BTDoc)doc).WriteConfigDocument(true);
doc.WriteConfigDocument(true);
doc.Modified = false;
}
}
......
......@@ -89,6 +89,11 @@ namespace CommonLib
public static Bitmap TreeViewIOIcon;
public static Icon TreeViewSolutionIcon;
public static Bitmap TreeViewBridgeIcon;
public static Bitmap SimpleArrowDown;
public static Bitmap SimpleArrowUp;
public static Bitmap SimpleArrowLeft;
public static Bitmap SimpleArrowRight;
public static void InitializeBitmap()
{
......@@ -156,6 +161,11 @@ namespace CommonLib
TreeViewIOIcon = NewBmpTrPath(strAppDir + "\\Res\\icon_io.png");
TreeViewSolutionIcon = NewIcoTrPath(strAppDir + "\\SmartAppSln.ico");
TreeViewBridgeIcon = NewBmpTrPath(strAppDir + "\\Res\\icon_bridge.png"); ;
SimpleArrowDown = NewBmpTrPath(strAppDir + "\\Res\\arrow-down.png"); ;
SimpleArrowUp = NewBmpTrPath(strAppDir + "\\Res\\arrow-up.png"); ;
SimpleArrowLeft = NewBmpTrPath(strAppDir + "\\Res\\arrow-left.png"); ;
SimpleArrowRight = NewBmpTrPath(strAppDir + "\\Res\\arrow-right.png"); ;
}
public static Bitmap NewBmpTrPath(string path)
......
......@@ -26,6 +26,7 @@ namespace CommonLib
}
public delegate void FrameRecievedDelegate(Trame frame);
public delegate void ScriptExecuted(int quickID);
public class QuickExecuter
{
......@@ -53,6 +54,8 @@ namespace CommonLib
//private event ScriptAddedToExecute EvScriptToExecute;
public event AddLogEventDelegate EventAddLogEvent;
public event FrameRecievedDelegate EventFrameRecieved;
public event ScriptExecuted EventScriptExecuted;
#endregion
#region cosntructeur / destructeur
......@@ -182,7 +185,6 @@ namespace CommonLib
while (m_PileScriptsToExecute.Count != 0 && !m_bStopRequested)
{
// on prend le script sans l'enlever afin de savoir qu'il n'est pas encore executé
//m_QueueMutex.WaitOne();
Object thisLock = new Object();
int QuickId = 0;
lock (thisLock)
......@@ -195,11 +197,14 @@ namespace CommonLib
InternalExecuteScript(QuickId);
// il est éxécuté, on l'enlève de la liste.
m_PileScriptsToExecute.Dequeue();
//m_QueueMutex.ReleaseMutex();
if (EventScriptExecuted != null)
EventScriptExecuted(QuickId);
Thread.Sleep(20);
}
theChrono.EndMeasure("ScriptExecuter");
Thread.Sleep(50);
Thread.Sleep(30);
} while (!m_bStopRequested);
m_bStopRequested = false;
}
......
......@@ -941,6 +941,18 @@
<Content Include="ImgLib\Voyant\VoyantVertOn.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Res\arrow-down.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Res\arrow-left.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Res\arrow-right.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Res\arrow-up.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Res\CxnOn.bmp">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
......
......@@ -129,6 +129,7 @@ namespace SmartApp.Ihm
if (m_InteractiveControlContainer.SelectionCount >= 1)
{
m_PropDialog.Document = m_Document;
m_PropDialog.CurrentScreen = this.CurrentScreen;
m_PropDialog.ConfiguredItem = m_InteractiveControlContainer.FirstSelected.SourceBTControl;
m_PropDialog.Initialize();
}
......
......@@ -1049,12 +1049,13 @@ namespace SmartApp.Ihm
if (m_GestSolution != null)
{
ProjectNameForm projNameFrm = new ProjectNameForm();
projNameFrm.IsBridgeDoc = true;
DialogResult dlgRes = projNameFrm.ShowDialog();
if (dlgRes == DialogResult.OK)
{
string bridgeName = Path.GetFileName(projNameFrm.ProjectName);
string projectPath = Path.GetDirectoryName(m_GestSolution.FilePath) + Path.DirectorySeparatorChar + bridgeName;
BridgeDoc newDoc = new BridgeDoc(Program.TypeApp);
BridgeDoc newDoc = new BridgeDoc(Program.TypeApp, m_GestSolution);
newDoc.WriteOut(projectPath, false);
m_GestSolution.AddDocument(newDoc);
newDoc.Modified = false;
......
......@@ -117,28 +117,4 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="colSrcProj.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSrcData.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDstProj.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDstData.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colScriptProj.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colScriptFunction.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colScriptProj.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colScriptFunction.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>
\ No newline at end of file
......@@ -11,6 +11,14 @@ namespace SmartApp.Ihm
{
public partial class ProjectNameForm : Form
{
bool m_bIsBridgeDoc = false;
public bool IsBridgeDoc
{
get { return m_bIsBridgeDoc; }
set { m_bIsBridgeDoc = value; }
}
public ProjectNameForm()
{
InitializeComponent();
......@@ -19,7 +27,7 @@ namespace SmartApp.Ihm
public string ProjectName
{
get { return textBox1.Text + ".saf"; }
get { return textBox1.Text + (m_bIsBridgeDoc? ".sab" : ".saf"); }
}
private void btnOK_Click(object sender, EventArgs e)
......
......@@ -24,6 +24,7 @@ namespace SmartApp
ContextMenuStrip m_CtxMenuObject = new ContextMenuStrip();
ContextMenuStrip m_CtxMenuTrame = new ContextMenuStrip();
ContextMenuStrip m_CtxMenuBridge = new ContextMenuStrip();
ContextMenuStrip m_CtxMenuBridgeItem = new ContextMenuStrip();
//ContextMenuStrip m_CtxMenuStrip = new ContextMenuStrip();
class DocumentElementNode
{
......@@ -81,7 +82,6 @@ namespace SmartApp
}
m_PropDialog = MDISmartConfigMain.GlobalPropDialog;
m_PropDialog.ObjectPropertiesChanged += new EventHandler(OnPropertiesDlgObjChangedNotified);
InitContextMenu();
}
......@@ -116,7 +116,10 @@ namespace SmartApp
m_CtxMenuBridge.Items.Add(item);
item = new ToolStripMenuItem(Program.LangSys.C("Configure Bridge"));
item.Click += new EventHandler(CtxMenuBridgeProperties_Click);
m_CtxMenuBridge.Items.Add(item);
m_CtxMenuBridgeItem.Items.Add(item);
item = new ToolStripMenuItem(Program.LangSys.C("Delete"));
item.Click += new EventHandler(CtxMenuObjectDelete_Click);
m_CtxMenuBridgeItem.Items.Add(item);
// menu pour un gestionnaire de group
item = new ToolStripMenuItem(Program.LangSys.C("Manage group"));
......@@ -184,11 +187,6 @@ namespace SmartApp
{
this.ContextMenuStrip = m_CtxMenuSolution;
}
// un objet quelconque
else if (selNode.Tag is BaseObject)
{
this.ContextMenuStrip = m_CtxMenuObject;
}
// un groupe
else if (selNode.Tag is BaseGestGroup.Group)
{
......@@ -221,6 +219,16 @@ namespace SmartApp
this.ContextMenuStrip = m_CtxMenuGest;
m_PropDialog.ConfiguredItem = null;
}
else if (selNode.Tag is DataBridgeInfo)
{
this.ContextMenuStrip = m_CtxMenuBridgeItem;
m_PropDialog.ConfiguredItem = null;
}
// un objet quelconque
else if (selNode.Tag is BaseObject)
{
this.ContextMenuStrip = m_CtxMenuObject;
}
else
{
this.ContextMenuStrip = null;
......@@ -645,6 +653,8 @@ namespace SmartApp
doc.OnDocumentModified += new DocumentModifiedEvent(OnDocumentModified);
docNode.DocNode.Expand();
m_SolutionNode.Expand();
m_chkViewTips.Checked = true;
m_chkViewTips.Checked = false;
}
/// <summary>
......@@ -684,6 +694,11 @@ namespace SmartApp
AddBaseGestNode(docName, doc.GestFunction, Program.LangSys.C("Functions"), "Function");
AddBaseGestNode(docName, doc.GestLogger, Program.LangSys.C("Loggers"), "Logger");
}
if (docElem.Document is BridgeDoc)
{
BridgeDoc doc = docElem.Document as BridgeDoc;
this.AddBridgeNode(docName, Program.LangSys.C("Data bridge"), "IO");
}
}
void SolutionNameChanged()
......@@ -716,6 +731,26 @@ namespace SmartApp
AddBaseGestContent(GestNode, gest, imageKey);
}
public void AddBridgeNode(string docName, string Label, string imageKey)
{
DocumentElementNode docElem = m_ListDocument[docName];
BridgeDoc doc = docElem.Document as BridgeDoc;
for (int i = 0; i < doc.DocumentBridges.Count; i++)
{
BaseObject item = doc.DocumentBridges[i];
if (item.IsUserVisible)
{
TreeNode ItemNode = new TreeNode(item.Symbol);
ItemNode.ImageKey = imageKey;
ItemNode.StateImageKey = imageKey;
ItemNode.SelectedImageKey = imageKey;
ItemNode.Tag = item;
ItemNode.ToolTipText = GetToolTipFromTag(item);
docElem.DocNode.Nodes.Add(ItemNode);
}
}
}
/// <summary>
/// Ajoute le contenu d'un gestionnaire de groupe dans l'arbre
/// </summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment