// Sets the phosphate-sugar bond type differently based on the bond // direction. This allows the phosphate to be closer to one sugar // than the other, based on the strand direction. static void pam5_phosphate_sugar_match(struct patternMatch *match) { struct part *p = match->p; struct atom *aPl = p->atoms[match->atomIndices[0]]; struct atom *aSs = p->atoms[match->atomIndices[1]]; struct bond *b = getBond(p, aPl, aSs); BAIL(); struct stretch *s = getStretch(p, aPl, aSs); BAIL(); int reverse; pam5_requires_gromacs(match->p); BAIL(); init_stack_match(); BAIL(); switch (b->direction) { case 'F': reverse = (b->a1 == aSs); break; case 'R': reverse = (b->a1 == aPl); break; default: ERROR2("pam5_phosphate_sugar_match: bond between ids %d and %d has no direction", aPl->atomID, aSs->atomID); p->parseError(p->stream); return; } s->stretchType = reverse ? stretch_5_Ss_Pl_3 : stretch_5_Pl_Ss_3 ; trace_setStretchType(match, s); //printMatch(match); }
void RotatedDC::DrawText (const String& text, const RealPoint& pos, AColor color, int blur_radius, int boldness, double stretch_) { if (text.empty()) return; if (color.alpha == 0) return; if (quality >= QUALITY_AA) { RealRect r(pos, GetTextExtent(text)); RealRect r_ext = trRectToBB(r); RealPoint pos2 = tr(pos); stretch_ *= getStretch(); if (fabs(stretch_ - 1) > 1e-6) { r.width *= stretch_; RealRect r_ext2 = trRectToBB(r); pos2.x += r_ext2.x - r_ext.x; pos2.y += r_ext2.y - r_ext.y; r_ext.x = r_ext2.x; r_ext.y = r_ext2.y; } draw_resampled_text(dc, pos2, r_ext, stretch_, angle, color, text, blur_radius, boldness); } else if (quality >= QUALITY_SUB_PIXEL) { RealPoint p_ext = tr(pos)*text_scaling; double usx,usy; dc.GetUserScale(&usx, &usy); dc.SetUserScale(usx/text_scaling, usy/text_scaling); dc.SetTextForeground(color); dc.DrawRotatedText(text, (int) p_ext.x, (int) p_ext.y, rad_to_deg(angle)); dc.SetUserScale(usx, usy); } else { RealPoint p_ext = tr(pos); dc.SetTextForeground(color); dc.DrawRotatedText(text, (int) p_ext.x, (int) p_ext.y, rad_to_deg(angle)); } }
QSplitterLayoutStruct *QSplitterPrivate::insertWidget(int index, QWidget *w) { Q_Q(QSplitter); QSplitterLayoutStruct *sls = 0; int i; int last = list.count(); for (i = 0; i < list.size(); ++i) { QSplitterLayoutStruct *s = list.at(i); if (s->widget == w) { sls = s; --last; break; } } if (index < 0 || index > last) index = last; if (sls) { list.move(i,index); } else { QSplitterHandle *newHandle = 0; sls = new QSplitterLayoutStruct; QString tmp = QLatin1String("qt_splithandle_"); tmp += w->objectName(); newHandle = q->createHandle(); newHandle->setObjectName(tmp); sls->handle = newHandle; sls->widget = w; w->lower(); list.insert(index,sls); if (newHandle && q->isVisible()) newHandle->show(); // will trigger sending of post events #ifdef QT3_SUPPORT if (compatMode) { int sf = getStretch(sls->widget); if (sf == 243) setStretch(sls->widget, 0); else if (sf == 0) setStretch(sls->widget, 1); } #endif } return sls; }
void QSplitter::setResizeMode(QWidget *w, ResizeMode mode) { /* Internal comment: This function tries to simulate the Qt 3.x ResizeMode behavior using QSizePolicy stretch factors. This isn't easy, because the default \l ResizeMode was \l Stretch, not \l KeepSize, whereas the default stetch factor is 0. So what we do is this: When the user calls setResizeMode() the first time, we iterate through all the child widgets and set their stretch factors to 1. Later on, if children are added (using addWidget()), their stretch factors are also set to 1. There is just one problem left: Often, setResizeMode() is called \e{before} addWidget(), because addWidget() is called from the event loop. In that case, we use a special value, 243, instead of 0 to prevent 0 from being overwritten with 1 in addWidget(). This is a wicked hack, but fortunately it only occurs as a result of calling a \c QT3_SUPPORT function. */ Q_D(QSplitter); bool metWidget = false; if (!d->compatMode) { d->compatMode = true; for (int i = 0; i < d->list.size(); ++i) { QSplitterLayoutStruct *s = d->list.at(i); if (s->widget == w) metWidget = true; if (getStretch(s->widget) == 0) setStretch(s->widget, 1); } } int sf; if (mode == KeepSize) sf = metWidget ? 0 : 243; else sf = 1; setStretch(w, sf); }
void Rotation::setStretch(double s) { size.width *= s * getStretch(); zoomX = zoomY * s; }