[Ttssh2-commit] [7276] ウィンドウサイズ変更ショートカットキー用の機能/メニューIDを追加

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2018年 11月 21日 (水) 17:45:45 JST


Revision: 7276
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7276
Author:   doda
Date:     2018-11-21 17:45:45 +0900 (Wed, 21 Nov 2018)
Log Message:
-----------
ウィンドウサイズ変更ショートカットキー用の機能/メニューIDを追加

・55151: ウィンドウの横幅を1広げる
・55152: ウィンドウの横幅を1狭める
・55153: ウィンドウの縦幅を1広げる
・55154: ウィンドウの縦幅を1狭める

keyboard.cnf でキーにメニュー ID を割り当てて使うのを想定。

1 変更する度にホスト側へサイズ変更通知が送られるので、利用している
シェルや設定(特にzshでRPS1を設定している場合)によっては辛いかも。
連続するサイズ変更通知をまとめる機能が欲しいかも。

Inspired from:
  https://qiita.com/salexkidd@github/items/c56699d6f8cb22464123

Modified Paths:
--------------
    trunk/TTXSamples/TTXResizeMenu/TTXResizeMenu.c
    trunk/doc/en/html/about/history.html
    trunk/doc/en/html/reference/keycode.txt
    trunk/doc/ja/html/about/history.html
    trunk/doc/ja/html/reference/keycode.txt

-------------- next part --------------
Modified: trunk/TTXSamples/TTXResizeMenu/TTXResizeMenu.c
===================================================================
--- trunk/TTXSamples/TTXResizeMenu/TTXResizeMenu.c	2018-11-21 08:45:41 UTC (rev 7275)
+++ trunk/TTXSamples/TTXResizeMenu/TTXResizeMenu.c	2018-11-21 08:45:45 UTC (rev 7276)
@@ -13,6 +13,10 @@
 
 #define ID_MENUID_BASE 55101
 #define MAX_MENU_ITEMS 20
+#define ID_MENUID_INC_WIDTH  (ID_MENUID_BASE + 50)
+#define ID_MENUID_DEC_WIDTH  (ID_MENUID_BASE + 51)
+#define ID_MENUID_INC_HEIGHT (ID_MENUID_BASE + 52)
+#define ID_MENUID_DEC_HEIGHT (ID_MENUID_BASE + 53)
 
 static HANDLE hInst; /* Instance handle of TTX*.DLL */
 
@@ -277,7 +281,35 @@
     SendMessage(HWin, WM_COMMAND, MAKELONG(ID_SETUP_TERMINAL, 0), 0);
     return 1;
   }
-  return 0;
+  switch (cmd) {
+    case ID_MENUID_INC_WIDTH:
+      pvar->ts->TerminalWidth += 1;
+      pvar->ReplaceTermDlg = TRUE;
+      break;
+    case ID_MENUID_DEC_WIDTH:
+      if (pvar->ts->TerminalWidth > 1) {
+	pvar->ts->TerminalWidth -= 1;
+	pvar->ReplaceTermDlg = TRUE;
+      }
+      break;
+    case ID_MENUID_INC_HEIGHT:
+      pvar->ts->TerminalHeight += 1;
+      pvar->ReplaceTermDlg = TRUE;
+      break;
+    case ID_MENUID_DEC_HEIGHT:
+      if (pvar->ts->TerminalHeight > 1) {
+	pvar->ts->TerminalHeight -= 1;
+	pvar->ReplaceTermDlg = TRUE;
+      }
+      break;
+    default:
+      return 0;
+  }
+
+  if (pvar->ReplaceTermDlg) {
+    SendMessage(HWin, WM_COMMAND, MAKELONG(ID_SETUP_TERMINAL, 0), 0);
+  }
+  return 1;
 }
 
 static TTXExports Exports = {

Modified: trunk/doc/en/html/about/history.html
===================================================================
--- trunk/doc/en/html/about/history.html	2018-11-21 08:45:41 UTC (rev 7275)
+++ trunk/doc/en/html/about/history.html	2018-11-21 08:45:45 UTC (rev 7276)
@@ -53,6 +53,7 @@
   <li>Misc
     <ul>
       <li>upgraded TTSSH to <a href="#ttssh_2.87">2.87</a>.</li>
+      <li>upgraded TTXResizeMenu Plug-in to <a href="#resizemenu_1.05">1.05</a></li>
     </ul>
   </li>
 </ul>
@@ -4863,6 +4864,11 @@
 </ul>
 
 <h2 id="resizemenu">TTXResizeMenu</h2>
+<h3 id="resizemenu_1.05">2018.11.xx (Ver 1.05)</h3>
+<ul class="history">
+  <li>added menu id to increase/decrease window size. (for shortcut keys)</li>
+</ul>
+
 <h3 id="resizemenu_1.04">2018.08.31 (Ver 1.04)</h3>
 <ul class="history">
   <li>Fixed an issue where TTXResizeMenu can not be loaded on Windows 95/NT4.0.</li>

Modified: trunk/doc/en/html/reference/keycode.txt
===================================================================
--- trunk/doc/en/html/reference/keycode.txt	2018-11-21 08:45:41 UTC (rev 7275)
+++ trunk/doc/en/html/reference/keycode.txt	2018-11-21 08:45:45 UTC (rev 7276)
@@ -478,6 +478,10 @@
 TTXResizeMenu Menu command          ID
 -----------------------------------------
 [Resize] Menu(1) - Menu(20)         55101 - 55120
+-- Increase window width            55151 (not in menu)
+-- Decrease window width            55152 (not in menu)
+-- Increase window height           55153 (not in menu)
+-- Decrease window height           55154 (not in menu)
 
 TTXViewMode Menu command            ID
 -----------------------------------------

Modified: trunk/doc/ja/html/about/history.html
===================================================================
--- trunk/doc/ja/html/about/history.html	2018-11-21 08:45:41 UTC (rev 7275)
+++ trunk/doc/ja/html/about/history.html	2018-11-21 08:45:45 UTC (rev 7276)
@@ -53,6 +53,7 @@
   <li>\x82\xBB\x82̑\xBC
     <ul>
       <li><a href="#ttssh_2.87">TTSSH(2.87)</a>\x82֍\xB7\x82\xB5\x91ւ\xA6\x82\xBD\x81B</li>
+      <li><a href="#resizemenu_1.05">TTXResizeMenu Plugin(1.05)</a>\x82֍\xB7\x82\xB5\x91ւ\xA6\x82\xBD\x81B</li>
     </ul>
   </li>
 </ul>
@@ -4870,6 +4871,11 @@
 </ul>
 
 <h2 id="resizemenu">TTXResizeMenu</h2>
+<h3 id="resizemenu_1.05">2018.11.xx (Ver 1.05)</h3>
+<ul class="history">
+  <li>\x83E\x83C\x83\x93\x83h\x83E\x83T\x83C\x83Y\x82𑝌\xB8\x82\xB3\x82\xB9\x82\xE9\x88ׂ̃\x81\x83j\x83\x85\x81[ID\x82\xF0\x92lj\xC1\x82\xB5\x82\xBD\x81B(\x83V\x83\x87\x81[\x83g\x83J\x83b\x83g\x83L\x81[\x92\xE8\x8B`\x97p)</li>
+</ul>
+
 <h3 id="resizemenu_1.04">2018.08.31 (Ver 1.04)</h3>
 <ul class="history">
   <li>Windows 95/NT4.0 \x82\xC5 TTXResizeMenu \x82\xAA\x93ǂݍ\x9E\x82܂\xEA\x82Ȃ\xA2\x96\xE2\x91\xE8\x82\xF0\x8FC\x90\xB3\x82\xB5\x82\xBD\x81B</li>

Modified: trunk/doc/ja/html/reference/keycode.txt
===================================================================
--- trunk/doc/ja/html/reference/keycode.txt	2018-11-21 08:45:41 UTC (rev 7275)
+++ trunk/doc/ja/html/reference/keycode.txt	2018-11-21 08:45:45 UTC (rev 7276)
@@ -488,6 +488,10 @@
 TTXResizeMenu \x83\x81\x83j\x83\x85\x81[\x83R\x83}\x83\x93\x83h      ID
 -----------------------------------------
 [Resize] Menu(1) - Menu(20)         55101 - 55120
+-- Increase window width            55151 (\x83\x81\x83j\x83\x85\x81[\x8A\x84\x82蓖\x82ĂȂ\xB5)
+-- Decrease window width            55152 (\x83\x81\x83j\x83\x85\x81[\x8A\x84\x82蓖\x82ĂȂ\xB5)
+-- Increase window height           55153 (\x83\x81\x83j\x83\x85\x81[\x8A\x84\x82蓖\x82ĂȂ\xB5)
+-- Decrease window height           55154 (\x83\x81\x83j\x83\x85\x81[\x8A\x84\x82蓖\x82ĂȂ\xB5)
 
 TTXViewMode \x83\x81\x83j\x83\x85\x81[\x83R\x83}\x83\x93\x83h        ID
 -----------------------------------------


Ttssh2-commit メーリングリストの案内
Back to archive index