[gme-users] Decorators in Windows.Forms.

Vamshi Raghu vamshi.raghu at MAIL.MCGILL.CA
Fri Apr 22 15:15:22 CDT 2005


Thanks a lot for such a responsive and useful list! I must say I'm 
enjoying tinkering with GME the past few months.
I'm considering using it to build a prototype 
music-authoring/content-management tool, which supports arbitrarily 
complex end-user programming/configuration at different abstraction 
levels (composition level, sensor level, signal level) via 
metaprogramming ... im interested in using Windows.Forms as I would like 
the GUI to be web based (to facilitate community driven activities like 
sharing, referencing, composition and specialization of music building 
blocks a.k.a "licks"). GME and VSTS Team System (esp features like the 
DSL environment supposedly in the 2005 Beta 2) seemed like good starting 
points. I haven't had the chance to try VSTS yet, and there is interest 
in GME here at McGill (I was referred to it by Hans Vangheluwe).
Would having a web based interface require me to relinquish using the 
GME GUI altogether and operate at the MGA library level? Or is there a 
way out?
Anyway, it's been GReAT so far (sure u'r used to that now :D), thanks 
for the help and any pointers would be greatly appreciated.
Thanks!
-Vamshi

Peter Volgyesi wrote:

>Hi,
>
>Although you can implement custom decorators as managed  components, you
>will encounter several minor problems.  Our idl files (type libraries) are
>not tested rigorously with managed code. You can overcome many of the
>problems by disassembling the generated (tlbimp) wrappers, slighlty modify
>them and reassemble again.
>I've attached the most basic custom decorator I could come up with. Even for
>this one, I had to modify the MgaDecorator and Mga wrappers and change
> - the MgaFCOs class to have a public (not assembly) constructor
> - the IMgaDecorator:Draw method to pass the hDC parameter as an int32 value
>
>--
>Peter Volgyesi
>ISIS, Vanderbilt University
>
>  
>
>>-----Original Message-----
>>From: gme-users-bounces at list.isis.vanderbilt.edu 
>>[mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf 
>>Of Vamshi Raghu
>>Sent: Thursday, April 21, 2005 4:54 PM
>>To: gme-users at list.isis.vanderbilt.edu
>>Subject: [gme-users] Decorators in Windows.Forms.
>>
>>Hi!
>>Can a decorator be written using "managed" components? If so, 
>>any pointers to information on where to find out how to 
>>expose the .NET equivalent of a custom control as a COM 
>>component implementing IMgaDecorator? Is there a 
>>gme-developers list or equivalent?
>>Thanks in advance!
>>-Vamshi
>>
>>_______________________________________________
>>gme-users mailing list
>>gme-users at list.isis.vanderbilt.edu
>>http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
>>    
>>
>>------------------------------------------------------------------------
>>
>>using System;
>>using MGADECORATORLib;
>>using MGALib;
>>using System.Windows.Forms;
>>using System.Drawing;
>>using System.Drawing.Drawing2D;
>>using System.Drawing.Imaging;
>>using System.Drawing.Text;
>>
>>
>>namespace Decorators
>>{
>>	/// <summary>
>>	/// Summary description for NETDecorator.
>>	/// </summary>
>>	public class NETDecorator : IMgaDecorator
>>	{
>>		public NETDecorator()
>>		{
>>			//
>>			// TODO: Add constructor logic here
>>			//
>>		}
>>	
>>		#region IMgaDecorator Members
>>
>>		public void GetLabelLocation(out int sx, out int sy, out int ex, out int ey)
>>		{
>>			// TODO:  Add NETDecorator.GetLabelLocation implementation
>>			sx = 0;
>>			sy = 0;
>>			ex = 0;
>>			ey = 0;
>>		}
>>
>>		public void GetFeatures(out uint features)
>>		{
>>			// TODO:  Add NETDecorator.GetFeatures implementation
>>			features = 0;
>>		}
>>
>>		public void SetLocation(int sx, int sy, int ex, int ey)
>>		{
>>			m_sx = sx;
>>			m_sy = sy;
>>			m_ex = ex;
>>			m_ey = ey;
>>		}
>>
>>		public void SetActive(bool isActive)
>>		{
>>			// TODO:  Add NETDecorator.SetActive implementation
>>		}
>>
>>		public void SetParam(string Name, object Value)
>>		{
>>			// TODO:  Add NETDecorator.SetParam implementation
>>		}
>>
>>		public void Destroy()
>>		{
>>			// TODO:  Add NETDecorator.Destroy implementation
>>		}
>>
>>		public void GetLocation(out int sx, out int sy, out int ex, out int ey)
>>		{
>>			// TODO:  Add NETDecorator.GetLocation implementation
>>			sx = m_sx;
>>			sy = m_sy;
>>			ex = m_ex;
>>			ey = m_ey;
>>		}
>>
>>		public void GetPortLocation(MGADECORATORLib.IMgaFCO FCO, out int sx, out int sy, out int ex, out int ey)
>>		{
>>			// TODO:  Add NETDecorator.GetPortLocation implementation
>>			sx = 0;
>>			sy = 0;
>>			ex = 0;
>>			ey = 0;
>>		}
>>
>>		public void Initialize(MGADECORATORLib.IMgaProject Project, IMgaMetaPart Meta, MGADECORATORLib.IMgaFCO obj)
>>		{
>>			// TODO:  Add NETDecorator.Initialize implementation
>>		}
>>
>>		public void GetMnemonic(out string mnemonic)
>>		{
>>			// TODO:  Add NETDecorator.GetMnemonic implementation
>>			mnemonic = "NETDecorator";
>>		}
>>
>>		public void GetParam(string Name, out object Value)
>>		{
>>			// TODO:  Add NETDecorator.GetParam implementation
>>			Value = null;
>>		}
>>
>>		public MGADECORATORLib.IMgaFCOs GetPorts()
>>		{
>>			// TODO:  Add NETDecorator.GetPorts implementation
>>			MGADECORATORLib.IMgaFCOs ports = (MGADECORATORLib.IMgaFCOs)new MGALib.MgaFCOsClass();
>>			return ports;
>>		}
>>
>>		public void SaveState()
>>		{
>>			// TODO:  Add NETDecorator.SaveState implementation
>>		}
>>
>>		public void Draw(System.Int32 hdc)
>>		{
>>			Graphics g = Graphics.FromHdc((System.IntPtr)hdc);
>>			Pen blackPen = new Pen(Color.Black, 3);
>>			g.DrawRectangle(blackPen, m_sx, m_sy, m_ex-m_sx, m_ey-m_sy);
>>			g.Dispose();
>>		}
>>
>>		public void GetPreferredSize(out int sizex, out int sizey)
>>		{
>>			// TODO:  Add NETDecorator.GetPreferredSize implementation
>>			sizex = 100;
>>			sizey = 100;
>>		}
>>
>>		#endregion
>>
>>		private int m_sx;
>>		private int m_sy;
>>		private int m_ex;
>>		private int m_ey;
>>	}
>>}
>>    
>>
>>------------------------------------------------------------------------
>>
>>_______________________________________________
>>gme-users mailing list
>>gme-users at list.isis.vanderbilt.edu
>>http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
>>    
>>




More information about the gme-users mailing list