ES
apps/winzik / src / Model / SkinParts.php · commit 6576d6f
<?phpnamespace App\Model;/** * The pictures of a skin, window by window: REF.NUN of the skin editor of 2001 (EDT), with where each one goes in * its window (the controls of winster.frm), so that the editor can show the window and pick a piece in it. */final class SkinParts{    /** window => [title, background, width, height] */    public const WINDOWS = [        'main' => ['Fenêtre principale', 'main', 258, 128],        'playlist' => ['Playlist', 'mainpl', 258, 362],        'compact' => ['Mode compact', 'mainp', 112, 13],    ];    /** window => part => [width, height, x, y] (F0, F1, F2 of REF.NUN, in its order) */    public const PARTS = [        'main' => [            'he' => [25, 17, 0, 0], 'hd' => [25, 17, 0, 0], 'petit' => [15, 15, 224, 0], 'close' => [17, 15, 240, 0],            'info' => [25, 17, 0, 16], 'tray' => [17, 15, 224, 16], 'lyr' => [17, 15, 240, 16],            'fbson' => [116, 10, 0, 48], 'bson' => [17, 9, 80, 48], 'fbbal' => [116, 10, 136, 48], 'bbal' => [17, 9, 186, 48],            'bpos' => [17, 9, 60, 64], 'fpos' => [255, 10, 0, 64],            'barr' => [25, 18, 64, 76], 'bpause' => [25, 18, 88, 76], 'bplay' => [25, 18, 112, 76], 'bstop' => [25, 18, 136, 76],            'bav' => [25, 18, 160, 76], 'bpl' => [25, 18, 184, 76],        ],        'playlist' => [            'plp' => [25, 17, 0, 0], 'pledit' => [82, 16, 88, 0], 'pledit2' => [82, 16, 88, 0], 'plm' => [25, 17, 232, 0],            'plload' => [25, 17, 0, 16], 'plrem' => [25, 17, 120, 16], 'plsave' => [25, 17, 232, 16],            'btnplay' => [8, 17, 250, 47], 'posplay' => [8, 296, 250, 48],            'infocd' => [17, 9, 24, 91], 'infomp3' => [17, 9, 24, 52], 'infowav' => [17, 9, 24, 65], 'infomid' => [17, 9, 24, 78],            'lyrno' => [17, 9, 0, 65], 'lyrok' => [17, 9, 0, 52],        ],        'compact' => [            'arrp' => [17, 13, 0, 0], 'pausep' => [17, 13, 16, 0], 'playp' => [17, 13, 32, 0], 'avp' => [17, 13, 48, 0],            'petitp' => [17, 13, 64, 0], 'helpp' => [17, 13, 80, 0], 'lyrp' => [17, 13, 96, 0],        ],    ];    /** The pieces drawn over the others in the preview (he over hd, pledit2 over pledit, the thumb over its track). */    public const HIDDEN_IN_PREVIEW = ['he', 'pledit2', 'posplay'];    /** what each piece is, for the list of the editor */    public const LABELS = [        'main' => 'fond du lecteur', 'mainpl' => 'fond de la playlist', 'mainp' => 'fond du mode compact',        'he' => 'Hasard activé', 'hd' => 'Hasard désactivé', 'petit' => 'mode compact', 'close' => 'fermer', 'info' => 'infos (tag)',        'tray' => 'réduire', 'lyr' => 'paroles', 'fbson' => 'barre du volume', 'bson' => 'curseur du volume',        'fbbal' => 'barre de la balance', 'bbal' => 'curseur de la balance', 'bpos' => 'curseur de position', 'fpos' => 'barre de position',        'barr' => 'précédent', 'bpause' => 'pause', 'bplay' => 'play', 'bstop' => 'stop', 'bav' => 'suivant', 'bpl' => 'playlist',        'plp' => '+ ajouter', 'pledit' => 'Mode édition', 'pledit2' => 'Mode playlist', 'plm' => '- retirer', 'plload' => 'charger .FLS',        'plrem' => 'supprimer', 'plsave' => 'sauver .FLS', 'btnplay' => 'ascenseur', 'posplay' => "barre de l'ascenseur",        'infocd' => 'icône CD', 'infomp3' => 'icône MP3', 'infowav' => 'icône WAV', 'infomid' => 'icône MID',        'lyrno' => 'sans paroles', 'lyrok' => 'avec paroles',        'arrp' => 'précédent', 'pausep' => 'pause', 'playp' => 'play', 'avp' => 'suivant', 'petitp' => 'retour', 'helpp' => 'titre', 'lyrp' => 'paroles',    ];    /** @return array{0: int, 1: int} the size of a picture (a background or a piece) */    public static function size(string $part): array    {        foreach (self::WINDOWS as [, $background, $w, $h]) {            if ($background === $part) {                return [$w, $h];            }        }        foreach (self::PARTS as $parts) {            if (isset($parts[$part])) {                return [$parts[$part][0], $parts[$part][1]];            }        }        return [16, 16];    }    /** @return list<string> the pictures of a window: its background first, then its pieces */    public static function of(string $window): array    {        return array_merge([self::WINDOWS[$window][1]], array_keys(self::PARTS[$window]));    }    /** @return list<string> every picture of a skin */    public static function all(): array    {        $all = [];        foreach (array_keys(self::WINDOWS) as $window) {            $all = array_merge($all, self::of($window));        }        return array_merge($all, ['ico']);    }}