本文整理汇总了C++中ObjArray::Sort方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjArray::Sort方法的具体用法?C++ ObjArray::Sort怎么用?C++ ObjArray::Sort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjArray
的用法示例。
在下文中一共展示了ObjArray::Sort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrintPiecesThread
static void PrintPiecesThread(void* pv)
{
CFrameWndEx* pFrame = (CFrameWndEx*)pv;
CView* pView = pFrame->GetActiveView();
CPrintDialog PD(FALSE, PD_ALLPAGES|PD_USEDEVMODECOPIES|PD_NOPAGENUMS|PD_NOSELECTION, pFrame);
if (theApp.DoPrintDialog(&PD) != IDOK)
return;
if (PD.m_pd.hDC == NULL)
return;
Project* project = lcGetActiveProject();
ObjArray<lcPiecesUsedEntry> PiecesUsed;
project->GetPiecesUsed(PiecesUsed);
PiecesUsed.Sort(PiecesUsedSortFunc, NULL);
// gather file to print to if print-to-file selected
CString strOutput;
if (PD.m_pd.Flags & PD_PRINTTOFILE)
{
CString strDef(MAKEINTRESOURCE(AFX_IDS_PRINTDEFAULTEXT));
CString strPrintDef(MAKEINTRESOURCE(AFX_IDS_PRINTDEFAULT));
CString strFilter(MAKEINTRESOURCE(AFX_IDS_PRINTFILTER));
CString strCaption(MAKEINTRESOURCE(AFX_IDS_PRINTCAPTION));
CFileDialog dlg(FALSE, strDef, strPrintDef,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, strFilter);
dlg.m_ofn.lpstrTitle = strCaption;
if (dlg.DoModal() != IDOK)
return;
strOutput = dlg.GetPathName();
}
CString DocName;
char* Ext = strrchr(project->m_strTitle, '.');
DocName.Format("LeoCAD - %.*s BOM", Ext ? Ext - project->m_strTitle : strlen(project->m_strTitle), project->m_strTitle);
DOCINFO docInfo;
memset(&docInfo, 0, sizeof(DOCINFO));
docInfo.cbSize = sizeof(DOCINFO);
docInfo.lpszDocName = DocName;
CString strPortName;
int nFormatID;
if (strOutput.IsEmpty())
{
docInfo.lpszOutput = NULL;
strPortName = PD.GetPortName();
nFormatID = AFX_IDS_PRINTONPORT;
}
else
{
docInfo.lpszOutput = strOutput;
AfxGetFileTitle(strOutput, strPortName.GetBuffer(_MAX_PATH), _MAX_PATH);
nFormatID = AFX_IDS_PRINTTOFILE;
}
SetAbortProc(PD.m_pd.hDC, _AfxAbortProc);
pFrame->EnableWindow(FALSE);
CPrintingDialog dlgPrintStatus(NULL);
CString strTemp;
dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_DOCNAME, DocName);
dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_PRINTERNAME, PD.GetDeviceName());
AfxFormatString1(strTemp, nFormatID, strPortName);
dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_PORTNAME, strTemp);
dlgPrintStatus.ShowWindow(SW_SHOW);
dlgPrintStatus.UpdateWindow();
if (StartDoc(PD.m_pd.hDC, &docInfo) == SP_ERROR)
{
pFrame->EnableWindow(TRUE);
dlgPrintStatus.DestroyWindow();
AfxMessageBox(AFX_IDP_FAILED_TO_START_PRINT);
return;
}
int ResX = GetDeviceCaps(PD.m_pd.hDC, LOGPIXELSX);
int ResY = GetDeviceCaps(PD.m_pd.hDC, LOGPIXELSY);
CRect RectDraw(0, 0, GetDeviceCaps(PD.m_pd.hDC, HORZRES), GetDeviceCaps(PD.m_pd.hDC, VERTRES));
DPtoLP(PD.m_pd.hDC, (LPPOINT)(RECT*)&RectDraw, 2);
RectDraw.DeflateRect((int)(ResX*(float)theApp.GetProfileInt("Default","Margin Left", 50)/100.0f),
(int)(ResY*(float)theApp.GetProfileInt("Default","Margin Top", 50)/100.0f),
(int)(ResX*(float)theApp.GetProfileInt("Default","Margin Right", 50)/100.0f),
(int)(ResY*(float)theApp.GetProfileInt("Default","Margin Bottom", 50)/100.0f));
CRect HeaderRect = RectDraw;
HeaderRect.top -= (int)(ResY*theApp.GetProfileInt("Default", "Margin Top", 50) / 200.0f);
HeaderRect.bottom += (int)(ResY*theApp.GetProfileInt("Default", "Margin Bottom", 50) / 200.0f);
int RowsPerPage = AfxGetApp()->GetProfileInt("Default", "Catalog Rows", 10);
int ColsPerPage = AfxGetApp()->GetProfileInt("Default", "Catalog Columns", 3);
int PicHeight = RectDraw.Height() / RowsPerPage;
int PicWidth = RectDraw.Width() / ColsPerPage;
int TotalRows = (PiecesUsed.GetSize() + ColsPerPage - 1) / ColsPerPage;
int TotalPages = (TotalRows + RowsPerPage - 1) / RowsPerPage;
int RowHeight = RectDraw.Height() / RowsPerPage;
int ColWidth = RectDraw.Width() / ColsPerPage;
PD.m_pd.nMinPage = 1;
//.........这里部分代码省略.........