Esempio n. 1
0
        /* ----------------------------------------------------------------- */
        ///
        /// SaveRecentlyResizedList
        /// 
        /// <summary>
        /// 最近に使用したリサイズ設定の一覧を保存する.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        private void SaveRecentlyResizedList()
        {
            var list = combo_size.Tag as List<SizeSelector.ItemInfo>;
            if (list == null) return;

            if (_presize != null) {
                for (int i = 0; i < list.Count; ++i) {
                    if (list[i].id == _presize.id && list[i].category == _presize.category) {
                        list.RemoveAt(i);
                        combo_size.Items.RemoveAt(i);
                        break;
                    }
                }
                combo_size.Items.Insert(0, _presize.name);
                list.Insert(0, _presize);
                combo_size.SelectedIndex = 0;
            }
            else if (combo_size.SelectedIndex > 0)
            {
                // 現在,選択されている項目を最上段へ移動させる.
                var selected = list[combo_size.SelectedIndex];
                list.RemoveAt(combo_size.SelectedIndex);
                list.Insert(0, selected);
                combo_size.Items.RemoveAt(combo_size.SelectedIndex);
                combo_size.Items.Insert(0, selected.name);
                combo_size.SelectedIndex = 0;
            }

            int num = combo_size.Items.Count;
            _setting.SetInt(SETTING_LIST_NUM, num);
            for (int i = 0; i < num; ++i) {
                _setting.SetString(SETTING_LIST_ID + i, list[i].id);
                _setting.SetString(SETTING_LIST_CATEGORY + i, list[i].category);
                _setting.SetString(SETTING_LIST_NAME + i, list[i].name);
                _setting.SetInt(SETTING_LIST_WIDTH + i, list[i].width);
                _setting.SetInt(SETTING_LIST_HEIGHT + i, list[i].height);
                _setting.SetInt(SETTING_LIST_METHOD + i, list[i].method);
            }

            _presize = null;
        }
Esempio n. 2
0
 private void numeric_wh_ValueChanged(object sender, EventArgs e)
 {
     if (!_isupdate)
         _presize = null;
 }
Esempio n. 3
0
        /* ----------------------------------------------------------------- */
        ///
        /// CreateRecentlyResizedItem
        /// 
        /// <summary>
        /// 現在のサイズ,およびサイズ変更メソッドの値が最近使用した設定
        /// 一覧のどれにも当てはまらない場合,「ユーザ設定」とした項目
        /// を作成する.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        private void CreateRecentlyResizedItem()
        {
            var list = combo_size.Tag as List<SizeSelector.ItemInfo>;
            if (_presize != null || list == null) return;

            var width = (int)numeric_width.Value;
            var height = (int)numeric_height.Value;
            var method = this.GetResizeMethod();
            foreach (var item in list)
            {
                if (item.width == width && item.height == height && item.method == method) return;
            }

            // コンボボックスに表示する文字列
            var name = "ユーザ設定 (";
            if (method == 3) name += "任意の幅";
            else name += width.ToString();
            name += "×";
            if (method == 2) name += "任意の高さ";
            else name += height.ToString();
            name += ")";

            _presize = new SizeSelector.ItemInfo("user", "user", name, width, height, method);
        }
Esempio n. 4
0
        public MainForm()
        {
            InitializeComponent();
            _setting = new Global.Setting.Setting(ORGANIZATION_NAME, APPLICATION_NAME);
            this.FormClosed += (sender,e) => _setting.Dispose();

            // サイズに関する初期設定
            check_resize.Checked = _setting.GetBool(SETTING_ENABLE_RESIZE, true);
            panel_resize.Enabled = check_resize.Checked;
            numeric_width.Value = _setting.GetInt(SETTING_WIDTH, 640);
            numeric_height.Value = _setting.GetInt(SETTING_HEIGHT, 480);
            this.SetResizeMethod(_setting.GetInt(SETTING_RESIZE_METHOD, 1));

            // 画質に関する初期設定
            check_quality.Checked = _setting.GetBool(SETTING_ENABLE_QUALITY, false);
            panel_quality.Enabled = check_quality.Checked;
            if (_setting.GetBool(SETTING_IS_QUALITY, true))
                radio_quality.Checked = true;
            else
                radio_filesize.Checked = true;
            numeric_quality.Enabled = radio_quality.Checked;
            numeric_quality.Value = _setting.GetInt(SETTING_QUALITY, 90);
            combo_quality.Enabled = radio_quality.Checked;
            track_quality.Enabled = radio_quality.Checked;
            numeric_filesize.Enabled = radio_filesize.Checked;
            numeric_filesize.Value = _setting.GetInt(SETTING_FILESIZE, 40);

            // 画像エフェクトに関する初期設定
            check_brightness.Checked = _setting.GetBool(SETTING_BRIGHTNESS, false);
            check_saturation.Checked = _setting.GetBool(SETTING_SATURATION, false);
            check_contrast.Checked = _setting.GetBool(SETTING_CONTRAST, false);
            check_monochrome.Checked = _setting.GetBool(SETTING_MONOCHROME, false);
            check_sepia.Checked = _setting.GetBool(SETTING_SEPIA, false);

            // 保存方法に関する初期設定
            if (_setting.GetBool(SETTING_IS_FOLDER, false))
                radio_folder.Checked = true;
            else
                radio_filename.Checked = true;
            text_folder.Enabled = radio_folder.Checked;
            text_folder.Text = _setting.GetString(SETTING_FOLDER, "resize");
            text_filename.Enabled = radio_filename.Checked;
            text_filename.Text = _setting.GetString(SETTING_FILENAME, "-resize");
            combo_filename.Enabled = radio_filename.Checked;
            if (_setting.GetBool(SETTING_MODIFIER, false))
                combo_filename.SelectedIndex = 0;
            else
                combo_filename.SelectedIndex = 1;
            check_overwrite.Checked = _setting.GetBool(SETTING_OVERWRITE, true);

            var list = new List<SizeSelector.ItemInfo>();
            int num = _setting.GetInt(SETTING_LIST_NUM, 0);
            for (int i = 0; i < num; ++i)
            {
                SizeSelector.ItemInfo info = new SizeSelector.ItemInfo(
                    _setting.GetString(SETTING_LIST_ID + i, ""),
                    _setting.GetString(SETTING_LIST_CATEGORY + i, ""),
                    _setting.GetString(SETTING_LIST_NAME + i, ""),
                    _setting.GetInt(SETTING_LIST_WIDTH + i, 0),
                    _setting.GetInt(SETTING_LIST_HEIGHT + i, 0),
                    _setting.GetInt(SETTING_LIST_METHOD + i, 1));
                combo_size.Items.Add(info.name);
                list.Add(info);
            }
            combo_size.Tag = list;
            if (num != 0) {
                combo_size.SelectedIndex = 0;
            }
        }
Esempio n. 5
0
 /* ----------------------------------------------------------------- */
 ///
 /// button_size_Click
 ///
 /// <summary>
 /// アシスタント機能(「他の設定サイズより選ぶ」)を通じて画像
 /// サイズを設定する.
 /// </summary>
 ///
 /* ----------------------------------------------------------------- */
 private void button_size_Click(object sender, EventArgs e)
 {
     using (SizeSelector selector = new SizeSelector(SIZE_SELECTOR_LAYOUT_XML)) {
         if (selector.ShowDialog(this) == System.Windows.Forms.DialogResult.Cancel)
             return;
         _isupdate = true;
         _presize = selector.SelectedItem;
         numeric_width.Value = _presize.width;
         numeric_height.Value = _presize.height;
         this.SetResizeMethod(_presize.method);
         this.SaveRecentlyResizedList();
         _isupdate = false;
     }
 }