File diff r13023:9f6499c8d4fb → r13024:48c81d0b078a
src/music_gui.cpp
Show inline comments
 
@@ -139,46 +139,46 @@ static void SelectSongToPlay()
 
				*a = *b;
 
				*b = t;
 
			}
 
		} while (--i);
 
	}
 
}
 

	
 
static void StopMusic()
 
{
 
	_music_wnd_cursong = 0;
 
	DoStopMusic();
 
	_song_is_active = false;
 
	InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 9);
 
	SetWindowWidgetDirty(WC_MUSIC_WINDOW, 0, 9);
 
}
 

	
 
static void PlayPlaylistSong()
 
{
 
	if (_cur_playlist[0] == 0) {
 
		SelectSongToPlay();
 
		/* 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 */
 
		if (_cur_playlist[0] == 0) {
 
			_song_is_active = false;
 
			_music_wnd_cursong = 0;
 
			msf.playing = false;
 
			return;
 
		}
 
	}
 
	_music_wnd_cursong = _cur_playlist[0];
 
	DoPlaySong();
 
	_song_is_active = true;
 

	
 
	InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 9);
 
	SetWindowWidgetDirty(WC_MUSIC_WINDOW, 0, 9);
 
}
 

	
 
void ResetMusic()
 
{
 
	_music_wnd_cursong = 1;
 
	DoPlaySong();
 
}
 

	
 
void MusicLoop()
 
{
 
	if (!msf.playing && _song_is_active) {
 
		StopMusic();
 
@@ -591,48 +591,48 @@ struct MusicWindow : public Window {
 
				if (new_vol != *vol) {
 
					*vol = new_vol;
 
					if (widget == MW_MUSIC_VOL) MusicVolumeChanged(new_vol);
 
					this->SetDirty();
 
				}
 

	
 
				_left_button_clicked = false;
 
			} break;
 

	
 
			case MW_SHUFFLE: // toggle shuffle
 
				msf.shuffle ^= 1;
 
				this->SetWidgetLoweredState(MW_SHUFFLE, msf.shuffle);
 
				this->InvalidateWidget(MW_SHUFFLE);
 
				this->SetWidgetDirty(MW_SHUFFLE);
 
				StopMusic();
 
				SelectSongToPlay();
 
				this->SetDirty();
 
				break;
 

	
 
			case MW_PROGRAMME: // show track selection
 
				ShowMusicTrackSelection();
 
				break;
 

	
 
			case MW_ALL: case MW_OLD: case MW_NEW:
 
			case MW_EZY: case MW_CUSTOM1: case MW_CUSTOM2: // playlist
 
				SelectPlaylist(widget - MW_ALL);
 
				StopMusic();
 
				SelectSongToPlay();
 
				this->SetDirty();
 
				break;
 
		}
 
	}
 

	
 
#if 0
 
	virtual void OnTick()
 
	{
 
		this->InvalidateWidget(MW_GAUGE);
 
		this->SetWidgetDirty(MW_GAUGE);
 
	}
 
#endif
 
};
 

	
 
static const NWidgetPart _nested_music_window_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY, MW_CLOSE),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, MW_CAPTION), SetDataTip(STR_MUSIC_JAZZ_JUKEBOX_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	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),