void Frame::computeAccelerationDep(void) const { if (hasParent()) { mParentSpAccel = motionFromParent(getParentFrame()->getSpAccel()); mReferenceFrameId = getParentFrame()->getRefFrameId(); } else { mParentSpAccel = Vector6::zeros(); mReferenceFrameId = getFrameId(); } mDirtySpAccel = false; }
void Frame::computeVelocityDep(void) const { if (hasParent()) { mParentSpVel = motionFromParent(getParentFrame()->getSpVel()); mRefVel = getRelVel() + motionFromParent(getParentFrame()->getRefVel()); mReferenceFrameId = getParentFrame()->getRefFrameId(); } else { mParentSpVel = Vector6::zeros(); mRefVel = Vector6::zeros(); mReferenceFrameId = getFrameId(); } mDirtySpVel = false; }
void Frame::computePositionDep(void) const { if (hasParent()) { mRefOrient = getParentFrame()->getRefOrientation()*getOrientation(); mRefPos = getParentFrame()->posToRef(getPosition()); mReferenceFrameId = getParentFrame()->getRefFrameId(); } else { mRefOrient = getOrientation(); mRefPos = getPosition(); mReferenceFrameId = getFrameId(); } mDirtyPos = false; }
GridLayout::GridLayout(const Frame& frame, int rows, int cols) : Layout(frame), targetList(rows*cols), nrows(rows), ncols(cols) { Frame parent=getParentFrame(); double ylow=parent.ly(); double yhigh=parent.uy(); double height = parent.getHeight()/nrows; double xlow=parent.lx(); double xhigh=parent.ux(); double width = parent.getWidth()/ncols; for (int r=0;r<nrows;r++) for (int c=0; c<ncols; c++) { double yloc = ylow + r*(yhigh-ylow)/nrows; double xloc = xlow + c*(xhigh-xlow)/ncols; // The list is linear; It's row major int i=c+r*ncols; targetList[i].setWidth(width); targetList[i].setHeight(height); targetList[i].nest(parent, xloc, yloc); } }
BorderLayout::BorderLayout(const Frame& frame, double iMarginSize) : Layout(frame), targetList(1) { Frame parent=getParentFrame(); targetList[0].setHeight(parent.getHeight()-2*iMarginSize); targetList[0].setWidth(parent.getWidth()-2*iMarginSize); targetList[0].nest(parent, iMarginSize, iMarginSize); }
//! determine the path, load and display html page void MetadataItemPropertiesPanel::loadPage() { wxString fileName = config().getHtmlTemplatesPath(); switch (pageTypeM) { case ptSummary: fileName += objectM->getTypeName() + ".html"; break; case ptConstraints: fileName += objectM->getTypeName() + "constraints.html"; break; case ptTriggers: fileName += objectM->getTypeName() + "triggers.html"; break; case ptPrivileges: fileName += objectM->getTypeName() + "privileges.html"; break; case ptTableIndices: fileName += "TABLEindices.html"; break; case ptDependencies: fileName += "dependencies.html"; break; case ptDDL: fileName += "DDL.html"; break; } wxBusyCursor bc; // start a transaction for metadata loading and lock the object DatabasePtr db = objectM->getDatabase(); MetadataLoaderTransaction tr((db) ? db->getMetadataLoader() : 0); SubjectLocker lock(objectM); ProgressDialog pd(this, _("Processing template...")); pd.doShow(); wxString htmlpage; HtmlTemplateProcessor tp(objectM, this); tp.processTemplateFile(htmlpage, fileName, 0, &pd); pd.SetTitle(_("Rendering page...")); wxWindowUpdateLocker freeze(html_window); int x = 0, y = 0; html_window->GetViewStart(&x, &y); // save scroll position html_window->setPageSource(htmlpage); html_window->Scroll(x, y); // restore scroll position // set title if (MetadataItemPropertiesFrame* pf = getParentFrame()) { pf->setTabTitle(this, objectM->getName_() + ": " + html_window->GetOpenedPageTitle()); } }
//! closes window if observed object gets removed (disconnecting, dropping, etc) void MetadataItemPropertiesPanel::subjectRemoved(Subject* subject) { // main observed object is getting destroyed if (subject == objectM) { objectM = 0; if (MetadataItemPropertiesFrame* f = getParentFrame()) f->removePanel(this); } }
BorderLayout::BorderLayout(const Frame& frame, double leftMargin, double topMargin, double rightMargin, double bottomMargin) : Layout(frame), targetList(1) { Frame parent=getParentFrame(); targetList[0].setHeight(parent.getHeight()-topMargin-bottomMargin); targetList[0].setWidth(parent.getWidth()-leftMargin-rightMargin); targetList[0].nest(parent, leftMargin, bottomMargin); }
/*private*/ CatalogPanel* IconItemPanel::makeCatalog() { CatalogPanel* catalog = CatalogPanel::makeDefaultCatalog(false, false, !_update); ImagePanel* panel = catalog->getPreviewPanel(); if (!isUpdate()) { panel->setImage(_backgrounds->at(getParentFrame()->getPreviewBg())); } else { panel->setImage(_backgrounds->at(0)); //update always should be the panel background catalog->setParent(this); } catalog->setToolTip(tr("Drag an icon directly from the Catalog Pane to add it to the Control Panel")); catalog->setVisible(false); return catalog; }
//! recreate html page if something changes void MetadataItemPropertiesPanel::update() { Database* db = dynamic_cast<Database*>(objectM); if (db && !db->isConnected()) { objectM = 0; if (MetadataItemPropertiesFrame* f = getParentFrame()) f->Close(); // MB: This code used to use: //f->removePanel(this); // which would allow us to mix property pages from different // databases in the same Frame, but there are some mysterious // reasons why it causes heap corruption with MSVC return; } // if table or view columns change, we need to reattach if (objectM->getType() == ntTable || objectM->getType() == ntView) // also observe columns { Relation* r = dynamic_cast<Relation*>(objectM); if (!r) return; SubjectLocker locker(r); r->ensureChildrenLoaded(); for (ColumnPtrs::iterator it = r->begin(); it != r->end(); ++it) (*it)->attachObserver(this, false); } // if description of procedure params change, we need to reattach if (objectM->getType() == ntProcedure) { Procedure* p = dynamic_cast<Procedure*>(objectM); if (!p) return; SubjectLocker locker(p); p->ensureChildrenLoaded(); for (ParameterPtrs::iterator it = p->begin(); it != p->end(); ++it) (*it)->attachObserver(this, false); } // with this set to false updates to the same page do not show the // "Please wait while the data is being loaded..." temporary page // this results in less flicker, but may also seem less responsive if (!htmlReloadRequestedM) requestLoadPage(false); }
HLayout::HLayout(const Frame& frame, double fraction) : Layout(frame), targetList(2) { Frame parent=getParentFrame(); double xlow=parent.lx(); targetList[0].setHeight(parent.getHeight()); targetList[0].setWidth(parent.getWidth()*fraction); targetList[0].nest(parent, xlow, 0); targetList[1].setHeight(parent.getHeight()); targetList[1].setWidth(parent.getWidth()*(1.-fraction)); targetList[1].nest(parent, xlow+parent.getWidth()*fraction,0); }
VLayout::VLayout(const Frame& frame, int nframes) : Layout(frame), targetList(nframes) { Frame parent=getParentFrame(); double ylow=parent.ly(); double yhigh=parent.uy(); double height = parent.getHeight()/nframes; for (int i=0;i<nframes;i++) { double yloc = ylow + i*(yhigh-ylow)/nframes; targetList[i].setWidth(parent.getWidth()); targetList[i].setHeight(height); targetList[i].nest(parent, 0, yloc); } }
HLayout::HLayout(const Frame& frame, int nframes) : Layout(frame), targetList(nframes) { Frame parent=getParentFrame(); double xlow=parent.lx(); double xhigh=parent.ux(); double width = parent.getWidth()/nframes; for (int i=0;i<nframes;i++) { double xloc = xlow + i*(xhigh-xlow)/nframes; targetList[i].setHeight(parent.getHeight()); targetList[i].setWidth(width); targetList[i].nest(parent, xloc, 0); } }
//============================================================================== bool Entity::descendsFrom(const Frame *_someFrame) const { if(nullptr == _someFrame) return false; if(this == _someFrame) return true; if(_someFrame->isWorld()) return true; const Frame* descentCheck = getParentFrame(); while(descentCheck) { if(descentCheck->isWorld()) break; if(descentCheck == _someFrame) return true; descentCheck = descentCheck->getParentFrame(); } return false; }
void MetadataItemPropertiesPanel::OnCloseFrame(wxCommandEvent& WXUNUSED(event)) { if (MetadataItemPropertiesFrame* f = getParentFrame()) f->removePanel(this); }