From: Brad P. C. <bcr...@us...> - 2000-12-05 05:42:47
|
Update of /cvsroot/rswitch/rswitch In directory slayer.i.sourceforge.net:/tmp/cvs-serv6406 Modified Files: MainConfigDlg.cpp Log Message: * Added member pointer to hotkeylist * Added OnGetdispinfoHotkeylist * Too many others to list. Index: MainConfigDlg.cpp =================================================================== RCS file: /cvsroot/rswitch/rswitch/MainConfigDlg.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** MainConfigDlg.cpp 2000/11/01 15:10:17 1.1.1.1 --- MainConfigDlg.cpp 2000/12/05 05:42:36 1.2 *************** *** 19,22 **** --- 19,27 ---- // $Log$ + // Revision 1.2 2000/12/05 05:42:36 bcrochet + // * Added member pointer to hotkeylist + // * Added OnGetdispinfoHotkeylist + // * Too many others to list. + // // Revision 1.1.1.1 2000/11/01 15:10:17 bcrochet // Initial revision and import *************** *** 63,66 **** --- 68,72 ---- ON_BN_CLICKED(IDC_ADD, OnAdd) ON_BN_CLICKED(IDC_EDIT, OnEdit) + ON_NOTIFY(LVN_GETDISPINFO, IDC_HOTKEYLIST, OnGetdispinfoHotkeylist) //}}AFX_MSG_MAP END_MESSAGE_MAP() *************** *** 78,81 **** --- 84,109 ---- m_ctrlHotkeyList.SetColumnWidth(1, LVSCW_AUTOSIZE_USEHEADER); + m_pHotKeyList = &(GetMainFrame()->GetHotKeyList()); + HotKeyList::iterator i; + for ( i = m_pHotKeyList->begin(); i != m_pHotKeyList->end(); i++ ) + { + LV_ITEM lvItem; + lvItem.mask = LVIF_TEXT | LVIF_PARAM; + lvItem.iItem = 0; + lvItem.iSubItem = 0; + //CString modString = GetModifierString( (*i).GetModifiers() ); + //CString virtString = GetVirtKeyString( (*i).GetVirtKey() ); + //modString += " + "; + //modString += virtString; + //lvItem.pszText = ToLpstr( modString ); + lvItem.pszText = LPSTR_TEXTCALLBACK; + lvItem.lParam = (LPARAM)m_pHotKeyList->size() - 1; + m_ctrlHotkeyList.InsertItem(&lvItem); + lvItem.iSubItem = 1; + //lvItem.pszText = ToLpstr( (*i).GetServerName() + "/" + (*i).GetChannelName() ); + lvItem.pszText = LPSTR_TEXTCALLBACK; + m_ctrlHotkeyList.SetItem(&lvItem); + } + m_ctrlHotkeyList.SetExtendedStyle( m_ctrlHotkeyList.GetExtendedStyle() | LVS_EX_FULLROWSELECT ); *************** *** 124,149 **** if ( dlg.DoModal() == IDOK ) { LV_ITEM lvItem; ! lvItem.mask = LVIF_TEXT; ! lvItem.iItem = 0; lvItem.iSubItem = 0; ! CString modString = GetModifierString( dlg.m_wModifiers ); ! CString virtString = GetVirtKeyString( dlg.m_wVirtualKeyCode ); ! modString += " + "; ! modString += virtString; ! lvItem.pszText = ToLpstr( modString ); m_ctrlHotkeyList.InsertItem(&lvItem); lvItem.iSubItem = 1; ! CString ipaddr; ! DWORD ipAddr = dlg.m_dwIpAddr; ! ipaddr.Format( "%s %d.%d.%d.%d/%s", ! dlg.m_sFunction, ! FIRST_IPADDRESS(ipAddr), ! SECOND_IPADDRESS(ipAddr), ! THIRD_IPADDRESS(ipAddr), ! FOURTH_IPADDRESS(ipAddr), ! dlg.m_sChannel ! ); ! lvItem.pszText = ToLpstr( ipaddr ); m_ctrlHotkeyList.SetItem(&lvItem); } --- 152,178 ---- if ( dlg.DoModal() == IDOK ) { + CHotKeyEntry newEntry( dlg.m_wModifiers, dlg.m_wVirtualKeyCode, dlg.m_sServerName, dlg.m_sChannel ); + m_pHotKeyList->push_back( newEntry ); LV_ITEM lvItem; ! lvItem.mask = LVIF_TEXT | LVIF_PARAM; ! lvItem.iItem = m_ctrlHotkeyList.GetItemCount(); lvItem.iSubItem = 0; ! //CString modString = GetModifierString( dlg.m_wModifiers ); ! //CString virtString = GetVirtKeyString( dlg.m_wVirtualKeyCode ); ! //modString += " + "; ! //modString += virtString; ! //lvItem.pszText = ToLpstr( modString ); ! lvItem.pszText = LPSTR_TEXTCALLBACK; ! lvItem.lParam = (LPARAM)m_pHotKeyList->size() - 1; m_ctrlHotkeyList.InsertItem(&lvItem); lvItem.iSubItem = 1; ! //CString ipaddr; ! //ipaddr.Format( "%s %s/%s", ! // dlg.m_sFunction, ! // dlg.m_sServerName, ! // dlg.m_sChannel ! // ); ! //lvItem.pszText = ToLpstr( ipaddr ); ! lvItem.pszText = LPSTR_TEXTCALLBACK; m_ctrlHotkeyList.SetItem(&lvItem); } *************** *** 152,160 **** void CMainConfigDlg::OnEdit() { ! CAddEditDlg dlg(_T("Edit Hotkey")); ! dlg.DoModal(); } --- 181,219 ---- void CMainConfigDlg::OnEdit() { ! POSITION pos = m_ctrlHotkeyList.GetFirstSelectedItemPosition(); ! if ( pos == NULL ) ! { ! AfxMessageBox( "Please select an item before pressing the Edit button." ); ! return; ! } ! CHotKeyEntry& entry = (*m_pHotKeyList)[m_ctrlHotkeyList.GetNextSelectedItem( pos )]; ! CAddEditDlg dlg(_T("Edit Hotkey"), entry ); ! if ( dlg.DoModal() == IDOK ) ! { ! entry.SetChannelName( dlg.m_sChannel ); ! entry.SetServerName( dlg.m_sServerName ); ! } } + void CMainConfigDlg::OnGetdispinfoHotkeylist(NMHDR* pNMHDR, LRESULT* pResult) + { + LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR; + CString str; + switch ( pDispInfo->item.iSubItem ) + { + case 0: + str.Format( "%s + %s", GetModifierString( (*m_pHotKeyList)[pDispInfo->item.lParam].GetModifiers( ) ), + GetVirtKeyString( (*m_pHotKeyList)[pDispInfo->item.lParam].GetVirtKey( ) ) ); + break; + case 1: + str.Format( "%s/%s", (*m_pHotKeyList)[pDispInfo->item.lParam].GetServerName(), + (*m_pHotKeyList)[pDispInfo->item.lParam].GetChannelName() ); + break; + } + lstrcpyn( pDispInfo->item.pszText, str, str.GetLength() + 1 ); + + *pResult = 0; + } *************** *** 169,173 **** --- 228,234 ---- + // Keep at the bottom of the file to reduce clutter up top + // FIXME: Anyone think of a better way to do this? CString CMainConfigDlg::GetVirtKeyString( WORD wVirtKeyCode ) { *************** *** 302,303 **** --- 363,365 ---- return ret; } + |