MouseLeave="{Background=Transparent}"/>
</HorizontalStack>
</ItemTemplate>
- <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetFileSystemInfos">
+ <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetFileSystemInfos">
<Expandable Caption="{Name}" >
<Template>
<VerticalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}">
<?xml version="1.0"?>
-<Border BorderWidth="1" Foreground="White" CornerRadius="{./CornerRadius}" Height="{./HeightPolicy}" Width="{./WidthPolicy}"
+<Border BorderWidth="1" Foreground="White" CornerRadius="{./CornerRadius}"
+ Background="{./Background}"
+ Height="{./HeightPolicy}" Width="{./WidthPolicy}"
MouseEnter="./onBorderMouseEnter"
MouseLeave="./onBorderMouseLeave">
<VerticalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}" Spacing="0">
#region Layouting
- #if DEBUG_LAYOUTING
- public List<LayoutingQueueItem> CurrentDrawLQIs = null;
- public List<List<LayoutingQueueItem>> LQIs = new List<List<LayoutingQueueItem>>();
- #endif
/// <summary> return size of content + margins </summary>
protected virtual int measureRawSize (LayoutingType lt) {
return lt == LayoutingType.Width ?
public virtual void OnLayoutChanges(LayoutingType layoutType)
{
#if DEBUG_LAYOUTING
- LayoutingQueueItem.currentLQI.Slot = LastSlots;
- LayoutingQueueItem.currentLQI.NewSlot = Slot;
+ CurrentInterface.currentLQI.Slot = LastSlots;
+ CurrentInterface.currentLQI.NewSlot = Slot;
#endif
switch (layoutType) {
return;
LastPaintedSlot = Slot;
- #if DEBUG_LAYOUTING
- if (CurrentDrawLQIs != null){
- LQIs.Add (CurrentDrawLQIs);
- CurrentDrawLQIs = null;
- }
- #endif
if (cacheEnabled) {
if (Slot.Width > Interface.MaxCacheSize || Slot.Height > Interface.MaxCacheSize)
public override void OnLayoutChanges (LayoutingType layoutType)
{
#if DEBUG_LAYOUTING
- LayoutingQueueItem.currentLQI.Slot = LastSlots;
- LayoutingQueueItem.currentLQI.Slot = Slot;
+ CurrentInterface.currentLQI.Slot = LastSlots;
+ CurrentInterface.currentLQI.Slot = Slot;
#endif
switch (layoutType) {
}
#endregion
-
+ #if DEBUG_LAYOUTING
+ public List<LQIList> LQIsTries = new List<LQIList>();
+ public LQIList curLQIsTries = new LQIList();
+ public List<LQIList> LQIs = new List<LQIList>();
+ public LQIList curLQIs = new LQIList();
+// public static LayoutingQueueItem[] MultipleRunsLQIs {
+// get { return curUpdateLQIs.Where(l=>l.LayoutingTries>2 || l.DiscardCount > 0).ToArray(); }
+// }
+ public LayoutingQueueItem currentLQI = null;
+ #endif
public void Update(){
if (mouseRepeatCount > 0) {
int mc = mouseRepeatCount;
processLayouting ();
+ #if DEBUG_LAYOUTING
+ if (curLQIsTries.Count > 0){
+ LQIsTries.Add(curLQIsTries);
+ curLQIsTries = new LQIList();
+ LQIs.Add(curLQIs);
+ curLQIs = new LQIList();
+ }
+ #endif
+
clippingRegistration ();
processDrawing ();
LayoutingQueueItem lqi = null;
while (LayoutingQueue.Count > 0) {
lqi = LayoutingQueue.Dequeue ();
+ #if DEBUG_LAYOUTING
+ currentLQI = lqi;
+ curLQIsTries.Add(currentLQI);
+ #endif
lqi.ProcessLayouting ();
+ #if DEBUG_LAYOUTING
+ currentLQI = null;
+ #endif
}
LayoutingQueue = DiscardQueue;
}
g.ClearBinding ();
GraphicTree.RemoveAt (0);
}
+ #if DEBUG_LAYOUTING
+ LQIsTries = new List<LQIList>();
+ curLQIsTries = new LQIList();
+ LQIs = new List<LQIList>();
+ curLQIs = new LQIList();
+ #endif
}
public GraphicObject FindByName (string nameToFind)
{
#endregion
public void CreateExpandDelegate (TemplatedControl host){
- Type dataType = Type.GetType(strDataType);
Type hostType = typeof(TemplatedControl);//not sure is the best place to put the dyn method
Type evtType = typeof(EventHandler);
Type listBoxType = typeof(ListBox);
il.Emit (OpCodes.Ldarg_1);//get the dataSource of the sender
il.Emit (OpCodes.Callvirt, typeof(GraphicObject).GetProperty("DataSource").GetGetMethod ());
- emitGetSubData(il, dataType);
+ if (fetchMethodName != "self"){//special keyword self allows the use of recurent list<<<
+ Type dataType = Type.GetType(strDataType);
+ emitGetSubData(il, dataType);
+ }
//set 'return' from the fetch method as 'data' of the list
il.Emit (OpCodes.Callvirt, piListData.GetSetMethod ());
if (miGetDatas == null) {//in last resort, search among properties
PropertyInfo piDatas = dataType.GetProperty (fetchMethodName);
- if (piDatas == null)
- throw new Exception ("Fetch data member not found in ItemTemplate: " + fetchMethodName);
+ if (piDatas == null) {
+ FieldInfo fiDatas = dataType.GetField (fetchMethodName);
+ if (fiDatas == null)//and among fields
+ throw new Exception ("Fetch data member not found in ItemTemplate: " + fetchMethodName);
+ il.Emit (OpCodes.Ldfld, fiDatas);
+ return;
+ }
miGetDatas = piDatas.GetGetMethod ();
if (miGetDatas == null)
throw new Exception ("Read only property for fetching data in ItemTemplate: " + fetchMethodName);
public int LayoutingTries, DiscardCount;
#if DEBUG_LAYOUTING
- public static List<LayoutingQueueItem> processedLQIs = new List<LayoutingQueueItem>();
- public static LayoutingQueueItem[] MultipleRunsLQIs {
- get { return processedLQIs.Where(l=>l.LayoutingTries>2 || l.DiscardCount > 0).ToArray(); }
- }
- public static LayoutingQueueItem currentLQI = null;
public Stopwatch LQITime = new Stopwatch();
- public List<LayoutingQueueItem> triggeredLQIs = new List<LayoutingQueueItem>();
+ public LQIList triggeredLQIs = new LQIList();
public LayoutingQueueItem wasTriggeredBy = null;
public GraphicObject graphicObject {
get { return Layoutable as GraphicObject; }
}
+ public string Name {
+ get { return graphicObject.Name; }
+ }
+ public string FullName {
+ get { return graphicObject.ToString(); }
+ }
+ public Measure Width {
+ get { return graphicObject.Width; }
+ }
+ public Measure Height {
+ get { return graphicObject.Height; }
+ }
+ public bool HasTriggeredLQIs { get { return triggeredLQIs.Count > 0; }}
public Rectangle Slot, NewSlot;
#endif
Layoutable = _graphicObject;
Layoutable.RegisteredLayoutings |= LayoutType;
#if DEBUG_LAYOUTING
- if (graphicObject.CurrentDrawLQIs == null)
- graphicObject.CurrentDrawLQIs = new List<LayoutingQueueItem>();
- graphicObject.CurrentDrawLQIs.Add(this);
- if (currentLQI != null){
- wasTriggeredBy = currentLQI;
- currentLQI.triggeredLQIs.Add(this);
+ GraphicObject g = graphicObject;
+ g.CurrentInterface.curLQIs.Add(this);
+ if (g.CurrentInterface.currentLQI != null){
+ wasTriggeredBy = g.CurrentInterface.currentLQI;
+ g.CurrentInterface.currentLQI.triggeredLQIs.Add(this);
}
#endif
}
return;
}
#if DEBUG_LAYOUTING
- currentLQI = this;
- processedLQIs.Add(this);
LQITime.Start();
#endif
+ LayoutingTries++;
if (!Layoutable.UpdateLayout (LayoutType)) {
if (LayoutingTries < Interface.MaxLayoutingTries) {
- LayoutingTries++;
Layoutable.RegisteredLayoutings |= LayoutType;
(Layoutable as GraphicObject).CurrentInterface.LayoutingQueue.Enqueue (this);
} else if (DiscardCount < Interface.MaxDiscardCount) {
#endif
}
#if DEBUG_LAYOUTING
- currentLQI = null;
LQITime.Stop();
#endif
}
#endif
}
}
+ #if DEBUG_LAYOUTING
+ public class LQIList : List<LayoutingQueueItem>{
+ public List<LayoutingQueueItem> GetRootLQIs(){
+ return this.Where (lqi => lqi.wasTriggeredBy == null).ToList ();
+ }
+ }
+ #endif
}