Example #1
0
bool wxComboBox::OSXHandleClicked( double WXUNUSED(timestampsec) )
{
    wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId );
    event.SetInt(GetSelection());
    event.SetEventObject(this);
    event.SetString(GetStringSelection());
    ProcessCommand(event);
    return true;
}
Example #2
0
bool wxButton::SendClickEvent()
{
    wxCommandEvent                  vEvent( wxEVT_COMMAND_BUTTON_CLICKED
                                           ,GetId()
                                          );

    vEvent.SetEventObject(this);
    return ProcessCommand(vEvent);
} // end of wxButton::SendClickEvent
Example #3
0
bool wxDisclosureTriangle::OSXHandleClicked( double WXUNUSED(timestampsec) )
{
    // Just emit button event for now
    wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, m_windowId);
    event.SetEventObject(this);
    ProcessCommand(event);

    return true;
}
Example #4
0
bool wxTextCtrl::OS2Command(
  WXUINT                            uParam
, WXWORD                            WXUNUSED(vId)
)
{
    switch (uParam)
    {
        case EN_SETFOCUS:
        case EN_KILLFOCUS:
            {
                wxFocusEvent        vEvent( uParam == EN_KILLFOCUS ? wxEVT_KILL_FOCUS
                                                                   : wxEVT_SET_FOCUS
                                           ,m_windowId
                                          );

                vEvent.SetEventObject(this);
                GetEventHandler()->ProcessEvent(vEvent);
            }
            break;

        case EN_CHANGE:
            {
                if (m_bSkipUpdate)
                {
                    m_bSkipUpdate = false;
                    break;
                }

                wxCommandEvent      vEvent( wxEVT_COMMAND_TEXT_UPDATED
                                           ,m_windowId
                                          );

                InitCommandEvent(vEvent);
                ProcessCommand(vEvent);
            }
            break;

        case EN_OVERFLOW:
            //
            // The text size limit has been hit - increase it
            //
            AdjustSpaceLimit();
            break;

        case EN_SCROLL:
        case EN_INSERTMODETOGGLE:
        case EN_MEMERROR:
            return false;
        default:
            return false;
    }

    //
    // Processed
    //
    return true;
} // end of wxTextCtrl::OS2Command
Example #5
0
void CommandParser::ProcessBuffer(std::string &buffer,LocalUser *user)
{
	if (buffer.empty())
		return;

	ServerInstance->Logs->Log("USERINPUT", LOG_RAWIO, "C[%s] I :%s %s",
		user->uuid.c_str(), user->nick.c_str(), buffer.c_str());
	ProcessCommand(user,buffer);
}
Example #6
0
// -------------------------------------------------------------------------------------------------
le_result_t send_SendMessage(const char* telPtr, const char* messagePtr)
{
    if (!ProcessCommand(messagePtr, NULL))
    {
        return SendMessage(telPtr, messagePtr);
    }

    return LE_OK;
}
bool wxCheckBox::OSXHandleClicked( double WXUNUSED(timestampsec) )
{
    bool sendEvent = true;
    wxCheckBoxState newState = Get3StateValue();

    if ( !GetPeer()->ButtonClickDidStateChange() )
    {
        wxCheckBoxState origState ;

        origState = Get3StateValue();

        switch (origState)
        {
            case wxCHK_UNCHECKED:
                newState = wxCHK_CHECKED;
                break;

            case wxCHK_CHECKED:
                // If the style flag to allow the user setting the undetermined state is set,
                // then set the state to undetermined; otherwise set state to unchecked.
                newState = Is3rdStateAllowedForUser() ? wxCHK_UNDETERMINED : wxCHK_UNCHECKED;
                break;

            case wxCHK_UNDETERMINED:
                newState = wxCHK_UNCHECKED;
                break;

            default:
                break;
        }
        
        if (newState == origState)
            sendEvent = false;
        else
            Set3StateValue( newState );
    }
    else
    {
        // in case we cannot avoid this user state change natively (eg cocoa) we intercept it here
        if ( newState == wxCHK_UNDETERMINED && !Is3rdStateAllowedForUser() )
        {
            newState = wxCHK_CHECKED;
            Set3StateValue( newState );
        }
    }
    
    if (sendEvent)
    {
        wxCommandEvent event( wxEVT_CHECKBOX, m_windowId );
        event.SetInt( newState );
        event.SetEventObject( this );
        ProcessCommand( event );
    }

    return true;
}
Example #8
0
bool ExternalStreamHandler::StopStreaming(void)
{
    QString result;

    QMutexLocker locker(&m_stream_lock);

    LOG(VB_RECORD, LOG_INFO, LOC +
        QString("StopStreaming %1 listeners")
        .arg(StreamingCount()));

    if (StreamingCount() == 0)
    {
        LOG(VB_RECORD, LOG_INFO, LOC +
            "StopStreaming requested, but we are not streaming!");
        return true;
    }

    if (m_streaming_cnt.deref())
    {
        LOG(VB_RECORD, LOG_INFO, LOC +
            QString("StopStreaming delayed, still have %1 listeners")
            .arg(StreamingCount()));
        return true;
    }

    LOG(VB_RECORD, LOG_INFO, LOC + "StopStreaming");

    if (!IsOpen())
    {
        LOG(VB_GENERAL, LOG_ERR, LOC + "External recorder not started.");
        return false;
    }

    if (!ProcessCommand("StopStreaming", 5000, result))
    {
        LOG(VB_GENERAL, LOG_ERR, LOC + QString("StopStreaming: '%1'")
            .arg(result));
        if (!result.startsWith("Warn"))
        {
            _error = true;
            m_error = QString("StopStreaming failed: '%1'").arg(result);
        }
        return false;
    }

    if (!result.startsWith("OK:Stopped"))
    {
        LOG(VB_GENERAL, LOG_WARNING, LOC + m_error);
        return false;
    }

    PurgeBuffer();
    LOG(VB_RECORD, LOG_INFO, LOC + "Streaming stopped");

    return true;
}
Example #9
0
//-----------------------------------------------------------------------------
//	BugDlg_SaveGame
//
//-----------------------------------------------------------------------------
void BugDlg_SaveGame( HWND hWnd )
{
	char	buff[1024];
	char	savename[MAX_PATH];
	char	remoteFile[MAX_PATH];

	if ( !g_bug_mapInfo.savePath[0] )
	{
		return;
	}

	SetDlgItemText( hWnd, IDC_BUG_SAVEGAME_LABEL, "Working..." );

	BugDlg_GetDataFileBase( g_bug_pReporter->GetUserName(), true, g_bug_szSavegame, sizeof( g_bug_szSavegame ) );
	Sys_StripPath( g_bug_szSavegame, savename, sizeof( savename ) );
	strcat( g_bug_szSavegame, ".360.sav" );

	sprintf( remoteFile, "%s\\%s.360.sav", g_bug_mapInfo.savePath, savename );

	// delete file locally
	unlink( g_bug_szSavegame );

	// delete file remotely
	DmDeleteFile( remoteFile, false );

	// save, and wait to ensure async completes
	sprintf( buff, "save \"%s\" notmostrecent wait", savename );
	if ( !ProcessCommand( buff ) )
	{
		// failed
		g_bug_szSavegame[0] = '\0';
	}
	else
	{
		DM_FILE_ATTRIBUTES fileAttributes;
		for (int i=0; i<5; i++)
		{
			// wait for the save file to appear
			HRESULT hr = DmGetFileAttributes( remoteFile, &fileAttributes );
			if ( hr == XBDM_NOERR )
				break;

			// wait for it
			Sleep( 1000 );
		}

		HRESULT hr = DmReceiveFile( g_bug_szSavegame, remoteFile );
		if ( hr != XBDM_NOERR )
		{
			// failed
			g_bug_szSavegame[0] = '\0';
		}
	}

	SetDlgItemText( hWnd, IDC_BUG_SAVEGAME_LABEL, g_bug_szSavegame );
}
Example #10
0
int main(void)
{

	// open the device
	AFP_Error = ADIM29W64DEntryPoint.adi_pdd_Open(	NULL,		// DevMgr handle
							0,				// pdd entry point
							NULL,			// device instance
							NULL,			// client handle callback identifier
				  			ADI_DEV_DIRECTION_BIDIRECTIONAL,// data direction for this device
							NULL,			// DevMgr handle for this device
							NULL,			// handle to DmaMgr for this device
							NULL,			// handle to deferred callback service
							NULL );			// client's callback function

	// setup the device so the DSP can access it
	if (SetupForFlash() != NO_ERR)
		return FALSE;

	// allocate AFP_Buffer
	if (( AFP_Error = AllocateAFPBuffer()) != NO_ERR)
		return FALSE;

	// get sector map
	if (( AFP_Error = GetSectorMap())!= NO_ERR)
		return FALSE;

	// get flash manufacturer & device codes, title & desc
	if (( AFP_Error = GetFlashInfo()) != NO_ERR)
		return FALSE;

	// command processing loop
	while ( !bExit )
	{
		// the plug-in will set a breakpoint at "AFP_BreakReady" so it knows
		// when we are ready for a new command because the DSP will halt
		//
		// the jump is used so that the label will be part of the debug
		// information in the driver image otherwise it may be left out
 		// since the label is not referenced anywhere
		asm("AFP_BreakReady:");
       		asm("nop;");
			if ( FALSE )
				asm("jump AFP_BreakReady;");

		// Make a call to the ProcessCommand
		   AFP_Error = ProcessCommand();
	}

	//Clear the AFP_Buffer
	FreeAFPBuffer();

	//Close the Device
	AFP_Error = ADIM29W64DEntryPoint.adi_pdd_Close(NULL);

	return TRUE;
}
Example #11
0
status_t
IMAPMailbox::SelectMailbox(const char* mailbox)
{
	TRACE("SELECT %s\n", mailbox);
	fMailboxSelectHandler.SetTo(mailbox);
	status_t status = ProcessCommand(&fMailboxSelectHandler);
	if (status != B_OK)
		return status;
	fSelectedMailbox = mailbox;

	if (fCapabilityHandler.Capabilities() != "")
		return status;
	//else get them
	status = ProcessCommand(fCapabilityHandler.Command());
	if (status != B_OK)
		return status;

	return B_OK;
}
Example #12
0
void wxCheckBox::Command (wxCommandEvent & event)
{
    int state = event.GetInt();
    wxCHECK_RET( (state == wxCHK_UNCHECKED) || (state == wxCHK_CHECKED)
        || (state == wxCHK_UNDETERMINED),
        wxT("event.GetInt() returned an invalid checkbox state") );

    Set3StateValue((wxCheckBoxState) state);
    ProcessCommand(event);
}
Example #13
0
void TextureFillProc( HWND hWindow, UINT msg, int x, int y, UINT32 Option )
/************************************************************************/
{
FNAME szFileName;
LPIMAGE lpImage;
TEXTUREFILL_PARMS parms;

switch (msg)
    {
    case WM_CREATE:	// The first mouse down message
	// Load the texture
	if (!IsOnImage(hWindow, x, y))
		break;
	if (!LookupExtFile(Texture.TextureName, szFileName, IDN_TEXTURE))
		break;
	if (!FileExists(szFileName))
		{
		Message(IDS_EOPEN, (LPSTR)szFileName);
		break;
		}
    lpImage = (LPIMAGE)GetImagePtr ( hWindow );
	parms.TextureOpacity = Texture.TextureOpacity;
	parms.TextureMergeMode = Texture.TextureMergeMode;
	lstrcpy(parms.TextureName, Texture.TextureName);
	parms.fHorzFlip = Texture.fHorzFlip;
	parms.fVertFlip = Texture.fVertFlip;
	ProcessCommand(lpImage->lpCmdList, IDS_CMD_TEXTUREFILL, &parms);
	break;

	case WM_ACTIVATE:
	if (!Option) // a deactivate
		{
		FrameClose( lpTextureFrame );
		lpTextureFrame = NULL;
		}
	return;
		
    case WM_LBUTTONDOWN:
	break;

    case WM_LBUTTONUP:
	Tool.bActive = NO;
	break;

    case WM_MOUSEMOVE:	// sent when ToolActive is on
	break;

    case WM_LBUTTONDBLCLK:
	break;

    case WM_DESTROY:	// The cancel operation message
	Tool.bActive = NO;
	break;
    }
}
void HID_GetOutReport(uint8_t *pu8EpBuf, uint32_t u32Size)
{
    uint8_t  u8Cmd;
    uint32_t u32StartPage;
    uint32_t u32Pages;
    uint32_t u32PageCnt;

    /* Get command information */
    u8Cmd        = gCmd.u8Cmd;
    u32StartPage = gCmd.u32Arg1;
    u32Pages     = gCmd.u32Arg2;
    u32PageCnt   = gCmd.u32Signature; /* The signature word is used to count pages */


    /* Check if it is in the data phase of write command */
    if((u8Cmd == HID_CMD_WRITE) &&  (u32PageCnt < u32Pages))
    {
        /* Process the data phase of write command */

        /* Get data from HID OUT */
        USBD_MemCopy(&g_u8PageBuff[g_u32BytesInPageBuf], pu8EpBuf, EP6_MAX_PKT_SIZE);
        g_u32BytesInPageBuf += EP6_MAX_PKT_SIZE;

        /* The HOST must make sure the data is PAGE_SIZE alignment */
        if(g_u32BytesInPageBuf >= PAGE_SIZE)
        {
            printf("Writing page %d\n", u32StartPage + u32PageCnt);
            /* TODO: We should program received data to storage here */
            memcpy(g_u8TestPages + u32PageCnt * PAGE_SIZE, g_u8PageBuff, sizeof(g_u8PageBuff));
            u32PageCnt++;

            /* Write command complete! */
            if(u32PageCnt >= u32Pages)
            {
                u8Cmd = HID_CMD_NONE;

                printf("Write command complete.\n");
            }

            g_u32BytesInPageBuf = 0;
        }

        /* Update command status */
        gCmd.u8Cmd        = u8Cmd;
        gCmd.u32Signature = u32PageCnt;
    }
    else
    {
        /* Check and process the command packet */
        if(ProcessCommand(pu8EpBuf, u32Size))
        {
            printf("Unknown HID command!\n");
        }
    }
}
Example #15
0
bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
{
    switch ( msg )
    {
        case WM_CHAR:
            // for compatibility with wxTextCtrl, generate a special message
            // when Enter is pressed
            if ( wParam == VK_RETURN )
            {
                if (SendMessage(GetHwnd(), CB_GETDROPPEDSTATE, 0, 0))
                    return false;

                wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);

                const int sel = GetSelection();
                event.SetInt(sel);
                event.SetString(GetValue());
                InitCommandEventWithItems(event, sel);

                if ( ProcessCommand(event) )
                {
                    // don't let the event through to the native control
                    // because it doesn't need it and may generate an annoying
                    // beep if it gets it
                    return true;
                }
            }
            // fall through

        case WM_SYSCHAR:
            return HandleChar(wParam, lParam);

        case WM_SYSKEYDOWN:
        case WM_KEYDOWN:
            return HandleKeyDown(wParam, lParam);

        case WM_SYSKEYUP:
        case WM_KEYUP:
            return HandleKeyUp(wParam, lParam);

        case WM_SETFOCUS:
            return HandleSetFocus((WXHWND)wParam);

        case WM_KILLFOCUS:
            return HandleKillFocus((WXHWND)wParam);

        case WM_CUT:
        case WM_COPY:
        case WM_PASTE:
            return HandleClipboardEvent(msg);
    }

    return false;
}
Example #16
0
void CScreenManager::OnReceive(LPBYTE lpBuffer, UINT nSize)
{
	try
	{
 		switch (lpBuffer[0])
 		{
		case COMMAND_NEXT:
			// 通知内核远程控制端对话框已打开,WaitForDialogOpen可以返回
			NotifyDialogIsOpen();
			break;
		case COMMAND_SCREEN_RESET:
			ResetScreen(*(LPBYTE)&lpBuffer[1]);
			break;
		case COMMAND_ALGORITHM_RESET:
			m_bAlgorithm = *(LPBYTE)&lpBuffer[1];
			m_pScreenSpy->setAlgorithm(m_bAlgorithm);
			break;
		case COMMAND_SCREEN_CTRL_ALT_DEL:
			::SimulateCtrlAltDel();
			break;
		case COMMAND_SCREEN_CONTROL:
			{
				typedef BOOL (WINAPI *BlockInputT)
					(
					BOOL fBlockIt
					);
				BlockInputT pBlockInput= (BlockInputT)GetProcAddress(LoadLibrary("user32.dll"),"BlockInput");
				// 远程仍然可以操作
				pBlockInput(false);
				ProcessCommand(lpBuffer + 1, nSize - 1);
				pBlockInput(m_bIsBlockInput);
			}
			break;
		case COMMAND_SCREEN_BLOCK_INPUT: //ControlThread里锁定
			m_bIsBlockInput = *(LPBYTE)&lpBuffer[1];
			break;
		case COMMAND_SCREEN_BLANK:
			m_bIsBlankScreen = *(LPBYTE)&lpBuffer[1];
			break;
		case COMMAND_SCREEN_CAPTURE_LAYER:
			m_bIsCaptureLayer = *(LPBYTE)&lpBuffer[1];
			m_pScreenSpy->setCaptureLayer(m_bIsCaptureLayer);
			break;
		case COMMAND_SCREEN_GET_CLIPBOARD:
			SendLocalClipboard();
			break;
		case COMMAND_SCREEN_SET_CLIPBOARD:
			UpdateLocalClipboard((char *)lpBuffer + 1, nSize - 1);
			break;
		default:
			break;
		}
	}catch(...){}
}
Example #17
0
status_t
Protocol::_GetAllFolders(StringList& folders)
{
	ListCommand command(NULL, false);
	status_t status = ProcessCommand(command);
	if (status != B_OK)
		return status;

	folders = command.FolderList();
	return status;
}
Example #18
0
bool wxSearchCtrl::HandleSearchFieldSearchHit()
{
    wxCommandEvent event(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, m_windowId );
    event.SetEventObject(this);

    // provide the string to search for directly in the event, this is more
    // convenient than retrieving it from the control in event handler code
    event.SetString(GetValue());

    return ProcessCommand(event);
}
Example #19
0
status_t
IMAPFolders::_GetSubscribedFolders(StringList& folders)
{
	ListSubscribedCommand listSubscribedCommand;
	status_t status = ProcessCommand(&listSubscribedCommand);
	if (status != B_OK)
		return status;

	folders = listSubscribedCommand.FolderList();
	return status;
}
Example #20
0
void wxListBox::Command (wxCommandEvent & event)
{
    if (event.GetExtraLong())
        SetSelection (event.GetInt());
    else
    {
        Deselect (event.GetInt());
        return;
    }
    ProcessCommand (event);
}
Example #21
0
BOOL CImage::Crop( LPRECT lpCropRect )
{

if (lpCropRect)
	{
	int res;
	CROP_PARMS parms;

	GetInfo(NULL, NULL, NULL, NULL, &res);
	parms.iBaseRes = res;
	parms.CropRect = *lpCropRect;
	return(ProcessCommand(lpCmdList, IDS_CMD_CROP, &parms));
	}
else
	{
	CMD_PARMS parms;

	return(ProcessCommand(lpCmdList, IDS_CMD_CROPMASK, &parms));
	}
}
Example #22
0
/*
	Fuction:LoopCommand;
	INPUT:
		args -- POINTER ALWAYS NULL;
	RETURN:NULL;
*/
void *
SA_CommandLoop( void *args )
{
    char cmdline[100];

    strcpy(cmdline,NowCommand);

    ProcessCommand( cmdline );

    return NULL;
}
Example #23
0
void wxRadioBox::SendNotificationEvent()
{
    wxCommandEvent                  vEvent( wxEVT_COMMAND_RADIOBOX_SELECTED
                                           ,m_windowId
                                          );

    vEvent.SetInt( m_nSelectedButton );
    vEvent.SetString( GetString(m_nSelectedButton) );
    vEvent.SetEventObject(this);
    ProcessCommand(vEvent);
} // end of wxRadioBox::SendNotificationEvent
Example #24
0
void HALshell ()
{
    string commandLine;

    do
    {
        commandLine = GetCommandLine ();
        ProcessCommand (commandLine);
    } while (1);

    return;
}
Example #25
0
void Console::ExecuteCommand(void)
{
	if(cmd.str().length() < 1)
		return;

	commands.push_back(cmd.str());
	commandPos = commands.size();

	ProcessCommand(cmd.str().c_str(), true);

	cmd.str("");
}
Example #26
0
status_t
Protocol::GetSubscribedFolders(StringList& folders, BString& separator)
{
	ListCommand command(NULL, true);
	status_t status = ProcessCommand(command);
	if (status != B_OK)
		return status;

	folders = command.FolderList();
	separator = command.Separator();
	return status;
}
Example #27
0
/***********************************************************
 * AddKey
 ***********************************************************/
status_t
PGP::AddKey(const char* key)
{
	BPath path(fTmpDirPath);
	path.Append(INPUT_FILENAME);
	
	BString cmd;
	cmd += "pgpk -a ";
	cmd += path.Path();
	
	return ProcessCommand(cmd.String(),key,NULL);
}
Example #28
0
void wxRadioBox::OnRadioButton( wxCommandEvent &outer )
{
    if ( outer.IsChecked() )
    {
        wxCommandEvent event(wxEVT_COMMAND_RADIOBOX_SELECTED, m_windowId);
        int i = GetSelection() ;
        event.SetInt( i );
        event.SetString( GetString( i ) );
        event.SetEventObject( this );
        ProcessCommand(event);
    }
}
Example #29
0
bool wxFrameBase::ProcessCommand(int id)
{
    wxMenuBar *bar = GetMenuBar();
    if ( !bar )
        return false;

    wxMenuItem *item = bar->FindItem(id);
    if ( !item )
        return false;

    return ProcessCommand(item);
}
Example #30
0
void Uart::ReceiveTask(const uint8_t *aBuf, uint16_t aBufLength)
{
    const uint8_t *end;

    end = aBuf + aBufLength;

    for (; aBuf < end; aBuf++)
    {
        switch (*aBuf)
        {
        case '\r':
        case '\n':
            Output(CRNL, sizeof(CRNL));

            if (mRxLength > 0)
            {
                mRxBuffer[mRxLength] = '\0';
                ProcessCommand();
            }

            Output(sCommandPrompt, sizeof(sCommandPrompt));

            break;

#ifdef OPENTHREAD_EXAMPLES_POSIX

        case 0x04: // ASCII for Ctrl-D
        case 0x03: // ASCII for Ctrl-C
            exit(EXIT_SUCCESS);
            break;
#endif

        case '\b':
        case 127:
            if (mRxLength > 0)
            {
                Output(sEraseString, sizeof(sEraseString));
                mRxBuffer[--mRxLength] = '\0';
            }

            break;

        default:
            if (mRxLength < kRxBufferSize)
            {
                Output(reinterpret_cast<const char *>(aBuf), 1);
                mRxBuffer[mRxLength++] = static_cast<char>(*aBuf);
            }

            break;
        }
    }
}