Parcourir la source

Documentation

BearishSun il y a 10 ans
Parent
commit
cc9c391d97

+ 16 - 1
MBansheeEditor/Library/LibraryDropDown.cs

@@ -2,15 +2,26 @@
 
 
 namespace BansheeEditor
 namespace BansheeEditor
 {
 {
+    /// <summary>
+    /// Drop down window that displays options used by the library window.
+    /// </summary>
     internal class LibraryDropDown : DropDownWindow
     internal class LibraryDropDown : DropDownWindow
     {
     {
         private LibraryWindow parent;
         private LibraryWindow parent;
 
 
+        /// <summary>
+        /// Constructs the drop down window.
+        /// </summary>
         public LibraryDropDown()
         public LibraryDropDown()
             : base(150, 30)
             : base(150, 30)
         { }
         { }
 
 
-        internal void SetParent(LibraryWindow parent)
+        /// <summary>
+        /// Initializes the drop down window by creating the necessary GUI. Must be called after construction and before
+        /// use.
+        /// </summary>
+        /// <param name="parent">Libary window that this drop down window is a part of.</param>
+        internal void Initialize(LibraryWindow parent)
         {
         {
             this.parent = parent;
             this.parent = parent;
 
 
@@ -75,6 +86,10 @@ namespace BansheeEditor
             vertLayout.AddFlexibleSpace();
             vertLayout.AddFlexibleSpace();
         }
         }
 
 
+        /// <summary>
+        /// Changes the icon view type in the library window.
+        /// </summary>
+        /// <param name="viewType">Type of icons to display in the library window.</param>
         private void ChangeViewType(ProjectViewType viewType)
         private void ChangeViewType(ProjectViewType viewType)
         {
         {
             parent.ViewType = viewType;
             parent.ViewType = viewType;

+ 74 - 0
MBansheeEditor/Library/LibraryDropTarget.cs

@@ -5,16 +5,47 @@ using BansheeEngine;
 
 
 namespace BansheeEditor
 namespace BansheeEditor
 {
 {
+    /// <summary>
+    /// Handles various types of drag and drop operations used by the library window.
+    /// </summary>
     public class LibraryDropTarget
     public class LibraryDropTarget
     {
     {
         private const int DragStartDistancePx = 3;
         private const int DragStartDistancePx = 3;
 
 
+        /// <summary>
+        /// Triggered when a resource drag and drop operation occured over the drop target.
+        /// </summary>
         public Action<Vector2I, string[]> OnDropResource;
         public Action<Vector2I, string[]> OnDropResource;
+
+        /// <summary>
+        /// Triggered when a scene object drag and drop operation occured over the drop target.
+        /// </summary>
         public Action<Vector2I, SceneObject[]> OnDropSceneObject;
         public Action<Vector2I, SceneObject[]> OnDropSceneObject;
+
+        /// <summary>
+        /// Triggered when a local drag and drop operation is starting (pointer has been pressed and is being dragged while
+        /// within the drop target).
+        /// </summary>
         public Action<Vector2I> OnStart;
         public Action<Vector2I> OnStart;
+
+        /// <summary>
+        /// Triggered when a pointer enters the drop target area while a drag operation is in progress.
+        /// </summary>
         public Action<Vector2I> OnEnter;
         public Action<Vector2I> OnEnter;
+
+        /// <summary>
+        /// Triggered when a pointer leaves the drop target area while a drag operation is in progress.
+        /// </summary>
         public Action OnLeave;
         public Action OnLeave;
+
+        /// <summary>
+        /// Triggered when a pointer moves within the drop target area while a drag operation is in progress.
+        /// </summary>
         public Action<Vector2I> OnDrag;
         public Action<Vector2I> OnDrag;
+
+        /// <summary>
+        /// Triggered when a locally initiated (started within the drop target) drag and drop operation ends.
+        /// </summary>
         public Action<Vector2I> OnEnd;
         public Action<Vector2I> OnEnd;
 
 
         private readonly EditorWindow parentWindow;
         private readonly EditorWindow parentWindow;
@@ -31,6 +62,9 @@ namespace BansheeEditor
         private Vector2I mouseDownScreenPos;
         private Vector2I mouseDownScreenPos;
         private Vector2I lastDragWindowPos;
         private Vector2I lastDragWindowPos;
 
 
+        /// <summary>
+        /// Area inside which drag and drop operations are allowed to occurr. Relative to the parent library window.
+        /// </summary>
         public Rect2I Bounds
         public Rect2I Bounds
         {
         {
             get { return bounds; }
             get { return bounds; }
@@ -41,6 +75,10 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Creates a new library drop target.
+        /// </summary>
+        /// <param name="window">Window the drop target is part of.</param>
         public LibraryDropTarget(EditorWindow window)
         public LibraryDropTarget(EditorWindow window)
         {
         {
             parentWindow = window;
             parentWindow = window;
@@ -56,6 +94,10 @@ namespace BansheeEditor
             Input.OnPointerMoved += Input_OnPointerMoved;
             Input.OnPointerMoved += Input_OnPointerMoved;
         }
         }
 
 
+        /// <summary>
+        /// Triggered when the pointer moved.
+        /// </summary>
+        /// <param name="ev">Data about the pointer move event.</param>
         void Input_OnPointerMoved(PointerEvent ev)
         void Input_OnPointerMoved(PointerEvent ev)
         {
         {
             Vector2I currentWindowPos = parentWindow.ScreenToWindowPos(ev.ScreenPos);
             Vector2I currentWindowPos = parentWindow.ScreenToWindowPos(ev.ScreenPos);
@@ -72,6 +114,10 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Triggered when the pointer is released.
+        /// </summary>
+        /// <param name="ev">Data about the pointer release event.</param>
         void Input_OnPointerReleased(PointerEvent ev)
         void Input_OnPointerReleased(PointerEvent ev)
         {
         {
             if (isLocalDragInProgress)
             if (isLocalDragInProgress)
@@ -83,6 +129,10 @@ namespace BansheeEditor
             triggerStartLocalDrag = false;
             triggerStartLocalDrag = false;
         }
         }
 
 
+        /// <summary>
+        /// Triggered when the pointer is pressed.
+        /// </summary>
+        /// <param name="ev">Data about the pointer press event.</param>
         void Input_OnPointerPressed(PointerEvent ev)
         void Input_OnPointerPressed(PointerEvent ev)
         {
         {
             Vector2I currentWindowPos = parentWindow.ScreenToWindowPos(ev.ScreenPos);
             Vector2I currentWindowPos = parentWindow.ScreenToWindowPos(ev.ScreenPos);
@@ -94,6 +144,9 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Triggers events and queries for changes in drag and drop operations. Should be called every frame.
+        /// </summary>
         public void Update()
         public void Update()
         {
         {
             Vector2I currentWindowPos = parentWindow.ScreenToWindowPos(Input.PointerPosition);
             Vector2I currentWindowPos = parentWindow.ScreenToWindowPos(Input.PointerPosition);
@@ -173,12 +226,20 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Destroy the drop target. You should call this when done with the drop target.
+        /// </summary>
         public void Destroy()
         public void Destroy()
         {
         {
             dropTargetOS.Destroy();
             dropTargetOS.Destroy();
             dropTargetOS = null;
             dropTargetOS = null;
         }
         }
 
 
+        /// <summary>
+        /// Triggered when an OS drag event has entered the drop target area.
+        /// </summary>
+        /// <param name="x">X coordinate of the pointer relative to the drop target area.</param>
+        /// <param name="y">Y coordinate of the pointer relative to the drop target area.</param>
         private void DoOnOSDragEnter(int x, int y)
         private void DoOnOSDragEnter(int x, int y)
         {
         {
             isOSDragActive = true;
             isOSDragActive = true;
@@ -187,6 +248,9 @@ namespace BansheeEditor
                 OnEnter(new Vector2I(x, y));
                 OnEnter(new Vector2I(x, y));
         }
         }
 
 
+        /// <summary>
+        /// Triggered when an OS drag event has left the drop target area.
+        /// </summary>
         private void DoOnOSDragLeave()
         private void DoOnOSDragLeave()
         {
         {
             isOSDragActive = false;
             isOSDragActive = false;
@@ -195,12 +259,22 @@ namespace BansheeEditor
                 OnLeave();
                 OnLeave();
         }
         }
 
 
+        /// <summary>
+        /// Triggered when a pointer moves while an OS drag event is occuring over the drop target area.
+        /// </summary>
+        /// <param name="x">X coordinate of the pointer relative to the drop target area.</param>
+        /// <param name="y">Y coordinate of the pointer relative to the drop target area.</param>
         private void DoOnOSDrag(int x, int y)
         private void DoOnOSDrag(int x, int y)
         {
         {
             if (OnDrag != null)
             if (OnDrag != null)
                 OnDrag(new Vector2I(x, y));
                 OnDrag(new Vector2I(x, y));
         }
         }
 
 
+        /// <summary>
+        /// Triggered when the pointer was released during an OS drag and drop operation while over the drop target area.
+        /// </summary>
+        /// <param name="x">X coordinate of the pointer relative to the drop target area.</param>
+        /// <param name="y">Y coordinate of the pointer relative to the drop target area.</param>
         private void DoOnOSDrop(int x, int y)
         private void DoOnOSDrop(int x, int y)
         {
         {
             isOSDragActive = false;
             isOSDragActive = false;

+ 85 - 15
MBansheeEditor/Library/LibraryGUIContent.cs

@@ -4,6 +4,10 @@ using BansheeEngine;
 
 
 namespace BansheeEditor
 namespace BansheeEditor
 {
 {
+    /// <summary>
+    /// Manages GUI for the content area of the library window. Content area displays resources as a grid or list of
+    /// resource icons.
+    /// </summary>
     internal class LibraryGUIContent
     internal class LibraryGUIContent
     {
     {
         private const int MIN_HORZ_SPACING = 8;
         private const int MIN_HORZ_SPACING = 8;
@@ -14,7 +18,7 @@ namespace BansheeEditor
         private GUILayout main;
         private GUILayout main;
         private GUIPanel overlay;
         private GUIPanel overlay;
         private GUIPanel underlay;
         private GUIPanel underlay;
-        private GUIPanel inputOverlay;
+        private GUIPanel renameOverlay;
 
 
         private LibraryWindow window;
         private LibraryWindow window;
         private GUIScrollArea parent;
         private GUIScrollArea parent;
@@ -27,66 +31,95 @@ namespace BansheeEditor
         private LibraryGUIEntry[] entries = new LibraryGUIEntry[0];
         private LibraryGUIEntry[] entries = new LibraryGUIEntry[0];
         private Dictionary<string, LibraryGUIEntry> entryLookup = new Dictionary<string, LibraryGUIEntry>();
         private Dictionary<string, LibraryGUIEntry> entryLookup = new Dictionary<string, LibraryGUIEntry>();
 
 
+        /// <summary>
+        /// Area of the content area relative to the parent window.
+        /// </summary>
         public Rect2I Bounds
         public Rect2I Bounds
         {
         {
             get { return main.Bounds; }
             get { return main.Bounds; }
         }
         }
 
 
+        /// <summary>
+        /// Number of elements per row. Only relvant for grid layouts.
+        /// </summary>
         public int ElementsPerRow
         public int ElementsPerRow
         {
         {
             get { return elementsPerRow; }
             get { return elementsPerRow; }
         }
         }
 
 
-        public int LabelWidth
-        {
-            get { return labelWidth; }
-        }
-
+        /// <summary>
+        /// Determines is the content display in a grid (true) or list (false) layout.
+        /// </summary>
         public bool GridLayout
         public bool GridLayout
         {
         {
             get { return gridLayout; }
             get { return gridLayout; }
         }
         }
 
 
+        /// <summary>
+        /// Sizes of a single resource tile in grid layout. Size in list layout is fixed.
+        /// </summary>
         public int TileSize
         public int TileSize
         {
         {
             get { return tileSize; }
             get { return tileSize; }
         }
         }
 
 
+        /// <summary>
+        /// Returns objects representing each of the displayed resource icons.
+        /// </summary>
         public LibraryGUIEntry[] Entries
         public LibraryGUIEntry[] Entries
         {
         {
             get { return entries; }
             get { return entries; }
         }
         }
 
 
-        // TODO: This doesn't feel like it should be public
+        /// <summary>
+        /// Returns parent window the content area is part of.
+        /// </summary>
         public LibraryWindow Window
         public LibraryWindow Window
         {
         {
             get { return window; }
             get { return window; }
         }
         }
 
 
-        // TODO: This doesn't feel like it should be public
+        /// <summary>
+        /// Returns a GUI panel that can be used for displaying elements underneath the resource tiles.
+        /// </summary>
         public GUIPanel Underlay
         public GUIPanel Underlay
         {
         {
             get { return underlay; }
             get { return underlay; }
         }
         }
 
 
-        // TODO: This doesn't feel like it should be public
+        /// <summary>
+        /// Returns a GUI panel that can be used for displaying elements above the resource tiles.
+        /// </summary>
         public GUIPanel Overlay
         public GUIPanel Overlay
         {
         {
             get { return overlay; }
             get { return overlay; }
         }
         }
 
 
-        // TODO: This doesn't feel like it should be public
-        public GUIPanel InputOverlay
+        /// <summary>
+        /// Returns a GUI panel that can be used for displaying rename input box. Displayed on top of the resource tiles
+        /// and the standard overlay.
+        /// </summary>
+        public GUIPanel RenameOverlay
         {
         {
-            get { return inputOverlay; }
+            get { return renameOverlay; }
         }
         }
 
 
+        /// <summary>
+        /// Constructs a new GUI library content object.
+        /// </summary>
+        /// <param name="window">Parent window the content area is part of.</param>
+        /// <param name="parent">Scroll area the content area is part of.</param>
         public LibraryGUIContent(LibraryWindow window, GUIScrollArea parent)
         public LibraryGUIContent(LibraryWindow window, GUIScrollArea parent)
         {
         {
             this.window = window;
             this.window = window;
             this.parent = parent;
             this.parent = parent;
         }
         }
 
 
+        /// <summary>
+        /// Refreshes the contents of the content area. Must be called at least once after construction.
+        /// </summary>
+        /// <param name="viewType">Determines how to display the resource tiles.</param>
+        /// <param name="entriesToDisplay">Project library entries to display.</param>
         public void Refresh(ProjectViewType viewType, LibraryEntry[] entriesToDisplay)
         public void Refresh(ProjectViewType viewType, LibraryEntry[] entriesToDisplay)
         {
         {
             if (mainPanel != null)
             if (mainPanel != null)
@@ -100,7 +133,7 @@ namespace BansheeEditor
             GUIPanel contentPanel = mainPanel.AddPanel(1);
             GUIPanel contentPanel = mainPanel.AddPanel(1);
             overlay = mainPanel.AddPanel(0);
             overlay = mainPanel.AddPanel(0);
             underlay = mainPanel.AddPanel(2);
             underlay = mainPanel.AddPanel(2);
-            inputOverlay = mainPanel.AddPanel(-1);
+            renameOverlay = mainPanel.AddPanel(-1);
 
 
             main = contentPanel.AddLayoutY();
             main = contentPanel.AddLayoutY();
 
 
@@ -154,7 +187,7 @@ namespace BansheeEditor
             {
             {
                 for (int i = 0; i < entriesToDisplay.Length; i++)
                 for (int i = 0; i < entriesToDisplay.Length; i++)
                 {
                 {
-                    LibraryGUIEntry guiEntry = new LibraryGUIEntry(this, main, entriesToDisplay[i], i);
+                    LibraryGUIEntry guiEntry = new LibraryGUIEntry(this, main, entriesToDisplay[i], i, labelWidth);
                     entries[i] = guiEntry;
                     entries[i] = guiEntry;
                     entryLookup[guiEntry.path] = guiEntry;
                     entryLookup[guiEntry.path] = guiEntry;
 
 
@@ -184,7 +217,7 @@ namespace BansheeEditor
                         elemsInRow = 0;
                         elemsInRow = 0;
                     }
                     }
 
 
-                    LibraryGUIEntry guiEntry = new LibraryGUIEntry(this, rowLayout, entriesToDisplay[i], i);
+                    LibraryGUIEntry guiEntry = new LibraryGUIEntry(this, rowLayout, entriesToDisplay[i], i, labelWidth);
                     entries[i] = guiEntry;
                     entries[i] = guiEntry;
                     entryLookup[guiEntry.path] = guiEntry;
                     entryLookup[guiEntry.path] = guiEntry;
 
 
@@ -210,6 +243,11 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Changes the visual representation of an element at the specified path as being hovered over.
+        /// </summary>
+        /// <param name="path">Project library path to the element to mark.</param>
+        /// <param name="hovered">True if mark as hovered, false to reset to normal.</param>
         public void MarkAsHovered(string path, bool hovered)
         public void MarkAsHovered(string path, bool hovered)
         {
         {
             if (!string.IsNullOrEmpty(path))
             if (!string.IsNullOrEmpty(path))
@@ -220,6 +258,11 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Changes the visual representation of an element at the specified path as being pinged.
+        /// </summary>
+        /// <param name="path">Project library path to the element to mark.</param>
+        /// <param name="pinged">True if mark as pinged, false to reset to normal.</param>
         public void MarkAsPinged(string path, bool pinged)
         public void MarkAsPinged(string path, bool pinged)
         {
         {
             if (!string.IsNullOrEmpty(path))
             if (!string.IsNullOrEmpty(path))
@@ -230,6 +273,11 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Changes the visual representation of an element at the specified path as being cut.
+        /// </summary>
+        /// <param name="path">Project library path to the element to mark.</param>
+        /// <param name="cut">True if mark as cut, false to reset to normal.</param>
         public void MarkAsCut(string path, bool cut)
         public void MarkAsCut(string path, bool cut)
         {
         {
             if (!string.IsNullOrEmpty(path))
             if (!string.IsNullOrEmpty(path))
@@ -240,6 +288,11 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Changes the visual representation of an element at the specified path as being selected.
+        /// </summary>
+        /// <param name="path">Project library path to the element to mark.</param>
+        /// <param name="selected">True if mark as selected, false to reset to normal.</param>
         public void MarkAsSelected(string path, bool selected)
         public void MarkAsSelected(string path, bool selected)
         {
         {
             if (!string.IsNullOrEmpty(path))
             if (!string.IsNullOrEmpty(path))
@@ -250,6 +303,11 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Attempts to find a resource tile element at the specified coordinates.
+        /// </summary>
+        /// <param name="scrollPos">Coordinates relative to the scroll area the content area is part of.</param>
+        /// <returns>True if found an entry, false otherwise.</returns>
         public LibraryGUIEntry FindElementAt(Vector2I scrollPos)
         public LibraryGUIEntry FindElementAt(Vector2I scrollPos)
         {
         {
             foreach (var element in entries)
             foreach (var element in entries)
@@ -261,6 +319,12 @@ namespace BansheeEditor
             return null;
             return null;
         }
         }
 
 
+        /// <summary>
+        /// Attempts to find all resource tile elements overlapping the specified bounds.
+        /// </summary>
+        /// <param name="scrollBounds">Bounds to check for overlap, specified relative to the scroll area the content area 
+        ///                            is part of.</param>
+        /// <returns>A list of found entries.</returns>
         public LibraryGUIEntry[] FindElementsOverlapping(Rect2I scrollBounds)
         public LibraryGUIEntry[] FindElementsOverlapping(Rect2I scrollBounds)
         {
         {
             List<LibraryGUIEntry> elements = new List<LibraryGUIEntry>();
             List<LibraryGUIEntry> elements = new List<LibraryGUIEntry>();
@@ -273,6 +337,12 @@ namespace BansheeEditor
             return elements.ToArray();
             return elements.ToArray();
         }
         }
 
 
+        /// <summary>
+        /// Attempts to find a resource tile element with the specified path.
+        /// </summary>
+        /// <param name="path">Project library path to the element.</param>
+        /// <param name="entry">Found element, or null if none found.</param>
+        /// <returns>True if an element was found, false otherwise.</returns>
         public bool TryGetEntry(string path, out LibraryGUIEntry entry)
         public bool TryGetEntry(string path, out LibraryGUIEntry entry)
         {
         {
             return entryLookup.TryGetValue(path, out entry);
             return entryLookup.TryGetValue(path, out entry);

+ 70 - 5
MBansheeEditor/Library/LibraryGUIEntry.cs

@@ -8,6 +8,9 @@ using BansheeEngine;
 
 
 namespace BansheeEditor
 namespace BansheeEditor
 {
 {
+    /// <summary>
+    /// Represents GUI for a single resource tile used in <see cref="LibraryGUIContent"/>.
+    /// </summary>
     internal class LibraryGUIEntry
     internal class LibraryGUIEntry
     {
     {
         private const int MAX_LABEL_HEIGHT = 50;
         private const int MAX_LABEL_HEIGHT = 50;
@@ -18,8 +21,10 @@ namespace BansheeEditor
         private static readonly Color CUT_COLOR = new Color(1.0f, 1.0f, 1.0f, 0.5f);
         private static readonly Color CUT_COLOR = new Color(1.0f, 1.0f, 1.0f, 0.5f);
         private const int SELECTION_EXTRA_WIDTH = 3;
         private const int SELECTION_EXTRA_WIDTH = 3;
 
 
-        // Note: Order of these is relevant
-        enum UnderlayState
+        /// <summary>
+        /// Possible visual states for the resource tile.
+        /// </summary>
+        enum UnderlayState // Note: Order of these is relevant
         {
         {
             None, Hovered, Selected, Pinged
             None, Hovered, Selected, Pinged
         }
         }
@@ -35,7 +40,15 @@ namespace BansheeEditor
         private UnderlayState underlayState;
         private UnderlayState underlayState;
         private GUITextBox renameTextBox;
         private GUITextBox renameTextBox;
 
 
-        public LibraryGUIEntry(LibraryGUIContent owner, GUILayout parent, LibraryEntry entry, int index)
+        /// <summary>
+        /// Constructs a new resource tile entry.
+        /// </summary>
+        /// <param name="owner">Content area this entry is part of.</param>
+        /// <param name="parent">Parent layout to add this entry's GUI elements to.</param>
+        /// <param name="entry">Project library entry this entry displays data for.</param>
+        /// <param name="index">Sequential index of the entry in the conent area.</param>
+        /// <param name="labelWidth">Width of the GUI labels that display the elements.</param>
+        public LibraryGUIEntry(LibraryGUIContent owner, GUILayout parent, LibraryEntry entry, int index, int labelWidth)
         {
         {
             GUILayout entryLayout;
             GUILayout entryLayout;
 
 
@@ -54,7 +67,7 @@ namespace BansheeEditor
             if (owner.GridLayout)
             if (owner.GridLayout)
             {
             {
                 label = new GUILabel(entry.Name, EditorStyles.MultiLineLabelCentered,
                 label = new GUILabel(entry.Name, EditorStyles.MultiLineLabelCentered,
-                    GUIOption.FixedWidth(owner.LabelWidth), GUIOption.FlexibleHeight(0, MAX_LABEL_HEIGHT));
+                    GUIOption.FixedWidth(labelWidth), GUIOption.FlexibleHeight(0, MAX_LABEL_HEIGHT));
             }
             }
             else
             else
             {
             {
@@ -71,6 +84,10 @@ namespace BansheeEditor
             this.underlay = null;
             this.underlay = null;
         }
         }
 
 
+        /// <summary>
+        /// Positions the GUI elements. Must be called after construction, but only after all content area entries have
+        /// been constructed so that entry's final bounds are known.
+        /// </summary>
         public void Initialize()
         public void Initialize()
         {
         {
             bounds = icon.Bounds;
             bounds = icon.Bounds;
@@ -94,11 +111,18 @@ namespace BansheeEditor
             owner.Overlay.AddElement(overlayBtn);
             owner.Overlay.AddElement(overlayBtn);
         }
         }
 
 
+        /// <summary>
+        /// Bounds of the entry relative to part content area.
+        /// </summary>
         public Rect2I Bounds
         public Rect2I Bounds
         {
         {
             get { return bounds; }
             get { return bounds; }
         }
         }
 
 
+        /// <summary>
+        /// Changes the visual representation of the element as being cut.
+        /// </summary>
+        /// <param name="enable">True if mark as cut, false to reset to normal.</param>
         public void MarkAsCut(bool enable)
         public void MarkAsCut(bool enable)
         {
         {
             if (enable)
             if (enable)
@@ -107,6 +131,10 @@ namespace BansheeEditor
                 icon.SetTint(Color.White);
                 icon.SetTint(Color.White);
         }
         }
 
 
+        /// <summary>
+        /// Changes the visual representation of the element as being selected.
+        /// </summary>
+        /// <param name="enable">True if mark as selected, false to reset to normal.</param>
         public void MarkAsSelected(bool enable)
         public void MarkAsSelected(bool enable)
         {
         {
             if ((int)underlayState > (int)UnderlayState.Selected)
             if ((int)underlayState > (int)UnderlayState.Selected)
@@ -123,6 +151,10 @@ namespace BansheeEditor
             underlayState = UnderlayState.Selected;
             underlayState = UnderlayState.Selected;
         }
         }
 
 
+        /// <summary>
+        /// Changes the visual representation of the element as being pinged.
+        /// </summary>
+        /// <param name="enable">True if mark as pinged, false to reset to normal.</param>
         public void MarkAsPinged(bool enable)
         public void MarkAsPinged(bool enable)
         {
         {
             if ((int)underlayState > (int)UnderlayState.Pinged)
             if ((int)underlayState > (int)UnderlayState.Pinged)
@@ -139,6 +171,10 @@ namespace BansheeEditor
             underlayState = UnderlayState.Pinged;
             underlayState = UnderlayState.Pinged;
         }
         }
 
 
+        /// <summary>
+        /// Changes the visual representation of the element as being hovered over.
+        /// </summary>
+        /// <param name="enable">True if mark as hovered, false to reset to normal.</param>
         public void MarkAsHovered(bool enable)
         public void MarkAsHovered(bool enable)
         {
         {
             if ((int)underlayState > (int)UnderlayState.Hovered)
             if ((int)underlayState > (int)UnderlayState.Hovered)
@@ -155,6 +191,9 @@ namespace BansheeEditor
             underlayState = UnderlayState.Hovered;
             underlayState = UnderlayState.Hovered;
         }
         }
 
 
+        /// <summary>
+        /// Starts a rename operation over the entry, displaying the rename input box.
+        /// </summary>
         public void StartRename()
         public void StartRename()
         {
         {
             if (renameTextBox != null)
             if (renameTextBox != null)
@@ -162,7 +201,7 @@ namespace BansheeEditor
 
 
             renameTextBox = new GUITextBox(false);
             renameTextBox = new GUITextBox(false);
             renameTextBox.Bounds = label.Bounds;
             renameTextBox.Bounds = label.Bounds;
-            owner.InputOverlay.AddElement(renameTextBox);
+            owner.RenameOverlay.AddElement(renameTextBox);
 
 
             string name = Path.GetFileNameWithoutExtension(PathEx.GetTail(path));
             string name = Path.GetFileNameWithoutExtension(PathEx.GetTail(path));
             renameTextBox.Text = name;
             renameTextBox.Text = name;
@@ -171,6 +210,9 @@ namespace BansheeEditor
             label.Visible = false;
             label.Visible = false;
         }
         }
 
 
+        /// <summary>
+        /// Stops a rename operation over the entry, hiding the rename input box.
+        /// </summary>
         public void StopRename()
         public void StopRename()
         {
         {
             if (renameTextBox != null)
             if (renameTextBox != null)
@@ -182,6 +224,10 @@ namespace BansheeEditor
             label.Visible = true;
             label.Visible = true;
         }
         }
 
 
+        /// <summary>
+        /// Gets the new name of the entry. Only valid while a rename operation is in progress.
+        /// </summary>
+        /// <returns>New name of the entry currently entered in the rename input box.</returns>
         public string GetRenamedName()
         public string GetRenamedName()
         {
         {
             if (renameTextBox != null)
             if (renameTextBox != null)
@@ -190,6 +236,9 @@ namespace BansheeEditor
             return "";
             return "";
         }
         }
 
 
+        /// <summary>
+        /// Clears the underlay GUI element (e.g. ping, hover, select).
+        /// </summary>
         private void ClearUnderlay()
         private void ClearUnderlay()
         {
         {
             if (underlay != null)
             if (underlay != null)
@@ -201,6 +250,9 @@ namespace BansheeEditor
             underlayState = UnderlayState.None;
             underlayState = UnderlayState.None;
         }
         }
 
 
+        /// <summary>
+        /// Creates a GUI elements that may be used for underlay effects (e.g. ping, hover, select).
+        /// </summary>
         private void CreateUnderlay()
         private void CreateUnderlay()
         {
         {
             if (underlay == null)
             if (underlay == null)
@@ -212,11 +264,19 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Triggered when the user clicks on the entry.
+        /// </summary>
+        /// <param name="path">Project library path of the clicked entry.</param>
         private void OnEntryClicked(string path)
         private void OnEntryClicked(string path)
         {
         {
             owner.Window.Select(path);
             owner.Window.Select(path);
         }
         }
 
 
+        /// <summary>
+        /// Triggered when the user double-clicked on the entry.
+        /// </summary>
+        /// <param name="path">Project library path of the double-clicked entry.</param>
         private void OnEntryDoubleClicked(string path)
         private void OnEntryDoubleClicked(string path)
         {
         {
             LibraryEntry entry = ProjectLibrary.GetEntry(path);
             LibraryEntry entry = ProjectLibrary.GetEntry(path);
@@ -235,6 +295,11 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Returns an icon that can be used for displaying a resource of the specified type.
+        /// </summary>
+        /// <param name="entry">Project library entry of the resource to retrieve icon for.</param>
+        /// <returns>Icon to display for the specified entry.</returns>
         private static SpriteTexture GetIcon(LibraryEntry entry)
         private static SpriteTexture GetIcon(LibraryEntry entry)
         {
         {
             if (entry.Type == LibraryEntryType.Directory)
             if (entry.Type == LibraryEntryType.Directory)

+ 221 - 3
MBansheeEditor/Library/LibraryWindow.cs

@@ -5,11 +5,19 @@ using BansheeEngine;
 
 
 namespace BansheeEditor
 namespace BansheeEditor
 {
 {
+    /// <summary>
+    /// Types of resource tile display in the library window.
+    /// </summary>
     internal enum ProjectViewType
     internal enum ProjectViewType
     {
     {
         Grid64, Grid48, Grid32, List16
         Grid64, Grid48, Grid32, List16
     }
     }
 
 
+    /// <summary>
+    /// Editor window that displays all resources in the project. Resources can be displayed as a grid or list of icons,
+    /// with the ability to move, cut, copy, paste resources and folders, as well as supporting drag and drop and search
+    /// operations.
+    /// </summary>
     internal sealed class LibraryWindow : EditorWindow
     internal sealed class LibraryWindow : EditorWindow
     {
     {
         internal enum MoveDirection
         internal enum MoveDirection
@@ -61,6 +69,9 @@ namespace BansheeEditor
         private List<string> copyPaths = new List<string>();
         private List<string> copyPaths = new List<string>();
         private List<string> cutPaths = new List<string>();
         private List<string> cutPaths = new List<string>();
 
 
+        /// <summary>
+        /// Determines how to display resource tiles in the library window.
+        /// </summary>
         internal ProjectViewType ViewType
         internal ProjectViewType ViewType
         {
         {
             get { return viewType; }
             get { return viewType; }
@@ -118,12 +129,17 @@ namespace BansheeEditor
             get { return currentDirectory; }
             get { return currentDirectory; }
         }
         }
 
 
-        // Note: I don't feel like I should be exposing this
+        /// <summary>
+        /// Context menu that should open when user right clicks on the content area.
+        /// </summary>
         internal ContextMenu ContextMenu
         internal ContextMenu ContextMenu
         {
         {
             get { return entryContextMenu; }
             get { return entryContextMenu; }
         }
         }
 
 
+        /// <summary>
+        /// Opens the library window if not already open.
+        /// </summary>
         [MenuItem("Windows/Library", ButtonModifier.CtrlAlt, ButtonCode.L, 6000)]
         [MenuItem("Windows/Library", ButtonModifier.CtrlAlt, ButtonCode.L, 6000)]
         private static void OpenLibraryWindow()
         private static void OpenLibraryWindow()
         {
         {
@@ -324,11 +340,13 @@ namespace BansheeEditor
             dropTarget.Update();
             dropTarget.Update();
         }
         }
 
 
+        /// <inheritdoc/>
         protected override LocString GetDisplayName()
         protected override LocString GetDisplayName()
         {
         {
             return new LocEdString("Library");
             return new LocEdString("Library");
         }
         }
 
 
+        /// <inheritdoc/>
         protected override void WindowResized(int width, int height)
         protected override void WindowResized(int width, int height)
         {
         {
             base.WindowResized(width, height);
             base.WindowResized(width, height);
@@ -338,6 +356,11 @@ namespace BansheeEditor
             dropTarget.Bounds = contentScrollArea.Bounds;
             dropTarget.Bounds = contentScrollArea.Bounds;
         }
         }
 
 
+        /// <summary>
+        /// Attempts to find a resource tile element at the specified coordinates.
+        /// </summary>
+        /// <param name="windowPos">Coordinates relative to the window.</param>
+        /// <returns>True if found an entry, false otherwise.</returns>
         private LibraryGUIEntry FindElementAt(Vector2I windowPos)
         private LibraryGUIEntry FindElementAt(Vector2I windowPos)
         {
         {
             Vector2I scrollPos = WindowToScrollAreaCoords(windowPos);
             Vector2I scrollPos = WindowToScrollAreaCoords(windowPos);
@@ -345,12 +368,19 @@ namespace BansheeEditor
             return content.FindElementAt(scrollPos);
             return content.FindElementAt(scrollPos);
         }
         }
 
 
+        /// <summary>
+        /// Clears hover highlight from the currently hovered over element.
+        /// </summary>
         private void ClearHoverHighlight()
         private void ClearHoverHighlight()
         {
         {
             content.MarkAsHovered(hoverHighlightPath, false);
             content.MarkAsHovered(hoverHighlightPath, false);
             hoverHighlightPath = "";
             hoverHighlightPath = "";
         }
         }
 
 
+        /// <summary>
+        /// Pings an element at the specified path, displaying and highlighting it in the window.
+        /// </summary>
+        /// <param name="path">Project library path to the element.</param>
         public void Ping(string path)
         public void Ping(string path)
         {
         {
             content.MarkAsPinged(pingPath, false);
             content.MarkAsPinged(pingPath, false);
@@ -358,6 +388,9 @@ namespace BansheeEditor
             content.MarkAsPinged(pingPath, true);
             content.MarkAsPinged(pingPath, true);
         }
         }
 
 
+        /// <summary>
+        /// Resets the library window to initial state.
+        /// </summary>
         public void Reset()
         public void Reset()
         {
         {
             currentDirectory = ProjectLibrary.Root.Path;
             currentDirectory = ProjectLibrary.Root.Path;
@@ -370,6 +403,11 @@ namespace BansheeEditor
             Refresh();
             Refresh();
         }
         }
 
 
+        /// <summary>
+        /// Deselects all selected elements.
+        /// </summary>
+        /// <param name="onlyInternal">If true, do not update the global <see cref="Selection"/>, instead the operation
+        ///                            will be contained to the library window internally.</param>
         internal void DeselectAll(bool onlyInternal = false)
         internal void DeselectAll(bool onlyInternal = false)
         {
         {
             SetSelection(new List<string>(), onlyInternal);
             SetSelection(new List<string>(), onlyInternal);
@@ -377,6 +415,11 @@ namespace BansheeEditor
             selectionAnchorEnd = -1;
             selectionAnchorEnd = -1;
         }
         }
 
 
+        /// <summary>
+        /// Select an element at the specified path. If control or shift keys are pressed during this operations multiple 
+        /// elements can be selected.
+        /// </summary>
+        /// <param name="path">Project library path to the element.</param>
         internal void Select(string path)
         internal void Select(string path)
         {
         {
             LibraryGUIEntry entry;
             LibraryGUIEntry entry;
@@ -455,6 +498,12 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Selects a new element in the specified direction from the currently selected element. If shift or control are
+        /// held during this operation, the selected object will be added to existing selection. If no element is selected
+        /// the first or last element will be selected depending on direction.
+        /// </summary>
+        /// <param name="dir">Direction to move from the currently selected element.</param>
         internal void MoveSelection(MoveDirection dir)
         internal void MoveSelection(MoveDirection dir)
         {
         {
             string newPath = "";
             string newPath = "";
@@ -507,6 +556,12 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Selects a set of elements based on the provided paths.
+        /// </summary>
+        /// <param name="paths">Project library paths of the elements to select.</param>
+        /// <param name="onlyInternal">If true, do not update the global <see cref="Selection"/>, instead the operation
+        ///                            will be contained to the library window internally.</param>
         internal void SetSelection(List<string> paths, bool onlyInternal = false)
         internal void SetSelection(List<string> paths, bool onlyInternal = false)
         {
         {
             if (selectionPaths != null)
             if (selectionPaths != null)
@@ -535,6 +590,11 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Changes the active directory to the provided directory. Current contents of the window will be cleared and
+        /// instead contents of the new directory will be displayed.
+        /// </summary>
+        /// <param name="directory">Project library path to the directory.</param>
         internal void EnterDirectory(string directory)
         internal void EnterDirectory(string directory)
         {
         {
             currentDirectory = directory;
             currentDirectory = directory;
@@ -543,6 +603,11 @@ namespace BansheeEditor
             Refresh();
             Refresh();
         }
         }
 
 
+        /// <summary>
+        /// Marks the provided set of elements for a cut operation. Cut elements can be moved to a new location by calling
+        /// <see cref="Paste"/>.
+        /// </summary>
+        /// <param name="sourcePaths">Project library paths of the elements to cut.</param>
         internal void Cut(IEnumerable<string> sourcePaths)
         internal void Cut(IEnumerable<string> sourcePaths)
         {
         {
             foreach (var path in cutPaths)
             foreach (var path in cutPaths)
@@ -557,6 +622,10 @@ namespace BansheeEditor
             copyPaths.Clear();
             copyPaths.Clear();
         }
         }
 
 
+        /// <summary>
+        /// Marks the provided set of elements for a copy operation. You can copy the elements by calling <see cref="Paste"/>.
+        /// </summary>
+        /// <param name="sourcePaths">Project library paths of the elements to copy.</param>
         internal void Copy(IEnumerable<string> sourcePaths)
         internal void Copy(IEnumerable<string> sourcePaths)
         {
         {
             copyPaths.Clear();
             copyPaths.Clear();
@@ -567,7 +636,11 @@ namespace BansheeEditor
 
 
             cutPaths.Clear();
             cutPaths.Clear();
         }
         }
-
+       
+        /// <summary>
+        /// Duplicates the provided set of elements.
+        /// </summary>
+        /// <param name="sourcePaths">Project library paths of the elements to duplicate.</param>
         internal void Duplicate(IEnumerable<string> sourcePaths)
         internal void Duplicate(IEnumerable<string> sourcePaths)
         {
         {
             foreach (var source in sourcePaths)
             foreach (var source in sourcePaths)
@@ -581,6 +654,11 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Performs a cut or copy operations on the elements previously marked by calling <see cref="Cut"/> or
+        /// <see cref="Copy"/>.
+        /// </summary>
+        /// <param name="destinationFolder">Project library folder into which to move/copy the elements.</param>
         internal void Paste(string destinationFolder)
         internal void Paste(string destinationFolder)
         {
         {
             if (copyPaths.Count > 0)
             if (copyPaths.Count > 0)
@@ -614,6 +692,10 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Scrolls the contents GUI area so that the element at the specified path becomes visible.
+        /// </summary>
+        /// <param name="path">Project library path to the element.</param>
         private void ScrollToEntry(string path)
         private void ScrollToEntry(string path)
         {
         {
             LibraryGUIEntry entryGUI;
             LibraryGUIEntry entryGUI;
@@ -641,6 +723,9 @@ namespace BansheeEditor
             contentScrollArea.VerticalScroll = percent;
             contentScrollArea.VerticalScroll = percent;
         }
         }
 
 
+        /// <summary>
+        /// Rebuilds the library window GUI. Should be called any time the active folder or contents change.
+        /// </summary>
         private void Refresh()
         private void Refresh()
         {
         {
             requiresRefresh = false;
             requiresRefresh = false;
@@ -711,6 +796,11 @@ namespace BansheeEditor
             UpdateDragSelection(dragSelectionEnd);
             UpdateDragSelection(dragSelectionEnd);
         }
         }
 
 
+        /// <summary>
+        /// Converts coordinates relative to the window into coordinates relative to the contents scroll area.
+        /// </summary>
+        /// <param name="windowPos">Coordinates relative to the window.</param>
+        /// <returns>Coordinates relative to the contents scroll area.</returns>
         private Vector2I WindowToScrollAreaCoords(Vector2I windowPos)
         private Vector2I WindowToScrollAreaCoords(Vector2I windowPos)
         {
         {
             Rect2I scrollBounds = contentScrollArea.Layout.Bounds;
             Rect2I scrollBounds = contentScrollArea.Layout.Bounds;
@@ -721,6 +811,10 @@ namespace BansheeEditor
             return scrollPos;
             return scrollPos;
         }
         }
 
 
+        /// <summary>
+        /// Starts a drag operation that displays a selection outline allowing the user to select multiple entries at once.
+        /// </summary>
+        /// <param name="windowPos">Coordinates relative to the window where the drag originated.</param>
         private void StartDragSelection(Vector2I windowPos)
         private void StartDragSelection(Vector2I windowPos)
         {
         {
             isDraggingSelection = true;
             isDraggingSelection = true;
@@ -728,6 +822,12 @@ namespace BansheeEditor
             dragSelectionEnd = dragSelectionStart;
             dragSelectionEnd = dragSelectionStart;
         }
         }
 
 
+        /// <summary>
+        /// Updates a selection outline drag operation by expanding the outline to the new location. Elements in the outline
+        /// are selected.
+        /// </summary>
+        /// <param name="windowPos">Coordinates of the pointer relative to the window.</param>
+        /// <returns>True if the selection outline drag is valid and was updated, false otherwise.</returns>
         private bool UpdateDragSelection(Vector2I windowPos)
         private bool UpdateDragSelection(Vector2I windowPos)
         {
         {
             if (!isDraggingSelection)
             if (!isDraggingSelection)
@@ -748,6 +848,10 @@ namespace BansheeEditor
             return true;
             return true;
         }
         }
 
 
+        /// <summary>
+        /// Ends the selection outline drag operation. Elements in the outline are selected.
+        /// </summary>
+        /// <returns>True if the selection outline drag is valid and was ended, false otherwise.</returns>
         private bool EndDragSelection()
         private bool EndDragSelection()
         {
         {
             if (!isDraggingSelection)
             if (!isDraggingSelection)
@@ -766,6 +870,11 @@ namespace BansheeEditor
             return false;
             return false;
         }
         }
 
 
+        /// <summary>
+        /// Calculates bounds of the selection area used for selection overlay drag operation, depending on drag starting
+        /// point coordinates and current drag coordinates.
+        /// </summary>
+        /// <returns>Bounds of the selection area, relative to the content scroll area.</returns>
         private Rect2I CalculateSelectionArea()
         private Rect2I CalculateSelectionArea()
         {
         {
             Rect2I selectionArea = new Rect2I();
             Rect2I selectionArea = new Rect2I();
@@ -800,6 +909,10 @@ namespace BansheeEditor
             return selectionArea;
             return selectionArea;
         }
         }
 
 
+        /// <summary>
+        /// Selects all elements overlapping the specified bounds.
+        /// </summary>
+        /// <param name="scrollBounds">Bounds relative to the content scroll area.</param>
         private void SelectInArea(Rect2I scrollBounds)
         private void SelectInArea(Rect2I scrollBounds)
         {
         {
             LibraryGUIEntry[] foundElements = content.FindElementsOverlapping(scrollBounds);
             LibraryGUIEntry[] foundElements = content.FindElementsOverlapping(scrollBounds);
@@ -822,6 +935,9 @@ namespace BansheeEditor
             SetSelection(elementPaths);
             SetSelection(elementPaths);
         }
         }
 
 
+        /// <summary>
+        /// Updates GUI for the directory bar. Should be called whenever the active folder changes.
+        /// </summary>
         private void RefreshDirectoryBar()
         private void RefreshDirectoryBar()
         {
         {
             if (folderListLayout != null)
             if (folderListLayout != null)
@@ -888,29 +1004,46 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Performs <see cref="Cut"/> operation on the currently selected elements.
+        /// </summary>
         internal void CutSelection()
         internal void CutSelection()
         {
         {
             if (selectionPaths.Count > 0)
             if (selectionPaths.Count > 0)
                 Cut(selectionPaths);
                 Cut(selectionPaths);
         }
         }
 
 
+        /// <summary>
+        /// Performs <see cref="Copy"/> operation on the currently selected elements.
+        /// </summary>
         internal void CopySelection()
         internal void CopySelection()
         {
         {
             if (selectionPaths.Count > 0)
             if (selectionPaths.Count > 0)
                 Copy(selectionPaths);
                 Copy(selectionPaths);
         }
         }
 
 
+        /// <summary>
+        /// Performs <see cref="Duplicate"/> operation on the currently selected elements.
+        /// </summary>
         internal void DuplicateSelection()
         internal void DuplicateSelection()
         {
         {
             if (selectionPaths.Count > 0)
             if (selectionPaths.Count > 0)
                 Duplicate(selectionPaths);
                 Duplicate(selectionPaths);
         }
         }
 
 
+        /// <summary>
+        /// Performs <see cref="Paste"/> operation. Elements will be pasted in the currently selected directory (if any), or
+        /// the active directory otherwise.
+        /// </summary>
         internal void PasteToSelection()
         internal void PasteToSelection()
         {
         {
             Paste(SelectedFolder);
             Paste(SelectedFolder);
         }
         }
 
 
+        /// <summary>
+        /// Starts a rename operation on the currently selected elements. If more than one elements are selected only the
+        /// first one will be affected.
+        /// </summary>
         internal void RenameSelection()
         internal void RenameSelection()
         {
         {
             if (selectionPaths.Count == 0)
             if (selectionPaths.Count == 0)
@@ -930,6 +1063,9 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Deletes currently selected elements. User will be asked to confirm deletion via a dialog box.
+        /// </summary>
         internal void DeleteSelection()
         internal void DeleteSelection()
         {
         {
             if (selectionPaths.Count == 0)
             if (selectionPaths.Count == 0)
@@ -952,6 +1088,9 @@ namespace BansheeEditor
                 });
                 });
         }
         }
 
 
+        /// <summary>
+        /// Stops the rename operation, if one is in progress on any element.
+        /// </summary>
         internal void StopRename()
         internal void StopRename()
         {
         {
             if (inProgressRenameElement != null)
             if (inProgressRenameElement != null)
@@ -961,6 +1100,9 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Clears the search bar and refreshes the content area to display contents of the current directory.
+        /// </summary>
         private void ClearSearch()
         private void ClearSearch()
         {
         {
             searchField.Value = "";
             searchField.Value = "";
@@ -968,6 +1110,9 @@ namespace BansheeEditor
             Refresh();
             Refresh();
         }
         }
 
 
+        /// <summary>
+        /// Opens the drop down options window that allows you to customize library window look and feel.
+        /// </summary>
         private void OpenOptionsWindow()
         private void OpenOptionsWindow()
         {
         {
             Vector2I openPosition;
             Vector2I openPosition;
@@ -977,9 +1122,13 @@ namespace BansheeEditor
             openPosition.y = buttonBounds.y + buttonBounds.height / 2;
             openPosition.y = buttonBounds.y + buttonBounds.height / 2;
 
 
             LibraryDropDown dropDown = DropDownWindow.Open<LibraryDropDown>(this, openPosition);
             LibraryDropDown dropDown = DropDownWindow.Open<LibraryDropDown>(this, openPosition);
-            dropDown.SetParent(this);
+            dropDown.Initialize(this);
         }
         }
 
 
+        /// <summary>
+        /// Returns the content scroll area bounds.
+        /// </summary>
+        /// <returns>Bounds of the content scroll area, relative to the window.</returns>
         private Rect2I GetScrollAreaBounds()
         private Rect2I GetScrollAreaBounds()
         {
         {
             Rect2I bounds = GUI.Bounds;
             Rect2I bounds = GUI.Bounds;
@@ -992,11 +1141,20 @@ namespace BansheeEditor
             return bounds;
             return bounds;
         }
         }
 
 
+        /// <summary>
+        /// Triggered when a project library entry was changed (added, modified, deleted).
+        /// </summary>
+        /// <param name="entry">Project library path of the changed entry.</param>
         private void OnEntryChanged(string entry)
         private void OnEntryChanged(string entry)
         {
         {
             requiresRefresh = true;
             requiresRefresh = true;
         }
         }
 
 
+        /// <summary>
+        /// Triggered when the drag and drop operation is starting while over the content area. If drag operation is over
+        /// an element, element will be dragged.
+        /// </summary>
+        /// <param name="windowPos">Coordinates where the drag operation started, relative to the window.</param>
         private void OnDragStart(Vector2I windowPos)
         private void OnDragStart(Vector2I windowPos)
         {
         {
             LibraryGUIEntry underCursorElem = FindElementAt(windowPos);
             LibraryGUIEntry underCursorElem = FindElementAt(windowPos);
@@ -1033,6 +1191,10 @@ namespace BansheeEditor
             DragDrop.StartDrag(dragDropData);
             DragDrop.StartDrag(dragDropData);
         }
         }
 
 
+        /// <summary>
+        /// Triggered when a pointer is moved while a drag operation is in progress.
+        /// </summary>
+        ///  <param name="windowPos">Coordinates of the pointer relative to the window.</param>
         private void OnDragMove(Vector2I windowPos)
         private void OnDragMove(Vector2I windowPos)
         {
         {
             // Auto-scroll
             // Auto-scroll
@@ -1070,12 +1232,21 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Triggered when a pointer leaves the drop targer while a drag operation is in progress.
+        /// </summary>
         private void OnDragLeave()
         private void OnDragLeave()
         {
         {
             ClearHoverHighlight();
             ClearHoverHighlight();
             autoScrollAmount = 0;
             autoScrollAmount = 0;
         }
         }
 
 
+        /// <summary>
+        /// Triggered when a resource drop operation finishes over the content area.
+        /// </summary>
+        /// <param name="windowPos">Coordinates of the pointer relative to the window where the drop operation finished
+        ///                         .</param>
+        /// <param name="paths">Paths of the dropped resources.</param>
         private void OnResourceDragDropped(Vector2I windowPos, string[] paths)
         private void OnResourceDragDropped(Vector2I windowPos, string[] paths)
         {
         {
             ClearHoverHighlight();
             ClearHoverHighlight();
@@ -1137,6 +1308,12 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Triggered when a scene object drop operation finishes over the content area.
+        /// </summary>
+        /// <param name="windowPos">Coordinates of the pointer relative to the window where the drop operation finished
+        ///                         .</param>
+        /// <param name="objects">Dropped scene objects.</param>
         private void OnSceneObjectDragDropped(Vector2I windowPos, SceneObject[] objects)
         private void OnSceneObjectDragDropped(Vector2I windowPos, SceneObject[] objects)
         {
         {
             ClearHoverHighlight();
             ClearHoverHighlight();
@@ -1172,44 +1349,76 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Triggered when a drag operation that originated from this window ends.
+        /// </summary>
+        /// <param name="windowPos">Coordinates of the pointer where the drag ended relative to the window </param>
         private void OnDragEnd(Vector2I windowPos)
         private void OnDragEnd(Vector2I windowPos)
         {
         {
             EndDragSelection();
             EndDragSelection();
             autoScrollAmount = 0;
             autoScrollAmount = 0;
         }
         }
 
 
+        /// <summary>
+        /// Triggered when the global selection changes.
+        /// </summary>
+        /// <param name="sceneObjects">A set of newly selected scene objects.</param>
+        /// <param name="resourcePaths">A set of paths for newly selected resources.</param>
         private void OnSelectionChanged(SceneObject[] sceneObjects, string[] resourcePaths)
         private void OnSelectionChanged(SceneObject[] sceneObjects, string[] resourcePaths)
         {
         {
             if(sceneObjects.Length > 0)
             if(sceneObjects.Length > 0)
                 DeselectAll(true);
                 DeselectAll(true);
         }
         }
 
 
+        /// <summary>
+        /// Triggered when a ping operation was triggered externally.
+        /// </summary>
+        /// <param name="path">Path to the resource to highlight.</param>
         private void OnPing(string path)
         private void OnPing(string path)
         {
         {
             Ping(path);
             Ping(path);
         }
         }
 
 
+        /// <summary>
+        /// Triggered when a folder on the directory bar was selected.
+        /// </summary>
+        /// <param name="path">Project library path to the folder to enter.</param>
         private void OnFolderButtonClicked(string path)
         private void OnFolderButtonClicked(string path)
         {
         {
             EnterDirectory(path);
             EnterDirectory(path);
         }
         }
 
 
+        /// <summary>
+        /// Triggered when the content area receives or loses keyboard focus.
+        /// </summary>
+        /// <param name="focus">True if focus was received, false otherwise.</param>
         private void OnContentsFocusChanged(bool focus)
         private void OnContentsFocusChanged(bool focus)
         {
         {
             hasContentFocus = focus;
             hasContentFocus = focus;
         }
         }
 
 
+        /// <summary>
+        /// Triggered when the user clicks on empty space between elements.
+        /// </summary>
         private void OnCatchAllClicked()
         private void OnCatchAllClicked()
         {
         {
             DeselectAll();
             DeselectAll();
         }
         }
 
 
+        /// <summary>
+        /// Triggered when the user clicks on the home button on the directory bar, changing the active directory to
+        /// project library root.
+        /// </summary>
         private void OnHomeClicked()
         private void OnHomeClicked()
         {
         {
             currentDirectory = ProjectLibrary.Root.Path;
             currentDirectory = ProjectLibrary.Root.Path;
             Refresh();
             Refresh();
         }
         }
 
 
+        /// <summary>
+        /// Triggered when the user clicks on the up button on the directory bar, changing the active directory to the
+        /// parent directory, unless already at project library root.
+        /// </summary>
         private void OnUpClicked()
         private void OnUpClicked()
         {
         {
             currentDirectory = currentDirectory.Trim(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
             currentDirectory = currentDirectory.Trim(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
@@ -1223,12 +1432,21 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// Triggered when the user inputs new values into the search input box. Refreshes the contents so they display
+        /// elements matching the search text.
+        /// </summary>
+        /// <param name="newValue">Search box text.</param>
         private void OnSearchChanged(string newValue)
         private void OnSearchChanged(string newValue)
         {
         {
             searchQuery = newValue;
             searchQuery = newValue;
             Refresh();
             Refresh();
         }
         }
 
 
+        /// <summary>
+        /// Sorts the specified set of project library entries by type (folder or resource), followed by name.
+        /// </summary>
+        /// <param name="input">Set of project library entries to sort.</param>
         private static void SortEntries(LibraryEntry[] input)
         private static void SortEntries(LibraryEntry[] input)
         {
         {
             Array.Sort(input, (x, y) =>
             Array.Sort(input, (x, y) =>

+ 6 - 4
TODO.txt

@@ -53,7 +53,6 @@ Code quality improvements:
 Polish
 Polish
 
 
 Ribek use:
 Ribek use:
- - Document Library stuff (I moved it to a different folder so I might miss it)
  - Hook up color picker to guicolor field
  - Hook up color picker to guicolor field
  - When hiding a component in inspector, it doesn't immediately reposition the components below it
  - When hiding a component in inspector, it doesn't immediately reposition the components below it
  - Having en empty component in inspector shows a small empty background, it shouldn't show anything
  - Having en empty component in inspector shows a small empty background, it shouldn't show anything
@@ -94,8 +93,6 @@ Optional:
  - Handle seems to lag behind the selected mesh
  - Handle seems to lag behind the selected mesh
  - When resizing library window while docked, selection area appears
  - When resizing library window while docked, selection area appears
  - Move all the code files into subfolders so their hierarchy is similar to VS filters
  - Move all the code files into subfolders so their hierarchy is similar to VS filters
- - GUI tabbing to switch between elements
- - Better Prefab inspector - display SceneObject inspector of top-level object, and possibly prefab hierarchy?
  - Undo/Redo
  - Undo/Redo
   - CmdRecordSO records an SO and all its children but it should only record a single SO
   - CmdRecordSO records an SO and all its children but it should only record a single SO
   - CmdRecordSO should instead of recording the entire object record a diff
   - CmdRecordSO should instead of recording the entire object record a diff
@@ -103,7 +100,6 @@ Optional:
   - Add commands for breaking or reverting a scene object 
   - Add commands for breaking or reverting a scene object 
   - Test & finalize undo/redo system
   - Test & finalize undo/redo system
   - Add Undo/Redo menu and toolbar entries to "Edit" menu
   - Add Undo/Redo menu and toolbar entries to "Edit" menu
- - Add Range[] attribute to C# that forces a float/int to be displayed as a slider
  - Add "focus on object" key (F) - animate it: rotate camera towards then speed towards while zooming in (+ menu entry)
  - Add "focus on object" key (F) - animate it: rotate camera towards then speed towards while zooming in (+ menu entry)
  - Ortographic camera views (+ gizmo in scene view corner that shows camera orientation)
  - Ortographic camera views (+ gizmo in scene view corner that shows camera orientation)
  - Drag to select in scene view
  - Drag to select in scene view
@@ -111,6 +107,12 @@ Optional:
    - Likely use a user-provided callback to trigger when populating the menus (I already added a callback to MenuItem, just need to implement it)
    - Likely use a user-provided callback to trigger when populating the menus (I already added a callback to MenuItem, just need to implement it)
  - Need to list all script components in the Components menu
  - Need to list all script components in the Components menu
 
 
+Seriously optional:
+ - Automatically generate readable inspector names and add [Name] attribute that allows custom naming
+ - Add Range[] attribute to C# that forces a float/int to be displayed as a slider
+ - GUI tabbing to switch between elements
+ - Better Prefab inspector - display SceneObject inspector of top-level object, and possibly prefab hierarchy?
+
 Finalizing:
 Finalizing:
  - Add copyright notices in all files & change license to GPL
  - Add copyright notices in all files & change license to GPL
  - Documentation
  - Documentation