foo_history

History component for foobar2000

version 0.8.1

Table of contents

Features

Note

Some features require additional components to be installed:

  • The sidebar panel and the toolbar require foo_ui_columns 0.1.2 alpha 4 or a compatible component.
  • The history search requires foo_dbsearch 1.3.0 or a compatible component.

Installation and uninstallation

Installing the component

The history component is available as ZIP archive from my site. It is also included in the special installer available on foobar2000.org and in the installer provided by Case. The following instructions are for manual installation from the ZIP archive.

To install the component, put foo_history.dll into a subdirectory of your foobar2000 installation directory; the default is %PROGRAMFILES%\foobar2000\components. Put foo_history_help.html into the same directory.

Note

When upgrading from a version prior to 0.8.0rc5, the font and colors of the history window and panel seem to be reset. This is due to the new options for using the system font and colors being enabled by default. Disabling these options will cause the component to use the settings imported from the older version.

Uninstalling the component

To uninstall the component, remove foo_history.dll from your foobar2000 installtion directory and its subdirectories (whereever it was installed previously). The component creates a file called history.flg in your foobar2000 profile directory. If you have user profile support enabled in foobar2000, this is %APPDATA%\foobar2000. Otherwise it is your foobar2000 installation directory.

History navigation

...using menu commands

The component provides the following menu commands which can be bound to keyboard shortcuts in the foobar2000 preferences:

Playback/History/Previous in history
Goes back by one track in the history. If the currently played track is the first in the history, this command will have no effect.
Playback/History/Next in history
Goes forward by one track in the history. If the currently played track is the first in the history, this command will start playing the next track determined by the active playback order.
Playback/History/Clear history
Clears the history. Note that there is no confirmation dialog.
Components/History
Shows the history window. If the history window is already visible, it will be activated.
Components/History help
Opens the history help file. The help file will be opened in whatever application is set to handle HTML files by default.

...using the toolbar

The history toolbar can only be used in conjunction with foo_ui_columns 0.1.2 alpha 4 or a compatible component. The instructions for showing the toolbar depend on the component you are using; in Columns UI you have to right-click the toolbar area and chosoe "Toolbars/History buttons" from the popup menu.

The toolbar contains two drop-down buttons: one for back and one for forward in history. Clicking on the buttons will go in the indicated direction by one track in the history. Clicking on the arrow part of the buttons or right-clicking them opens a popup menu which allows to go back or forward instantly by a number of tracks. The maximum size of these popup menus as well as the format of the entries is configurable in the preferences.

Note

Chosing an entry from one of the popup menus will always perform a relative movement at the time the entry is chosen. If the playing track changed after the menu was opened, the target will usually be different from the track shown in the menu. The status bar text contains a description of the menu items that is independent of the contents of the history. This is a known issue, and will most likely not be fixed (other than by closing the popup menus when the playing track changes).

...using the window

The history window is opened by the Components/History command in the main menu. If the window is already visible, it will be activated by this command. Entries can be deleted using the Delete key or through the context menu. Double-clicking an entry or pressing the Enter key will play the selected entry. Double-clicking on the status bar will select the currently playing entry, unless you removed it from the history. The window can be closed by pressing Escape.

The method for opening the sidebar panel depends on the component in which you want to show it; in Columns UI you have to right-click the titlebar of a sidebar panel and choose "General/History" from the popup menu. The sidebar panel behaves just like the history window with the following notable exceptions: it cannot be closed using Escape, and it has no status bar of its own.

Settings

The settings for this component can be found in the foobar2000 preferences under Components/History. The context menu of the history window and sidebar panel contain a command to directly go to this page. It contains three tabs which are detailed further in this section.

Note

The display and titleformatting settings are shared by the history window and all instances of the sidebar panel. This is subject to change in later versions.

Titleformatting settings

Here you can change the formatting strings used by the component. The following strings are available (choose from the drop-down listbox at the top):

History
This is used in the list of the history window and sidebar panel.
Status bar
This is used for the status bar of the history window. The sidebar panel does not currently use this.
Popup
This is used to format the entries of the toolbar's popup menus.

In addition to the common fields, the above strings support the following special fields:

%_history_number%
Returns the index of the entry in the history; the first entry is at index 1, newer entries have higher indices.
%_history_is_playing%
Returns "1" for the currently playing entry and the empty string for all other entries.
%_history_prev%
Returns how many times you would have to go forward in history to reach this track; returns the empty string for entries which cannot be reached this way.
%_history_next%
Returns how many times you would have to go back in history to reach this track; returns the empty string for entries which cannot be reached this way.
%_history_timestamp%
Returns the date and time when the entry was added to the history in ISO 8601 format, for example "2004-10-13 12:34:56Z". The "Z" at the end indicates that the date is in GMT (Zero Meridian). The other time related special fields use your local time zone.
%_history_date%
Returns the date part of the timestamp. Example: "2004-10-13".
%_history_time%
Returns the time part of the timestamp. Example: "14:34:56".
%_history_timezone%
Returns the bias of the local timezone. Example: "+02:00".
%history_timezone_minutes%
Returns the bias of the local timezone in minutes. Example: "120".
%_history_day_of_week%
Returns the day of week of the timestamp encoded as a number between 1 and 7, where 1 is for Sunday, 2 is for Monday, and so on, until 7 for Saturday. This works nicely in conjunction with the $select() function.
%_history_days_ago%
Returns the number of days since the entry was added to the history. The computation is based only on the date part of the timestamp, so if an entry is added at 23:59 of your local time, the value of this field will already be "1" two minutes later.
%_history_hours_ago%
Returns the number of full hours since the entry was added to the history.

The Reset button in the upper right corner reverts the currently selected format string to its default value. The Insert button shows a popup menu containing shortcuts for various special fields and code snippets, as well as an option to insert a color code or a tab. The entries for color codes and tabs only show up, if the current format string supports them. This menu is not configurable.

Display settings

The Display tab contains settings for altering the font and the colors used by the history window and the sidebar panel, as well as a few other appearance related options. These options set the order in which entries are displayed in history window and the sidebar panel, and the maximum number of entries in the toolbar's popup menus.

The Appearance section allows to customize the font and the colors used for drawing the history view. This is done by selecting one of the elements from the drop-down listbox, and then changing settings for that element using the appriate "Edit..." button(s). The following elements are currently available:

Normal
Specifies the text and background color for non-selected entries as well as the font used for all entries.
Selected
Overrides the text and background color for selected entries.
Active item
Specifies the color of the frame drawn around the active item.

The three options at the top of the Appearance section can be used to enable custom settings for the history view: if "Use system font" is enabled, the default GUI font will be used; otherwise the font set for the "Normal" element will be used. "Use system frame" determines how the active item in the history view is marked; if the option is enabled this will be the usual dotted rectangle, otherwise it is a rectangle with solid lines in the color set for the "Active item" element. Likewise, "Use system colors" switches between the colors set for the "Normal" and "Selected" elements, and the ones set in the Windows system control panel. All three options are enabled by default, making the history view look like a standard listbox control.

History engine settings

This tab contains settings that work directly on the history engine itself. If the "Remember history across sessions" option is enabled, the component will save the history data to a file when foobar2000 is exited. It will read this data back in next time you start the player again.

You can also switch the component to log mode: in that mode, new entries are always appended to the history. Normally, when the current track is somewhere in the middle of the history, and a new entry is to be added, the component will first remove all tracks newer than the current one before appending the new track. Please note that the "Next in history" and "Previous in history" menu commands are disabled in log mode.

Finally, you can adjust the maximum number of entries that the history will hold. The default is 1000, which will suffice for about two days of non-stop playback assuming an average track length of three minutes.

Frequently asked questions

Q: Does the component store metadata?

A: No, it only stores track locations (i.e. file path and subsong index) and timestamps. It does not store track metadata, and it also does not change it.

Q: Will you add an option to set a minimum height for the history panel?

A: No. Never. It's a sidebar panel, not a toolbar.

In my opinion, a toolbar should only contain "tools", that is simple controls like buttons, sliders, drop-down listboxes or even a text field (in a search toolbar), but nothing as complicated as the history view. I know that some people are abusing the toolbar area as a top-aligned sidebar. Still I do not want to add hacks to the history panel to enforce a minimum height. If you want a top-aligned sidebar, wait for musicmusic to implement one (I know it already has been requested in the foo_ui_columns thread).

Q: The "Next in history" and "Previous in history" main menu commands do nothing. Why?

A: The most likely answer is that you have enabled log mode. Please see the next question as to why that disables these commands.

Q: Why are the "Next in history" and "Previous in history" main menu commands disabled in log mode?

A: There is a simple reason: it wouldn't work. I'll try to explain it with an example. Assume the history has the following contents (newest entry first):

  1. A (now playing)
  2. B
  3. C

Now consider what would happen, if the "Previous in history" command were applied:

  1. B (now playing)
  2. A
  3. B
  4. C

Note that track B has been added again and is marked as now playing, so another "Previous in history" would yield the following result:

  1. A (now playing)
  2. B
  3. A
  4. B
  5. C

That doesn't look like you could ever reach track C this way. Now you could ask, why I don't change the history menu commands to navigate relative to some other index instead of the currently playing one. Firstly, I think it would be confusing. Secondly, it would create another problem with "Next in history":

  1. A (now playing)
  2. B
  3. C (navigation base)

In that situation, the effect of "Next in history" would be as follows:

  1. B (now playing)
  2. A
  3. B (navigation base)
  4. C

Note that the distance between the now playing and the navigation base markers remained the same, so it wouldn't be possible to reach the newest track. Mix "Next in history" and "Previous in history", and you would be stuck at the oldest entry sooner or later, because the size of the history is limited.

Getting in contact

Please post bug reports, feature requests and the like in the foo_history thread on the foobar2000 forum. If you have a problem with the component, but do not feel comfortable about a public post, you can send a personal message. Finally, if you cannot or do not want to register at the forum, you can send me an email.

License

Copyright (c) 2003-2004, Holger Stenger
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.