Foobar2000:Components/Playlist Organizer (foo plorg)
From Hydrogenaudio Knowledgebase
foo_plorg is a simple component that will let your organize your playlists in a treeview fashion. It is available as either a Column UI panel or an UI element for the default UI. It enables your to create folders, hierarchies and move around folders and playlists by dragging and dropping them wherever you want in the panel.
The component is available from here. Download an place in your foobar components directory (or use the automatic updater with foobar V1.1).
Please use this thread to provide feedback or report any bug.
As of version 1.9.1 [2011-04-16]:
- Foobar 1.1 (or newer) is required and Column UI 0.3.8.x (Optional). The component will not work with previous versions of Foobar.
- Microsoft Visual C++ 2010 Redistributable Package may also be needed if not already present on your system
 Getting started
Install the toolbar as an UI element (Default UI) or a column UI panel. The commands are available with a right click on the panel. Folders and Playlists be can selected by a left click, then moved and dropped around.
 Basic Usage
The component implements a treeview control, basically made of playlist and folders. When the component is used for the first time, a "Default" folder will be created and all playlists placed in this folder.
The basic usage is to create folders (right click anywhere on the panel to access this function) and move your playlists within those newly created folders. Folders can be nested. Playlists and folders can be moved (e.g. Drag & Dropped) to their desired location within the hierarchy.
 Visual Indication for playlists
Based on the general or customized color scheme, foo_playlist_organizer will give an indication of Selected, Active and Playing playlists, as well as the source of Drag & Drop operations.
Please note that Selected and Active playlists will be kept equal (except for instance when selecting folders) when the "Activate on single click" option is chosen.
 Windows Management
Using foo_plorg as a standalone (popup) window may lead to loosing part of your playlists organization if some changes (addition, deletion, reordering, ...) are applied with other playlist managers while the window is closed. The window startup tries to recognize such situations but it is by nature limited. It is recommended that you use it as a "permanent" panel or UI element rather.
The last known tree configuration is howered memorized and will be recalled when a new panel or UI element instance is created, so that the tree can be somehow rebuilt.
 Drag & Drop
 Basic Drag & Drop
Basic drag & drop is triggered by selecting an item and keeping the left button presssed. A visual indication (dotted line around the item, small square below the mouse pointer) will be given that dragging has taken place. The selected item can be moved to the desired location and a visual indication (Colored insertion mark or rectangle for folders) of the drop target. Releasing the mouse button will move the dragged item in the requested location.
- During a Drag & Drop operation, folders will expand after a short delay to expand their contents
- Automatic scrolling of the treeview is triggered when the mouse approaches the top or bottom of the treeview.
- Folders cannot be dropped into their childrens
- Drag & Drop can take place across foobar windows (for instance in the playlist view), and also to other applications or windows (See Exporting playlists or contents below)
- The contents of a playlist can be added to another playlist, when selected as the target of a drop operation. A + sign will appear under the mouse cursor to indicate that this mode is active. Please note that when the target playlist is locked for some reason (e.g. autoplaylists), no content can be added. A visual indication (small circle) is provided in this case below the mouse cursor.
 Exporting playlists
Playlists selected as the source of a drag & drop operations can be exported to windows folder (or potentially other applications). Export uses the .fpl format to create playlists in the dropped location. Playlist contents (i.e. tracks) can be exported as well but only when the Ctrl key is pressed at the start of the dragging operation, in which case the files will be copied to the target location.
 Importing playlists or content
Similarly, foo_playlist_organizer can act as the target of a drag & drop operation initiated in other foobar windows, windows explorer or other applications. The behavior in this case is similar to the basic drag & drop and a visual indication of the target location will be given, together with an indication in the status bar that content is being imported.
- The .fpl format is recognized as a valid source and playlists names will be preserved in this case.For other sources (e.g. other playlists formats, tracks, ...) a new playlist will be generated with some intelligent name generation based on similar fields (e.g. artist, album, genre, ...) found in the tracks being imported.
 Context Menu
A context menu is available from everywhere in the treeview, from a mouse right click or using the Alt+Keydown short cut. Options are the following :
Will activate the chosen playlist. Note that activation happens automatically when "Activate on single click" is chosen in the preferences page. This option is also available using the Enter key.
Will rename the selected playlist or folder. This option is also available using the F2 key.
Will remove (delete) the selected playlist or folder. This option is also available using the Del key. Note that folders cannot be removed while they still contain playlists or other folders.
Will sort the content of the selected folder alphabetically.
 Autoplaylist (or lock) properties
Will give access to the properties of an autoplaylist (when selected) or whatever is provided for other playlist locks.
Will give access to the standard context menu, based on the content of the selected playlist.
Enables the customization of the Treeview appearance (Playlist information to show on the right side, Framestyle and Colors).
The Show Playlist entry enables to select between Number of items, Duration, Size or Nothing.
Please note that customizable colors are limited to Text, Background, Background (selected) and Active playlist, in order to remain consistent with the standard DUI color scheme. For CUI, the Active playlist colors defaults to the custom item frame color (See CUI standard color preferences).
A "Reset" option is available to revert to the standard colors, frame style and item count.
Will link to the general preferences page.
This entry will present the list of previously deleted playlists and enable to restore them. A menu entry ("Clear History") is available at the bottom of the list and will permanently delete the playlists. Note that the history is not remembered across session and deleted playlists will be permanently lost if foobar is closed.
 Create Playlist, Create Folder
These options will create new playlist and folders. Note that the newly created playlist or folder will be positioned after a currently selected playlist or as the first child of a currently selected folder.
- When activated with the the Alt+Keydown shortcut, regular shortcuts are available for each of the menu entries (underlined letter, see picture for details).
The preferences page is available from the preferences dialog (General->Playlist Organizer) and provides with the following options.
- Activate on single click will activate (e.g. make visible on the playlist renderer) the selected playlist on a single click. Please note that when this option is selected and a playlist is activated by other means (for example the standard playlist switcher), it will be automatically selected and thus made visible as a result of the standard treeview behavior.
- Play on double click will play the next item (according to the currently selected playback order) in the selected playlist.
- Make playing playlist visible on activation will ensure that the playing playlist is visible when activated (for instance when double clicking on the status bar). This option only make sense when "Activate on single click" is unchecked.
- Title formatting enables the customization of how playlists and folders are displayed in the treeview. The formatting of nodes uses foobar formatting language and the following variables are available :
- %node_name% is the name of the node, either a playlist or a folder.
- %is_folder% is a boolean value for use in $if( ...) expressions and is true when the node is a folder.
- %count% will provide the number of children (folders or playlists) for each folder or the number of items for playlists.
- %playlist_duration% will provide the duration of playlists.
- %playlist_size% will provide the size of playlists (in kB, MB or GB).
The default formatting string is %node_name%$if(%is_folder%,' ['%count%']',) and will give an indication of the number of children (folders or playlists) for each folder in the tree.
Another popular string is %node_name%$if($and(%is_folder%,$strcmp(%count%,0)),' ') which will not show the children count but just provide an indication of empty folders.
 Change Log
- Fixed improper behavior during copy/paste operations by core uie mgt.
- V2.4 [2011-05-05]
- Changed shared selection type as caller_playlist_manager and revisited shared selection management
- V2.3 [2011-05-03]
- Fixed small cursor glitch after folder expansion
- Fixed some menu entries skipped (standard "contents" menu)during their execution
- Checked behavior for nicer "Library Viewer Selection" playlist management (with Facets)
- V2.2 [2011-04-26]
- Fixed this bug
- V2.1 [2011-04-25]
- Re-engineering of drag&drop operations, Various bugfix
- V2.0 [2011-04-23] Do Not use
- Ctrl-key is no longer needed to add tracks to a playlist and it's behavior has been merged with the standard one, depending on the mouse position.
- V1.9.1 [2011-04-16]
- Recompiled with /MD run time library option.
- V1.9 [2011-04-15]
- Compiled with the latest SDK [2011-03-11] & VS2010
- V1.8 [2010-10-21]
- Selected playlist is now unchanged after dropping files into a playlist from external source or other panel
- Fixed Alt+F4 Key behavior
- V1.7 [2010-10-19]
- Fixed Alt Key behavior
- Implemented shared selection management
- V1.6 [2010-10-03]
- Provide real lock name instead of "Lock Properties"
- Fixed keyboard shortcuts not working in CUI when poo_plorg had focus
- V1.5 [2010-10-01]
- New option in contexte menu to show playlist Duration and Size
- New variables in node titleformatting to show playlist Duration and Size
- Replaced %children_count% with %count% (available for playlists and folders) in node titleformatting
- Included 'Show Playlist' reset to default (item count) in Options->Reset menu
- Fixed erratic behavior of selection after a playlist is removed
- V1.4 [2010-09-26]
- Simple Recompilation
- V1.3 [2010-08-21]
- Fixed preferences appearing in so called "Broken Components" section (in Foobar V1.1)
- Updated to latest SDK version [2010-05-21]
- V1.2 [2010-05-22]
- Fixed bug in standard context menu activation
- Removed selection of target playlist when copying content
- V1.1 [2010-05-20]
- Fixed bug in playing playlist detection
- Hack to replace "Filter Results" playlist (CUI) next to "Filter Results (Playback)" playlist
- V1.0 [2010-05-15]
- 1.0.1 Fixed minor bug in colors of active playlist not refreshed after activation when clicking on the status bar.
- Reworked Drag & drop and introduce content copy from one playlist to another (with Ctrl Key), or copy inside a playlist when Drag & Drop is from "external" source
- Introduced titleformatting script for nodes (See Preferences page)
- Memorized last known tree configuration for recall when new instance is initialized
- Eliminated flickering during single click and resize (to be confirmed on Vista/Seven)
- Implemented options to restore deleted playlists
- Fixed Reset function not working in preferences
- Forced playlist activation (after double click) when "Play on double click" option is selected and "Playback follow cursor" is not selected
- Added indication of external drop operations in status bar
- Autonamed newly created playlists and folders
- Ensured active playlist is selected at initialization
- Fixed dialog not getting focus when using Tab key
- Reworked tree display (rectangles mgt.)
- Fixed bug in framestyle setting
- Fixed bug (with potential crash) in accented characters display
- Miscellaneous bug fixes and improvements
- Implemented external drag & drop support (Thanks kerpondile !)
- Fixed preferences page activated from 1st item of standard context menu
- Fixed improper colors on selection (drop highlight) rectangle
- 0.8.3 Fixed glitch in active item display. Applied theme. Introduced a new option to make playing playlist visible upon activation. Fixed background color of preferences page.
- 0.8.2 Fixed crash in debug mode due to resize called before window activation (OnInit).
- 0.8.1 CUI colors when not restored properly after unselecting custom background color
- Fixed playback continuation (after double click) happening in same playlist when "Play on double click" option is selected and "Playback follow cursor" is not selected
- Fixed improper display of playlists or folders containing "&"
- Improved look for Vista/seven (Custom Draw for all items, No lines)
- Added visual indication of playing playlist
- Fixed DUI context menu not appearing in edit mode
- Neutralized selection of first playlist if clicking on an empty region
- Double click now jumps to next track when "Play on double click" option is selected
- Fixed unwanted column ui context menu
- Neutralized keyboard shortcuts while editing an item
- Various changes on click/double click handling
- Added options to hide item count (Context Menu-> Options)
- Tentatively introduced Vista / Seven style (to be confirmed)
- Implemented "Preferences" entry in context menu
- Implemented "Activate on single click" option (Preferences)
- Implemented "Play on double click" option (Preferences)
- Fix glitch with drophightlight rectangle (dotted rectangle sometimes breaks and takes on strange colors)
- Re engineered visual appearance + drag & drop operations, fixed some glitches
- Implemented minimum width/height
- Fixed active playlist not appearing at startup
- Fixed "active playlist" status/color lost after move
- Fixed glitch during window scrolling (drag& drop)
- New border drawing to integrate nicely with DUI
- Fixed item count not refreshing instantaneously
- Fixed double click not working outside of playlist name
- Link to this page from the preferences page (Help button)
- Fixed bug in managing (Enter/Delete) keys for label editing
- Make the matching (at startup) of tree content vs. actual playlists more intelligent (usefull for utilization of the popup window)
- Fixed panel appearing twice in column UI layout
- V0.1 [2010-05-03]
- Initial release
 To Do
- Check panel always made visible inside tabs
- Implement copy/paste settings across instances
- Synchronize playlist order with tree (on request and maybe automatically)
- Generate super set of contained playlists when activating a folder (maybe)
- Add capability to copy a playlist (create a new one) whith Ctrl Key (for internal drop source)
- check this bug
- check this bug
- Provide option to focus on target playlist after D&D (maybe)
- Provide Lockname as a variable
- Improve placement of restored playlist
- Make external dropsource return asynchronous (maybe)
- Eliminate drawing of drophighlighted item (source) on click without dragging (maybe)
- Prevent the panel from appearing in the toolbar menu (CUI)