LabelActionMenu.cs 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159
  1. using PaintDotNet.Annotation.Enum;
  2. using PaintDotNet.Annotation.Label;
  3. using PaintDotNet.Base;
  4. using PaintDotNet.Data.Param;
  5. using PaintDotNet.ImageLabel;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Globalization;
  9. using System.Reflection;
  10. using System.Windows.Forms;
  11. namespace PaintDotNet.Menus
  12. {
  13. /// <summary>
  14. /// 图像标注菜单
  15. /// </summary>
  16. internal sealed class LabelActionMenu : PdnMenuItem
  17. {
  18. private PdnMenuItem menuChoiseAction;
  19. private PdnMenuItem menuSelectAllAction;
  20. private PdnMenuItem menuContinuousDrawingAction;
  21. private PdnMenuItem menuClearAllAction;
  22. private ToolStripSeparator menuHelpSeparator1;
  23. private PdnMenuItem menuAutoRulerAction;
  24. private PdnMenuItem menuPrestoredRulerAction;
  25. private PdnMenuItem menuHandRulerAction;
  26. private ToolStripSeparator menuHelpSeparator2;
  27. private PdnMenuItem menuTextAction;
  28. private PdnMenuItem menuMarkAction;
  29. private PdnMenuItem menuLineAction;
  30. private PdnMenuItem menuCurveLineAction;
  31. private PdnMenuItem menuArrowAction;
  32. private PdnMenuItem menuCircleAction;
  33. private PdnMenuItem menuPolygonAction;
  34. private ToolStripSeparator menuHelpSeparator3;
  35. private PdnMenuItem menuWaterMarkAction;
  36. private PdnMenuItem menuWordLineAction;
  37. private ToolStripSeparator menuHelpSeparator4;
  38. private PdnMenuItem menuMoveUpAction;
  39. private PdnMenuItem menuMoveDownAction;
  40. private PdnMenuItem menuMoveTopAction;
  41. private PdnMenuItem menuMoveBottomAction;
  42. private ToolStripSeparator menuHelpSeparator5;
  43. private PdnMenuItem menuLabelListAction;
  44. //标记子菜单
  45. private PdnMenuItem menuDateMark;
  46. private PdnMenuItem menuTimeMark;
  47. private PdnMenuItem menuPointMark;
  48. private PdnMenuItem menuNumberMark;
  49. private PdnMenuItem menuGainNumber;
  50. //直线子菜单
  51. private PdnMenuItem menuLineChildLine;
  52. private PdnMenuItem menuLineChildLineSegment;
  53. //曲线子菜单
  54. private PdnMenuItem menuCurvePencil;
  55. private PdnMenuItem menuCurvePolyline;
  56. private PdnMenuItem menuCurveCurve;
  57. private PdnMenuItem menuCurveClosedCurve;
  58. //箭头子菜单
  59. private PdnMenuItem menuOnewayArrow;
  60. private PdnMenuItem menuTwowayArrow;
  61. //圆子菜单
  62. private PdnMenuItem menuCircleOval;
  63. private PdnMenuItem menuCircleCircle;
  64. //多边形子菜单
  65. private PdnMenuItem menuPolygonRectangle;
  66. private PdnMenuItem menuPolygonPolygon;
  67. private PdnMenuItem menuRoundedRectangle;
  68. public LabelActionMenu(int menuId)
  69. {
  70. InitializeComponent();
  71. this.MenuId = menuId;
  72. this.AutomaticScript = false;
  73. }
  74. protected override void OnAppWorkspaceChanged()
  75. {
  76. base.OnAppWorkspaceChanged();
  77. }
  78. private void InitializeComponent()
  79. {
  80. this.menuChoiseAction = new PdnMenuItem(ActionType.LabelSelect);
  81. this.menuSelectAllAction = new PdnMenuItem(ActionType.SelectAllLabel);
  82. this.menuContinuousDrawingAction = new PdnMenuItem(ActionType.ContinuousDrawingLabel, true);
  83. this.menuClearAllAction = new PdnMenuItem(ActionType.ClearAllLabel);
  84. this.menuHelpSeparator1 = new ToolStripSeparator();
  85. this.menuAutoRulerAction = new PdnMenuItem(ActionType.AutoRuler);
  86. this.menuPrestoredRulerAction = new PdnMenuItem(ActionType.PrestoredRuler);
  87. this.menuHandRulerAction = new PdnMenuItem(ActionType.HandRuler);
  88. this.menuHelpSeparator2 = new ToolStripSeparator();
  89. this.menuTextAction = new PdnMenuItem(ActionType.TextLabel);
  90. this.menuMarkAction = new PdnMenuItem(ActionType.MarkAction);
  91. this.menuLineAction = new PdnMenuItem(ActionType.LineAction);
  92. this.menuCurveLineAction = new PdnMenuItem(ActionType.CurveLineAction);
  93. this.menuArrowAction = new PdnMenuItem(ActionType.ArrowAction);
  94. this.menuCircleAction = new PdnMenuItem(ActionType.CircleAction);
  95. this.menuPolygonAction = new PdnMenuItem(ActionType.PolygonAction);
  96. this.menuHelpSeparator3 = new ToolStripSeparator();
  97. this.menuWaterMarkAction = new PdnMenuItem(ActionType.WaterMarkAction);
  98. this.menuWordLineAction = new PdnMenuItem(ActionType.WordLineAction);
  99. this.menuHelpSeparator4 = new ToolStripSeparator();
  100. this.menuMoveUpAction = new PdnMenuItem(ActionType.MoveUpAction);
  101. this.menuMoveDownAction = new PdnMenuItem(ActionType.MoveDownAction);
  102. this.menuMoveTopAction = new PdnMenuItem(ActionType.MoveTopAction);
  103. this.menuMoveBottomAction = new PdnMenuItem(ActionType.MoveBottomAction);
  104. this.menuHelpSeparator5 = new ToolStripSeparator();
  105. this.menuLabelListAction = new PdnMenuItem(ActionType.LabelListAction);
  106. this.menuDateMark = new PdnMenuItem(ActionType.DateMark);
  107. this.menuTimeMark = new PdnMenuItem(ActionType.TimeMark);
  108. this.menuPointMark = new PdnMenuItem(ActionType.PointMark);
  109. this.menuNumberMark = new PdnMenuItem(ActionType.NumberMark);
  110. this.menuGainNumber = new PdnMenuItem(ActionType.GainNumber);
  111. this.menuLineChildLine = new PdnMenuItem(ActionType.LineChildLine);
  112. this.menuLineChildLineSegment = new PdnMenuItem(ActionType.LineChildLineSegment);
  113. this.menuCurvePencil = new PdnMenuItem(ActionType.CurvePencil);
  114. this.menuCurvePolyline = new PdnMenuItem(ActionType.CurvePolyline);
  115. this.menuCurveCurve = new PdnMenuItem(ActionType.CurveCurve);
  116. this.menuCurveClosedCurve = new PdnMenuItem(ActionType.CurveClosedCurve);
  117. this.menuOnewayArrow = new PdnMenuItem(ActionType.OnewayArrow);
  118. this.menuTwowayArrow = new PdnMenuItem(ActionType.TwowayArrow);
  119. this.menuCircleOval = new PdnMenuItem(ActionType.CircleOval);
  120. this.menuCircleCircle = new PdnMenuItem(ActionType.CircleCircle);
  121. this.menuPolygonRectangle = new PdnMenuItem(ActionType.PolygonRectangle);
  122. this.menuPolygonPolygon = new PdnMenuItem(ActionType.PolygonPolygon);
  123. this.menuRoundedRectangle = new PdnMenuItem(ActionType.RoundedRectangle);
  124. //
  125. // 添加到主菜单
  126. //
  127. this.DropDownItems.AddRange(new ToolStripItem[] {
  128. this.menuChoiseAction,
  129. this.menuSelectAllAction,
  130. this.menuContinuousDrawingAction,
  131. this.menuClearAllAction,
  132. this.menuHelpSeparator1,
  133. this.menuAutoRulerAction,
  134. this.menuPrestoredRulerAction,
  135. this.menuHandRulerAction,
  136. this.menuHelpSeparator2,
  137. this.menuTextAction,
  138. this.menuMarkAction,
  139. this.menuLineAction,
  140. this.menuCurveLineAction,
  141. this.menuArrowAction,
  142. this.menuCircleAction,
  143. this.menuPolygonAction,
  144. this.menuHelpSeparator3,
  145. this.menuWaterMarkAction,
  146. this.menuWordLineAction,
  147. this.menuHelpSeparator4,
  148. this.menuMoveUpAction,
  149. this.menuMoveDownAction,
  150. this.menuMoveTopAction,
  151. this.menuMoveBottomAction,
  152. this.menuHelpSeparator5,
  153. this.menuLabelListAction
  154. });
  155. //
  156. // 主菜单
  157. //
  158. this.Name = "Menu.LabelAction";
  159. this.Text = PdnResources.GetString("Menu.LabelAction.Text");
  160. //
  161. // 选择
  162. //
  163. this.menuChoiseAction.NeedWaitKey = true;
  164. this.menuChoiseAction.Click += new EventHandler(MenuChoiseAction_Click);
  165. //
  166. // 全选
  167. //
  168. this.menuSelectAllAction.NeedWaitKey = true;
  169. this.menuSelectAllAction.Click += new EventHandler(MenuSelectAllAction_Click);
  170. //
  171. // 连续绘制
  172. //
  173. this.menuContinuousDrawingAction.NeedWaitKey = true;
  174. this.menuContinuousDrawingAction.Click += new EventHandler(MenuContinuousDrawingAction_Click);
  175. //
  176. // 清空元素
  177. //
  178. this.menuClearAllAction.Click += new EventHandler(MenuClearAllAction_Click);
  179. //
  180. // 自动标尺
  181. //
  182. this.menuAutoRulerAction.NeedWaitKey = true;
  183. this.menuAutoRulerAction.Click += new EventHandler(MenuAutoRuler_Click);
  184. //
  185. // 预存标尺
  186. //
  187. this.menuPrestoredRulerAction.Click += new EventHandler(MenuPrestoredRuler_Click);
  188. //
  189. // 手动标尺
  190. //
  191. this.menuHandRulerAction.NeedWaitKey = true;
  192. this.menuHandRulerAction.Click += new EventHandler(MenuHandRuler_Click);
  193. //
  194. // 文本
  195. //
  196. this.menuTextAction.NeedWaitKey = true;
  197. this.menuTextAction.Click += new EventHandler(MenuTextAction_Click);
  198. //
  199. // 标记
  200. //
  201. this.menuMarkAction.DropDownItems.AddRange(
  202. new ToolStripItem[]
  203. {
  204. this.menuDateMark,
  205. this.menuTimeMark,
  206. this.menuPointMark,
  207. this.menuNumberMark,
  208. this.menuGainNumber
  209. });
  210. //
  211. // 直线
  212. //
  213. this.menuLineAction.DropDownItems.AddRange(
  214. new ToolStripItem[]
  215. {
  216. this.menuLineChildLine,
  217. this.menuLineChildLineSegment
  218. });
  219. //
  220. // 曲线
  221. //
  222. this.menuCurveLineAction.DropDownItems.AddRange(
  223. new ToolStripItem[]
  224. {
  225. this.menuCurvePencil,
  226. this.menuCurvePolyline,
  227. this.menuCurveCurve,
  228. this.menuCurveClosedCurve
  229. });
  230. //
  231. // 箭头
  232. //
  233. this.menuArrowAction.DropDownItems.AddRange(
  234. new ToolStripItem[]
  235. {
  236. this.menuOnewayArrow,
  237. this.menuTwowayArrow
  238. });
  239. //
  240. // 圆
  241. //
  242. this.menuCircleAction.DropDownItems.AddRange(
  243. new ToolStripItem[]
  244. {
  245. this.menuCircleOval,
  246. this.menuCircleCircle
  247. });
  248. //
  249. // 多边形
  250. //
  251. this.menuPolygonAction.DropDownItems.AddRange(
  252. new ToolStripItem[]
  253. {
  254. this.menuPolygonRectangle,
  255. this.menuPolygonPolygon,
  256. this.menuRoundedRectangle
  257. });
  258. //
  259. // 水印
  260. //
  261. this.menuWaterMarkAction.NeedWaitKey = true;
  262. this.menuWaterMarkAction.Click += new EventHandler(MenuWaterMarkAction_Click);
  263. //
  264. // 工字线
  265. //
  266. this.menuWordLineAction.NeedWaitKey = true;
  267. this.menuWordLineAction.Click += new EventHandler(MenuWorkTypeAction_Click);
  268. //
  269. // 向上移动
  270. //
  271. this.menuMoveUpAction.NeedWaitKey = true;
  272. this.menuMoveUpAction.Click += new EventHandler(MenuMoveUpAction_Click);
  273. //
  274. // 向下移动
  275. //
  276. this.menuMoveDownAction.NeedWaitKey = true;
  277. this.menuMoveDownAction.Click += new EventHandler(MenuMoveDownAction_Click);
  278. //
  279. // 移动到最上
  280. //
  281. this.menuMoveTopAction.NeedWaitKey = true;
  282. this.menuMoveTopAction.Click += new EventHandler(MenuMoveTopAction_Click);
  283. //
  284. // 移动到最下
  285. //
  286. this.menuMoveBottomAction.NeedWaitKey = true;
  287. this.menuMoveBottomAction.Click += new EventHandler(MenuMoveBottomAction_Click);
  288. //
  289. // 标注信息列表
  290. //
  291. this.menuLabelListAction.NeedWaitKey = true;
  292. this.menuLabelListAction.Click += new EventHandler(MenuLabelListAction_Click);
  293. //
  294. // 以下是子菜单
  295. //
  296. //
  297. // 标记->日期
  298. //
  299. this.menuDateMark.Text = PdnResources.GetString("Menu.LabelAction.DrawDateMark.Text");
  300. this.menuDateMark.NeedWaitKey = true;
  301. this.menuDateMark.Click += new EventHandler(MenuDateMark_Click);
  302. this.menuDateMark.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawDateMarkIcon.png").Reference;
  303. //
  304. // 标记->时间
  305. //
  306. this.menuTimeMark.Text = PdnResources.GetString("Menu.LabelAction.DrawTimeMark.Text");
  307. this.menuTimeMark.NeedWaitKey = true;
  308. this.menuTimeMark.Click += new EventHandler(MenuTimeMark_Click);
  309. this.menuTimeMark.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawTimeMarkIcon.png").Reference;
  310. //
  311. // 标记->点标记
  312. //
  313. this.menuPointMark.Text = PdnResources.GetString("Menu.LabelAction.DrawPointMark.Text");
  314. this.menuPointMark.NeedWaitKey = true;
  315. this.menuPointMark.Click += new EventHandler(MenuPointMark_Click);
  316. this.menuPointMark.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawPointMarkIcon.png").Reference;
  317. //
  318. // 标记->数字标记
  319. //
  320. this.menuNumberMark.Text = PdnResources.GetString("Menu.LabelAction.DrawNumberMark.Text");
  321. this.menuNumberMark.NeedWaitKey = true;
  322. this.menuNumberMark.Click += new EventHandler(MenuNumberMark_Click);
  323. this.menuNumberMark.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawNumberMarkIcon.png").Reference;
  324. //
  325. // 放大倍数
  326. //
  327. this.menuGainNumber.Text = PdnResources.GetString("Menu.LabelAction.DrawGainNumber.Text");
  328. this.menuGainNumber.NeedWaitKey = true;
  329. this.menuGainNumber.Click += new EventHandler(MenuGainNumber_Click);
  330. this.menuGainNumber.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawGainNumberIcon.png").Reference;
  331. //
  332. // 直线->直线
  333. //
  334. this.menuLineChildLine.Text = PdnResources.GetString("Menu.LabelAction.DrawLine.Text");
  335. this.menuLineChildLine.NeedWaitKey = true;
  336. this.menuLineChildLine.Click += new EventHandler(MenuLineChildLine_Click);
  337. this.menuLineChildLine.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawLineIcon.png").Reference;
  338. //
  339. // 直线->线段
  340. //
  341. this.menuLineChildLineSegment.Text = PdnResources.GetString("Menu.LabelAction.DrawLineSegment.Text");
  342. this.menuLineChildLineSegment.NeedWaitKey = true;
  343. this.menuLineChildLineSegment.Click += new EventHandler(MenuLineChildLineSegment_Click);
  344. this.menuLineChildLineSegment.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawLineSegmentIcon.png").Reference;
  345. //
  346. // 曲线->铅笔
  347. //
  348. this.menuCurvePencil.Text = PdnResources.GetString("Menu.LabelAction.DrawPencil.Text");
  349. this.menuCurvePencil.NeedWaitKey = true;
  350. this.menuCurvePencil.Click += new EventHandler(MenuCurvePencil_Click);
  351. this.menuCurvePencil.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawPencilIcon.png").Reference;
  352. //
  353. // 曲线->折线
  354. //
  355. this.menuCurvePolyline.Text = PdnResources.GetString("Menu.LabelAction.DrawPolygonLine.Text");
  356. this.menuCurvePolyline.NeedWaitKey = true;
  357. this.menuCurvePolyline.Click += new EventHandler(MenuCurvePolyline_Click);
  358. this.menuCurvePolyline.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawPolygonLineIcon.png").Reference;
  359. //
  360. // 曲线->曲线
  361. //
  362. this.menuCurveCurve.Text = PdnResources.GetString("Menu.LabelAction.DrawCurve.Text");
  363. this.menuCurveCurve.NeedWaitKey = true;
  364. this.menuCurveCurve.Click += new EventHandler(MenuCurveCurve_Click);
  365. this.menuCurveCurve.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawCurveIcon.png").Reference;
  366. //
  367. // 曲线->闭合曲线
  368. //
  369. this.menuCurveClosedCurve.Text = PdnResources.GetString("Menu.LabelAction.DrawClosedCurve.Text");
  370. this.menuCurveClosedCurve.NeedWaitKey = true;
  371. this.menuCurveClosedCurve.Click += new EventHandler(MenuCurveClosedCurve_Click);
  372. this.menuCurveClosedCurve.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawClosedCurveIcon.png").Reference;
  373. //
  374. // 箭头->单向箭头
  375. //
  376. this.menuOnewayArrow.Text = PdnResources.GetString("Menu.LabelAction.DrawOneArrowLine.Text");
  377. this.menuOnewayArrow.NeedWaitKey = true;
  378. this.menuOnewayArrow.Click += new EventHandler(MenuOnewayArrow_Click);
  379. this.menuOnewayArrow.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawOneArrowLineIcon.png").Reference;
  380. //
  381. // 箭头->双向箭头
  382. //
  383. this.menuTwowayArrow.Text = PdnResources.GetString("Menu.LabelAction.DrawTwoArrowLine.Text");
  384. this.menuTwowayArrow.NeedWaitKey = true;
  385. this.menuTwowayArrow.Click += new EventHandler(MenuTwowayArrow_Click);
  386. this.menuTwowayArrow.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawTwoArrowLineIcon.png").Reference;
  387. //
  388. // 圆->椭圆
  389. //
  390. this.menuCircleOval.Text = PdnResources.GetString("Menu.LabelAction.DrawEllipse.Text");
  391. this.menuCircleOval.NeedWaitKey = true;
  392. this.menuCircleOval.Click += new EventHandler(MenuCircleOval_Click);
  393. this.menuCircleOval.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawEllipseIcon.png").Reference;
  394. //
  395. // 圆->圆
  396. //
  397. this.menuCircleCircle.Text = PdnResources.GetString("Menu.LabelAction.DrawCircle.Text");
  398. this.menuCircleCircle.NeedWaitKey = true;
  399. this.menuCircleCircle.Click += new EventHandler(MenuCircleCircle_Click);
  400. this.menuCircleCircle.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawCircleIcon.png").Reference;
  401. //
  402. // 多边形->矩形
  403. //
  404. this.menuPolygonRectangle.Text = PdnResources.GetString("Menu.LabelAction.DrawRectangle.Text");
  405. this.menuPolygonRectangle.NeedWaitKey = true;
  406. this.menuPolygonRectangle.Click += new EventHandler(MenuPolygonRectangle_Click);
  407. this.menuPolygonRectangle.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawRectangleIcon.png").Reference;
  408. //
  409. // 多边形->多边形
  410. //
  411. this.menuPolygonPolygon.Text = PdnResources.GetString("Menu.LabelAction.DrawPolygon.Text");
  412. this.menuPolygonPolygon.NeedWaitKey = true;
  413. this.menuPolygonPolygon.Click += new EventHandler(MenuPolygonPolygon_Click);
  414. this.menuPolygonPolygon.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawPolygonIcon.png").Reference;
  415. //
  416. // 多边形->圆角矩形
  417. //
  418. this.menuRoundedRectangle.Text = PdnResources.GetString("Menu.LabelAction.DrawRoundRectangle.Text");
  419. this.menuRoundedRectangle.NeedWaitKey = true;
  420. this.menuRoundedRectangle.Click += new EventHandler(MenuRoundedRectangle_Click);
  421. this.menuRoundedRectangle.Image = PdnResources.GetImageResource("Icons.MenuLabelDrawRoundRectangleIcon.png").Reference;
  422. //
  423. // 加载菜单的文字和icon
  424. //
  425. this.LoadNames(this.Name);
  426. this.LoadIcons();
  427. }
  428. protected override void OnDropDownOpening(EventArgs e)
  429. {
  430. //if (AppWorkspace.ActiveDocumentWorkspace != null/* && !AppWorkspace.ScriptRunning*/)
  431. //{
  432. // this.menuLineAction.Enabled = true;
  433. //}
  434. //else
  435. //{
  436. // this.menuLineAction.Enabled = false;
  437. //}
  438. this.menuLabelListAction.Checked = AppWorkspace.Widgets.LabelListDialog.Visible;
  439. this.menuContinuousDrawingAction.Checked = DocumentView.ContinuousDrawing;
  440. //this.RecursiveData(this.DropDownItems);
  441. base.OnDropDownOpening(e);
  442. }
  443. /// <summary>
  444. /// 选择
  445. /// </summary>
  446. /// <param name="sender"></param>
  447. /// <param name="e"></param>
  448. private void MenuChoiseAction_Click(object sender, EventArgs e)
  449. {
  450. if (AppWorkspace.ActiveDocumentWorkspace != null)
  451. {
  452. if (AppWorkspace.startScriptRecording)
  453. {
  454. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  455. }
  456. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  457. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.Pointer;
  458. }
  459. this.SetCameraPreviewActiveTool(DrawToolType.Pointer);
  460. }
  461. /// <summary>
  462. /// 全选
  463. /// </summary>
  464. /// <param name="sender"></param>
  465. /// <param name="e"></param>
  466. private void MenuSelectAllAction_Click(object sender, EventArgs e)
  467. {
  468. if (AppWorkspace.ActiveDocumentWorkspace != null)
  469. {
  470. if (AppWorkspace.startScriptRecording)
  471. {
  472. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  473. }
  474. AppWorkspace.ActiveDocumentWorkspace.GraphicsList.SelectAll();
  475. AppWorkspace.ActiveDocumentWorkspace.Refresh();
  476. }
  477. if (AppWorkspace.cameraPreviewDialog != null && !AppWorkspace.cameraPreviewDialog.IsDisposed)
  478. {
  479. AppWorkspace.cameraPreviewDialog.documentWorkspace.GraphicsList.SelectAll();
  480. AppWorkspace.cameraPreviewDialog.documentWorkspace.Refresh();
  481. }
  482. }
  483. /// <summary>
  484. /// 连续绘制
  485. /// </summary>
  486. /// <param name="sender"></param>
  487. /// <param name="e"></param>
  488. private void MenuContinuousDrawingAction_Click(object sender, EventArgs e)
  489. {
  490. if (AppWorkspace.startScriptRecording)
  491. {
  492. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  493. }
  494. AppWorkspace.ContinuousDrawing = !AppWorkspace.ContinuousDrawing;
  495. }
  496. /// <summary>
  497. /// 清空元素
  498. /// </summary>
  499. /// <param name="sender"></param>
  500. /// <param name="e"></param>
  501. private void MenuClearAllAction_Click(object sender, EventArgs e)
  502. {
  503. if (AppWorkspace.ActiveDocumentWorkspace != null)
  504. {
  505. if (AppWorkspace.startScriptRecording)
  506. {
  507. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  508. }
  509. AppWorkspace.ActiveDocumentWorkspace.GraphicsList.Clear();
  510. AppWorkspace.ActiveDocumentWorkspace.Refresh();
  511. }
  512. if (AppWorkspace.cameraPreviewDialog != null && !AppWorkspace.cameraPreviewDialog.IsDisposed)
  513. {
  514. AppWorkspace.cameraPreviewDialog.documentWorkspace.GraphicsList.Clear();
  515. AppWorkspace.cameraPreviewDialog.documentWorkspace.Refresh();
  516. }
  517. }
  518. /// <summary>
  519. /// 自动标尺
  520. /// </summary>
  521. /// <param name="sender"></param>
  522. /// <param name="e"></param>
  523. private void MenuAutoRuler_Click(object sender, EventArgs e)
  524. {
  525. if (AppWorkspace.ActiveDocumentWorkspace != null)
  526. {
  527. if (AppWorkspace.startScriptRecording)
  528. {
  529. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  530. }
  531. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  532. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawAutoRuler;
  533. if (AppWorkspace.ContinuousDrawing)
  534. {
  535. AppWorkspace.ContinuousDrawing = false;
  536. }
  537. if (AppWorkspace.Widgets.LabelListDialog != null)
  538. {
  539. AppWorkspace.Widgets.LabelListDialog.RefreshDateGridView(null, null);
  540. }
  541. }
  542. this.SetCameraPreviewActiveTool(DrawToolType.DrawAutoRuler);
  543. }
  544. /// <summary>
  545. /// 手动标尺
  546. /// </summary>
  547. /// <param name="sender"></param>
  548. /// <param name="e"></param>
  549. private void MenuHandRuler_Click(object sender, EventArgs e)
  550. {
  551. if (AppWorkspace.ActiveDocumentWorkspace != null)
  552. {
  553. if (AppWorkspace.startScriptRecording)
  554. {
  555. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  556. }
  557. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  558. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawHandModeRuler;
  559. }
  560. this.SetCameraPreviewActiveTool(DrawToolType.DrawHandModeRuler);
  561. }
  562. /// <summary>
  563. /// 预存标尺
  564. /// </summary>
  565. /// <param name="sender"></param>
  566. /// <param name="e"></param>
  567. private void MenuPrestoredRuler_Click(object sender, EventArgs e)
  568. {
  569. using (PresetRulerDialog presetRulerDialog = new PresetRulerDialog(this.AppWorkspace))
  570. {
  571. if (AppWorkspace.startScriptRecording)
  572. {
  573. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  574. }
  575. if (AppWorkspace.ContinuousDrawing)
  576. {
  577. AppWorkspace.ContinuousDrawing = false;
  578. }
  579. presetRulerDialog.StartPosition = FormStartPosition.CenterScreen;
  580. presetRulerDialog.ShowDialog();
  581. }
  582. }
  583. /// <summary>
  584. /// 标记->文本
  585. /// </summary>
  586. /// <param name="sender"></param>
  587. /// <param name="e"></param>
  588. private void MenuTextAction_Click(object sender, EventArgs e)
  589. {
  590. if (AppWorkspace.ActiveDocumentWorkspace != null)
  591. {
  592. if (AppWorkspace.startScriptRecording)
  593. {
  594. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  595. }
  596. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  597. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawTextString;
  598. }
  599. this.SetCameraPreviewActiveTool(DrawToolType.DrawTextString);
  600. }
  601. /// <summary>
  602. /// 标记->日期
  603. /// </summary>
  604. /// <param name="sender"></param>
  605. /// <param name="e"></param>
  606. private void MenuDateMark_Click(object sender, EventArgs e)
  607. {
  608. if (AppWorkspace.ActiveDocumentWorkspace != null)
  609. {
  610. if (AppWorkspace.startScriptRecording)
  611. {
  612. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  613. }
  614. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  615. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawDateMark;
  616. if (AppWorkspace.ContinuousDrawing)
  617. {
  618. AppWorkspace.ContinuousDrawing = false;
  619. }
  620. if (AppWorkspace.Widgets.LabelListDialog != null)
  621. {
  622. AppWorkspace.Widgets.LabelListDialog.RefreshDateGridView(null, null);
  623. }
  624. }
  625. this.SetCameraPreviewActiveTool(DrawToolType.DrawDateMark);
  626. }
  627. /// <summary>
  628. /// 标记->时间
  629. /// </summary>
  630. /// <param name="sender"></param>
  631. /// <param name="e"></param>
  632. private void MenuTimeMark_Click(object sender, EventArgs e)
  633. {
  634. if (AppWorkspace.ActiveDocumentWorkspace != null)
  635. {
  636. if (AppWorkspace.startScriptRecording)
  637. {
  638. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  639. }
  640. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  641. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawTimeMark;
  642. if (AppWorkspace.ContinuousDrawing)
  643. {
  644. AppWorkspace.ContinuousDrawing = false;
  645. }
  646. if (AppWorkspace.Widgets.LabelListDialog != null)
  647. {
  648. AppWorkspace.Widgets.LabelListDialog.RefreshDateGridView(null, null);
  649. }
  650. }
  651. this.SetCameraPreviewActiveTool(DrawToolType.DrawTimeMark);
  652. }
  653. /// <summary>
  654. /// 标记->点标记
  655. /// </summary>
  656. /// <param name="sender"></param>
  657. /// <param name="e"></param>
  658. private void MenuPointMark_Click(object sender, EventArgs e)
  659. {
  660. if (AppWorkspace.ActiveDocumentWorkspace != null)
  661. {
  662. if (AppWorkspace.startScriptRecording)
  663. {
  664. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  665. }
  666. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  667. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawPointMark;
  668. }
  669. this.SetCameraPreviewActiveTool(DrawToolType.DrawPointMark);
  670. }
  671. /// <summary>
  672. /// 标记->数字标记
  673. /// </summary>
  674. /// <param name="sender"></param>
  675. /// <param name="e"></param>
  676. private void MenuNumberMark_Click(object sender, EventArgs e)
  677. {
  678. if (AppWorkspace.ActiveDocumentWorkspace != null)
  679. {
  680. if (AppWorkspace.startScriptRecording)
  681. {
  682. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  683. }
  684. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  685. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawNumberMark;
  686. }
  687. this.SetCameraPreviewActiveTool(DrawToolType.DrawNumberMark);
  688. }
  689. /// <summary>
  690. /// 标记->放大倍数
  691. /// </summary>
  692. /// <param name="sender"></param>
  693. /// <param name="e"></param>
  694. private void MenuGainNumber_Click(object sender, EventArgs e)
  695. {
  696. if (AppWorkspace.ActiveDocumentWorkspace != null)
  697. {
  698. if (AppWorkspace.startScriptRecording)
  699. {
  700. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  701. }
  702. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  703. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawGainNumber;
  704. if (AppWorkspace.ContinuousDrawing) {
  705. AppWorkspace.ContinuousDrawing = false;
  706. }
  707. if (AppWorkspace.Widgets.LabelListDialog != null)
  708. {
  709. AppWorkspace.Widgets.LabelListDialog.RefreshDateGridView(null, null);
  710. }
  711. }
  712. this.SetCameraPreviewActiveTool(DrawToolType.DrawGainNumber);
  713. }
  714. /// <summary>
  715. /// 直线->直线
  716. /// </summary>
  717. /// <param name="sender"></param>
  718. /// <param name="e"></param>
  719. private void MenuLineChildLine_Click(object sender, EventArgs e)
  720. {
  721. if (AppWorkspace.ActiveDocumentWorkspace != null)
  722. {
  723. if (AppWorkspace.startScriptRecording)
  724. {
  725. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  726. }
  727. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  728. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawLine;
  729. }
  730. this.SetCameraPreviewActiveTool(DrawToolType.DrawLine);
  731. }
  732. /// <summary>
  733. /// 直线->线段
  734. /// </summary>
  735. /// <param name="sender"></param>
  736. /// <param name="e"></param>
  737. private void MenuLineChildLineSegment_Click(object sender, EventArgs e)
  738. {
  739. if (AppWorkspace.ActiveDocumentWorkspace != null)
  740. {
  741. if (AppWorkspace.startScriptRecording)
  742. {
  743. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  744. }
  745. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  746. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawLineSegment;
  747. }
  748. this.SetCameraPreviewActiveTool(DrawToolType.DrawLineSegment);
  749. }
  750. /// <summary>
  751. /// 曲线->铅笔
  752. /// </summary>
  753. /// <param name="sender"></param>
  754. /// <param name="e"></param>
  755. private void MenuCurvePencil_Click(object sender, EventArgs e)
  756. {
  757. if (AppWorkspace.ActiveDocumentWorkspace != null)
  758. {
  759. if (AppWorkspace.startScriptRecording)
  760. {
  761. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  762. }
  763. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  764. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawPencil;
  765. }
  766. this.SetCameraPreviewActiveTool(DrawToolType.DrawPencil);
  767. }
  768. /// <summary>
  769. /// 曲线->折线
  770. /// </summary>
  771. /// <param name="sender"></param>
  772. /// <param name="e"></param>
  773. private void MenuCurvePolyline_Click(object sender, EventArgs e)
  774. {
  775. if (AppWorkspace.ActiveDocumentWorkspace != null)
  776. {
  777. if (AppWorkspace.startScriptRecording)
  778. {
  779. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  780. }
  781. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  782. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawPolygonLine;
  783. }
  784. this.SetCameraPreviewActiveTool(DrawToolType.DrawPolygonLine);
  785. }
  786. /// <summary>
  787. /// 曲线->曲线
  788. /// </summary>
  789. /// <param name="sender"></param>
  790. /// <param name="e"></param>
  791. private void MenuCurveCurve_Click(object sender, EventArgs e)
  792. {
  793. if (AppWorkspace.ActiveDocumentWorkspace != null)
  794. {
  795. if (AppWorkspace.startScriptRecording)
  796. {
  797. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  798. }
  799. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  800. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawCurve;
  801. }
  802. this.SetCameraPreviewActiveTool(DrawToolType.DrawCurve);
  803. }
  804. /// <summary>
  805. /// 曲线->闭合曲线
  806. /// </summary>
  807. /// <param name="sender"></param>
  808. /// <param name="e"></param>
  809. private void MenuCurveClosedCurve_Click(object sender, EventArgs e)
  810. {
  811. if (AppWorkspace.ActiveDocumentWorkspace != null)
  812. {
  813. if (AppWorkspace.startScriptRecording)
  814. {
  815. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  816. }
  817. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  818. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawClosedCurve;
  819. }
  820. this.SetCameraPreviewActiveTool(DrawToolType.DrawClosedCurve);
  821. }
  822. /// <summary>
  823. /// 箭头->单向箭头
  824. /// </summary>
  825. /// <param name="sender"></param>
  826. /// <param name="e"></param>
  827. private void MenuOnewayArrow_Click(object sender, EventArgs e)
  828. {
  829. if (AppWorkspace.ActiveDocumentWorkspace != null)
  830. {
  831. if (AppWorkspace.startScriptRecording)
  832. {
  833. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  834. }
  835. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  836. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawOneArrowLine;
  837. }
  838. this.SetCameraPreviewActiveTool(DrawToolType.DrawOneArrowLine);
  839. }
  840. /// <summary>
  841. /// 箭头->双向箭头
  842. /// </summary>
  843. /// <param name="sender"></param>
  844. /// <param name="e"></param>
  845. private void MenuTwowayArrow_Click(object sender, EventArgs e)
  846. {
  847. if (AppWorkspace.ActiveDocumentWorkspace != null)
  848. {
  849. if (AppWorkspace.startScriptRecording)
  850. {
  851. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  852. }
  853. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  854. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawTwoArrowLine;
  855. }
  856. this.SetCameraPreviewActiveTool(DrawToolType.DrawTwoArrowLine);
  857. }
  858. /// <summary>
  859. /// 圆->椭圆
  860. /// </summary>
  861. /// <param name="sender"></param>
  862. /// <param name="e"></param>
  863. private void MenuCircleOval_Click(object sender, EventArgs e)
  864. {
  865. if (AppWorkspace.ActiveDocumentWorkspace != null)
  866. {
  867. if (AppWorkspace.startScriptRecording)
  868. {
  869. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  870. }
  871. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  872. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawEllipse;
  873. }
  874. this.SetCameraPreviewActiveTool(DrawToolType.DrawEllipse);
  875. }
  876. /// <summary>
  877. /// 圆->圆
  878. /// </summary>
  879. /// <param name="sender"></param>
  880. /// <param name="e"></param>
  881. private void MenuCircleCircle_Click(object sender, EventArgs e)
  882. {
  883. if (AppWorkspace.ActiveDocumentWorkspace != null)
  884. {
  885. if (AppWorkspace.startScriptRecording)
  886. {
  887. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  888. }
  889. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  890. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawCircle;
  891. }
  892. this.SetCameraPreviewActiveTool(DrawToolType.DrawCircle);
  893. }
  894. /// <summary>
  895. /// 多边形->矩形
  896. /// </summary>
  897. /// <param name="sender"></param>
  898. /// <param name="e"></param>
  899. private void MenuPolygonRectangle_Click(object sender, EventArgs e)
  900. {
  901. if (AppWorkspace.ActiveDocumentWorkspace != null)
  902. {
  903. if (AppWorkspace.startScriptRecording)
  904. {
  905. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  906. }
  907. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  908. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawRectangle;
  909. }
  910. this.SetCameraPreviewActiveTool(DrawToolType.DrawRectangle);
  911. }
  912. /// <summary>
  913. /// 多边形->多边形
  914. /// </summary>
  915. /// <param name="sender"></param>
  916. /// <param name="e"></param>
  917. private void MenuPolygonPolygon_Click(object sender, EventArgs e)
  918. {
  919. if (AppWorkspace.ActiveDocumentWorkspace != null)
  920. {
  921. if (AppWorkspace.startScriptRecording)
  922. {
  923. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  924. }
  925. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  926. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawPolygon;
  927. }
  928. this.SetCameraPreviewActiveTool(DrawToolType.DrawPolygon);
  929. }
  930. /// <summary>
  931. /// 多边形->圆角矩形
  932. /// </summary>
  933. /// <param name="sender"></param>
  934. /// <param name="e"></param>
  935. private void MenuRoundedRectangle_Click(object sender, EventArgs e)
  936. {
  937. if (AppWorkspace.ActiveDocumentWorkspace != null)
  938. {
  939. if (AppWorkspace.startScriptRecording)
  940. {
  941. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  942. }
  943. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  944. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawRoundRectangle;
  945. }
  946. this.SetCameraPreviewActiveTool(DrawToolType.DrawRoundRectangle);
  947. }
  948. /// <summary>
  949. /// 水印
  950. /// </summary>
  951. /// <param name="sender"></param>
  952. /// <param name="e"></param>
  953. private void MenuWaterMarkAction_Click(object sender, EventArgs e)
  954. {
  955. if (AppWorkspace.ActiveDocumentWorkspace != null)
  956. {
  957. if (AppWorkspace.startScriptRecording)
  958. {
  959. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  960. }
  961. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  962. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawWaterMark;
  963. if (AppWorkspace.Widgets.LabelListDialog != null)
  964. {
  965. AppWorkspace.Widgets.LabelListDialog.RefreshDateGridView(null, null);
  966. }
  967. }
  968. this.SetCameraPreviewActiveTool(DrawToolType.DrawWaterMark);
  969. }
  970. /// <summary>
  971. /// 工字线
  972. /// </summary>
  973. /// <param name="sender"></param>
  974. /// <param name="e"></param>
  975. private void MenuWorkTypeAction_Click(object sender, EventArgs e)
  976. {
  977. if (AppWorkspace.ActiveDocumentWorkspace != null)
  978. {
  979. if (AppWorkspace.startScriptRecording)
  980. {
  981. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  982. }
  983. AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  984. AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.DrawWorkType;
  985. }
  986. this.SetCameraPreviewActiveTool(DrawToolType.DrawWorkType);
  987. }
  988. /// <summary>
  989. /// 向上移动
  990. /// </summary>
  991. /// <param name="sender"></param>
  992. /// <param name="e"></param>
  993. private void MenuMoveUpAction_Click(object sender, EventArgs e)
  994. {
  995. if (AppWorkspace.ActiveDocumentWorkspace != null)
  996. {
  997. if (AppWorkspace.startScriptRecording)
  998. {
  999. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  1000. }
  1001. AppWorkspace.ActiveDocumentWorkspace.GraphicsList.MoveSelectionToMoveUp();
  1002. AppWorkspace.ActiveDocumentWorkspace.Refresh();
  1003. if (AppWorkspace.Widgets.LabelListDialog != null)
  1004. {
  1005. AppWorkspace.Widgets.LabelListDialog.RefreshDateGridView(null, null);
  1006. }
  1007. }
  1008. }
  1009. /// <summary>
  1010. /// 向下移动
  1011. /// </summary>
  1012. /// <param name="sender"></param>
  1013. /// <param name="e"></param>
  1014. private void MenuMoveDownAction_Click(object sender, EventArgs e)
  1015. {
  1016. if (AppWorkspace.ActiveDocumentWorkspace != null)
  1017. {
  1018. if (AppWorkspace.startScriptRecording)
  1019. {
  1020. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  1021. }
  1022. AppWorkspace.ActiveDocumentWorkspace.GraphicsList.MoveSelectionToMoveDown();
  1023. AppWorkspace.ActiveDocumentWorkspace.Refresh();
  1024. if (AppWorkspace.Widgets.LabelListDialog != null)
  1025. {
  1026. AppWorkspace.Widgets.LabelListDialog.RefreshDateGridView(null, null);
  1027. }
  1028. }
  1029. }
  1030. /// <summary>
  1031. /// 移动到最上
  1032. /// </summary>
  1033. /// <param name="sender"></param>
  1034. /// <param name="e"></param>
  1035. private void MenuMoveTopAction_Click(object sender, EventArgs e)
  1036. {
  1037. if (AppWorkspace.ActiveDocumentWorkspace != null)
  1038. {
  1039. if (AppWorkspace.startScriptRecording)
  1040. {
  1041. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  1042. }
  1043. AppWorkspace.ActiveDocumentWorkspace.GraphicsList.MoveSelectionToFront();
  1044. AppWorkspace.ActiveDocumentWorkspace.Refresh();
  1045. if (AppWorkspace.Widgets.LabelListDialog != null)
  1046. {
  1047. AppWorkspace.Widgets.LabelListDialog.RefreshDateGridView(null, null);
  1048. }
  1049. }
  1050. }
  1051. /// <summary>
  1052. /// 移动到最下
  1053. /// </summary>
  1054. /// <param name="sender"></param>
  1055. /// <param name="e"></param>
  1056. private void MenuMoveBottomAction_Click(object sender, EventArgs e)
  1057. {
  1058. if (AppWorkspace.ActiveDocumentWorkspace != null)
  1059. {
  1060. if (AppWorkspace.startScriptRecording)
  1061. {
  1062. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  1063. }
  1064. AppWorkspace.ActiveDocumentWorkspace.GraphicsList.MoveSelectionToBack();
  1065. AppWorkspace.ActiveDocumentWorkspace.Refresh();
  1066. if (AppWorkspace.Widgets.LabelListDialog != null)
  1067. {
  1068. AppWorkspace.Widgets.LabelListDialog.RefreshDateGridView(null, null);
  1069. }
  1070. }
  1071. }
  1072. /// <summary>
  1073. /// 标注列表
  1074. /// </summary>
  1075. /// <param name="sender"></param>
  1076. /// <param name="e"></param>
  1077. private void MenuLabelListAction_Click(object sender, EventArgs e)
  1078. {
  1079. AppWorkspace.Widgets.LabelListDialog.Visible = !AppWorkspace.Widgets.LabelListDialog.Visible;
  1080. if (AppWorkspace.ActiveDocumentWorkspace != null)
  1081. {
  1082. if (AppWorkspace.startScriptRecording)
  1083. {
  1084. AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List<Args>());
  1085. }
  1086. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.Widgets.LabelListDialog.Visible, "LabelListAction");
  1087. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.Widgets.LabelListDialog.Visible, "LabelListAction");
  1088. this.menuLabelListAction.Checked = AppWorkspace.Widgets.LabelListDialog.Visible;
  1089. AppWorkspace.Widgets.LabelListDialog.getData();
  1090. AppWorkspace.ActiveDocumentWorkspace.Focus();
  1091. }
  1092. }
  1093. private void SetCameraPreviewActiveTool(DrawToolType drawToolType)
  1094. {
  1095. if (AppWorkspace.cameraPreviewDialog != null && !AppWorkspace.cameraPreviewDialog.IsDisposed)
  1096. {
  1097. AppWorkspace.cameraPreviewDialog.documentWorkspace.ActiveTool = drawToolType;
  1098. }
  1099. }
  1100. private string GetCultureInfoName(CultureInfo ci)
  1101. {
  1102. CultureInfo en_US = new CultureInfo("en-US");
  1103. if (ci.Equals(en_US))
  1104. {
  1105. return GetCultureInfoName(ci.Parent);
  1106. }
  1107. else
  1108. {
  1109. return ci.NativeName;
  1110. }
  1111. }
  1112. public void checkMenu(bool v)
  1113. {
  1114. this.menuContinuousDrawingAction.Checked = v;
  1115. }
  1116. }
  1117. }