本文整理汇总了C++中PView类的典型用法代码示例。如果您正苦于以下问题:C++ PView类的具体用法?C++ PView怎么用?C++ PView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeAndSendVertexArrays
// This version sends VArrays using MPI
static void computeAndSendVertexArrays()
{
// compute...
for(unsigned int i = 0; i < PView::list.size(); i++)
PView::list[i]->fillVertexArrays();
// ...and send
int nbArrays = PView::list.size()* 4;
MPI_Send(&nbArrays, 1, MPI_INT, 0, MPI_GMSH_DATA_READY, MPI_COMM_WORLD);
for(unsigned int i = 0; i < PView::list.size(); i++){
PView *p = PView::list[i];
PViewData *data = p->getData();
PViewOptions *opt = p->getOptions();
double min = data->getMin(), max = data->getMax();
if(opt->rangeType == PViewOptions::PerTimeStep){
min = data->getMin(opt->timeStep);
max = data->getMax(opt->timeStep);
}
VertexArray *va[4] =
{p->va_points, p->va_lines, p->va_triangles, p->va_vectors};
for(int type = 0; type < 4; type++){
if(va[type]){
int len;
char *str = va[type]->toChar
(p->getTag(), data->getName(), type + 1, min, max,
data->getNumTimeSteps(), data->getTime(opt->timeStep),
data->getBoundingBox(), len);
MPI_Send(&len, 1, MPI_INT, 0, MPI_GMSH_VARRAY_LEN, MPI_COMM_WORLD);
MPI_Send(str, len, MPI_CHAR, 0, MPI_GMSH_VARRAY, MPI_COMM_WORLD);
delete [] str;
}
}
}
}
示例2: PTextViewHighlight
int32_t
PTextViewHighlight(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BTextView *backend = (BTextView*)parent->GetView();
PArgs *inArgs = static_cast<PArgs*>(in);
int32 start;
if (inArgs->FindInt32("start", &start) != B_OK)
return B_ERROR;
int32 end;
if (inArgs->FindInt32("end", &end) != B_OK)
return B_ERROR;
if (backend->Window())
backend->Window()->Lock();
backend->Highlight(start, end);
if (backend->Window())
backend->Window()->Unlock();
return B_OK;
}
示例3: PListViewScrollTo
int32_t
PListViewScrollTo(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BListView *backend = (BListView*)parent->GetView();
PArgs *inArgs = static_cast<PArgs*>(in);
float x;
if (inArgs->FindFloat("x", &x) != B_OK)
return B_ERROR;
float y;
if (inArgs->FindFloat("y", &y) != B_OK)
return B_ERROR;
if (backend->Window())
backend->Window()->Lock();
backend->ScrollTo(x, y);
if (backend->Window())
backend->Window()->Unlock();
return B_OK;
}
示例4: PTextViewLineAtOffset
int32_t
PTextViewLineAtOffset(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BTextView *backend = (BTextView*)parent->GetView();
PArgs *inArgs = static_cast<PArgs*>(in);
PArgs *outArgs = static_cast<PArgs*>(out);
int32 offset;
if (inArgs->FindInt32("offset", &offset) != B_OK)
return B_ERROR;
if (backend->Window())
backend->Window()->Lock();
int32 outValue1;
outValue1 = backend->LineAt(offset);
if (backend->Window())
backend->Window()->Unlock();
outArgs->MakeEmpty();
return B_OK;
}
示例5: PTextViewInsert
int32_t
PTextViewInsert(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BTextView *backend = (BTextView*)parent->GetView();
PArgs *inArgs = static_cast<PArgs*>(in);
BString text;
if (inArgs->FindString("text", &text) != B_OK)
return B_ERROR;
int32 length;
if (inArgs->FindInt32("length", &length) != B_OK)
return B_ERROR;
if (backend->Window())
backend->Window()->Lock();
backend->Insert(text.String(), length);
if (backend->Window())
backend->Window()->Unlock();
return B_OK;
}
示例6: PListViewItemFrame
int32_t
PListViewItemFrame(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BListView *backend = (BListView*)parent->GetView();
PArgs *inArgs = static_cast<PArgs*>(in);
PArgs *outArgs = static_cast<PArgs*>(out);
int32 index;
if (inArgs->FindInt32("index", &index) != B_OK)
return B_ERROR;
if (backend->Window())
backend->Window()->Lock();
BRect outValue1;
outValue1 = backend->ItemFrame(index);
if (backend->Window())
backend->Window()->Unlock();
outArgs->MakeEmpty();
return B_OK;
}
示例7: PListViewDeselectExcept
int32_t
PListViewDeselectExcept(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BListView *backend = (BListView*)parent->GetView();
PArgs *inArgs = static_cast<PArgs*>(in);
int32 from;
if (inArgs->FindInt32("from", &from) != B_OK)
return B_ERROR;
int32 to;
if (inArgs->FindInt32("to", &to) != B_OK)
return B_ERROR;
if (backend->Window())
backend->Window()->Lock();
backend->DeselectExcept(from, to);
if (backend->Window())
backend->Window()->Unlock();
return B_OK;
}
示例8: PTextViewCut
int32_t
PTextViewCut(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BTextView *backend = (BTextView*)parent->GetView();
PArgs *inArgs = static_cast<PArgs*>(in);
uint64 id = 0;
if (inArgs->FindInt64("clipid", (int64*)&id) != B_OK)
return B_ERROR;
PObject *obj = BROKER->FindObject(id);
if (!obj || obj->GetType().ICompare("PClipboard") != 0)
return B_BAD_DATA;
PClipboard *clip = dynamic_cast<PClipboard*>(obj);
if (backend->Window())
backend->Window()->Lock();
backend->Cut(clip->GetBackend());
if (backend->Window())
backend->Window()->Unlock();
return B_OK;
}
示例9: PListViewRemoveItem
int32_t
PListViewRemoveItem(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BListView *backend = (BListView*)parent->GetView();
PArgs *args = static_cast<PArgs*>(in), *outArgs = static_cast<PArgs*>(out);
int32 index;
if (args->FindInt32("index", &index) != B_OK)
return B_ERROR;
if (backend->Window())
backend->Window()->Lock();
bool outValue = backend->RemoveItems(index, 1);
if (backend->Window())
backend->Window()->Unlock();
outArgs->MakeEmpty();
outArgs->AddBool("value", outValue);
return B_OK;
}
示例10: PListViewSelect
int32_t
PListViewSelect(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BListView *backend = (BListView*)parent->GetView();
PArgs *inArgs = static_cast<PArgs*>(in);
int32 index;
if (inArgs->FindInt32("index", &index) != B_OK)
return B_ERROR;
bool extend;
if (inArgs->FindBool("extend", &extend) != B_OK)
return B_ERROR;
if (backend->Window())
backend->Window()->Lock();
backend->Select(index, extend);
if (backend->Window())
backend->Window()->Unlock();
return B_OK;
}
示例11: medGetFieldNames
bool PView::readMED(const std::string &fileName, int fileIndex)
{
std::vector<std::string> fieldNames = medGetFieldNames(fileName);
for(unsigned int index = 0; index < fieldNames.size(); index++){
if(fileIndex < 0 || (int)index == fileIndex){
PViewDataGModel *d = 0;
// we use the filename as a kind of "partition" indicator, allowing to
// complete datasets provided in separate files (e.g. coming from DDM)
PView *p = getViewByName(fieldNames[index], -1, -1, fileName);
if(p) d = dynamic_cast<PViewDataGModel*>(p->getData());
bool create = d ? false : true;
if(create) d = new PViewDataGModel();
if(!d->readMED(fileName, index)){
Msg::Error("Could not read data in MED file");
if(create) delete d;
return false;
}
else{
if(create) new PView(d);
}
}
}
return true;
}
示例12: PListViewScrollToPoint
int32_t
PListViewScrollToPoint(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BListView *backend = (BListView*)parent->GetView();
PArgs *inArgs = static_cast<PArgs*>(in);
BPoint pt;
if (inArgs->FindPoint("pt", &pt) != B_OK)
return B_ERROR;
if (backend->Window())
backend->Window()->Lock();
backend->ScrollTo(pt);
if (backend->Window())
backend->Window()->Unlock();
return B_OK;
}
示例13: PTextViewGetSelection
int32_t
PTextViewGetSelection(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BTextView *backend = (BTextView*)parent->GetView();
PArgs *outArgs = static_cast<PArgs*>(out);
if (backend->Window())
backend->Window()->Lock();
int32 outValue1;
int32 outValue2;
backend->GetSelection(&outValue1, &outValue2);
if (backend->Window())
backend->Window()->Unlock();
outArgs->MakeEmpty();
outArgs->AddInt32("start", outValue1);
outArgs->AddInt32("end", outValue2);
return B_OK;
}
示例14: PMenuItemSubmenu
int32_t
PMenuItemSubmenu(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BMenuItem *backend = (BMenuItem*)parent->GetView();
PArgs *outArgs = static_cast<PArgs*>(out);
outArgs->MakeEmpty();
BMenu *menu = backend->Menu();
PMenuBackend *menuBackend = static_cast<PMenuBackend*>(menu);
if (menuBackend)
{
PMenu *pmenu = static_cast<PMenu*>(menuBackend->GetOwner());
outArgs->AddInt64("id", pmenu->GetID());
}
else
outArgs->AddInt64("id", 0);
return B_OK;
}
示例15: PTextViewDisallowChars
int32_t
PTextViewDisallowChars(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BTextView *backend = (BTextView*)parent->GetView();
PArgs *inArgs = static_cast<PArgs*>(in);
BString string;
if (inArgs->FindString("chars", &string) != B_OK)
return B_ERROR;
if (backend->Window())
backend->Window()->Lock();
for (int32 i = 0; i < string.CountChars(); i++)
{
char c = string.ByteAt(i);
if (c)
backend->DisallowChar(c);
}
if (backend->Window())
backend->Window()->Unlock();
return B_OK;
}