Пример #1
0
        /* ----------------------------------------------------------------- */
        ///
        /// SaveSetting
        /// 
        /// <summary>
        /// 各種 GUI コンポーネントの情報を UserSetting に反映する.
        /// 仮想プリンタ経由など tmp パスが入力パスのテキストボックスに
        /// 設定されている場合,save_input を false にして反映しない
        /// ようにする.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        private void SaveSetting(UserSetting setting, bool save_input)
        {
            setting.OutputPath = this.OutputPathTextBox.Text;
            if (save_input) setting.InputPath = this.InputPathTextBox.Text;
            setting.UserProgram = this.UserProgramTextBox.Text;

            // コンボボックスのインデックス関連
            setting.FileType     = Translator.IndexToFileType(this.FileTypeCombBox.SelectedIndex);
            setting.PDFVersion   = Translator.IndexToPDFVersion(this.PDFVersionComboBox.SelectedIndex);
            setting.Resolution   = Translator.IndexToResolution(this.ResolutionComboBox.SelectedIndex);
            setting.ExistedFile  = Translator.IndexToExistedFile(this.ExistedFileComboBox.SelectedIndex);
            setting.PostProcess  = Translator.IndexToPostProcess(_postproc.SelectedIndex);
            setting.DownSampling = Translator.IndexToDownSampling(this.DownSamplingComboBox.SelectedIndex);

            // チェックボックスのフラグ関連
            setting.PageRotation = this.PageLotationCheckBox.Checked;
            setting.EmbedFont = this.EmbedFontCheckBox.Checked;
            setting.Grayscale = this.GrayscaleCheckBox.Checked;
            setting.ImageFilter = this.ImageFilterCheckBox.Checked ? Parameter.ImageFilters.DCTEncode : Parameter.ImageFilters.FlateEncode;
            setting.WebOptimize = this.WebOptimizeCheckBox.Checked;
            setting.SaveSetting = this.SaveSettingCheckBox.Checked;
            setting.CheckUpdate = this.UpdateCheckBox.Checked;

            // 文書プロパティ
            setting.Document.Title = this.DocTitleTextBox.Text;
            setting.Document.Author = this.DocAuthorTextBox.Text;
            setting.Document.Subtitle = this.DocSubtitleTextBox.Text;
            setting.Document.Keyword = this.DocKeywordTextBox.Text;

            // パスワード
            if (this.OwnerPasswordCheckBox.Checked) {
                setting.Permission.Password = String.Copy(this.OwnerPasswordTextBox.Text);
                setting.Permission.AllowPrint = this.AllowPrintCheckBox.Checked;
                setting.Permission.AllowCopy = this.AllowCopyCheckBox.Checked;
                setting.Permission.AllowFormInput = this.AllowFormInputCheckBox.Checked;
                setting.Permission.AllowModify = this.AllowModifyCheckBox.Checked;

                if (this.RequiredUserPasswordCheckBox.Checked)
                {
                    setting.Password = String.Copy(this.UserPasswordCheckBox.Checked ? this.UserPasswordTextBox.Text : this.OwnerPasswordTextBox.Text);
                }
            }

            // ログ出力
            _messages.Add(new Message(Message.Levels.Debug, "CubePDF.MainForm.SaveSetting"));
            _messages.Add(new Message(Message.Levels.Debug, setting.ToString()));
        }
Пример #2
0
        /* ----------------------------------------------------------------- */
        ///
        /// LoadSetting
        /// 
        /// <summary>
        /// UserSetting の情報を各種 GUI コンポーネントに反映する.
        /// TODO: 仮想プリンタ経由の場合は InputPath にその値を設定する.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        private void LoadSetting(UserSetting setting)
        {
            this.UserProgramTextBox.Text = setting.UserProgram;
            this.OutputPathTextBox.Text = setting.OutputPath;
            this.InputPathTextBox.Text = setting.InputPath;

            // コンボボックスのインデックス関連
            this.FileTypeCombBox.SelectedIndex      = Translator.FileTypeToIndex(setting.FileType);
            this.PDFVersionComboBox.SelectedIndex   = Translator.PDFVersionToIndex(setting.PDFVersion);
            this.ResolutionComboBox.SelectedIndex   = Translator.ResolutionToIndex(setting.Resolution);
            this.ExistedFileComboBox.SelectedIndex  = Translator.ExistedFileToIndex(setting.ExistedFile);
            this.DownSamplingComboBox.SelectedIndex = Translator.DownSamplingToIndex(setting.DownSampling);

            // チェックボックスのフラグ関連
            this.PageLotationCheckBox.Checked = setting.PageRotation;
            this.EmbedFontCheckBox.Checked = setting.EmbedFont;
            this.GrayscaleCheckBox.Checked = setting.Grayscale;
            this.ImageFilterCheckBox.Checked = (setting.ImageFilter == Parameter.ImageFilters.DCTEncode) ? true : false;
            this.WebOptimizeCheckBox.Checked = setting.WebOptimize;
            this.SaveSettingCheckBox.Checked = setting.SaveSetting;
            this.UpdateCheckBox.Checked = setting.CheckUpdate;

            // ポストプロセス関連
            _postproc = setting.AdvancedMode ? this.PostProcessComboBox : this.PostProcessLiteComboBox;
            _postproc.SelectedIndex = Translator.PostProcessToIndex(setting.PostProcess);
            this.PostProcessPanel.Enabled = setting.AdvancedMode;
            this.PostProcessPanel.Visible = setting.AdvancedMode;
            this.PostProcessLabel.Visible = setting.AdvancedMode;
            this.PostProcessLiteComboBox.Enabled = !setting.AdvancedMode;
            this.PostProcessLiteComboBox.Visible = !setting.AdvancedMode;
            this.PostProcessLiteLabel.Visible = !setting.AdvancedMode;

            // 入力パスを選択可能にするかどうか
            this.InputPathLabel.Visible = setting.SelectInputFile;
            this.InputPathPanel.Visible = setting.SelectInputFile;
            this.InputPathPanel.Enabled = setting.SelectInputFile && setting.InputPath.Length == 0;

            // ログ出力
            _messages.Add(new Message(Message.Levels.Debug, "CubePDF.MainForm.LoadSetting"));
            _messages.Add(new Message(Message.Levels.Debug, setting.ToString()));
        }