123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173 |
- using PaintDotNet.Annotation.Enum;
- using PaintDotNet.Base;
- using PaintDotNet.Data.Param;
- using PaintDotNet.ImageLabel;
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Windows.Forms;
- namespace PaintDotNet.Menus
- {
- /// <summary>
- /// 图像标注菜单
- /// </summary>
- internal sealed class LabelActionMenu : PdnMenuItem
- {
- private PdnMenuItem menuChoiseAction;
- private PdnMenuItem menuSelectAllAction;
- private PdnMenuItem menuContinuousDrawingAction;
- private PdnMenuItem menuClearAllAction;
- private ToolStripSeparator menuHelpSeparator1;
- private PdnMenuItem menuAutoRulerAction;
- private PdnMenuItem menuPrestoredRulerAction;
- private PdnMenuItem menuHandRulerAction;
- private ToolStripSeparator menuHelpSeparator2;
- private PdnMenuItem menuTextAction;
- private PdnMenuItem menuMarkAction;
- private PdnMenuItem menuLineAction;
- private PdnMenuItem menuCurveLineAction;
- private PdnMenuItem menuArrowAction;
- private PdnMenuItem menuCircleAction;
- private PdnMenuItem menuPolygonAction;
- private ToolStripSeparator menuHelpSeparator3;
- private PdnMenuItem menuWaterMarkAction;
- private PdnMenuItem menuWordLineAction;
- private ToolStripSeparator menuHelpSeparator4;
- private PdnMenuItem menuMoveUpAction;
- private PdnMenuItem menuMoveDownAction;
- private PdnMenuItem menuMoveTopAction;
- private PdnMenuItem menuMoveBottomAction;
- private ToolStripSeparator menuHelpSeparator5;
- private PdnMenuItem menuLabelListAction;
- //标记子菜单
- private PdnMenuItem menuDateMark;
- private PdnMenuItem menuTimeMark;
- private PdnMenuItem menuPointMark;
- private PdnMenuItem menuNumberMark;
- private PdnMenuItem menuGainNumber;
- //直线子菜单
- private PdnMenuItem menuLineChildLine;
- private PdnMenuItem menuLineChildLineSegment;
- //曲线子菜单
- private PdnMenuItem menuCurvePencil;
- private PdnMenuItem menuCurvePolyline;
- private PdnMenuItem menuCurveCurve;
- private PdnMenuItem menuCurveClosedCurve;
- //箭头子菜单
- private PdnMenuItem menuOnewayArrow;
- private PdnMenuItem menuTwowayArrow;
- //圆子菜单
- private PdnMenuItem menuCircleOval;
- private PdnMenuItem menuCircleCircle;
- //多边形子菜单
- private PdnMenuItem menuPolygonRectangle;
- private PdnMenuItem menuPolygonPolygon;
- private PdnMenuItem menuRoundedRectangle;
- public LabelActionMenu(int menuId)
- {
- InitializeComponent();
- this.MenuId = menuId;
- this.AutomaticScript = false;
- }
- protected override void OnAppWorkspaceChanged()
- {
- base.OnAppWorkspaceChanged();
- }
- private void InitializeComponent()
- {
- this.menuChoiseAction = new PdnMenuItem(ActionType.LabelSelect);
- this.menuSelectAllAction = new PdnMenuItem(ActionType.SelectAllLabel);
- this.menuContinuousDrawingAction = new PdnMenuItem(ActionType.ContinuousDrawingLabel, true);
- this.menuClearAllAction = new PdnMenuItem(ActionType.ClearAllLabel);
- this.menuHelpSeparator1 = new ToolStripSeparator();
- this.menuAutoRulerAction = new PdnMenuItem(ActionType.AutoRuler);
- this.menuPrestoredRulerAction = new PdnMenuItem(ActionType.PrestoredRuler);
- this.menuHandRulerAction = new PdnMenuItem(ActionType.HandRuler);
- this.menuHelpSeparator2 = new ToolStripSeparator();
- this.menuTextAction = new PdnMenuItem(ActionType.TextLabel);
- this.menuMarkAction = new PdnMenuItem(ActionType.MarkAction);
- this.menuLineAction = new PdnMenuItem(ActionType.LineAction);
- this.menuCurveLineAction = new PdnMenuItem(ActionType.CurveLineAction);
- this.menuArrowAction = new PdnMenuItem(ActionType.ArrowAction);
- this.menuCircleAction = new PdnMenuItem(ActionType.CircleAction);
- this.menuPolygonAction = new PdnMenuItem(ActionType.PolygonAction);
- this.menuHelpSeparator3 = new ToolStripSeparator();
- this.menuWaterMarkAction = new PdnMenuItem(ActionType.WaterMarkAction);
- this.menuWordLineAction = new PdnMenuItem(ActionType.WordLineAction);
- this.menuHelpSeparator4 = new ToolStripSeparator();
- this.menuMoveUpAction = new PdnMenuItem(ActionType.MoveUpAction);
- this.menuMoveDownAction = new PdnMenuItem(ActionType.MoveDownAction);
- this.menuMoveTopAction = new PdnMenuItem(ActionType.MoveTopAction);
- this.menuMoveBottomAction = new PdnMenuItem(ActionType.MoveBottomAction);
- this.menuHelpSeparator5 = new ToolStripSeparator();
- this.menuLabelListAction = new PdnMenuItem(ActionType.LabelListAction);
- this.menuDateMark = new PdnMenuItem(ActionType.DateMark);
- this.menuTimeMark = new PdnMenuItem(ActionType.TimeMark);
- this.menuPointMark = new PdnMenuItem(ActionType.PointMark);
- this.menuNumberMark = new PdnMenuItem(ActionType.NumberMark);
- this.menuGainNumber = new PdnMenuItem(ActionType.GainNumber);
- this.menuLineChildLine = new PdnMenuItem(ActionType.LineChildLine);
- this.menuLineChildLineSegment = new PdnMenuItem(ActionType.LineChildLineSegment);
- this.menuCurvePencil = new PdnMenuItem(ActionType.CurvePencil);
- this.menuCurvePolyline = new PdnMenuItem(ActionType.CurvePolyline);
- this.menuCurveCurve = new PdnMenuItem(ActionType.CurveCurve);
- this.menuCurveClosedCurve = new PdnMenuItem(ActionType.CurveClosedCurve);
- this.menuOnewayArrow = new PdnMenuItem(ActionType.OnewayArrow);
- this.menuTwowayArrow = new PdnMenuItem(ActionType.TwowayArrow);
- this.menuCircleOval = new PdnMenuItem(ActionType.CircleOval);
- this.menuCircleCircle = new PdnMenuItem(ActionType.CircleCircle);
- this.menuPolygonRectangle = new PdnMenuItem(ActionType.PolygonRectangle);
- this.menuPolygonPolygon = new PdnMenuItem(ActionType.PolygonPolygon);
- this.menuRoundedRectangle = new PdnMenuItem(ActionType.RoundedRectangle);
- //
- // 添加到主菜单
- //
- this.DropDownItems.AddRange(new ToolStripItem[] {
- this.menuChoiseAction,
- this.menuSelectAllAction,
- this.menuContinuousDrawingAction,
- this.menuClearAllAction,
- this.menuHelpSeparator1,
- this.menuAutoRulerAction,
- this.menuPrestoredRulerAction,
- this.menuHandRulerAction,
- this.menuHelpSeparator2,
- this.menuTextAction,
- this.menuMarkAction,
- this.menuLineAction,
- this.menuCurveLineAction,
- this.menuArrowAction,
- this.menuCircleAction,
- this.menuPolygonAction,
- this.menuHelpSeparator3,
- this.menuWaterMarkAction,
- this.menuWordLineAction,
- this.menuHelpSeparator4,
- this.menuMoveUpAction,
- this.menuMoveDownAction,
- this.menuMoveTopAction,
- this.menuMoveBottomAction,
- this.menuHelpSeparator5,
- this.menuLabelListAction
- });
- //
- // 主菜单
- //
- this.Name = "Menu.LabelAction";
- this.Text = PdnResources.GetString("Menu.LabelAction.Text");
- //
- // 选择
- //
- this.menuChoiseAction.NeedWaitKey = true;
- this.menuChoiseAction.Click += new EventHandler(MenuChoiseAction_Click);
- //
- // 全选
- //
- this.menuSelectAllAction.NeedWaitKey = true;
- this.menuSelectAllAction.Click += new EventHandler(MenuSelectAllAction_Click);
- //
- // 连续绘制
- //
- this.menuContinuousDrawingAction.NeedWaitKey = true;
- this.menuContinuousDrawingAction.Click += new EventHandler(MenuContinuousDrawingAction_Click);
- //
- // 清空元素
- //
- this.menuClearAllAction.Click += new EventHandler(MenuClearAllAction_Click);
- //
- // 自动标尺
- //
- this.menuAutoRulerAction.NeedWaitKey = true;
- this.menuAutoRulerAction.Click += new EventHandler(MenuAutoRuler_Click);
- //
- // 预存标尺
- //
- this.menuPrestoredRulerAction.Click += new EventHandler(MenuPrestoredRuler_Click);
- //
- // 手动标尺
- //
- this.menuHandRulerAction.NeedWaitKey = true;
- this.menuHandRulerAction.Click += new EventHandler(MenuHandRuler_Click);
- //
- // 文本
- //
- this.menuTextAction.NeedWaitKey = true;
- this.menuTextAction.Click += new EventHandler(MenuTextAction_Click);
- //
- // 标记
- //
- this.menuMarkAction.DropDownItems.AddRange(
- new ToolStripItem[]
- {
- this.menuDateMark,
- this.menuTimeMark,
- this.menuPointMark,
- this.menuNumberMark,
- this.menuGainNumber
- });
- //
- // 直线
- //
- this.menuLineAction.DropDownItems.AddRange(
- new ToolStripItem[]
- {
- this.menuLineChildLine,
- this.menuLineChildLineSegment
- });
- //
- // 曲线
- //
- this.menuCurveLineAction.DropDownItems.AddRange(
- new ToolStripItem[]
- {
- this.menuCurvePencil,
- this.menuCurvePolyline,
- this.menuCurveCurve,
- this.menuCurveClosedCurve
- });
- //
- // 箭头
- //
- this.menuArrowAction.DropDownItems.AddRange(
- new ToolStripItem[]
- {
- this.menuOnewayArrow,
- this.menuTwowayArrow
- });
- //
- // 圆
- //
- this.menuCircleAction.DropDownItems.AddRange(
- new ToolStripItem[]
- {
- this.menuCircleOval,
- this.menuCircleCircle
- });
- //
- // 多边形
- //
- this.menuPolygonAction.DropDownItems.AddRange(
- new ToolStripItem[]
- {
- this.menuPolygonRectangle,
- this.menuPolygonPolygon,
- this.menuRoundedRectangle
- });
- //
- // 水印
- //
- this.menuWaterMarkAction.NeedWaitKey = true;
- this.menuWaterMarkAction.Click += new EventHandler(MenuWaterMarkAction_Click);
- //
- // 工字线
- //
- this.menuWordLineAction.NeedWaitKey = true;
- this.menuWordLineAction.Click += new EventHandler(MenuWorkTypeAction_Click);
- //
- // 向上移动
- //
- this.menuMoveUpAction.NeedWaitKey = true;
- this.menuMoveUpAction.Click += new EventHandler(MenuMoveUpAction_Click);
- //
- // 向下移动
- //
- this.menuMoveDownAction.NeedWaitKey = true;
- this.menuMoveDownAction.Click += new EventHandler(MenuMoveDownAction_Click);
- //
- // 移动到最上
- //
- this.menuMoveTopAction.NeedWaitKey = true;
- this.menuMoveTopAction.Click += new EventHandler(MenuMoveTopAction_Click);
- //
- // 移动到最下
- //
- this.menuMoveBottomAction.NeedWaitKey = true;
- this.menuMoveBottomAction.Click += new EventHandler(MenuMoveBottomAction_Click);
- //
- // 标注信息列表
- //
- this.menuLabelListAction.NeedWaitKey = true;
- this.menuLabelListAction.Click += new EventHandler(MenuLabelListAction_Click);
- //
- // 以下是子菜单
- //
- //
- // 标记->日期
- //
- this.menuDateMark.Text = PdnResources.GetString("Menu.LabelAction.DrawDateMark.Text");
- this.menuDateMark.NeedWaitKey = true;
- this.menuDateMark.Click += new EventHandler(MenuDateMark_Click);
- this.menuDateMark.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawDateMarkIcon.png").Reference;
- //
- // 标记->时间
- //
- this.menuTimeMark.Text = PdnResources.GetString("Menu.LabelAction.DrawTimeMark.Text");
- this.menuTimeMark.NeedWaitKey = true;
- this.menuTimeMark.Click += new EventHandler(MenuTimeMark_Click);
- this.menuTimeMark.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawTimeMarkIcon.png").Reference;
- //
- // 标记->点标记
- //
- this.menuPointMark.Text = PdnResources.GetString("Menu.LabelAction.DrawPointMark.Text");
- this.menuPointMark.NeedWaitKey = true;
- this.menuPointMark.Click += new EventHandler(MenuPointMark_Click);
- this.menuPointMark.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawPointMarkIcon.png").Reference;
- //
- // 标记->数字标记
- //
- this.menuNumberMark.Text = PdnResources.GetString("Menu.LabelAction.DrawNumberMark.Text");
- this.menuNumberMark.NeedWaitKey = true;
- this.menuNumberMark.Click += new EventHandler(MenuNumberMark_Click);
- this.menuNumberMark.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawNumberMarkIcon.png").Reference;
- //
- // 放大倍数
- //
- this.menuGainNumber.Text = PdnResources.GetString("Menu.LabelAction.DrawGainNumber.Text");
- this.menuGainNumber.NeedWaitKey = true;
- this.menuGainNumber.Click += new EventHandler(MenuGainNumber_Click);
- this.menuGainNumber.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawGainNumberIcon.png").Reference;
- //
- // 直线->直线
- //
- this.menuLineChildLine.Text = PdnResources.GetString("Menu.LabelAction.DrawLine.Text");
- this.menuLineChildLine.NeedWaitKey = true;
- this.menuLineChildLine.Click += new EventHandler(MenuLineChildLine_Click);
- this.menuLineChildLine.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawLineIcon.png").Reference;
- //
- // 直线->线段
- //
- this.menuLineChildLineSegment.Text = PdnResources.GetString("Menu.LabelAction.DrawLineSegment.Text");
- this.menuLineChildLineSegment.NeedWaitKey = true;
- this.menuLineChildLineSegment.Click += new EventHandler(MenuLineChildLineSegment_Click);
- this.menuLineChildLineSegment.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawLineSegmentIcon.png").Reference;
- //
- // 曲线->铅笔
- //
- this.menuCurvePencil.Text = PdnResources.GetString("Menu.LabelAction.DrawPencil.Text");
- this.menuCurvePencil.NeedWaitKey = true;
- this.menuCurvePencil.Click += new EventHandler(MenuCurvePencil_Click);
- this.menuCurvePencil.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawPencilIcon.png").Reference;
- //
- // 曲线->折线
- //
- this.menuCurvePolyline.Text = PdnResources.GetString("Menu.LabelAction.DrawPolygonLine.Text");
- this.menuCurvePolyline.NeedWaitKey = true;
- this.menuCurvePolyline.Click += new EventHandler(MenuCurvePolyline_Click);
- this.menuCurvePolyline.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawPolygonLineIcon.png").Reference;
- //
- // 曲线->曲线
- //
- this.menuCurveCurve.Text = PdnResources.GetString("Menu.LabelAction.DrawCurve.Text");
- this.menuCurveCurve.NeedWaitKey = true;
- this.menuCurveCurve.Click += new EventHandler(MenuCurveCurve_Click);
- this.menuCurveCurve.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawCurveIcon.png").Reference;
- //
- // 曲线->闭合曲线
- //
- this.menuCurveClosedCurve.Text = PdnResources.GetString("Menu.LabelAction.DrawClosedCurve.Text");
- this.menuCurveClosedCurve.NeedWaitKey = true;
- this.menuCurveClosedCurve.Click += new EventHandler(MenuCurveClosedCurve_Click);
- this.menuCurveClosedCurve.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawClosedCurveIcon.png").Reference;
- //
- // 箭头->单向箭头
- //
- this.menuOnewayArrow.Text = PdnResources.GetString("Menu.LabelAction.DrawOneArrowLine.Text");
- this.menuOnewayArrow.NeedWaitKey = true;
- this.menuOnewayArrow.Click += new EventHandler(MenuOnewayArrow_Click);
- this.menuOnewayArrow.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawOneArrowLineIcon.png").Reference;
- //
- // 箭头->双向箭头
- //
- this.menuTwowayArrow.Text = PdnResources.GetString("Menu.LabelAction.DrawTwoArrowLine.Text");
- this.menuTwowayArrow.NeedWaitKey = true;
- this.menuTwowayArrow.Click += new EventHandler(MenuTwowayArrow_Click);
- this.menuTwowayArrow.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawTwoArrowLineIcon.png").Reference;
- //
- // 圆->椭圆
- //
- this.menuCircleOval.Text = PdnResources.GetString("Menu.LabelAction.DrawEllipse.Text");
- this.menuCircleOval.NeedWaitKey = true;
- this.menuCircleOval.Click += new EventHandler(MenuCircleOval_Click);
- this.menuCircleOval.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawEllipseIcon.png").Reference;
- //
- // 圆->圆
- //
- this.menuCircleCircle.Text = PdnResources.GetString("Menu.LabelAction.DrawCircle.Text");
- this.menuCircleCircle.NeedWaitKey = true;
- this.menuCircleCircle.Click += new EventHandler(MenuCircleCircle_Click);
- this.menuCircleCircle.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawCircleIcon.png").Reference;
- //
- // 多边形->矩形
- //
- this.menuPolygonRectangle.Text = PdnResources.GetString("Menu.LabelAction.DrawRectangle.Text");
- this.menuPolygonRectangle.NeedWaitKey = true;
- this.menuPolygonRectangle.Click += new EventHandler(MenuPolygonRectangle_Click);
- this.menuPolygonRectangle.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawRectangleIcon.png").Reference;
- //
- // 多边形->多边形
- //
- this.menuPolygonPolygon.Text = PdnResources.GetString("Menu.LabelAction.DrawPolygon.Text");
- this.menuPolygonPolygon.NeedWaitKey = true;
- this.menuPolygonPolygon.Click += new EventHandler(MenuPolygonPolygon_Click);
- this.menuPolygonPolygon.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawPolygonIcon.png").Reference;
- //
- // 多边形->圆角矩形
- //
- this.menuRoundedRectangle.Text = PdnResources.GetString("Menu.LabelAction.DrawRoundRectangle.Text");
- this.menuRoundedRectangle.NeedWaitKey = true;
- this.menuRoundedRectangle.Click += new EventHandler(MenuRoundedRectangle_Click);
- this.menuRoundedRectangle.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawRoundRectangleIcon.png").Reference;
- //
- // 加载菜单的文字和icon
- //
- this.LoadNames(this.Name);
- this.LoadIcons();
- }
- protected override void OnDropDownOpening(EventArgs e)
- {
- //if (AppWorkspace.ActiveDocumentWorkspace != null/* && !AppWorkspace.ScriptRunning*/)
- //{
- // this.menuLineAction.Enabled = true;
- //}
- //else
- //{
- // this.menuLineAction.Enabled = false;
- //}
- this.menuLabelListAction.Checked = AppWorkspace.Widgets.LabelListDialog.Visible;
- this.menuContinuousDrawingAction.Checked = AppWorkspace.ActiveDocumentWorkspace != null ? AppWorkspace.ActiveDocumentWorkspace.ContinuousDrawingLabel : false;
- //this.RecursiveData(this.DropDownItems);
- base.OnDropDownOpening(e);
- }
- /// <summary>
- /// 选择
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuChoiseAction_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.Pointer;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.Pointer);
- }
- /// <summary>
- /// 全选
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuSelectAllAction_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.GraphicsList.SelectAll();
- AppWorkspace.ActiveDocumentWorkspace.Refresh();
- }
- if (AppWorkspace.cameraPreviewDialog != null && !AppWorkspace.cameraPreviewDialog.IsDisposed)
- {
- AppWorkspace.cameraPreviewDialog.documentWorkspace.GraphicsList.SelectAll();
- AppWorkspace.cameraPreviewDialog.documentWorkspace.Refresh();
- }
- }
- /// <summary>
- /// 连续绘制
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuContinuousDrawingAction_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ContinuousDrawingLabel = !AppWorkspace.ActiveDocumentWorkspace.ContinuousDrawingLabel;
- AppWorkspace.continuousDrawingLabel = AppWorkspace.ActiveDocumentWorkspace.ContinuousDrawingLabel;
- for (int i = 0; i < AppWorkspace.DocumentWorkspaces.Length; i++)
- {
- AppWorkspace.DocumentWorkspaces[i].ContinuousDrawingLabel = AppWorkspace.ActiveDocumentWorkspace.ContinuousDrawingLabel;
- }
- this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.ContinuousDrawingLabel, "ContinuousDrawingLabel");
- this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.ContinuousDrawingLabel, "ContinuousDrawingLabel");
- if (!AppWorkspace.ActiveDocumentWorkspace.ContinuousDrawingLabel
- && AppWorkspace.ActiveDocumentWorkspace.activeTool >= DrawToolType.DrawRectangle && AppWorkspace.ActiveDocumentWorkspace.activeTool <= DrawToolType.DrawPrestoredRuler)
- {
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.Pointer;
- }
- this.menuContinuousDrawingAction.Checked = AppWorkspace.ActiveDocumentWorkspace.ContinuousDrawingLabel;
- }
- if (AppWorkspace.cameraPreviewDialog != null && !AppWorkspace.cameraPreviewDialog.IsDisposed)
- {
- AppWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingLabel = !AppWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingLabel;
- if(AppWorkspace.ActiveDocumentWorkspace!=null) AppWorkspace.continuousDrawingLabel = AppWorkspace.ActiveDocumentWorkspace.ContinuousDrawingLabel;
- for (int i = 0; i < AppWorkspace.DocumentWorkspaces.Length; i++)
- {
- AppWorkspace.DocumentWorkspaces[i].ContinuousDrawingLabel = AppWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingLabel;
- }
- this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingLabel, "ContinuousDrawingLabel");
- this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingLabel, "ContinuousDrawingLabel");
- if (!AppWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingLabel)
- {
- AppWorkspace.cameraPreviewDialog.documentWorkspace.ActiveTool = DrawToolType.Pointer;
- }
-
- if(AppWorkspace.ActiveDocumentWorkspace!=null
- && AppWorkspace.ActiveDocumentWorkspace.activeTool >= DrawToolType.DrawRectangle
- && AppWorkspace.ActiveDocumentWorkspace.activeTool <= DrawToolType.DrawPrestoredRuler)
- {
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
-
- }
- this.menuContinuousDrawingAction.Checked = AppWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingLabel;
- }
- }
- /// <summary>
- /// 清空元素
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuClearAllAction_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.GraphicsList.Clear();
- AppWorkspace.ActiveDocumentWorkspace.Refresh();
- }
- if (AppWorkspace.cameraPreviewDialog != null && !AppWorkspace.cameraPreviewDialog.IsDisposed)
- {
- AppWorkspace.cameraPreviewDialog.documentWorkspace.GraphicsList.Clear();
- AppWorkspace.cameraPreviewDialog.documentWorkspace.Refresh();
- }
- }
-
- /// <summary>
- /// 自动标尺
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuAutoRuler_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawAutoRuler;
- if (AppWorkspace.Widgets.LabelListDialog != null)
- {
- AppWorkspace.Widgets.LabelListDialog.RefreshDateGridView(null, null);
- }
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawAutoRuler);
- }
- /// <summary>
- /// 手动标尺
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuHandRuler_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawHandModeRuler;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawHandModeRuler);
- }
- /// <summary>
- /// 预存标尺
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuPrestoredRuler_Click(object sender, EventArgs e)
- {
- using (PresetRulerDialog presetRulerDialog = new PresetRulerDialog(this.AppWorkspace))
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- presetRulerDialog.StartPosition = FormStartPosition.CenterScreen;
- presetRulerDialog.ShowDialog();
- }
- }
- /// <summary>
- /// 标记->文本
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuTextAction_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawTextString;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawTextString);
- }
- /// <summary>
- /// 标记->日期
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuDateMark_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawDateMark;
- if (AppWorkspace.Widgets.LabelListDialog != null)
- {
- AppWorkspace.Widgets.LabelListDialog.RefreshDateGridView(null, null);
- }
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawDateMark);
- }
- /// <summary>
- /// 标记->时间
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuTimeMark_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawTimeMark;
- if (AppWorkspace.Widgets.LabelListDialog != null)
- {
- AppWorkspace.Widgets.LabelListDialog.RefreshDateGridView(null, null);
- }
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawTimeMark);
- }
- /// <summary>
- /// 标记->点标记
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuPointMark_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawPointMark;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawPointMark);
- }
- /// <summary>
- /// 标记->数字标记
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuNumberMark_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawNumberMark;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawNumberMark);
- }
-
- /// <summary>
- /// 标记->放大倍数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuGainNumber_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawGainNumber;
- if (AppWorkspace.Widgets.LabelListDialog != null)
- {
- AppWorkspace.Widgets.LabelListDialog.RefreshDateGridView(null, null);
- }
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawGainNumber);
- }
- /// <summary>
- /// 直线->直线
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuLineChildLine_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawLine;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawLine);
- }
- /// <summary>
- /// 直线->线段
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuLineChildLineSegment_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawLineSegment;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawLineSegment);
- }
- /// <summary>
- /// 曲线->铅笔
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuCurvePencil_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawPencil;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawPencil);
- }
- /// <summary>
- /// 曲线->折线
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuCurvePolyline_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawPolygonLine;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawPolygonLine);
- }
- /// <summary>
- /// 曲线->曲线
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuCurveCurve_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawCurve;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawCurve);
- }
- /// <summary>
- /// 曲线->闭合曲线
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuCurveClosedCurve_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawClosedCurve;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawClosedCurve);
- }
- /// <summary>
- /// 箭头->单向箭头
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuOnewayArrow_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawOneArrowLine;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawOneArrowLine);
- }
- /// <summary>
- /// 箭头->双向箭头
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuTwowayArrow_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawTwoArrowLine;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawTwoArrowLine);
- }
- /// <summary>
- /// 圆->椭圆
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuCircleOval_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawEllipse;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawEllipse);
- }
- /// <summary>
- /// 圆->圆
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuCircleCircle_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawCircle;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawCircle);
- }
- /// <summary>
- /// 多边形->矩形
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuPolygonRectangle_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawRectangle;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawRectangle);
- }
- /// <summary>
- /// 多边形->多边形
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuPolygonPolygon_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawPolygon;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawPolygon);
- }
- /// <summary>
- /// 多边形->圆角矩形
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuRoundedRectangle_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawRoundRectangle;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawRoundRectangle);
- }
- /// <summary>
- /// 水印
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuWaterMarkAction_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawWaterMark;
- if (AppWorkspace.Widgets.LabelListDialog != null)
- {
- AppWorkspace.Widgets.LabelListDialog.RefreshDateGridView(null, null);
- }
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawWaterMark);
- }
- /// <summary>
- /// 工字线
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuWorkTypeAction_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawWorkType;
- }
- this.SetCameraPreviewActiveTool(DrawToolType.DrawWorkType);
- }
- /// <summary>
- /// 向上移动
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuMoveUpAction_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.GraphicsList.MoveSelectionToMoveUp();
- AppWorkspace.ActiveDocumentWorkspace.Refresh();
- if (AppWorkspace.Widgets.LabelListDialog != null)
- {
- AppWorkspace.Widgets.LabelListDialog.RefreshDateGridView(null, null);
- }
- }
- }
- /// <summary>
- /// 向下移动
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuMoveDownAction_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.GraphicsList.MoveSelectionToMoveDown();
- AppWorkspace.ActiveDocumentWorkspace.Refresh();
- if (AppWorkspace.Widgets.LabelListDialog != null)
- {
- AppWorkspace.Widgets.LabelListDialog.RefreshDateGridView(null, null);
- }
- }
- }
- /// <summary>
- /// 移动到最上
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuMoveTopAction_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.GraphicsList.MoveSelectionToFront();
- AppWorkspace.ActiveDocumentWorkspace.Refresh();
- if (AppWorkspace.Widgets.LabelListDialog != null)
- {
- AppWorkspace.Widgets.LabelListDialog.RefreshDateGridView(null, null);
- }
- }
- }
- /// <summary>
- /// 移动到最下
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuMoveBottomAction_Click(object sender, EventArgs e)
- {
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- AppWorkspace.ActiveDocumentWorkspace.GraphicsList.MoveSelectionToBack();
- AppWorkspace.ActiveDocumentWorkspace.Refresh();
- if (AppWorkspace.Widgets.LabelListDialog != null)
- {
- AppWorkspace.Widgets.LabelListDialog.RefreshDateGridView(null, null);
- }
- }
- }
- /// <summary>
- /// 标注列表
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MenuLabelListAction_Click(object sender, EventArgs e)
- {
- AppWorkspace.Widgets.LabelListDialog.Visible = !AppWorkspace.Widgets.LabelListDialog.Visible;
- if (AppWorkspace.ActiveDocumentWorkspace != null)
- {
- if (AppWorkspace.startScriptRecording)
- {
- AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
- }
- this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.Widgets.LabelListDialog.Visible, "LabelListAction");
- this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.Widgets.LabelListDialog.Visible, "LabelListAction");
- this.menuLabelListAction.Checked = AppWorkspace.Widgets.LabelListDialog.Visible;
- AppWorkspace.Widgets.LabelListDialog.getData();
- AppWorkspace.ActiveDocumentWorkspace.Focus();
- }
- }
- private void SetCameraPreviewActiveTool(DrawToolType drawToolType)
- {
- if (AppWorkspace.cameraPreviewDialog != null && !AppWorkspace.cameraPreviewDialog.IsDisposed)
- {
- AppWorkspace.cameraPreviewDialog.documentWorkspace.ActiveTool = drawToolType;
- }
- }
- 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;
- }
- }
- }
- }
|