From fede4713a963b54c0c178acee2bd4585e63bdb74 Mon Sep 17 00:00:00 2001 From: zmatsuo <6488847+zmatsuo@users.noreply.github.com> Date: Thu, 24 Oct 2024 00:52:13 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B7=E3=83=AA=E3=82=A2=E3=83=AB=E3=83=9D?= =?UTF-8?q?=E3=83=BC=E3=83=88=E3=83=80=E3=82=A4=E3=82=A2=E3=83=AD=E3=82=B0?= =?UTF-8?q?=E3=82=92=E3=83=97=E3=83=AD=E3=83=91=E3=83=86=E3=82=A3=E3=83=BC?= =?UTF-8?q?=E3=83=9A=E3=83=BC=E3=82=B8=E3=81=AB=E5=A4=89=E6=9B=B4=20#84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - デフォルトポートの仕様を変更した - 全般タブでは"TCP/IP"/"シリアル"の選択を行う - シリアルポート番号の選択はシリアルポートタブで行う - ts.ComPort を全般タブとシリアルタブの2か所で変更しないようにするため - ドキュメント修正 - シリアルタブの速度のツールチップを削除した - "You can directly specify a number" - 数値を入力できるようにしてからだいぶ経つ - ヘルプに記述があれば良い --- .editorconfig | 1 + doc/en/html/about/history.html | 24 +- doc/en/html/menu/file-new.html | 2 +- .../menu/setup-additional-serialport.html | 113 ++++ doc/en/html/menu/setup-additional.html | 1 + doc/en/html/menu/setup-serialport.html | 69 +-- doc/en/html/setup/teraterm-ini.html | 16 +- doc/en/teraterm.hhc | 5 + doc/en/teraterm.hhp | 1 + doc/ja/html/about/history.html | 24 +- doc/ja/html/menu/file-new.html | 2 +- .../menu/setup-additional-serialport.html | 112 ++++ doc/ja/html/menu/setup-additional.html | 1 + doc/ja/html/menu/setup-serialport.html | 70 +-- doc/ja/html/setup/teraterm-ini.html | 16 +- doc/ja/teraterm.hhc | 5 + doc/ja/teraterm.hhp | 1 + installer/release/lang_utf8/English.lng | 7 +- installer/release/lang_utf8/French.lng | 8 +- installer/release/lang_utf8/German.lng | 7 +- installer/release/lang_utf8/Japanese.lng | 7 +- installer/release/lang_utf8/Korean.lng | 7 +- installer/release/lang_utf8/Russian.lng | 7 +- .../release/lang_utf8/Simplified Chinese.lng | 7 +- installer/release/lang_utf8/Spanish.lng | 7 +- installer/release/lang_utf8/Tamil.lng | 7 +- .../release/lang_utf8/Traditional Chinese.lng | 7 +- teraterm/common/comportinfo.cpp | 5 +- teraterm/common/dlglib_cpp.cpp | 1 + teraterm/common/helpid.h | 1 + teraterm/teraterm/CMakeLists.txt | 2 + teraterm/teraterm/addsetting.cpp | 6 + teraterm/teraterm/addsetting.h | 2 + teraterm/teraterm/externalsetup.cpp | 50 ++ teraterm/teraterm/general_pp.cpp | 24 +- teraterm/teraterm/serial_pp.cpp | 529 ++++++++++++++++++ teraterm/teraterm/serial_pp.h | 39 ++ teraterm/teraterm/tekwin.cpp | 2 +- teraterm/teraterm/ttdialog.c | 1 - teraterm/teraterm/ttermpro.rc | 2 +- teraterm/teraterm/ttermpro.v16.vcxproj | 2 + .../teraterm/ttermpro.v16.vcxproj.filters | 6 + teraterm/teraterm/ttermpro.v17.vcxproj | 2 + .../teraterm/ttermpro.v17.vcxproj.filters | 6 + teraterm/teraterm/vtwin.cpp | 34 +- teraterm/ttpdlg/dlg_res.h | 3 +- teraterm/ttpdlg/serialdlg.cpp | 426 +------------- teraterm/ttpdlg/ttpdlg.rc | 26 +- 48 files changed, 999 insertions(+), 704 deletions(-) create mode 100644 doc/en/html/menu/setup-additional-serialport.html create mode 100644 doc/ja/html/menu/setup-additional-serialport.html create mode 100644 teraterm/teraterm/serial_pp.cpp create mode 100644 teraterm/teraterm/serial_pp.h diff --git a/.editorconfig b/.editorconfig index 4507f4a3e..1e5ad7507 100644 --- a/.editorconfig +++ b/.editorconfig @@ -17,6 +17,7 @@ end_of_line = crlf charset = cp932 indent_style = space indent_size = 2 +trim_trailing_whitespace = true [*.md] end_of_line = crlf diff --git a/doc/en/html/about/history.html b/doc/en/html/about/history.html index 80cb16dd7..e95ed5dca 100644 --- a/doc/en/html/about/history.html +++ b/doc/en/html/about/history.html @@ -60,6 +60,12 @@

YYYY.MM.DD (Ver 5.4 not released yet)

  • Added skip Send file dialog setting.
  • Macro commands for sending and receiving files are also from File transfer folder.
  • ZMODEM send: CANFDX flag handling is implemented when receiving ZRINIT. While the receiver cannot receive data, the sender(Tera Term) can wait for the receiver. +
  • Additional settings - Serial Port tab
  • + @@ -410,15 +416,15 @@

    2019.12.7 (Ver 4.105)

    @@ -1870,7 +1876,7 @@

    2010.12.7 (Ver 4.68)

  • Bug fixes
  • added support for specifying any baud rate of the serial port connection.
  • diff --git a/doc/en/html/menu/file-new.html b/doc/en/html/menu/file-new.html index 67afacac7..179dd0761 100644 --- a/doc/en/html/menu/file-new.html +++ b/doc/en/html/menu/file-new.html @@ -164,7 +164,7 @@

    TCP/IP

    Serial

    -
    Port
    +
    Port
    Select a port from the list. By default, maximum serial port number in the list is 256. Also, the serial port does not show when there is no available port. It is configurable in MaxComPort setting.
    diff --git a/doc/en/html/menu/setup-additional-serialport.html b/doc/en/html/menu/setup-additional-serialport.html new file mode 100644 index 000000000..04a6134be --- /dev/null +++ b/doc/en/html/menu/setup-additional-serialport.html @@ -0,0 +1,113 @@ + + + + + Additional settings / "Serial port" tab ([Setup] menu) + + + + + +

    Additional settings / "Serial port" tab ([Setup] menu)

    + +

    + Settings related to the serial port. + +

    +
    Port
    +
    + When the serial port is not connected, + Sets the default serial port for New connection Dialog. + A non existent serial port can be set. + New connection dialog does not show any non existent serial ports.
    + By default, maximum serial port number in the list is 256. It is configurable in MaxComPort setting. +

    + When the serial port is connected, + displays the serial port to which it is connected. +

    +
    + +
    Serial parameters
    +
    + Serial port parameters. + Choose the appropriate parameters for the modem or the host.
    + Whether the selected or specified settings are actually applied depends on serial port chip or driver. + +

    + When the serial port is not connected, + Sets the parameters for connecting to the serial port.
    + Use New connection when connecting to a serial port. +

    +

    + When the serial port is connected, + Set parameters for the connected serial port. +

    + +
    +
    Speed
    +
    + The Speed can be specified with any number. +
    + +
    Data
    +
    + 8 bit / 7 bit +

    + Note: If Data is 7 bit, the XMODEM, ZMODEM, B PLUS and Quick-VAN + protocols are disabled. +

    +
    + +
    Parity
    +
    + none / odd / even / mark / space +
    + +
    Stop bits
    +
    + 1 bit / 2 bit +
    + +
    Flow control
    +
    +
    +
    Xon/Xoff
    +
    + Software flow +

    + Note: If Flow control is Xon/Xoff, the XMODEM and Quick-VAN protocols are disabled. +

    +
    +
    RTS/CTS
    +
    + Hardware flow(RTS/CTS) +

    + Note: The "hardware" prior to version 4.104 applies to RTS/CTS. +

    +
    +
    DSR/DTR
    Hardware flow(DSR/DTR)
    +
    none
    No flow control
    +
    + +
    +
    +
    + +
    Transmit delay
    +
    + Time intervals between characters (lines) being sent, in milliseconds. + The unit is milliseconds. You can set the wait time per character (line). + If the modem or host drops characters when Tera Term sends a large number of characters, try setting an appropriate delay time. +
    + +
    Detail information of COM port
    +
    + The detail information of selected port is shown in the text box.
    + You can select all data by using CTRL+A. + You can scroll horizontally by using CTRL/SHIFT + wheel. +
    + +
    + + diff --git a/doc/en/html/menu/setup-additional.html b/doc/en/html/menu/setup-additional.html index 08e7895f6..f644b5efc 100644 --- a/doc/en/html/menu/setup-additional.html +++ b/doc/en/html/menu/setup-additional.html @@ -33,6 +33,7 @@

    tabs

  • "Terminal" Tab
  • "Window" Tab
  • +
  • "Serail Port" Tab
  • diff --git a/doc/en/html/menu/setup-serialport.html b/doc/en/html/menu/setup-serialport.html index 9815403c3..8418ec06f 100644 --- a/doc/en/html/menu/setup-serialport.html +++ b/doc/en/html/menu/setup-serialport.html @@ -10,71 +10,8 @@

    Serial port ([Setup] menu)

    - -

    "Serial port setup" dialog box

    - -
    - -
    OK button
    -
    - The label of OK button is changed according to the connection state.
    - Connect with New window ... Serial connection is launched with new window since TCP/IP connection is using.
    - New open ... Serial connection starts.
    - Close and New open ... Current COM port is closed and serial connection starts with new COM port.
    - New setting ... The setting of current COM port is changed.
    -
    - -
    Cancel button
    -
    - Discards the setting change and closes the dialog. -
    - -
    Help button
    -
    - Displays the help file. -
    - -
    Port
    -
    - Serial port to be used. By default, maximum serial port number in the list is 256. It is configurable in MaxComPort setting. -
    - -
    Speed, Data, Parity, Stop bits, Flow control
    -
    - Serial port parameters. Choose the appropriate parameters for - the modem or the host. -

    - The Speed can be specified with any number. Actually, the serial port driver may not reflect your speed. -

    -

    - Flow control can be configured in the following:
    - Xon/Xoff ... Software flow
    - RTS/CTS ... Hardware flow(RTS/CTS)
    - DSR/DTR ... Hardware flow(DSR/DTR)
    - none ... No flow control
    -

    -

    - Note: If Data is 7 bit, the XMODEM, ZMODEM, B PLUS and Quick-VAN - protocols are disabled. If Flow control is Xon/Xoff, the XMODEM - and Quick-VAN protocols are disabled. -

    -

    - Note: The "hardware" prior to version 4.104 applies to RTS/CTS. -

    -
    - -
    Transmit delay
    -
    - Time intervals between characters (lines) being sent, in milliseconds. -
    - -
    Detail information of COM port
    -
    - The detail information of selected port is shown in the text box.
    - You can select all data by using CTRL+A. - You can scroll horizontally by using CTRL/SHIFT + wheel. -
    - -
    +

    + Open Serial Port tab of Additional settings dialog. +

    diff --git a/doc/en/html/setup/teraterm-ini.html b/doc/en/html/setup/teraterm-ini.html index 6a7fb70c7..1bf1035f6 100644 --- a/doc/en/html/setup/teraterm-ini.html +++ b/doc/en/html/setup/teraterm-ini.html @@ -194,7 +194,7 @@

    Tera Term

    - BaudRate + BaudRate 9600 <- @@ -302,7 +302,7 @@

    Tera Term

    - ComPort + ComPort 1 <- @@ -386,7 +386,7 @@

    Tera Term

    - DataBit + DataBit 8 <- @@ -410,13 +410,13 @@

    Tera Term

    - DelayPerChar + DelayPerChar 0 <- - DelayPerLine + DelayPerLine 0 <- @@ -632,7 +632,7 @@

    Tera Term

    - FlowCtrl + FlowCtrl none <- @@ -974,7 +974,7 @@

    Tera Term

    - Parity + Parity none <- @@ -1154,7 +1154,7 @@

    Tera Term

    - StopBit + StopBit 1 <- diff --git a/doc/en/teraterm.hhc b/doc/en/teraterm.hhc index 7b02491a6..cd093ba54 100644 --- a/doc/en/teraterm.hhc +++ b/doc/en/teraterm.hhc @@ -533,6 +533,11 @@ +
  • + + + +
  • diff --git a/doc/en/teraterm.hhp b/doc/en/teraterm.hhp index 5f6c1a1ef..32009a9c6 100644 --- a/doc/en/teraterm.hhp +++ b/doc/en/teraterm.hhp @@ -133,6 +133,7 @@ HlpMenuSetupAdditionalCtrlSeq=html\menu\setup-additional-ctrlseq.html HlpMenuSetupAdditionalCygwin=html\menu\setup-additional-cygwin.html HlpMenuSetupAdditionalWindow=html\menu\setup-additional-window.html HlpMenuSetupAdditionalTerminal=html\menu\setup-additional-terminal.html +HlpMenuSetupAdditionalSerialPort=html\menu\setup-additional-serialport.html HlpMenuSetupThemeEditor=html\menu\setup-additional-visual-theme.html HlpMenuSetupSave=html\menu\setup-save.html HlpMenuSetupRestore=html\menu\setup-restore.html diff --git a/doc/ja/html/about/history.html b/doc/ja/html/about/history.html index e6285a315..d8ca8727e 100644 --- a/doc/ja/html/about/history.html +++ b/doc/ja/html/about/history.html @@ -60,6 +60,12 @@

    YYYY.MM.DD (Ver 5.4 not released yet)

  • t@CM_CAOXLbvݒljB
  • t@CM}NR}ht@C]ptH_N_Ƃ悤ɂB
  • ZMODEM send: M ZRINIT CANFDX tȌBMf[^MłȂԁAM(Tera Term)͎M҂Ă悤ɂȂB
  • +
  • Additional settings - Serial Port ^u
  • +
      +
    • Setup-Serial ݒ Additional settings Serial Port ^u֓B
    • +
    • ݒ̂ݍs悤ɂȂB(VڑNew connection _CAOsB)
    • +
    • Additional settings - General ^uVڑ̃ftHg TCP/IP Serial IAftHgSerial port͂̃^uőI悤ɂB
    • +
    @@ -410,15 +416,15 @@

    2019.12.7 (Ver 4.105)

    @@ -1869,7 +1875,7 @@

    2010.12.7 (Ver 4.68)

  • oOC
    • ZLeBC: DLL ǂݍ݂ɊւƎ㐫CB
    • -
    • [Setup]-[Serial port] _CAO\Ƃ Baud rate IĂȂCB
    • +
    • [Setup]-[Serial port] _CAO\Ƃ Baud rate IĂȂCB
    • Beep ݒǂݍ܂ȂCB
    • DECALN (DEC Screen Alignment Test) V[PXŁAXN[̈NA悤ɂB
    • EBhE^Cg/ACRx񍐗vɑ΂āA󕶎ݒ肪삵ȂCB
    • @@ -1951,7 +1957,7 @@

      2010.5.31 (Ver 4.66)

  • VA|[gڑ̃{[[gIȊO͏o悤ɂB
  • diff --git a/doc/ja/html/menu/file-new.html b/doc/ja/html/menu/file-new.html index 2ae5c97ce..e2b61740a 100644 --- a/doc/ja/html/menu/file-new.html +++ b/doc/ja/html/menu/file-new.html @@ -161,7 +161,7 @@

    TCP/IP

    Serial

    -
    Port
    +
    Port
    ڑVA|[gXg̒IĂBXgɕ\VA|[gԍ̍ől̓ftHg256ƂȂĂ܂B܂Ap”\ȃVA|[g݂Ȃꍇ͕\܂BMaxComPortōőlύXł܂B
    diff --git a/doc/ja/html/menu/setup-additional-serialport.html b/doc/ja/html/menu/setup-additional-serialport.html new file mode 100644 index 000000000..b9c55f7ba --- /dev/null +++ b/doc/ja/html/menu/setup-additional-serialport.html @@ -0,0 +1,112 @@ + + + + + Additional settings / "Serial port" ^u ([Setup] j[) + + + + + +

    Additional settings / "Serial port" ^u ([Setup] j[)

    + +

    + VA|[gɊ֘Aݒs܂B + +

    +
    Port
    +
    + VA|[gɐڑĂȂƂA + New connection _CAO\̃ftHgVA|[gݒ肵܂B + ݒ莞ɂ݂͑ȂVA|[gݒł܂B + New connection _CAOł݂͑ȂVA|[g͕\܂B
    + Xgɕ\VA|[gԍ̍ől̓ftHg256ƂȂĂ܂BMaxComPortōőlύXł܂B
    +

    + VA|[gɐڑĂƂA + ڑĂVA|[g\܂B +

    +
    + +
    Serial parameters
    +
    + VA|[g̃p[^łB + ڑ郂f̐ݒɂ킹ĂB
    + IEw肵ݒ肪ۂɔf邩́AVA|[g̃`bvEhCo̎dlɂ܂B + +

    + VA|[gɐڑĂȂƂA + VA|[gɐڑ鎞̃p[^ݒ肵܂B
    + VA|[gɐڑ鎞New connectiongpĂB +

    +

    + VA|[gɐڑĂƂA + ڑĂVA|[g̃p[^ݒ肵܂B +

    + +
    +
    Speed
    +
    + Speed ͔Cӂ̐lw肷邱Ƃł܂B +
    + +
    Data
    +
    + 8 bit / 7 bit +

    + : 7 bit ̂ƂAXMODEM, ZMODEM, B-PLUS, Quick-VAN + ɂt@C]͂ł܂B +

    +
    + +
    Parity
    +
    + none / odd / even / mark / space +
    + +
    Stop bits
    +
    + 1 bit / 2 bit +
    + +
    Flow control
    +
    +
    +
    Xon/Xoff
    +
    + \tgEFAt[ +

    + : Xon/Xoff ɂƁAXMODEM, Quick-VAN ɂt@C]͂ł܂B +

    +
    +
    RTS/CTS
    +
    + n[hEFAt[(RTS/CTS) +

    + : o[W4.104ȑO"hardware"RTS/CTSɊY܂B +

    +
    +
    DSR/DTR
    n[hEFAt[(DSR/DTR)
    +
    none
    t[Ȃ
    +
    + +
    +
    +
    + +
    Transmit delay
    +
    + Tera Term (s)𑗏oƎ̕(s)𑗏o܂ł̑҂ԁB + Pʂ̓~błB1(s)Ƃ̑҂Ԃݒł܂B
    + Tera Term ʂ̕𑗏oƂɃfzXg肱ڂꍇɂ͓Kȑ҂Ԃݒ肵Ă݂ĂB +
    + +
    COM|[g̏ڍ׏
    +
    + eLXg{bNXł͑I𒆂COM|[gɊւڍ׏\܂B
    + CTRL+AőSIł܂BCTRL/SHIFT+zC[ʼnXN[ł܂B +
    + +
    + + diff --git a/doc/ja/html/menu/setup-additional.html b/doc/ja/html/menu/setup-additional.html index 3394e71ae..23d130289 100644 --- a/doc/ja/html/menu/setup-additional.html +++ b/doc/ja/html/menu/setup-additional.html @@ -33,6 +33,7 @@
  • "Terminal" ^u
  • "Window" ^u
  • +
  • "Serail Port" ^u
  • diff --git a/doc/ja/html/menu/setup-serialport.html b/doc/ja/html/menu/setup-serialport.html index 72248a346..e3427be90 100644 --- a/doc/ja/html/menu/setup-serialport.html +++ b/doc/ja/html/menu/setup-serialport.html @@ -10,72 +10,8 @@

    Serial port ([Setup] j[)

    - -

    "Serial port setup" _CAO{bNX

    - -
    -
    OK button
    -
    - ݂̐ڑԂāAVAڑ̓\܂B
    - VEBhEŐڑ ... TCP/IPڑ̂߁AVEBhEŃVAڑs܂B
    - VKI[v ... VAڑs܂B
    - N[YVKI[v ... ݊JĂCOM|[g‚āAVCOM|[gŃVAڑs܂B
    - ݂̐ڑĐݒ ... ݊JĂCOM|[g̐ݒύX܂B
    -
    - -
    Cancel button
    -
    - ݒύXLZāA_CAOI܂B -
    - -
    Help button
    -
    - wv\܂B -
    - -
    Port
    -
    - gp|[głBXgɕ\VA|[gԍ̍ől̓ftHg256ƂȂĂ܂BMaxComPortōőlύXł܂B -
    - -
    Speed, Data, Parity, Stop bits, Flow control
    -
    - VA|[g̃p[^łB - ڑ郂f̐ݒɂ킹ĂB -

    - Speed ͔Cӂ̐lw肷邱Ƃł܂BIEw肵ݒ肪ۂɔf邩́AVA|[g̃`bvEhCo̎dlɂ܂B -

    -

    - Flow control͈ȉݒł܂B
    - Xon/Xoff ... \tgEFAt[
    - RTS/CTS ... n[hEFAt[(RTS/CTS)
    - DSR/DTR ... n[hEFAt[(DSR/DTR)
    - none ... t[Ȃ
    -

    -

    - : Data 7 ɂƁAXMODEM, ZMODEM, B-PLUS, Quick-VAN - ɂt@C]͂ł܂B - ܂ Flow control Xon/Xoff ɂƁAXMODEM, Quick-VAN - ɂt@C]͂ł܂B -

    -

    - : o[W4.104ȑO"hardware"RTS/CTSɊY܂B -

    -
    - -
    Transmit delay
    -
    - Tera Term (s)𑗏oƎ̕(s)𑗏o܂ł̑҂ԁB - Pʂ̓~błB1(s)Ƃ̑҂Ԃݒł܂B
    - Tera Term ʂ̕𑗏oƂɃfzXg肱ڂꍇɂ͓Kȑ҂Ԃݒ肵Ă݂ĂB -
    - -
    COM|[g̏ڍ׏
    -
    - eLXg{bNXł͑I𒆂COM|[gɊւڍ׏\܂B
    - CTRL+AőSIł܂BCTRL/SHIFT+zC[ʼnXN[ł܂B -
    - -
    +

    + Additional settings Serial port ^uJ܂B +

    diff --git a/doc/ja/html/setup/teraterm-ini.html b/doc/ja/html/setup/teraterm-ini.html index 9a89a6b58..891bd3f96 100644 --- a/doc/ja/html/setup/teraterm-ini.html +++ b/doc/ja/html/setup/teraterm-ini.html @@ -194,7 +194,7 @@

    Tera Term

    - BaudRate + BaudRate 9600 <- @@ -302,7 +302,7 @@

    Tera Term

    - ComPort + ComPort 1 <- @@ -386,7 +386,7 @@

    Tera Term

    - DataBit + DataBit 8 <- @@ -410,13 +410,13 @@

    Tera Term

    - DelayPerChar + DelayPerChar 0 <- - DelayPerLine + DelayPerLine 0 <- @@ -632,7 +632,7 @@

    Tera Term

    - FlowCtrl + FlowCtrl none <- @@ -974,7 +974,7 @@

    Tera Term

    - Parity + Parity none <- @@ -1154,7 +1154,7 @@

    Tera Term

    - StopBit + StopBit 1 <- diff --git a/doc/ja/teraterm.hhc b/doc/ja/teraterm.hhc index 8d7799331..6cb920063 100644 --- a/doc/ja/teraterm.hhc +++ b/doc/ja/teraterm.hhc @@ -556,6 +556,11 @@
    +
  • + + + +
  • diff --git a/doc/ja/teraterm.hhp b/doc/ja/teraterm.hhp index 33081cf7c..8e2b526a1 100755 --- a/doc/ja/teraterm.hhp +++ b/doc/ja/teraterm.hhp @@ -139,6 +139,7 @@ HlpMenuSetupAdditionalCtrlSeq=html\menu\setup-additional-ctrlseq.html HlpMenuSetupAdditionalCygwin=html\menu\setup-additional-cygwin.html HlpMenuSetupAdditionalWindow=html\menu\setup-additional-window.html HlpMenuSetupAdditionalTerminal=html\menu\setup-additional-terminal.html +HlpMenuSetupAdditionalSerialPort=html\menu\setup-additional-serialport.html HlpMenuSetupThemeEditor=html\menu\setup-additional-visual-theme.html HlpMenuSetupSave=html\menu\setup-save.html HlpMenuSetupRestore=html\menu\setup-restore.html diff --git a/installer/release/lang_utf8/English.lng b/installer/release/lang_utf8/English.lng index 9f0ed5ac6..843ae9e2c 100644 --- a/installer/release/lang_utf8/English.lng +++ b/installer/release/lang_utf8/English.lng @@ -1,6 +1,6 @@ [Info] language=English -date=2025-01-04 by TeraTerm Project +date=2025-01-20 by TeraTerm Project contributor=- [Tera Term] @@ -376,7 +376,7 @@ DLG_ABOUT_TITLE=About Tera Term DLG_SELECT_DIR_TITLE=Select new directory DLG_GEN_TITLE=Tera Term: General setup -DLG_GEN_PORT=Default &port: +DLG_GEN_PORT=New &connection default DLG_GEN_LANG_UI=Language&UI: DLG_GEN_UILANG=UI &Language: @@ -397,7 +397,7 @@ DLG_KEYB_DISABLE=Disabled mode: DLG_KEYB_APPKEY=&Application Keypad DLG_KEYB_APPCUR=Application &Cursor -DLG_SERIAL_TITLE=Tera Term: Serial port setup and connection +DLG_SERIAL_TITLE=Serial port DLG_SERIAL_PORT=&Port: DLG_SERIAL_BAUD=Sp&eed: DLG_SERIAL_DATA=&Data: @@ -407,7 +407,6 @@ DLG_SERIAL_FLOW=&Flow control: DLG_SERIAL_DELAY=Transmit delay DLG_SERIAL_DELAYCHAR=msec/&char DLG_SERIAL_DELAYLINE=msec/&line -DLG_SERIAL_SPEED_TOOLTIP=You can directly specify a number DLG_SERIAL_OK_CONNECTION=Connect with &New window DLG_SERIAL_OK_OPEN=&New open DLG_SERIAL_OK_CLOSEOPEN=Close and &New open diff --git a/installer/release/lang_utf8/French.lng b/installer/release/lang_utf8/French.lng index 157893b74..7d575a431 100644 --- a/installer/release/lang_utf8/French.lng +++ b/installer/release/lang_utf8/French.lng @@ -1,6 +1,6 @@ [Info] language=French -date=2025-01-04 by TeraTerm Project +date=2025-01-20 by TeraTerm Project contributor=Francois MOCQ (2010-07-21) [Tera Term] @@ -373,8 +373,9 @@ DLG_ABOUT_TITLE=A propos de Tera Term DLG_SELECT_DIR_TITLE=Selectionner un nouveau répertoire DLG_GEN_TITLE=Tera Term: Configuration générale -DLG_GEN_PORT=Port par défaut: +DLG_GEN_PORT=New &connection default DLG_GEN_LANG_UI=Language&UI: +DLG_GEN_UILANG=UI &Language: DLG_HOST_TITLE=Tera Term: Nouvelle connexion DLG_HOST_TCPIPHOST=Hôte: @@ -393,7 +394,7 @@ DLG_KEYB_DISABLE=Dévalider le mode: DLG_KEYB_APPKEY=Codes pavé numérique DLG_KEYB_APPCUR=Codes Curseur pavé numérique -DLG_SERIAL_TITLE=Tera Term: Serial port setup and connection +DLG_SERIAL_TITLE=Serial port DLG_SERIAL_PORT=&Port: DLG_SERIAL_BAUD=&Vitesse: DLG_SERIAL_DATA=&Données: @@ -403,7 +404,6 @@ DLG_SERIAL_FLOW=Ctrl. de flux: DLG_SERIAL_DELAY=Délai de transmission DLG_SERIAL_DELAYCHAR=msec/&car DLG_SERIAL_DELAYLINE=msec/&ligne -DLG_SERIAL_SPEED_TOOLTIP=You can directly specify a number DLG_SERIAL_OK_CONNECTION=Connect with &New window DLG_SERIAL_OK_OPEN=&New open DLG_SERIAL_OK_CLOSEOPEN=Close and &New open diff --git a/installer/release/lang_utf8/German.lng b/installer/release/lang_utf8/German.lng index a53f46f94..bb05a7490 100644 --- a/installer/release/lang_utf8/German.lng +++ b/installer/release/lang_utf8/German.lng @@ -1,6 +1,6 @@ [Info] language=German -date=2025-01-04 by TeraTerm Project +date=2025-01-20 by TeraTerm Project contributor=Frederik Schwarzer (2010-05-17) [Tera Term] @@ -373,7 +373,7 @@ DLG_ABOUT_TITLE=Über Tera Term DLG_SELECT_DIR_TITLE=Neues Verzeichnis wählen DLG_GEN_TITLE=Tera-Grundeinstellungen -DLG_GEN_PORT=Standard-Port +DLG_GEN_PORT=New &connection default DLG_GEN_LANG_UI=Language&UI: DLG_HOST_TITLE=Tera Term: Neue Verbindung @@ -393,7 +393,7 @@ DLG_KEYB_DISABLE=Abschalten: DLG_KEYB_APPKEY=Anwendungs-Keypad DLG_KEYB_APPCUR=Anwendungs-Cursor -DLG_SERIAL_TITLE=Tera Term: Serial port setup and connection +DLG_SERIAL_TITLE=Serial port DLG_SERIAL_PORT=Port: DLG_SERIAL_BAUD=Sp&eed: DLG_SERIAL_DATA=Data: @@ -403,7 +403,6 @@ DLG_SERIAL_FLOW=Flow control: DLG_SERIAL_DELAY=Transmit delay DLG_SERIAL_DELAYCHAR=msec/char DLG_SERIAL_DELAYLINE=msec/line -DLG_SERIAL_SPEED_TOOLTIP=You can directly specify a number DLG_SERIAL_OK_CONNECTION=Connect with &New window DLG_SERIAL_OK_OPEN=&New open DLG_SERIAL_OK_CLOSEOPEN=Close and &New open diff --git a/installer/release/lang_utf8/Japanese.lng b/installer/release/lang_utf8/Japanese.lng index b3c0cbe10..4985e96d4 100644 --- a/installer/release/lang_utf8/Japanese.lng +++ b/installer/release/lang_utf8/Japanese.lng @@ -1,6 +1,6 @@ [Info] language=Japanese(日本語) -date=2025-01-04 by TeraTerm Project +date=2025-01-20 by TeraTerm Project contributor=- [Tera Term] @@ -376,7 +376,7 @@ DLG_ABOUT_TITLE=Tera Term について DLG_SELECT_DIR_TITLE=新しいディレクトリを選択してください DLG_GEN_TITLE=Tera Term: 全般設定 -DLG_GEN_PORT=標準のポート(&P): +DLG_GEN_PORT=新しい接続のデフォルト(&C): DLG_GEN_LANG_UI=言語UI(&U): DLG_GEN_UILANG=UI言語(&L): @@ -397,7 +397,7 @@ DLG_KEYB_DISABLE=無効化するモード DLG_KEYB_APPKEY=アプリケーションキーパッド(&A) DLG_KEYB_APPCUR=アプリケーションカーソル(&C) -DLG_SERIAL_TITLE=Tera Term: シリアルポート 設定と接続 +DLG_SERIAL_TITLE=シリアルポート DLG_SERIAL_PORT=ポート(&P): DLG_SERIAL_BAUD=スピード(&E): DLG_SERIAL_DATA=データ(&D): @@ -407,7 +407,6 @@ DLG_SERIAL_FLOW=フロー制御(&F): DLG_SERIAL_DELAY=送信遅延 DLG_SERIAL_DELAYCHAR=ミリ秒/字(&C) DLG_SERIAL_DELAYLINE=ミリ秒/行(&L) -DLG_SERIAL_SPEED_TOOLTIP=数値を直接入力できます DLG_SERIAL_OK_CONNECTION=新しいウィンドウで接続(&N) DLG_SERIAL_OK_OPEN=新規オープン(&N) DLG_SERIAL_OK_CLOSEOPEN=クローズ&新規オープン(&N) diff --git a/installer/release/lang_utf8/Korean.lng b/installer/release/lang_utf8/Korean.lng index 6590b9276..531f04a6b 100644 --- a/installer/release/lang_utf8/Korean.lng +++ b/installer/release/lang_utf8/Korean.lng @@ -1,6 +1,6 @@ [Info] language=Korean -date=2025-01-04 by TeraTerm Project +date=2025-01-20 by TeraTerm Project contributor=Daehong Kim (2013-07-25) [Tera Term] @@ -373,7 +373,7 @@ DLG_ABOUT_TITLE=Tera Term에 대하여 DLG_SELECT_DIR_TITLE=새로운 경로를 선택하세요 DLG_GEN_TITLE=Tera Term: 일반설정 -DLG_GEN_PORT=기본 포트(&P): +DLG_GEN_PORT=New &connection default DLG_GEN_LANG_UI=UI 언어(&U): DLG_HOST_TITLE=Tera Term: 새 연결 @@ -393,7 +393,7 @@ DLG_KEYB_DISABLE=비활성화 모드: DLG_KEYB_APPKEY=어플리케이션 키패드(&A) DLG_KEYB_APPCUR=어플리케이션 커서(&C) -DLG_SERIAL_TITLE=Tera Term: Serial port setup and connection +DLG_SERIAL_TITLE=Serial port DLG_SERIAL_PORT=포트(&P): DLG_SERIAL_BAUD=속도(&E): DLG_SERIAL_DATA=데이터(&D): @@ -403,7 +403,6 @@ DLG_SERIAL_FLOW=흐름제어(&F): DLG_SERIAL_DELAY=전송지연 DLG_SERIAL_DELAYCHAR=msec/&char DLG_SERIAL_DELAYLINE=msec/&line -DLG_SERIAL_SPEED_TOOLTIP=You can directly specify a number DLG_SERIAL_OK_CONNECTION=Connect with &New window DLG_SERIAL_OK_OPEN=&New open DLG_SERIAL_OK_CLOSEOPEN=Close and &New open diff --git a/installer/release/lang_utf8/Russian.lng b/installer/release/lang_utf8/Russian.lng index df21196cd..0f0ec520d 100644 --- a/installer/release/lang_utf8/Russian.lng +++ b/installer/release/lang_utf8/Russian.lng @@ -1,6 +1,6 @@ [Info] language=Russian -date=2025-01-04 by TeraTerm Project +date=2025-01-20 by TeraTerm Project contributor=Ryumik Sergey (2017-07-19) [Tera Term] @@ -373,7 +373,7 @@ DLG_ABOUT_TITLE=О программе Tera Term DLG_SELECT_DIR_TITLE=Выбрать новую папку DLG_GEN_TITLE=Tera Term: Общие настройки -DLG_GEN_PORT=&Порт: +DLG_GEN_PORT=New &connection default DLG_GEN_LANG_UI=&Язык меню: DLG_HOST_TITLE=Tera Term: Новое соединение @@ -393,7 +393,7 @@ DLG_KEYB_DISABLE=Альтернатива: DLG_KEYB_APPKEY=&Применить Keypad DLG_KEYB_APPCUR=Применить &Cursor -DLG_SERIAL_TITLE=Tera Term: Serial port setup and connection +DLG_SERIAL_TITLE=Serial port DLG_SERIAL_PORT=&Порт: DLG_SERIAL_BAUD=&Скорость: DLG_SERIAL_DATA=&Данные: @@ -403,7 +403,6 @@ DLG_SERIAL_FLOW=&Управление: DLG_SERIAL_DELAY=Задержка передачи DLG_SERIAL_DELAYCHAR=мс/&символ DLG_SERIAL_DELAYLINE=мс/&строка -DLG_SERIAL_SPEED_TOOLTIP=You can directly specify a number DLG_SERIAL_OK_CONNECTION=Connect with &New window DLG_SERIAL_OK_OPEN=&New open DLG_SERIAL_OK_CLOSEOPEN=Close and &New open diff --git a/installer/release/lang_utf8/Simplified Chinese.lng b/installer/release/lang_utf8/Simplified Chinese.lng index a5caf06d9..41d89a9a1 100644 --- a/installer/release/lang_utf8/Simplified Chinese.lng +++ b/installer/release/lang_utf8/Simplified Chinese.lng @@ -1,6 +1,6 @@ [Info] language=Simplified Chinese -date=2025-01-04 by TeraTerm Project +date=2025-01-20 by TeraTerm Project contributor=LiShaohui (2017-04-11) [Tera Term] @@ -373,7 +373,7 @@ DLG_ABOUT_TITLE=关于 Tera Term DLG_SELECT_DIR_TITLE=选择新文件夹 DLG_GEN_TITLE=Tera Term:常规设置 -DLG_GEN_PORT=端口(&P): +DLG_GEN_PORT=New &connection default DLG_GEN_LANG_UI=界面语言(&U): DLG_HOST_TITLE=Tera Term:新建连接 @@ -393,7 +393,7 @@ DLG_KEYB_DISABLE=禁用模式: DLG_KEYB_APPKEY=应用键盘(&A) DLG_KEYB_APPCUR=应用鼠标(&C) -DLG_SERIAL_TITLE=Tera Term: Serial port setup and connection +DLG_SERIAL_TITLE=Serial port DLG_SERIAL_PORT=端口(&P): DLG_SERIAL_BAUD=比特率(&E): DLG_SERIAL_DATA=数据位(&D): @@ -403,7 +403,6 @@ DLG_SERIAL_FLOW=流量控制(&F): DLG_SERIAL_DELAY=传输延迟 DLG_SERIAL_DELAYCHAR=毫秒/字符 DLG_SERIAL_DELAYLINE=毫秒/行 -DLG_SERIAL_SPEED_TOOLTIP=You can directly specify a number DLG_SERIAL_OK_CONNECTION=Connect with &New window DLG_SERIAL_OK_OPEN=&New open DLG_SERIAL_OK_CLOSEOPEN=Close and &New open diff --git a/installer/release/lang_utf8/Spanish.lng b/installer/release/lang_utf8/Spanish.lng index 93984ec07..6fde45684 100644 --- a/installer/release/lang_utf8/Spanish.lng +++ b/installer/release/lang_utf8/Spanish.lng @@ -1,6 +1,6 @@ [Info] language=Spanish -date=2025-01-04 by TeraTerm Project +date=2025-01-20 by TeraTerm Project contributor=Filiberto Olguin Ascona (2022-05-26) [Tera Term] @@ -373,7 +373,7 @@ DLG_ABOUT_TITLE=About Tera Term DLG_SELECT_DIR_TITLE=Select new directory DLG_GEN_TITLE=Tera Term: General setup -DLG_GEN_PORT=Default &port: +DLG_GEN_PORT=New &connection default DLG_GEN_LANG_UI=Language&UI: DLG_HOST_TITLE=Tera Term: New connection @@ -393,7 +393,7 @@ DLG_KEYB_DISABLE=Disabled mode: DLG_KEYB_APPKEY=&Application Keypad DLG_KEYB_APPCUR=Application &Cursor -DLG_SERIAL_TITLE=Tera Term: Serial port setup +DLG_SERIAL_TITLE=Serial port DLG_SERIAL_PORT=&Port: DLG_SERIAL_BAUD=&Baud rate: DLG_SERIAL_DATA=&Data: @@ -403,7 +403,6 @@ DLG_SERIAL_FLOW=&Flow control: DLG_SERIAL_DELAY=Transmit delay DLG_SERIAL_DELAYCHAR=msec/&char DLG_SERIAL_DELAYLINE=msec/&line -DLG_SERIAL_SPEED_TOOLTIP=You can directly specify a number DLG_SERIAL_OK_CONNECTION=Connect with &New window DLG_SERIAL_OK_OPEN=&New open DLG_SERIAL_OK_CLOSEOPEN=Close and &New open diff --git a/installer/release/lang_utf8/Tamil.lng b/installer/release/lang_utf8/Tamil.lng index 7dab1184f..4e5e2a62d 100644 --- a/installer/release/lang_utf8/Tamil.lng +++ b/installer/release/lang_utf8/Tamil.lng @@ -1,6 +1,6 @@ [Info] language=Tamil(தமிழ்) -date=2025-01-04 by TeraTerm Project +date=2025-01-20 by TeraTerm Project contributor=திட்டத்தால் புதுப்பிக்கப்பட்டது (2024-02-24) [Tera Term] @@ -373,7 +373,7 @@ DLG_ABOUT_TITLE=தேரா முனைத்தைப் பற்றி DLG_SELECT_DIR_TITLE=புதிய கோப்பகத்தைத் தேர்ந்தெடுக்கவும் DLG_GEN_TITLE=தேரா முனை: பொது அமைப்பு -DLG_GEN_PORT=இயல்புநிலை &துறைமுகம்: +DLG_GEN_PORT=New &connection default DLG_GEN_LANG_UI=மொழி இடைமுகம்: DLG_HOST_TITLE=தேரா முனை: புதிய இணைப்பு @@ -393,7 +393,7 @@ DLG_KEYB_DISABLE=முடக்கப்பட்ட பயன்முறை: DLG_KEYB_APPKEY=&பயன்பாட்டு விசைப்பலகை DLG_KEYB_APPCUR=பயன்பாடு &சிமிட்டும் கோடு -DLG_SERIAL_TITLE=தேரா முனை: தொடர் துறைமுகம் அமைவு மற்றும் இணைப்பு +DLG_SERIAL_TITLE=தொடர் துறைமுகம் DLG_SERIAL_PORT=&துறைமுகம்: DLG_SERIAL_BAUD=வேகம்: DLG_SERIAL_DATA=&தரவு: @@ -403,7 +403,6 @@ DLG_SERIAL_FLOW=&ஓட்டம் கட்டுப்பாடு: DLG_SERIAL_DELAY=அனுப்பும் தாமதம் DLG_SERIAL_DELAYCHAR=மிநொடி/&எழுத்து DLG_SERIAL_DELAYLINE=மிநொடி/&வரி -DLG_SERIAL_SPEED_TOOLTIP=நீங்கள் நேரடியாக எண்ணைக் குறிப்பிடலாம் DLG_SERIAL_OK_CONNECTION=&புதிய சாளரத்துடன் இணைக்கவும் DLG_SERIAL_OK_OPEN=&புதிய திறந்தது DLG_SERIAL_OK_CLOSEOPEN=மூடு மற்றும் &புதிய திற diff --git a/installer/release/lang_utf8/Traditional Chinese.lng b/installer/release/lang_utf8/Traditional Chinese.lng index 037184acf..ee8d24c67 100644 --- a/installer/release/lang_utf8/Traditional Chinese.lng +++ b/installer/release/lang_utf8/Traditional Chinese.lng @@ -1,6 +1,6 @@ [Info] language=Traditional Chinese -date=2025-01-04 by TeraTerm Project +date=2025-01-20 by TeraTerm Project contributor=kikiqqp (2014-09-20) [Tera Term] @@ -373,7 +373,7 @@ DLG_ABOUT_TITLE=關於 Tera Term DLG_SELECT_DIR_TITLE=選擇新文件夾 DLG_GEN_TITLE=Tera Term:設定設定 -DLG_GEN_PORT=端口(&P): +DLG_GEN_PORT=New &connection default DLG_GEN_LANG_UI=界面語言(&U): DLG_HOST_TITLE=Tera Term:建立新連線 @@ -393,7 +393,7 @@ DLG_KEYB_DISABLE=禁用模式: DLG_KEYB_APPKEY=使用鍵盤(&A) DLG_KEYB_APPCUR=使用滑鼠(&C) -DLG_SERIAL_TITLE=Tera Term: Serial port setup and connection +DLG_SERIAL_TITLE=Serial port DLG_SERIAL_PORT=端口(&P): DLG_SERIAL_BAUD=位元速率(&E): DLG_SERIAL_DATA=資料位元(&D): @@ -403,7 +403,6 @@ DLG_SERIAL_FLOW=流量控制(&F): DLG_SERIAL_DELAY=傳輸延遲 DLG_SERIAL_DELAYCHAR=毫秒/字符 DLG_SERIAL_DELAYLINE=毫秒/行 -DLG_SERIAL_SPEED_TOOLTIP=You can directly specify a number DLG_SERIAL_OK_CONNECTION=Connect with &New window DLG_SERIAL_OK_OPEN=&New open DLG_SERIAL_OK_CLOSEOPEN=Close and &New open diff --git a/teraterm/common/comportinfo.cpp b/teraterm/common/comportinfo.cpp index 532ce5627..aad37a797 100644 --- a/teraterm/common/comportinfo.cpp +++ b/teraterm/common/comportinfo.cpp @@ -90,6 +90,9 @@ #define INITGUID #include +// 1̂ƂA"COM%d" ̂݌o +#define DETECT_COM_ONLY 1 + /** * |[g擾 */ @@ -326,7 +329,7 @@ static ComPortInfo_t *ComPortInfoGetByGetSetupAPI(int *count) continue; } -#if 1 +#if DETECT_COM_ONLY // "COM%d" ł͂ȂꍇAoȂ if (wcsncmp(port_name, L"COM", 3) != 0) { free(port_name); diff --git a/teraterm/common/dlglib_cpp.cpp b/teraterm/common/dlglib_cpp.cpp index 4043e3dd4..7c5949a0a 100644 --- a/teraterm/common/dlglib_cpp.cpp +++ b/teraterm/common/dlglib_cpp.cpp @@ -238,6 +238,7 @@ void ExpandCBWidth(HWND dlg, int ID) free(text); } max_width += GetSystemMetrics(SM_CXVSCROLL); // XN[o[̕ł + max_width += 2 * GetSystemMetrics( SM_CYFIXEDFRAME ); SendMessageW(hCtrlWnd, CB_SETDROPPEDWIDTH, max_width, 0); SelectObject(TmpDC, hFont); ReleaseDC(hCtrlWnd, TmpDC); diff --git a/teraterm/common/helpid.h b/teraterm/common/helpid.h index 865d595fb..fac178abd 100644 --- a/teraterm/common/helpid.h +++ b/teraterm/common/helpid.h @@ -164,6 +164,7 @@ #define HlpMenuSetupAdditionalCygwin 43032 #define HlpMenuSetupAdditionalWindow 43033 #define HlpMenuSetupAdditionalTerminal 43034 +#define HlpMenuSetupAdditionalSerialPort 43036 #define HlpMenuSetupSave 43013 #define HlpMenuSetupRestore 43014 #define HlpMenuSetupDir 43016 diff --git a/teraterm/teraterm/CMakeLists.txt b/teraterm/teraterm/CMakeLists.txt index b78cff74c..b9efd40f6 100644 --- a/teraterm/teraterm/CMakeLists.txt +++ b/teraterm/teraterm/CMakeLists.txt @@ -127,6 +127,8 @@ set(SRC_DIALOG resource.h sendfiledlg.cpp sendfiledlg.h + serial_pp.cpp + serial_pp.h setupdirdlg.cpp setupdirdlg.h tcpip_pp.cpp diff --git a/teraterm/teraterm/addsetting.cpp b/teraterm/teraterm/addsetting.cpp index d7ca15aa4..9bc3cd744 100644 --- a/teraterm/teraterm/addsetting.cpp +++ b/teraterm/teraterm/addsetting.cpp @@ -61,6 +61,7 @@ #include "tcpip_pp.h" #include "term_pp.h" #include "win_pp.h" +#include "serial_pp.h" #include "addsetting.h" @@ -1532,6 +1533,8 @@ CAddSettingPropSheetDlg::CAddSettingPropSheetDlg(HINSTANCE hInstance, HWND hPare AddPage(page); page = CreateTerminalPP(hInstance, hParentWnd, & ts); AddPage(page); + page = SerialPageCreate(hInstance, &ts); + AddPage(page); } page = CreateWinPP(hInstance, hParentWnd, &ts); AddPage(page); @@ -1571,6 +1574,9 @@ void CAddSettingPropSheetDlg::SetStartPage(Page page) start_page = 12; break; case WinPage: + start_page = 14; + break; + case SerialPortPage: start_page = 13; break; default: diff --git a/teraterm/teraterm/addsetting.h b/teraterm/teraterm/addsetting.h index 44290cf9b..e88b34320 100644 --- a/teraterm/teraterm/addsetting.h +++ b/teraterm/teraterm/addsetting.h @@ -57,6 +57,7 @@ class CAddSettingPropSheetDlg: public TTCPropSheetDlg GeneralPage, TermPage, WinPage, + SerialPortPage, }; void SetStartPage(Page page); @@ -79,6 +80,7 @@ typedef enum { GeneralPage, TermPage, WinPage, + SerialPortPage, } CAddSettingPropSheetDlgPage; typedef enum { diff --git a/teraterm/teraterm/externalsetup.cpp b/teraterm/teraterm/externalsetup.cpp index e99aa024e..a1caefa5f 100644 --- a/teraterm/teraterm/externalsetup.cpp +++ b/teraterm/teraterm/externalsetup.cpp @@ -90,6 +90,9 @@ static void ExternalSetupPreProcess(CAddSettingPropSheetDlgPage page) if (all || page == CAddSettingPropSheetDlgPage::WinPage) { ExternalSetupData.orgTitle = _strdup(ts.Title); } + if (all || page == CAddSettingPropSheetDlgPage::SerialPortPage) { + ; + } } /** @@ -159,6 +162,42 @@ static void ExternalSetupPostProcess(CAddSettingPropSheetDlgPage page, BOOL ok) free(ExternalSetupData.orgTitle); ExternalSetupData.orgTitle = NULL; } + if (all || page == CAddSettingPropSheetDlgPage::SerialPortPage) { + if (ok) { + if (ts.ComPort > 0) { + + if (cv.Ready && (cv.PortType != IdSerial)) { + // VAȊOɐڑ̏ꍇ + // TODO cv.Ready cv.Open̍? +#if 0 + OpenNewComport(&ts); + return; +#endif + } + else if (!cv.Open) { + // ڑ̏ꍇ +#if 0 + CommOpen(m_hWnd,&ts,&cv); +#endif + } + else { + // VAɐڑ̏ꍇ +#if 0 + if (ts.ComPort != cv.ComPort) { + // |[gύX + CommClose(&cv); + CommOpen(HVTWin,&ts,&cv); + } + else +#endif + { + // ʐMp[^ύX + CommResetSerial(&ts, &cv, ts.ClearComBuffOnOpen); + } + } + } + } + } } /** @@ -286,3 +325,14 @@ void OpenSetupGeneral() BOOL r = (*SetupGeneral)(HVTWin,&ts); ExternalSetupPostProcess(CAddSettingPropSheetDlgPage::GeneralPage, r); } + +void OpenSetupSerialPort() +{ + if (! LoadTTDLG()) { + return; + } + ExternalSetupPreProcess(CAddSettingPropSheetDlgPage::SerialPortPage); + BOOL r = (*SetupSerialPort)(HVTWin, &ts); + ExternalSetupPostProcess(CAddSettingPropSheetDlgPage::SerialPortPage, r); +} + diff --git a/teraterm/teraterm/general_pp.cpp b/teraterm/teraterm/general_pp.cpp index 949f166d6..b1be6fc4f 100644 --- a/teraterm/teraterm/general_pp.cpp +++ b/teraterm/teraterm/general_pp.cpp @@ -307,27 +307,9 @@ void CGeneralPropPageDlg::OnInitDialog() } // default port - { - WORD w; - SendDlgItemMessageA(IDC_GENPORT, CB_ADDSTRING, 0, (LPARAM) "TCP/IP"); - for (w=1;w<=pts->MaxComPort;w++) { - char Temp[8]; - _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "COM%d", w); - SendDlgItemMessageA(IDC_GENPORT, CB_ADDSTRING, 0, (LPARAM)Temp); - } - if (pts->PortType==IdSerial) { - if (pts->ComPort <= pts->MaxComPort) { - w = pts->ComPort; - } - else { - w = 1; // COM1 - } - } - else { - w = 0; // TCP/IP - } - SendDlgItemMessageA(IDC_GENPORT, CB_SETCURSEL, w, 0); - } + SendDlgItemMessageA(IDC_GENPORT, CB_ADDSTRING, 0, (LPARAM)"TCP/IP"); + SendDlgItemMessageA(IDC_GENPORT, CB_ADDSTRING, 0, (LPARAM)"Serial"); + SendDlgItemMessageA(IDC_GENPORT, CB_SETCURSEL, (pts->PortType == IdSerial) ? 1 : 0, 0); // File transfer dir SetDlgItemTextW(IDC_FILE_DIR, pts->FileDirW); diff --git a/teraterm/teraterm/serial_pp.cpp b/teraterm/teraterm/serial_pp.cpp new file mode 100644 index 000000000..ac6313a79 --- /dev/null +++ b/teraterm/teraterm/serial_pp.cpp @@ -0,0 +1,529 @@ +/* + * Copyright (C) 1994-1998 T. Teranishi + * (C) 2024- TeraTerm Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* serial dialog */ + +#include +#include +#define _CRTDBG_MAP_ALLOC +#include +#include +#include + +#include "tttypes.h" +#include "ttlib.h" +#include "dlglib.h" +#include "dlg_res.h" +#include "comportinfo.h" +#include "helpid.h" +#include "asprintf.h" +#include "win32helper.h" +#include "compat_win.h" +#include "ttwinman.h" + +#include "serial_pp.h" + +// ev[g̏s +#define REWRITE_TEMPLATE + +// ݂VA|[ĝ݂\ +//#define SHOW_ONLY_EXSITING_PORT TRUE +#define SHOW_ONLY_EXSITING_PORT FALSE // ׂẴ|[g\ + +// hbv_E|[g\؂ւ +//#define ENABLE_SWITCH_PORT_DISPLAY 1 +#define ENABLE_SWITCH_PORT_DISPLAY 0 + +// MaxComPort傫ȃ|[g݂ƂAMaxComPortI[o[Ch +#define ENABLE_MAXCOMPORT_OVERRIDE 0 + +static const char *BaudList[] = { + "110","300","600","1200","2400","4800","9600", + "14400","19200","38400","57600","115200", + "230400", "460800", "921600", NULL}; +static const char *DataList[] = {"7 bit","8 bit",NULL}; +static const char *ParityList[] = {"none", "odd", "even", "mark", "space", NULL}; +static const char *StopList[] = {"1 bit", "2 bit", NULL}; +static const char *FlowList[] = {"Xon/Xoff", "RTS/CTS", "DSR/DTR", "none", NULL}; + +typedef struct { + PTTSet pts; + ComPortInfo_t *ComPortInfoPtr; + int ComPortInfoCount; + HINSTANCE hInst; + DLGTEMPLATE *dlg_templ; + int g_deltaSumSerialDlg; // }EXzC[Deltaݐϗp + WNDPROC g_defSerialDlgEditWndProc; // Edit Control̃TuNXp + BOOL show_all_port; +} SerialDlgData; + +/* + * VA|[gݒ_CAÕeLXg{bNXCOM|[g̏ڍ׏\B + * @param port_index port_info[] ̃CfbNX, -1̂ƂgpȂ + * @param port_no |[gԍ "com%d", -1̂ƂgpȂ + * @param port_name port_name |[g + */ +static void serial_dlg_set_comport_info(HWND dlg, SerialDlgData *dlg_data, int port_index, int port_no, const wchar_t *port_name) +{ + const wchar_t *text = L"This port does not exist now."; + if (port_index != -1) { + if (port_index < dlg_data->ComPortInfoCount ) { + const ComPortInfo_t *p = &dlg_data->ComPortInfoPtr[port_index]; + text = p->property; + } + } + else if (port_no != -1) { + const ComPortInfo_t *p = dlg_data->ComPortInfoPtr; + for (int i = 0; i < dlg_data->ComPortInfoCount; p++,i++) { + if (p->port_no == port_no) { + text = p->property; + break; + } + } + } + else if (port_name != NULL) { + const ComPortInfo_t *p = dlg_data->ComPortInfoPtr; + for (int i = 0; i < dlg_data->ComPortInfoCount; p++,i++) { + if (wcscmp(p->port_name, port_name) == 0) { + text = p->property; + break; + } + } + } + SetDlgItemTextW(dlg, IDC_SERIALTEXT, text); +} + +/* + * VA|[gݒ_CAÕeLXg{bNX̃vV[W + */ +static LRESULT CALLBACK SerialDlgEditWindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) +{ + SerialDlgData *dlg_data = (SerialDlgData *)GetWindowLongPtrW(hWnd, GWLP_USERDATA); + + switch (msg) { + case WM_KEYDOWN: + // Edit control CTRL+A ƁAeLXgSIB + if (wp == 'A' && GetKeyState(VK_CONTROL) < 0) { + PostMessage(hWnd, EM_SETSEL, 0, -1); + return 0; + } + break; + + case WM_MOUSEWHEEL: { + // CTRLorSHIFT + }EXzC[̏ꍇAXN[B + WORD keys; + short delta; + BOOL page; + keys = GET_KEYSTATE_WPARAM(wp); + delta = GET_WHEEL_DELTA_WPARAM(wp); + page = keys & (MK_CONTROL | MK_SHIFT); + + if (page == 0) + break; + + dlg_data->g_deltaSumSerialDlg += delta; + + if (dlg_data->g_deltaSumSerialDlg >= WHEEL_DELTA) { + dlg_data->g_deltaSumSerialDlg -= WHEEL_DELTA; + SendMessage(hWnd, WM_HSCROLL, SB_PAGELEFT , 0); + } else if (dlg_data->g_deltaSumSerialDlg <= -WHEEL_DELTA) { + dlg_data->g_deltaSumSerialDlg += WHEEL_DELTA; + SendMessage(hWnd, WM_HSCROLL, SB_PAGERIGHT, 0); + } + + break; + } + } + return CallWindowProc(dlg_data->g_defSerialDlgEditWndProc, hWnd, msg, wp, lp); +} + +/** + * VA|[ghbv_Eݒ肷 + * ITEMDATA + * 0... PortInfo̐擪̔ԍ 0PortInfoCount-1܂ + * -1 ݑ݂Ȃ|[g + * -2 "݂|[ĝݕ\" + * -3 "SẴ|[g\" + */ +static void SetPortDrop(HWND hWnd, int id, SerialDlgData *dlg_data) +{ + PTTSet ts = dlg_data->pts; + BOOL show_all_port = dlg_data->show_all_port; + int max_com = ts->MaxComPort; + if (max_com < ts->ComPort) { + max_com = ts->ComPort; + } +#if ENABLE_MAXCOMPORT_OVERRIDE + if (dlg_data->ComPortInfoCount != 0) { + int max_exist_port = dlg_data->ComPortInfoPtr[dlg_data->ComPortInfoCount-1].port_no; + if (max_com < max_exist_port) { + max_com = max_exist_port; + } + } +#endif + if (dlg_data->ComPortInfoCount == 0) { + // |[g݂ĂȂƂׂ͂ĕ\ + show_all_port = TRUE; + } + + // "COM%d" ł͂Ȃ|[g + int port_index = 0; + int skip_count = 0; + const ComPortInfo_t *port_info = dlg_data->ComPortInfoPtr; + const ComPortInfo_t *p; + for (int i = 0; i < dlg_data->ComPortInfoCount; i++) { + p = port_info + port_index; + if (wcsncmp(p->port_name, L"COM", 3) == 0) { + break; + } + port_index++; + wchar_t *name; + if (p->friendly_name != NULL) { + aswprintf(&name, L"%s: %s", p->port_name, p->friendly_name); + } + else { + aswprintf(&name, L"%s: (no name, exists)", p->port_name); + } + LRESULT index = SendDlgItemMessageW(hWnd, id, CB_ADDSTRING, 0, (LPARAM)name); + free(name); + SendDlgItemMessageA(hWnd, id, CB_SETITEMDATA, index, i); + skip_count++; + } + + // `I "COM%d" + int sel_index = 0; + int com_count = 0; + BOOL all = show_all_port; + for (int i = 1; i <= max_com; i++) { + + wchar_t *com_name = NULL; + int item_data; + if (port_index < dlg_data->ComPortInfoCount) { + p = port_info + port_index; + if (p->port_no == i) { + // ComPortInfo Ōoł|[g + item_data = port_index; + port_index++; + + if (p->friendly_name != NULL) { + aswprintf(&com_name, L"%s: %s", p->port_name, p->friendly_name); + } + else { + aswprintf(&com_name, L"%s: (no friendly name, exist)", p->port_name); + } + } + } + + if (com_name == NULL) { + // ołȂ|[g(݂Ȃ|[g) + if (!all && (i != ts->ComPort)) { + // ׂĕ\Ȃ + continue; + } + aswprintf(&com_name, L"COM%d", i); + item_data = -1; + } + + LRESULT index = SendDlgItemMessageW(hWnd, id, CB_ADDSTRING, 0, (LPARAM)com_name); + SendDlgItemMessageA(hWnd, id, CB_SETITEMDATA, index, item_data); + free(com_name); + com_count++; + + if (i == ts->ComPort) { + sel_index = com_count + skip_count; + } + } + + if (ENABLE_SWITCH_PORT_DISPLAY) { + if (show_all_port) { + LRESULT index = SendDlgItemMessageW(hWnd, id, CB_ADDSTRING, 0, (LPARAM)L""); + SendDlgItemMessageA(hWnd, id, CB_SETITEMDATA, index, -2); + } + else { + wchar_t *s; + aswprintf(&s, L"", max_com); + LRESULT index = SendDlgItemMessageW(hWnd, id, CB_ADDSTRING, 0, (LPARAM)s); + free(s); + SendDlgItemMessageA(hWnd, id, CB_SETITEMDATA, index, -3); + } + } + + ExpandCBWidth(hWnd, id); + if (dlg_data->ComPortInfoCount == 0) { + // COM|[gȂ + serial_dlg_set_comport_info(hWnd, dlg_data, -1, -1, NULL); + } + else { + if (cv.Open && (cv.PortType == IdSerial)) { + // ڑ̎͑IłȂ悤ɂ + EnableWindow(GetDlgItem(hWnd, id), FALSE); + } + serial_dlg_set_comport_info(hWnd, dlg_data, -1, ts->ComPort, NULL); + } + SendDlgItemMessage(hWnd, id, CB_SETCURSEL, sel_index - 1, 0); // sel_index = 1 origin +} + +/* + * VA|[gݒ_CAO + * + * VA|[g0̎͌Ă΂Ȃ + */ +static INT_PTR CALLBACK SerialDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam) +{ + static const DlgTextInfo TextInfos[] = { + { IDC_SERIALPORT_LABEL, "DLG_SERIAL_PORT" }, + { IDC_SERIALBAUD_LEBAL, "DLG_SERIAL_BAUD" }, + { IDC_SERIALDATA_LABEL, "DLG_SERIAL_DATA" }, + { IDC_SERIALPARITY_LABEL, "DLG_SERIAL_PARITY" }, + { IDC_SERIALSTOP_LABEL, "DLG_SERIAL_STOP" }, + { IDC_SERIALFLOW_LABEL, "DLG_SERIAL_FLOW" }, + { IDC_SERIALDELAY, "DLG_SERIAL_DELAY" }, + { IDC_SERIALDELAYCHAR_LABEL, "DLG_SERIAL_DELAYCHAR" }, + { IDC_SERIALDELAYLINE_LABEL, "DLG_SERIAL_DELAYLINE" }, + }; + + switch (Message) { + case WM_INITDIALOG: { + + SerialDlgData *dlg_data = (SerialDlgData *)(((PROPSHEETPAGEW_V1 *)lParam)->lParam); + SetWindowLongPtrW(Dialog, DWLP_USER, (LPARAM)dlg_data); + PTTSet ts = dlg_data->pts; + + SetDlgTextsW(Dialog, TextInfos, _countof(TextInfos), ts->UILanguageFileW); + + SetPortDrop(Dialog, IDC_SERIALPORT, dlg_data); + // speed, baud rate + { + int i, sel; + SetDropDownList(Dialog, IDC_SERIALBAUD, BaudList, 0); + i = sel = 0; + while (BaudList[i] != NULL) { + if ((WORD)atoi(BaudList[i]) == ts->Baud) { + SendDlgItemMessage(Dialog, IDC_SERIALBAUD, CB_SETCURSEL, i, 0); + sel = 1; + break; + } + i++; + } + if (!sel) { + SetDlgItemInt(Dialog, IDC_SERIALBAUD, ts->Baud, FALSE); + } + } + + SetDropDownList(Dialog, IDC_SERIALDATA, DataList, ts->DataBit); + SetDropDownList(Dialog, IDC_SERIALPARITY, ParityList, ts->Parity); + SetDropDownList(Dialog, IDC_SERIALSTOP, StopList, ts->StopBit); + + /* + * value display + * 1 IdFlowX 1 Xon/Xoff + * 2 IdFlowHard 2 RTS/CTS + * 3 IdFlowNone 4 none + * 4 IdFlowHardDsrDtr 3 DSR/DTR + */ + WORD Flow = ts->Flow; + if (Flow == 3) { + Flow = 4; + } + else if (Flow == 4) { + Flow = 3; + } + SetDropDownList(Dialog, IDC_SERIALFLOW, FlowList, Flow); + + SetDlgItemInt(Dialog,IDC_SERIALDELAYCHAR,ts->DelayPerChar,FALSE); + SendDlgItemMessage(Dialog, IDC_SERIALDELAYCHAR, EM_LIMITTEXT,4, 0); + + SetDlgItemInt(Dialog,IDC_SERIALDELAYLINE,ts->DelayPerLine,FALSE); + SendDlgItemMessage(Dialog, IDC_SERIALDELAYLINE, EM_LIMITTEXT,4, 0); + + CenterWindow(Dialog, GetParent(Dialog)); + + // Edit controlTuNXB + dlg_data->g_deltaSumSerialDlg = 0; + SetWindowLongPtrW(GetDlgItem(Dialog, IDC_SERIALTEXT), GWLP_USERDATA, (LONG_PTR)dlg_data); + dlg_data->g_defSerialDlgEditWndProc = (WNDPROC)SetWindowLongPtrW( + GetDlgItem(Dialog, IDC_SERIALTEXT), + GWLP_WNDPROC, + (LONG_PTR)SerialDlgEditWindowProc); + + return TRUE; + } + case WM_NOTIFY: { + NMHDR *nmhdr = (NMHDR *)lParam; + SerialDlgData *data = (SerialDlgData *)GetWindowLongPtrW(Dialog, DWLP_USER); + PTTSet ts = data->pts; + switch (nmhdr->code) { + case PSN_APPLY: { + int w; + char Temp[128]; + Temp[0] = 0; + GetDlgItemTextA(Dialog, IDC_SERIALPORT, Temp, sizeof(Temp)-1); + if (strncmp(Temp, "COM", 3) == 0 && Temp[3] != '\0') { + ts->ComPort = (WORD)atoi(&Temp[3]); + } + + GetDlgItemTextA(Dialog, IDC_SERIALBAUD, Temp, sizeof(Temp)-1); + if (atoi(Temp) != 0) { + ts->Baud = (DWORD)atoi(Temp); + } + if ((w = (WORD)GetCurSel(Dialog, IDC_SERIALDATA)) > 0) { + ts->DataBit = w; + } + if ((w = (WORD)GetCurSel(Dialog, IDC_SERIALPARITY)) > 0) { + ts->Parity = w; + } + if ((w = (WORD)GetCurSel(Dialog, IDC_SERIALSTOP)) > 0) { + ts->StopBit = w; + } + if ((w = (WORD)GetCurSel(Dialog, IDC_SERIALFLOW)) > 0) { + /* + * display value + * 1 Xon/Xoff 1 IdFlowX + * 2 RTS/CTS 2 IdFlowHard + * 3 DSR/DTR 4 IdFlowHardDsrDtr + * 4 none 3 IdFlowNone + */ + WORD Flow = w; + if (Flow == 3) { + Flow = 4; + } + else if (Flow == 4) { + Flow = 3; + } + ts->Flow = Flow; + } + + ts->DelayPerChar = GetDlgItemInt(Dialog,IDC_SERIALDELAYCHAR,NULL,FALSE); + + ts->DelayPerLine = GetDlgItemInt(Dialog,IDC_SERIALDELAYLINE,NULL,FALSE); + + // TODO 폜 + // Sʃ^úuW̃|[gvŃftHg̐ڑ|[gw肷 + // ł͎w肵Ȃ + // ts->PortType = IdSerial; + + // {[[gύX邱Ƃ̂ŁA^Cgĕ\ + // bZ[W΂悤ɂB (2007.7.21 maya) + PostMessage(GetParent(Dialog),WM_USER_CHANGETITLE,0,0); + + break; + } + case PSN_HELP: { + HWND vtwin = GetParent(GetParent(Dialog)); + PostMessage(vtwin, WM_USER_DLGHELP2, HlpMenuSetupAdditionalSerialPort, 0); + break; + } + } + break; + } + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_SERIALPORT: + if (HIWORD(wParam) == CBN_SELCHANGE) { + // XgCOM|[gIꂽ + SerialDlgData *dlg_data = (SerialDlgData *)GetWindowLongPtrW(Dialog, DWLP_USER); + LRESULT sel = SendDlgItemMessageA(Dialog, IDC_SERIALPORT, CB_GETCURSEL, 0, 0); + int item_data = (int)SendDlgItemMessageA(Dialog, IDC_SERIALPORT, CB_GETITEMDATA, sel, 0); + if (item_data >= 0) { + // ڍ׏\ + serial_dlg_set_comport_info(Dialog, dlg_data, item_data, -1, NULL); + } + else if (item_data == -1) { + // Ȃ\ + serial_dlg_set_comport_info(Dialog, dlg_data, -1, -1, NULL); + } + else { + // I@ύX + dlg_data->show_all_port = (item_data == -2) ? FALSE : TRUE; + SendDlgItemMessageA(Dialog, IDC_SERIALPORT, CB_RESETCONTENT, 0, 0); + SetPortDrop(Dialog, IDC_SERIALPORT, dlg_data); + } + break; + } + + return TRUE; + } + } + return FALSE; +} + +static UINT CALLBACK CallBack(HWND hwnd, UINT uMsg, struct _PROPSHEETPAGEW *ppsp) +{ + UINT ret_val = 0; + switch (uMsg) { + case PSPCB_CREATE: + ret_val = 1; + break; + case PSPCB_RELEASE: { + SerialDlgData *dlg_data = (SerialDlgData *)ppsp->lParam; + + free((void *)ppsp->pResource); + ppsp->pResource = NULL; + ComPortInfoFree(dlg_data->ComPortInfoPtr, dlg_data->ComPortInfoCount); + free(dlg_data); + ppsp->lParam = (LPARAM)NULL; + break; + } + default: + break; + } + return ret_val; +} + +HPROPSHEETPAGE SerialPageCreate(HINSTANCE inst, TTTSet *pts) +{ + SerialDlgData *Param = (SerialDlgData *)calloc(1, sizeof(SerialDlgData)); + Param->hInst = inst; + Param->pts = pts; + Param->ComPortInfoPtr = ComPortInfoGet(&Param->ComPortInfoCount); + Param->show_all_port = !SHOW_ONLY_EXSITING_PORT; + + PROPSHEETPAGEW_V1 psp = {}; + psp.dwSize = sizeof(psp); + psp.dwFlags = PSP_DEFAULT | PSP_USECALLBACK | PSP_USETITLE | PSP_HASHELP; + psp.hInstance = inst; + psp.pfnCallback = CallBack; + wchar_t *UIMsg; + GetI18nStrWW("Tera Term", "DLG_SERIAL_TITLE", + L"Serial port", pts->UILanguageFileW, &UIMsg); + psp.pszTitle = UIMsg; + psp.pszTemplate = MAKEINTRESOURCEW(IDD_SERIALDLG); +#if defined(REWRITE_TEMPLATE) + psp.dwFlags |= PSP_DLGINDIRECT; + Param->dlg_templ = TTGetDlgTemplate(inst, MAKEINTRESOURCEW(IDD_SERIALDLG)); + psp.pResource = Param->dlg_templ; +#endif + + psp.pfnDlgProc = SerialDlg; + psp.lParam = (LPARAM)Param; + + HPROPSHEETPAGE hpsp = CreatePropertySheetPageW((LPPROPSHEETPAGEW)&psp); + free(UIMsg); + return hpsp; +} diff --git a/teraterm/teraterm/serial_pp.h b/teraterm/teraterm/serial_pp.h new file mode 100644 index 000000000..afa53b41e --- /dev/null +++ b/teraterm/teraterm/serial_pp.h @@ -0,0 +1,39 @@ +/* + * (C) 2020- TeraTerm Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +HPROPSHEETPAGE SerialPageCreate(HINSTANCE inst, TTTSet *pts); + +#ifdef __cplusplus +} +#endif diff --git a/teraterm/teraterm/tekwin.cpp b/teraterm/teraterm/tekwin.cpp index 3f9acccbc..5d140813f 100644 --- a/teraterm/teraterm/tekwin.cpp +++ b/teraterm/teraterm/tekwin.cpp @@ -751,7 +751,7 @@ void CTEKWindow::OnSetupFont() return; } - (*TEKSetupFont)(&tk,&ts); + TEKSetupFont(&tk,&ts); } void CTEKWindow::OnVTWin() diff --git a/teraterm/teraterm/ttdialog.c b/teraterm/teraterm/ttdialog.c index 4e7719fb8..a26e15f21 100644 --- a/teraterm/teraterm/ttdialog.c +++ b/teraterm/teraterm/ttdialog.c @@ -34,7 +34,6 @@ #include "ttdlg.h" #include "ttdialog.h" -#include "ttwinman.h" PSetupTerminal SetupTerminal; PSetupWin SetupWin; diff --git a/teraterm/teraterm/ttermpro.rc b/teraterm/teraterm/ttermpro.rc index 771e8d7fd..d4f59fff5 100644 --- a/teraterm/teraterm/ttermpro.rc +++ b/teraterm/teraterm/ttermpro.rc @@ -66,7 +66,7 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,51,220,10 CONTROL "Change cursor shape with &IME state",IDC_CURSOR_CHANGE_IME, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,66,220,10 - CONTROL "Default &port:",IDC_GENPORT_LABEL,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,10,106,91,11 + CONTROL "Default &port:",IDC_GENPORT_LABEL,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,10,106,142,11 COMBOBOX IDC_GENPORT,21,118,52,58,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP GROUPBOX "Title format",IDC_TITLEFMT_GROUP,5,133,247,55 CONTROL "&Display host/port name",IDC_TITLEFMT_DISPHOSTNAME, diff --git a/teraterm/teraterm/ttermpro.v16.vcxproj b/teraterm/teraterm/ttermpro.v16.vcxproj index 3b11eed6d..456b3c43f 100644 --- a/teraterm/teraterm/ttermpro.v16.vcxproj +++ b/teraterm/teraterm/ttermpro.v16.vcxproj @@ -194,6 +194,7 @@ + @@ -272,6 +273,7 @@ + diff --git a/teraterm/teraterm/ttermpro.v16.vcxproj.filters b/teraterm/teraterm/ttermpro.v16.vcxproj.filters index 11d1061c7..e24dcb8f4 100644 --- a/teraterm/teraterm/ttermpro.v16.vcxproj.filters +++ b/teraterm/teraterm/ttermpro.v16.vcxproj.filters @@ -294,6 +294,9 @@ Source Files + + dialog + Source Files @@ -639,6 +642,9 @@ Header Files + + dialog + Header Files diff --git a/teraterm/teraterm/ttermpro.v17.vcxproj b/teraterm/teraterm/ttermpro.v17.vcxproj index 147d51ba4..89ebfa150 100644 --- a/teraterm/teraterm/ttermpro.v17.vcxproj +++ b/teraterm/teraterm/ttermpro.v17.vcxproj @@ -194,6 +194,7 @@ + @@ -272,6 +273,7 @@ + diff --git a/teraterm/teraterm/ttermpro.v17.vcxproj.filters b/teraterm/teraterm/ttermpro.v17.vcxproj.filters index 09df21672..7d2b3dcec 100644 --- a/teraterm/teraterm/ttermpro.v17.vcxproj.filters +++ b/teraterm/teraterm/ttermpro.v17.vcxproj.filters @@ -294,6 +294,9 @@ Source Files + + dialog + Source Files @@ -639,6 +642,9 @@ Header Files + + dialog + Header Files diff --git a/teraterm/teraterm/vtwin.cpp b/teraterm/teraterm/vtwin.cpp index 873bba132..15cc21b05 100644 --- a/teraterm/teraterm/vtwin.cpp +++ b/teraterm/teraterm/vtwin.cpp @@ -4307,39 +4307,7 @@ static void OpenNewComport(const TTTSet *pts) void CVTWindow::OnSetupSerialPort() { - BOOL Ok; - - HelpId = HlpSetupSerialPort; - if (! LoadTTDLG()) { - return; - } - SetDialogFont(ts.DialogFontNameW, ts.DialogFontPoint, ts.DialogFontCharSet, - ts.UILanguageFileW, "Tera Term", "DLG_SYSTEM_FONT"); - Ok = (*SetupSerialPort)(HVTWin, &ts); - - if (Ok && ts.ComPort > 0) { - /* - * TCP/IPɂڑ̏ꍇ͐VKvZXƂċNB - * New connectionVAڑ铮Ɗ{IɓƂȂB - */ - if ( cv.Ready && (cv.PortType != IdSerial) ) { - OpenNewComport(&ts); - return; - } - - if (cv.Open) { - if (ts.ComPort != cv.ComPort) { - CommClose(&cv); - CommOpen(HVTWin,&ts,&cv); - } - else { - CommResetSerial(&ts, &cv, ts.ClearComBuffOnOpen); - } - } - else { - CommOpen(HVTWin,&ts,&cv); - } - } + OpenSetupSerialPort(); } void CVTWindow::OnSetupTCPIP() diff --git a/teraterm/ttpdlg/dlg_res.h b/teraterm/ttpdlg/dlg_res.h index e29452a07..4dd90a147 100644 --- a/teraterm/ttpdlg/dlg_res.h +++ b/teraterm/ttpdlg/dlg_res.h @@ -69,7 +69,6 @@ #define IDC_SERIALFLOW 406 #define IDC_SERIALDELAYCHAR 407 #define IDC_SERIALDELAYLINE 408 -#define IDC_SERIALHELP 499 #define IDD_TCPIPDLG 500 #define IDC_TCPIPHISTORY 507 #define IDC_TCPIPAUTOCLOSE 508 @@ -158,7 +157,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 103 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1081 +#define _APS_NEXT_CONTROL_VALUE 1082 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/teraterm/ttpdlg/serialdlg.cpp b/teraterm/ttpdlg/serialdlg.cpp index 9cbb3db48..121d04595 100644 --- a/teraterm/ttpdlg/serialdlg.cpp +++ b/teraterm/ttpdlg/serialdlg.cpp @@ -29,431 +29,13 @@ /* serial dialog */ -#include -#include -#define _CRTDBG_MAP_ALLOC -#include -#include -#include - -#include "tttypes.h" -#include "ttlib.h" -#include "dlglib.h" -#include "ttcommon.h" -#include "dlg_res.h" -#include "tipwin.h" -#include "comportinfo.h" -#include "codeconv.h" -#include "helpid.h" -#include "asprintf.h" -#include "win32helper.h" -#include "compat_win.h" -#include "asprintf.h" -#include "ttwinman.h" +#include +#include "externalsetup.h" #include "ttdlg.h" -static const char *BaudList[] = - {"110","300","600","1200","2400","4800","9600", - "14400","19200","38400","57600","115200", - "230400", "460800", "921600", NULL}; - -typedef struct { - PTTSet pts; - ComPortInfo_t *ComPortInfoPtr; - int ComPortInfoCount; -} SerialDlgData; - -static const char *DataList[] = {"7 bit","8 bit",NULL}; -static const char *ParityList[] = {"none", "odd", "even", "mark", "space", NULL}; -static const char *StopList[] = {"1 bit", "2 bit", NULL}; -static const char *FlowList[] = {"Xon/Xoff", "RTS/CTS", "DSR/DTR", "none", NULL}; -static int g_deltaSumSerialDlg = 0; // }EXzC[Deltaݐϗp -static WNDPROC g_defSerialDlgEditWndProc; // Edit Control̃TuNXp -static WNDPROC g_defSerialDlgSpeedComboboxWndProc; // Combo-box Control̃TuNXp -static TipWin *g_SerialDlgSpeedTip; - -/* - * VA|[gݒ_CAOOK{^ڑɉĖ̂؂ւB - * OnSetupSerialPort() ƍ킹KvB - */ -static void serial_dlg_change_OK_button(HWND dlg, int portno, const wchar_t *UILanguageFileW) -{ - wchar_t *uimsg; - if ( cv.Ready && (cv.PortType != IdSerial) ) { - uimsg = TTGetLangStrW("Tera Term", - "DLG_SERIAL_OK_CONNECTION", - L"Connect with &New window", - UILanguageFileW); - } else { - if (cv.Open) { - if (portno != cv.ComPort) { - uimsg = TTGetLangStrW("Tera Term", - "DLG_SERIAL_OK_CLOSEOPEN", - L"Close and &New open", - UILanguageFileW); - } else { - uimsg = TTGetLangStrW("Tera Term", - "DLG_SERIAL_OK_RESET", - L"&New setting", - UILanguageFileW); - } - - } else { - uimsg = TTGetLangStrW("Tera Term", - "DLG_SERIAL_OK_OPEN", - L"&New open", - UILanguageFileW); - } - } - SetDlgItemTextW(dlg, IDOK, uimsg); - free(uimsg); -} - -/* - * VA|[gݒ_CAÕeLXg{bNXCOM|[g̏ڍ׏\B - * - */ -static void serial_dlg_set_comport_info(HWND dlg, SerialDlgData *dlg_data, int port_index) -{ - if (port_index + 1 > dlg_data->ComPortInfoCount) { - SetDlgItemTextW(dlg, IDC_SERIALTEXT, NULL); - } - else { - const ComPortInfo_t *p = &dlg_data->ComPortInfoPtr[port_index]; - SetDlgItemTextW(dlg, IDC_SERIALTEXT, p->property); - } -} - -/* - * VA|[gݒ_CAÕeLXg{bNX̃vV[W - */ -static LRESULT CALLBACK SerialDlgEditWindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) -{ - WORD keys; - short delta; - BOOL page; - - switch (msg) { - case WM_KEYDOWN: - // Edit control CTRL+A ƁAeLXgSIB - if (wp == 'A' && GetKeyState(VK_CONTROL) < 0) { - PostMessage(hWnd, EM_SETSEL, 0, -1); - return 0; - } - break; - - case WM_MOUSEWHEEL: - // CTRLorSHIFT + }EXzC[̏ꍇAXN[B - keys = GET_KEYSTATE_WPARAM(wp); - delta = GET_WHEEL_DELTA_WPARAM(wp); - page = keys & (MK_CONTROL | MK_SHIFT); - - if (page == 0) - break; - - g_deltaSumSerialDlg += delta; - - if (g_deltaSumSerialDlg >= WHEEL_DELTA) { - g_deltaSumSerialDlg -= WHEEL_DELTA; - SendMessage(hWnd, WM_HSCROLL, SB_PAGELEFT , 0); - } else if (g_deltaSumSerialDlg <= -WHEEL_DELTA) { - g_deltaSumSerialDlg += WHEEL_DELTA; - SendMessage(hWnd, WM_HSCROLL, SB_PAGERIGHT, 0); - } - - break; - } - return CallWindowProc(g_defSerialDlgEditWndProc, hWnd, msg, wp, lp); -} - -/* - * VA|[gݒ_CAOSPEED(BAUD)̃vV[W - */ -static LRESULT CALLBACK SerialDlgSpeedComboboxWindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) -{ - const int tooltip_timeout = 1000; // msec - int h; - int cx, cy; - RECT wr; - SerialDlgData *dlg_data = (SerialDlgData *)GetWindowLongPtr(hWnd, GWLP_USERDATA); - int frame_width; - - switch (msg) { - case WM_MOUSEMOVE: - // c[`bv쐬 - if (g_SerialDlgSpeedTip == NULL) { - const wchar_t *UILanguageFileW; - wchar_t *uimsg; - UILanguageFileW = dlg_data->pts->UILanguageFileW; - uimsg = TTGetLangStrW("Tera Term", - "DLG_SERIAL_SPEED_TOOLTIP", L"You can directly specify a number", UILanguageFileW); - g_SerialDlgSpeedTip = TipWinCreate(hInst, hWnd); - TipWinSetTextW(g_SerialDlgSpeedTip, uimsg); - - free(uimsg); - } - - // Combo-box̍W߂ - GetWindowRect(hWnd, &wr); - - // c[`bv\ - TipWinGetWindowSize(g_SerialDlgSpeedTip, NULL, &h); - TipWinGetFrameSize(g_SerialDlgSpeedTip, &frame_width); - cx = wr.left; - cy = wr.top - (h + frame_width * 4); - TipWinSetPos(g_SerialDlgSpeedTip, cx, cy); - TipWinSetHideTimer(g_SerialDlgSpeedTip, tooltip_timeout); - if (!TipWinIsVisible(g_SerialDlgSpeedTip)) - TipWinSetVisible(g_SerialDlgSpeedTip, TRUE); - - break; - } - return CallWindowProc(g_defSerialDlgSpeedComboboxWndProc, hWnd, msg, wp, lp); -} - -/* - * VA|[gݒ_CAO - * - * VA|[g0̎͌Ă΂Ȃ - */ -static INT_PTR CALLBACK SerialDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam) -{ - static const DlgTextInfo TextInfos[] = { - { 0, "DLG_SERIAL_TITLE" }, - { IDC_SERIALPORT_LABEL, "DLG_SERIAL_PORT" }, - { IDC_SERIALBAUD_LEBAL, "DLG_SERIAL_BAUD" }, - { IDC_SERIALDATA_LABEL, "DLG_SERIAL_DATA" }, - { IDC_SERIALPARITY_LABEL, "DLG_SERIAL_PARITY" }, - { IDC_SERIALSTOP_LABEL, "DLG_SERIAL_STOP" }, - { IDC_SERIALFLOW_LABEL, "DLG_SERIAL_FLOW" }, - { IDC_SERIALDELAY, "DLG_SERIAL_DELAY" }, - { IDC_SERIALDELAYCHAR_LABEL, "DLG_SERIAL_DELAYCHAR" }, - { IDC_SERIALDELAYLINE_LABEL, "DLG_SERIAL_DELAYLINE" }, - { IDOK, "BTN_OK" }, - { IDCANCEL, "BTN_CANCEL" }, - { IDC_SERIALHELP, "BTN_HELP" }, - }; - SerialDlgData *dlg_data = (SerialDlgData *)GetWindowLongPtr(Dialog, DWLP_USER); - PTTSet ts = dlg_data == NULL ? NULL : dlg_data->pts; - int i, w, sel; - WORD Flow; - - switch (Message) { - case WM_INITDIALOG: - dlg_data = (SerialDlgData *)lParam; - SetWindowLongPtr(Dialog, DWLP_USER, lParam); - ts = dlg_data->pts; - - assert(dlg_data->ComPortInfoCount > 0); - SetDlgTextsW(Dialog, TextInfos, _countof(TextInfos), ts->UILanguageFileW); - - w = 0; - - for (i = 0; i < dlg_data->ComPortInfoCount; i++) { - ComPortInfo_t *p = dlg_data->ComPortInfoPtr + i; - wchar_t *EntNameW; - - // MaxComPort z|[g͕\Ȃ - if (i > ts->MaxComPort) { - continue; - } - - aswprintf(&EntNameW, L"%s", p->port_name); - SendDlgItemMessageW(Dialog, IDC_SERIALPORT, CB_ADDSTRING, 0, (LPARAM)EntNameW); - free(EntNameW); - - if (p->port_no == ts->ComPort) { - w = i; - } - } - serial_dlg_set_comport_info(Dialog, dlg_data, w); - SendDlgItemMessage(Dialog, IDC_SERIALPORT, CB_SETCURSEL, w, 0); - - SetDropDownList(Dialog, IDC_SERIALBAUD, BaudList, 0); - i = sel = 0; - while (BaudList[i] != NULL) { - if ((WORD)atoi(BaudList[i]) == ts->Baud) { - SendDlgItemMessage(Dialog, IDC_SERIALBAUD, CB_SETCURSEL, i, 0); - sel = 1; - break; - } - i++; - } - if (!sel) { - SetDlgItemInt(Dialog, IDC_SERIALBAUD, ts->Baud, FALSE); - } - - SetDropDownList(Dialog, IDC_SERIALDATA, DataList, ts->DataBit); - SetDropDownList(Dialog, IDC_SERIALPARITY, ParityList, ts->Parity); - SetDropDownList(Dialog, IDC_SERIALSTOP, StopList, ts->StopBit); - - /* - * value display - * 1 IdFlowX 1 Xon/Xoff - * 2 IdFlowHard 2 RTS/CTS - * 3 IdFlowNone 4 none - * 4 IdFlowHardDsrDtr 3 DSR/DTR - */ - Flow = ts->Flow; - if (Flow == 3) { - Flow = 4; - } - else if (Flow == 4) { - Flow = 3; - } - SetDropDownList(Dialog, IDC_SERIALFLOW, FlowList, Flow); - - SetDlgItemInt(Dialog,IDC_SERIALDELAYCHAR,ts->DelayPerChar,FALSE); - SendDlgItemMessage(Dialog, IDC_SERIALDELAYCHAR, EM_LIMITTEXT,4, 0); - - SetDlgItemInt(Dialog,IDC_SERIALDELAYLINE,ts->DelayPerLine,FALSE); - SendDlgItemMessage(Dialog, IDC_SERIALDELAYLINE, EM_LIMITTEXT,4, 0); - - CenterWindow(Dialog, GetParent(Dialog)); - - // Edit controlTuNXB - g_deltaSumSerialDlg = 0; - g_defSerialDlgEditWndProc = (WNDPROC)SetWindowLongPtr( - GetDlgItem(Dialog, IDC_SERIALTEXT), - GWLP_WNDPROC, - (LONG_PTR)SerialDlgEditWindowProc); - - // Combo-box controlTuNXB - SetWindowLongPtrW(GetDlgItem(Dialog, IDC_SERIALBAUD), GWLP_USERDATA, (LONG_PTR)dlg_data); - g_defSerialDlgSpeedComboboxWndProc = (WNDPROC)SetWindowLongPtr( - GetDlgItem(Dialog, IDC_SERIALBAUD), - GWLP_WNDPROC, - (LONG_PTR)SerialDlgSpeedComboboxWindowProc); - - // ݂̐ڑԂƐV|[gԍ̑gݍ킹ŁAڑς邽߁A - // ɉOK{^̃x؂ւB - serial_dlg_change_OK_button(Dialog, dlg_data->ComPortInfoPtr[w].port_no, ts->UILanguageFileW); - - return TRUE; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDOK: - if ( ts!=NULL ) { - char Temp[128]; - memset(Temp, 0, sizeof(Temp)); - GetDlgItemText(Dialog, IDC_SERIALPORT, Temp, sizeof(Temp)-1); - if (strncmp(Temp, "COM", 3) == 0 && Temp[3] != '\0') { - ts->ComPort = (WORD)atoi(&Temp[3]); - } - - GetDlgItemText(Dialog, IDC_SERIALBAUD, Temp, sizeof(Temp)-1); - if (atoi(Temp) != 0) { - ts->Baud = (DWORD)atoi(Temp); - } - if ((w = (WORD)GetCurSel(Dialog, IDC_SERIALDATA)) > 0) { - ts->DataBit = w; - } - if ((w = (WORD)GetCurSel(Dialog, IDC_SERIALPARITY)) > 0) { - ts->Parity = w; - } - if ((w = (WORD)GetCurSel(Dialog, IDC_SERIALSTOP)) > 0) { - ts->StopBit = w; - } - if ((w = (WORD)GetCurSel(Dialog, IDC_SERIALFLOW)) > 0) { - /* - * display value - * 1 Xon/Xoff 1 IdFlowX - * 2 RTS/CTS 2 IdFlowHard - * 3 DSR/DTR 4 IdFlowHardDsrDtr - * 4 none 3 IdFlowNone - */ - Flow = w; - if (Flow == 3) { - Flow = 4; - } - else if (Flow == 4) { - Flow = 3; - } - ts->Flow = Flow; - } - - ts->DelayPerChar = GetDlgItemInt(Dialog,IDC_SERIALDELAYCHAR,NULL,FALSE); - - ts->DelayPerLine = GetDlgItemInt(Dialog,IDC_SERIALDELAYLINE,NULL,FALSE); - - ts->PortType = IdSerial; - - // {[[gύX邱Ƃ̂ŁA^Cgĕ\ - // bZ[W΂悤ɂB (2007.7.21 maya) - PostMessage(GetParent(Dialog),WM_USER_CHANGETITLE,0,0); - } - - // c[`bvp - if (g_SerialDlgSpeedTip) { - TipWinDestroy(g_SerialDlgSpeedTip); - g_SerialDlgSpeedTip = NULL; - } - - EndDialog(Dialog, 1); - return TRUE; - - case IDCANCEL: - // c[`bvp - if (g_SerialDlgSpeedTip) { - TipWinDestroy(g_SerialDlgSpeedTip); - g_SerialDlgSpeedTip = NULL; - } - - EndDialog(Dialog, 0); - return TRUE; - - case IDC_SERIALHELP: - PostMessage(GetParent(Dialog),WM_USER_DLGHELP2,HlpSetupSerialPort,0); - return TRUE; - - case IDC_SERIALPORT: - if (HIWORD(wParam) == CBN_SELCHANGE) { - // XgCOM|[gIꂽ - int portno; - sel = SendDlgItemMessage(Dialog, IDC_SERIALPORT, CB_GETCURSEL, 0, 0); - portno = dlg_data->ComPortInfoPtr[sel].port_no; // |[gԍ - - // ڍ׏\ - serial_dlg_set_comport_info(Dialog, dlg_data, sel); - - // ݂̐ڑԂƐV|[gԍ̑gݍ킹ŁAڑς邽߁A - // ɉOK{^̃x؂ւB - serial_dlg_change_OK_button(Dialog, portno, ts->UILanguageFileW); - - break; - - } - - return TRUE; - } - } - return FALSE; -} - BOOL WINAPI _SetupSerialPort(HWND WndParent, PTTSet ts) { - BOOL r; - SerialDlgData *dlg_data = (SerialDlgData *)calloc(1, sizeof(*dlg_data)); - dlg_data->pts = ts; - dlg_data->ComPortInfoPtr = ComPortInfoGet(&dlg_data->ComPortInfoCount); - if (dlg_data->ComPortInfoCount == 0) { - static const TTMessageBoxInfoW info = { - "Tera Term", - "MSG_TT_NOTICE", L"Tera Term: Notice", - NULL, L"No serial port", - MB_ICONINFORMATION | MB_OK - }; - TTMessageBoxW(WndParent, &info, ts->UILanguageFileW); - return FALSE; // ύXȂ - } - - r = (BOOL)TTDialogBoxParam(hInst, - MAKEINTRESOURCEW(IDD_SERIALDLG), - WndParent, SerialDlg, (LPARAM)dlg_data); - - ComPortInfoFree(dlg_data->ComPortInfoPtr, dlg_data->ComPortInfoCount); - free(dlg_data); - return r; + (void)ts; + return OpenExternalSetupTab(WndParent, SerialPortPage); } diff --git a/teraterm/ttpdlg/ttpdlg.rc b/teraterm/ttpdlg/ttpdlg.rc index 66bb6cb8a..1b294f4f4 100644 --- a/teraterm/ttpdlg/ttpdlg.rc +++ b/teraterm/ttpdlg/ttpdlg.rc @@ -77,32 +77,29 @@ BEGIN CONTROL "A&uto switch (VT<->TEK)",IDC_TERMAUTOSWITCH,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,123,80,126,12 END -IDD_SERIALDLG DIALOGEX 20, 20, 234, 214 +IDD_SERIALDLG DIALOGEX 20, 20, 304, 215 STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Tera Term: Serial port setup and connection" -FONT 14, "System", 0, 0, 0x0 +FONT 8, "Tahoma", 400, 0, 0x0 BEGIN CONTROL "&Port:",IDC_SERIALPORT_LABEL,"Static",SS_LEFTNOWORDWRAP,15,9,54,8 - COMBOBOX IDC_SERIALPORT,75,7,48,52,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_SERIALPORT,75,7,62,52,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP CONTROL "Sp&eed:",IDC_SERIALBAUD_LEBAL,"Static",SS_LEFTNOWORDWRAP,15,24,54,8 - COMBOBOX IDC_SERIALBAUD,75,22,48,100,CBS_DROPDOWN | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_SERIALBAUD,75,22,62,100,CBS_DROPDOWN | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP CONTROL "&Data:",IDC_SERIALDATA_LABEL,"Static",SS_LEFTNOWORDWRAP,15,39,54,8 - COMBOBOX IDC_SERIALDATA,75,37,48,35,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_SERIALDATA,75,37,62,35,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP CONTROL "P&arity:",IDC_SERIALPARITY_LABEL,"Static",SS_LEFTNOWORDWRAP,15,54,54,8 - COMBOBOX IDC_SERIALPARITY,75,52,48,65,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_SERIALPARITY,75,52,62,65,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP CONTROL "&Stop bits:",IDC_SERIALSTOP_LABEL,"Static",SS_LEFTNOWORDWRAP,15,69,54,8 - COMBOBOX IDC_SERIALSTOP,75,67,48,40,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_SERIALSTOP,75,67,62,40,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP CONTROL "&Flow control:",IDC_SERIALFLOW_LABEL,"Static",SS_LEFTNOWORDWRAP,15,84,54,8 - COMBOBOX IDC_SERIALFLOW,75,82,48,53,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_SERIALFLOW,75,82,62,53,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP GROUPBOX "Transmit delay",IDC_SERIALDELAY,41,104,152,32 LTEXT "msec/&char",IDC_SERIALDELAYCHAR_LABEL,75,118,42,10 EDITTEXT IDC_SERIALDELAYCHAR,51,116,20,12,ES_AUTOHSCROLL | ES_NUMBER LTEXT "msec/&line",IDC_SERIALDELAYLINE_LABEL,146,118,42,10 EDITTEXT IDC_SERIALDELAYLINE,122,116,20,12,ES_AUTOHSCROLL | ES_NUMBER - DEFPUSHBUTTON "OK",IDOK,138,9,87,18,BS_CENTER | BS_MULTILINE | WS_GROUP - PUSHBUTTON "Cancel",IDCANCEL,138,38,87,16,BS_CENTER - PUSHBUTTON "&Help",IDC_SERIALHELP,138,64,86,16,BS_CENTER - EDITTEXT IDC_SERIALTEXT,10,141,212,70,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL + EDITTEXT IDC_SERIALTEXT,10,141,254,70,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL END IDD_TCPIPDLG DIALOGEX 20, 20, 260, 189 @@ -289,7 +286,10 @@ BEGIN IDD_SERIALDLG, DIALOG BEGIN - RIGHTMARGIN, 232 + RIGHTMARGIN, 302 + VERTGUIDE, 75 + VERTGUIDE, 137 + BOTTOMMARGIN, 214 END IDD_TCPIPDLG, DIALOG