Ejemplo n.º 1
0
	private void InitEncodingComboBox () {
		int fixedEncoding = -1;
		ConfigFileOpenEncoding encodingConfig = Base.Config.PrefsDefaultsFileOpenEncoding;
		if (encodingConfig == ConfigFileOpenEncoding.Fixed) {
			string encodingName = Base.Config.PrefsDefaultsFileOpenEncodingFixed;
			EncodingDescription encodingDescription = EncodingDescription.Empty;
			Encodings.Find(encodingName, ref encodingDescription);
			fixedEncoding = encodingDescription.CodePage;
		}

		this.encodingComboBox = new EncodingComboBox(fileEncodingComboBox, true, null, fixedEncoding);

		/* Only need to handle the case of currentLocale, as Fixed is handled before and AutoDetect is the default behaviour */
		if (encodingConfig == ConfigFileOpenEncoding.CurrentLocale)
			encodingComboBox.ActiveSelection = (int)encodingConfig;
	}
Ejemplo n.º 2
0
	private void SetDefaultsFileSaveEncoding () {
		string[] additionalActions = { Catalog.GetString("Keep the encoding used on file open"), Catalog.GetString("Remember the last used encoding") };
		int fixedEncoding = -1;
		ConfigFileSaveEncodingOption fileSaveEncodingOption = Base.Config.PrefsDefaultsFileSaveEncodingOption;
		if (fileSaveEncodingOption == ConfigFileSaveEncodingOption.Specific) {
			string encodingName = Base.Config.PrefsDefaultsFileSaveEncodingFixed;
			EncodingDescription encodingDescription = EncodingDescription.Empty;
			Encodings.Find(encodingName, ref encodingDescription);
			fixedEncoding = encodingDescription.CodePage;
		}

		fileSaveEncoding = new EncodingComboBox(fileSaveEncodingComboBox, false, additionalActions, fixedEncoding);
		if (fileSaveEncodingOption != ConfigFileSaveEncodingOption.Specific) {
			fileSaveEncoding.ActiveSelection = (int)fileSaveEncodingOption;
		}
		fileSaveEncoding.SelectionChanged += OnDefaultsFileSaveEncodingChanged;
	}
Ejemplo n.º 3
0
	private void SetDefaultsFileOpenFallbackEncoding () {
		int fixedEncoding = -1;
		ConfigFileOpenFallbackEncoding fileOpenFallbackEncodingConfig = Base.Config.PrefsDefaultsFileOpenFallbackEncoding;
		if (fileOpenFallbackEncodingConfig == ConfigFileOpenFallbackEncoding.Fixed) {
			string encodingName = Base.Config.PrefsDefaultsFileOpenFallbackEncodingFixed;
			EncodingDescription encodingDescription = EncodingDescription.Empty;
			Encodings.Find(encodingName, ref encodingDescription);
			fixedEncoding = encodingDescription.CodePage;
		}

		fileOpenFallbackEncoding = new EncodingComboBox(fileOpenFallbackEncodingComboBox, false, null, fixedEncoding);
		fileOpenFallbackEncoding.SelectionChanged += OnDefaultsFileOpenFallbackEncodingChanged;
	}
	/* Private members */

	private void InitEncodingComboBox () {
		int fixedEncoding = GetFixedEncoding();
		ConfigFileSaveEncoding encodingConfig = Base.Config.PrefsDefaultsFileSaveEncoding;
		if (encodingConfig == ConfigFileSaveEncoding.Fixed) {
			string encodingName = Base.Config.PrefsDefaultsFileSaveEncodingFixed;
			EncodingDescription encodingDescription = EncodingDescription.Empty;
			Encodings.Find(encodingName, ref encodingDescription);
			fixedEncoding = encodingDescription.CodePage;
		}

		this.encodingComboBoxComponent = new EncodingComboBox(fileEncodingComboBox, false, null, fixedEncoding);

		/* Only need to handle the case of currentLocale, as Fixed and Keep Existent is handled before */
		if (encodingConfig == ConfigFileSaveEncoding.CurrentLocale)
			encodingComboBoxComponent.ActiveSelection = (int)encodingConfig;
	}