本文整理汇总了C++中OverlayComp类的典型用法代码示例。如果您正苦于以下问题:C++ OverlayComp类的具体用法?C++ OverlayComp怎么用?C++ OverlayComp使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OverlayComp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
OverlayComp* OverlayComp::TopComp() {
OverlayComp* comp = this;
OverlayComp* parent = (OverlayComp*)comp->GetParent();
while (parent)
comp = (OverlayComp*) comp->GetParent();
return comp;
}
示例2: objv
void TransformerFunc::execute() {
ComValue objv(stack_arg(0));
ComValue transv(stack_arg(0));
reset_stack();
if (objv.object_compview()) {
ComponentView* compview = (ComponentView*)objv.obj_val();
if (compview && compview->GetSubject()) {
OverlayComp* comp = (OverlayComp*)compview->GetSubject();
Graphic* gr = comp->GetGraphic();
if (gr) {
Transformer* trans = gr->GetTransformer();
if (transv.is_unknown() || !transv.is_array() || transv.array_val()->Number()!=6) {
AttributeValueList* avl = new AttributeValueList();
float a00, a01, a10, a11, a20, a21;
trans->matrix(a00, a01, a10, a11, a20, a21);
avl->Append(new AttributeValue(a00));
avl->Append(new AttributeValue(a01));
avl->Append(new AttributeValue(a10));
avl->Append(new AttributeValue(a11));
avl->Append(new AttributeValue(a20));
avl->Append(new AttributeValue(a21));
ComValue retval(avl);
push_stack(retval);
} else {
float a00, a01, a10, a11, a20, a21;
AttributeValueList* avl = transv.array_val();
Iterator it;
AttributeValue* av;
avl->First(it);
av = avl->GetAttrVal(it);
a00 = av->float_val();
avl->Next(it);
av = avl->GetAttrVal(it);
a01 = av->float_val();
avl->Next(it);
av = avl->GetAttrVal(it);
a10 = av->float_val();
avl->Next(it);
av = avl->GetAttrVal(it);
a11 = av->float_val();
avl->Next(it);
av = avl->GetAttrVal(it);
a20 = av->float_val();
avl->Next(it);
av = avl->GetAttrVal(it);
a21 = av->float_val();
Transformer t(a00, a01, a10, a11, a20, a21);
*gr->GetTransformer()=t;
ComValue compval(new OverlayViewRef(comp), comp->class_symid());
push_stack(compval);
}
}
}
}
}
示例3: while
int FrameFileScript::ReadPathName (istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
FrameFileComp* filecomp = (FrameFileComp*)addr1;
char pathname[BUFSIZ];
if (ParamList::parse_pathname(in, pathname, BUFSIZ, filecomp->GetBaseDir()) != 0)
return -1;
/* check pathname for recursion */
OverlayComp* parent = (OverlayComp*) filecomp->GetParent();
while (parent != nil) {
if (parent->GetPathName() && strcmp(parent->GetPathName(), pathname) == 0) {
cerr << "framefile recursion not allowed (" << pathname << ")\n";
return -1;
}
parent = (OverlayComp*) parent->GetParent();
}
filecomp->SetPathName(pathname);
FrameIdrawComp* child = nil;
FrameCatalog* catalog = (FrameCatalog*)unidraw->GetCatalog();
catalog->SetParent(filecomp);
if( catalog->FrameCatalog::Retrieve(pathname, (Component*&)child)) {
catalog->SetParent(nil);
catalog->Forget(child);
filecomp->Append(child);
return 0;
} else {
catalog->SetParent(nil);
return -1;
}
}
示例4: SetComp
void OverlaysComp::Ungroup (OverlayComp* parent, Clipboard* cb, Command* cmd) {
Iterator i, insertPt;
parent->First(i);
if (!parent->Done(i)) {
SetComp(parent, insertPt);
for (parent->First(i); !parent->Done(i); parent->Next(i)) {
OverlayComp* kid = (OverlayComp*) parent->GetComp(i);
cmd->Store(kid, new UngroupData(parent, kid->GetGraphic()));
}
cmd->Store(parent, new GSData(parent->GetGraphic()));
parent->Bequeath();
parent->First(i);
do {
OverlayComp* kid = (OverlayComp*)parent->GetComp(i);
parent->Remove(i);
InsertBefore(insertPt, kid);
cb->Append(kid);
} while (!parent->Done(i));
Remove(parent);
}
}
示例5: GetGraphic
boolean OverlayComp::operator == (OverlayComp& comp) {
Graphic* gr = GetGraphic();
Graphic* test = comp.GetGraphic();
return
GetClassId() == comp.GetClassId() &&
GraphicEquals(gr, test);
}
示例6: switch
/* virtual */ void ComEditor::ExecuteCmd(Command* cmd) {
if(!whiteboard())
/* normal Unidraw command execution */
OverlayEditor::ExecuteCmd(cmd);
else {
/* indirect command execution, all by script */
std::ostrstream sbuf;
boolean oldflag = OverlayScript::ptlist_parens();
OverlayScript::ptlist_parens(false);
switch (cmd->GetClassId()) {
case PASTE_CMD:
{
boolean scripted = false;
Clipboard* cb = cmd->GetClipboard();
if (cb) {
Iterator it;
for (cb->First(it); !cb->Done(it); cb->Next(it)) {
OverlayComp* comp = (OverlayComp*)cb->GetComp(it);
if (comp) {
Creator* creator = unidraw->GetCatalog()->GetCreator();
OverlayScript* scripter = (OverlayScript*)
creator->Create(Combine(comp->GetClassId(), SCRIPT_VIEW));
if (scripter) {
scripter->SetSubject(comp);
if (scripted)
sbuf << ';';
else
scripted = true;
boolean status = scripter->Definition(sbuf);
delete scripter;
}
}
}
}
if (!scripted)
sbuf << "print(\"Failed attempt to generate script for a PASTE_CMD\\n\" :err)";
sbuf.put('\0');
cout << sbuf.str() << "\n";
cout.flush();
GetComTerp()->run(sbuf.str());
delete cmd;
}
break;
default:
sbuf << "print(\"Attempt to convert unknown command (id == %d) to interpretable script\\n\" " << cmd->GetClassId() << " :err)";
cmd->Execute();
if (cmd->Reversible()) {
cmd->Log();
} else {
delete cmd;
}
break;
}
OverlayScript::ptlist_parens(oldflag);
}
}
示例7: while
int OverlayFileScript::ReadPathName (istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
OverlayFileComp* filecomp = (OverlayFileComp*)addr1;
const char* paramname = ParamList::CurrParamStruct()->name();
filecomp->SetPopenFlag(strcmp(paramname, "popen")==0);
char pathname[BUFSIZ];
if (filecomp->GetPopenFlag()) {
if (ParamList::parse_string(in, pathname, BUFSIZ) != 0)
return -1;
} else {
if (ParamList::parse_pathname(in, pathname, BUFSIZ, filecomp->GetBaseDir()) != 0)
return -1;
}
/* check pathname for recursion */
OverlayComp* parent = (OverlayComp*) filecomp->GetParent();
while (!filecomp->GetPopenFlag() && parent != nil) {
if (parent->GetPathName() && strcmp(parent->GetPathName(), pathname) == 0) {
cerr << "pathname recursion not allowed (" << pathname << ")\n";
return -1;
}
parent = (OverlayComp*) parent->GetParent();
}
filecomp->SetPathName(pathname);
if (!filecomp->GetPopenFlag()) {
OverlayIdrawComp* child = nil;
OverlayCatalog* catalog = (OverlayCatalog*) unidraw->GetCatalog();
catalog->SetParent(filecomp);
if( catalog->OverlayCatalog::Retrieve(pathname, (Component*&)child)) {
catalog->SetParent(nil);
catalog->Forget(child);
filecomp->Append(child);
return 0;
} else {
catalog->SetParent(nil);
return -1;
}
} else {
OvImportCmd impcmd((Editor*)nil);
FILE* fptr = popen(pathname, "r");
if (fptr) {
FILEBUF(fbuf, fptr, ios_base::in);
istream ifs(&fbuf);
OverlayComp* child = (OverlayComp*) impcmd.Import(ifs);
if (child) {
filecomp->Append(child);
return 0;
}
fclose(fptr);
}
return -1;
}
}
示例8: accept
void AttributeDialogImpl::accept() {
editor_->add();
// should set modified flag here if something happenns
// ((ModifStatusVar*)<Editor>->GetState("ModifStatusVar"))->SetModifStatus(true);
OverlayComp* comp = (OverlayComp*)compview_->GetSubject();
if (comp) comp->SetAttributeList(copylist_);
Unref(copylist_);
dialog_->dismiss(true);
unidraw->Update();
}
示例9: Pred
static OverlayComp* Pred (OverlayComp* child) {
Iterator i;
OverlayComp* parent = (OverlayComp*) child->GetParent();
if (parent) {
parent->SetComp(child, i);
parent->Prev(i);
return (OverlayComp*) parent->GetComp(i);
} else
return nil;
}
示例10: DeferredNotify
void OverlaysComp::DeferredNotify() {
if (_notify_deferred) {
GraphicComp::Notify();
_notify_deferred = false;
} else {
Iterator i;
for (First(i); !Done(i); Next(i)) {
OverlayComp* comp = (OverlayComp*)GetComp(i);
if (!comp->GetGraphic()->Hidden())
((OverlayComp*)GetComp(i))->DeferredNotify();
}
}
}
示例11: compviewv
void GrAttrListFunc::execute() {
ComValue compviewv(stack_arg(0));
reset_stack();
if (compviewv.object_compview()) {
ComponentView* compview = (ComponentView*)compviewv.obj_val();
OverlayComp* comp = compview ? (OverlayComp*)compview->GetSubject() : nil;
if (comp) {
ComValue retval(AttributeList::class_symid(), (void*)comp->GetAttributeList());
push_stack(retval);
} else
push_stack(ComValue::nullval());
}
}
示例12: RestorePosition
void OverlaysComp::RestorePosition (OverlayComp* comp, Command* cmd) {
VoidData* vd = (VoidData*) cmd->Recall(comp);
OverlayComp* pred = (OverlayComp*) vd->_void;
OverlayComp* parent = (OverlayComp*) comp->GetParent();
if (parent != nil) parent->Remove(comp);
if (pred == nil) {
Prepend(comp);
} else {
Iterator insertPt;
SetComp(pred, insertPt);
InsertAfter(insertPt, comp);
}
}
示例13: compv
void GrParentFunc::execute() {
ComValue compv(stack_arg(0));
reset_stack();
if(compv.is_object() && compv.object_compview()) {
ComponentView* compview = (ComponentView*)compv.obj_val();
OverlayComp* comp = (OverlayComp*)compview->GetSubject();
if (comp && comp->GetParent()) {
ComValue retval(new OverlayViewRef((OverlayComp*)comp->GetParent()),
((OverlayComp*)comp->GetParent())->classid());
push_stack(retval);
return;
}
}
push_stack(ComValue::nullval());
return;
}
示例14: viewval
void SensitizeCompFunc::execute() {
ComValue viewval(stack_arg(0));
reset_stack();
if (!viewval.is_object()) {
push_stack(ComValue::nullval());
return;
}
ComponentView* view = (ComponentView*)viewval.obj_val();
OverlayComp* comp = (OverlayComp*)view->GetSubject();
if(comp) {
comp->GetGraphic()->Sensitize();
comp->Notify();
}
push_stack(viewval);
}
示例15: strcmp
boolean TextFileComp::operator == (OverlayComp& comp) {
if (GetClassId() != comp.GetClassId()) return false;
return
strcmp(GetPathname(), ((TextFileComp&)comp).GetPathname()) &&
strcmp(GetBegstr(), ((TextFileComp&)comp).GetBegstr()) &&
strcmp(GetEndstr(), ((TextFileComp&)comp).GetEndstr()) &&
GetLineWidth() == ((TextFileComp&)comp).GetLineWidth() &&
OverlayComp::operator==(comp);
}