<commit_before>package pman.ui.ctrl;

import tannus.io.*;
import tannus.ds.*;
import tannus.geom.*;
import tannus.events.*;
import tannus.graphics.Color;

import gryffin.core.*;
import gryffin.display.*;

import pman.core.*;
import pman.display.*;
import pman.display.media.*;
import pman.ui.*;

import tannus.math.TMath.*;
import foundation.Tools.*;

using StringTools;
using tannus.ds.StringUtils;
using Lambda;
using tannus.ds.ArrayTools;
using Slambda;
using tannus.ds.AnonTools;

/**
  * button used for toggling playback
  */
class PlaybackButton extends ImagePlayerControlButton {
	/* Constructor Function */
	public function new(c : PlayerControlsView):Void {
		super( c );

		name = 'toggle-playback';
	}

/* === Instance Methods === */

	// set up icon info
	override function initIcon():Void {
	    _il = [
	        Icons.playIcon(iconSize, iconSize).toImage(),
	        Icons.pauseIcon(iconSize, iconSize).toImage()
	    ];
	}

	// get the active icon at any given time
	override function getIcon():Null<Image> {
		return _il[player.paused ? 0 : 1];
	}
	
	// handle click events
	override function click(event : MouseEvent):Void {
		player.togglePlayback();
	}
}<commit_msg>PlaybackButton hides when not relevant<commit_after>package pman.ui.ctrl;

import tannus.io.*;
import tannus.ds.*;
import tannus.geom.*;
import tannus.events.*;
import tannus.graphics.Color;

import gryffin.core.*;
import gryffin.display.*;

import pman.core.*;
import pman.display.*;
import pman.display.media.*;
import pman.ui.*;

import tannus.math.TMath.*;
import foundation.Tools.*;

using StringTools;
using tannus.ds.StringUtils;
using Lambda;
using tannus.ds.ArrayTools;
using Slambda;
using tannus.ds.AnonTools;

/**
  * button used for toggling playback
  */
class PlaybackButton extends ImagePlayerControlButton {
	/* Constructor Function */
	public function new(c : PlayerControlsView):Void {
		super( c );

		name = 'toggle-playback';
	}

/* === Instance Methods === */

	// set up icon info
	override function initIcon():Void {
	    _il = [
	        Icons.playIcon(iconSize, iconSize).toImage(),
	        Icons.pauseIcon(iconSize, iconSize).toImage()
	    ];
	}

	// get the active icon at any given time
	override function getIcon():Null<Image> {
		return _il[player.paused ? 0 : 1];
	}
	
	// handle click events
	override function click(event : MouseEvent):Void {
		player.togglePlayback();
	}

	override function update(stage: Stage):Void {
	    super.update( stage );

	    enabled = (player.track != null && player.track.hasFeature( Playback ));
	}
}
{'fraction_non_alphanumeric': 0.13424657534246576, 'fraction_numerical': 0.0015655577299412916, 'mean_word_length': 3.8135593220338984, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2345230', 'n_tokens_mistral': 867, 'n_tokens_neox': 835, 'n_words': 207}