LabelActionMenu.cs 52 KB

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