<commit_before><!-- This Source Code Form is licensed MPL-2.0: http://mozilla.org/MPL/2.0 -->

<docs>
  # B-PLAYCONTROLS
  A container holding the play and seek controls for a Bse.song.
  ## Props:
  *project*
  : Injected *Bse.Project*, using `b-projectshell.project`.
</docs>

<style lang="scss">
  @import 'mixins.scss';
  .b-playcontrols {
    .b-button	{ padding: 5px; }
  }
</style>

<template>

  <b-button-bar
      class="b-playcontrols" >
    <b-button hotkey="L"     @click="pcall ('...Last')"      ><b-icon fw lg fa="fast-backward" /></b-button>
    <b-button hotkey="B"     @click="pcall ('...Backwards')" ><b-icon fw lg fa="backward"      /></b-button>
    <b-button hotkey="Space" @click="pcall ('stop')"         ><b-icon fw lg fa="stop"          /></b-button>
    <b-button hotkey="P"     @click="pcall ('play')"         ><b-icon fw lg fa="play"          /></b-button>
    <b-button hotkey="R"     @click="pcall ('...Record')"    ><b-icon fw lg fa="circle"        /></b-button>
    <b-button hotkey="F"     @click="pcall ('...Forwards')"  ><b-icon fw lg fa="forward"       /></b-button>
    <b-button hotkey="N"     @click="pcall ('...Next')"      ><b-icon fw lg fa="fast-forward"  /></b-button>
  </b-button-bar>

</template>

<script>
module.exports = {
  name: 'b-playcontrols',
  inject: [ 'b-projectshell' ],
  computed: {
    project: function () { return this['b-projectshell'].project; },
  },
  methods:  {
    pcall (method, e) {
      let project = this.project, m = project[method], message;
      if (m !== undefined) {
	let result = m.call (project);
	if (result == undefined)
	  result = 'ok';
	message = method + ': ' + result;
      }
      else
	message = method + ': unimplemented';
      Shell.status (message);
    },
  },
};
</script><commit_msg>EBEAST: b/playcontrols.vue: use "Space" to toggle playback and 'S' for stop<commit_after><!-- This Source Code Form is licensed MPL-2.0: http://mozilla.org/MPL/2.0 -->

<docs>
  # B-PLAYCONTROLS
  A container holding the play and seek controls for a Bse.song.
  ## Props:
  *project*
  : Injected *Bse.Project*, using `b-projectshell.project`.
</docs>

<style lang="scss">
  @import 'mixins.scss';
  .b-playcontrols {
    .b-button	{ padding: 5px; }
  }
</style>

<template>

  <b-button-bar
      class="b-playcontrols" >
    <b-button hotkey="L"     @click="pcall ('...Last')"      ><b-icon fw lg fa="fast-backward" /></b-button>
    <b-button hotkey="B"     @click="pcall ('...Backwards')" ><b-icon fw lg fa="backward"      /></b-button>
    <b-button hotkey="S"     @click="pcall ('stop')"         ><b-icon fw lg fa="stop"          /></b-button>
    <b-button hotkey="Space" @click="toggle_play()"          ><b-icon fw lg fa="play"          /></b-button>
    <b-button hotkey="R"     @click="pcall ('...Record')"    ><b-icon fw lg fa="circle"        /></b-button>
    <b-button hotkey="F"     @click="pcall ('...Forwards')"  ><b-icon fw lg fa="forward"       /></b-button>
    <b-button hotkey="N"     @click="pcall ('...Next')"      ><b-icon fw lg fa="fast-forward"  /></b-button>
  </b-button-bar>

</template>

<script>
module.exports = {
  name: 'b-playcontrols',
  inject: [ 'b-projectshell' ],
  computed: {
    project: function () { return this['b-projectshell'].project; },
  },
  methods:  {
    pcall (method, e) {
      let project = this.project, m = project[method], message;
      if (m !== undefined) {
	let result = m.call (project);
	if (result == undefined)
	  result = 'ok';
	message = method + ': ' + result;
      }
      else
	message = method + ': unimplemented';
      Shell.status (message);
    },
    async toggle_play() {
      const project = this.project;
      if (!await this.project.is_playing())
	project.play();
      else
	project.stop();
    },
  },
};
</script>
{'fraction_non_alphanumeric': 0.20353748680042238, 'fraction_numerical': 0.0026399155227032735, 'mean_word_length': 2.5880681818181817, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 67, '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': '2940905', 'n_tokens_mistral': 1420, 'n_tokens_neox': 1383, 'n_words': 317}