Pastebin: コピー: 年足表示機能追加 MainFrame.cs 修正:20150222

Format
Plain text
Post date
2015-02-22 23:10
Période de publication
Illimité
  1. /*
  2. * Copyright (c) Daisuke OKAJIMA All rights reserved.
  3. *
  4. * $Id$
  5. */
  6. using System;
  7. using System.Diagnostics;
  8. using System.Drawing;
  9. using System.Collections;
  10. using System.ComponentModel;
  11. using System.Windows.Forms;
  12. using Zanetti.Forms;
  13. using Zanetti.Data;
  14. using Zanetti.DataSource;
  15. using Zanetti.Indicators;
  16. using Zanetti.Commands;
  17. using Zanetti.UI;
  18. using Crownwood.Magic.Common;
  19. using Crownwood.Magic.Controls;
  20. using Crownwood.Magic.Docking;
  21. namespace Zanetti.Forms
  22. {
  23. /// <summary>
  24. /// MainFrame の概要の説明です。
  25. /// </summary>
  26. internal class MainFrame : System.Windows.Forms.Form
  27. {
  28. private DockingManager _manager;
  29. private Content _bookmarkContent;
  30. private InitialAction _initialAction;
  31. private IZModelessForm _modelessDialog;
  32. private AsyncSchemaLoader _asyncLoader;
  33. private BrandListPane _currentBrandListPane;
  34. private System.Windows.Forms.MainMenu _mainMenu;
  35. private System.Windows.Forms.StatusBar _statusBar;
  36. private ChartCanvas _chartCanvas;
  37. private ZMainMenuItem _menuFile;
  38. private ZMenuItem _menuDownload;
  39. private ZMenuItem _menuMRUDownload;
  40. private ZMenuItem _menuBarFile1;
  41. private ZMenuItem _menuInitialize;
  42. private ZMenuItem _menuBarFile2;
  43. private ZMenuItem _menuPrint;
  44. private ZMenuItem _menuBarFile3;
  45. private ZMenuItem _menuExport;
  46. private ZMenuItem _menuExportHalfDaily;
  47. private ZMenuItem _menuDownloadIndexFile;
  48. private ZMenuItem _menuBarFile4;
  49. private ZMenuItem _menuQuit;
  50. private ZMainMenuItem _menuView;
  51. private ZMenuItem _menuHalfDaily;
  52. private ZMenuItem _menuDaily;
  53. private ZMenuItem _menuWeekly;
  54. private ZMenuItem _menuMonthly;
  55. private ZMenuItem _menuYearly;
  56. private ZMenuItem _menuBarView1;
  57. private ZMenuItem _menuJump;
  58. private ZMenuItem _menuJumpHome;
  59. private ZMenuItem _menuJumpEnd;
  60. private ZMenuItem _menuBarJump;
  61. private ZMenuItem _menuJumpPrev;
  62. private ZMenuItem _menuJumpNext;
  63. private ZMenuItem _menuBarView2;
  64. private ZMenuItem _menuBookmark;
  65. private ZMenuItem _menuAddBookmark;
  66. private ZMenuItem _menuBarView3;
  67. private ZMenuItem _menuClearFreeLines;
  68. private ZMenuItem _menuBarView4;
  69. private ZMenuItem _menuLinkToInfo;
  70. private ZMenuItem _menuLinkToYahoo;
  71. private ZMenuItem _menuLinkToNikkei;
  72. private ZMenuItem _menuLinkToInfoseek;
  73. private ZMenuItem _menuLinkToLivedoor;
  74. private ZMainMenuItem _menuMove;
  75. private ZMenuItem _menuBack;
  76. private ZMenuItem _menuFront;
  77. private ZMenuItem _menuBarMove1;
  78. private ZMenuItem _menuInputCode;
  79. private ZMenuItem _menuInputName;
  80. private ZMenuItem _menuIndices;
  81. private ZMenuItem _menuCommodities;
  82. private ZMenuItem _menuDerivedBrand;
  83. private ZMainMenuItem _menuTool;
  84. private ZMenuItem _menuStartScreening;
  85. private ZMenuItem _menuStartAutoTrading;
  86. private ZMenuItem _menuStartVerification;
  87. private ZMenuItem _menuBarTool1;
  88. private ZMenuItem _menuCustomize;
  89. private ZMenuItem _menuKeyConfig;
  90. private ZMenuItem _menuEnvironment;
  91. private ZMenuItem _menuBarTool2;
  92. private ZMenuItem _menuReloadExtensionKit;
  93. private ZMenuItem _menuListExtensionKit;
  94. private ZMenuItem _menuTestExtensionKit;
  95. private ZMainMenuItem _menuHelp;
  96. private ZMenuItem _menuOpenWeb;
  97. private ZMenuItem _menuRegisterCode;
  98. private ZMenuItem _menuBarHelp;
  99. private ZMenuItem _menuAboutBox;
  100. #if ENABLE_SUPPORT_COMMAND
  101. private ZMainMenuItem _menuSupport;
  102. private ZMenuItem _menuRebuildIndex;
  103. private ZMenuItem _menuCreateKey;
  104. //private ZMenuItem _menuSignKit;
  105. private ZMenuItem _menuReload;
  106. private ZMenuItem _menuCreateCert;
  107. private ZMenuItem _menuStatistics;
  108. private ZMenuItem _menuShrinkData;
  109. #endif
  110. /// <summary>
  111. /// 必要なデザイナ変数です。
  112. /// </summary>
  113. private System.ComponentModel.Container components = null;
  114. //Layout.Initの時点ではFrameにアクセスできないといけないので初期化を分離
  115. public MainFrame() {
  116. }
  117. public void Init() {
  118. Env.Layout.Init();
  119. _chartCanvas = new Zanetti.UI.ChartCanvas();
  120. _chartCanvas.Dock = System.Windows.Forms.DockStyle.Fill;
  121. //
  122. // Windows フォーム デザイナ サポートに必要です。
  123. //
  124. InitializeComponent();
  125. InitStatusBar();
  126. //
  127. // TODO: InitializeComponent 呼び出しの後に、コンストラクタ コードを追加してください。
  128. //
  129. AdjustShortcut();
  130. }
  131. public void WarmUpMagicLibrary() {
  132. Type m = typeof(DockingManager);
  133. }
  134. public InitialAction InitialAction {
  135. get {
  136. return _initialAction;
  137. }
  138. set {
  139. _initialAction = value;
  140. }
  141. }
  142. public DockingManager DockingManager {
  143. get {
  144. return _manager;
  145. }
  146. }
  147. public Content BookmarkPaneContent {
  148. get {
  149. return _bookmarkContent;
  150. }
  151. set {
  152. _bookmarkContent = value;
  153. }
  154. }
  155. public IZModelessForm CurrentModelessDialog {
  156. get {
  157. return _modelessDialog;
  158. }
  159. set {
  160. _modelessDialog = value;
  161. }
  162. }
  163. /// <summary>
  164. /// 使用されているリソースに後処理を実行します。
  165. /// </summary>
  166. protected override void Dispose( bool disposing )
  167. {
  168. if( disposing )
  169. {
  170. if(components != null)
  171. {
  172. components.Dispose();
  173. }
  174. }
  175. base.Dispose( disposing );
  176. }
  177. #region Windows フォーム デザイナで生成されたコード
  178. /// <summary>
  179. /// デザイナ サポートに必要なメソッドです。このメソッドの内容を
  180. /// コード エディタで変更しないでください。
  181. /// </summary>
  182. private void InitializeComponent()
  183. {
  184. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainFrame));
  185. this._mainMenu = new System.Windows.Forms.MainMenu();
  186. this._menuFile = new ZMainMenuItem();
  187. this._menuDownload = new ZMenuItem();
  188. this._menuBarFile1 = new ZMenuItem();
  189. this._menuInitialize = new ZMenuItem();
  190. this._menuMRUDownload = new ZMenuItem();
  191. this._menuBarFile2 = new ZMenuItem();
  192. this._menuPrint = new ZMenuItem();
  193. this._menuBarFile3 = new ZMenuItem();
  194. this._menuExport = new ZMenuItem();
  195. this._menuExportHalfDaily = new ZMenuItem();
  196. this._menuDownloadIndexFile = new ZMenuItem();
  197. this._menuBarFile4 = new ZMenuItem();
  198. this._menuQuit = new ZMenuItem();
  199. this._menuView = new ZMainMenuItem();
  200. this._menuHalfDaily = new ZMenuItem();
  201. this._menuDaily = new ZMenuItem();
  202. this._menuWeekly = new ZMenuItem();
  203. this._menuMonthly = new ZMenuItem();
  204. this._menuYearly = new ZMenuItem();
  205. this._menuBarView1 = new ZMenuItem();
  206. this._menuJump = new ZMenuItem();
  207. this._menuJumpHome = new ZMenuItem();
  208. this._menuJumpEnd = new ZMenuItem();
  209. this._menuBarJump = new ZMenuItem();
  210. this._menuJumpPrev = new ZMenuItem();
  211. this._menuJumpNext = new ZMenuItem();
  212. this._menuBarView2 = new ZMenuItem();
  213. this._menuBookmark = new ZMenuItem();
  214. this._menuAddBookmark = new ZMenuItem();
  215. this._menuBarView3 = new ZMenuItem();
  216. this._menuClearFreeLines = new ZMenuItem();
  217. this._menuBarView4 = new ZMenuItem();
  218. this._menuLinkToInfo = new ZMenuItem();
  219. this._menuLinkToYahoo = new ZMenuItem();
  220. this._menuLinkToInfoseek = new ZMenuItem();
  221. this._menuLinkToNikkei = new ZMenuItem();
  222. this._menuLinkToLivedoor = new ZMenuItem();
  223. this._menuMove = new ZMainMenuItem();
  224. this._menuBack = new ZMenuItem();
  225. this._menuFront = new ZMenuItem();
  226. this._menuBarMove1 = new ZMenuItem();
  227. this._menuInputCode = new ZMenuItem();
  228. this._menuInputName = new ZMenuItem();
  229. this._menuIndices = new ZMenuItem();
  230. this._menuCommodities = new ZMenuItem();
  231. this._menuDerivedBrand = new ZMenuItem();
  232. this._menuTool = new ZMainMenuItem();
  233. this._menuStartScreening = new ZMenuItem();
  234. this._menuStartAutoTrading = new ZMenuItem();
  235. this._menuStartVerification = new ZMenuItem();
  236. this._menuBarTool1 = new ZMenuItem();
  237. this._menuCustomize = new ZMenuItem();
  238. this._menuKeyConfig = new ZMenuItem();
  239. this._menuEnvironment = new ZMenuItem();
  240. this._menuBarTool2 = new ZMenuItem();
  241. this._menuReloadExtensionKit = new ZMenuItem();
  242. this._menuListExtensionKit = new ZMenuItem();
  243. this._menuTestExtensionKit = new ZMenuItem();
  244. this._menuHelp = new ZMainMenuItem();
  245. this._menuOpenWeb = new ZMenuItem();
  246. this._menuRegisterCode = new ZMenuItem();
  247. this._menuBarHelp = new ZMenuItem();
  248. this._menuAboutBox = new ZMenuItem();
  249. #if ENABLE_SUPPORT_COMMAND
  250. this._menuSupport = new ZMainMenuItem();
  251. this._menuRebuildIndex = new ZMenuItem();
  252. this._menuCreateKey = new ZMenuItem();
  253. this._menuReload = new ZMenuItem();
  254. this._menuStatistics = new ZMenuItem();
  255. this._menuCreateCert = new ZMenuItem();
  256. this._menuShrinkData = new ZMenuItem();
  257. #endif
  258. this._statusBar = new System.Windows.Forms.StatusBar();
  259. this.SuspendLayout();
  260. //
  261. // _mainMenu
  262. //
  263. this._mainMenu.MenuItems.AddRange(new ZMainMenuItem[] {
  264. this._menuFile,
  265. this._menuView,
  266. this._menuMove,
  267. this._menuTool,
  268. this._menuHelp,
  269. #if ENABLE_SUPPORT_COMMAND
  270. this._menuSupport
  271. #endif
  272. });
  273. //
  274. // _menuFile
  275. //
  276. this._menuFile.Index = 0;
  277. this._menuFile.MenuItems.AddRange(new ZMenuItem[] {
  278. this._menuDownload,
  279. this._menuMRUDownload,
  280. this._menuBarFile1,
  281. this._menuInitialize,
  282. this._menuBarFile2,
  283. this._menuPrint,
  284. this._menuBarFile3,
  285. this._menuExport,
  286. this._menuExportHalfDaily,
  287. this._menuDownloadIndexFile,
  288. this._menuBarFile4,
  289. this._menuQuit});
  290. this._menuFile.Text = "ファイル(&F)";
  291. this._menuFile.Popup += new System.EventHandler(this.OnAdjustFileMenu);
  292. //
  293. // _menuDownload
  294. //
  295. this._menuDownload.Index = 0;
  296. this._menuDownload.Text = "データのダウンロード(&D)...";
  297. this._menuDownload.Click += new System.EventHandler(this.OnMenu);
  298. this._menuDownload.CID = CID.ShowDownloadDialog;
  299. //
  300. // _menuMRUDownload
  301. //
  302. this._menuMRUDownload.Index = 1;
  303. this._menuMRUDownload.Text = "保存した設定でダウンロード(&S)";
  304. //
  305. // _menuBarFile1
  306. //
  307. this._menuBarFile1.Index = 2;
  308. this._menuBarFile1.Text = "-";
  309. //
  310. // _menuInitialize
  311. //
  312. this._menuInitialize.Index = 3;
  313. this._menuInitialize.Text = "データの初期化(&I)...";
  314. this._menuInitialize.Click += new System.EventHandler(this.OnMenu);
  315. this._menuInitialize.CID = CID.ShowInitializeDialog;
  316. //
  317. // _menuBarFile2
  318. //
  319. this._menuBarFile2.Index = 4;
  320. this._menuBarFile2.Text = "-";
  321. //
  322. // _menuPrint
  323. //
  324. this._menuPrint.Index = 5;
  325. this._menuPrint.Text = "印刷(&P)...";
  326. this._menuPrint.Click += new System.EventHandler(this.OnMenu);
  327. this._menuPrint.CID = CID.ShowPrintDialog;
  328. //
  329. // _menuBarFile3
  330. //
  331. this._menuBarFile3.Index = 6;
  332. this._menuBarFile3.Text = "-";
  333. //
  334. // _menuExport
  335. //
  336. this._menuExport.Index = 7;
  337. this._menuExport.Text = "データのエクスポート(&E)...";
  338. this._menuExport.Click += new System.EventHandler(this.OnMenu);
  339. this._menuExport.CID = CID.ExportBrand;
  340. //
  341. // _menuExportHalfDaily
  342. //
  343. this._menuExportHalfDaily.Index = 8;
  344. this._menuExportHalfDaily.Text = "半日足のエクスポート(&H)...";
  345. this._menuExportHalfDaily.Click += new System.EventHandler(this.OnMenu);
  346. this._menuExportHalfDaily.CID = CID.ExportHalfDaily;
  347. this._menuExportHalfDaily.Visible = false;
  348. //
  349. // _menuDownloadIndexFile
  350. //
  351. this._menuDownloadIndexFile.Index = 9;
  352. this._menuDownloadIndexFile.Text = "インデックスファイルのダウンロード(&I)";
  353. this._menuDownloadIndexFile.Click += new System.EventHandler(this.OnMenu);
  354. this._menuDownloadIndexFile.CID = CID.DownloadIndexFile;
  355. //
  356. // _menuBarFile4
  357. //
  358. this._menuBarFile4.Index = 10;
  359. this._menuBarFile4.Text = "-";
  360. //
  361. // _menuQuit
  362. //
  363. this._menuQuit.Index = 11;
  364. this._menuQuit.Text = "終了(&X)";
  365. this._menuQuit.Click += new System.EventHandler(this.OnMenu);
  366. this._menuQuit.CID = CID.Quit;
  367. //
  368. // _menuView
  369. //
  370. this._menuView.Index = 1;
  371. this._menuView.MenuItems.AddRange(new ZMenuItem[] {
  372. this._menuHalfDaily,
  373. this._menuDaily,
  374. this._menuWeekly,
  375. this._menuMonthly,
  376. this._menuYearly,
  377. this._menuBarView1,
  378. this._menuBookmark,
  379. this._menuAddBookmark,
  380. this._menuBarView2,
  381. this._menuClearFreeLines,
  382. this._menuBarView3,
  383. this._menuLinkToInfo});
  384. this._menuView.Text = "表示(&V)";
  385. this._menuView.Popup += new System.EventHandler(this.OnAdjustViewMenu);
  386. //
  387. // _menuHalfDaily
  388. //
  389. this._menuHalfDaily.Index = 0;
  390. this._menuHalfDaily.Visible = false;
  391. this._menuHalfDaily.Text = "半日足(&H)";
  392. this._menuHalfDaily.Click += new System.EventHandler(this.OnMenu);
  393. this._menuHalfDaily.CID = CID.SetStyleHalfDaily;
  394. //
  395. // _menuDaily
  396. //
  397. this._menuDaily.Index = 1;
  398. this._menuDaily.Text = "日足(&D)";
  399. this._menuDaily.Click += new System.EventHandler(this.OnMenu);
  400. this._menuDaily.CID = CID.SetStyleDaily;
  401. //
  402. // _menuWeekly
  403. //
  404. this._menuWeekly.Index = 2;
  405. this._menuWeekly.Text = "週足(&W)";
  406. this._menuWeekly.Click += new System.EventHandler(this.OnMenu);
  407. this._menuWeekly.CID = CID.SetStyleWeekly;
  408. //
  409. // _menuMonthly
  410. //
  411. this._menuMonthly.Index = 3;
  412. this._menuMonthly.Text = "月足(&M)";
  413. this._menuMonthly.Click += new System.EventHandler(this.OnMenu);
  414. this._menuMonthly.CID = CID.SetStyleMonthly;
  415. //
  416. // _menuMonthly
  417. //
  418. this._menuYearly.Index = 4;
  419. this._menuYearly.Text = "年足(&Y)";
  420. this._menuYearly.Click += new System.EventHandler(this.OnMenu);
  421. this._menuYearly.CID = CID.SetStyleYearly;
  422. //
  423. // _menuBarView1
  424. //
  425. this._menuBarView1.Index = 5;
  426. this._menuBarView1.Text = "-";
  427. //
  428. // _menuBookmark
  429. //
  430. this._menuBookmark.Index = 6;
  431. this._menuBookmark.Text = "お気に入りの表示(&B)";
  432. this._menuBookmark.Click += new System.EventHandler(this.OnMenu);
  433. this._menuBookmark.CID = CID.ToggleBookmarkPane;
  434. //
  435. // _menuAddBookmark
  436. //
  437. this._menuAddBookmark.Index = 7;
  438. this._menuAddBookmark.Text = "お気に入りへ追加(&A)...";
  439. this._menuAddBookmark.Click += new System.EventHandler(this.OnMenu);
  440. this._menuAddBookmark.CID = CID.ShowAddBookmarkDialog;
  441. //
  442. // _menuBarView2
  443. //
  444. this._menuBarView2.Index = 8;
  445. this._menuBarView2.Text = "-";
  446. //
  447. // _menuClearFreeLines
  448. //
  449. this._menuClearFreeLines.Index = 9;
  450. this._menuClearFreeLines.Text = "自由直線のクリア(&C)";
  451. this._menuClearFreeLines.Click += new System.EventHandler(this.OnMenu);
  452. this._menuClearFreeLines.CID = CID.ClearFreeLines;
  453. //
  454. // _menuBarView5
  455. //
  456. this._menuBarView3.Index = 10;
  457. this._menuBarView3.Text = "-";
  458. //
  459. // _menuLinkToInfo
  460. //
  461. this._menuLinkToInfo.Index = 11;
  462. this._menuLinkToInfo.MenuItems.AddRange(new ZMenuItem[] {
  463. this._menuLinkToYahoo,
  464. this._menuLinkToInfoseek,
  465. this._menuLinkToNikkei,
  466. this._menuLinkToLivedoor});
  467. this._menuLinkToInfo.Text = "企業情報へのリンク(&L)";
  468. //
  469. // _menuLinkToYahoo
  470. //
  471. this._menuLinkToYahoo.Index = 0;
  472. this._menuLinkToYahoo.Text = "Yahoo(&Y)";
  473. this._menuLinkToYahoo.Click += new System.EventHandler(this.OnMenu);
  474. this._menuLinkToYahoo.CID = CID.OpenCompanyInfoSite_Yahoo;
  475. //
  476. // _menuLinkToInfoseek
  477. //
  478. this._menuLinkToInfoseek.Index = 1;
  479. this._menuLinkToInfoseek.Text = "Infoseek(&I)";
  480. this._menuLinkToInfoseek.Click += new System.EventHandler(this.OnMenu);
  481. this._menuLinkToInfoseek.CID = CID.OpenCompanyInfoSite_Infoseek;
  482. //
  483. // _menuLinkToNikkei
  484. //
  485. this._menuLinkToNikkei.Index = 2;
  486. this._menuLinkToNikkei.Text = "日経新聞(&N)";
  487. this._menuLinkToNikkei.Click += new System.EventHandler(this.OnMenu);
  488. this._menuLinkToNikkei.CID = CID.OpenCompanyInfoSite_Nikkei;
  489. //
  490. // _menuLinkToLivedoor
  491. //
  492. this._menuLinkToLivedoor.Index = 3;
  493. this._menuLinkToLivedoor.Text = "livedoor(&L)";
  494. this._menuLinkToLivedoor.Click += new System.EventHandler(this.OnMenu);
  495. this._menuLinkToLivedoor.CID = CID.OpenCompanyInfoSite_Livedoor;
  496. //
  497. // _menuMove
  498. //
  499. this._menuMove.Index = 2;
  500. this._menuMove.MenuItems.AddRange(new ZMenuItem[] {
  501. this._menuBack,
  502. this._menuFront,
  503. this._menuBarMove1,
  504. this._menuInputCode,
  505. this._menuInputName,
  506. this._menuIndices,
  507. this._menuCommodities,
  508. this._menuDerivedBrand
  509. });
  510. this._menuMove.Text = "移動(&M)";
  511. this._menuMove.Popup += new System.EventHandler(this.OnAdjustMoveMenu);
  512. //
  513. // _menuBack
  514. //
  515. this._menuBack.Index = 0;
  516. this._menuBack.Text = "戻る(&B)";
  517. this._menuBack.Click += new System.EventHandler(this.OnMenu);
  518. this._menuBack.CID = CID.Back;
  519. //
  520. // _menuFront
  521. //
  522. this._menuFront.Index = 1;
  523. this._menuFront.Text = "進む(&F)";
  524. this._menuFront.Click += new System.EventHandler(this.OnMenu);
  525. this._menuFront.CID = CID.Front;
  526. //
  527. // _menuBarTool1
  528. //
  529. this._menuBarMove1.Index = 2;
  530. this._menuBarMove1.Text = "-";
  531. //
  532. // _menuInputCode
  533. //
  534. this._menuInputCode.Index = 3;
  535. this._menuInputCode.Text = "銘柄コードを指定(&C)...";
  536. this._menuInputCode.Click += new System.EventHandler(this.OnMenu);
  537. this._menuInputCode.CID = CID.ShowInputCode;
  538. //
  539. // _menuInputName
  540. //
  541. this._menuInputName.Index = 4;
  542. this._menuInputName.Text = "名前から検索(&S)...";
  543. this._menuInputName.Click += new System.EventHandler(this.OnMenu);
  544. this._menuInputName.CID = CID.ShowSearchBrandDialog;
  545. //
  546. // _menuIndices
  547. //
  548. this._menuIndices.Index = 5;
  549. this._menuIndices.Text = "指数・為替(&I)";
  550. //
  551. // _menuCommodities
  552. //
  553. this._menuCommodities.Index = 6;
  554. this._menuCommodities.Visible = false;
  555. this._menuCommodities.Text = "商品先物(&O)";
  556. //
  557. // _menuDerivedBrand
  558. //
  559. this._menuDerivedBrand.Index = 7;
  560. this._menuDerivedBrand.Text = "派生銘柄(&U)";
  561. //
  562. // _menuTool
  563. //
  564. this._menuTool.Index = 3;
  565. this._menuTool.MenuItems.AddRange(new ZMenuItem[] {
  566. this._menuStartScreening,
  567. this._menuStartAutoTrading,
  568. this._menuStartVerification,
  569. this._menuBarTool1,
  570. this._menuCustomize,
  571. this._menuKeyConfig,
  572. this._menuEnvironment,
  573. this._menuBarTool2,
  574. this._menuReloadExtensionKit,
  575. this._menuListExtensionKit,
  576. this._menuTestExtensionKit});
  577. this._menuTool.Text = "ツール(&T)";
  578. //
  579. // _menuStartScreening
  580. //
  581. this._menuStartScreening.Index = 0;
  582. this._menuStartScreening.Text = "スクリーニング(&S)...";
  583. this._menuStartScreening.Click += new System.EventHandler(this.OnMenu);
  584. this._menuStartScreening.CID = CID.ShowScreeningDialog;
  585. //
  586. // _menuStartAutoTrading
  587. //
  588. this._menuStartAutoTrading.Index = 1;
  589. this._menuStartAutoTrading.Text = "自動売買検証(&U)...";
  590. this._menuStartAutoTrading.Click += new System.EventHandler(this.OnMenu);
  591. this._menuStartAutoTrading.CID = CID.ShowAutoTradingDialog;
  592. //
  593. // _menuStartVerification
  594. //
  595. this._menuStartVerification.Index = 2;
  596. this._menuStartVerification.Text = "セオリー検証(&V)...";
  597. this._menuStartVerification.Click += new System.EventHandler(this.OnMenu);
  598. this._menuStartVerification.CID = CID.ShowPredictionDialog;
  599. //
  600. // _menuBarTool1
  601. //
  602. this._menuBarTool1.Index = 3;
  603. this._menuBarTool1.Text = "-";
  604. //
  605. // _menuCustomize
  606. //
  607. this._menuCustomize.Index = 4;
  608. this._menuCustomize.Text = "カスタマイズ(&C)...";
  609. this._menuCustomize.Click += new System.EventHandler(this.OnMenu);
  610. this._menuCustomize.CID = CID.ShowCustomizeDialog;
  611. //
  612. // _menuKeyConfig
  613. //
  614. this._menuKeyConfig.Index = 5;
  615. this._menuKeyConfig.Text = "キー割り当て(&A)...";
  616. this._menuKeyConfig.Click += new System.EventHandler(this.OnMenu);
  617. this._menuKeyConfig.CID = CID.ShowKeyConfigDialog;
  618. //
  619. // _menuEnvironment
  620. //
  621. this._menuEnvironment.Index = 6;
  622. this._menuEnvironment.Text = "環境設定(&E)...";
  623. this._menuEnvironment.Click += new System.EventHandler(this.OnMenu);
  624. this._menuEnvironment.CID = CID.ShowEnvironmentDialog;
  625. //
  626. // _menuBarTool2
  627. //
  628. this._menuBarTool2.Index = 7;
  629. this._menuBarTool2.Text = "-";
  630. //
  631. // _menuReloadExtensionKit
  632. //
  633. this._menuReloadExtensionKit.Index = 8;
  634. this._menuReloadExtensionKit.Text = "拡張キットのリロード(&R)";
  635. this._menuReloadExtensionKit.Click += new System.EventHandler(this.OnMenu);
  636. this._menuReloadExtensionKit.CID = CID.ReloadKit;
  637. //
  638. // _menuListExtensionKit
  639. //
  640. this._menuListExtensionKit.Index = 9;
  641. this._menuListExtensionKit.Text = "拡張キットの一覧(&K)...";
  642. this._menuListExtensionKit.Click += new System.EventHandler(this.OnMenu);
  643. this._menuListExtensionKit.CID = CID.ShowExtensionKitDialog;
  644. //
  645. // _menuTestExtensionKit
  646. //
  647. this._menuTestExtensionKit.Index = 10;
  648. this._menuTestExtensionKit.Text = "拡張キットのテスト(&T)...";
  649. this._menuTestExtensionKit.Click += new System.EventHandler(this.OnMenu);
  650. this._menuTestExtensionKit.CID = CID.ShowTestKitDialog;
  651. //
  652. // _menuHelp
  653. //
  654. this._menuHelp.Index = 4;
  655. this._menuHelp.MenuItems.AddRange(new ZMenuItem[] {
  656. this._menuOpenWeb,
  657. this._menuRegisterCode,
  658. this._menuBarHelp,
  659. this._menuAboutBox});
  660. this._menuHelp.Text = "ヘルプ(&H)";
  661. //
  662. // _menuOpenWeb
  663. //
  664. this._menuOpenWeb.Index = 0;
  665. this._menuOpenWeb.Text = "OmegaChartのWebを開く(&W)";
  666. this._menuOpenWeb.Click += new System.EventHandler(this.OnMenu);
  667. this._menuOpenWeb.CID = CID.OpenWeb;
  668. //
  669. // _menuRegistCode
  670. //
  671. this._menuRegisterCode.Index = 1;
  672. this._menuRegisterCode.Text = "Contribution Certificate登録(&R)...";
  673. this._menuRegisterCode.Click += new System.EventHandler(this.OnMenu);
  674. this._menuRegisterCode.CID = CID.RegisterUserCode;
  675. //
  676. // _menuBarHelp
  677. //
  678. this._menuBarHelp.Index = 2;
  679. this._menuBarHelp.Text = "-";
  680. //
  681. // _menuAboutBox
  682. //
  683. this._menuAboutBox.Index = 3;
  684. this._menuAboutBox.Text = "バージョン情報(&A)...";
  685. this._menuAboutBox.Click += new System.EventHandler(this.OnMenu);
  686. this._menuAboutBox.CID = CID.ShowAboutBox;
  687. #if ENABLE_SUPPORT_COMMAND
  688. //
  689. // _menuSupport
  690. //
  691. this._menuSupport.Index = 5;
  692. this._menuSupport.MenuItems.AddRange(new ZMenuItem[] {
  693. this._menuRebuildIndex,
  694. this._menuCreateKey,
  695. this._menuReload,
  696. this._menuCreateCert,
  697. this._menuStatistics,
  698. this._menuShrinkData
  699. });
  700. this._menuSupport.Text = "サポート";
  701. //
  702. // _menuRebuildIndex
  703. //
  704. this._menuRebuildIndex.Index = 0;
  705. this._menuRebuildIndex.Text = "インデックス再構築";
  706. this._menuRebuildIndex.Click += new System.EventHandler(this.OnMenu);
  707. this._menuRebuildIndex.CID = CID.SupRebuildIndex;
  708. //
  709. // _menuCreateKey
  710. //
  711. this._menuCreateKey.Index = 1;
  712. this._menuCreateKey.Text = "鍵の作成(既存の鍵は消える)";
  713. this._menuCreateKey.Click += new System.EventHandler(this.OnMenu);
  714. this._menuCreateKey.CID = CID.SupCreateKey;
  715. //
  716. // _menuReload
  717. //
  718. this._menuReload.Index = 2;
  719. this._menuReload.Text = "Reload";
  720. this._menuReload.Click += new System.EventHandler(this.OnMenu);
  721. this._menuReload.CID = CID.SupReload;
  722. //
  723. // _menuCreateCert
  724. //
  725. this._menuCreateCert.Index = 3;
  726. this._menuCreateCert.Text = "Certificate生成";
  727. this._menuCreateCert.Click += new System.EventHandler(this.OnMenu);
  728. this._menuCreateCert.CID = CID.SupCreateCert;
  729. //
  730. // _menuStatistics
  731. //
  732. this._menuStatistics.Index = 4;
  733. this._menuStatistics.Text = "Statistics";
  734. this._menuStatistics.Click += new System.EventHandler(this.OnMenu);
  735. this._menuStatistics.CID = CID.SupStatistics;
  736. //
  737. // _menuShrinkData
  738. //
  739. this._menuShrinkData.Index = 4;
  740. this._menuShrinkData.Text = "データ縮小";
  741. this._menuShrinkData.Click += new System.EventHandler(this.OnMenu);
  742. this._menuShrinkData.CID = CID.SupShrinkData;
  743. #endif
  744. //
  745. // _statusBar
  746. //
  747. this._statusBar.Location = new System.Drawing.Point(0, 213);
  748. this._statusBar.Name = "_statusBar";
  749. this._statusBar.Size = new System.Drawing.Size(292, 22);
  750. this._statusBar.TabIndex = 0;
  751. this._statusBar.DoubleClick += new System.EventHandler(this.OnStatusBarDoubleClicked);
  752. //
  753. // MainFrame
  754. //
  755. this.Controls.Add(this._chartCanvas);
  756. this.Controls.Add(this._statusBar);
  757. this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  758. this.Menu = this._mainMenu;
  759. this.Name = "MainFrame";
  760. this.Text = Env.Constants.AppTitle;
  761. this.ImeMode = ImeMode.Disable;
  762. this.ResumeLayout(false);
  763. }
  764. #endregion
  765. public ChartCanvas ChartCanvas {
  766. get {
  767. return _chartCanvas;
  768. }
  769. }
  770. public BrandListPane CurrentBrandListPane {
  771. get {
  772. return _currentBrandListPane;
  773. }
  774. set {
  775. _currentBrandListPane = value;
  776. }
  777. }
  778. private void InitMenus() {
  779. //MRU
  780. InitMRUDownloadMenu();
  781. //指標を追加
  782. AddIndexMenu(BuiltInIndex.Nikkei225);
  783. AddIndexMenu(BuiltInIndex.TOPIX);
  784. AddIndexMenu(BuiltInIndex.JASDAQ);
  785. //AddIndexMenu(BuiltInIndex.LONGTERM_INTEREST); DreamVisor
  786. AddIndexMenu(BuiltInIndex.Nikkei225_F);
  787. AddIndexMenu(BuiltInIndex.TOPIX_F);
  788. Util.AddMenuBar(_menuIndices);
  789. AddIndexMenu(BuiltInIndex.JPYUSD);
  790. AddIndexMenu(BuiltInIndex.JPYEUR);
  791. Util.AddMenuBar(_menuIndices);
  792. AddIndexMenu(BuiltInIndex.Dow);
  793. AddIndexMenu(BuiltInIndex.Nasdaq);
  794. AddIndexMenu(BuiltInIndex.SP500);
  795. Util.AddMenuBar(_menuIndices);
  796. MenuItem sectors = new ZMenuItem();
  797. sectors.Text = "業種別(&S)";
  798. _menuIndices.MenuItems.Add(sectors);
  799. for(int i=(int)BuiltInIndexGroup.SectorIndexStart; i<=(int)BuiltInIndexGroup.SectorIndexEnd; i++)
  800. AddBrandMenu(sectors, Env.BrandCollection.FindBrand(i));
  801. #if DOJIMA
  802. for(int i=CommodityUtil.INDEX_START; i<=CommodityUtil.INDEX_END; i++)
  803. AddBrandMenu(_menuCommodities, Env.BrandCollection.FindBrand(i));
  804. _menuCommodities.Visible = true;
  805. _menuHalfDaily.Visible = true;
  806. _menuExportHalfDaily.Visible = true;
  807. _menuOpenWeb.Visible = false;
  808. _menuRegisterCode.Visible = false;
  809. _menuBarHelp.Visible = false;
  810. #endif
  811. ArrayList derived = Env.BrandCollection.DerivedBrands;
  812. if(derived.Count>0) {
  813. foreach(DerivedBrand br in derived)
  814. AddBrandMenu(_menuDerivedBrand, br);
  815. }
  816. }
  817. private void AddIndexMenu(BuiltInIndex mi) {
  818. AbstractBrand br = Env.BrandCollection.FindBrand((int)mi);
  819. AddBrandMenu(_menuIndices, br);
  820. }
  821. private void AddBrandMenu(Menu parent, AbstractBrand br) {
  822. ZMenuItem menu = new ZMenuItem();
  823. menu.Text = String.Format("{0}:{1}", br.CodeAsString, br.Name.Replace("&", "&&"));
  824. menu.Index = _menuIndices.MenuItems.Count;
  825. menu.Click += new EventHandler(OnMenu);
  826. menu.CID = CID.ShowSpecifiedBrand;
  827. parent.MenuItems.Add(menu);
  828. }
  829. public void InitMRUDownloadMenu() {
  830. _menuMRUDownload.MenuItems.Clear();
  831. bool mru_found = false;
  832. for(int i=0; i<Env.Options.DownloadOrders.Count; i++) {
  833. DownloadOrder o = Env.Options.DownloadOrders[i];
  834. ZMenuItem mi = new ZMenuItem();
  835. mi.Text = String.Format("&{0} {1}", i+1, Env.Options.DownloadOrders.GetDescription(i));
  836. mi.Enabled = o!=null;
  837. mi.Click += new EventHandler(OnMRUDownloadOrder);
  838. _menuMRUDownload.MenuItems.Add(mi);
  839. mru_found = true;
  840. }
  841. _menuMRUDownload.Enabled = mru_found;
  842. }
  843. private void OnMRUDownloadOrder(object sender, EventArgs args) {
  844. DownloadOrder o = Env.Options.DownloadOrders[((MenuItem)sender).Index];
  845. Debug.Assert(o!=null);
  846. CommandExec.ShowDownloadDialog(o);
  847. }
  848. private void InitStatusBar() {
  849. StatusBarPanel mp = new StatusBarPanel();
  850. mp.Style = StatusBarPanelStyle.Text;
  851. mp.AutoSize = StatusBarPanelAutoSize.Spring;
  852. _statusBar.ShowPanels = true;
  853. _statusBar.Panels.Add(mp);
  854. }
  855. public void SetStatusBarText(string text, string tooltip) {
  856. _statusBar.Panels[0].Text = text;
  857. _statusBar.Panels[0].ToolTipText = tooltip;
  858. }
  859. private void OnStatusBarDoubleClicked(object sender, EventArgs args) {
  860. if(_modelessDialog!=null) {
  861. _modelessDialog.ZShow();
  862. SetStatusBarText("", "");
  863. }
  864. }
  865. public void AdjustShortcut() {
  866. foreach(MenuItem mi in this._mainMenu.MenuItems)
  867. AdjustShortcut(mi);
  868. }
  869. private void AdjustShortcut(MenuItem mi) {
  870. ZMenuItem zmi = mi as ZMenuItem;
  871. if(zmi!=null && zmi.CID!=CID.None)
  872. zmi.ShortcutKey = Env.Command.Get(zmi.CID).Shortcut;
  873. foreach(MenuItem ch in mi.MenuItems)
  874. AdjustShortcut(ch);
  875. }
  876. public bool IsBookmarkPaneVisible {
  877. get {
  878. return _bookmarkContent!=null && _bookmarkContent.Visible;
  879. }
  880. }
  881. private void OnMenu(object sender, EventArgs args) {
  882. try {
  883. if(_asyncLoader!=null) return; //ロード中はメニュー起動しない
  884. ZMenuItem mi = (ZMenuItem)sender;
  885. if(mi.CID==CID.ShowInputCode)
  886. CommandExec.PromptInputCode(true, '\0');
  887. else if(mi.CID==CID.ShowSpecifiedBrand)
  888. CommandExec.ShowBrand(Env.BrandCollection.FindBrand(MenuItemToCode(mi)));
  889. else if(mi.CID!=CID.None)
  890. Env.Command.Exec(mi.CID);
  891. else
  892. Util.Warning(this, "NOT IMPLEMENTED YET!");
  893. }
  894. catch(Exception ex) {
  895. Util.ReportCriticalError(ex);
  896. }
  897. }
  898. private void OnAdjustViewMenu(object sender, EventArgs args) {
  899. AdjustViewMenu(_menuView);
  900. }
  901. private void OnAdjustMoveMenu(object sender, EventArgs args) {
  902. _menuBack.Enabled = Env.BrandHistory.HasBack;
  903. _menuFront.Enabled = Env.BrandHistory.HasFront;
  904. }
  905. //本体とコンテキストメニューの両方があるので
  906. private void AdjustViewMenu(Menu parent) {
  907. parent.MenuItems[_menuBookmark.Index].Checked = (_bookmarkContent!=null && _bookmarkContent.Visible);
  908. #if DOJIMA
  909. parent.MenuItems[_menuHalfDaily.Index].Checked = Env.CurrentIndicators.Format==ChartFormat.HalfDaily;
  910. #endif
  911. parent.MenuItems[_menuDaily.Index].Checked = Env.CurrentIndicators.Format==ChartFormat.Daily;
  912. parent.MenuItems[_menuWeekly.Index].Checked = Env.CurrentIndicators.Format==ChartFormat.Weekly;
  913. parent.MenuItems[_menuMonthly.Index].Checked = Env.CurrentIndicators.Format==ChartFormat.Monthly;
  914. parent.MenuItems[_menuYearly.Index].Checked = Env.CurrentIndicators.Format == ChartFormat.Yearly;
  915. parent.MenuItems[_menuLinkToInfo.Index].Enabled = !_chartCanvas.GetBrand().IsBuiltIn;
  916. }
  917. private void OnAdjustFileMenu(object sender, EventArgs args) {
  918. _menuDownload.Enabled = _modelessDialog==null;
  919. _menuMRUDownload.Enabled = _modelessDialog==null;
  920. }
  921. public ContextMenu CreateContextMenu() {
  922. ContextMenu cm = new ContextMenu();
  923. foreach(ZMenuItem mi in _menuView.MenuItems) {
  924. MenuItem cl = mi.CloneMenu();
  925. cm.MenuItems.Add(cl);
  926. }
  927. AdjustViewMenu(cm);
  928. return cm;
  929. }
  930. private void FinishAsyncLoad(IntPtr lparam) {
  931. Debug.Assert(_asyncLoader!=null);
  932. InitMenus();
  933. //失敗の場合でもDockingManagerは必要
  934. _manager = new DockingManager(this, VisualStyle.IDE);
  935. _manager.ContentHidden += _manager_ContentHidden;
  936. _manager.ContentShown += _manager_ContentShown;
  937. _manager.OuterControl = _statusBar;
  938. _manager.InnerControl = _chartCanvas;
  939. if(lparam.ToInt32()==AsyncConst.LPARAM_FINISHED) {
  940. Env.CurrentIndicators = _asyncLoader.IndicatorSet;
  941. Env.BrandCollection.ClearAllFarms();
  942. AbstractBrand br = _chartCanvas.GetBrand();
  943. _chartCanvas.ReloadFromPreference();
  944. _chartCanvas.LoadBrand(br, false);
  945. Invalidate(true);
  946. }
  947. else {
  948. Util.Warning(this, "スキーマのロード中にエラーが発生しました。\n"+_asyncLoader.ErrorMessage);
  949. }
  950. _asyncLoader = null;
  951. foreach(MenuItem mi in _mainMenu.MenuItems) mi.Enabled = true;
  952. this.Cursor = Cursors.Default;
  953. CommandExec.ResetLayout();
  954. #if DOJIMA
  955. if(!Env.Options.DojimaPasswordVerified)
  956. new Dojima.PasswordDialog().ShowDialog(this);
  957. #endif
  958. }
  959. protected override void OnActivated(EventArgs e) {
  960. base.OnActivated (e);
  961. if(_initialAction==null || _initialAction.Performed) {
  962. //if(!_chartCanvas.Focused) _chartCanvas.Focus();
  963. return;
  964. }
  965. _initialAction.Performed = true;
  966. //!!こういった処理がOnActivatedにあるのも変だが...
  967. foreach(MenuItem mi in _mainMenu.MenuItems) mi.Enabled = false;
  968. CommandExec.ShowBrand(Env.BrandCollection.FindBrand(_initialAction.BrandCode));
  969. this.Cursor = Cursors.AppStarting;
  970. _asyncLoader = new AsyncSchemaLoader(this);
  971. _asyncLoader.AsyncLoad();
  972. DecupleData.Decuple(); // データの10倍化
  973. }
  974. protected override void OnClosing(CancelEventArgs e) {
  975. base.OnClosing (e);
  976. Env.Options.FrameLocation = new Rectangle(this.Location, this.Size);
  977. Env.Options.WindowState = this.WindowState;
  978. if(_modelessDialog!=null) _modelessDialog.ZAbort();
  979. }
  980. protected override bool ProcessDialogKey(Keys keyData) {
  981. //Debug.WriteLine("ProcessDialogKey(Frame)");
  982. return ProcessShortcut(keyData);
  983. }
  984. public bool IsPriorShortcutKey(Keys keyData) {
  985. return (Keys.D0<=keyData && keyData<=Keys.D9) || (Keys.NumPad0<=keyData && keyData<=Keys.NumPad9);
  986. }
  987. public bool ProcessShortcut(Keys keyData) {
  988. if(Env.Command.Exec(keyData)!=CommandResult.Ignored)
  989. return true;
  990. else
  991. return false;
  992. }
  993. protected override void OnMouseWheel(MouseEventArgs e) {
  994. Env.Command.ExecMouseWheel(e.Delta);
  995. }
  996. private int MenuItemToCode(object sender) {
  997. string t = ((MenuItem)sender).Text;
  998. return Int32.Parse(t.Substring(0, t.IndexOf(':')));
  999. }
  1000. private void _manager_ContentHidden(Content c, EventArgs cea) {
  1001. _chartCanvas.Focus();
  1002. if(c.Control is BrandListPane)
  1003. _currentBrandListPane = null;
  1004. }
  1005. private void _manager_ContentShown(Content c, EventArgs cea) {
  1006. if(c.Control is BrandListPane)
  1007. _currentBrandListPane = (BrandListPane)c.Control;
  1008. }
  1009. protected override void WndProc(ref Message m) {
  1010. const int WM_SETCODE = Win32.WM_USER + 100;
  1011. const int WM_SETSPAN = Win32.WM_USER + 101;
  1012. base.WndProc (ref m);
  1013. if(m.Msg==AsyncConst.WM_ASYNCPROCESS)
  1014. FinishAsyncLoad(m.LParam);
  1015. else if (m.Msg == WM_SETCODE)
  1016. {
  1017. int code = (int)m.WParam;
  1018. AbstractBrand br = Env.BrandCollection.FindBrand(code);
  1019. if (br != null) CommandExec.ShowBrand(br);
  1020. }
  1021. else if (m.Msg == WM_SETSPAN)
  1022. {
  1023. int style = (int)m.WParam;
  1024. switch (style)
  1025. {
  1026. case 1:
  1027. CommandExec.SetChartFormat(ChartFormat.Daily);
  1028. break;
  1029. case 2:
  1030. CommandExec.SetChartFormat(ChartFormat.Weekly);
  1031. break;
  1032. case 3:
  1033. CommandExec.SetChartFormat(ChartFormat.Monthly);
  1034. break;
  1035. case 4:
  1036. CommandExec.SetChartFormat(ChartFormat.Yearly);
  1037. break;
  1038. }
  1039. }
  1040. }
  1041. }
  1042. internal interface IZModelessForm {
  1043. void ZShow();
  1044. void ZAbort();
  1045. }
  1046. }
Télécharger Printable view

URL of this paste

Embed with JavaScript

Embed with iframe

Raw text