Пример #1
0
void SearchThread::DeleteThread() {
    // We may be waiting for the condition so we cannot just call Delete
    m_stopSearch = true;
    CancelSearch();

    // Signal thread to stop waiting
    wxMutexLocker lock(m_condMutex);
    m_startSearchCond.Signal();
}
Пример #2
0
int RoutineView::Activate(int No) {
  CancelSearch();

  if (No < Buffer->rlst.Count) {
    View->SwitchToModel(Buffer);
    Buffer->CenterPosR(0, Buffer->rlst.Lines[No]);
    return 1;
  }
  return 0;
}
Пример #3
0
//离开FM前初始化函数
//利用内部FM模块时,底层会在切离通道(DAC_CH_ONCHIP_FM、DAC_CH_ONCHIP_FM_L、DAC_CH_ONCHIP_FM_R)过程中调用此函数
VOID RadioCtrlDeinit(VOID)
{
	CancelSearch();
	MuteOn(TRUE, TRUE);
	RadioMute(TRUE);
	RadioPowerDown();
#ifdef FUNC_POWER_AMPLIFIER_EN
	ABPowerAmplifierOn();	//在其它模式下选择AB 类功放
#endif	
}
Пример #4
0
int BufferView::Activate(int No) {
    EModel *B;

    CancelSearch();
    B = GetBufferById(No);
    if (B) {
        View->SwitchToModel(B);
        return 1;
    }
    return 0;
}
Пример #5
0
int RoutineView::ExecCommand(int Command, ExState& State) {
  switch (Command) {
  case ExRescan:
    CancelSearch();
    Buffer->ScanForRoutines();
    UpdateList();
    return ErOK;

  case ExActivateInOtherWindow:
    CancelSearch();

    if (Row < Buffer->rlst.Count) {
      View->Next->SwitchToModel(Buffer);
      Buffer->CenterPosR(0, Buffer->rlst.Lines[Row]);
      return ErOK;
    }
    return ErFAIL;

  case ExCloseActivate:
    CancelSearch();
    return ErFAIL;
  }
  return EList::ExecCommand(Command, State);
}
Пример #6
0
void RegexSearch::FindNextWorker(SearchParams* searchParams) {
  regex_iterator_t* pit =
      reinterpret_cast<regex_iterator_t*>(searchParams->SearchBuffer);
  // Placement new for the iterator on the 1st call
  if (searchParams->MatchStart == nullptr) {
    pit = new(pit) regex_iterator_t(
        searchParams->TextStart,
        searchParams->TextStart + searchParams->TextLength,
        *impl_->regex_);
  }
  // Iterate
  regex_iterator_t& it(*pit);
  if (it == impl_->it_end_) {
    // Implicit cleanup on completed search.
    CancelSearch(searchParams);
    return;
  }
  // Set result if match found
  searchParams->MatchStart = searchParams->TextStart + it->position();
  searchParams->MatchLength = (int)it->length(); // TODO(rpaquay): 2GB limit
  ++it;
}
Пример #7
0
//按键响应
VOID RadioEventProcess(VOID)
{
	MESSAGE Event = MessageGet(MSG_FIFO_KEY);
	
	switch(Event)
	{
		case MSG_POWER:
		case MSG_MODE_SW:
			//DBG(("Exit FM, Event:%bx\n", Event));
			CancelSearch();
			MessageSend(MSG_FIFO_DEV_CTRL, Event);
			break;
			
		case MSG_SCAN://启动自动全频段搜台
		case MSG_INTRO:
		case MSG_PLAY_1CP:
#if !defined(AU6210K_HXX_B002)			
		case MSG_PLAY_PAUSE:
#endif			
#ifdef FUNC_DEVICE_FORCEPAUSE_EN
			if(gDevicePlayForcePauseFlag == TRUE)
			{
				gDevicePlayForcePauseFlag = FALSE;
				UnMute();
				break;
			}
#endif
			DBG(("SCAN\n"));
#ifdef FUNC_BEEP_SOUND_EN	
			PushKeyBeep(1);
#endif
			if(gRadioCtrl.State == RADIO_IDLE)
			{
				gRadioCtrl.State = RADIO_READ;
				
				gRadioCtrl.SeekMode = SEEK_AUTOSCAN;
#ifdef FUNC_SLAVE_UART_EN
                            gRadioData.CurrFreq = gRadioCtrl.RadioLowerBound;
#else
				gRadioData.CurrFreq = RADIO_LOWER_BOUND;
#endif
				gRadioData.CurrStation = 0;	
				gRadioData.Area1StationSum = 0;
				gRadioData.StationSum = 0;					
				memset(&gRadioData.Stations, 0, sizeof(gRadioData.Stations));
				
				MuteOn(TRUE, TRUE);				
				RadioSetFreq();		
#ifdef FUNC_SLAVE_UART_EN
#ifdef	FUNC_RADIO_AUTOSEEK_EN
				MVFM_AutoSeekConfig(gRadioData.CurrFreq, gRadioCtrl.RadioUpperBound, gRadioCtrl.RadioSeekStep, 1, 1);
#else
				MVFM_AutoSeekConfig(gRadioData.CurrFreq, gRadioCtrl.RadioUpperBound, gRadioCtrl.RadioSeekStep, 0, 1);
#endif

#else
#ifdef	FUNC_RADIO_AUTOSEEK_EN
				MVFM_AutoSeekConfig(gRadioData.CurrFreq, RADIO_UPPER_BOUND, RADIO_SEEK_STEP, 1, 1);
#else
				MVFM_AutoSeekConfig(gRadioData.CurrFreq, RADIO_UPPER_BOUND, RADIO_SEEK_STEP, 0, 1);
#endif
#endif				
				RadioMute(TRUE);
				TimeOutSet(&gRadioCtrl.SeekPreviewTimer, RadioSeekTimeValue);
			}
			else
			{
				CancelSearch();
			}
			break;

		case MSG_SAVE_STATION:  //保存当前的频率到当前的频道
			if(gRadioCtrl.State == RADIO_IDLE)
			{		
				if(gRadioData.StationSum < MAX_RADIO_STATION_NUM)
				{		
					if((gRadioData.CurrFreq < RADIO_FREQ_BASE_875) && ((gRadioData.CurrStation + 1) <= gRadioData.Area1StationSum))
					{
						gRadioData.Stations[gRadioData.CurrStation] = (gRadioData.CurrFreq - RADIO_FREQ_BASE_760);
					}
					else if((gRadioData.CurrFreq > RADIO_FREQ_BASE_875) && ((gRadioData.CurrStation + 1) > gRadioData.Area1StationSum))
					{
						gRadioData.Stations[gRadioData.CurrStation] = (gRadioData.CurrFreq - RADIO_FREQ_BASE_875);
					}				
					RadioShowDebug(RadioShowSaveCurFreToCurChannle);
					RadioWriteData();
					RadioDisFlag = RadioDisCurFreBlink;
					RadioDisCount = 6;
					TimeOutSet(&gRadioCtrl.SeekPreviewTimer,RadioBlinkTime);
#ifdef FUNC_SLAVE_UART_EN
					SlaveRadioRetCurrentStatus();
#endif

				}
			}
			break;
		
		case MSG_NEXT://下一个台
		case MSG_PLAY_1:
#ifdef	FUNC_DEVICE_FORCEPAUSE_EN
			if(gDevicePlayForcePauseFlag == TRUE) 
			{
				break;
			}					
#endif

#ifdef AU6210K_BOOMBOX_DEMO
			if(gRadioCtrl.State == RADIO_PROG)
			{
				if(gRadioData.CurrStation < (MAX_RADIO_STATION_NUM / 2))
				{
					gRadioData.CurrStation++;
				}
				else
				{
					gRadioData.CurrStation = 0;
				}
				break;
			}
			
			if(gRadioCtrl.State == RADIO_IDLE)
			{
				if(RadioGetValidPresetNum(gRadioData.CurrStation, UP) == TRUE)
				{
					RadioDisFlag = RadioDisCurChChange;
					TimeOutSet(&gRadioCtrl.SeekPreviewTimer, RadioPreVimeTimerValue);
					RadioChannelChange();
					UnMute();
					gSys.MuteFg = FALSE;
				}
				break;
			}
#endif

			if((gRadioData.StationSum > 0) && (gRadioCtrl.State == RADIO_IDLE))
			{
#ifdef FUNC_BEEP_SOUND_EN	
				PushKeyBeep(1);
#endif
				if(gRadioData.CurrStation < (gRadioData.StationSum - 1))
				{
					gRadioData.CurrStation++;
				}
				else
				{
					gRadioData.CurrStation = 0;
				}
				RadioDisFlag = RadioDisCurChChange;				
				RadioChannelChange();
				UnMute();
				TimeOutSet(&gRadioCtrl.SeekPreviewTimer, RadioPreVimeTimerValue);
				gSys.MuteFg = FALSE;
#ifdef FUNC_SLAVE_UART_EN
				SlaveRadioRetCurrentStatus();
#endif
			}
			break;
			
		case MSG_PRE://上一个台
		case MSG_EQ_CH_SUB:
#ifdef	FUNC_DEVICE_FORCEPAUSE_EN
			if(gDevicePlayForcePauseFlag == TRUE) 
			{
				break;
			}					
#endif

#ifdef AU6210K_BOOMBOX_DEMO
			if(gRadioCtrl.State == RADIO_PROG)
			{
				if(gRadioData.CurrStation < (MAX_RADIO_STATION_NUM / 2))
				{
					gRadioData.CurrStation++;
				}
				else
				{
					gRadioData.CurrStation = 0;
				}
				break;
			}
			
			if(gRadioCtrl.State == RADIO_IDLE)
			{
				if(RadioGetValidPresetNum(gRadioData.CurrStation, DOWN) == TRUE)
				{
					RadioDisFlag = RadioDisCurChChange;
					TimeOutSet(&gRadioCtrl.SeekPreviewTimer, RadioPreVimeTimerValue);
					RadioChannelChange();
					UnMute();
					gSys.MuteFg = FALSE;
					break;
				}
			}
#endif

			if((gRadioData.StationSum >  0) && (gRadioCtrl.State == RADIO_IDLE)) 
			{
#ifdef FUNC_BEEP_SOUND_EN	
				PushKeyBeep(1);
#endif
				if(gRadioData.CurrStation > 0)
				{
					gRadioData.CurrStation--;
				}
				else
				{
					gRadioData.CurrStation = gRadioData.StationSum - 1;
				}
				RadioDisFlag = RadioDisCurChChange;				
				RadioChannelChange();
				UnMute();
				TimeOutSet(&gRadioCtrl.SeekPreviewTimer, RadioPreVimeTimerValue);
				gSys.MuteFg = FALSE;
#ifdef FUNC_SLAVE_UART_EN
				SlaveRadioRetCurrentStatus();
#endif
			}
			break;
			
#ifdef	FUNC_NUMBER_KEY_EN
		case MSG_RECV_NUM://选台(输入数值在有效台数内)或设置频率(输入数值在有效频率范围内)	
			if(gRadioCtrl.State == RADIO_IDLE)//SeanFu
			{
				if((gRecvNum > 0) && (gRecvNum <= gRadioData.StationSum))
				{
					//DBG(("RecvNum合法台号:%d\n", gRecvNum));				
					gRadioData.CurrStation = gRecvNum - 1;
					if(gRecvNum <= gRadioData.Area1StationSum)
					{
						gRadioData.CurrFreq = (gRadioData.Stations[gRadioData.CurrStation] + RADIO_FREQ_BASE_760);
					}
					else
					{
						gRadioData.CurrFreq = (gRadioData.Stations[gRadioData.CurrStation] + RADIO_FREQ_BASE_875);
					}	
					RadioWriteData();
					RadioShowDebug(RadioShowCurStationChange);
				}
#ifdef FUNC_SLAVE_UART_EN
                            else if((gRecvNum >= gRadioCtrl.RadioLowerBound) && (gRecvNum <= gRadioCtrl.RadioUpperBound))
#else
				else if((gRecvNum >= RADIO_LOWER_BOUND) && (gRecvNum <= RADIO_UPPER_BOUND))
#endif
				{
					//DBG(("RecvNum合法 频率:%d\n", gRecvNum));
					gRadioData.CurrFreq = gRecvNum;				
					RadioWriteData();
					RadioShowDebug(RadioShowSaveFre);
				}
				else 
				{
					//DBG(("RecvNum非法:%d\n", gRecvNum));	
					gRecvNum = 0;						
					NumKeyRadioFreqErrorFlag = TRUE;
					NumKeyErrorDispFlag = TRUE;					
#ifdef FUNC_DISP_EN						
					TimeOutSet(&DispTmr, NORMAL_INTERVAL);	//输入错误Err显示保留时间
#endif
					return;
				}			
				RadioSetFreq();
				RadioMute(FALSE);
				gRecvNum = 0;					
#ifdef FUNC_DISP_EN						
				TimeOutSet(&DispTmr, 0);	//退出数值显示
#endif
			}
			break;

		case MSG_NUM_SAVE_STAITON:	//将当前频率保存起来
			if(gRadioCtrl.State == RADIO_IDLE)
			{				
				//DBG(("RecvNum %d \n", gRecvNum));
				RadioArrayInsert();
				gRecvNum = 0;
				RadioWriteData();
				RadioShowDebug(RadioShowSaveFre);
				RadioDisFlag = RadioDisCurFreBlink;
				RadioDisCount = 4;
				TimeOutSet(&gRadioCtrl.SeekPreviewTimer, RadioBlinkTime);
			}
			break;
#endif
			
#ifdef	FUNC_RADIO_STEPOVER_EN		
		case MSG_NEXT1:
		case MSG_FREQ_UP:
		case MSG_FREQUP_10TRK://循环递增微调频率(+100KHZ)	
			if(gRadioCtrl.State == RADIO_IDLE)
			{
#ifdef FUNC_SLAVE_UART_EN
                            if(++gRadioData.CurrFreq > gRadioCtrl.RadioUpperBound)
				{
					gRadioData.CurrFreq = gRadioCtrl.RadioLowerBound;
				}
#else
				if(++gRadioData.CurrFreq > RADIO_UPPER_BOUND)
				{
					gRadioData.CurrFreq = RADIO_LOWER_BOUND;
				}
#endif
				RadioSetFreq();
				RadioMute(FALSE);		
				RadioWriteData();
				RadioShowDebug(RadioShowFreChange);
			}
			break;
		
		case MSG_PREV1:
		case MSG_FREQ_DN:
		case MSG_FREQDN_10TRK://循环递减微调频率(-100KHZ)		
			if(gRadioCtrl.State == RADIO_IDLE)
			{
#ifdef FUNC_SLAVE_UART_EN
                            if(--gRadioData.CurrFreq < gRadioCtrl.RadioLowerBound)
				{
					gRadioData.CurrFreq = gRadioCtrl.RadioUpperBound;
				}	
#else
				if(--gRadioData.CurrFreq < RADIO_LOWER_BOUND)
				{
					gRadioData.CurrFreq = RADIO_UPPER_BOUND;
				}	
#endif
				RadioSetFreq();
				RadioMute(FALSE);		
				RadioWriteData();
				RadioShowDebug(RadioShowFreChange);
			}
			break;
#endif
		
#ifdef	FUNC_RADIO_SEMO_AUTOSEEK_EN		
		case MSG_FF_START:
		case MSG_10TRACK_ADD://递增方式搜台,搜到第一个后停止
			if(gRadioCtrl.State == RADIO_IDLE)
			{
				gRadioCtrl.SeekMode = SEEK_SCANUP;
#ifdef FUNC_SLAVE_UART_EN
                            if(gRadioData.CurrFreq >= gRadioCtrl.RadioUpperBound)
				{	
					gRadioData.CurrFreq = gRadioCtrl.RadioLowerBound;
				}
				else
				{
					gRadioData.CurrFreq++;
				}
#else
				if(gRadioData.CurrFreq >= RADIO_UPPER_BOUND)
				{	
					gRadioData.CurrFreq = RADIO_LOWER_BOUND;
				}
				else
				{
					gRadioData.CurrFreq++;
				}
#endif				
				MuteOn(TRUE, TRUE);	
				RadioSetFreq();						
				gRadioCtrl.State = RADIO_READ;
#ifdef FUNC_SLAVE_UART_EN
#ifdef	FUNC_RADIO_AUTOSEEK_EN
				MVFM_AutoSeekConfig(gRadioData.CurrFreq, gRadioCtrl.RadioUpperBound, gRadioCtrl.RadioSeekStep, 1, 1);
#else
				MVFM_AutoSeekConfig(gRadioData.CurrFreq, gRadioCtrl.RadioUpperBound, gRadioCtrl.RadioSeekStep, 0, 1);
#endif
#else
#ifdef	FUNC_RADIO_AUTOSEEK_EN
				MVFM_AutoSeekConfig(gRadioData.CurrFreq, RADIO_UPPER_BOUND, RADIO_SEEK_STEP, 1, 1);
#else
				MVFM_AutoSeekConfig(gRadioData.CurrFreq, RADIO_UPPER_BOUND, RADIO_SEEK_STEP, 0, 1);
#endif
#endif
				RadioMute(TRUE);
				TimeOutSet(&gRadioCtrl.SeekPreviewTimer, RadioSeekTimeValue);
					
			}
			break;
		
		case MSG_FB_START:
		case MSG_10TRACK_SUB://递减方式搜台,搜到第一个后停止
			if(gRadioCtrl.State == RADIO_IDLE)
			{
				gRadioCtrl.SeekMode = SEEK_SCANDOWN;
#ifdef FUNC_SLAVE_UART_EN
                            if(gRadioData.CurrFreq <= gRadioCtrl.RadioLowerBound)
				{
					gRadioData.CurrFreq = gRadioCtrl.RadioUpperBound;
				}
				else
				{
					gRadioData.CurrFreq--;
				}
#else				
				if(gRadioData.CurrFreq <= RADIO_LOWER_BOUND)
				{
					gRadioData.CurrFreq = RADIO_UPPER_BOUND;
				}
				else
				{
					gRadioData.CurrFreq--;
				}
#endif				
				MuteOn(TRUE, TRUE);	
				RadioSetFreq();						
				gRadioCtrl.State = RADIO_READ;
#ifdef FUNC_SLAVE_UART_EN
#ifdef	FUNC_RADIO_AUTOSEEK_EN
				MVFM_AutoSeekConfig(gRadioData.CurrFreq, gRadioCtrl.RadioLowerBound, gRadioCtrl.RadioSeekStep, 1, 1);
#else
				MVFM_AutoSeekConfig(gRadioData.CurrFreq, gRadioCtrl.RadioLowerBound, gRadioCtrl.RadioSeekStep, 0, 1);
#endif
#else
#ifdef	FUNC_RADIO_AUTOSEEK_EN
				MVFM_AutoSeekConfig(gRadioData.CurrFreq, RADIO_LOWER_BOUND, RADIO_SEEK_STEP, 1, 1);
#else
				MVFM_AutoSeekConfig(gRadioData.CurrFreq, RADIO_LOWER_BOUND, RADIO_SEEK_STEP, 0, 1);
#endif
#endif
				RadioMute(TRUE);
				TimeOutSet(&gRadioCtrl.SeekPreviewTimer, RadioSeekTimeValue);
					
			}
			break;
#endif

		case MSG_VOL_ADD://音量加					
#if defined(AU6210K_NR_D_9X)||defined(AU6210K_NR_D_9X_XJ_HTS)
			if (gSys.Volume >= VOLUME_MAX)
			{
				SPI_PlaySelectNum(SPIPLAY_SONG_MAX_VOLUME, 0);
				InDacChannelSel(DAC_CH_ONCHIP_FM);
				RadioSetFreq();
				UnMute();
				SysClkDivSet(CLK_DIV_RATE);
			}
#endif

#ifdef FUNC_POWER_AMPLIFIER_EN
			ABPowerAmplifierOff();			
#endif

#ifdef FUNC_OTP_KEY_SOUND_EN
			OTP_PlaySelNum(OTPPLAY_NUM_VOLUP, 0);
			InDacChannelSel(DAC_CH_ONCHIP_FM);
			RadioSetFreq();
			UnMute();
			SysClkDivSet(CLK_DIV_RATE);
#endif
#ifdef FUNC_PT231X_EN
            VolType = VOL_MAIN;
            PT2313VolAdd();
#else
			VolumeAdjust(UP);
#endif
			break;
		
		case MSG_VOL_SUB://音量减			
#if defined(AU6210K_NR_D_9X)||defined(AU6210K_NR_D_9X_XJ_HTS)
			if (gSys.Volume <= VOLUME_MIN)
			{
				SPI_PlaySelectNum(SPIPLAY_SONG_MIN_VOLUME, 0);
				InDacChannelSel(DAC_CH_ONCHIP_FM);
				RadioSetFreq();
				SysClkDivSet(CLK_DIV_RATE);
			}
#endif

#ifdef FUNC_POWER_AMPLIFIER_EN
			ABPowerAmplifierOff();			
#endif

#ifdef FUNC_OTP_KEY_SOUND_EN
			OTP_PlaySelNum(OTPPLAY_NUM_VOLDN, 0);
			InDacChannelSel(DAC_CH_ONCHIP_FM);
			RadioSetFreq();
			UnMute();
			SysClkDivSet(CLK_DIV_RATE);
#endif
#ifdef FUNC_PT231X_EN
                    VolType = VOL_MAIN;
                    PT2313VolSub();
#else
			VolumeAdjust(DOWN);
#endif
			break;
#ifdef FUNC_PT231X_EN
              case MSG_TREBUP:
			VolType = VOL_TREB;
                     PT2313VolAdd();  	
			break;  	
		case MSG_TREBDN:
			VolType = VOL_TREB;
                     PT2313VolSub();  	
			break;  	
		case MSG_BASSUP:
			VolType = VOL_BASS;
                     PT2313VolAdd();  	
			break;  	
		case MSG_BASSDN:
			VolType = VOL_BASS;
                     PT2313VolSub();  	
			break;  	
		case MSG_DEFAULT:
			PT2313TrebBassSetDefault();
			break;  	
#endif
#if defined(AU6210K_HXX_B002)
		case MSG_PLAY_PAUSE:
#endif
		case MSG_MUTE:
			if(gRadioCtrl.State == RADIO_IDLE)
			{			
#if 0//def FUNC_SPI_KEY_SOUND_EN
				if(gSys.MuteFg)
				{
					SPI_PlaySelectNum(SPIPLAY_SONG_UNMUTE, 0);
				}
				else
				{	
					SPI_PlaySelectNum(SPIPLAY_SONG_MUTE, 0);
				}				
				InDacChannelSel(DAC_CH_ONCHIP_FM);
				if(gSys.MuteFg)
				{
					RadioSetFreq();
					gSys.MuteFg = TRUE;
				}
				SysClkDivSet(CLK_DIV_RATE);
#endif
				MuteStatusChange();			
			}
			break;	
		
#if (defined(AU6210K_BOOMBOX_DEMO))
		case MSG_CLOCK:			
			if(gRadioCtrl.State == RADIO_IDLE)
			{
				gRadioCtrl.State = RADIO_PROG;
				RadioDisFlag = RadioDisCurProgramNum;
				TimeOutSet(&gRadioCtrl.SeekPreviewTimer, RadioProgramWaitTime);
				break;
			}	

			if(gRadioCtrl.State == RADIO_PROG)
			{		
				if(gRadioData.CurrFreq < RADIO_FREQ_BASE_875) 
				{
					gRadioData.Stations[gRadioData.CurrStation] = (gRadioData.CurrFreq - RADIO_FREQ_BASE_760);
				}
				else if(gRadioData.CurrFreq > RADIO_FREQ_BASE_875)
				{
					gRadioData.Stations[gRadioData.CurrStation] = (gRadioData.CurrFreq - RADIO_FREQ_BASE_875);
				}				
				gRadioData.Stations[gRadioData.CurrStation + (MAX_RADIO_STATION_NUM / 2)] = gRadioData.CurrStation + 1;
				gRadioData.StationSum = (MAX_RADIO_STATION_NUM / 2);		
					
				RadioShowDebug(RadioShowSaveCurFreToCurChannle);
#ifdef FUNC_BREAK_POINT_EN
				RadioWriteData();
#endif
				RadioDisFlag = RadioDisCurFreNum;
				gRadioCtrl.State = RADIO_IDLE;
			}
			break;

		case MSG_FM_STERO_SW:
			if(gRadioCtrl.State == RADIO_IDLE)
			{
				gRadioMonoEnableFlag ^= 1;
				RadioMonoModeSet(gRadioMonoEnableFlag);			
			}
			break;
#endif

		default:	
			break;
	}//switch(Event)

#ifdef FUN_SYSTEM_POWEROFF_WAIT_TIME
	SystemOffTimeMsgPro(Event);
#endif
}
// ==========================================================================
// FUNCTION: ClearSearchResultCache
// ==========================================================================
EXPORT_C void CMsgStoreMailBox::ClearSearchResultCache()
    {
    CancelSearch();
    iOldSearchHandlers.ResetAndDestroy();
    iContext.iSession.ClearSearchResultCache();
    }
Пример #9
0
int BufferView::ExecCommand(int Command, ExState &State) {

    switch (Command) {
    case ExCloseActivate: {
        EModel *B;

        CancelSearch();
        B = GetBufferById(Row);
        if (B && B != this) {
            View->SwitchToModel(B);
            delete this;
            return ErOK;
        }
    }
    return ErFAIL;
    case ExBufListFileClose: {
        EModel *B = GetBufferById(Row);

        CancelSearch();
        if (B && B != this && Count > 1) {
            if (B->ConfQuit(View->MView->Win)) {
                View->DeleteModel(B);
            }
            UpdateList();
            return ErOK;
        }
    }
    return ErFAIL;
    case ExBufListFileSave: {
        EModel *B = GetBufferById(Row);

        if (B && B->GetContext() == CONTEXT_FILE)
            if (((EBuffer *)B)->Save())
                return ErOK;
    }
    return ErFAIL;

    case ExActivateInOtherWindow: {
        EModel *B = GetBufferById(Row);

        CancelSearch();
        if (B) {
            View->Next->SwitchToModel(B);
            return ErOK;
        }
    }
    return ErFAIL;
    case ExBufListSearchCancel:
        CancelSearch();
        return ErOK;
    case ExBufListSearchNext:
        // Find next matching line
        if (SearchLen) {
            int i = Row + 1;
            i = GetMatchingLine(i == BCount ? 0 : i, 1);
            // Never returns -1 since something already found before call
            Row = SearchPos[SearchLen] = i;
        }
        return ErOK;
    case ExBufListSearchPrev:
        // Find prev matching line
        if (SearchLen) {
            int i = Row - 1;
            i = GetMatchingLine(i == -1 ? BCount - 1 : i, -1);
            // Never returns -1 since something already found before call
            Row = SearchPos[SearchLen] = i;
        }
        return ErOK;
    }

    return EList::ExecCommand(Command, State);
}