Skip to content

Commit

Permalink
Windowsダイアログをプロパティーページに変更 #84
Browse files Browse the repository at this point in the history
- 色見本を分離した
  - color_sample.cpp,h
  • Loading branch information
zmatsuo committed Sep 9, 2024
1 parent 7f512f8 commit 608d5bc
Show file tree
Hide file tree
Showing 18 changed files with 804 additions and 514 deletions.
2 changes: 1 addition & 1 deletion installer/release/lang_utf8/English.lng
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ DLG_CODING_UNICODE_TO_DEC_PUNCTUATION=Punctuation, Block Elements, Shade
DLG_CODING_UNICODE_TO_DEC_MIDDLEDOT=Middle dots (U+00B7,U+2024,U+2219)
DLG_CODING_DEC_TO_UNICODE=Mapping DEC Special Graphics to Unicode

DLG_WIN_TITLE=Tera Term: Window setup
DLG_WIN_TITLE=Window
DLG_WIN_TITLELABEL=&Title:
DLG_WIN_CURSOR=Cursor shape
DLG_WIN_BLOCK=B&lock
Expand Down
2 changes: 1 addition & 1 deletion installer/release/lang_utf8/French.lng
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ DLG_CODING_UNICODE_TO_DEC_PUNCTUATION=Punctuation, Block Elements, Shade
DLG_CODING_UNICODE_TO_DEC_MIDDLEDOT=Middle dots (U+00B7,U+2024,U+2219)
DLG_CODING_DEC_TO_UNICODE=Mapping DEC Special Graphics to Unicode

DLG_WIN_TITLE=Tera Term:Fenêtre de Configuration
DLG_WIN_TITLE=Fenêtre
DLG_WIN_TITLELABEL=&Titre:
DLG_WIN_CURSOR=Forme du curseur
DLG_WIN_BLOCK=B&loc
Expand Down
2 changes: 1 addition & 1 deletion installer/release/lang_utf8/German.lng
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ DLG_CODING_UNICODE_TO_DEC_PUNCTUATION=Punctuation, Block Elements, Shade
DLG_CODING_UNICODE_TO_DEC_MIDDLEDOT=Middle dots (U+00B7,U+2024,U+2219)
DLG_CODING_DEC_TO_UNICODE=Mapping DEC Special Graphics to Unicode

DLG_WIN_TITLE=Fenster-Einstellungen
DLG_WIN_TITLE=Fenster
DLG_WIN_TITLELABEL=Titel
DLG_WIN_CURSOR=Cursor-Aussehen
DLG_WIN_BLOCK=Block
Expand Down
2 changes: 1 addition & 1 deletion installer/release/lang_utf8/Japanese.lng
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ DLG_CODING_UNICODE_TO_DEC_PUNCTUATION=
DLG_CODING_UNICODE_TO_DEC_MIDDLEDOT=中点(U+00B7,U+2024,U+2219)
DLG_CODING_DEC_TO_UNICODE=DEC Special GraphicsをUnicodeへマッピングする

DLG_WIN_TITLE=Tera Term: ウィンドウの設定
DLG_WIN_TITLE=ウィンドウ
DLG_WIN_TITLELABEL=タイトル(&T):
DLG_WIN_CURSOR=カーソルの形
DLG_WIN_BLOCK=四角(&L):
Expand Down
2 changes: 1 addition & 1 deletion installer/release/lang_utf8/Korean.lng
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ DLG_CODING_UNICODE_TO_DEC_PUNCTUATION=Punctuation, Block Elements, Shade
DLG_CODING_UNICODE_TO_DEC_MIDDLEDOT=Middle dots (U+00B7,U+2024,U+2219)
DLG_CODING_DEC_TO_UNICODE=Mapping DEC Special Graphics to Unicode

DLG_WIN_TITLE=Tera Term: 창 설정
DLG_WIN_TITLE=
DLG_WIN_TITLELABEL=타이틀(&T):
DLG_WIN_CURSOR=커서 모양
DLG_WIN_BLOCK=블럭(&L)
Expand Down
2 changes: 1 addition & 1 deletion installer/release/lang_utf8/Russian.lng
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ DLG_CODING_UNICODE_TO_DEC_PUNCTUATION=Punctuation, Block Elements, Shade
DLG_CODING_UNICODE_TO_DEC_MIDDLEDOT=Middle dots (U+00B7,U+2024,U+2219)
DLG_CODING_DEC_TO_UNICODE=Mapping DEC Special Graphics to Unicode

DLG_WIN_TITLE=Tera Term: Настройка окон
DLG_WIN_TITLE=окон
DLG_WIN_TITLELABEL=&Название:
DLG_WIN_CURSOR=Вид курсора
DLG_WIN_BLOCK=&Блок
Expand Down
2 changes: 1 addition & 1 deletion installer/release/lang_utf8/Simplified Chinese.lng
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ DLG_CODING_UNICODE_TO_DEC_PUNCTUATION=Punctuation, Block Elements, Shade
DLG_CODING_UNICODE_TO_DEC_MIDDLEDOT=Middle dots (U+00B7,U+2024,U+2219)
DLG_CODING_DEC_TO_UNICODE=Mapping DEC Special Graphics to Unicode

DLG_WIN_TITLE=Tera Term:窗口设置
DLG_WIN_TITLE=窗口
DLG_WIN_TITLELABEL=标题(&T):
DLG_WIN_CURSOR=光标形状
DLG_WIN_BLOCK=块状(&L)
Expand Down
2 changes: 1 addition & 1 deletion installer/release/lang_utf8/Spanish.lng
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ DLG_CODING_UNICODE_TO_DEC_PUNCTUATION=Punctuation, Block Elements, Shade
DLG_CODING_UNICODE_TO_DEC_MIDDLEDOT=Middle dots (U+00B7,U+2024,U+2219)
DLG_CODING_DEC_TO_UNICODE=Mapping DEC Special Graphics to Unicode

DLG_WIN_TITLE=Tera Term: Window setup
DLG_WIN_TITLE=Window
DLG_WIN_TITLELABEL=&Title:
DLG_WIN_CURSOR=Cursor shape
DLG_WIN_BLOCK=B&lock
Expand Down
2 changes: 1 addition & 1 deletion installer/release/lang_utf8/Tamil.lng
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ DLG_CODING_UNICODE_TO_DEC_PUNCTUATION=நிறுத்தம், தொகு
DLG_CODING_UNICODE_TO_DEC_MIDDLEDOT=மத்திய புள்ளிகள் (U+00B7,U+2024,U+2219)
DLG_CODING_DEC_TO_UNICODE=பதின்மம் சிறப்பு வரைகலை ஒருங்குறிக்கு வரைபடம்

DLG_WIN_TITLE=தேரா முனை: சாளர அமைப்பு
DLG_WIN_TITLE=சாளர
DLG_WIN_TITLELABEL=&தலைப்பு:
DLG_WIN_CURSOR=சிமிட்டும் கோடு வடிவம்
DLG_WIN_BLOCK=தடு
Expand Down
2 changes: 1 addition & 1 deletion installer/release/lang_utf8/Traditional Chinese.lng
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ DLG_CODING_UNICODE_TO_DEC_PUNCTUATION=Punctuation, Block Elements, Shade
DLG_CODING_UNICODE_TO_DEC_MIDDLEDOT=Middle dots (U+00B7,U+2024,U+2219)
DLG_CODING_DEC_TO_UNICODE=Mapping DEC Special Graphics to Unicode

DLG_WIN_TITLE=Tera Term:視窗設定
DLG_WIN_TITLE=視窗
DLG_WIN_TITLELABEL=標題(&T):
DLG_WIN_CURSOR=游標形狀
DLG_WIN_BLOCK=塊狀(&L)
Expand Down
4 changes: 4 additions & 0 deletions teraterm/teraterm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ set(SRC_DIALOG
coding_pp.h
coding_pp.rc
coding_pp_res.h
color_sample.cpp
color_sample.h
debug_pp.cpp
debug_pp.h
debug_pp.rc
Expand Down Expand Up @@ -135,6 +137,8 @@ set(SRC_DIALOG
themedlg.h
themedlg.rc
themedlg_res.h
win_pp.cpp
win_pp.h
)

target_sources(
Expand Down
6 changes: 6 additions & 0 deletions teraterm/teraterm/addsetting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
#include "log_pp.h"
#include "tcpip_pp.h"
#include "term_pp.h"
#include "win_pp.h"

#include "addsetting.h"

Expand Down Expand Up @@ -1526,6 +1527,8 @@ CAddSettingPropSheetDlg::CAddSettingPropSheetDlg(HINSTANCE hInstance, HWND hPare
AddPage(page);
page = CreateTerminalPP(hInstance, hParentWnd, & ts);
AddPage(page);
page = CreateWinPP(hInstance, hParentWnd, &ts);
AddPage(page);

wchar_t *title = TTGetLangStrW("Tera Term", "DLG_TABSHEET_TITLE", L"Tera Term: Additional settings", ts.UILanguageFileW);
SetCaption(title);
Expand Down Expand Up @@ -1561,6 +1564,9 @@ void CAddSettingPropSheetDlg::SetStartPage(Page page)
case TermPage:
start_page = 12;
break;
case WinPage:
start_page = 13;
break;
default:
start_page = 0;
break;
Expand Down
2 changes: 2 additions & 0 deletions teraterm/teraterm/addsetting.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class CAddSettingPropSheetDlg: public TTCPropSheetDlg
KeyboardPage,
TcpIpPage,
TermPage,
WinPage,
};
void SetStartPage(Page page);

Expand All @@ -71,4 +72,5 @@ typedef enum {
KeyboardPage,
TcpIpPage,
TermPage,
WinPage,
} CAddSettingPropSheetDlgPage;
108 changes: 108 additions & 0 deletions teraterm/teraterm/color_sample.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*
* Copyright (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.
*/

#include "ttwinman.h"
#include "color_sample.h"

typedef struct ColorSampleTag {
HWND hWnd;
WNDPROC OrigProc;
int dummy;
COLORREF fore_color;
COLORREF back_color;
HFONT SampleFont;
} ColorSampleWork;

static LRESULT CALLBACK CSProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
ColorSampleWork *work = (ColorSampleWork *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
LRESULT Result;

switch (msg) {
case WM_PAINT: {
int i, x, y;
int DX[3];
TEXTMETRIC Metrics;
RECT TestRect;
int FW, FH;

PAINTSTRUCT ps;
HDC hDC;
hDC = BeginPaint(hWnd, &ps);

SetTextColor(hDC, work->fore_color);
SetBkColor(hDC, work->back_color);
SelectObject(hDC, work->SampleFont);
GetTextMetrics(hDC, &Metrics);
FW = Metrics.tmAveCharWidth;
FH = Metrics.tmHeight;
for (i = 0; i <= 2; i++) {
DX[i] = FW;
}
GetClientRect(hWnd, &TestRect);
x = (int)((TestRect.left + TestRect.right) / 2 - FW * 1.5);
y = (TestRect.top + TestRect.bottom - FH) / 2;
ExtTextOut(hDC, x, y, ETO_CLIPPED | ETO_OPAQUE, &TestRect, "ABC", 3, &(DX[0]));
break;
}
default:
break;
}

Result = CallWindowProcW(work->OrigProc, hWnd, msg, wParam, lParam);

switch (msg) {
case WM_NCDESTROY: {
SetWindowLongPtr(hWnd, GWLP_USERDATA, 0);
free(work);
break;
}
default:
break;
}

return Result;
}

ColorSample *ColorSampleInit(HWND hWnd)
{
ColorSampleWork *work = (ColorSampleWork *)calloc(sizeof(*work), 1);
work->hWnd = hWnd;
work->SampleFont = ts.SampleFont;
work->OrigProc = (WNDPROC)SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)CSProc);
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)work);
InvalidateRect(hWnd, NULL, TRUE);
return work;
}

void ColorSampleSetColor(ColorSample *work, COLORREF fore_color, COLORREF back_color)
{
work->fore_color = fore_color;
work->back_color = back_color;
InvalidateRect(work->hWnd, NULL, TRUE);
}
36 changes: 36 additions & 0 deletions teraterm/teraterm/color_sample.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (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.
*/

#pragma once

#include <windows.h>

typedef struct ColorSampleTag ColorSample;

ColorSample *ColorSampleInit(HWND hWnd);
void ColorSampleSetColor(ColorSample *work, COLORREF fore_color, COLORREF back_color);
Loading

0 comments on commit 608d5bc

Please sign in to comment.