예제 #1
0
wxString TagsOptionsData::ToString()
{
    wxString options(wxEmptyString);

    static wxString file_name;
    wxString file_content;

    if(file_name.IsEmpty()) {
        char* ctagsReplacement = getenv("CTAGS_REPLACEMENTS");
        if(ctagsReplacement) {
            file_name = wxString(ctagsReplacement, wxConvUTF8).c_str();
        }
    }

    DoUpdateTokensWxMap();
    std::map<wxString, wxString> tokensMap = GetTokensWxMap();
    std::map<wxString, wxString>::iterator iter = tokensMap.begin();

    if(tokensMap.empty() == false) {
        for(; iter != tokensMap.end(); ++iter) {
            if(!iter->second.IsEmpty() || (iter->second.IsEmpty() && iter->first.Find(wxT("%0")) != wxNOT_FOUND)) {
                // Key = Value pair. Place this one in the output file
                file_content << iter->first << wxT("=") << iter->second << wxT("\n");
            } else {

                if(options.IsEmpty())
                    options = wxT(" -I");

                options << iter->first;
                options << wxT(",");
            }
        }

        if(options.IsEmpty() == false)
            options.RemoveLast();

        options += wxT(" ");
    }

    // write the file content
    if(file_name.IsEmpty() == false) {
        wxFFile fp(file_name, wxT("w+b"));
        if(fp.IsOpened()) {
            fp.Write(file_content);
            fp.Close();
        }
    }

    if(GetLanguages().IsEmpty() == false) {
        options += wxT(" --language-force=");
        options += GetLanguages().Item(0);
        options += wxT(" ");
    }
    return options;
}
예제 #2
0
wxString GetSystemLanguageCode()
{
   wxArrayString langCodes;
   wxArrayString langNames;

   GetLanguages(langCodes, langNames);
   int sysLang = wxLocale::GetSystemLanguage();
   const wxLanguageInfo *info = wxLocale::GetLanguageInfo(sysLang);
   
   if (info) {
      wxString fullCode = info->CanonicalName;
      if (fullCode.Length() < 2)
         return wxT("en");

      wxString code = fullCode.Left(2);
      unsigned int i;

      for(i=0; i<langCodes.GetCount(); i++) {
         if (langCodes[i] == fullCode)
            return fullCode;

         if (langCodes[i] == code)
            return code;
      }
   }

   return wxT("en");
}
예제 #3
0
//---------------------------------------------------------------------------------------
LangOptionsPanel::LangOptionsPanel(wxWindow* parent, ApplicationScope& appScope)
    : OptionsPanel(parent, appScope)
{
    create_controls();

    //load icon
    m_pTitleIcon->SetBitmap( wxArtProvider::GetIcon("opt_language", wxART_TOOLBAR, wxSize(24,24)) );

    //Get current selected language
    wxConfigBase* pPrefs = m_appScope.get_preferences();
    m_sCurLang = pPrefs->Read("/Locale/Language", "en");

    // Get array of available languages
    GetLanguages(m_cLangCodes, m_cLangNames);
    int nNumLangs = m_cLangNames.GetCount();
    m_pChoice->Append(m_cLangNames);

    //select current language
    m_pChoice->SetSelection(0);         //default selection
    int i;
    for(i=0; i < nNumLangs; i++) {
        if (m_cLangCodes[i] == m_sCurLang)
            m_pChoice->SetSelection(i);
    }

}
예제 #4
0
void GUIPrefs::Populate()
{
   // First any pre-processing for constructing the GUI.
   GetLanguages(mLangCodes, mLangNames);

   mHtmlHelpCodes.Add(wxT("Local"));
   mHtmlHelpCodes.Add(wxT("FromInternet"));

   mHtmlHelpChoices.Add(_("Local"));
   mHtmlHelpChoices.Add(_("From Internet"));

   GetRangeChoices(&mRangeChoices, &mRangeCodes);

#if 0
   // only for testing...
   mLangCodes.Add("kg");   mLangNames.Add("Klingon");
   mLangCodes.Add("ep");   mLangNames.Add("Esperanto");
#endif

   //------------------------- Main section --------------------
   // Now construct the GUI itself.
   // Use 'eIsCreatingFromPrefs' so that the GUI is
   // initialised with values from gPrefs.
   ShuttleGui S(this, eIsCreatingFromPrefs);
   PopulateOrExchange(S);
   // ----------------------- End of main section --------------
}
wxString TagsOptionsData::ToString() const
{
	wxString options(wxEmptyString);
	if(GetLanguages().IsEmpty() == false){
		options += wxT(" --language-force=");
		options += GetLanguages().Item(0);
		options += wxT(" ");
	}

	if(GetPreprocessorFilename().IsOk()){
		options += wxT("-I@\"");
		options += GetPreprocessorFilename().GetFullPath();
		options += wxT("\"");
	}
	return options;
}
예제 #6
0
std::vector<MapElementI*> DesuraJSSettings::getLanguages()
{
	std::vector<MapElementI*> ret;
	
	for (auto lang : GetLanguages())
		ret.push_back(new MapElement<std::map<gcString, gcString>>(lang));

	return ret;
}
예제 #7
0
bool ThemeManager::DoesLanguageExist( const RString &sLanguage )
{
	vector<RString> asLanguages;
	GetLanguages( asLanguages );

	for( unsigned i=0; i<asLanguages.size(); i++ )
		if( sLanguage.CompareNoCase(asLanguages[i])==0 )
			return true;
	return false;
}
예제 #8
0
wxString TagsOptionsData::ToString() const
{
	wxString options(wxEmptyString);

	wxString file_name, file_content;
	wxGetEnv(wxT("CTAGS_REPLACEMENTS"), &file_name);

	std::map<wxString, wxString> tokensMap = GetTokensWxMap();
	std::map<wxString, wxString>::iterator iter = tokensMap.begin();

	if(tokensMap.empty() == false) {
		options = wxT(" -I");
		for(; iter != tokensMap.end(); iter++) {
			if(iter->second.IsEmpty() == false) {
				// Key = Value pair. Place this one in the output file
				file_content << iter->first << wxT("=") << iter->second << wxT("\n");
			} else {
				options << iter->first;
				options << wxT(",");
			}
		}
		options.RemoveLast();
		options += wxT(" ");
	}

	// write the file content
	if (file_name.IsEmpty() == false) {
		wxFFile fp(file_name, wxT("w+b"));
		if (fp.IsOpened()) {
			fp.Write(file_content);
			fp.Close();
		}
	}

	if (GetLanguages().IsEmpty() == false) {
		options += wxT(" --language-force=");
		options += GetLanguages().Item(0);
		options += wxT(" ");
	}
	return options;
}
예제 #9
0
LanguageServerEntry LanguageServerPage::GetData() const
{
    LanguageServerEntry d;
    d.SetName(m_textCtrlName->GetValue());
    d.SetArgs(m_textCtrlArgs->GetValue());
    d.SetExepath(m_filePickerExe->GetPath());
    d.SetWorkingDirectory(m_dirPickerWorkingDir->GetPath());
    d.SetLanguages(GetLanguages());
    d.SetEnabled(m_checkBoxEnabled->IsChecked());
    d.SetConnectionString(m_comboBoxConnection->GetValue());
    d.SetPriority(m_sliderPriority->GetValue());
    d.SetDisaplayDiagnostics(m_checkBoxDiagnostics->IsChecked());
    return d;
}
예제 #10
0
//---------------------------------------------------------------------------------------
DlgChooseLanguage::DlgChooseLanguage(wxWindow* parent, wxWindowID id,
                                   const wxString& title)
    : wxDialog(parent, id, title)
{
    GetLanguages(m_cLangCodes, m_cLangNames);
    m_nNumLangs = m_cLangNames.GetCount();

    wxString sysLang = GetSystemLanguageCode();

    wxBoxSizer *mainSizer = LENMUS_NEW wxBoxSizer(wxVERTICAL);
    wxBoxSizer *hSizer;

    hSizer = LENMUS_NEW wxBoxSizer(wxHORIZONTAL);
    hSizer->Add(LENMUS_NEW wxStaticText(this, -1,
                                    _("Choose language to use:")),
                0, wxALIGN_CENTRE | wxALIGN_CENTER_VERTICAL | wxALL, 8);

    wxString *langArray = LENMUS_NEW wxString[m_nNumLangs];
    for(int i=0; i < m_nNumLangs; i++)
        langArray[i] = m_cLangNames[i];
    m_pChoice = LENMUS_NEW wxChoice(this, -1, wxDefaultPosition, wxDefaultSize,
                            m_nNumLangs, langArray);
    m_pChoice->SetSelection(0); // in case nothing else matches
    delete[] langArray;

    for(int i=0; i < m_nNumLangs; i++)
    {
        if (m_cLangCodes[i] == sysLang)
            m_pChoice->SetSelection(i);
    }
    hSizer->Add(m_pChoice,
                0, wxALIGN_CENTRE | wxALIGN_CENTER_VERTICAL | wxALL, 8);

    mainSizer->Add(hSizer,
                    0, wxALL, 8);

    wxButton *ok = LENMUS_NEW wxButton(this, wxID_OK, _("OK"));
    ok->SetDefault();
    mainSizer->Add(ok, 0, wxALIGN_CENTRE | wxALL, 8);

    SetAutoLayout(true);
    SetSizer(mainSizer);
    mainSizer->Fit(this);
    mainSizer->SetSizeHints(this);

    // set default language, just in case user closes the dialog by clicking on
    // the dialog title [X] button
    m_sLang = m_cLangCodes[m_pChoice->GetSelection()];
}
예제 #11
0
bool SetLanguageVoice(int lang, int voice, int sampleRate=0) 
{
    ttsTrace("ECI::SetLanguage...");
    
    int baseVoice = 0;
    
    switch (voice) {        
        case 1:
            baseVoice = 2;  //adult female
            break;
        case 2:
            baseVoice = 3;  //child
            break;
        case 3:
            baseVoice = 7;  //elderly male
            break;
        case 4:
            baseVoice = 8;  //elderly female
            break;
        default:
            baseVoice = 1;  //adult male
    }
    
    
    eciCopyVoice(eciInstance, baseVoice, 0);
    
    eciSetParam(eciInstance, eciSampleRate, sampleRate); // use 8k
    
    if(SelectedLanguage==-1) GetLanguages(0, NULL);	//initialize AvailableLangs array
    SelectedLanguage=AvailableLangs[lang];
    eciSetParam(eciInstance, eciLanguageDialect, LANGUAGES[SelectedLanguage].param);
    int lan=eciGetParam(eciInstance, eciLanguageDialect);
#ifdef _DEBUG    
	FILE *fp=fopen("C:\\b.log","w+");
	if(fp!=NULL) {
		int actualsize=fwrite((void*)LANGUAGES[SelectedLanguage].paramString, sizeof(char), 20,fp);		
		fwrite((void*)"\n", sizeof(char), 2,fp);		
		if(lan==eciTaiwaneseMandarin) fwrite((void*)"GOOD\n", sizeof(char), 6,fp);		
		if(lan==eciGeneralAmericanEnglish) fwrite((void*)"BAD\n", sizeof(char), 6,fp);	
		
		fflush(fp);
		fclose(fp);
	}
#endif
    
    return true;    
}
예제 #12
0
void GUIPrefs::Populate()
{
   // First any pre-processing for constructing the GUI.
   GetLanguages(mLangCodes, mLangNames);

   mHtmlHelpCodes.Add(wxT("Local"));
   mHtmlHelpCodes.Add(wxT("FromInternet"));

   mHtmlHelpChoices.Add(_("Local"));
   mHtmlHelpChoices.Add(_("From Internet"));

   mThemeCodes.Add( wxT("classic") );
   mThemeCodes.Add( wxT("light") );
   mThemeCodes.Add( wxT("dark") );
   mThemeCodes.Add( wxT("high-contrast") );
   mThemeCodes.Add( wxT("custom") );

   /* i18n-hint: describing the "classic" or traditional appearance of older versions of Audacity */
   mThemeChoices.Add( _("Classic") );
   /* i18n-hint: Light meaning opposite of dark */
   mThemeChoices.Add( _("Light") );
   mThemeChoices.Add( _("Dark") );
   /* i18n-hint: greater difference between foreground and background colors */
   mThemeChoices.Add( _("High Contrast") );
   /* i18n-hint: user defined */
   mThemeChoices.Add( _("Custom") );

   GetRangeChoices(&mRangeChoices, &mRangeCodes);

#if 0
   // only for testing...
   mLangCodes.Add("kg");   mLangNames.Add("Klingon");
   mLangCodes.Add("ep");   mLangNames.Add("Esperanto");
#endif

   //------------------------- Main section --------------------
   // Now construct the GUI itself.
   // Use 'eIsCreatingFromPrefs' so that the GUI is
   // initialised with values from gPrefs.
   ShuttleGui S(this, eIsCreatingFromPrefs);
   PopulateOrExchange(S);
   // ----------------------- End of main section --------------
}
예제 #13
0
void GUIPrefs::Populate()
{
   // First any pre-processing for constructing the GUI.
   GetLanguages(mLangCodes, mLangNames);

   mHtmlHelpCodes.Add(wxT("Local"));
   mHtmlHelpCodes.Add(wxT("FromInternet"));

   mHtmlHelpChoices.Add(_("Local"));
   mHtmlHelpChoices.Add(_("From Internet"));

   mRangeCodes.Add(wxT("36"));
   mRangeCodes.Add(wxT("48"));
   mRangeCodes.Add(wxT("60"));
   mRangeCodes.Add(wxT("72"));
   mRangeCodes.Add(wxT("84"));
   mRangeCodes.Add(wxT("96"));
   mRangeCodes.Add(wxT("120"));
   mRangeCodes.Add(wxT("145"));

   mRangeChoices.Add(_("-36 dB (shallow range for high-amplitude editing)"));
   mRangeChoices.Add(_("-48 dB (PCM range of 8 bit samples)"));
   mRangeChoices.Add(_("-60 dB (PCM range of 10 bit samples)"));
   mRangeChoices.Add(_("-72 dB (PCM range of 12 bit samples)"));
   mRangeChoices.Add(_("-84 dB (PCM range of 14 bit samples)"));
   mRangeChoices.Add(_("-96 dB (PCM range of 16 bit samples)"));
   mRangeChoices.Add(_("-120 dB (approximate limit of human hearing)"));
   mRangeChoices.Add(_("-145 dB (PCM range of 24 bit samples)"));

#if 0
   // only for testing...
   mLangCodes.Add("kg");   mLangNames.Add("Klingon");
   mLangCodes.Add("ep");   mLangNames.Add("Esperanto");
#endif

   //------------------------- Main section --------------------
   // Now construct the GUI itself.
   // Use 'eIsCreatingFromPrefs' so that the GUI is
   // initialised with values from gPrefs.
   ShuttleGui S(this, eIsCreatingFromPrefs);
   PopulateOrExchange(S);
   // ----------------------- End of main section --------------
}
예제 #14
0
	void KnownDictsManager::reemitLanguages ()
	{
		emit languagesChanged (GetLanguages ());
	}
예제 #15
0
GUIPrefs::GUIPrefs(wxWindow * parent):
PrefsPanel(parent)
{
   // Scrolling
   bool autoscroll, spectrogram, editToolBar,mixerToolBar, alwaysEnablePause,
      quitOnClose, adjustSelectionEdges, ergonomicTransportButtons,
	   meterToolBar, alwaysEnablePlay;
   int envdBRange;

   gPrefs->Read("/GUI/AutoScroll", &autoscroll, true);
   gPrefs->Read("/GUI/UpdateSpectrogram", &spectrogram, true);

   bool bDefaultEditToolbar = true;
   bool bDefaultMixerToolbar = true;
   bool bDefaultMeterToolbar = true;
   #if (AUDACITY_BRANDING == BRAND_UMIXIT)
      bDefaultEditToolbar = false;
      bDefaultMixerToolbar = false;
   #elif (AUDACITY_BRANDING == BRAND_THINKLABS)
      // no Mixer or Meter Toolbar by default for Thinklabs
      bDefaultMixerToolbar = false;
      bDefaultMeterToolbar = true;
   #endif
   gPrefs->Read("/GUI/EnableEditToolBar", &editToolBar, bDefaultEditToolbar);
   gPrefs->Read("/GUI/EnableMixerToolBar", &mixerToolBar, bDefaultMixerToolbar);
   gPrefs->Read("/GUI/EnableMeterToolBar", &meterToolBar, bDefaultMeterToolbar);

   gPrefs->Read("/GUI/AlwaysEnablePause", &alwaysEnablePause, false);
   gPrefs->Read("/GUI/AlwaysEnablePlay", &alwaysEnablePlay, false);

   // Code duplication warning: this default is repeated in Project.cpp
   // in the destructor.  -DMM
   #ifdef __WXMAC__
   bool defaultQuitOnClose = false;
   #else
   bool defaultQuitOnClose = true;
   #endif
   // End code duplication warning

   gPrefs->Read("/GUI/QuitOnClose", &quitOnClose, defaultQuitOnClose);
   gPrefs->Read("/GUI/AdjustSelectionEdges", &adjustSelectionEdges, true);
   gPrefs->Read("/GUI/ErgonomicTransportButtons", &ergonomicTransportButtons, false);
   gPrefs->Read("/GUI/EnvdBRange", &envdBRange, ENV_DB_RANGE);

   topSizer = new wxBoxSizer( wxVERTICAL );
   
   //Auto-scrolling preference
   mAutoscroll = new wxCheckBox(this, -1, _("Autoscroll while playing"));
   mAutoscroll->SetValue(autoscroll);
   topSizer->Add(mAutoscroll, 0, wxGROW|wxALL, 2);

   //Always enable pause preference
   mAlwaysEnablePause = new wxCheckBox(this, -1, _("Always allow pausing"));
   mAlwaysEnablePause->SetValue(alwaysEnablePause);
   topSizer->Add(mAlwaysEnablePause, 0, wxGROW|wxALL, 2);

   // Always enable play
   mAlwaysEnablePlay = new wxCheckBox(this, -1, _("Always allow playing"));
   mAlwaysEnablePlay->SetValue(alwaysEnablePlay);
   topSizer->Add(mAlwaysEnablePlay, 0, wxGROW|wxALL, 2);

   //Spectrogram preference
   mSpectrogram = new wxCheckBox(this, -1, _("Update spectrogram while playing"));
   mSpectrogram->SetValue(spectrogram);
   topSizer->Add(mSpectrogram, 0, wxGROW|wxALL, 2);

   //Enable Edit toolbar preference

   mEditToolBar = new wxCheckBox(this, -1, _("Enable Edit Toolbar"));
   mEditToolBar->SetValue(editToolBar);
   topSizer->Add(mEditToolBar, 0, wxGROW|wxALL, 2);

   //Enable Mixer toolbar preference
   mMixerToolBar = new wxCheckBox(this, -1, _("Enable Mixer Toolbar"));
   mMixerToolBar->SetValue(mixerToolBar);
   topSizer->Add(mMixerToolBar, 0, wxGROW|wxALL, 2);

   //Enable Meter toolbar preference
   mMeterToolBar = new wxCheckBox(this, -1, _("Enable Meter Toolbar"));
   mMeterToolBar->SetValue(meterToolBar);
   topSizer->Add(mMeterToolBar, 0, wxGROW|wxALL, 2);


   // Quit Audacity when last window closes?
   mQuitOnClose = new wxCheckBox(this, -1,
                                 _("Quit Audacity upon closing last window"));
   mQuitOnClose->SetValue(quitOnClose);
   topSizer->Add(mQuitOnClose, 0, wxGROW|wxALL, 2);

   // Enable/disable adjust selection edges
   mAdjustSelectionEdges =
      new wxCheckBox(this, -1,
                     _("Enable dragging of left and right selection edges"));
   mAdjustSelectionEdges->SetValue(adjustSelectionEdges);
   topSizer->Add(mAdjustSelectionEdges, 0, wxGROW|wxALL, 2);

   // Enable/disable ergonomic order of transport buttons
   mErgonomicTransportButtons =
      new wxCheckBox(this, -1,
                     _("Enable ergonomic order of Audio I/O buttons"));
   mErgonomicTransportButtons->SetValue(ergonomicTransportButtons);
   topSizer->Add(mErgonomicTransportButtons, 0, wxGROW|wxALL, 2);

   // Locale
   GetLanguages(mLangCodes, mLangNames);
   int numLangs = mLangNames.GetCount();

   wxString currentLang = gPrefs->Read("/Locale/Language", "en");
   wxString *langArray = new wxString[numLangs];
   int i;
   for(i=0; i<numLangs; i++)
      langArray[i] = mLangNames[i];
   mLocale = new wxChoice(this, -1, wxDefaultPosition, wxDefaultSize,
                          numLangs, langArray);
   mLocale->SetSelection(0); // in case nothing else matches
   delete[] langArray;
   for(i=0; i<numLangs; i++)
      if (mLangCodes[i] == currentLang)
         mLocale->SetSelection(i);

   mLocaleLabel = new wxStaticText(this, -1, _("Language:"));

   wxFlexGridSizer *localeSizer = new wxFlexGridSizer( 0, 2, 0, 0 );
   localeSizer->Add(mLocaleLabel, 0, wxALIGN_LEFT|wxALL|wxALIGN_CENTER_VERTICAL, 2);
   localeSizer->Add(mLocale, 1, wxGROW|wxALL|wxALIGN_CENTER_VERTICAL, 2 );
   topSizer->Add(localeSizer, 0, wxGROW|wxALL, 2);
   
   // dB range display setup
   {
      wxStaticBoxSizer *dbRangeSizer = new wxStaticBoxSizer(
         new wxStaticBox(this, -1,
            _("Minimum of dB mode display range")),
         wxVERTICAL );

      
      mdBArray[0] = new wxRadioButton(
	 this, -1, _("-36 dB (shallow range for high-amplitude editing)"),
         wxDefaultPosition, wxDefaultSize, wxRB_GROUP );

      dbRangeSizer->Add( mdBArray[0], 0,
         wxGROW|wxLEFT | wxRIGHT, RADIO_BUTTON_BORDER );

      mdBArray[1] = new wxRadioButton(
	 this, -1, _("-48 dB (PCM range of 8 bit samples)"),
         wxDefaultPosition, wxDefaultSize, 0 );

      dbRangeSizer->Add( mdBArray[1], 0,
         wxGROW|wxLEFT | wxRIGHT, RADIO_BUTTON_BORDER );

      mdBArray[2] = new wxRadioButton(
	 this, -1, _("-96 dB (PCM range of 16 bit samples)"),
         wxDefaultPosition, wxDefaultSize, 0 );

      dbRangeSizer->Add( mdBArray[2], 0,
         wxGROW|wxLEFT | wxRIGHT, RADIO_BUTTON_BORDER );

      mdBArray[3] = new wxRadioButton(
	 this, -1, _("-120 dB (approximate limit of human hearing)"),
         wxDefaultPosition, wxDefaultSize, 0 );
          
      dbRangeSizer->Add( mdBArray[3], 0,
         wxGROW|wxLEFT | wxRIGHT, RADIO_BUTTON_BORDER );

      mdBArray[4] = new wxRadioButton(
	 this, -1, _("-145 dB (PCM range of 24 bit samples)"),
         wxDefaultPosition, wxDefaultSize, 0 );

      dbRangeSizer->Add( mdBArray[4], 0,
         wxGROW|wxLEFT | wxRIGHT, RADIO_BUTTON_BORDER );

      mdBArray[0]->SetValue(false);
      mdBArray[1]->SetValue(false);
      mdBArray[2]->SetValue(false);
      mdBArray[3]->SetValue(false);
      mdBArray[4]->SetValue(false);

      if(envdBRange<=36){
	mdBArray[0]->SetValue(true);
      }else if(envdBRange<=48){
	mdBArray[1]->SetValue(true);
      }else if(envdBRange<=96){
	mdBArray[2]->SetValue(true);
      }else if(envdBRange<=120){
	mdBArray[3]->SetValue(true);
      }else{
	mdBArray[4]->SetValue(true);
      }

      topSizer->Add( dbRangeSizer, 0, wxGROW|wxALL, TOP_LEVEL_BORDER );
   }

   // Finish layout
   outSizer = new wxBoxSizer( wxVERTICAL );
   outSizer->Add(topSizer, 0, wxGROW|wxALL, TOP_LEVEL_BORDER);

   SetAutoLayout(true);
   SetSizer(outSizer);

   outSizer->Fit(this);
   outSizer->SetSizeHints(this);
}