home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1999 March / VPR9903A.BIN / APUPDATE / VC / Tx300d / TX300D.LZH / DISP.C < prev    next >
Text File  |  1997-05-23  |  7KB  |  303 lines

  1. // WZ EDITOR 標準機能 表示
  2. // Copyright 1997 TY
  3. //2.95 970128 start
  4.  
  5. //{###表示}
  6.  
  7. //2.99D 970331 TXCMDBASE対応
  8.  
  9. #include <windows.h>
  10. #include "dialog.h"
  11. #include "window.h"
  12.  
  13. //##メニューへの表示
  14.  
  15. // -1:不明
  16. static int checked(WZCMD wzcmd)
  17. {
  18.     mchar* szcmd = wzcmdToSzcmd(wzcmd);
  19.     if (!szcmd) return -1;
  20.     if (!stricmp(szcmd,"\m.toolbar")) {
  21.         return text->fDispToolbar;
  22.     } else if (!stricmp(szcmd,"\m.ruler")) {
  23.         return text->fDispRuler;
  24.     } else if (!stricmp(szcmd,"\m.functionbar")) {
  25.         return text->fDispFunctionKey;
  26.     } else if (!stricmp(szcmd,"\m.linenumber")) {
  27.         return text->fDispLine;
  28.     } else if (!stricmp(szcmd,"\m.tab")) {
  29.         return text->fDispTab;
  30.     } else if (!stricmp(szcmd,"\m.underline")) {
  31.         return text->fDispUnder;
  32.     } else if (!stricmp(szcmd,"\m.jspace")) {
  33.         return text->fDispJspace;
  34.     } else if (!stricmp(szcmd,"\m.fully")) {
  35.         return (text->fDispFull == 2);
  36.     } else if (!stricmp(szcmd,"\m.readmode")) {
  37.         return text->fReadMode;
  38.     } else if (!stricmp(szcmd,"\m.search")) {
  39. #if 1//2.99C 970323 
  40.         return (text->fDispFind && text->fDispFindEnable);
  41. #else
  42.         return (text->fDispFind && text->fConfigDispFindEnable);
  43. #endif
  44.     } else if (!stricmp(szcmd,"\m.tag")) {
  45.         return text->fDispTag;
  46.     } else if (!stricmp(szcmd,"\m.titlebar")) {
  47.         LONG ws = GetWindowLong(text->hwndbase,GWL_STYLE);
  48.         return ((ws & WS_DLGFRAME) != 0);
  49.     } else if (!stricmp(szcmd,"\m.prop")) {//2.99 970320 
  50.         return text->lfProp;
  51.     }
  52.     return -1;
  53. }
  54.  
  55. WORD at_cmdcheck(WZCMD wzcmd)
  56. {
  57. //2.99 970319 
  58. #if 1///3.00B1 970523 
  59.     mchar* szcmd = wzcmdToSzcmd(wzcmd);
  60.     if (!szcmd) return 0;
  61.     if (!stricmp(szcmd,"\m.proof")) {
  62.         if (text->editmode == 0) return MF_GRAYED;
  63.         if (!text->fWztext) {
  64.             if (text->tszformat[SZFORMAT_PROOF_TOP][0] == 0) return MF_GRAYED;
  65.         }
  66.         return 0;
  67.     }
  68. #endif
  69.     int f = checked(wzcmd);
  70.     if (f >= 1) return MF_CHECKED;
  71.     return 0;
  72. }
  73.  
  74. BOOL TXCMDBASE toolbar(TX* text)
  75. {
  76. // ツールバーの表示、非表示切り替え
  77.     text->fDispToolbar ^= 1;
  78.     txcfgSavePart(text,fDispToolbar);
  79.     txFlush(text);
  80.     return TRUE;
  81. }
  82.  
  83. //2.99D 970331 disp.ruler new
  84. BOOL TXCMDBASE ruler(TX* text)
  85. {
  86. // ルーラーの表示、非表示切り替え
  87.     text->fDispRuler ^= 1;
  88.     txcfgSavePart(text,fDispRuler);
  89.     txFlush(text);
  90.     return TRUE;
  91. }
  92.  
  93. //2.99D 970331 disp.linenumber new
  94. BOOL TXCMDBASE linenumber(TX* text)
  95. {
  96. // ファンクションバーの表示、非表示切り替え
  97.     text->fDispLine ^= 1;
  98.     txcfgSavePart(text,fDispLine);
  99.     txFlush(text);
  100.     return TRUE;
  101. }
  102.  
  103. //2.99D 970331 disp.functionbar new
  104. BOOL TXCMDBASE functionbar(TX* text)
  105. {
  106. // ファンクションバーの表示、非表示切り替え
  107.     text->fDispFunctionKey ^= 1;
  108.     txcfgSavePart(text,fDispFunctionKey);
  109.     txFlush(text);
  110.     return TRUE;
  111. }
  112.  
  113. //2.99D 970331 disp.control->disp.tab
  114. BOOL TXCMDBASE tab(TX* text)
  115. {
  116. // タブとEOFの表示、非表示切り替え
  117.     text->fDispTab ^= 1;
  118.     text->fDispEof = text->fDispTab;
  119.     txcfgSavePart(text,fDispEof);
  120.     txcfgSavePart(text,fDispTab);
  121.     txFlush(text);
  122.     return TRUE;
  123. }
  124.  
  125. BOOL TXCMDBASE underline(TX* text)
  126. {
  127. // カーソル行アンダーラインの表示、非表示切り替え
  128.     text->fDispUnder ^= 1;
  129.     txcfgSavePart(text,fDispUnder);
  130.     txFlush(text);
  131.     return TRUE;
  132. }
  133.  
  134. BOOL TXCMDBASE jspace(TX* text)
  135. {
  136. // 全角スペースの表示、非表示切り替え
  137.     text->fDispJspace ^= 1;
  138.     txcfgSavePart(text,fDispJspace);
  139.     txFlush(text);
  140.     return TRUE;
  141. }
  142.  
  143. //2.98 970310 「表示|タイトルバー」追加
  144. //2.99D 970331 「表示|タイトルバー」削除
  145. BOOL TXCMDBASE titlebar(TX* text)
  146. {
  147. // タイトルバーの表示、非表示切り替え
  148. #if 1
  149.     text->fDispTitlebar ^= 1;
  150.     txcfgSavePart(text,fDispTitlebar);
  151.     txFlush(text);
  152.     return TRUE;
  153. #else
  154.     LONG ws = GetWindowLong(text->hwndbase,GWL_STYLE);
  155.     if (ws & WS_DLGFRAME) {
  156.         ws &= ~WS_DLGFRAME;
  157.     } else {
  158.         ws |= WS_DLGFRAME;
  159.     }
  160.     SetWindowLong(text->hwndbase,GWL_STYLE,ws);
  161.     SetWindowPos(text->hwndbase,NULL,0,0,0,0,SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER);
  162.     return TRUE;
  163. #endif
  164. }
  165.  
  166. BOOL TXCMDBASE search(TX* text)
  167. {
  168. // 検索文字列の色分けのON/OFF
  169. #if 1///2.99C 970323 「表示|検索文字列」による検索文字列の色分けは一時的なものとした
  170.     text->fDispFindEnable ^= 1;
  171.     txFlush(text);
  172.     return TRUE;
  173. #else
  174.     text->fConfigDispFindEnable ^= 1;
  175.     txcfgSavePart(text,fConfigDispFindEnable);
  176.     txFlush(text);
  177.     return TRUE;
  178. #endif
  179. }
  180.  
  181. BOOL TXCMDBASE fully(TX* text)
  182. {
  183. // 全画面表示のON/OFF
  184.     text->fDispFull = (text->fDispFull == 2) ? 0 : 2;
  185.     txcfgSavePart(text,fDispFull);
  186.     if (text->fDispFull) {
  187.         //2.99C 970325 
  188.         RECT r;
  189.         GetWindowRect(text->hwndbase,&r);
  190.         wndtxSetOriginalRect(text->hwndbase,&r);
  191.         //
  192.         txFlush(text);
  193.         call("window.FullY2");
  194.     } else {
  195.         call("window.FullY1");//3.00A2 970507 FullY->FullY1
  196. #if 1    //2.99C 970325 
  197.         wndtxMoveOriginal(text->hwndbase);
  198. //        MoveWindow(text->hwndbase,r.left,r.top,rectCx(&r),rectCy(&r),TRUE);
  199. #else
  200.         txFlushEx(text,TXFLUSHEX_TXFLUSHALL);
  201. #endif
  202.     }
  203.     return TRUE;
  204. }
  205.  
  206. BOOL TXCMDBASE readmode(TX* text)
  207. {
  208. // 閲覧モードのON/OFF
  209.     text->fReadMode = text->fReadMode ? 0 : 1;
  210.     if (text->fNoCaret != text->fReadMode) {
  211.         // キャレットを消す/点ける
  212.         txSwitchCaret(text);
  213.     }
  214.     if (text->fReadMode) {
  215.         txVarSet(text,"\m.fDispUnder",text->fDispUnder);
  216.         text->fDispUnder = FALSE;
  217.         txVarSet(text,"\m.fEditable",text->fEditable);
  218.         text->fEditable = FALSE;
  219.     } else {
  220.         text->fEditable = txVarGet(text,"\m.fEditable");
  221.         text->fDispUnder = txVarGet(text,"\m.fDispUnder");
  222.     }
  223.     txFlush(text);
  224.     wndtxDoCaption();
  225.     return TRUE;
  226. }
  227.  
  228. BOOL TXCMDBASE tag(TX* text)
  229. {
  230. // HTMLタグ表示のON/OFF
  231. #if 1
  232.     text->fDispTag ^= 1;
  233.     txcfgSavePart(text,fDispTag);
  234.     txFlush(text);
  235.     return TRUE;
  236. #else
  237.     //2.99 970313 HTMLタグの省略表示を試してみたが、
  238.     // dialogを出すのは使いにくいのでやめた。
  239.     HDIALOG hd = dialog("HTMLタグの表示");
  240.     dialogControlRadioV(hd);
  241.     dialogRadioIDB(hd,&text->fDispTag,
  242.         "表示しない",
  243.         "表示する",
  244.         "アトリビュートを省略して表示する"
  245.     );
  246.     if (dialogOpen(hd)) {
  247.         txcfgSavePart(text,fDispTag);
  248.         txFlush(text);
  249.     }
  250.     return TRUE;
  251. #endif
  252. }
  253.  
  254. //2.98 970305 「表示|校正」追加
  255. BOOL TXCMDBASE proof(TX* text)
  256. {
  257. // 校正の表示方法を指定
  258.     if (text->editmode == 0) {
  259.         information("体裁/詳細モードで実行してください");
  260.         return FALSE;
  261.     } else {
  262.         HDIALOG hd = dialog("校正の表示");
  263.         dialogControlRadioV(hd);
  264.         dialogRadioIDB(hd,&text->modeDispProof,
  265.             "校正前",
  266.             "校正後",
  267.             "校正状態",
  268.             "詳細"
  269.         );
  270.         BOOL fTxsemProofProcess = text->fTxsemProofProcess;
  271.         dialogControlEnable(hd,!text->fWztext);
  272.         dialogControlHelp(hd,403);
  273.         dialogCheck(hd,"次回の保存時に校正を処理(&P)",&fTxsemProofProcess);
  274.         if (dialogOpen(hd)) {
  275.             txFlush(text);
  276.             txcfgSavePart(text,modeDispProof);
  277.             text->fTxsemProofProcess = fTxsemProofProcess;
  278.         }
  279.     }
  280.     return TRUE;
  281. }
  282.  
  283. //2.98 970310 「表示|プロポーショナル」追加
  284. BOOL TXCMDBASE prop(TX* text)
  285. {
  286. // プロポーショナル表示のON/OFF
  287.     text->lfProp = text->lfProp ? 0 : 1;
  288. #if 0    //2.99 970320 プロポーショナルは保存しない。テキストファイルの設定で保存すると問題だから。
  289.     txcfgSavePart(text,lfProp);
  290. #endif
  291.     txFlush(text);
  292.     return TRUE;
  293. }
  294.  
  295. //2.99I 970406 new
  296. redraw
  297. {
  298. // 画面表示をリフレッシュ
  299.     tyFlush(text);
  300.     txDispAll(text);
  301. }
  302.  
  303.