EditMenu.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. using Resources;
  2. using SmartCoalApplication.Base.Enum;
  3. using SmartCoalApplication.Core;
  4. using System;
  5. using System.Windows.Forms;
  6. namespace SmartCoalApplication.Menus
  7. {
  8. /// <summary>
  9. /// 编辑菜单
  10. /// </summary>
  11. internal sealed class EditMenu : PdnMenuItem
  12. {
  13. private PdnMenuItem menuEditUndo;
  14. private PdnMenuItem menuEditRedo;
  15. private PdnMenuItem menuEditCopy;
  16. private PdnMenuItem menuEditPaste;
  17. private PdnMenuItem menuEditDelete;
  18. private ToolStripSeparator menuEditSeparator1;
  19. private PdnMenuItem menuViewZoomIn;
  20. private PdnMenuItem menuViewZoomOut;
  21. private PdnMenuItem menuViewActualSize;
  22. private PdnMenuItem menuViewZoomToWindow;
  23. private PdnMenuItem menuViewZoomToWidth;
  24. private PdnMenuItem menuViewZoomToHeight;
  25. private ToolStripSeparator menuEditSeparator2;
  26. private PdnMenuItem menuImageCut;
  27. private PdnMenuItem menuLockZoom;
  28. private PdnMenuItem menuFixedMultiple;
  29. private ToolStripSeparator menuEditSeparator3;
  30. private PdnMenuItem menuImageFlipHorizontal;
  31. private PdnMenuItem menuImageFlipVertical;
  32. private PdnMenuItem menuImageFlipCenter;
  33. private ToolStripSeparator menuEditSeparator4;
  34. private PdnMenuItem menuImageRotate90CW;
  35. private PdnMenuItem menuImageRotate180;
  36. private PdnMenuItem menuImageRotate90CCW;
  37. public EditMenu(int menuId)
  38. {
  39. PdnBaseForm.RegisterFormHotKey(Keys.Control | Keys.Insert, OnLeftHandedCopyHotKey);
  40. PdnBaseForm.RegisterFormHotKey(Keys.Shift | Keys.Insert, OnLeftHandedPasteHotKey);
  41. InitializeComponent();
  42. this.MenuId = menuId;
  43. }
  44. private bool OnLeftHandedCopyHotKey(Keys keys)
  45. {
  46. this.menuEditCopy.PerformClick();
  47. return true;
  48. }
  49. private bool OnLeftHandedPasteHotKey(Keys keys)
  50. {
  51. this.menuEditPaste.PerformClick();
  52. return true;
  53. }
  54. private void InitializeComponent()
  55. {
  56. this.menuEditUndo = new PdnMenuItem(ActionType.Undo);
  57. this.menuEditRedo = new PdnMenuItem(ActionType.Redo);
  58. this.menuEditCopy = new PdnMenuItem(ActionType.Copy);
  59. this.menuEditPaste = new PdnMenuItem(ActionType.Paste);
  60. this.menuEditDelete = new PdnMenuItem(ActionType.Delete);
  61. this.menuEditSeparator1 = new ToolStripSeparator();
  62. this.menuViewZoomIn = new PdnMenuItem(ActionType.ZoomIn);
  63. this.menuViewZoomOut = new PdnMenuItem(ActionType.ZoomOut);
  64. this.menuViewActualSize = new PdnMenuItem(ActionType.ActualSize, true);
  65. this.menuViewZoomToWindow = new PdnMenuItem(ActionType.ZoomToWindow, true);
  66. this.menuViewZoomToWidth = new PdnMenuItem(ActionType.ZoomToWidth, true);
  67. this.menuViewZoomToHeight = new PdnMenuItem(ActionType.ZoomToHeight, true);
  68. this.menuEditSeparator2 = new ToolStripSeparator();
  69. this.menuImageCut = new PdnMenuItem(ActionType.ImageCut);
  70. this.menuLockZoom = new PdnMenuItem(ActionType.LockZoom);
  71. this.menuFixedMultiple = new PdnMenuItem(ActionType.FixedMultiple);
  72. //this.menuFixedMultiple.Visible = false;
  73. this.menuEditSeparator3 = new ToolStripSeparator();
  74. this.menuImageFlipHorizontal = new PdnMenuItem(ActionType.FlipHorizontal);
  75. this.menuImageFlipVertical = new PdnMenuItem(ActionType.FlipVertical);
  76. this.menuImageFlipCenter = new PdnMenuItem(ActionType.FlipCenter);
  77. this.menuEditSeparator4 = new ToolStripSeparator();
  78. this.menuImageRotate90CW = new PdnMenuItem(ActionType.Rotate90CW);
  79. this.menuImageRotate180 = new PdnMenuItem(ActionType.Rotate180);
  80. this.menuImageRotate90CCW = new PdnMenuItem(ActionType.Rotate90CCW);
  81. //
  82. // EditMenu
  83. //
  84. this.DropDownItems.AddRange(
  85. new ToolStripItem[]
  86. {
  87. this.menuEditUndo,
  88. this.menuEditRedo,
  89. this.menuEditCopy,
  90. this.menuEditPaste,
  91. this.menuEditDelete,
  92. this.menuEditSeparator1,
  93. this.menuViewZoomIn,
  94. this.menuViewZoomOut,
  95. this.menuViewActualSize,
  96. this.menuViewZoomToWindow,
  97. this.menuViewZoomToWidth,
  98. this.menuViewZoomToHeight,
  99. this.menuEditSeparator2,
  100. this.menuImageCut,
  101. this.menuLockZoom,
  102. this.menuFixedMultiple,
  103. this.menuEditSeparator3,
  104. this.menuImageFlipHorizontal,
  105. this.menuImageFlipVertical,
  106. this.menuImageFlipCenter,
  107. this.menuEditSeparator4,
  108. this.menuImageRotate90CW,
  109. this.menuImageRotate180,
  110. this.menuImageRotate90CCW
  111. }); ;
  112. this.Name = "Menu.Edit";
  113. this.Text = PdnResources.GetString("Menu.Edit.Text");
  114. //
  115. // 撤销
  116. //
  117. this.menuEditUndo.Click += new EventHandler(this.MenuEditUndo_Click);
  118. //
  119. // 恢复
  120. //
  121. this.menuEditRedo.Click += new EventHandler(this.MenuEditRedo_Click);
  122. //
  123. // 复制
  124. //
  125. this.menuEditCopy.Click += new EventHandler(this.MenuEditCopy_Click);
  126. //
  127. // 粘贴
  128. //
  129. this.menuEditPaste.Click += new EventHandler(this.MenuEditPaste_Click);
  130. //
  131. // 删除
  132. //
  133. this.menuEditDelete.Click += new EventHandler(this.MenuEditDelete_Click);
  134. //
  135. // 放大
  136. //
  137. this.menuViewZoomIn.ShortcutKeyDisplayString = PdnResources.GetString("Menu.View.ZoomIn.ShortcutKeyDisplayString");
  138. this.menuViewZoomIn.NeedWaitKey = true;
  139. this.menuViewZoomIn.Click += new EventHandler(this.MenuViewZoomIn_Click);
  140. //
  141. // 缩小
  142. //
  143. this.menuViewZoomOut.ShortcutKeyDisplayString = PdnResources.GetString("Menu.View.ZoomOut.ShortcutKeyDisplayString");
  144. this.menuViewZoomOut.NeedWaitKey = true;
  145. this.menuViewZoomOut.Click += new EventHandler(this.MenuViewZoomOut_Click);
  146. //
  147. // 实际大小
  148. //
  149. this.menuViewActualSize.NeedWaitKey = true;
  150. this.menuViewActualSize.Click += new EventHandler(this.MenuViewActualSize_Click);
  151. //
  152. // 合适大小
  153. //
  154. this.menuViewZoomToWindow.NeedWaitKey = true;
  155. this.menuViewZoomToWindow.Click += new EventHandler(this.MenuViewZoomToWindow_Click);
  156. //
  157. // 合适宽度
  158. //
  159. this.menuViewZoomToWidth.NeedWaitKey = true;
  160. this.menuViewZoomToWidth.Click += new EventHandler(this.MenuViewZoomToWidth_Click);
  161. //
  162. //
  163. // 合适高度
  164. this.menuViewZoomToHeight.NeedWaitKey = true;
  165. this.menuViewZoomToHeight.Click += new EventHandler(this.MenuViewZoomToHeight_Click);
  166. //
  167. // 图片裁剪
  168. //
  169. this.menuImageCut.NeedWaitKey = true;
  170. this.menuImageCut.Click += new EventHandler(this.MenuImageCut_Click);
  171. //
  172. // 锁定扩缩
  173. //
  174. this.menuLockZoom.Click += new EventHandler(this.MenuLockZoom_Click);
  175. //
  176. // 定倍显示
  177. //
  178. this.menuFixedMultiple.Click += new EventHandler(this.MenuFixedMultiple_Click);
  179. //
  180. // 水平翻转
  181. //
  182. this.menuImageFlipHorizontal.Click += new EventHandler(this.MenuImageFlipHorizontal_Click);
  183. //
  184. // 垂直翻转
  185. //
  186. this.menuImageFlipVertical.Click += new EventHandler(this.MenuImageFlipVertical_Click);
  187. //
  188. // 中心翻转
  189. //
  190. this.menuImageFlipCenter.Click += new EventHandler(this.MenuImageFlipCenter_Click);
  191. //
  192. // 旋转90度
  193. //
  194. this.menuImageRotate90CW.Click += new EventHandler(this.MenuImageRotate90_Click);
  195. //this.menuImageRotate90CW.ShortcutKeys = Keys.Control | Keys.J;
  196. //
  197. // 旋转180度
  198. //
  199. this.menuImageRotate180.Click += new EventHandler(this.MenuImageRotate180_Click);
  200. //this.menuImageRotate180.ShortcutKeys = Keys.Control | Keys.J;
  201. //
  202. // 旋转270度
  203. //
  204. this.menuImageRotate90CCW.Click += new EventHandler(this.MenuImageRotate270_Click);
  205. //this.menuImageRotate90CCW.ShortcutKeys = Keys.Control | Keys.J;
  206. //
  207. // 加载菜单的文字和icon
  208. //
  209. this.LoadNames(this.Name);
  210. this.LoadIcons();
  211. }
  212. protected override void OnDropDownOpening(EventArgs e)
  213. {
  214. this.menuViewActualSize.Checked = AppWorkspace.ActiveDocumentWorkspace != null ? AppWorkspace.ActiveDocumentWorkspace.ActualSize : false;
  215. this.menuViewZoomToWindow.Checked = AppWorkspace.ActiveDocumentWorkspace != null ? AppWorkspace.ActiveDocumentWorkspace.SuitableSize : false;
  216. this.menuViewZoomToWidth.Checked = AppWorkspace.ActiveDocumentWorkspace != null ? AppWorkspace.ActiveDocumentWorkspace.SuitableWidth : false;
  217. this.menuViewZoomToHeight.Checked = AppWorkspace.ActiveDocumentWorkspace != null ? AppWorkspace.ActiveDocumentWorkspace.SuitableHeight : false;
  218. this.menuLockZoom.Checked = AppWorkspace.ActiveDocumentWorkspace != null ? AppWorkspace.ActiveDocumentWorkspace.LockZoom : false;
  219. this.menuFixedMultiple.Checked = AppWorkspace.ActiveDocumentWorkspace != null ? AppWorkspace.ActiveDocumentWorkspace.FixedMultiple : false;
  220. if (AppWorkspace.ActiveDocumentWorkspace == null/* || AppWorkspace.ScriptRunning*/)
  221. {
  222. this.menuViewZoomToWindow.Enabled = false;
  223. this.menuViewActualSize.Enabled = false;
  224. this.menuEditCopy.Enabled = false;
  225. this.menuEditDelete.Enabled = false;
  226. this.menuLockZoom.Checked = false;
  227. this.menuFixedMultiple.Enabled = false;
  228. }
  229. else
  230. {
  231. this.menuViewZoomToWindow.Enabled = true;
  232. this.menuViewActualSize.Enabled = true;
  233. this.menuEditCopy.Enabled = true;
  234. this.menuEditDelete.Enabled = false;
  235. this.menuFixedMultiple.Enabled = true;
  236. }
  237. base.OnDropDownOpening(e);
  238. }
  239. /// <summary>
  240. /// 撤销
  241. /// </summary>
  242. /// <param name="sender"></param>
  243. /// <param name="e"></param>
  244. private void MenuEditUndo_Click(object sender, EventArgs e)
  245. {
  246. }
  247. /// <summary>
  248. /// 恢复
  249. /// </summary>
  250. /// <param name="sender"></param>
  251. /// <param name="e"></param>
  252. private void MenuEditRedo_Click(object sender, EventArgs e)
  253. {
  254. }
  255. /// <summary>
  256. /// 复制
  257. /// </summary>
  258. /// <param name="sender"></param>
  259. /// <param name="e"></param>
  260. private void MenuEditCopy_Click(object sender, EventArgs e)
  261. {
  262. }
  263. /// <summary>
  264. /// 粘贴
  265. /// </summary>
  266. /// <param name="sender"></param>
  267. /// <param name="e"></param>
  268. private void MenuEditPaste_Click(object sender, EventArgs e)
  269. {
  270. }
  271. /// <summary>
  272. /// 删除
  273. /// </summary>
  274. /// <param name="sender"></param>
  275. /// <param name="e"></param>
  276. private void MenuEditDelete_Click(object sender, EventArgs e)
  277. {
  278. }
  279. private void MenuViewZoomIn_Click(object sender, EventArgs e)
  280. {
  281. if (AppWorkspace.ActiveDocumentWorkspace != null)
  282. {
  283. AppWorkspace.ActiveDocumentWorkspace.ZoomIn();
  284. }
  285. }
  286. private void MenuViewZoomOut_Click(object sender, EventArgs e)
  287. {
  288. if (AppWorkspace.ActiveDocumentWorkspace != null)
  289. {
  290. AppWorkspace.ActiveDocumentWorkspace.ZoomOut();
  291. }
  292. }
  293. private void MenuViewActualSize_Click(object sender, EventArgs e)
  294. {
  295. if (AppWorkspace.ActiveDocumentWorkspace != null)
  296. {
  297. if (!AppWorkspace.ActiveDocumentWorkspace.ActualSize)
  298. {
  299. AppWorkspace.ActiveDocumentWorkspace.ActualSize = !AppWorkspace.ActiveDocumentWorkspace.ActualSize;
  300. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.ActualSize, "ActualSize");
  301. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.ActualSize, "ActualSize");
  302. this.menuViewActualSize.Checked = AppWorkspace.ActiveDocumentWorkspace.ActualSize;
  303. AppWorkspace.ActiveDocumentWorkspace.SuitableSize = false;
  304. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableSize, "ZoomToWindow");
  305. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableSize, "ZoomToWindow");
  306. this.menuViewZoomToWindow.Checked = AppWorkspace.ActiveDocumentWorkspace.SuitableSize;
  307. AppWorkspace.ActiveDocumentWorkspace.SuitableWidth = false;
  308. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableWidth, "ZoomToWidth");
  309. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableWidth, "ZoomToWidth");
  310. this.menuViewZoomToWidth.Checked = AppWorkspace.ActiveDocumentWorkspace.SuitableWidth;
  311. AppWorkspace.ActiveDocumentWorkspace.SuitableHeight = false;
  312. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableHeight, "ZoomToHeight");
  313. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableHeight, "ZoomToHeight");
  314. this.menuViewZoomToHeight.Checked = AppWorkspace.ActiveDocumentWorkspace.SuitableHeight;
  315. }
  316. else
  317. {
  318. AppWorkspace.ActiveDocumentWorkspace.ActualSize = !AppWorkspace.ActiveDocumentWorkspace.ActualSize;
  319. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.ActualSize, "ActualSize");
  320. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.ActualSize, "ActualSize");
  321. this.menuViewActualSize.Checked = AppWorkspace.ActiveDocumentWorkspace.ActualSize;
  322. this.AppWorkspace.UpdateBottomButtonSelectionStatus();
  323. }
  324. AppWorkspace.UpdateBottomButtonSelectionStatus();
  325. AppWorkspace.ActiveDocumentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
  326. AppWorkspace.ActiveDocumentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
  327. }
  328. }
  329. private void MenuViewZoomToWindow_Click(object sender, EventArgs e)
  330. {
  331. if (AppWorkspace.ActiveDocumentWorkspace != null)
  332. {
  333. if (!AppWorkspace.ActiveDocumentWorkspace.SuitableSize)
  334. {
  335. AppWorkspace.ActiveDocumentWorkspace.SuitableSize = !AppWorkspace.ActiveDocumentWorkspace.SuitableSize;
  336. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableSize, "ZoomToWindow");
  337. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableSize, "ZoomToWindow");
  338. this.menuViewZoomToWindow.Checked = AppWorkspace.ActiveDocumentWorkspace.SuitableSize;
  339. AppWorkspace.ActiveDocumentWorkspace.ActualSize = false;
  340. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.ActualSize, "ActualSize");
  341. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.ActualSize, "ActualSize");
  342. this.menuViewActualSize.Checked = AppWorkspace.ActiveDocumentWorkspace.ActualSize;
  343. AppWorkspace.ActiveDocumentWorkspace.SuitableWidth = false;
  344. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableWidth, "ZoomToWidth");
  345. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableWidth, "ZoomToWidth");
  346. this.menuViewZoomToWidth.Checked = AppWorkspace.ActiveDocumentWorkspace.SuitableWidth;
  347. AppWorkspace.ActiveDocumentWorkspace.SuitableHeight = false;
  348. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableHeight, "ZoomToHeight");
  349. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableHeight, "ZoomToHeight");
  350. this.menuViewZoomToHeight.Checked = AppWorkspace.ActiveDocumentWorkspace.SuitableHeight;
  351. this.AppWorkspace.UpdateBottomButtonSelectionStatus();
  352. }
  353. else
  354. {
  355. AppWorkspace.ActiveDocumentWorkspace.SuitableSize = !AppWorkspace.ActiveDocumentWorkspace.SuitableSize;
  356. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableSize, "ZoomToWindow");
  357. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableSize, "ZoomToWindow");
  358. this.menuViewZoomToWindow.Checked = AppWorkspace.ActiveDocumentWorkspace.SuitableSize;
  359. this.AppWorkspace.UpdateBottomButtonSelectionStatus();
  360. }
  361. AppWorkspace.UpdateBottomButtonSelectionStatus();
  362. AppWorkspace.ActiveDocumentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
  363. }
  364. }
  365. private void MenuViewZoomToWidth_Click(object sender, EventArgs e)
  366. {
  367. if (AppWorkspace.ActiveDocumentWorkspace != null)
  368. {
  369. if (!AppWorkspace.ActiveDocumentWorkspace.SuitableWidth)
  370. {
  371. AppWorkspace.ActiveDocumentWorkspace.SuitableWidth = !AppWorkspace.ActiveDocumentWorkspace.SuitableWidth;
  372. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableWidth, "ZoomToWidth");
  373. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableWidth, "ZoomToWidth");
  374. this.menuViewZoomToWidth.Checked = AppWorkspace.ActiveDocumentWorkspace.SuitableWidth;
  375. AppWorkspace.ActiveDocumentWorkspace.SuitableSize = false;
  376. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableSize, "ZoomToWindow");
  377. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableSize, "ZoomToWindow");
  378. this.menuViewZoomToWindow.Checked = AppWorkspace.ActiveDocumentWorkspace.SuitableSize;
  379. AppWorkspace.ActiveDocumentWorkspace.ActualSize = false;
  380. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.ActualSize, "ActualSize");
  381. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.ActualSize, "ActualSize");
  382. this.menuViewActualSize.Checked = AppWorkspace.ActiveDocumentWorkspace.ActualSize;
  383. AppWorkspace.ActiveDocumentWorkspace.SuitableHeight = false;
  384. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableHeight, "ZoomToHeight");
  385. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableHeight, "ZoomToHeight");
  386. this.menuViewZoomToHeight.Checked = AppWorkspace.ActiveDocumentWorkspace.SuitableHeight;
  387. this.AppWorkspace.UpdateBottomButtonSelectionStatus();
  388. }
  389. else
  390. {
  391. AppWorkspace.ActiveDocumentWorkspace.SuitableWidth = !AppWorkspace.ActiveDocumentWorkspace.SuitableWidth;
  392. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableWidth, "ZoomToWidth");
  393. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableWidth, "ZoomToWidth");
  394. this.menuViewZoomToWidth.Checked = AppWorkspace.ActiveDocumentWorkspace.SuitableWidth;
  395. this.AppWorkspace.UpdateBottomButtonSelectionStatus();
  396. }
  397. AppWorkspace.ActiveDocumentWorkspace.ZoomBasis = ZoomBasis.FitToWidth;
  398. }
  399. }
  400. private void MenuViewZoomToHeight_Click(object sender, EventArgs e)
  401. {
  402. if (AppWorkspace.ActiveDocumentWorkspace != null)
  403. {
  404. if (!AppWorkspace.ActiveDocumentWorkspace.SuitableHeight)
  405. {
  406. AppWorkspace.ActiveDocumentWorkspace.SuitableHeight = !AppWorkspace.ActiveDocumentWorkspace.SuitableHeight;
  407. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableHeight, "ZoomToHeight");
  408. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableHeight, "ZoomToHeight");
  409. this.menuViewZoomToHeight.Checked = AppWorkspace.ActiveDocumentWorkspace.SuitableHeight;
  410. AppWorkspace.ActiveDocumentWorkspace.SuitableWidth = false;
  411. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableWidth, "ZoomToWidth");
  412. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableWidth, "ZoomToWidth");
  413. this.menuViewZoomToWidth.Checked = AppWorkspace.ActiveDocumentWorkspace.SuitableWidth;
  414. AppWorkspace.ActiveDocumentWorkspace.SuitableSize = false;
  415. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableSize, "ZoomToWindow");
  416. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableSize, "ZoomToWindow");
  417. this.menuViewZoomToWindow.Checked = AppWorkspace.ActiveDocumentWorkspace.SuitableSize;
  418. AppWorkspace.ActiveDocumentWorkspace.ActualSize = false;
  419. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.ActualSize, "ActualSize");
  420. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.ActualSize, "ActualSize");
  421. this.menuViewActualSize.Checked = AppWorkspace.ActiveDocumentWorkspace.ActualSize;
  422. this.AppWorkspace.UpdateBottomButtonSelectionStatus();
  423. }
  424. else
  425. {
  426. AppWorkspace.ActiveDocumentWorkspace.SuitableHeight = !AppWorkspace.ActiveDocumentWorkspace.SuitableHeight;
  427. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableHeight, "ZoomToHeight");
  428. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.SuitableHeight, "ZoomToHeight");
  429. this.menuViewZoomToHeight.Checked = AppWorkspace.ActiveDocumentWorkspace.SuitableHeight;
  430. this.AppWorkspace.UpdateBottomButtonSelectionStatus();
  431. }
  432. AppWorkspace.ActiveDocumentWorkspace.ZoomBasis = ZoomBasis.FitToHeight;
  433. }
  434. }
  435. private void MenuImageCut_Click(object sender, EventArgs e)
  436. {
  437. }
  438. /// <summary>
  439. /// 锁定扩缩
  440. /// </summary>
  441. /// <param name="sender"></param>
  442. /// <param name="e"></param>
  443. private void MenuLockZoom_Click(object sender, EventArgs e)
  444. {
  445. if (AppWorkspace.ActiveDocumentWorkspace != null)
  446. {
  447. AppWorkspace.ActiveDocumentWorkspace.LockZoom = !AppWorkspace.ActiveDocumentWorkspace.LockZoom;
  448. this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.LockZoom, "LockZoom");
  449. this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.ActiveDocumentWorkspace.LockZoom, "LockZoom");
  450. this.menuLockZoom.Checked = !this.menuLockZoom.Checked;
  451. AppWorkspace.UpdateBottomButtonSelectionStatus();
  452. AppWorkspace.isLockZoom = this.menuLockZoom.Checked;
  453. AppWorkspace.lockScaleRatio = AppWorkspace.ActiveDocumentWorkspace.ScaleFactor.Ratio;
  454. }
  455. }
  456. /// <summary>
  457. /// 定倍显示
  458. /// </summary>
  459. /// <param name="sender"></param>
  460. /// <param name="e"></param>
  461. private void MenuFixedMultiple_Click(object sender, EventArgs e)
  462. {
  463. }
  464. /// <summary>
  465. /// 水平镜像
  466. /// </summary>
  467. /// <param name="sender"></param>
  468. /// <param name="e"></param>
  469. private void MenuImageFlipHorizontal_Click(object sender, EventArgs e)
  470. {
  471. }
  472. /// <summary>
  473. /// 垂直镜像
  474. /// </summary>
  475. /// <param name="sender"></param>
  476. /// <param name="e"></param>
  477. private void MenuImageFlipVertical_Click(object sender, EventArgs e)
  478. {
  479. }
  480. /// <summary>
  481. /// 中心镜像
  482. /// </summary>
  483. /// <param name="sender"></param>
  484. /// <param name="e"></param>
  485. private void MenuImageFlipCenter_Click(object sender, EventArgs e)
  486. {
  487. }
  488. /// <summary>
  489. /// 旋转90度
  490. /// </summary>
  491. /// <param name="sender"></param>
  492. /// <param name="e"></param>
  493. private void MenuImageRotate90_Click(object sender, EventArgs e)
  494. {
  495. }
  496. /// <summary>
  497. /// 旋转180度
  498. /// </summary>
  499. /// <param name="sender"></param>
  500. /// <param name="e"></param>
  501. private void MenuImageRotate180_Click(object sender, EventArgs e)
  502. {
  503. }
  504. /// <summary>
  505. /// 旋转270度
  506. /// </summary>
  507. /// <param name="sender"></param>
  508. /// <param name="e"></param>
  509. private void MenuImageRotate270_Click(object sender, EventArgs e)
  510. {
  511. }
  512. }
  513. }