示例#1
0
void RimeWithWeaselHandler::FocusIn(DWORD client_caps, UINT session_id)
{
	DLOG(INFO) << "Focus in: session_id = " << session_id << ", client_caps = " << client_caps;
	if (m_disabled) return;
	_UpdateUI(session_id);
	m_active_session = session_id;
}
示例#2
0
void RimeWithWeaselHandler::EndMaintenance()
{
	if (m_disabled)
	{
		Initialize();
		_UpdateUI(0);
	}
}
示例#3
0
void RimeWithWeaselHandler::ClearComposition(UINT session_id)
{
	DLOG(INFO) << "Clear composition: session_id = " << session_id;
	if (m_disabled) return;
	RimeClearComposition(session_id);
	_UpdateUI(session_id);
	m_active_session = session_id;
}
示例#4
0
BOOL RimeWithWeaselHandler::ProcessKeyEvent(weasel::KeyEvent keyEvent, UINT session_id, LPWSTR buffer)
{
	DLOG(INFO) << "Process key event: keycode = " << keyEvent.keycode << ", mask = " << keyEvent.mask
		 << ", session_id = " << session_id;
	if (m_disabled) return FALSE;
	Bool handled = RimeProcessKey(session_id, keyEvent.keycode, expand_ibus_modifier(keyEvent.mask));
	_Respond(session_id, buffer);
	_UpdateUI(session_id);
	m_active_session = session_id;
	return (BOOL)handled;
}
示例#5
0
void RimeWithWeaselHandler::UpdateInputPosition(RECT const& rc, UINT session_id)
{
	DLOG(INFO) << "Update input position: (" << rc.left << ", " << rc.top
		<< "), session_id = " << session_id << ", m_active_session = " << m_active_session;
	if (m_ui) m_ui->UpdateInputPosition(rc);
	if (m_disabled) return;
	if (m_active_session != session_id)
	{
		_UpdateUI(session_id);
		m_active_session = session_id;
	}
}
示例#6
0
UINT RimeWithWeaselHandler::AddSession(LPWSTR buffer)
{
	if (m_disabled)
	{
		DLOG(INFO) << "Trying to resume service.";
		EndMaintenance();
		if (m_disabled) return 0;
	}
	UINT session_id = RimeCreateSession();
	DLOG(INFO) << "Add session: created session_id = " << session_id;
	_ReadClientInfo(session_id, buffer);
	// show session's welcome message :-) if any
	_UpdateUI(session_id);
	m_active_session = session_id;
	return session_id;
}
示例#7
0
//////////////////////////////////////////////////////////////////////////
// 子项目扫描完毕
LRESULT CUIHandlerSystemSlim::OnItemScanComplete(
    UINT uMsg, 
    WPARAM wParam, 
    LPARAM lParam, 
    BOOL& bHandled
    )
{
    CString strMsg;
    int nItemCount = m_slimData.GetCount();


    // todo: 更新List, Disable  always
    _UpdateListStatus(m_nScanIndex);

    // 上报数据
    if (m_nScanIndex >= 0 && m_nScanIndex < nItemCount)
    {
        SlimItem item(m_slimData.GetItem(m_nScanIndex));

        m_feedback.AddData(item.Id(), item.SizeOnDisk());
    }

    // 更新当前项目的状态,进行下一个项目的扫描
    if (++m_nScanIndex != nItemCount)
    {
        m_strScanName = m_slimData.GetName(m_nScanIndex);
        m_nMaxScanPos = int(((double)100 / nItemCount) * (m_nScanIndex + 1)) - 1;
        m_nScanPos = int(((double)100 / nItemCount) * m_nScanIndex);
        m_slimData.Scan(m_nScanIndex, m_dlg->m_hWnd);
    }
    else
    {
         // 全部扫描完成
        _UpdateUI(0);
        // todo: 更新List, Disable = > Enable
        m_dataListCtrl.SetEnable(TRUE);
        m_dataListCtrl.Invalidate();
        m_feedback.Report(_Module.GetAppVersion());
    }

    return 0L;
}
示例#8
0
LRESULT CUIHandlerSystemSlim::OnTreatItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
    int nItem = (int)wParam;

    if (nItem < 0 || nItem >= m_slimData.GetCount())
        return 0L;

    SlimItem& item = m_slimData.GetItem(nItem);
    SlimMethod nMethod = item.Method();
    m_dataListCtrl.EnableWindow(FALSE);
    if (SLIM_DELETE_FILE == nMethod)
    {
        // 删除文件
        SlimWarningDlg dlgWarning(item.Warning());
        if (dlgWarning.DoModal() == IDOK)
        {
            BOOL bUndoEnable = dlgWarning.UndoEnable();
            // report data
            item.SetUndoEnable(bUndoEnable);
            SlimDlg dlgDel(item, FALSE);
            dlgDel.DoModal();
        }
        else
        {
        }
    }
    else if (SLIM_COMPRESS_FILE == nMethod)
    {
        // 压缩文件
        SlimDlg dlgCompress(item, TRUE);
        dlgCompress.DoModal();
    }
    m_dataListCtrl.EnableWindow(TRUE);
    
    _UpdateUI(0);
    _UpdateListStatus(nItem);

    return 0L;
}
示例#9
0
void RimeWithWeaselHandler::StartMaintenance()
{
	Finalize();
	_UpdateUI(0);
}