123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346 |
- using Metis.Setting;
- using PaintDotNet.Base;
- using PaintDotNet.Data.Param;
- using PaintDotNet.Setting;
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Windows.Forms;
- namespace PaintDotNet.Menus
- {
- /// <summary>
- /// 设置菜单
- /// </summary>
- internal sealed class SettingMenu : PdnMenuItem
- {
- private PdnMenuItem menuGeneralSetting;
- private PdnMenuItem menuGridSetting;
- private PdnMenuItem menuWatermarkSetting;
- private PdnMenuItem menuWorkTypeSetting;
- private PdnMenuItem menuRuleSetting;
- private PdnMenuItem menuLabelSetting;
- private PdnMenuItem menuMeasureSetting;
- private PdnMenuItem menuWorkFlowSetting;
- private ToolStripSeparator menuToolsSeperator1;
- private PdnMenuItem menuFocusSetting;
- private ToolStripSeparator menuToolsSeperator2;
- private PdnMenuItem menuModuleSetting;
- private PdnMenuItem menuImportExportSetting;
- private ToolStripSeparator menuToolsSeperator3;
- public SettingMenu(int menuId)
- {
- InitializeComponent();
- this.MenuId = menuId;
- //在脚本中不显示
- this.CanUseInScript = false;
- this.AutomaticScript = false;
- }
- protected override void OnAppWorkspaceChanged()
- {
- base.OnAppWorkspaceChanged();
- }
- private void InitializeComponent()
- {
- this.menuGeneralSetting = new PdnMenuItem(ActionType.GeneralSetting);
- this.menuGridSetting = new PdnMenuItem(ActionType.GridSetting);
- this.menuWatermarkSetting = new PdnMenuItem(ActionType.WatermarkSetting);
- this.menuWorkTypeSetting = new PdnMenuItem(ActionType.WorkTypeSetting);
- this.menuRuleSetting = new PdnMenuItem(ActionType.RuleSetting);
- this.menuLabelSetting = new PdnMenuItem(ActionType.LabelSetting);
- this.menuMeasureSetting = new PdnMenuItem(ActionType.MeasureSetting);
- this.menuWorkFlowSetting = new PdnMenuItem(ActionType.WorkFlowSetting);
- this.menuToolsSeperator1 = new ToolStripSeparator();
- this.menuFocusSetting = new PdnMenuItem(ActionType.FocusSetting);
- this.menuToolsSeperator2 = new ToolStripSeparator();
- this.menuModuleSetting = new PdnMenuItem(ActionType.ModuleSetting);
- this.menuImportExportSetting = new PdnMenuItem(ActionType.ImportExportSetting);
- this.menuToolsSeperator3 = new ToolStripSeparator();
- //
- // 主菜单
- //
- this.DropDownItems.AddRange(new ToolStripItem[] {
- this.menuGeneralSetting,
- this.menuGridSetting,
- this.menuWatermarkSetting,
- this.menuWorkTypeSetting,
- this.menuRuleSetting,
- this.menuLabelSetting,
- this.menuMeasureSetting,
- this.menuWorkFlowSetting,
- this.menuToolsSeperator1,
- this.menuFocusSetting,
- this.menuToolsSeperator2,
- this.menuModuleSetting,
- this.menuToolsSeperator3,
- this.menuImportExportSetting
- });
- this.Name = "Menu.Setting";
- this.Text = PdnResources.GetString("Menu.Setting.Text");
- //
- // 常规设置
- //
- this.menuGeneralSetting.Click += new EventHandler(MenuGeneralSetting_Click);
- //
- // 网格设置
- //
- this.menuGridSetting.Click += new EventHandler(MenuGridSetting_Click);
- //
- // 水印设置
- //
- this.menuWatermarkSetting.Click += new EventHandler(WatermarkSettingsDialog_Click);
- //
- // 工型设置
- //
- this.menuWorkTypeSetting.Click += new EventHandler(MenuWorkTypeSetting_Click);
- //
- // 标尺设置
- //
- this.menuRuleSetting.Click += new EventHandler(MenuRulerSetting_Click); ;
- //
- // 标注设置
- //
- this.menuLabelSetting.Click += new EventHandler(MenuLabelSetting_Click);
- //
- // 测量设置
- //
- this.menuMeasureSetting.Click += new EventHandler(MenuMeasureSetting_Click);
- //
- // 工作流程
- //
- this.menuWorkFlowSetting.Click += new EventHandler(MenuWorkFlowSetting_Click);
- //
- // 聚焦参数
- //
- this.menuFocusSetting.Click += new EventHandler(menuFocusSetting_Click);
- //
- // 模块管理
- //
- this.menuModuleSetting.Click += new EventHandler(MenuModuleSetting_Click);
- //
- // 导入导出管理
- //
- this.menuImportExportSetting.Click += new EventHandler(MenuImportExportSetting_Click);
- this.menuImportExportSetting.Text = PdnResources.GetString("ImportAndExportSet");
- //
- // 加载菜单的文字和icon
- //
- this.LoadNames(this.Name);
- this.LoadIcons();
- }
- /// <summary>
- /// 常规设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuGeneralSetting_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- using (GeneralSettingDialog af = new GeneralSettingDialog(AppWorkspace))
- {
- af.StartPosition = FormStartPosition.CenterScreen;
- af.ShowDialog(AppWorkspace);
- }
- }
- /// <summary>
- /// 网格设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuGridSetting_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- //using (GridSettingDialog af = new GridSettingDialog(AppWorkspace))
- //{
- // af.StartPosition = FormStartPosition.CenterScreen;
- // af.ShowDialog(AppWorkspace);
- //}
- using (GridSettingForm af = new GridSettingForm(AppWorkspace))
- {
- af.StartPosition = FormStartPosition.CenterScreen;
- af.ShowDialog(AppWorkspace);
- }
- }
- /// <summary>
- /// 聚焦参数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void menuFocusSetting_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- using (FocusingParameter fp = new FocusingParameter())
- {
- fp.StartPosition = FormStartPosition.CenterScreen;
- fp.ShowDialog(AppWorkspace);
- }
- }
- private void MenuModuleSetting_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- using (ModuleManageDialog af = new ModuleManageDialog(AppWorkspace))
- {
- af.StartPosition = FormStartPosition.CenterScreen;
- af.ShowDialog(AppWorkspace);
- }
- }
- /// <summary>
- /// 标尺设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuRulerSetting_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- using (RulerSettingDialog af = new RulerSettingDialog(AppWorkspace))
- {
- af.StartPosition = FormStartPosition.CenterScreen;
- af.ShowDialog(AppWorkspace);
- }
- }
- /// <summary>
- /// 测量设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuMeasureSetting_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- using (MeasureSettingDialog af = new MeasureSettingDialog(AppWorkspace))
- {
- af.StartPosition = FormStartPosition.CenterScreen;
- af.ShowDialog(AppWorkspace);
- }
- }
- /// <summary>
- /// 标注设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuLabelSetting_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- using (LabelSettingDialog af = new LabelSettingDialog(AppWorkspace))
- {
- af.StartPosition = FormStartPosition.CenterScreen;
- af.ShowDialog();
- }
- }
- /// <summary>
- /// 工作流程
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuWorkFlowSetting_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- using (WorkFlowSettingDialog af = new WorkFlowSettingDialog(AppWorkspace))
- {
- af.StartPosition = FormStartPosition.CenterScreen;
- af.ShowDialog();
- }
- }
- private string GetCultureInfoName(CultureInfo ci)
- {
- CultureInfo en_US = new CultureInfo("en-US");
- if (ci.Equals(en_US))
- {
- return GetCultureInfoName(ci.Parent);
- }
- else
- {
- return ci.NativeName;
- }
- }
- /// <summary>
- /// 工型设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuWorkTypeSetting_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- using (WorkTypeSettingDialog af = new WorkTypeSettingDialog())
- {
- af.StartPosition = FormStartPosition.CenterScreen;
- af.ShowDialog(AppWorkspace);
- }
- }
- /// <summary>
- /// 水印设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void WatermarkSettingsDialog_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- using (WatermarkSettingsDialog af = new WatermarkSettingsDialog())
- {
- af.StartPosition = FormStartPosition.CenterScreen;
- af.ShowDialog(AppWorkspace);
- }
- }
- /// <summary>
- /// 导入导出设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuImportExportSetting_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- using (ImportExportSettingDialog af = new ImportExportSettingDialog())
- {
- af.StartPosition = FormStartPosition.CenterScreen;
- af.ShowDialog(AppWorkspace);
- }
- }
- }
- }
|