Пример #1
0
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
	MSG msg; int retval;

 	if(InitApp(hInstance, lpCmdLine) == false)
		return 0;

	hWnd = BuildWindow(nCmdShow);
	if(hWnd == NULL)
		return 0;

	// build GUI
	if (!BuildControls(hWnd))
		return 0;

	// Initialize all controls
	ApplySettings();

	// show credits
	char buf[BUFLEN];
	ZeroMemory(buf, BUFLEN);
	strncpy(buf, CREDITS, BUFLEN-1);
	SendMessage(g_statusTextControl, WM_SETTEXT, 0, (LPARAM)buf);

	while((retval = GetMessage(&msg,NULL,0,0)) != 0)
	{
		// capture key-def events
		if ((msg.hwnd == g_keySwitchLeftControl 
                    || msg.hwnd == g_keySwitchRightControl 
                    || msg.hwnd == g_keyResetControl 
                    || msg.hwnd == g_keyRandomControl 
                    || msg.hwnd == g_keyPrevControl 
                    || msg.hwnd == g_keyNextControl 
                    || msg.hwnd == g_keyPrevValControl 
                    || msg.hwnd == g_keyNextValControl 
                    || msg.hwnd == g_keyInfoPagePrevControl 
                    || msg.hwnd == g_keyInfoPageNextControl 
                    || msg.hwnd == g_keyAction1Control 
                    || msg.hwnd == g_keyAction2Control 
                    || msg.hwnd == g_keySwitch1Control 
                    || msg.hwnd == g_keySwitch2Control 
            ) && (
                msg.message == WM_KEYDOWN 
                    || msg.message == WM_SYSKEYDOWN
            ))
		{
			PostMessage(hWnd, WM_APP_KEYDEF, msg.wParam, (LPARAM)msg.hwnd);
			continue;
		}

		if(retval == -1)
			return 0;	// an error occured while getting a message

		if (!IsDialogMessage(hWnd, &msg)) // need to call this to make WS_TABSTOP work
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}

	return 0;
}
Пример #2
0
tSonarDebugDialog::tSonarDebugDialog( 
    QWidget* pParent,
    const bool showDebug3D,
    const SonarCommon::eSonarServerClass& ServerClass,
    const int& Split,
    const int& FrequencyIndex ) :
tScrollDialog( tDialog::Partial, pParent ),
m_pEnableDebugParameters(0),
m_pEnableDebug3DParameters(0),
m_pShowDiagnostics(0),
m_pIntegration(0),
m_pPingRate(0),
m_pBurstLength(0),
m_pDcDcVoltage(0),
m_pGainDuty(0),
m_pNoCompensationMode(0),
m_pAllowPingDither(0),
m_pAllowDigitalHiding(0),
m_pGainBoost(0),
m_pEnableRVG(0),
m_pUseISTFiltering(0),
m_pResetCSMButton(0),
m_pResetSonarSPIButton(0),
m_pRangecellCutoff(0),
m_pDSP2CaseNumber(0),
m_pDuration(0),
m_pDemodulationFormula(0),
m_pIntCascadeFormula(0),
m_pLAF(0),
m_pLPF(0),
m_pGainPWM(0),
m_pDSP1Enabled(0),
m_pDSP2Enabled(0),
m_pDSP2GainBoost1(0),
m_pDSP2GainBoost2(0),
m_pPADutyCycle(0),
#ifdef DEBUG_DCDC_PWM
m_pDCDCPWM_Override(0),
m_pDCDCPWM_Frequency(0),
m_pDCDCPWM_DutyCycle(0),
#endif
m_pChannelComp(0),
m_pReceiverPAD(0),
m_pReceiverChannel(0),
m_pSecondaryIntegration(0),
m_pSecIntegrationIndex(0),
m_pDisableTVG(0),
m_Class(ServerClass),
m_Split(Split),
m_FrequencyIndex(FrequencyIndex)
{
    m_EnableDisableList.append("Disabled");
    m_EnableDisableList.append("Enabled");

    m_LocalDebug = tSonar::Instance()->IsServerState(m_Class) || tSonar::Instance()->Simulating();

    #define DSP2_NETWORK_PROTOCOL_VERSION   0x022   
    tSonarControlSettings SonarControlSettings;
    tSonarSettings::Instance()->GetControlSettings(SonarControlSettings);
    m_SupportRemoteDSP2 = (SonarControlSettings.m_Version >= DSP2_NETWORK_PROTOCOL_VERSION);

    BuildControls(showDebug3D);
}