Author: alanmc
Date: 2007-08-22 16:50:06 -0400 (Wed, 22 Aug 2007)
New Revision: 84662

Modified:
   trunk/lunareclipse/ChangeLog
   trunk/lunareclipse/View/MainWindow.cs
Log:
* View/MainWindow.cs: Now regenerating the PropertyPane only when
  necessary, otherwise updating existing widgets

Modified: trunk/lunareclipse/ChangeLog
===================================================================
--- trunk/lunareclipse/ChangeLog        2007-08-22 20:39:39 UTC (rev 84661)
+++ trunk/lunareclipse/ChangeLog        2007-08-22 20:50:06 UTC (rev 84662)
@@ -1,5 +1,10 @@
 2007-08-22  Alan McGovern <[EMAIL PROTECTED]> 
 
+       * View/MainWindow.cs: Now regenerating the PropertyPane only when 
necessary,
+         otherwise updating existing widgets
+
+2007-08-22  Alan McGovern <[EMAIL PROTECTED]> 
+
        * Model/StoryboardManager.cs: removed excess writelines and made the 
undos
          silent
 

Modified: trunk/lunareclipse/View/MainWindow.cs
===================================================================
--- trunk/lunareclipse/View/MainWindow.cs       2007-08-22 20:39:39 UTC (rev 
84661)
+++ trunk/lunareclipse/View/MainWindow.cs       2007-08-22 20:50:06 UTC (rev 
84662)
@@ -133,10 +133,16 @@
                                                this.undo.Sensitive = 
((UndoEngine)sender).UndoCount != 0;
                                        };
                                
-                               controller.PropertyManager.PropertiesUpdated += 
delegate {
-                                       UpdateProperties();
+                               controller.PropertyManager.SelectionChanged += 
delegate {
+                                       Console.WriteLine("Selection changed");
+                                       GeneratePropertyWidgets();
                                };
                                
+                               Toolbox.PropertyChanged += delegate (object 
sender, PropertyChangedEventArgs e) {
+                                       Console.WriteLine("Property changed");
+                                       UpdatePropertyWidget(e);
+                               };
+                               
                        }
                        else
                        {
@@ -144,8 +150,29 @@
                        }
         }
                
-               private void UpdateProperties()
+               private void UpdatePropertyWidget(PropertyChangedEventArgs e)
                {
+                       if(e.Target != 
controller.PropertyManager.SelectedObject.Child)
+                               return;
+                       
+                       PropertyData data = 
LunarEclipse.Serialization.ReflectionHelper.GetData(e.Property);
+                       foreach(HBox box in propertyPane.Children)
+                       {
+                               if(((Label)box.Children[0]).Text == 
data.ShortName)
+                               {
+                                       if(box.Children[1] is SpinButton)
+                                               
((SpinButton)box.Children[1]).Value = Convert.ToDouble(e.NewValue);
+                                       
+                                       else if(box.Children[1] is ComboBox)
+                                               
((ComboBox)box.Children[1]).Active = Convert.ToInt32(e.NewValue);
+                                       else
+                                               Console.WriteLine("Couldn't 
Update");
+                               }
+                       }
+               }
+               
+               private void GeneratePropertyWidgets()
+               {
                        propertyPane.FreezeChildNotify();
                        
                    Widget[] widgets = (Widget[])propertyPane.Children.Clone();

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to