2005-07-24 14:12:37 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
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"
|
2005-06-02 19:30:21 +00:00
|
|
|
#include "openttd.h"
|
2008-08-31 10:50:05 +00:00
|
|
|
#include "fileio_func.h"
|
2006-07-07 02:44:51 +00:00
|
|
|
#include "music.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"
|
2008-01-29 00:26:31 +00:00
|
|
|
#include "core/random_func.hpp"
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2008-01-13 01:21:35 +00:00
|
|
|
#include "table/strings.h"
|
|
|
|
#include "table/sprites.h"
|
|
|
|
|
2005-07-21 19:46:58 +00:00
|
|
|
static byte _music_wnd_cursong;
|
|
|
|
static bool _song_is_active;
|
2006-07-07 02:44:51 +00:00
|
|
|
static byte _cur_playlist[NUM_SONGS_PLAYLIST];
|
2005-07-21 19:46:58 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
static byte _playlist_all[] = {
|
2005-11-14 19:48:04 +00:00
|
|
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0
|
2004-08-09 17:04:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static byte _playlist_old_style[] = {
|
2009-12-02 08:55:53 +00:00
|
|
|
2, 9, 3, 10, 15, 16, 20, 14, 0
|
2004-08-09 17:04:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static byte _playlist_new_style[] = {
|
2009-12-02 08:55:53 +00:00
|
|
|
7, 12, 11, 18, 22, 19, 6, 0
|
2004-08-09 17:04:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static byte _playlist_ezy_street[] = {
|
2009-12-02 08:55:53 +00:00
|
|
|
13, 8, 17, 4, 21, 5, 0
|
2004-08-09 17:04:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static byte * const _playlists[] = {
|
|
|
|
_playlist_all,
|
|
|
|
_playlist_old_style,
|
|
|
|
_playlist_new_style,
|
|
|
|
_playlist_ezy_street,
|
|
|
|
msf.custom_1,
|
|
|
|
msf.custom_2,
|
|
|
|
};
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
static void SkipToPrevSong()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
byte *b = _cur_playlist;
|
|
|
|
byte *p = b;
|
|
|
|
byte t;
|
|
|
|
|
2006-10-17 03:39:30 +00:00
|
|
|
if (b[0] == 0) return; // empty playlist
|
2004-09-10 19:02:27 +00:00
|
|
|
|
2006-10-17 03:39:30 +00:00
|
|
|
do p++; while (p[0] != 0); // find the end
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2006-10-17 03:39:30 +00:00
|
|
|
t = *--p; // and copy the bytes
|
2004-08-09 17:04:08 +00:00
|
|
|
while (p != b) {
|
|
|
|
p--;
|
|
|
|
p[1] = p[0];
|
|
|
|
}
|
|
|
|
*b = t;
|
|
|
|
|
|
|
|
_song_is_active = false;
|
|
|
|
}
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
static void SkipToNextSong()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2009-01-10 00:31:47 +00:00
|
|
|
byte *b = _cur_playlist;
|
2005-11-14 19:48:04 +00:00
|
|
|
byte t;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2005-11-14 19:48:04 +00:00
|
|
|
t = b[0];
|
|
|
|
if (t != 0) {
|
|
|
|
while (b[1] != 0) {
|
2004-08-09 17:04:08 +00:00
|
|
|
b[0] = b[1];
|
|
|
|
b++;
|
|
|
|
}
|
|
|
|
b[0] = t;
|
|
|
|
}
|
|
|
|
|
|
|
|
_song_is_active = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void MusicVolumeChanged(byte new_vol)
|
|
|
|
{
|
2007-07-05 12:23:54 +00:00
|
|
|
_music_driver->SetVolume(new_vol);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
static void DoPlaySong()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2007-06-17 15:48:57 +00:00
|
|
|
char filename[MAX_PATH];
|
|
|
|
FioFindFullPath(filename, lengthof(filename), GM_DIR,
|
2009-01-03 17:09:31 +00:00
|
|
|
_origin_songs_specs[_music_wnd_cursong - 1].filename);
|
2007-07-05 12:23:54 +00:00
|
|
|
_music_driver->PlaySong(filename);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
static void DoStopMusic()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2007-07-05 12:23:54 +00:00
|
|
|
_music_driver->StopSong();
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
static void SelectSongToPlay()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2005-07-31 17:18:43 +00:00
|
|
|
uint i = 0;
|
2006-07-07 02:44:51 +00:00
|
|
|
uint j = 0;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2005-07-31 17:18:43 +00:00
|
|
|
memset(_cur_playlist, 0, sizeof(_cur_playlist));
|
2005-06-01 11:52:44 +00:00
|
|
|
do {
|
2007-06-17 15:48:57 +00:00
|
|
|
/* We are now checking for the existence of that file prior
|
|
|
|
* to add it to the list of available songs */
|
2009-01-03 17:09:31 +00:00
|
|
|
if (FioCheckFileExists(_origin_songs_specs[_playlists[msf.playlist][i] - 1].filename, GM_DIR)) {
|
2007-06-17 15:48:57 +00:00
|
|
|
_cur_playlist[j] = _playlists[msf.playlist][i];
|
|
|
|
j++;
|
2006-07-07 02:44:51 +00:00
|
|
|
}
|
2009-01-03 17:10:20 +00:00
|
|
|
} while (_playlists[msf.playlist][++i] != 0 && j < lengthof(_cur_playlist) - 1);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2007-10-17 01:33:21 +00:00
|
|
|
/* Do not shuffle when on the intro-start window, as the song to play has to be the original TTD Theme*/
|
|
|
|
if (msf.shuffle && _game_mode != GM_MENU) {
|
2004-08-09 17:04:08 +00:00
|
|
|
i = 500;
|
|
|
|
do {
|
|
|
|
uint32 r = InteractiveRandom();
|
2005-07-20 15:29:28 +00:00
|
|
|
byte *a = &_cur_playlist[GB(r, 0, 5)];
|
|
|
|
byte *b = &_cur_playlist[GB(r, 8, 5)];
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
if (*a != 0 && *b != 0) {
|
|
|
|
byte t = *a;
|
|
|
|
*a = *b;
|
|
|
|
*b = t;
|
|
|
|
}
|
|
|
|
} while (--i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
static void StopMusic()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
_music_wnd_cursong = 0;
|
|
|
|
DoStopMusic();
|
|
|
|
_song_is_active = false;
|
2009-09-13 19:15:59 +00:00
|
|
|
SetWindowWidgetDirty(WC_MUSIC_WINDOW, 0, 9);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
static void PlayPlaylistSong()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
if (_cur_playlist[0] == 0) {
|
|
|
|
SelectSongToPlay();
|
2006-10-17 03:39:30 +00:00
|
|
|
/* if there is not songs in the playlist, it may indicate
|
|
|
|
* no file on the gm folder, or even no gm folder.
|
|
|
|
* Stop the playback, then */
|
2006-07-07 02:44:51 +00:00
|
|
|
if (_cur_playlist[0] == 0) {
|
|
|
|
_song_is_active = false;
|
|
|
|
_music_wnd_cursong = 0;
|
|
|
|
msf.playing = false;
|
|
|
|
return;
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
_music_wnd_cursong = _cur_playlist[0];
|
|
|
|
DoPlaySong();
|
|
|
|
_song_is_active = true;
|
2004-09-10 19:02:27 +00:00
|
|
|
|
2009-09-13 19:15:59 +00:00
|
|
|
SetWindowWidgetDirty(WC_MUSIC_WINDOW, 0, 9);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
void ResetMusic()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
_music_wnd_cursong = 1;
|
|
|
|
DoPlaySong();
|
|
|
|
}
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
void MusicLoop()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2006-02-20 23:40:53 +00:00
|
|
|
if (!msf.playing && _song_is_active) {
|
2004-08-09 17:04:08 +00:00
|
|
|
StopMusic();
|
2006-02-20 23:40:53 +00:00
|
|
|
} else if (msf.playing && !_song_is_active) {
|
2007-10-17 01:33:21 +00:00
|
|
|
PlayPlaylistSong();
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2006-07-07 02:44:51 +00:00
|
|
|
if (!_song_is_active) return;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2007-07-05 12:23:54 +00:00
|
|
|
if (!_music_driver->IsSongPlaying()) {
|
2005-04-24 19:04:56 +00:00
|
|
|
if (_game_mode != GM_MENU) {
|
|
|
|
StopMusic();
|
|
|
|
SkipToNextSong();
|
|
|
|
PlayPlaylistSong();
|
2005-11-14 19:48:04 +00:00
|
|
|
} else {
|
2005-04-24 19:04:56 +00:00
|
|
|
ResetMusic();
|
2005-11-14 19:48:04 +00:00
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-02 14:09:51 +00:00
|
|
|
static void SelectPlaylist(byte list)
|
|
|
|
{
|
|
|
|
msf.playlist = list;
|
|
|
|
InvalidateWindowData(WC_MUSIC_TRACK_SELECTION, 0);
|
|
|
|
InvalidateWindowData(WC_MUSIC_WINDOW, 0);
|
|
|
|
}
|
|
|
|
|
2009-04-10 11:02:09 +00:00
|
|
|
enum MusicTrackSelectionWidgets {
|
|
|
|
MTSW_LIST_LEFT,
|
2009-09-02 14:09:51 +00:00
|
|
|
MTSW_PLAYLIST,
|
2009-04-10 11:02:09 +00:00
|
|
|
MTSW_LIST_RIGHT,
|
|
|
|
MTSW_ALL,
|
|
|
|
MTSW_OLD,
|
|
|
|
MTSW_NEW,
|
|
|
|
MTSW_EZY,
|
|
|
|
MTSW_CUSTOM1,
|
|
|
|
MTSW_CUSTOM2,
|
|
|
|
MTSW_CLEAR,
|
|
|
|
};
|
|
|
|
|
2008-05-17 22:52:51 +00:00
|
|
|
struct MusicTrackSelectionWindow : public Window {
|
2009-09-02 14:09:51 +00:00
|
|
|
MusicTrackSelectionWindow(const WindowDesc *desc, WindowNumber number) : Window()
|
2008-05-17 22:52:51 +00:00
|
|
|
{
|
2009-09-02 14:09:51 +00:00
|
|
|
this->InitNested(desc, number);
|
|
|
|
this->LowerWidget(MTSW_LIST_LEFT);
|
|
|
|
this->LowerWidget(MTSW_LIST_RIGHT);
|
|
|
|
this->SetWidgetDisabledState(MTSW_CLEAR, msf.playlist <= 3);
|
|
|
|
this->LowerWidget(MTSW_ALL + msf.playlist);
|
2008-05-17 22:52:51 +00:00
|
|
|
}
|
|
|
|
|
2009-09-02 14:09:51 +00:00
|
|
|
virtual void SetStringParameters(int widget) const
|
2008-05-17 22:52:51 +00:00
|
|
|
{
|
2009-09-02 14:09:51 +00:00
|
|
|
switch (widget) {
|
|
|
|
case MTSW_PLAYLIST:
|
|
|
|
SetDParam(0, STR_MUSIC_PLAYLIST_ALL + msf.playlist);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-09-02 14:09:51 +00:00
|
|
|
virtual void OnInvalidateData(int data = 0)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < 6; i++) {
|
|
|
|
this->SetWidgetLoweredState(MTSW_ALL + i, i == msf.playlist);
|
|
|
|
}
|
|
|
|
this->SetWidgetDisabledState(MTSW_CLEAR, msf.playlist <= 3);
|
|
|
|
this->SetDirty();
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-11-22 18:28:14 +00:00
|
|
|
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
2009-09-02 14:09:51 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
|
|
|
case MTSW_PLAYLIST: {
|
|
|
|
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);
|
|
|
|
} break;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-09-02 14:09:51 +00:00
|
|
|
case MTSW_LIST_LEFT: case MTSW_LIST_RIGHT: {
|
|
|
|
Dimension d = {0, 0};
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-09-02 14:09:51 +00:00
|
|
|
for (uint i = 1; i <= NUM_SONGS_AVAILABLE; i++) {
|
|
|
|
SetDParam(0, i);
|
2009-11-19 13:56:10 +00:00
|
|
|
SetDParam(1, 2);
|
|
|
|
SetDParam(2, SPECSTR_SONGNAME);
|
|
|
|
SetDParam(3, i);
|
|
|
|
Dimension d2 = GetStringBoundingBox(STR_PLAYLIST_TRACK_NAME);
|
2009-09-02 14:09:51 +00:00
|
|
|
d.width = max(d.width, d2.width);
|
|
|
|
d.height += d2.height;
|
|
|
|
}
|
|
|
|
d.width += padding.width;
|
|
|
|
d.height += padding.height;
|
|
|
|
*size = maxdim(*size, d);
|
|
|
|
} 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
|
|
|
|
2009-09-02 14:09:51 +00:00
|
|
|
virtual void DrawWidget(const Rect &r, int widget) const
|
|
|
|
{
|
|
|
|
switch (widget) {
|
|
|
|
case MTSW_LIST_LEFT: {
|
|
|
|
GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, 0);
|
|
|
|
|
|
|
|
int y = r.top + WD_FRAMERECT_TOP;
|
|
|
|
for (uint i = 1; i <= NUM_SONGS_AVAILABLE; i++) {
|
|
|
|
SetDParam(0, i);
|
2009-11-19 13:56:10 +00:00
|
|
|
SetDParam(1, 2);
|
|
|
|
SetDParam(2, SPECSTR_SONGNAME);
|
|
|
|
SetDParam(3, i);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
} break;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-09-02 14:09:51 +00:00
|
|
|
case MTSW_LIST_RIGHT: {
|
|
|
|
GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, 0);
|
|
|
|
|
|
|
|
int y = r.top + WD_FRAMERECT_TOP;
|
|
|
|
for (const byte *p = _playlists[msf.playlist]; *p != 0; p++) {
|
|
|
|
uint i = *p;
|
|
|
|
SetDParam(0, i);
|
2009-11-19 13:56:10 +00:00
|
|
|
SetDParam(1, 2);
|
|
|
|
SetDParam(2, SPECSTR_SONGNAME);
|
|
|
|
SetDParam(3, i);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
} break;
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
}
|
2004-09-10 19:02:27 +00:00
|
|
|
|
2009-09-02 14:09:51 +00:00
|
|
|
virtual void OnPaint()
|
|
|
|
{
|
|
|
|
this->DrawWidgets();
|
|
|
|
}
|
|
|
|
|
2008-05-17 22:52:51 +00:00
|
|
|
virtual void OnClick(Point pt, int widget)
|
|
|
|
{
|
|
|
|
switch (widget) {
|
|
|
|
case MTSW_LIST_LEFT: { // add to playlist
|
2009-09-19 11:31:12 +00:00
|
|
|
int y = (pt.y - this->GetWidget<NWidgetBase>(widget)->pos_y) / FONT_HEIGHT_SMALL;
|
2008-05-17 22:52:51 +00:00
|
|
|
|
|
|
|
if (msf.playlist < 4) return;
|
|
|
|
if (!IsInsideMM(y, 0, NUM_SONGS_AVAILABLE)) return;
|
|
|
|
|
2009-04-10 10:29:28 +00:00
|
|
|
byte *p = _playlists[msf.playlist];
|
|
|
|
for (uint i = 0; i != NUM_SONGS_PLAYLIST - 1; i++) {
|
2008-05-17 22:52:51 +00:00
|
|
|
if (p[i] == 0) {
|
|
|
|
p[i] = y + 1;
|
|
|
|
p[i + 1] = 0;
|
|
|
|
this->SetDirty();
|
|
|
|
SelectSongToPlay();
|
|
|
|
break;
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
2008-05-17 22:52:51 +00:00
|
|
|
} break;
|
2006-07-07 02:44:51 +00:00
|
|
|
|
2008-05-17 22:52:51 +00:00
|
|
|
case MTSW_LIST_RIGHT: { // remove from playlist
|
2009-09-19 11:31:12 +00:00
|
|
|
int y = (pt.y - this->GetWidget<NWidgetBase>(widget)->pos_y) / FONT_HEIGHT_SMALL;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2008-05-17 22:52:51 +00:00
|
|
|
if (msf.playlist < 4) return;
|
|
|
|
if (!IsInsideMM(y, 0, NUM_SONGS_AVAILABLE)) return;
|
2006-07-07 02:44:51 +00:00
|
|
|
|
2009-04-10 10:29:28 +00:00
|
|
|
byte *p = _playlists[msf.playlist];
|
|
|
|
for (uint i = y; i != NUM_SONGS_PLAYLIST - 1; i++) {
|
2008-05-17 22:52:51 +00:00
|
|
|
p[i] = p[i + 1];
|
2006-07-07 02:44:51 +00:00
|
|
|
}
|
|
|
|
|
2008-05-17 22:52:51 +00:00
|
|
|
this->SetDirty();
|
|
|
|
SelectSongToPlay();
|
|
|
|
} break;
|
2006-07-07 02:44:51 +00:00
|
|
|
|
2008-05-17 22:52:51 +00:00
|
|
|
case MTSW_CLEAR: // clear
|
|
|
|
_playlists[msf.playlist][0] = 0;
|
|
|
|
this->SetDirty();
|
|
|
|
StopMusic();
|
|
|
|
SelectSongToPlay();
|
|
|
|
break;
|
2006-07-07 02:44:51 +00:00
|
|
|
|
2008-05-17 22:52:51 +00:00
|
|
|
case MTSW_ALL: case MTSW_OLD: case MTSW_NEW:
|
|
|
|
case MTSW_EZY: case MTSW_CUSTOM1: case MTSW_CUSTOM2: // set playlist
|
2009-09-02 14:09:51 +00:00
|
|
|
SelectPlaylist(widget - MTSW_ALL);
|
2008-05-17 22:52:51 +00:00
|
|
|
StopMusic();
|
|
|
|
SelectSongToPlay();
|
|
|
|
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_track_selection_widgets[] = {
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-11-24 18:05:55 +00:00
|
|
|
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
|
|
|
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_PLAYLIST_MUSIC_PROGRAM_SELECTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
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),
|
2009-08-04 18:04:33 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY, MTSW_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.
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, MTSW_ALL), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_ALL, STR_MUSIC_TOOLTIP_SELECT_ALL_TRACKS_PROGRAM),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, MTSW_OLD), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_OLD_STYLE, STR_MUSIC_TOOLTIP_SELECT_OLD_STYLE_MUSIC),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, MTSW_NEW), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_NEW_STYLE, STR_MUSIC_TOOLTIP_SELECT_NEW_STYLE_MUSIC),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, MTSW_EZY), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_EZY_STREET, STR_MUSIC_TOOLTIP_SELECT_EZY_STREET_STYLE),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, MTSW_CUSTOM1), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_CUSTOM_1, STR_MUSIC_TOOLTIP_SELECT_CUSTOM_1_USER_DEFINED),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, MTSW_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
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, MTSW_CLEAR), SetFill(1, 0), SetDataTip(STR_PLAYLIST_CLEAR, STR_PLAYLIST_TOOLTIP_CLEAR_CURRENT_PROGRAM_CUSTOM1),
|
|
|
|
NWidget(NWID_SPACER), SetFill(0, 1),
|
2009-04-10 11:06:12 +00:00
|
|
|
EndContainer(),
|
|
|
|
/* Right panel. */
|
|
|
|
NWidget(NWID_VERTICAL),
|
2009-09-02 14:09:51 +00:00
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, MTSW_PLAYLIST), SetDataTip(STR_PLAYLIST_PROGRAM, STR_NULL),
|
2009-08-04 18:04:33 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY, MTSW_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(),
|
|
|
|
};
|
|
|
|
|
2009-03-15 15:12:06 +00:00
|
|
|
static const WindowDesc _music_track_selection_desc(
|
2009-11-28 15:01:49 +00:00
|
|
|
WDP_AUTO, 0, 0,
|
2007-02-01 15:49:12 +00:00
|
|
|
WC_MUSIC_TRACK_SELECTION, WC_NONE,
|
2009-11-24 17:28:29 +00:00
|
|
|
WDF_UNCLICK_BUTTONS,
|
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
|
|
|
}
|
|
|
|
|
2009-04-10 11:02:09 +00:00
|
|
|
enum MusicWidgets {
|
|
|
|
MW_PREV,
|
|
|
|
MW_NEXT,
|
|
|
|
MW_STOP,
|
|
|
|
MW_PLAY,
|
|
|
|
MW_SLIDERS,
|
2009-08-30 20:38:57 +00:00
|
|
|
MW_MUSIC_VOL,
|
2009-04-10 11:02:09 +00:00
|
|
|
MW_GAUGE,
|
2009-08-30 20:38:57 +00:00
|
|
|
MW_EFFECT_VOL,
|
2009-04-10 11:02:09 +00:00
|
|
|
MW_BACKGROUND,
|
2009-09-01 21:30:14 +00:00
|
|
|
MW_TRACK,
|
|
|
|
MW_TRACK_NR,
|
|
|
|
MW_TRACK_TITLE,
|
|
|
|
MW_TRACK_NAME,
|
2009-04-10 11:02:09 +00:00
|
|
|
MW_SHUFFLE,
|
|
|
|
MW_PROGRAMME,
|
|
|
|
MW_ALL,
|
|
|
|
MW_OLD,
|
|
|
|
MW_NEW,
|
|
|
|
MW_EZY,
|
|
|
|
MW_CUSTOM1,
|
|
|
|
MW_CUSTOM2,
|
|
|
|
};
|
|
|
|
|
2008-05-17 22:52:51 +00:00
|
|
|
struct MusicWindow : public Window {
|
2009-08-30 21:31:54 +00:00
|
|
|
static const int slider_width = 3;
|
|
|
|
|
2009-08-30 19:23:36 +00:00
|
|
|
MusicWindow(const WindowDesc *desc, WindowNumber number) : Window()
|
2008-05-17 22:52:51 +00:00
|
|
|
{
|
2009-08-30 19:23:36 +00:00
|
|
|
this->InitNested(desc, number);
|
2009-08-30 20:38:57 +00:00
|
|
|
this->LowerWidget(msf.playlist + MW_ALL);
|
|
|
|
this->SetWidgetLoweredState(MW_SHUFFLE, msf.shuffle);
|
2008-05-17 22:52:51 +00:00
|
|
|
}
|
|
|
|
|
2009-11-22 18:28:14 +00:00
|
|
|
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
2009-09-01 19:18:42 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
|
|
|
/* Make sure that MW_SHUFFLE and MW_PROGRAMME have the same size.
|
|
|
|
* This can't be done by using NC_EQUALSIZE as the MW_INFO is
|
|
|
|
* between those widgets and of different size. */
|
|
|
|
case MW_SHUFFLE: case MW_PROGRAMME: {
|
|
|
|
Dimension d = maxdim(GetStringBoundingBox(STR_MUSIC_PROGRAM), GetStringBoundingBox(STR_MUSIC_SHUFFLE));
|
|
|
|
d.width += padding.width;
|
|
|
|
d.height += padding.height;
|
|
|
|
*size = maxdim(*size, d);
|
|
|
|
} break;
|
2009-09-01 21:30:14 +00:00
|
|
|
|
|
|
|
case MW_TRACK_NR: {
|
|
|
|
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);
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case MW_TRACK_NAME: {
|
|
|
|
Dimension d = GetStringBoundingBox(STR_MUSIC_TITLE_NONE);
|
|
|
|
for (int i = 0; i < NUM_SONGS_AVAILABLE; i++) {
|
|
|
|
SetDParam(0, SPECSTR_SONGNAME);
|
|
|
|
SetDParam(1, i);
|
|
|
|
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);
|
|
|
|
} 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. */
|
|
|
|
case MW_PREV: this->GetWidget<NWidgetCore>(MW_PREV)->widget_data = _dynlang.text_dir == TD_RTL ? SPR_IMG_SKIP_TO_NEXT : SPR_IMG_SKIP_TO_PREV; break;
|
|
|
|
case MW_NEXT: this->GetWidget<NWidgetCore>(MW_NEXT)->widget_data = _dynlang.text_dir == TD_RTL ? SPR_IMG_SKIP_TO_PREV : SPR_IMG_SKIP_TO_NEXT; break;
|
|
|
|
case MW_PLAY: this->GetWidget<NWidgetCore>(MW_PLAY)->widget_data = _dynlang.text_dir == TD_RTL ? SPR_IMG_PLAY_MUSIC_RTL : SPR_IMG_PLAY_MUSIC; break;
|
2009-09-01 19:18:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-30 19:23:36 +00:00
|
|
|
virtual void DrawWidget(const Rect &r, int widget) const
|
2008-05-17 22:52:51 +00:00
|
|
|
{
|
2009-08-30 19:23:36 +00:00
|
|
|
switch (widget) {
|
|
|
|
case MW_GAUGE:
|
|
|
|
GfxFillRect(r.left, r.top, r.right, r.bottom, 0);
|
|
|
|
|
|
|
|
for (uint i = 0; i != 8; i++) {
|
|
|
|
int colour = 0xD0;
|
|
|
|
if (i > 4) {
|
|
|
|
colour = 0xBF;
|
|
|
|
if (i > 6) {
|
|
|
|
colour = 0xB8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
GfxFillRect(r.left, r.bottom - i * 2, r.right, r.bottom - i * 2, colour);
|
|
|
|
}
|
|
|
|
break;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-09-01 21:30:14 +00:00
|
|
|
case MW_TRACK_NR: {
|
|
|
|
GfxFillRect(r.left + 1, r.top + 1, r.right, r.bottom, 0);
|
2009-08-30 19:23:36 +00:00
|
|
|
StringID str = STR_MUSIC_TRACK_NONE;
|
|
|
|
if (_song_is_active != 0 && _music_wnd_cursong != 0) {
|
|
|
|
SetDParam(0, _music_wnd_cursong);
|
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);
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case MW_TRACK_NAME: {
|
|
|
|
GfxFillRect(r.left, r.top + 1, r.right - 1, r.bottom, 0);
|
|
|
|
StringID str = STR_MUSIC_TITLE_NONE;
|
2009-08-30 19:23:36 +00:00
|
|
|
if (_song_is_active != 0 && _music_wnd_cursong != 0) {
|
|
|
|
str = STR_MUSIC_TITLE_NAME;
|
|
|
|
SetDParam(0, SPECSTR_SONGNAME);
|
|
|
|
SetDParam(1, _music_wnd_cursong);
|
|
|
|
}
|
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, TC_FROMSTRING, SA_CENTER);
|
2009-08-30 19:23:36 +00:00
|
|
|
} break;
|
2009-08-30 21:31:54 +00:00
|
|
|
|
|
|
|
case MW_MUSIC_VOL: case MW_EFFECT_VOL: {
|
2009-11-24 13:14:48 +00:00
|
|
|
DrawFrameRect(r.left, r.top + 2, r.right, r.bottom - 2, COLOUR_GREY, FR_LOWERED);
|
2009-08-30 21:31:54 +00:00
|
|
|
byte volume = (widget == MW_MUSIC_VOL) ? msf.music_vol : msf.effect_vol;
|
2009-11-19 20:34:45 +00:00
|
|
|
int x = (volume * (r.right - r.left) / 127);
|
|
|
|
if (_dynlang.text_dir == TD_RTL) {
|
|
|
|
x = r.right - x;
|
|
|
|
} else {
|
|
|
|
x += r.left;
|
|
|
|
}
|
2009-11-24 13:14:48 +00:00
|
|
|
DrawFrameRect(x, r.top, x + slider_width, r.bottom, COLOUR_GREY, FR_NONE);
|
2009-08-30 21:31:54 +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
|
|
|
|
2009-08-30 19:23:36 +00:00
|
|
|
virtual void OnPaint()
|
|
|
|
{
|
|
|
|
this->DrawWidgets();
|
2008-05-17 22:52:51 +00:00
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-09-02 14:09:51 +00:00
|
|
|
virtual void OnInvalidateData(int data = 0)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < 6; i++) {
|
|
|
|
this->SetWidgetLoweredState(MW_ALL + i, i == msf.playlist);
|
|
|
|
}
|
|
|
|
this->SetDirty();
|
|
|
|
}
|
|
|
|
|
2008-05-17 22:52:51 +00:00
|
|
|
virtual void OnClick(Point pt, int widget)
|
|
|
|
{
|
|
|
|
switch (widget) {
|
|
|
|
case MW_PREV: // skip to prev
|
|
|
|
if (!_song_is_active) return;
|
|
|
|
SkipToPrevSong();
|
2009-09-01 21:30:14 +00:00
|
|
|
this->SetDirty();
|
2008-05-17 22:52:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MW_NEXT: // skip to next
|
|
|
|
if (!_song_is_active) return;
|
|
|
|
SkipToNextSong();
|
2009-09-01 21:30:14 +00:00
|
|
|
this->SetDirty();
|
2008-05-17 22:52:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MW_STOP: // stop playing
|
|
|
|
msf.playing = false;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MW_PLAY: // start playing
|
|
|
|
msf.playing = true;
|
|
|
|
break;
|
|
|
|
|
2009-08-30 20:38:57 +00:00
|
|
|
case MW_MUSIC_VOL: case MW_EFFECT_VOL: { // volume sliders
|
2009-09-19 11:31:12 +00:00
|
|
|
int x = pt.x - this->GetWidget<NWidgetBase>(widget)->pos_x;
|
2008-05-17 22:52:51 +00:00
|
|
|
|
2009-08-30 21:31:54 +00:00
|
|
|
byte *vol = (widget == MW_MUSIC_VOL) ? &msf.music_vol : &msf.effect_vol;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-09-19 11:31:12 +00:00
|
|
|
byte new_vol = x * 127 / this->GetWidget<NWidgetBase>(widget)->current_x;
|
2009-11-19 20:34:45 +00:00
|
|
|
if (_dynlang.text_dir == TD_RTL) new_vol = 127 - new_vol;
|
2008-05-17 22:52:51 +00:00
|
|
|
if (new_vol != *vol) {
|
|
|
|
*vol = new_vol;
|
2009-08-30 21:31:54 +00:00
|
|
|
if (widget == MW_MUSIC_VOL) MusicVolumeChanged(new_vol);
|
2008-05-17 22:52:51 +00:00
|
|
|
this->SetDirty();
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2008-05-17 22:52:51 +00:00
|
|
|
_left_button_clicked = false;
|
|
|
|
} break;
|
|
|
|
|
2009-03-15 00:32:18 +00:00
|
|
|
case MW_SHUFFLE: // toggle shuffle
|
2008-05-17 22:52:51 +00:00
|
|
|
msf.shuffle ^= 1;
|
2009-08-30 20:38:57 +00:00
|
|
|
this->SetWidgetLoweredState(MW_SHUFFLE, msf.shuffle);
|
2009-09-13 19:15:59 +00:00
|
|
|
this->SetWidgetDirty(MW_SHUFFLE);
|
2008-05-17 22:52:51 +00:00
|
|
|
StopMusic();
|
|
|
|
SelectSongToPlay();
|
2009-09-01 21:30:14 +00:00
|
|
|
this->SetDirty();
|
2008-05-17 22:52:51 +00:00
|
|
|
break;
|
|
|
|
|
2009-03-15 00:32:18 +00:00
|
|
|
case MW_PROGRAMME: // show track selection
|
2008-05-17 22:52:51 +00:00
|
|
|
ShowMusicTrackSelection();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MW_ALL: case MW_OLD: case MW_NEW:
|
|
|
|
case MW_EZY: case MW_CUSTOM1: case MW_CUSTOM2: // playlist
|
2009-09-02 14:09:51 +00:00
|
|
|
SelectPlaylist(widget - MW_ALL);
|
2008-05-17 22:52:51 +00:00
|
|
|
StopMusic();
|
|
|
|
SelectSongToPlay();
|
2009-09-01 21:30:14 +00:00
|
|
|
this->SetDirty();
|
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
|
|
|
#if 0
|
|
|
|
virtual void OnTick()
|
|
|
|
{
|
2009-09-13 19:15:59 +00:00
|
|
|
this->SetWidgetDirty(MW_GAUGE);
|
2008-05-17 22:52:51 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
};
|
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),
|
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),
|
|
|
|
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, MW_PREV), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_SKIP_TO_PREV, STR_MUSIC_TOOLTIP_SKIP_TO_PREVIOUS_TRACK),
|
|
|
|
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, MW_NEXT), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_SKIP_TO_NEXT, STR_MUSIC_TOOLTIP_SKIP_TO_NEXT_TRACK_IN_SELECTION),
|
|
|
|
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, MW_STOP), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_STOP_MUSIC, STR_MUSIC_TOOLTIP_STOP_PLAYING_MUSIC),
|
|
|
|
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, MW_PLAY), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_PLAY_MUSIC, STR_MUSIC_TOOLTIP_START_PLAYING_MUSIC),
|
|
|
|
EndContainer(),
|
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY, -1), SetFill(1, 1), EndContainer(),
|
|
|
|
EndContainer(),
|
2009-08-30 20:38:57 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY, MW_SLIDERS),
|
2009-09-01 19:18:42 +00:00
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(20, 0, 20),
|
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),
|
|
|
|
NWidget(WWT_EMPTY, COLOUR_GREY, MW_MUSIC_VOL), SetMinimalSize(67, 0), SetMinimalTextLines(1, 0), SetFill(1, 0), SetDataTip(0x0, STR_MUSIC_TOOLTIP_DRAG_SLIDERS_TO_SET_MUSIC),
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, -1), SetDataTip(STR_MUSIC_RULER_MIN, STR_NULL),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, -1), SetDataTip(STR_MUSIC_RULER_MARKER, STR_NULL), SetFill(1, 0),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, -1), SetDataTip(STR_MUSIC_RULER_MARKER, STR_NULL), SetFill(1, 0),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, -1), SetDataTip(STR_MUSIC_RULER_MARKER, STR_NULL), SetFill(1, 0),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, -1), SetDataTip(STR_MUSIC_RULER_MARKER, STR_NULL), SetFill(1, 0),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, -1), SetDataTip(STR_MUSIC_RULER_MARKER, STR_NULL), SetFill(1, 0),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, -1), SetDataTip(STR_MUSIC_RULER_MAX, STR_NULL),
|
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY, MW_GAUGE), SetMinimalSize(16, 20), SetPadding(1, 11, 1, 11), SetFill(0, 0), EndContainer(),
|
2009-11-24 13:14:48 +00:00
|
|
|
NWidget(NWID_VERTICAL),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, -1), SetFill(1, 0), SetDataTip(STR_MUSIC_EFFECTS_VOLUME, STR_NULL),
|
|
|
|
NWidget(WWT_EMPTY, COLOUR_GREY, MW_EFFECT_VOL), SetMinimalSize(67, 0), SetMinimalTextLines(1, 0), SetFill(1, 0), SetDataTip(0x0, STR_MUSIC_TOOLTIP_DRAG_SLIDERS_TO_SET_MUSIC),
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, -1), SetDataTip(STR_MUSIC_RULER_MIN, STR_NULL),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, -1), SetDataTip(STR_MUSIC_RULER_MARKER, STR_NULL), SetFill(1, 0),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, -1), SetDataTip(STR_MUSIC_RULER_MARKER, STR_NULL), SetFill(1, 0),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, -1), SetDataTip(STR_MUSIC_RULER_MARKER, STR_NULL), SetFill(1, 0),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, -1), SetDataTip(STR_MUSIC_RULER_MARKER, STR_NULL), SetFill(1, 0),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, -1), SetDataTip(STR_MUSIC_RULER_MARKER, STR_NULL), SetFill(1, 0),
|
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, -1), SetDataTip(STR_MUSIC_RULER_MAX, STR_NULL),
|
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
2009-08-30 20:38:57 +00:00
|
|
|
EndContainer(),
|
2009-04-10 11:06:12 +00:00
|
|
|
EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY, MW_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),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, MW_SHUFFLE), SetMinimalSize(50, 8), SetDataTip(STR_MUSIC_SHUFFLE, STR_MUSIC_TOOLTIP_TOGGLE_PROGRAM_SHUFFLE),
|
|
|
|
NWidget(NWID_SPACER), SetFill(0, 1),
|
|
|
|
EndContainer(),
|
2009-09-01 21:30:14 +00:00
|
|
|
NWidget(NWID_VERTICAL), SetPadding(0, 0, 3, 3),
|
2009-11-24 13:14:48 +00:00
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, MW_TRACK), SetFill(0, 0), SetDataTip(STR_MUSIC_TRACK, STR_NULL),
|
2009-09-01 21:30:14 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY, MW_TRACK_NR), EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_VERTICAL), SetPadding(0, 3, 3, 0),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(WWT_LABEL, COLOUR_GREY, MW_TRACK_TITLE), SetFill(1, 0), SetDataTip(STR_MUSIC_XTITLE, STR_NULL),
|
2009-11-24 13:14:48 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY, MW_TRACK_NAME), SetFill(1, 0), EndContainer(),
|
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_VERTICAL),
|
|
|
|
NWidget(NWID_SPACER), SetFill(0, 1),
|
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, MW_PROGRAMME), SetMinimalSize(50, 8), SetDataTip(STR_MUSIC_PROGRAM, STR_MUSIC_TOOLTIP_SHOW_MUSIC_TRACK_SELECTION),
|
|
|
|
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),
|
2009-11-22 18:26:01 +00:00
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, MW_ALL), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_ALL, STR_MUSIC_TOOLTIP_SELECT_ALL_TRACKS_PROGRAM),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, MW_OLD), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_OLD_STYLE, STR_MUSIC_TOOLTIP_SELECT_OLD_STYLE_MUSIC),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, MW_NEW), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_NEW_STYLE, STR_MUSIC_TOOLTIP_SELECT_NEW_STYLE_MUSIC),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, MW_EZY), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_EZY_STREET, STR_MUSIC_TOOLTIP_SELECT_EZY_STREET_STYLE),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, MW_CUSTOM1), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_CUSTOM_1, STR_MUSIC_TOOLTIP_SELECT_CUSTOM_1_USER_DEFINED),
|
|
|
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, MW_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(),
|
|
|
|
};
|
|
|
|
|
2009-03-15 15:12:06 +00:00
|
|
|
static const WindowDesc _music_window_desc(
|
2009-11-28 15:01:49 +00:00
|
|
|
WDP_AUTO, 0, 0,
|
2007-02-01 15:49:12 +00:00
|
|
|
WC_MUSIC_WINDOW, WC_NONE,
|
2009-11-24 17:28:29 +00:00
|
|
|
WDF_UNCLICK_BUTTONS,
|
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
|
|
|
}
|