示例#1
0
void CMainDlg::OnTabPageRadioSwitch(int nID)
{
    if(m_bLayoutInited)
    {
        STabCtrl *pTab = FindChildByName2<STabCtrl>(L"tab_main");
        if(pTab)
        {
            pTab->SetCurSel(nID - 10000);
        }
    }
}
示例#2
0
void CMainDlg::OnSharePanelRadioSwitch(int nID)
{
    if(m_bLayoutInited)
    {
        STabCtrl *pTab = FindChildByName2<STabCtrl>(L"tab_share_panel");
        if(pTab)
        {
            pTab->SetCurSel(nID - 30000);
        }
    }
}
示例#3
0
//演示如何响应菜单事件
void CMainDlg::OnCommand( UINT uNotifyCode, int nID, HWND wndCtl )
{
    if(uNotifyCode==0)
    {
        if(nID==6)
        {   //nID==6对应menu_test定义的菜单的exit项。
            PostMessage(WM_CLOSE);
        } else if(nID==54)
        {   //about SOUI
            STabCtrl *pTabCtrl = FindChildByName2<STabCtrl>(L"tab_main");
            if(pTabCtrl) pTabCtrl->SetCurSel(_T("about"));
        }
    }
}
示例#4
0
void CMainDlg::OnTabMainStyleClick()
{
    if(m_bLayoutInited)
    {
        SImageButton *pBtn = FindChildByName2<SImageButton>(L"btn_navi_tile");
        STabCtrl *pTab = FindChildByName2<STabCtrl>(L"tab_file");
        m_MainStyle = (m_MainStyle + 1) % 2;
        if(pTab)
        {
            pTab->SetCurSel(m_MainStyle);
        }
        if(0 == m_MainStyle)
        {
            pBtn->SetAttribute(L"skin", L"skin_navi_list");
        }
        else
        {
            pBtn->SetAttribute(L"skin", L"skin_navi_tile");
        }
    }
}
示例#5
0
void CCodeLineCounterHandler::OnBtnGo()
{
    if(m_strDir.IsEmpty())
    {
        SMessageBox(m_pPageRoot->GetContainer()->GetHostHwnd(),_T("没有指定扫描目录"),_T("错误"),MB_OK|MB_ICONSTOP);
        return;
    }
    SStringT strTypes = m_pPageRoot->FindChildByName(L"edit_filetypes")->GetWindowText();
    SStringWList lstTypes;
    SplitString(S_CT2W(strTypes),L';',lstTypes);
    CODECFGMAP cfg;
    for(UINT i=0;i<lstTypes.GetCount();i++)
    {
        CODECFGMAP::CPair *pPair = m_mapCodeCfg.Lookup(lstTypes[i]);
        if(!pPair) continue;
        cfg[lstTypes[i]] = pPair->m_value;
    }
    if(cfg.IsEmpty())
    {
        SMessageBox(m_pPageRoot->GetContainer()->GetHostHwnd(),_T("没有指定文件类型或者类型无效"),_T("错误"),MB_OK|MB_ICONSTOP);
        return;
    }

    //获得文件列表,计每个目标文件的文件大小
    HSTREEITEM hRoot = m_pDirTree->GetRootItem();
    SList<FILEINFO> lstFileInfo;
    int nDirs = 1;
    DWORD szAll = EnumFileInfo(cfg,m_strDir,hRoot,lstFileInfo,nDirs);
    if(lstFileInfo.GetCount() == 0)
    {
        SMessageBox(m_pPageRoot->GetContainer()->GetHostHwnd(),_T("指定的目录下没有找到满足条件的文件类型"),_T("提示"),MB_OK|MB_ICONINFORMATION);
        return;
    }

    //SWindow *pPageResult = m_pPageRoot->FindChildByName(L"page_dir");   
    SSplitWnd_Row *pSplitTree = m_pPageRoot->FindChildByName2<SSplitWnd_Row>(L"split_tree");
    pSplitTree->ShowPane(1);

    SProgress *pProgBar = pSplitTree->FindChildByName2<SProgress>(L"prog_run");
    pProgBar->SetRange(0,szAll);
    pProgBar->SetValue(0);

    CLineInfo lineInfoAll;

    SMap<SStringW,CLineInfo> mapLineInfo;
    for(UINT i=0;i<lstTypes.GetCount();i++)
    {
        mapLineInfo[lstTypes[i]] = CLineInfo();
    }

    //统计代码行
    DWORD dwProg = 0;
    SPOSITION pos = lstFileInfo.GetHeadPosition();
    while(pos)
    {
        FILEINFO fi = lstFileInfo.GetNext(pos);

        CLineInfo lineInfo;
        CountCodeLines(S_CW2T(fi.strFileName),fi.cfg,lineInfo.nCodeLines,lineInfo.nRemarkLines,lineInfo.nBlankLines);
        lineInfoAll += lineInfo;
        mapLineInfo[fi.cfg.strExt] += lineInfo;

        dwProg += fi.dwSize;
        pProgBar->SetValue(dwProg);
        pProgBar->UpdateWindow();
    }

    pSplitTree->HidePane(1);
    STabCtrl *pTab = m_pPageRoot->FindChildByName2<STabCtrl>(L"tab_codeline");
    pTab->SetCurSel(1);
    SWindow *pWndRes = pTab->GetPage(_T("page_result"),FALSE);
    pWndRes->FindChildByName(L"txt_folders")->SetWindowText(SStringT().Format(_T("%d"),nDirs));
    pWndRes->FindChildByName(L"txt_files")->SetWindowText(SStringT().Format(_T("%d"),lstFileInfo.GetCount()));
    pWndRes->FindChildByName(L"txt_codelines")->SetWindowText(SStringT().Format(_T("%d"),lineInfoAll.nCodeLines));
    pWndRes->FindChildByName(L"txt_blanklines")->SetWindowText(SStringT().Format(_T("%d"),lineInfoAll.nBlankLines));
    pWndRes->FindChildByName(L"txt_remarklines")->SetWindowText(SStringT().Format(_T("%d"),lineInfoAll.nRemarkLines));

    SListCtrl *plstReport = pWndRes->FindChildByName2<SListCtrl>(L"lst_linecounter_report");
    plstReport->DeleteAllItems();
    for(UINT i=0;i<lstTypes.GetCount();i++)
    {
        CCodeConfig codeCfg = cfg[lstTypes[i]];
        CLineInfo lineInfo = mapLineInfo[lstTypes[i]];

        plstReport->InsertItem(i,S_CW2T(codeCfg.strType));
        plstReport->SetSubItemText(i,1,S_CW2T(codeCfg.strExt));
        plstReport->SetSubItemText(i,2,SStringT().Format(_T("%d"),lineInfo.nCodeLines));
        plstReport->SetSubItemText(i,3,SStringT().Format(_T("%d"),lineInfo.nBlankLines));
        plstReport->SetSubItemText(i,4,SStringT().Format(_T("%d"),lineInfo.nRemarkLines));
    }
}