Example #1
0
/* -----------------------------------------------------------------------------*/
void MoveSelection (char direction)
{
	short port = -1;
	if (portSelected < 0) {
		ListMove (direction);
		return;
	}
	
	switch (direction) {
		case kLeftArrowCharCode:	port = portSelected - 1;
			break;
		case kRightArrowCharCode:	port = portSelected + 1;
			break;
		case kUpArrowCharCode:		port = portSelected - 16;
			break;
		case kDownArrowCharCode:	port = portSelected + 16;
			break;
	}
	if ((port >= 0) && (port <= 255)) {
		portSelected = port;
		ShowSrcDest (port);
		InvalPortArea ();
	}
}
Example #2
0
BOOL ZipDlg::OnListNotify( HWND hDlg, WPARAM wParam, LPARAM lParam)
{
	NMHDR*	nmhdr = (NMHDR*)lParam ;

	// キーダウン
	if( nmhdr->code == LVN_KEYDOWN)
	{
		// デリート
		if( ( (LPNMLVKEYDOWN)lParam)->wVKey == VK_DELETE)
		{
			ListDel( ) ;
			EnableWindow( hwndOk, ( ListView_GetItemCount( hwndList) != 0 ? TRUE : FALSE)) ;
		}
		// Ctrl + A
		else if( GetKeyState( VK_CONTROL) < 0 && ( (LPNMLVKEYDOWN)lParam)->wVKey == 'A')
		{
			ListView_SetItemState( hwndList, -1, LVIS_SELECTED, LVIS_SELECTED) ;
		}
		// Alt + ↑↓
		else if( GetKeyState( VK_MENU) < 0)
		{
			if( ( (LPNMLVKEYDOWN)lParam)->wVKey == VK_UP)
			{
				ListMove( TRUE) ;
			}
			else if( ( (LPNMLVKEYDOWN)lParam)->wVKey == VK_DOWN)
			{
				ListMove( FALSE) ;
			}
		}
		return TRUE ;
	}
	// 選択変更時
	else if( nmhdr->code == LVN_ITEMCHANGED)
	{
		EnableWindow( hwndOk, ( ListView_GetItemCount( hwndList) != 0 ? TRUE : FALSE)) ;
		EnableWindow( hwndDel, ( ListView_GetSelectedCount( hwndList) != 0 ? TRUE : FALSE)) ;
		return TRUE ;
	}
	// ヘッダ部分クリック
	else if( nmhdr->code == LVN_COLUMNCLICK)
	{
		ListView_SortItems( hwndList, ListSortProc, ( (NMLISTVIEW*)lParam)->iSubItem) ;
		ListReload() ;
		return TRUE ;
	}
	// 右クリック
	else if( nmhdr->code == NM_RCLICK)
	{
		POINT pt ;
		GetCursorPos( &pt) ;
		HMENU hMenu = LoadMenu( hInstance, MAKEINTRESOURCE(IDR_POPMENU)) ;
		HMENU hMenuPopup = GetSubMenu( hMenu, 0) ;
		if( ListView_GetSelectedCount( hwndList) == 0)
		{
			EnableMenuItem( hMenuPopup, IDM_DEL, MF_BYCOMMAND | MF_GRAYED) ;
			EnableMenuItem( hMenuPopup, IDM_SETFOLDER, MF_BYCOMMAND | MF_GRAYED) ;
			EnableMenuItem( hMenuPopup, IDM_UP, MF_BYCOMMAND | MF_GRAYED) ;
			EnableMenuItem( hMenuPopup, IDM_DOWN, MF_BYCOMMAND | MF_GRAYED) ;
		}
		if( ListView_GetItemCount( hwndList) == 0)
		{
			EnableMenuItem( hMenuPopup, IDM_SORTFILE, MF_BYCOMMAND | MF_GRAYED) ;
			EnableMenuItem( hMenuPopup, IDM_SORTPATH, MF_BYCOMMAND | MF_GRAYED) ;
			EnableMenuItem( hMenuPopup, IDM_SORTZIP, MF_BYCOMMAND | MF_GRAYED) ;
		}

		DWORD dwID = TrackPopupMenu( hMenuPopup, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, 
			pt.x, pt.y, 0, hDlg, NULL) ;
		switch( dwID)
		{
			case IDM_ADD:
				ListAddFileDlg() ;
				break ;
			case IDM_DEL:
				ListDel() ;
				break ;
			case IDM_UP:
			case IDM_DOWN:
				ListMove( dwID == IDM_UP) ;
				break ;
			case IDM_SORTPATH:
				ListView_SortItems( hwndList, ListSortProc, 1) ;
				ListReload() ;
				break ;
			case IDM_SORTFILE:
				ListView_SortItems( hwndList, ListSortProc, 2) ;
				ListReload() ;
				break ;
			case IDM_SORTZIP:
				ListView_SortItems( hwndList, ListSortProc, 0) ;
				ListReload() ;
				break ;
			case IDM_SETFOLDER:
				ListSetFolder() ;
				break ;
		}

		DestroyMenu( hMenu) ;
	}

	return FALSE ;
}
Example #3
0
BOOL ZipDlg::OnDownBtn( HWND, WPARAM, LPARAM)
{
	return ListMove( FALSE) ;
}
Example #4
0
BOOL ZipDlg::OnUpBtn( HWND, WPARAM, LPARAM)
{
	return ListMove( TRUE) ;
}