Develop and Download Open Source Software

Browse Subversion Repository

Diff of /branches/ssh_chacha20poly1305/ttssh2/ttxssh/ttxssh.c

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

revision 3008 by maya, Tue Sep 4 13:40:18 2007 UTC revision 3009 by maya, Wed Sep 5 12:07:04 2007 UTC
# Line 805  static void enable_dlg_items(HWND dlg, i Line 805  static void enable_dlg_items(HWND dlg, i
805          }          }
806  }  }
807    
808  // C-n/C-p をサポート (2007.9.4 maya)  // C-n/C-p/C-a/C-e をサポート (2007.9.5 maya)
809  // ドロップダウンの中のエディットコントロールを  // ドロップダウンの中のエディットコントロールを
810  // サブクラス化するためのウインドウプロシージャ  // サブクラス化するためのウインドウプロシージャ
811  static WNDPROC OrigHostnameEditProc; // Original window procedure  static WNDPROC OrigHostnameEditProc; // Original window procedure
# Line 820  static LRESULT CALLBACK HostnameEditProc Line 820  static LRESULT CALLBACK HostnameEditProc
820                  case WM_KEYDOWN:                  case WM_KEYDOWN:
821                          if (GetKeyState(VK_CONTROL) < 0) {                          if (GetKeyState(VK_CONTROL) < 0) {
822                                  switch (wParam) {                                  switch (wParam) {
823                                          case 0x4e: // Ctrl+n                                          case 0x4e: // Ctrl+n ... down
824                                                  parent = GetParent(dlg);                                                  parent = GetParent(dlg);
825                                                  max_item = SendMessage(parent, CB_GETCOUNT, 0, 0);                                                  max_item = SendMessage(parent, CB_GETCOUNT, 0, 0);
826                                                  select_item = SendMessage(parent, CB_GETCURSEL, 0, 0);                                                  select_item = SendMessage(parent, CB_GETCURSEL, 0, 0);
# Line 828  static LRESULT CALLBACK HostnameEditProc Line 828  static LRESULT CALLBACK HostnameEditProc
828                                                          PostMessage(parent, CB_SETCURSEL, select_item + 1, 0);                                                          PostMessage(parent, CB_SETCURSEL, select_item + 1, 0);
829                                                  }                                                  }
830                                                  return 0;                                                  return 0;
831                                          case 0x50: // Ctrl+p                                          case 0x50: // Ctrl+p ... up
832                                                  parent = GetParent(dlg);                                                  parent = GetParent(dlg);
833                                                  select_item = SendMessage(parent, CB_GETCURSEL, 0, 0);                                                  select_item = SendMessage(parent, CB_GETCURSEL, 0, 0);
834                                                  if (select_item > 0) {                                                  if (select_item > 0) {
835                                                          PostMessage(parent, CB_SETCURSEL, select_item - 1, 0);                                                          PostMessage(parent, CB_SETCURSEL, select_item - 1, 0);
836                                                  }                                                  }
837                                                  return 0;                                                  return 0;
838                                            case 0x41: // Ctrl+a ... left
839                                                    PostMessage(dlg, EM_SETSEL, 0, 0);
840                                                    return 0;
841                                            case 0x45: // Ctrl+e ... right
842                                                    max_item = GetWindowTextLength(dlg) ;
843                                                    PostMessage(dlg, EM_SETSEL, max_item, max_item);
844                                                    return 0;
845                                  }                                  }
846                          }                          }
847                          break;                          break;
848    
849                  // C-n/C-p の結果送られる文字で音が鳴るので捨てる                  // C-n/C-p/C-a/C-e の結果送られる文字で音が鳴るので捨てる
850                  case WM_CHAR:                  case WM_CHAR:
851                          switch (wParam) {                          switch (wParam) {
852                                    case 0x01:
853                                    case 0x05:
854                                  case 0x0e:                                  case 0x0e:
855                                  case 0x10:                                  case 0x10:
856                                          return 0;                                          return 0;
# Line 1185  static BOOL CALLBACK TTXHostDlg(HWND dlg Line 1194  static BOOL CALLBACK TTXHostDlg(HWND dlg
1194                                          }                                          }
1195                                  }                                  }
1196                          }                          }
1197                            SetWindowLong(hwndHostnameEdit, GWL_WNDPROC, (LONG)OrigHostnameEditProc);
1198                          EndDialog(dlg, 1);                          EndDialog(dlg, 1);
1199    
1200                          if (DlgHostFont != NULL) {                          if (DlgHostFont != NULL) {
# Line 1194  static BOOL CALLBACK TTXHostDlg(HWND dlg Line 1204  static BOOL CALLBACK TTXHostDlg(HWND dlg
1204                          return TRUE;                          return TRUE;
1205    
1206                  case IDCANCEL:                  case IDCANCEL:
1207                            SetWindowLong(hwndHostnameEdit, GWL_WNDPROC, (LONG)OrigHostnameEditProc);
1208                          EndDialog(dlg, 0);                          EndDialog(dlg, 0);
1209    
1210                          if (DlgHostFont != NULL) {                          if (DlgHostFont != NULL) {
# Line 1258  hostssh_enabled: Line 1269  hostssh_enabled:
1269                          }                          }
1270                          return TRUE;                          return TRUE;
1271    
1272          case IDC_HOSTCOM:                  case IDC_HOSTCOM:
1273                  if(HIWORD(wParam) == CBN_DROPDOWN) {                          if(HIWORD(wParam) == CBN_DROPDOWN) {
1274                          HWND hostcom = GetDlgItem(dlg, IDC_HOSTCOM);                                  HWND hostcom = GetDlgItem(dlg, IDC_HOSTCOM);
1275                          int count = SendMessage(hostcom, CB_GETCOUNT, 0, 0);                                  int count = SendMessage(hostcom, CB_GETCOUNT, 0, 0);
1276                          int i, len, max_len = 0;                                  int i, len, max_len = 0;
1277                          char *lbl;                                  char *lbl;
1278                          HDC TmpDC = GetDC(hostcom);                                  HDC TmpDC = GetDC(hostcom);
1279                          SIZE s;                                  SIZE s;
1280                          for (i=0; i<count; i++) {                                  for (i=0; i<count; i++) {
1281                                  len = SendMessage(hostcom, CB_GETLBTEXTLEN, i, 0);                                          len = SendMessage(hostcom, CB_GETLBTEXTLEN, i, 0);
1282                                  lbl = (char *)calloc(len+1, sizeof(char));                                          lbl = (char *)calloc(len+1, sizeof(char));
1283                                  SendMessage(hostcom, CB_GETLBTEXT, i, (LPARAM)lbl);                                          SendMessage(hostcom, CB_GETLBTEXT, i, (LPARAM)lbl);
1284                                  GetTextExtentPoint32(TmpDC, lbl, len, &s);                                          GetTextExtentPoint32(TmpDC, lbl, len, &s);
1285                                  if (s.cx > max_len)                                          if (s.cx > max_len)
1286                                          max_len = s.cx;                                                  max_len = s.cx;
1287                                  free(lbl);                                          free(lbl);
1288                                    }
1289                                    SendMessage(hostcom, CB_SETDROPPEDWIDTH,
1290                                                            max_len + GetSystemMetrics(SM_CXVSCROLL), 0);
1291                          }                          }
1292                          SendMessage(hostcom, CB_SETDROPPEDWIDTH,                          break;
                                     max_len + GetSystemMetrics(SM_CXVSCROLL), 0);  
                 }  
                 break;  
1293    
1294                  case IDC_HOSTHELP:                  case IDC_HOSTHELP:
1295                          PostMessage(GetParent(dlg), WM_USER_DLGHELP2, 0, 0);                          PostMessage(GetParent(dlg), WM_USER_DLGHELP2, 0, 0);

Legend:
Removed from v.3008  
changed lines
  Added in v.3009

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