Exemple #1
0
int SendFileTestCancel()
{
  if (Cancel) {
    SendFileCleanup();
    CancelCommand();
    return 1;
  }
  return 0;
}
void GNC::GUI::AcquisitionTableModel::ClearResults()
{
        CancelCommand();

        wxDataViewItemArray toDeleteList;
        for (TMapIndex::iterator it = studyMap.begin(); it !=  studyMap.end(); ++it) {
                toDeleteList.push_back(wxDataViewItem((*it).second));
        }
        //then delete studies Nodes...
        ItemsDeleted(wxDataViewItem(0), toDeleteList);

        //delete all and reload again...
        ClearStudyMap();
}
LRESULT CALLBACK SubClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	static int p;

	switch (msg)
	{

	case WM_CHAR:

		if (inputlock) return 0;

		switch (wParam)
		{
		case 13:
			ProcessCommand();
			return 0;

		default:
			p = fn(ptr, SCI_GETCURRENTPOS, 0, 0);
			if (p < minCaret) fn(ptr, SCI_SETSEL, -1, -1);

		}
		break;

	case WM_KEYUP:

		switch (wParam)
		{
		case VK_UP:
		case VK_DOWN:
		case VK_RETURN:
			return 0;
		}
		break;

	case WM_KEYDOWN:

		if (inputlock) return 0;

		switch (wParam)
		{

		// don't know if I prefer this as copy or cancel.  ultimately copy 
		// is available via the menu, whilst we need a key for cancel.  
		// FIXME? how about, if there's a selection then copy; otherwise cancel.  
		// too confusing? actually I think it works, it's contextual.

		case 'C':
			if (GetKeyState(VK_CONTROL) < 0){
				DebugOut("Control-c\n");
				int start = fn(ptr, SCI_GETSELECTIONSTART, 0, 0);
				int end = fn(ptr, SCI_GETSELECTIONEND, 0, 0);
				if (end == start){
					DebugOut("Cancel");
					CancelCommand();
				}
			}
			break;

		case VK_ESCAPE:
			if (!fn(ptr, SCI_AUTOCACTIVE, 0, 0)
				&& !fn(ptr, SCI_CALLTIPACTIVE, 0, 0))
			{
				::PostMessage(::GetParent(hwnd), WM_COMMAND, WM_CLOSE_CONSOLE, 0);
				return 0;
			}
			break;

		case VK_HOME:
			fn(ptr, SCI_SETSEL, minCaret, minCaret);
			return 0;
			break;

		case VK_END:
			fn(ptr, SCI_SETSEL, -1, -1);
			break;

		case VK_LEFT:
		case VK_BACK:
			p = fn(ptr, SCI_GETCURRENTPOS, 0, 0);
			if (p <= minCaret) return 0;
			break;

		case VK_UP:
			if (!fn(ptr, SCI_AUTOCACTIVE, 0, 0))
			{
				CmdHistory(-1);
				return 0;
			}
			break;

		case VK_DOWN:
			if (!fn(ptr, SCI_AUTOCACTIVE, 0, 0))
			{
				CmdHistory(1);
				return 0;
			}
			break;

		case VK_RETURN:
			fn(ptr, SCI_AUTOCCANCEL, 0, 0);
			fn(ptr, SCI_CALLTIPCANCEL, 0, 0);
			return 0;
		}

		break;

	}

	return CallWindowProc(lpfnEditWndProc, hwnd, msg, wParam, lParam);
}