2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
|
|
|
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2008-05-06 15:11:33 +00:00
|
|
|
/** @file music_gui.cpp GUI for the music playback. */
|
2007-03-03 04:04:22 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
#include "stdafx.h"
|
2018-06-24 18:06:05 +00:00
|
|
|
#include <vector>
|
2005-06-02 19:30:21 +00:00
|
|
|
#include "openttd.h"
|
2009-12-22 21:40:29 +00:00
|
|
|
#include "base_media_base.h"
|
2007-07-05 12:23:54 +00:00
|
|
|
#include "music/music_driver.hpp"
|
2007-12-19 19:44:29 +00:00
|
|
|
#include "window_gui.h"
|
2007-12-21 19:49:27 +00:00
|
|
|
#include "strings_func.h"
|
2007-12-25 11:26:07 +00:00
|
|
|
#include "window_func.h"
|
2007-12-29 09:24:26 +00:00
|
|
|
#include "sound_func.h"
|
2008-01-09 09:45:45 +00:00
|
|
|
#include "gfx_func.h"
|
2018-03-19 20:25:08 +00:00
|
|
|
#include "zoom_func.h"
|
2008-01-29 00:26:31 +00:00
|
|
|
#include "core/random_func.hpp"
|
2011-12-10 13:54:10 +00:00
|
|
|
#include "error.h"
|
2010-01-15 16:41:15 +00:00
|
|
|
#include "core/geometry_func.hpp"
|
|
|
|
#include "string_func.h"
|
2011-03-05 18:00:48 +00:00
|
|
|
#include "settings_type.h"
|
2018-03-20 16:06:39 +00:00
|
|
|
#include "settings_gui.h"
|
|
|
|
#include "widgets/dropdown_func.h"
|
|
|
|
#include "widgets/dropdown_type.h"
|
2021-04-04 08:04:06 +00:00
|
|
|
#include "widgets/slider_func.h"
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2011-12-15 22:22:55 +00:00
|
|
|
#include "widgets/music_widget.h"
|
|
|
|
|
2008-01-13 01:21:35 +00:00
|
|
|
#include "table/strings.h"
|
|
|
|
#include "table/sprites.h"
|
|
|
|
|
2014-04-23 20:13:33 +00:00
|
|
|
#include "safeguards.h"
|
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
|
|
|
|
struct MusicSystem {
|
|
|
|
struct PlaylistEntry : MusicSongInfo {
|
|
|
|
const MusicSet *set; ///< music set the song comes from
|
|
|
|
uint set_index; ///< index of song in set
|
|
|
|
|
|
|
|
PlaylistEntry(const MusicSet *set, uint set_index) : MusicSongInfo(set->songinfo[set_index]), set(set), set_index(set_index) { }
|
|
|
|
bool IsValid() const { return !StrEmpty(this->songname); }
|
|
|
|
};
|
|
|
|
typedef std::vector<PlaylistEntry> Playlist;
|
|
|
|
|
|
|
|
enum PlaylistChoices {
|
|
|
|
PLCH_ALLMUSIC,
|
|
|
|
PLCH_OLDSTYLE,
|
|
|
|
PLCH_NEWSTYLE,
|
|
|
|
PLCH_EZYSTREET,
|
|
|
|
PLCH_CUSTOM1,
|
|
|
|
PLCH_CUSTOM2,
|
|
|
|
PLCH_THEMEONLY,
|
|
|
|
PLCH_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
Playlist active_playlist; ///< current play order of songs, including any shuffle
|
|
|
|
Playlist displayed_playlist; ///< current playlist as displayed in GUI, never in shuffled order
|
|
|
|
Playlist music_set; ///< all songs in current music set, in set order
|
|
|
|
|
|
|
|
PlaylistChoices selected_playlist;
|
|
|
|
|
|
|
|
void BuildPlaylists();
|
|
|
|
|
|
|
|
void ChangePlaylist(PlaylistChoices pl);
|
2020-05-17 21:32:06 +00:00
|
|
|
void ChangeMusicSet(const std::string &set_name);
|
2018-06-24 18:06:05 +00:00
|
|
|
void Shuffle();
|
|
|
|
void Unshuffle();
|
|
|
|
|
|
|
|
void Play();
|
|
|
|
void Stop();
|
|
|
|
void Next();
|
|
|
|
void Prev();
|
|
|
|
void CheckStatus();
|
|
|
|
|
|
|
|
bool IsPlaying() const;
|
|
|
|
bool IsShuffle() const;
|
|
|
|
PlaylistEntry GetCurrentSong() const;
|
|
|
|
|
|
|
|
bool IsCustomPlaylist() const;
|
|
|
|
void PlaylistAdd(size_t song_index);
|
|
|
|
void PlaylistRemove(size_t song_index);
|
|
|
|
void PlaylistClear();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void ChangePlaylistPosition(int ofs);
|
|
|
|
int playlist_position;
|
|
|
|
|
|
|
|
void SaveCustomPlaylist(PlaylistChoices pl);
|
|
|
|
|
|
|
|
Playlist standard_playlists[PLCH_MAX];
|
|
|
|
};
|
|
|
|
|
|
|
|
MusicSystem _music;
|
|
|
|
|
|
|
|
|
|
|
|
/** Rebuild all playlists for the current music set */
|
|
|
|
void MusicSystem::BuildPlaylists()
|
2009-12-22 18:34:07 +00:00
|
|
|
{
|
2018-06-24 18:06:05 +00:00
|
|
|
const MusicSet *set = BaseMusic::GetUsedSet();
|
|
|
|
|
|
|
|
/* Clear current playlists */
|
|
|
|
for (size_t i = 0; i < lengthof(this->standard_playlists); ++i) this->standard_playlists[i].clear();
|
|
|
|
this->music_set.clear();
|
|
|
|
|
|
|
|
/* Build standard playlists, and a list of available music */
|
|
|
|
for (uint i = 0; i < NUM_SONGS_AVAILABLE; i++) {
|
|
|
|
PlaylistEntry entry(set, i);
|
|
|
|
if (!entry.IsValid()) continue;
|
|
|
|
|
|
|
|
this->music_set.push_back(entry);
|
|
|
|
|
|
|
|
/* Add theme song to theme-only playlist */
|
|
|
|
if (i == 0) this->standard_playlists[PLCH_THEMEONLY].push_back(entry);
|
|
|
|
|
|
|
|
/* Don't add the theme song to standard playlists */
|
|
|
|
if (i > 0) {
|
|
|
|
this->standard_playlists[PLCH_ALLMUSIC].push_back(entry);
|
|
|
|
uint theme = (i - 1) / NUM_SONGS_CLASS;
|
|
|
|
this->standard_playlists[PLCH_OLDSTYLE + theme].push_back(entry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Load custom playlists
|
|
|
|
* Song index offsets are 1-based, zero indicates invalid/end-of-list value */
|
|
|
|
for (uint i = 0; i < NUM_SONGS_PLAYLIST; i++) {
|
|
|
|
if (_settings_client.music.custom_1[i] > 0) {
|
|
|
|
PlaylistEntry entry(set, _settings_client.music.custom_1[i] - 1);
|
|
|
|
if (entry.IsValid()) this->standard_playlists[PLCH_CUSTOM1].push_back(entry);
|
|
|
|
}
|
|
|
|
if (_settings_client.music.custom_2[i] > 0) {
|
|
|
|
PlaylistEntry entry(set, _settings_client.music.custom_2[i] - 1);
|
|
|
|
if (entry.IsValid()) this->standard_playlists[PLCH_CUSTOM2].push_back(entry);
|
|
|
|
}
|
|
|
|
}
|
2009-12-22 18:34:07 +00:00
|
|
|
}
|
|
|
|
|
2009-12-22 21:40:29 +00:00
|
|
|
/**
|
2018-06-24 18:06:05 +00:00
|
|
|
* Switch to another playlist, or reload the current one.
|
|
|
|
* @param pl Playlist to select
|
2009-12-22 21:40:29 +00:00
|
|
|
*/
|
2018-06-24 18:06:05 +00:00
|
|
|
void MusicSystem::ChangePlaylist(PlaylistChoices pl)
|
2009-12-22 21:40:29 +00:00
|
|
|
{
|
2018-06-24 18:06:05 +00:00
|
|
|
assert(pl < PLCH_MAX && pl >= PLCH_ALLMUSIC);
|
2009-12-22 18:34:07 +00:00
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
this->displayed_playlist = this->standard_playlists[pl];
|
|
|
|
this->active_playlist = this->displayed_playlist;
|
|
|
|
this->selected_playlist = pl;
|
|
|
|
this->playlist_position = 0;
|
|
|
|
|
|
|
|
if (this->selected_playlist != PLCH_THEMEONLY) _settings_client.music.playlist = this->selected_playlist;
|
|
|
|
|
|
|
|
if (_settings_client.music.shuffle) {
|
|
|
|
this->Shuffle();
|
|
|
|
/* Shuffle() will also Play() if necessary, only start once */
|
|
|
|
} else if (_settings_client.music.playing) {
|
|
|
|
this->Play();
|
|
|
|
}
|
|
|
|
|
|
|
|
InvalidateWindowData(WC_MUSIC_TRACK_SELECTION, 0);
|
|
|
|
InvalidateWindowData(WC_MUSIC_WINDOW, 0);
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-12-22 21:40:29 +00:00
|
|
|
/**
|
2018-06-24 18:06:05 +00:00
|
|
|
* Change to named music set, and reset playback.
|
|
|
|
* @param set_name Name of music set to select
|
2009-12-22 21:40:29 +00:00
|
|
|
*/
|
2020-05-17 21:32:06 +00:00
|
|
|
void MusicSystem::ChangeMusicSet(const std::string &set_name)
|
2009-12-22 21:40:29 +00:00
|
|
|
{
|
2018-06-24 18:06:05 +00:00
|
|
|
BaseMusic::SetSet(set_name);
|
2020-05-17 21:32:06 +00:00
|
|
|
BaseMusic::ini_set = set_name;
|
2018-11-02 15:54:08 +00:00
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
this->BuildPlaylists();
|
|
|
|
this->ChangePlaylist(this->selected_playlist);
|
|
|
|
|
|
|
|
InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_OPTIONS, 0, true);
|
2009-12-22 21:40:29 +00:00
|
|
|
}
|
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
/** Enable shuffle mode and restart playback */
|
|
|
|
void MusicSystem::Shuffle()
|
2009-12-22 21:40:29 +00:00
|
|
|
{
|
2018-06-24 18:06:05 +00:00
|
|
|
_settings_client.music.shuffle = true;
|
|
|
|
|
|
|
|
this->active_playlist = this->displayed_playlist;
|
|
|
|
for (size_t i = 0; i < this->active_playlist.size(); i++) {
|
|
|
|
size_t shuffle_index = InteractiveRandom() % (this->active_playlist.size() - i);
|
|
|
|
std::swap(this->active_playlist[i], this->active_playlist[i + shuffle_index]);
|
2009-12-22 21:40:29 +00:00
|
|
|
}
|
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
if (_settings_client.music.playing) this->Play();
|
2009-12-22 21:40:29 +00:00
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
InvalidateWindowData(WC_MUSIC_WINDOW, 0);
|
2009-12-22 21:40:29 +00:00
|
|
|
}
|
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
/** Disable shuffle and restart playback */
|
|
|
|
void MusicSystem::Unshuffle()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2018-06-24 18:06:05 +00:00
|
|
|
_settings_client.music.shuffle = false;
|
|
|
|
this->active_playlist = this->displayed_playlist;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
if (_settings_client.music.playing) this->Play();
|
2004-09-10 19:02:27 +00:00
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
InvalidateWindowData(WC_MUSIC_WINDOW, 0);
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
/** Start/restart playback at current song */
|
|
|
|
void MusicSystem::Play()
|
|
|
|
{
|
|
|
|
/* Always set the playing flag, even if there is no music */
|
|
|
|
_settings_client.music.playing = true;
|
|
|
|
MusicDriver::GetInstance()->StopSong();
|
|
|
|
/* Make sure playlist_position is a valid index, if playlist has changed etc. */
|
|
|
|
this->ChangePlaylistPosition(0);
|
|
|
|
|
|
|
|
/* If there is no music, don't try to play it */
|
|
|
|
if (this->active_playlist.empty()) return;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
MusicSongInfo song = this->active_playlist[this->playlist_position];
|
|
|
|
if (_game_mode == GM_MENU && this->selected_playlist == PLCH_THEMEONLY) song.loop = true;
|
|
|
|
MusicDriver::GetInstance()->PlaySong(song);
|
|
|
|
|
|
|
|
InvalidateWindowData(WC_MUSIC_WINDOW, 0);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
/** Stop playback and set flag that we don't intend to play music */
|
|
|
|
void MusicSystem::Stop()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2018-06-24 18:06:05 +00:00
|
|
|
MusicDriver::GetInstance()->StopSong();
|
|
|
|
_settings_client.music.playing = false;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
InvalidateWindowData(WC_MUSIC_WINDOW, 0);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
/** Skip to next track */
|
|
|
|
void MusicSystem::Next()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2018-06-24 18:06:05 +00:00
|
|
|
this->ChangePlaylistPosition(+1);
|
|
|
|
if (_settings_client.music.playing) this->Play();
|
|
|
|
|
|
|
|
InvalidateWindowData(WC_MUSIC_WINDOW, 0);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
/** Skip to previous track */
|
|
|
|
void MusicSystem::Prev()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2018-06-24 18:06:05 +00:00
|
|
|
this->ChangePlaylistPosition(-1);
|
|
|
|
if (_settings_client.music.playing) this->Play();
|
|
|
|
|
|
|
|
InvalidateWindowData(WC_MUSIC_WINDOW, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Check that music is playing if it should, and that appropriate playlist is active for game/main menu */
|
|
|
|
void MusicSystem::CheckStatus()
|
|
|
|
{
|
|
|
|
if ((_game_mode == GM_MENU) != (this->selected_playlist == PLCH_THEMEONLY)) {
|
|
|
|
/* Make sure the theme-only playlist is active when on the title screen, and not during gameplay */
|
|
|
|
this->ChangePlaylist((_game_mode == GM_MENU) ? PLCH_THEMEONLY : (PlaylistChoices)_settings_client.music.playlist);
|
2011-12-04 14:17:51 +00:00
|
|
|
}
|
2018-06-24 18:06:05 +00:00
|
|
|
if (this->active_playlist.empty()) return;
|
|
|
|
/* If we were supposed to be playing, but music has stopped, move to next song */
|
|
|
|
if (this->IsPlaying() && !MusicDriver::GetInstance()->IsSongPlaying()) this->Next();
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
/** Is the player getting music right now? */
|
|
|
|
bool MusicSystem::IsPlaying() const
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2018-06-24 18:06:05 +00:00
|
|
|
return _settings_client.music.playing && !this->active_playlist.empty();
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
/** Is shuffle mode enabled? */
|
|
|
|
bool MusicSystem::IsShuffle() const
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2018-06-24 18:06:05 +00:00
|
|
|
return _settings_client.music.shuffle;
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
/** Return the current song, or a dummy if none */
|
|
|
|
MusicSystem::PlaylistEntry MusicSystem::GetCurrentSong() const
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2018-06-24 18:06:05 +00:00
|
|
|
if (!this->IsPlaying()) return PlaylistEntry(BaseMusic::GetUsedSet(), 0);
|
|
|
|
return this->active_playlist[this->playlist_position];
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Is one of the custom playlists selected? */
|
|
|
|
bool MusicSystem::IsCustomPlaylist() const
|
|
|
|
{
|
|
|
|
return (this->selected_playlist == PLCH_CUSTOM1) || (this->selected_playlist == PLCH_CUSTOM2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Append a song to a custom playlist.
|
|
|
|
* Always adds to the currently active playlist.
|
|
|
|
* @param song_index Index of song in the current music set to add
|
|
|
|
*/
|
|
|
|
void MusicSystem::PlaylistAdd(size_t song_index)
|
|
|
|
{
|
|
|
|
if (!this->IsCustomPlaylist()) return;
|
|
|
|
|
|
|
|
/* Pick out song from the music set */
|
|
|
|
if (song_index >= this->music_set.size()) return;
|
|
|
|
PlaylistEntry entry = this->music_set[song_index];
|
|
|
|
|
|
|
|
/* Check for maximum length */
|
|
|
|
if (this->standard_playlists[this->selected_playlist].size() >= NUM_SONGS_PLAYLIST) return;
|
|
|
|
|
|
|
|
/* Add it to the appropriate playlist, and the display */
|
|
|
|
this->standard_playlists[this->selected_playlist].push_back(entry);
|
|
|
|
this->displayed_playlist.push_back(entry);
|
|
|
|
|
|
|
|
/* Add it to the active playlist, if playback is shuffled select a random position to add at */
|
|
|
|
if (this->active_playlist.empty()) {
|
|
|
|
this->active_playlist.push_back(entry);
|
|
|
|
if (this->IsPlaying()) this->Play();
|
|
|
|
} else if (this->IsShuffle()) {
|
|
|
|
/* Generate a random position between 0 and n (inclusive, new length) to insert at */
|
|
|
|
size_t maxpos = this->displayed_playlist.size();
|
|
|
|
size_t newpos = InteractiveRandom() % maxpos;
|
|
|
|
this->active_playlist.insert(this->active_playlist.begin() + newpos, entry);
|
|
|
|
/* Make sure to shift up the current playback position if the song was inserted before it */
|
|
|
|
if ((int)newpos <= this->playlist_position) this->playlist_position++;
|
|
|
|
} else {
|
|
|
|
this->active_playlist.push_back(entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
this->SaveCustomPlaylist(this->selected_playlist);
|
|
|
|
|
|
|
|
InvalidateWindowData(WC_MUSIC_TRACK_SELECTION, 0);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
/**
|
|
|
|
* Remove a song from a custom playlist.
|
|
|
|
* @param song_index Index in the custom playlist to remove.
|
|
|
|
*/
|
|
|
|
void MusicSystem::PlaylistRemove(size_t song_index)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2018-06-24 18:06:05 +00:00
|
|
|
if (!this->IsCustomPlaylist()) return;
|
|
|
|
|
|
|
|
Playlist &pl = this->standard_playlists[this->selected_playlist];
|
|
|
|
if (song_index >= pl.size()) return;
|
|
|
|
|
|
|
|
/* Remove from "simple" playlists */
|
|
|
|
PlaylistEntry song = pl[song_index];
|
|
|
|
pl.erase(pl.begin() + song_index);
|
|
|
|
this->displayed_playlist.erase(this->displayed_playlist.begin() + song_index);
|
|
|
|
|
|
|
|
/* Find in actual active playlist (may be shuffled) and remove,
|
|
|
|
* if it's the current song restart playback */
|
|
|
|
for (size_t i = 0; i < this->active_playlist.size(); i++) {
|
|
|
|
Playlist::iterator s2 = this->active_playlist.begin() + i;
|
|
|
|
if (s2->filename == song.filename && s2->cat_index == song.cat_index) {
|
|
|
|
this->active_playlist.erase(s2);
|
|
|
|
if ((int)i == this->playlist_position && this->IsPlaying()) this->Play();
|
|
|
|
break;
|
2006-07-07 02:44:51 +00:00
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
2004-09-10 19:02:27 +00:00
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
this->SaveCustomPlaylist(this->selected_playlist);
|
|
|
|
|
|
|
|
InvalidateWindowData(WC_MUSIC_TRACK_SELECTION, 0);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
/**
|
|
|
|
* Remove all songs from the current custom playlist.
|
|
|
|
* Effectively stops playback too.
|
|
|
|
*/
|
|
|
|
void MusicSystem::PlaylistClear()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2018-06-24 18:06:05 +00:00
|
|
|
if (!this->IsCustomPlaylist()) return;
|
|
|
|
|
|
|
|
this->standard_playlists[this->selected_playlist].clear();
|
|
|
|
this->ChangePlaylist(this->selected_playlist);
|
|
|
|
|
|
|
|
this->SaveCustomPlaylist(this->selected_playlist);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2018-03-19 19:13:09 +00:00
|
|
|
/**
|
2018-06-24 18:06:05 +00:00
|
|
|
* Change playlist position pointer by the given offset, making sure to keep it within valid range.
|
|
|
|
* If the playlist is empty, position is always set to 0.
|
|
|
|
* @param ofs Amount to move playlist position by.
|
2018-03-19 19:13:09 +00:00
|
|
|
*/
|
2018-06-24 18:06:05 +00:00
|
|
|
void MusicSystem::ChangePlaylistPosition(int ofs)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2018-06-24 18:06:05 +00:00
|
|
|
if (this->active_playlist.empty()) {
|
|
|
|
this->playlist_position = 0;
|
|
|
|
} else {
|
|
|
|
this->playlist_position += ofs;
|
|
|
|
while (this->playlist_position >= (int)this->active_playlist.size()) this->playlist_position -= (int)this->active_playlist.size();
|
|
|
|
while (this->playlist_position < 0) this->playlist_position += (int)this->active_playlist.size();
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
2018-06-24 18:06:05 +00:00
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
/**
|
|
|
|
* Save a custom playlist to settings after modification.
|
|
|
|
* @param pl Playlist to store back
|
|
|
|
*/
|
|
|
|
void MusicSystem::SaveCustomPlaylist(PlaylistChoices pl)
|
|
|
|
{
|
|
|
|
byte *settings_pl;
|
|
|
|
if (pl == PLCH_CUSTOM1) {
|
|
|
|
settings_pl = _settings_client.music.custom_1;
|
|
|
|
} else if (pl == PLCH_CUSTOM2) {
|
|
|
|
settings_pl = _settings_client.music.custom_2;
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
size_t num = 0;
|
|
|
|
MemSetT(settings_pl, 0, NUM_SONGS_PLAYLIST);
|
|
|
|
|
|
|
|
for (Playlist::const_iterator song = this->standard_playlists[pl].begin(); song != this->standard_playlists[pl].end(); ++song) {
|
|
|
|
/* Music set indices in the settings playlist are 1-based, 0 means unused slot */
|
|
|
|
settings_pl[num++] = (byte)song->set_index + 1;
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check music playback status and start/stop/song-finished.
|
|
|
|
* Called from main loop.
|
|
|
|
*/
|
|
|
|
void MusicLoop()
|
2009-09-02 14:09:51 +00:00
|
|
|
{
|
2018-06-24 18:06:05 +00:00
|
|
|
_music.CheckStatus();
|
2009-09-02 14:09:51 +00:00
|
|
|
}
|
|
|
|
|
2018-03-20 16:06:39 +00:00
|
|
|
/**
|
|
|
|
* Change the configured music set and reset playback
|
|
|
|
* @param index Index of music set to switch to
|
|
|
|
*/
|
|
|
|
void ChangeMusicSet(int index)
|
|
|
|
{
|
|
|
|
if (BaseMusic::GetIndexOfUsedSet() == index) return;
|
2020-05-17 21:32:06 +00:00
|
|
|
_music.ChangeMusicSet(BaseMusic::GetSet(index)->name);
|
2018-06-24 18:06:05 +00:00
|
|
|
}
|
2018-03-20 16:06:39 +00:00
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
/**
|
|
|
|
* Prepare the music system for use.
|
|
|
|
* Called from \c InitializeGame
|
|
|
|
*/
|
|
|
|
void InitializeMusic()
|
|
|
|
{
|
|
|
|
_music.BuildPlaylists();
|
2018-03-20 16:06:39 +00:00
|
|
|
}
|
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
|
2008-05-17 22:52:51 +00:00
|
|
|
struct MusicTrackSelectionWindow : public Window {
|
2013-05-26 19:23:42 +00:00
|
|
|
MusicTrackSelectionWindow(WindowDesc *desc, WindowNumber number) : Window(desc)
|
2008-05-17 22:52:51 +00:00
|
|
|
{
|
2013-05-26 19:23:42 +00:00
|
|
|
this->InitNested(number);
|
2011-12-16 18:02:27 +00:00
|
|
|
this->LowerWidget(WID_MTS_LIST_LEFT);
|
|
|
|
this->LowerWidget(WID_MTS_LIST_RIGHT);
|
|
|
|
this->SetWidgetDisabledState(WID_MTS_CLEAR, _settings_client.music.playlist <= 3);
|
|
|
|
this->LowerWidget(WID_MTS_ALL + _settings_client.music.playlist);
|
2008-05-17 22:52:51 +00:00
|
|
|
}
|
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void SetStringParameters(int widget) const override
|
2008-05-17 22:52:51 +00:00
|
|
|
{
|
2009-09-02 14:09:51 +00:00
|
|
|
switch (widget) {
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_MTS_PLAYLIST:
|
2011-03-05 18:00:48 +00:00
|
|
|
SetDParam(0, STR_MUSIC_PLAYLIST_ALL + _settings_client.music.playlist);
|
2009-09-02 14:09:51 +00:00
|
|
|
break;
|
2018-03-20 16:06:39 +00:00
|
|
|
case WID_MTS_CAPTION:
|
2021-04-27 18:58:17 +00:00
|
|
|
SetDParamStr(0, BaseMusic::GetUsedSet()->name);
|
2018-03-20 16:06:39 +00:00
|
|
|
break;
|
2009-09-02 14:09:51 +00:00
|
|
|
}
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2011-03-13 21:31:29 +00:00
|
|
|
/**
|
|
|
|
* Some data on this window has become invalid.
|
|
|
|
* @param data Information about the changed data.
|
|
|
|
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
|
|
|
|
*/
|
2019-03-04 07:49:37 +00:00
|
|
|
void OnInvalidateData(int data = 0, bool gui_scope = true) override
|
2009-09-02 14:09:51 +00:00
|
|
|
{
|
2011-03-13 21:31:29 +00:00
|
|
|
if (!gui_scope) return;
|
2009-09-02 14:09:51 +00:00
|
|
|
for (int i = 0; i < 6; i++) {
|
2011-12-16 18:02:27 +00:00
|
|
|
this->SetWidgetLoweredState(WID_MTS_ALL + i, i == _settings_client.music.playlist);
|
2009-09-02 14:09:51 +00:00
|
|
|
}
|
2011-12-16 18:02:27 +00:00
|
|
|
this->SetWidgetDisabledState(WID_MTS_CLEAR, _settings_client.music.playlist <= 3);
|
2009-09-02 14:09:51 +00:00
|
|
|
this->SetDirty();
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
|
2009-09-02 14:09:51 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_MTS_PLAYLIST: {
|
2009-09-02 14:09:51 +00:00
|
|
|
Dimension d = {0, 0};
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-09-02 14:09:51 +00:00
|
|
|
for (int i = 0; i < 6; i++) {
|
|
|
|
SetDParam(0, STR_MUSIC_PLAYLIST_ALL + i);
|
|
|
|
d = maxdim(d, GetStringBoundingBox(STR_PLAYLIST_PROGRAM));
|
|
|
|
}
|
|
|
|
d.width += padding.width;
|
|
|
|
d.height += padding.height;
|
|
|
|
*size = maxdim(*size, d);
|
2010-08-01 18:53:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_MTS_LIST_LEFT: case WID_MTS_LIST_RIGHT: {
|
2009-09-02 14:09:51 +00:00
|
|
|
Dimension d = {0, 0};
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2018-06-24 18:06:05 +00:00
|
|
|
for (MusicSystem::Playlist::const_iterator song = _music.music_set.begin(); song != _music.music_set.end(); ++song) {
|
|
|
|
SetDParam(0, song->tracknr);
|
2009-11-19 13:56:10 +00:00
|
|
|
SetDParam(1, 2);
|
2018-06-24 18:06:05 +00:00
|
|
|
SetDParamStr(2, song->songname);
|
2009-11-19 13:56:10 +00:00
|
|
|
Dimension d2 = GetStringBoundingBox(STR_PLAYLIST_TRACK_NAME);
|
2021-01-08 10:16:18 +00:00
|
|
|
d.width = std::max(d.width, d2.width);
|
2009-09-02 14:09:51 +00:00
|
|
|
d.height += d2.height;
|
|
|
|
}
|
|
|
|
d.width += padding.width;
|
|
|
|
d.height += padding.height;
|
|
|
|
*size = maxdim(*size, d);
|
2010-08-01 18:53:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
2009-09-02 14:09:51 +00:00
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void DrawWidget(const Rect &r, int widget) const override
|
2009-09-02 14:09:51 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_MTS_LIST_LEFT: {
|
2011-05-06 21:13:29 +00:00
|
|
|
GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, PC_BLACK);
|
2009-09-02 14:09:51 +00:00
|
|
|
|
|
|
|
int y = r.top + WD_FRAMERECT_TOP;
|
2018-06-24 18:06:05 +00:00
|
|
|
for (MusicSystem::Playlist::const_iterator song = _music.music_set.begin(); song != _music.music_set.end(); ++song) {
|
|
|
|
SetDParam(0, song->tracknr);
|
2009-11-19 13:56:10 +00:00
|
|
|
SetDParam(1, 2);
|
2018-06-24 18:06:05 +00:00
|
|
|
SetDParamStr(2, song->songname);
|
2009-11-19 13:56:10 +00:00
|
|
|
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_PLAYLIST_TRACK_NAME);
|
2009-09-02 14:09:51 +00:00
|
|
|
y += FONT_HEIGHT_SMALL;
|
|
|
|
}
|
2010-08-01 18:53:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_MTS_LIST_RIGHT: {
|
2011-05-06 21:13:29 +00:00
|
|
|
GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, PC_BLACK);
|
2009-09-02 14:09:51 +00:00
|
|
|
|
|
|
|
int y = r.top + WD_FRAMERECT_TOP;
|
2018-06-24 21:36:55 +00:00
|
|
|
for (MusicSystem::Playlist::const_iterator song = _music.active_playlist.begin(); song != _music.active_playlist.end(); ++song) {
|
2018-06-24 18:06:05 +00:00
|
|
|
SetDParam(0, song->tracknr);
|
2009-11-19 13:56:10 +00:00
|
|
|
SetDParam(1, 2);
|
2018-06-24 18:06:05 +00:00
|
|
|
SetDParamStr(2, song->songname);
|
2009-11-19 13:56:10 +00:00
|
|
|
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_PLAYLIST_TRACK_NAME);
|
2009-09-02 14:09:51 +00:00
|
|
|
y += FONT_HEIGHT_SMALL;
|
|
|
|
}
|
2010-08-01 18:53:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
}
|
2004-09-10 19:02:27 +00:00
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void OnClick(Point pt, int widget, int click_count) override
|
2008-05-17 22:52:51 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_MTS_LIST_LEFT: { // add to playlist
|
2010-07-26 13:02:28 +00:00
|
|
|
int y = this->GetRowFromWidget(pt.y, widget, 0, FONT_HEIGHT_SMALL);
|
2018-06-24 18:06:05 +00:00
|
|
|
_music.PlaylistAdd(y);
|
2010-08-01 18:53:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2006-07-07 02:44:51 +00:00
|
|
|
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_MTS_LIST_RIGHT: { // remove from playlist
|
2010-07-26 13:02:28 +00:00
|
|
|
int y = this->GetRowFromWidget(pt.y, widget, 0, FONT_HEIGHT_SMALL);
|
2018-06-24 18:06:05 +00:00
|
|
|
_music.PlaylistRemove(y);
|
2010-08-01 18:53:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2006-07-07 02:44:51 +00:00
|
|
|
|
2018-03-20 16:06:39 +00:00
|
|
|
case WID_MTS_MUSICSET: {
|
|
|
|
int selected = 0;
|
2019-04-02 19:31:24 +00:00
|
|
|
ShowDropDownList(this, BuildMusicSetDropDownList(&selected), selected, widget, 0, true, false);
|
2018-03-20 16:06:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_MTS_CLEAR: // clear
|
2018-06-24 18:06:05 +00:00
|
|
|
_music.PlaylistClear();
|
2008-05-17 22:52:51 +00:00
|
|
|
break;
|
2006-07-07 02:44:51 +00:00
|
|
|
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_MTS_ALL: case WID_MTS_OLD: case WID_MTS_NEW:
|
|
|
|
case WID_MTS_EZY: case WID_MTS_CUSTOM1: case WID_MTS_CUSTOM2: // set playlist
|
2018-06-24 18:06:05 +00:00
|
|
|
_music.ChangePlaylist((MusicSystem::PlaylistChoices)(widget - WID_MTS_ALL));
|
2008-05-17 22:52:51 +00:00
|
|
|
break;
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
}
|
2018-03-20 16:06:39 +00:00
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void OnDropdownSelect(int widget, int index) override
|
2018-03-20 16:06:39 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
|
|
|
case WID_MTS_MUSICSET:
|
|
|
|
ChangeMusicSet(index);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NOT_REACHED();
|
|
|
|
}
|
|
|
|
}
|
2008-05-17 22:52:51 +00:00
|
|
|
};
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-04-10 11:06:12 +00:00
|
|
|
static const NWidgetPart _nested_music_track_selection_widgets[] = {
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-11-24 18:05:55 +00:00
|
|
|
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
2018-03-20 16:06:39 +00:00
|
|
|
NWidget(WWT_CAPTION, COLOUR_GREY, WID_MTS_CAPTION), SetDataTip(STR_PLAYLIST_MUSIC_SELECTION_SETNAME, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
|
|
|
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_MTS_MUSICSET), SetDataTip(STR_PLAYLIST_CHANGE_SET, STR_PLAYLIST_TOOLTIP_CHANGE_SET),
|
2009-04-10 11:06:12 +00:00
|
|
|
EndContainer(),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY),
|
2009-04-10 11:06:12 +00:00
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(2, 4, 2),
|
|
|
|
/* Left panel. */
|
|
|
|
NWidget(NWID_VERTICAL),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_PLAYLIST_TRACK_INDEX, STR_NULL),
|
2011-12-16 18:02:27 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY, WID_MTS_LIST_LEFT), SetMinimalSize(180, 194), SetDataTip(0x0, STR_PLAYLIST_TOOLTIP_CLICK_TO_ADD_TRACK), EndContainer(),
|
2009-04-10 11:06:12 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 2),
|
|
|
|
EndContainer(),
|
|
|
|
/* Middle buttons. */
|
|
|
|
NWidget(NWID_VERTICAL),
|
2009-09-02 14:09:51 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(60, 30), // Space above the first button from the title bar.
|
2011-12-16 18:02:27 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_ALL), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_ALL, STR_MUSIC_TOOLTIP_SELECT_ALL_TRACKS_PROGRAM),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_OLD), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_OLD_STYLE, STR_MUSIC_TOOLTIP_SELECT_OLD_STYLE_MUSIC),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_NEW), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_NEW_STYLE, STR_MUSIC_TOOLTIP_SELECT_NEW_STYLE_MUSIC),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_EZY), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_EZY_STREET, STR_MUSIC_TOOLTIP_SELECT_EZY_STREET_STYLE),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_CUSTOM1), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_CUSTOM_1, STR_MUSIC_TOOLTIP_SELECT_CUSTOM_1_USER_DEFINED),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_CUSTOM2), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_CUSTOM_2, STR_MUSIC_TOOLTIP_SELECT_CUSTOM_2_USER_DEFINED),
|
2009-04-10 11:06:12 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 16), // Space above 'clear' button
|
2011-12-16 18:02:27 +00:00
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_MTS_CLEAR), SetFill(1, 0), SetDataTip(STR_PLAYLIST_CLEAR, STR_PLAYLIST_TOOLTIP_CLEAR_CURRENT_PROGRAM_CUSTOM1),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(NWID_SPACER), SetFill(0, 1),
|
2009-04-10 11:06:12 +00:00
|
|
|
EndContainer(),
|
|
|
|
/* Right panel. */
|
|
|
|
NWidget(NWID_VERTICAL),
|
2011-12-16 18:02:27 +00:00
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, WID_MTS_PLAYLIST), SetDataTip(STR_PLAYLIST_PROGRAM, STR_NULL),
|
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY, WID_MTS_LIST_RIGHT), SetMinimalSize(180, 194), SetDataTip(0x0, STR_PLAYLIST_TOOLTIP_CLICK_TO_REMOVE_TRACK), EndContainer(),
|
2009-04-10 11:06:12 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 2),
|
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
};
|
|
|
|
|
2013-05-26 19:23:42 +00:00
|
|
|
static WindowDesc _music_track_selection_desc(
|
2013-05-26 19:25:01 +00:00
|
|
|
WDP_AUTO, "music_track", 0, 0,
|
2007-02-01 15:49:12 +00:00
|
|
|
WC_MUSIC_TRACK_SELECTION, WC_NONE,
|
2012-11-11 16:10:43 +00:00
|
|
|
0,
|
2009-11-15 10:26:01 +00:00
|
|
|
_nested_music_track_selection_widgets, lengthof(_nested_music_track_selection_widgets)
|
2009-03-15 15:12:06 +00:00
|
|
|
);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
static void ShowMusicTrackSelection()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2008-05-17 22:52:51 +00:00
|
|
|
AllocateWindowDescFront<MusicTrackSelectionWindow>(&_music_track_selection_desc, 0);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2008-05-17 22:52:51 +00:00
|
|
|
struct MusicWindow : public Window {
|
2013-05-26 19:23:42 +00:00
|
|
|
MusicWindow(WindowDesc *desc, WindowNumber number) : Window(desc)
|
2008-05-17 22:52:51 +00:00
|
|
|
{
|
2013-05-26 19:23:42 +00:00
|
|
|
this->InitNested(number);
|
2011-12-16 18:02:27 +00:00
|
|
|
this->LowerWidget(_settings_client.music.playlist + WID_M_ALL);
|
|
|
|
this->SetWidgetLoweredState(WID_M_SHUFFLE, _settings_client.music.shuffle);
|
2018-03-19 19:13:25 +00:00
|
|
|
|
|
|
|
UpdateDisabledButtons();
|
|
|
|
}
|
|
|
|
|
|
|
|
void UpdateDisabledButtons()
|
|
|
|
{
|
|
|
|
/* Disable music control widgets if there is no music
|
|
|
|
* -- except Programme button! So you can still select a music set. */
|
|
|
|
this->SetWidgetsDisabledState(
|
|
|
|
BaseMusic::GetUsedSet()->num_available == 0,
|
|
|
|
WID_M_PREV, WID_M_NEXT, WID_M_STOP, WID_M_PLAY, WID_M_SHUFFLE,
|
|
|
|
WID_M_ALL, WID_M_OLD, WID_M_NEW, WID_M_EZY, WID_M_CUSTOM1, WID_M_CUSTOM2,
|
|
|
|
WIDGET_LIST_END
|
|
|
|
);
|
2008-05-17 22:52:51 +00:00
|
|
|
}
|
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
|
2009-09-01 19:18:42 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
2011-12-16 18:02:27 +00:00
|
|
|
/* Make sure that WID_M_SHUFFLE and WID_M_PROGRAMME have the same size.
|
|
|
|
* This can't be done by using NC_EQUALSIZE as the WID_M_INFO is
|
2009-09-01 19:18:42 +00:00
|
|
|
* between those widgets and of different size. */
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_M_SHUFFLE: case WID_M_PROGRAMME: {
|
2009-09-01 19:18:42 +00:00
|
|
|
Dimension d = maxdim(GetStringBoundingBox(STR_MUSIC_PROGRAM), GetStringBoundingBox(STR_MUSIC_SHUFFLE));
|
|
|
|
d.width += padding.width;
|
|
|
|
d.height += padding.height;
|
|
|
|
*size = maxdim(*size, d);
|
2010-08-01 18:53:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-09-01 21:30:14 +00:00
|
|
|
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_M_TRACK_NR: {
|
2009-09-01 21:30:14 +00:00
|
|
|
Dimension d = GetStringBoundingBox(STR_MUSIC_TRACK_NONE);
|
|
|
|
d.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
|
|
|
|
d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
|
|
|
|
*size = maxdim(*size, d);
|
2010-08-01 18:53:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-09-01 21:30:14 +00:00
|
|
|
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_M_TRACK_NAME: {
|
2009-09-01 21:30:14 +00:00
|
|
|
Dimension d = GetStringBoundingBox(STR_MUSIC_TITLE_NONE);
|
2018-06-24 18:06:05 +00:00
|
|
|
for (MusicSystem::Playlist::const_iterator song = _music.music_set.begin(); song != _music.music_set.end(); ++song) {
|
|
|
|
SetDParamStr(0, song->songname);
|
2009-09-01 21:30:14 +00:00
|
|
|
d = maxdim(d, GetStringBoundingBox(STR_MUSIC_TITLE_NAME));
|
|
|
|
}
|
|
|
|
d.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
|
|
|
|
d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
|
|
|
|
*size = maxdim(*size, d);
|
2010-08-01 18:53:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-11-19 20:34:45 +00:00
|
|
|
|
|
|
|
/* Hack-ish: set the proper widget data; only needs to be done once
|
|
|
|
* per (Re)Init as that's the only time the language changes. */
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_M_PREV: this->GetWidget<NWidgetCore>(WID_M_PREV)->widget_data = _current_text_dir == TD_RTL ? SPR_IMG_SKIP_TO_NEXT : SPR_IMG_SKIP_TO_PREV; break;
|
|
|
|
case WID_M_NEXT: this->GetWidget<NWidgetCore>(WID_M_NEXT)->widget_data = _current_text_dir == TD_RTL ? SPR_IMG_SKIP_TO_PREV : SPR_IMG_SKIP_TO_NEXT; break;
|
|
|
|
case WID_M_PLAY: this->GetWidget<NWidgetCore>(WID_M_PLAY)->widget_data = _current_text_dir == TD_RTL ? SPR_IMG_PLAY_MUSIC_RTL : SPR_IMG_PLAY_MUSIC; break;
|
2009-09-01 19:18:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void DrawWidget(const Rect &r, int widget) const override
|
2008-05-17 22:52:51 +00:00
|
|
|
{
|
2009-08-30 19:23:36 +00:00
|
|
|
switch (widget) {
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_M_TRACK_NR: {
|
2011-05-06 21:13:29 +00:00
|
|
|
GfxFillRect(r.left + 1, r.top + 1, r.right, r.bottom, PC_BLACK);
|
2018-03-19 19:26:13 +00:00
|
|
|
if (BaseMusic::GetUsedSet()->num_available == 0) {
|
|
|
|
break;
|
|
|
|
}
|
2009-08-30 19:23:36 +00:00
|
|
|
StringID str = STR_MUSIC_TRACK_NONE;
|
2018-06-24 18:06:05 +00:00
|
|
|
if (_music.IsPlaying()) {
|
|
|
|
SetDParam(0, _music.GetCurrentSong().tracknr);
|
2009-11-24 13:14:48 +00:00
|
|
|
SetDParam(1, 2);
|
2009-11-19 13:56:10 +00:00
|
|
|
str = STR_MUSIC_TRACK_DIGIT;
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
2009-09-01 21:30:14 +00:00
|
|
|
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, str);
|
2010-08-01 18:53:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-09-01 21:30:14 +00:00
|
|
|
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_M_TRACK_NAME: {
|
2011-05-06 21:13:29 +00:00
|
|
|
GfxFillRect(r.left, r.top + 1, r.right - 1, r.bottom, PC_BLACK);
|
2009-09-01 21:30:14 +00:00
|
|
|
StringID str = STR_MUSIC_TITLE_NONE;
|
2020-01-12 13:56:27 +00:00
|
|
|
MusicSystem::PlaylistEntry entry(_music.GetCurrentSong());
|
2018-03-19 19:26:13 +00:00
|
|
|
if (BaseMusic::GetUsedSet()->num_available == 0) {
|
|
|
|
str = STR_MUSIC_TITLE_NOMUSIC;
|
2018-06-24 18:06:05 +00:00
|
|
|
} else if (_music.IsPlaying()) {
|
2009-08-30 19:23:36 +00:00
|
|
|
str = STR_MUSIC_TITLE_NAME;
|
2020-01-12 13:56:27 +00:00
|
|
|
SetDParamStr(0, entry.songname);
|
2009-08-30 19:23:36 +00:00
|
|
|
}
|
2010-07-02 13:53:05 +00:00
|
|
|
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_FROMSTRING, SA_HOR_CENTER);
|
2010-08-01 18:53:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-08-30 21:31:54 +00:00
|
|
|
|
2021-04-04 08:04:06 +00:00
|
|
|
case WID_M_MUSIC_VOL:
|
|
|
|
DrawVolumeSliderWidget(r, _settings_client.music.music_vol);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WID_M_EFFECT_VOL:
|
|
|
|
DrawVolumeSliderWidget(r, _settings_client.music.effect_vol);
|
2010-08-01 18:53:30 +00:00
|
|
|
break;
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
2009-08-30 19:23:36 +00:00
|
|
|
}
|
2004-09-10 19:02:27 +00:00
|
|
|
|
2011-03-13 21:31:29 +00:00
|
|
|
/**
|
|
|
|
* Some data on this window has become invalid.
|
|
|
|
* @param data Information about the changed data.
|
|
|
|
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
|
|
|
|
*/
|
2019-03-04 07:49:37 +00:00
|
|
|
void OnInvalidateData(int data = 0, bool gui_scope = true) override
|
2009-09-02 14:09:51 +00:00
|
|
|
{
|
2011-03-13 21:31:29 +00:00
|
|
|
if (!gui_scope) return;
|
2009-09-02 14:09:51 +00:00
|
|
|
for (int i = 0; i < 6; i++) {
|
2011-12-16 18:02:27 +00:00
|
|
|
this->SetWidgetLoweredState(WID_M_ALL + i, i == _settings_client.music.playlist);
|
2009-09-02 14:09:51 +00:00
|
|
|
}
|
2018-03-19 19:13:25 +00:00
|
|
|
|
|
|
|
UpdateDisabledButtons();
|
|
|
|
|
2009-09-02 14:09:51 +00:00
|
|
|
this->SetDirty();
|
|
|
|
}
|
|
|
|
|
2019-03-04 07:49:37 +00:00
|
|
|
void OnClick(Point pt, int widget, int click_count) override
|
2008-05-17 22:52:51 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_M_PREV: // skip to prev
|
2018-06-24 18:06:05 +00:00
|
|
|
_music.Prev();
|
2008-05-17 22:52:51 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_M_NEXT: // skip to next
|
2018-06-24 18:06:05 +00:00
|
|
|
_music.Next();
|
2008-05-17 22:52:51 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_M_STOP: // stop playing
|
2018-06-24 18:06:05 +00:00
|
|
|
_music.Stop();
|
2008-05-17 22:52:51 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_M_PLAY: // start playing
|
2018-06-24 18:06:05 +00:00
|
|
|
_music.Play();
|
2008-05-17 22:52:51 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_M_MUSIC_VOL: case WID_M_EFFECT_VOL: { // volume sliders
|
2021-04-04 08:04:06 +00:00
|
|
|
byte &vol = (widget == WID_M_MUSIC_VOL) ? _settings_client.music.music_vol : _settings_client.music.effect_vol;
|
|
|
|
if (ClickVolumeSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, vol)) {
|
|
|
|
if (widget == WID_M_MUSIC_VOL) MusicDriver::GetInstance()->SetVolume(vol);
|
2021-05-06 00:36:56 +00:00
|
|
|
this->SetWidgetDirty(widget);
|
2021-04-04 09:22:13 +00:00
|
|
|
SetWindowClassesDirty(WC_GAME_OPTIONS);
|
2008-05-17 22:52:51 +00:00
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2019-02-14 06:26:29 +00:00
|
|
|
if (click_count > 0) this->mouse_capture_widget = widget;
|
2010-08-01 18:53:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-05-17 22:52:51 +00:00
|
|
|
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_M_SHUFFLE: // toggle shuffle
|
2018-06-24 18:06:05 +00:00
|
|
|
if (_music.IsShuffle()) {
|
|
|
|
_music.Unshuffle();
|
|
|
|
} else {
|
|
|
|
_music.Shuffle();
|
|
|
|
}
|
|
|
|
this->SetWidgetLoweredState(WID_M_SHUFFLE, _music.IsShuffle());
|
2011-12-16 18:02:27 +00:00
|
|
|
this->SetWidgetDirty(WID_M_SHUFFLE);
|
2008-05-17 22:52:51 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_M_PROGRAMME: // show track selection
|
2008-05-17 22:52:51 +00:00
|
|
|
ShowMusicTrackSelection();
|
|
|
|
break;
|
|
|
|
|
2011-12-16 18:02:27 +00:00
|
|
|
case WID_M_ALL: case WID_M_OLD: case WID_M_NEW:
|
|
|
|
case WID_M_EZY: case WID_M_CUSTOM1: case WID_M_CUSTOM2: // playlist
|
2018-06-24 18:06:05 +00:00
|
|
|
_music.ChangePlaylist((MusicSystem::PlaylistChoices)(widget - WID_M_ALL));
|
2008-05-17 22:52:51 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
2008-05-17 22:52:51 +00:00
|
|
|
};
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-04-10 11:06:12 +00:00
|
|
|
static const NWidgetPart _nested_music_window_widgets[] = {
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-11-24 18:05:55 +00:00
|
|
|
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
|
|
|
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_MUSIC_JAZZ_JUKEBOX_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
2013-09-15 15:56:46 +00:00
|
|
|
NWidget(WWT_SHADEBOX, COLOUR_GREY),
|
|
|
|
NWidget(WWT_STICKYBOX, COLOUR_GREY),
|
2009-04-10 11:06:12 +00:00
|
|
|
EndContainer(),
|
|
|
|
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-11-24 13:14:48 +00:00
|
|
|
NWidget(NWID_VERTICAL),
|
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY, -1), SetFill(1, 1), EndContainer(),
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2011-12-16 18:02:27 +00:00
|
|
|
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_M_PREV), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_SKIP_TO_PREV, STR_MUSIC_TOOLTIP_SKIP_TO_PREVIOUS_TRACK),
|
|
|
|
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_M_NEXT), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_SKIP_TO_NEXT, STR_MUSIC_TOOLTIP_SKIP_TO_NEXT_TRACK_IN_SELECTION),
|
|
|
|
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_M_STOP), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_STOP_MUSIC, STR_MUSIC_TOOLTIP_STOP_PLAYING_MUSIC),
|
|
|
|
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_M_PLAY), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_PLAY_MUSIC, STR_MUSIC_TOOLTIP_START_PLAYING_MUSIC),
|
2009-11-24 13:14:48 +00:00
|
|
|
EndContainer(),
|
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY, -1), SetFill(1, 1), EndContainer(),
|
|
|
|
EndContainer(),
|
2011-12-16 18:02:27 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY, WID_M_SLIDERS),
|
2020-01-05 14:20:18 +00:00
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(4, 0, 4),
|
2009-11-24 13:14:48 +00:00
|
|
|
NWidget(NWID_VERTICAL),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, -1), SetFill(1, 0), SetDataTip(STR_MUSIC_MUSIC_VOLUME, STR_NULL),
|
2020-01-05 14:20:18 +00:00
|
|
|
NWidget(WWT_EMPTY, COLOUR_GREY, WID_M_MUSIC_VOL), SetMinimalSize(67, 0), SetPadding(2), SetMinimalTextLines(1, 0), SetFill(1, 0), SetDataTip(0x0, STR_MUSIC_TOOLTIP_DRAG_SLIDERS_TO_SET_MUSIC),
|
2009-11-24 13:14:48 +00:00
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_VERTICAL),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, -1), SetFill(1, 0), SetDataTip(STR_MUSIC_EFFECTS_VOLUME, STR_NULL),
|
2020-01-05 14:20:18 +00:00
|
|
|
NWidget(WWT_EMPTY, COLOUR_GREY, WID_M_EFFECT_VOL), SetMinimalSize(67, 0), SetPadding(2), SetMinimalTextLines(1, 0), SetFill(1, 0), SetDataTip(0x0, STR_MUSIC_TOOLTIP_DRAG_SLIDERS_TO_SET_MUSIC),
|
2009-11-24 13:14:48 +00:00
|
|
|
EndContainer(),
|
2009-08-30 20:38:57 +00:00
|
|
|
EndContainer(),
|
2009-04-10 11:06:12 +00:00
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
2011-12-16 18:02:27 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY, WID_M_BACKGROUND),
|
2009-09-01 19:18:42 +00:00
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(6, 0, 6),
|
2009-11-24 13:14:48 +00:00
|
|
|
NWidget(NWID_VERTICAL),
|
|
|
|
NWidget(NWID_SPACER), SetFill(0, 1),
|
2011-12-16 18:02:27 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_M_SHUFFLE), SetMinimalSize(50, 8), SetDataTip(STR_MUSIC_SHUFFLE, STR_MUSIC_TOOLTIP_TOGGLE_PROGRAM_SHUFFLE),
|
2009-11-24 13:14:48 +00:00
|
|
|
NWidget(NWID_SPACER), SetFill(0, 1),
|
|
|
|
EndContainer(),
|
2009-09-01 21:30:14 +00:00
|
|
|
NWidget(NWID_VERTICAL), SetPadding(0, 0, 3, 3),
|
2011-12-16 18:02:27 +00:00
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, WID_M_TRACK), SetFill(0, 0), SetDataTip(STR_MUSIC_TRACK, STR_NULL),
|
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY, WID_M_TRACK_NR), EndContainer(),
|
2009-09-01 21:30:14 +00:00
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_VERTICAL), SetPadding(0, 3, 3, 0),
|
2011-12-16 18:02:27 +00:00
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, WID_M_TRACK_TITLE), SetFill(1, 0), SetDataTip(STR_MUSIC_XTITLE, STR_NULL),
|
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY, WID_M_TRACK_NAME), SetFill(1, 0), EndContainer(),
|
2009-11-24 13:14:48 +00:00
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_VERTICAL),
|
|
|
|
NWidget(NWID_SPACER), SetFill(0, 1),
|
2011-12-16 18:02:27 +00:00
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_M_PROGRAMME), SetMinimalSize(50, 8), SetDataTip(STR_MUSIC_PROGRAM, STR_MUSIC_TOOLTIP_SHOW_MUSIC_TRACK_SELECTION),
|
2009-11-24 13:14:48 +00:00
|
|
|
NWidget(NWID_SPACER), SetFill(0, 1),
|
2009-04-10 11:06:12 +00:00
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
2009-08-30 20:38:57 +00:00
|
|
|
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
|
2011-12-16 18:02:27 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_M_ALL), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_ALL, STR_MUSIC_TOOLTIP_SELECT_ALL_TRACKS_PROGRAM),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_M_OLD), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_OLD_STYLE, STR_MUSIC_TOOLTIP_SELECT_OLD_STYLE_MUSIC),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_M_NEW), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_NEW_STYLE, STR_MUSIC_TOOLTIP_SELECT_NEW_STYLE_MUSIC),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_M_EZY), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_EZY_STREET, STR_MUSIC_TOOLTIP_SELECT_EZY_STREET_STYLE),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_M_CUSTOM1), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_CUSTOM_1, STR_MUSIC_TOOLTIP_SELECT_CUSTOM_1_USER_DEFINED),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_M_CUSTOM2), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_CUSTOM_2, STR_MUSIC_TOOLTIP_SELECT_CUSTOM_2_USER_DEFINED),
|
2009-04-10 11:06:12 +00:00
|
|
|
EndContainer(),
|
|
|
|
};
|
|
|
|
|
2013-05-26 19:23:42 +00:00
|
|
|
static WindowDesc _music_window_desc(
|
2013-05-26 19:25:01 +00:00
|
|
|
WDP_AUTO, "music", 0, 0,
|
2007-02-01 15:49:12 +00:00
|
|
|
WC_MUSIC_WINDOW, WC_NONE,
|
2012-11-11 16:10:43 +00:00
|
|
|
0,
|
2009-11-15 10:26:01 +00:00
|
|
|
_nested_music_window_widgets, lengthof(_nested_music_window_widgets)
|
2009-03-15 15:12:06 +00:00
|
|
|
);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
void ShowMusicWindow()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2008-05-17 22:52:51 +00:00
|
|
|
AllocateWindowDescFront<MusicWindow>(&_music_window_desc, 0);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|