Example #1
0
void translatable_destroy (gpointer data)
{
    Translatable *self = TRANSLATABLE (data);
    /* free the hash table */
    g_hash_table_destroy(self->hash_table);
    /* free the allocated entry array */
    g_free(self->entry_array);
    /* free the FileType object */
    file_type_destroy(self->file_type);
    /* free self */
    g_object_unref(self);
}
void TranscriptionToolBar::RegenerateTooltips()
{
   mButtons[TTB_PlaySpeed]->SetToolTip(_("Play-at-speed"));

#ifdef EXPERIMENTAL_VOICE_DETECTION
   mButtons[TTB_StartOn]->SetToolTip(TRANSLATABLE("Left-to-On"));
   mButtons[TTB_EndOn]->SetToolTip(   TRANSLATABLE("Right-to-Off"));
   mButtons[TTB_StartOff]->SetToolTip(   TRANSLATABLE("Left-to-Off"));
   mButtons[TTB_EndOff]->SetToolTip(   TRANSLATABLE("Right-to-On"));
   mButtons[TTB_SelectSound]->SetToolTip(   TRANSLATABLE("Select-Sound"));
   mButtons[TTB_SelectSilence]->SetToolTip(   TRANSLATABLE("Select-Silence"));
   mButtons[TTB_AutomateSelection]->SetToolTip(   TRANSLATABLE("Make Labels"));
   mButtons[TTB_MakeLabel]->SetToolTip(   TRANSLATABLE("Add Label"));
   mButtons[TTB_Calibrate]->SetToolTip(   TRANSLATABLE("Calibrate"));

   mSensitivitySlider->SetToolTip(TRANSLATABLE("Sensitivity"));
   mKeyTypeChoice->SetToolTip(TRANSLATABLE("Key type"));
#endif
}
void TranscriptionToolBar::Populate()
{
// Very similar to code in ControlToolBar...
// Very similar to code in EditToolBar
   MakeButtonBackgroundsSmall();

   AddButton(bmpPlay,     bmpPlayDisabled,   TTB_PlaySpeed,
      _("Play at selected speed"));
   MakeAlternateImages(bmpLoop, bmpLoopDisabled, TTB_PlaySpeed, 1);
   MakeAlternateImages(bmpCutPreview, bmpCutPreviewDisabled, TTB_PlaySpeed, 2);
   mButtons[TTB_PlaySpeed]->FollowModifierKeys();

   //Add a slider that controls the speed of playback.
   const int SliderWidth=100;
   mPlaySpeedSlider = safenew ASlider(this,
                                  TTB_PlaySpeedSlider,
                                  _("Playback Speed"),
                                  wxDefaultPosition,
                                  wxSize(SliderWidth,25),
                                  SPEED_SLIDER);
   mPlaySpeedSlider->Set(mPlaySpeed / 100.0);
   mPlaySpeedSlider->SetLabel(_("Playback Speed"));
   //  6 steps using page up/down, and 60 using arrow keys
   mPlaySpeedSlider->SetScroll(0.16667f, 1.6667f);
   Add( mPlaySpeedSlider, 0, wxALIGN_CENTER );
   mPlaySpeedSlider->Connect(wxEVT_SET_FOCUS,
                 wxFocusEventHandler(TranscriptionToolBar::OnFocus),
                 NULL,
                 this);
   mPlaySpeedSlider->Connect(wxEVT_KILL_FOCUS,
                 wxFocusEventHandler(TranscriptionToolBar::OnFocus),
                 NULL,
                 this);

#ifdef EXPERIMENTAL_VOICE_DETECTION
// If we need these strings translated, then search and replace
// TRANSLATBLE by _ and remove this #define.
#define TRANSLATABLE( x ) wxT( x )
   AddButton(bmpTnStartOn,     bmpTnStartOnDisabled,  TTB_StartOn,
      TRANSLATABLE("Adjust left selection to next onset"));
   AddButton(bmpTnEndOn,       bmpTnEndOnDisabled,   TTB_EndOn,
      TRANSLATABLE("Adjust right selection to previous offset"));
   AddButton(bmpTnStartOff,    bmpTnStartOffDisabled,  TTB_StartOff,
      TRANSLATABLE("Adjust left selection to next offset"));
   AddButton(bmpTnEndOff,      bmpTnEndOffDisabled,    TTB_EndOff,
      TRANSLATABLE("Adjust right selection to previous onset"));
   AddButton(bmpTnSelectSound, bmpTnSelectSoundDisabled, TTB_SelectSound,
      TRANSLATABLE("Select region of sound around cursor"));
   AddButton(bmpTnSelectSilence, bmpTnSelectSilenceDisabled, TTB_SelectSilence,
      TRANSLATABLE("Select region of silence around cursor"));
   AddButton(bmpTnAutomateSelection,   bmpTnAutomateSelectionDisabled,  TTB_AutomateSelection,
      TRANSLATABLE("Automatically make labels from words"));
   AddButton(bmpTnMakeTag, bmpTnMakeTagDisabled,  TTB_MakeLabel,
      TRANSLATABLE("Add label at selection"));
   AddButton(bmpTnCalibrate, bmpTnCalibrateDisabled, TTB_Calibrate,
      TRANSLATABLE("Calibrate voicekey"));

   mSensitivitySlider = safenew ASlider(this,
                                    TTB_SensitivitySlider,
                                    TRANSLATABLE("Adjust Sensitivity"),
                                    wxDefaultPosition,
                                    wxSize(SliderWidth,25),
                                    SPEED_SLIDER);
   mSensitivitySlider->Set(.5);
   mSensitivitySlider->SetLabel(TRANSLATABLE("Sensitivity"));
   Add( mSensitivitySlider, 0, wxALIGN_CENTER );

   wxString choices[] =
   {
      TRANSLATABLE("Energy"),
      TRANSLATABLE("Sign Changes (Low Threshold)"),
      TRANSLATABLE("Sign Changes (High Threshold)"),
      TRANSLATABLE("Direction Changes (Low Threshold)"),
      TRANSLATABLE("Direction Changes (High Threshold)")
   };

   mKeyTypeChoice = safenew wxChoice(this, TTB_KeyType,
                                 wxDefaultPosition,
                                 wxDefaultSize,
                                 5,
                                 choices );
   mKeyTypeChoice->SetName(TRANSLATABLE("Key type"));
   mKeyTypeChoice->SetSelection(0);
   Add( mKeyTypeChoice, 0, wxALIGN_CENTER );
#endif

   // Add a little space
   Add(2, -1);

   UpdatePrefs();
}
void TranscriptionToolBar::RegenerateTooltips()
{
   // We could also mention the shift- and ctrl-modified versions in the
   // tool tip... but it would get long

   static const struct Entry {
      int tool;
      wxString commandName;
      wxString untranslatedLabel;
   } table[] = {
      { TTB_PlaySpeed,   wxT("PlayAtSpeed"),    XO("Play-at-speed")  },
   };

   std::vector<wxString> commands;
   for (const auto &entry : table) {
      commands.clear();
      commands.push_back(wxGetTranslation(entry.untranslatedLabel));
      commands.push_back(entry.commandName);
      ToolBar::SetButtonToolTip(*mButtons[entry.tool], commands);
   }


#ifdef EXPERIMENTAL_VOICE_DETECTION
   mButtons[TTB_StartOn]->SetToolTip(TRANSLATABLE("Left-to-On"));
   mButtons[TTB_EndOn]->SetToolTip(   TRANSLATABLE("Right-to-Off"));
   mButtons[TTB_StartOff]->SetToolTip(   TRANSLATABLE("Left-to-Off"));
   mButtons[TTB_EndOff]->SetToolTip(   TRANSLATABLE("Right-to-On"));
   mButtons[TTB_SelectSound]->SetToolTip(   TRANSLATABLE("Select-Sound"));
   mButtons[TTB_SelectSilence]->SetToolTip(   TRANSLATABLE("Select-Silence"));
   mButtons[TTB_AutomateSelection]->SetToolTip(   TRANSLATABLE("Make Labels"));
   mButtons[TTB_MakeLabel]->SetToolTip(   TRANSLATABLE("Add Label"));
   mButtons[TTB_Calibrate]->SetToolTip(   TRANSLATABLE("Calibrate"));

   mSensitivitySlider->SetToolTip(TRANSLATABLE("Sensitivity"));
   mKeyTypeChoice->SetToolTip(TRANSLATABLE("Key type"));
#endif
}