Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/teraterm/ttpset/ttset.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 9858 by zmatsuo, Tue Apr 12 13:21:35 2022 UTC revision 9913 by zmatsuo, Sun May 8 13:25:16 2022 UTC
# Line 49  Line 49 
49  #include "win32helper.h"  #include "win32helper.h"
50  #include "inifile_com.h"  #include "inifile_com.h"
51  #include "ttlib_charset.h"  #include "ttlib_charset.h"
52    #include "asprintf.h"
53    
54  #define DllExport __declspec(dllexport)  #define DllExport __declspec(dllexport)
55  #include "ttset.h"  #include "ttset.h"
# Line 58  Line 59 
59    
60  #define MaxStrLen (LONG)512  #define MaxStrLen (LONG)512
61    
62  static PCHAR far TermList[] =  static const PCHAR TermList[] =
63          { "VT100", "VT100J", "VT101", "VT102", "VT102J", "VT220J", "VT282",          { "VT100", "VT100J", "VT101", "VT102", "VT102J", "VT220J", "VT282",
64          "VT320", "VT382", "VT420", "VT520", "VT525", NULL };          "VT320", "VT382", "VT420", "VT520", "VT525", NULL };
65    
66  static PCHAR far RussList2[] = { "Windows", "KOI8-R", NULL };  static const PCHAR RussList2[] = { "Windows", "KOI8-R", NULL };
67    
68    
69  /*  /*
# Line 72  static PCHAR far RussList2[] = { "Window Line 73  static PCHAR far RussList2[] = { "Window
73    
74  typedef struct id_str_pair {  typedef struct id_str_pair {
75          WORD id;          WORD id;
76          char *str;          const char *str;
77  } id_str_pair_t;  } id_str_pair_t;
78    
79  static id_str_pair_t serial_conf_databit[] = {  static const id_str_pair_t serial_conf_databit[] = {
80          {IdDataBit7, "7"},          {IdDataBit7, "7"},
81          {IdDataBit8, "8"},          {IdDataBit8, "8"},
82          {IDENDMARK, NULL},          {IDENDMARK, NULL},
83  };  };
84    
85  static id_str_pair_t serial_conf_parity[] = {  static const id_str_pair_t serial_conf_parity[] = {
86          {IdParityNone, "none"},          {IdParityNone, "none"},
87          {IdParityOdd, "odd"},          {IdParityOdd, "odd"},
88          {IdParityEven, "even"},          {IdParityEven, "even"},
# Line 90  static id_str_pair_t serial_conf_parity[ Line 91  static id_str_pair_t serial_conf_parity[
91          {IDENDMARK, NULL},          {IDENDMARK, NULL},
92  };  };
93    
94  static id_str_pair_t serial_conf_stopbit[] = {  static const id_str_pair_t serial_conf_stopbit[] = {
95          {IdStopBit1, "1"},          {IdStopBit1, "1"},
96          {IdStopBit2, "2"},          {IdStopBit2, "2"},
97          {IDENDMARK, NULL},          {IDENDMARK, NULL},
# Line 116  static id_str_pair_t serial_conf_flowctr Line 117  static id_str_pair_t serial_conf_flowctr
117   */   */
118  int WINAPI SerialPortConfconvertId2Str(enum serial_port_conf type, WORD id, PCHAR str, int strlen)  int WINAPI SerialPortConfconvertId2Str(enum serial_port_conf type, WORD id, PCHAR str, int strlen)
119  {  {
120          id_str_pair_t *conf;          const id_str_pair_t *conf;
121          int ret = FALSE;          int ret = FALSE;
122          int i;          int i;
123    
# Line 172  error: Line 173  error:
173   */   */
174  static int SerialPortConfconvertStr2Id(enum serial_port_conf type, const wchar_t *str, WORD *id)  static int SerialPortConfconvertStr2Id(enum serial_port_conf type, const wchar_t *str, WORD *id)
175  {  {
176          id_str_pair_t *conf;          const id_str_pair_t *conf;
177          int ret = FALSE;          int ret = FALSE;
178          int i;          int i;
179          char *strA;          char *strA;
# Line 214  static int SerialPortConfconvertStr2Id(e Line 215  static int SerialPortConfconvertStr2Id(e
215          return ret;          return ret;
216  }  }
217    
218  WORD str2id(PCHAR far * List, PCHAR str, WORD DefId)  static WORD str2id(const PCHAR *List, PCHAR str, WORD DefId)
219  {  {
220          WORD i;          WORD i;
221          i = 0;          i = 0;
# Line 228  WORD str2id(PCHAR far * List, PCHAR str, Line 229  WORD str2id(PCHAR far * List, PCHAR str,
229          return i;          return i;
230  }  }
231    
232  void id2str(PCHAR far * List, WORD Id, WORD DefId, PCHAR str, int destlen)  static void id2str(const PCHAR *List, WORD Id, WORD DefId, PCHAR str, int destlen)
233  {  {
234          int i;          int i;
235    
# Line 3069  void PASCAL WriteIniFile(const wchar_t * Line 3070  void PASCAL WriteIniFile(const wchar_t *
3070          WritePrivateProfileString(NULL, NULL, NULL, FName);          WritePrivateProfileString(NULL, NULL, NULL, FName);
3071    
3072          // Eterm lookfeel alphablend (2005.4.24 yutaka)          // Eterm lookfeel alphablend (2005.4.24 yutaka)
3073  #define ETERM_SECTION BG_SECTION          WriteOnOff(BG_SECTION, "BGEnable", FName,
         WriteOnOff(ETERM_SECTION, "BGEnable", FName,  
3074                     ts->EtermLookfeel.BGEnable);                     ts->EtermLookfeel.BGEnable);
3075          WriteOnOff(ETERM_SECTION, "BGUseAlphaBlendAPI", FName,          WriteOnOff(BG_SECTION, "BGUseAlphaBlendAPI", FName,
3076                     ts->EtermLookfeel.BGUseAlphaBlendAPI);                     ts->EtermLookfeel.BGUseAlphaBlendAPI);
3077          WritePrivateProfileString(ETERM_SECTION, "BGSPIPath",          WritePrivateProfileString(BG_SECTION, "BGSPIPath",
3078                                    ts->EtermLookfeel.BGSPIPath, FName);                                    ts->EtermLookfeel.BGSPIPath, FName);
3079          WriteOnOff(ETERM_SECTION, "BGFastSizeMove", FName,          WriteOnOff(BG_SECTION, "BGFastSizeMove", FName,
3080                     ts->EtermLookfeel.BGFastSizeMove);                     ts->EtermLookfeel.BGFastSizeMove);
3081          WriteOnOff(ETERM_SECTION, "BGFlickerlessMove", FName,          WriteOnOff(BG_SECTION, "BGFlickerlessMove", FName,
3082                     ts->EtermLookfeel.BGNoCopyBits);                     ts->EtermLookfeel.BGNoCopyBits);
3083          WriteOnOff(ETERM_SECTION, "BGNoFrame", FName,          WriteOnOff(BG_SECTION, "BGNoFrame", FName,
3084                     ts->EtermLookfeel.BGNoFrame);                     ts->EtermLookfeel.BGNoFrame);
3085          WritePrivateProfileString(ETERM_SECTION, "BGThemeFile",          WritePrivateProfileString(BG_SECTION, "BGThemeFile",
3086                                    ts->EtermLookfeel.BGThemeFile, FName);                                    ts->EtermLookfeel.BGThemeFile, FName);
3087    
3088            // themeフォルダを作る
3089          {          {
3090                  wchar_t TempW[MAX_PATH];                  wchar_t *theme_folder = NULL;
3091                  _snwprintf_s(TempW, _countof(TempW), _TRUNCATE, L"%hs\\%hs", ts->HomeDir, BG_THEME_IMAGEFILE);                  awcscats(&theme_folder, ts->HomeDirW, L"\\", BG_THEME_DIR, NULL);
3092                  WritePrivateProfileStringA(BG_SECTION, BG_DESTFILE, ts->BGImageFilePath, TempW);                  CreateDirectoryW(theme_folder, NULL);
3093                  WriteInt(BG_SECTION, BG_THEME_IMAGE_BRIGHTNESS1, TempW, ts->BGImgBrightness);                  free(theme_folder);
                 WriteInt(BG_SECTION, BG_THEME_IMAGE_BRIGHTNESS2, TempW, ts->BGImgBrightness);  
3094          }          }
3095          WriteOnOff(ETERM_SECTION, "BGIgnoreThemeFile", FName,  
3096            // テーマファイルに保存("theme\\ImageFile.INI")
3097            //              TODO BGThemeFileはチェックしなくてよい?
3098            {
3099                    wchar_t *theme_file = NULL;
3100                    aswprintf(&theme_file, L"%s\\%hs", ts->HomeDirW, BG_THEME_IMAGEFILE);
3101                    WritePrivateProfileStringAFileW(BG_SECTION, BG_DESTFILE, ts->BGImageFilePath, theme_file);
3102                    WriteInt(BG_SECTION, BG_THEME_IMAGE_BRIGHTNESS1, theme_file, ts->BGImgBrightness);
3103                    WriteInt(BG_SECTION, BG_THEME_IMAGE_BRIGHTNESS2, theme_file, ts->BGImgBrightness);
3104                    free(theme_file);
3105            }
3106    
3107            WriteOnOff(BG_SECTION, "BGIgnoreThemeFile", FName,
3108                  ts->EtermLookfeel.BGIgnoreThemeFile);                  ts->EtermLookfeel.BGIgnoreThemeFile);
3109    
3110  #ifdef USE_NORMAL_BGCOLOR  #ifdef USE_NORMAL_BGCOLOR
# Line 4123  void PASCAL ParseParam(wchar_t *Param, P Line 4136  void PASCAL ParseParam(wchar_t *Param, P
4136  BOOL WINAPI DllMain(HANDLE hInst,  BOOL WINAPI DllMain(HANDLE hInst,
4137                      ULONG ul_reason_for_call, LPVOID lpReserved)                      ULONG ul_reason_for_call, LPVOID lpReserved)
4138  {  {
4139            (void)hInst;
4140            (void)lpReserved;
4141          switch (ul_reason_for_call) {          switch (ul_reason_for_call) {
4142          case DLL_THREAD_ATTACH:          case DLL_THREAD_ATTACH:
4143                  /* do thread initialization */                  /* do thread initialization */

Legend:
Removed from v.9858  
changed lines
  Added in v.9913

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26