コピペ: OmegaChart 日付固定表示 MainFrame.cs 追加修正ポイントには//☆FixedDisplayYMD

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

このコピペの URL

JavaScript での埋め込み

iframe での埋め込み

元のテキスト