Exemple #1
0
void Viewer::Update () {
    Selection* s = GetSelection();
    GraphicView* view = GetGraphicView();
    Component* viewComp = view->GetGraphicComp();
    Component* edComp = _editor->GetComponent();

    if (viewComp != edComp) {
        ComponentView* newView = edComp->Create(ViewCategory());

        if (newView->IsA(GRAPHIC_VIEW)) {
            edComp->Attach(newView);
            newView->Update();
            SetGraphicView((GraphicView*) newView);

        } else {
            delete newView;
        }

    } else {
	s->Hide(this);
        _viewerView->Update();
        GraphicBlock::UpdatePerspective();
	_damage->Repair();
        s->Show(this);
    }
}
Exemple #2
0
Control* NarrowTool::CreateViewEntry (Selection* s, Editor* ed) {
    Control* ctrl = nil;
    Iterator i;

    if (s->Number() >= 1) {
        H_PopupMenu* popup = new H_PopupMenu;
        ctrl = popup;

        s->First(i);
        GraphicComp* kid = s->GetView(i)->GetGraphicComp();
        RecurPopupInclude(ed, popup, kid);
        popup->LockPosition();

        for (;!s->Done(i); s->Next(i)) {
            GraphicView* gv = s->GetView(i);
            GraphicComp* parent = gv->GetGraphicComp();
            if (parent->IsA(SCENE_COMP) || parent->IsA(IGRAPHIC_COMPS)){
                GraphicComp* mykid = nil;
                Iterator j(i);
                s->Next(j);
                if (!s->Done(j)) {
                    mykid = (GraphicComp*) s->GetView(j)->GetGraphicComp();
                }
                NavigateCmd* cmd = new NavigateCmd(ed, false, parent, mykid);
                popup->Include(new CommandItem(GetName(parent), Center, cmd));
            }
        }
    }
    return ctrl;
}
Exemple #3
0
void ViewerGraphic::Update () {
    GraphicComp* parent = (GraphicComp*) _view->GetGraphicComp()->GetParent();

    if (parent != nil) {
        FullGraphic gs;
        totalGSGraphic(parent->GetGraphic(), gs);

        if (Different(this, &gs)) {
            Damage* damage = _view->GetViewer()->GetDamage();
            
            damage->Incur(this);
            *(Graphic*)this = *(Graphic*)(&gs);
            damage->Incur(this);
        }
    }
}
Exemple #4
0
Control* ExamineTool::CreateInfoEntry (Selection* s, Editor* ed) {
    Control* ctrl = nil;
    Iterator i;

    if (s->Number() > 1) {
        Menu* m = new H_PullrightMenu(new Message("Info...", Center, 2, hfil));
        ctrl = m;

        for (s->First(i); !s->Done(i); s->Next(i)) {
	    GraphicView* view = (GraphicView*) s->GetView(i);
            GraphicComp* comp = view->GetGraphicComp();
            InfoCmd* cmd = new InfoCmd(ed, view);
            m->Include(
                new CommandItem(GetName(comp, _shift, true), Center, cmd)
            );
        }
    } else {
	s->First(i);
	GraphicView* view = (GraphicView*) s->GetView(i);
        ctrl = new CommandItem("Info...", Center, new InfoCmd(ed, view));
    }
    return ctrl;
}
Exemple #5
0
void SelectFunc::execute() {
    static int all_symid = symbol_add("all");
    ComValue all_flagv(stack_key(all_symid));
    boolean all_flag = all_flagv.is_true();
    static int clear_symid = symbol_add("clear");
    ComValue clear_flagv(stack_key(clear_symid));
    boolean clear_flag = clear_flagv.is_true();

    Selection* sel = _ed->GetViewer()->GetSelection();
    if (clear_flag) {
      sel->Clear();
      unidraw->Update();
      reset_stack();
      return;
    }
      
    OverlaySelection* newSel = ((OverlayEditor*)_ed)->overlay_kit()->MakeSelection();
    
    Viewer* viewer = _ed->GetViewer();
    AttributeValueList* avl = new AttributeValueList();
    if (all_flag) {

      GraphicView* gv = ((OverlayEditor*)_ed)->GetFrame();
      Iterator i;
      int count=0;
      for (gv->First(i); !gv->Done(i); gv->Next(i)) {
	GraphicView* subgv = gv->GetView(i);
	newSel->Append(subgv);
	OverlayComp* comp = (OverlayComp*)subgv->GetGraphicComp();
	ComValue* compval = new ComValue(new OverlayViewRef(comp), comp->classid());
	avl->Append(compval);
      }

    } else if (nargs()==0) {
      Iterator i;
      int count=0;
      for (sel->First(i); !sel->Done(i); sel->Next(i)) {
	GraphicView* grview = sel->GetView(i);
	OverlayComp* comp = grview ? (OverlayComp*)grview->GetSubject() : nil;
	ComValue* compval = comp ? new ComValue(new OverlayViewRef(comp), comp->classid()) : nil;

	if (compval) {
	  avl->Append(compval);
	}
	delete newSel;
        newSel = nil;
      }

    } else {

      for (int i=0; i<nargsfixed(); i++) {
        ComValue& obj = stack_arg(i);
	if (obj.object_compview()) {
	  ComponentView* comview = (ComponentView*)obj.obj_val();
	  OverlayComp* comp = (OverlayComp*)comview->GetSubject();
	  if (comp) {
	    GraphicView* view = comp->FindView(viewer);
	    if (view) {
	      newSel->Append(view);
	      ComValue* compval = new ComValue(new OverlayViewRef(comp), comp->classid());
	      avl->Append(compval);
	    }
	  }
	} else if (obj.is_array()) {
	  Iterator it;
	  AttributeValueList* al = obj.array_val();
	  al->First(it);
	  while (!al->Done(it)) {
	    if (al->GetAttrVal(it)->object_compview()) {
	      ComponentView* comview = (ComponentView*)al->GetAttrVal(it)->obj_val();
	      OverlayComp* comp = (OverlayComp*)comview->GetSubject();
	      if (comp) {
		GraphicView* view = comp->FindView(viewer);
		if (view) {
		  newSel->Append(view);
		  ComValue* compval = new ComValue(new OverlayViewRef(comp), comp->classid());
		  avl->Append(compval);
		}
	      }
	    }
	    al->Next(it);
	  }
	}
      }
    }

    if (newSel){
      sel->Clear();
      delete sel;
      _ed->SetSelection(newSel);
      newSel->Update(viewer);
      unidraw->Update();
    }
    reset_stack();
    ComValue retval(avl);
    push_stack(retval);
}