void __fastcall TRigCtlMain::LogTimerTimer( TObject *Sender ) { bool show = getShowServers(); if ( !Application->MainForm->Visible && show ) { Application->MainForm->Visible = true; } if ( Application->MainForm->Visible && !show ) { Application->MainForm->Visible = false; } // check log queue; if anything on it then log to main window while ( true ) { LogEvent * ev = deQueueLog(); if ( ev ) { logMessage( "Log : " + ev->eMessageType + " " + ev->eMessage ); delete ev; } else break; } static bool closed = false; if ( !closed ) { if ( checkCloseEvent() ) { closed = true; CloseButtonClick( Sender ); } } }
void __fastcall TTestRigMain::Timer1Timer( TObject *Sender ) { static in_timer = false; if ( in_timer ) return ; static bool closed = false; if ( !closed ) { if ( checkCloseEvent() ) { closed = true; CloseButtonClick( Sender ); } } in_timer = true; freq_t freq; shortfreq_t ritfreq; shortfreq_t xitfreq; rmode_t mode; pbwidth_t width; char buff[ 1024 ]; DWORD t = GetTickCount(); int ferr = rig_get_freq( my_rig, RIG_VFO_CURR, &freq ); // int rerr = rig_get_rit(my_rig, RIG_VFO_CURR, &ritfreq); // int xerr = rig_get_xit(my_rig, RIG_VFO_CURR, &xitfreq); int merr = rig_get_mode( my_rig, RIG_VFO_CURR, &mode, &width ); DWORD t1 = GetTickCount(); if ( ferr != RIG_OK ) { sprintf( buff, "Time %d rig_getFreq: error = %s", ( int ) ( t1 - t ), rigerror( ferr ) ); Label2->Caption = buff; } else { sprintf( buff, "rig_getFreq Time %d Freq %lld", ( int ) ( t1 - t ), ( long long ) freq ); Label2->Caption = buff; noSetFreq = true; FreqSlider->Position = ( freq - 28000000 ) / 100; noSetFreq = false; } if ( merr != RIG_OK ) { sprintf( buff, "Time %d rig_get_mode: error = %s", ( int ) ( t1 - t ), rigerror( ferr ) ); Label2->Caption = buff; } else { sprintf( buff, "rig_get_mode Time %d mode %d", ( int ) ( t1 - t ), ( long ) mode ); Label2->Caption = buff; noSetMode = true; switch ( mode ) { case RIG_MODE_AM: ModeRadioGroup->ItemIndex = 0; break; case RIG_MODE_CW: ModeRadioGroup->ItemIndex = 1; break; case RIG_MODE_USB: ModeRadioGroup->ItemIndex = 2; break; case RIG_MODE_LSB: ModeRadioGroup->ItemIndex = 2; break; case RIG_MODE_RTTY: ModeRadioGroup->ItemIndex = 0; break; case RIG_MODE_FM: ModeRadioGroup->ItemIndex = 0; break; case RIG_MODE_WFM: ModeRadioGroup->ItemIndex = 0; break; case RIG_MODE_CWR: ModeRadioGroup->ItemIndex = 1; break; case RIG_MODE_RTTYR: ModeRadioGroup->ItemIndex = 0; break; case RIG_MODE_AMS: ModeRadioGroup->ItemIndex = 0; break; case RIG_MODE_PKTLSB: ModeRadioGroup->ItemIndex = 2; break; case RIG_MODE_PKTUSB: ModeRadioGroup->ItemIndex = 2; break; case RIG_MODE_PKTFM: ModeRadioGroup->ItemIndex = 0; break; case RIG_MODE_ECSSUSB: ModeRadioGroup->ItemIndex = 2; break; case RIG_MODE_ECSSLSB: ModeRadioGroup->ItemIndex = 2; break; case RIG_MODE_FAX: ModeRadioGroup->ItemIndex = 0; break; case RIG_MODE_NONE: default: ModeRadioGroup->ItemIndex = 0; break; } noSetMode = false; } in_timer = false; }
//--------------------------------------------------------------------------- void __fastcall TMessageForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { if( Key==VK_RETURN || Key==VK_ESCAPE ) CloseButtonClick(Sender); }