void DestroyCanvases() { TList* loc = (TList*)gROOT->GetListOfCanvases(); TListIter itc(loc); TObject *o(0); while ((o = itc())) delete o; }
LiveJournalUserData *LiveJournalClient::findContact(const char *user, Contact *&contact, bool bCreate, bool bJoin) { ContactList::ContactIterator it; while ((contact = ++it) != NULL) { LiveJournalUserData *data; ClientDataIterator itc(contact->clientData, this); while ((data = (LiveJournalUserData*)(++itc)) != NULL) { if (!strcmp(data->User.ptr, user)) return data; } } if (!bCreate) return NULL; QString sname = QString::fromUtf8(user); if (bJoin) { it.reset(); while ((contact = ++it) != NULL) { if (contact->getName().lower() == sname.lower()) break;; } } if (contact == NULL) { contact = getContacts()->contact(0, true); contact->setName(sname); } LiveJournalUserData *data = (LiveJournalUserData*)(contact->clientData.createData(this)); set_str(&data->User.ptr, user); Event e(EventContactChanged, contact); e.process(); return data; }
void LiveJournalClient::auth_ok() { m_status = STATUS_ONLINE; setState(Connected); setPreviousPassword(NULL); statusChanged(); list<Contact*> forDelete; Contact *contact; ContactList::ContactIterator it; while ((contact = ++it) != NULL) { LiveJournalUserData *data; ClientDataIterator itc(contact->clientData, this); while ((data = (LiveJournalUserData*)(++itc)) != NULL) { if (!data->Shared.bValue) continue; if (data->bChecked.bValue) continue; contact->clientData.freeData(data); if (contact->clientData.size() == 0) forDelete.push_back(contact); break; } } for (list<Contact*>::iterator itc = forDelete.begin(); itc != forDelete.end(); ++itc) delete (*itc); QTimer::singleShot(0, this, SLOT(timeout())); }
void LiveJournalClient::setStatus(unsigned status) { if (status == STATUS_OFFLINE) return; Contact *contact; ContactList::ContactIterator it; while ((contact = ++it) != NULL) { LiveJournalUserData *data; ClientDataIterator itc(contact->clientData, this); while ((data = (LiveJournalUserData*)(++itc)) != NULL) { data->bChecked.bValue = false; if (data->User.ptr && this->data.owner.User.ptr && !strcmp(data->User.ptr, this->data.owner.User.ptr)) data->bChecked.bValue = true; } } LiveJournalRequest *req = new LoginRequest(this); string version; #ifdef WIN32 version = "Win32"; #else #ifdef QT_MACOSX_VERSION version = "MacOS"; #else version = "Qt"; #endif #endif version += "-" PACKAGE "/" VERSION; req->addParam("clientversion", version.c_str()); req->addParam("getmoods", number(getMoods()).c_str()); req->addParam("getmenus", "1"); m_requests.push_back(req); send(); }
void Cyb3DWorld::loadObjects() { CybParameters* cybCore = CybParameters::getInstance(); sVertex *v0, *v1, *v2; CybVector3D<float> aux; for(int j = 0; j < cybCore->numLayer; ++j){ int l = 0; mfCellsIterator<cybSurfaceTriTraits> itc(cybCore->mesh[j]); objects.push_back(new CybTriangleBatch()); //objects[j].begin(); for(itc.initialize(), l = 0; itc.notFinish(); ++itc, ++l){ v0 = cybCore->mesh[j]->getVertex(itc->getVertexId(0)); v1 = cybCore->mesh[j]->getVertex(itc->getVertexId(1)); v2 = cybCore->mesh[j]->getVertex(itc->getVertexId(2)); vec3 verts[3] = {v0, v1, v2}; vec3 norms[3]; vec2 tc[3]; aux = v0->getNormal(); norms[0][0] = aux[0]; norms[0][1] = aux[1]; norms[0][2] = aux[2]; aux = v1->getNormal(); norms[1][0] = aux[0]; norms[1][1] = aux[1]; norms[1][2] = aux[2]; aux = v2->getNormal(); norms[2][0] = aux[0]; norms[2][1] = aux[1]; norms[2][2] = aux[2]; objects[j].addTriangle(verts, norms, tc); } objects[j].end(); } }
/** * Initializes the given socket structure * * \param data raw pointer to a \c DS_Socket structure */ static void* create_socket (void* data) { /* Data pointer is NULL */ if (!data) return NULL; /* Cast raw pointer to socket */ DS_Socket* ptr = (DS_Socket*) data; /* Make the address 0.0.0.0 if it is empty */ if (DS_StringIsEmpty (ptr->address) || ptr->broadcast == 1) { DS_FREESTR (ptr->address); ptr->address = sdsnew ("0.0.0.0"); } /* Set service strings */ ptr->info.in_service = itc (ptr->in_port); ptr->info.out_service = itc (ptr->out_port); /* Open TCP socket */ if (ptr->type == DS_SOCKET_TCP) { ptr->info.sock_in = create_server_tcp (ptr->info.in_service, SOCKY_IPv4, 0); ptr->info.sock_out = create_client_tcp (ptr->address, ptr->info.out_service, SOCKY_IPv4, 0); } /* Open UDP socket */ else if (ptr->type == DS_SOCKET_UDP) { ptr->info.sock_in = create_server_udp (ptr->info.in_service, SOCKY_IPv4, 0); ptr->info.sock_out = create_client_udp (SOCKY_IPv4, 0); } /* Update initialized states */ ptr->info.server_init = (ptr->info.sock_in > 0); ptr->info.client_init = (ptr->info.sock_out > 0); /* Start server loop */ server_loop (ptr); /* Exit */ return NULL; }
void LiveJournalClient::statusChanged() { Contact *contact = NULL; ContactList::ContactIterator it; while ((contact = ++it) != NULL) { ClientDataIterator itc(contact->clientData, this); if ((++itc) != NULL) { Event e(EventContactChanged, contact); e.process(); } } findContact(data.owner.User.ptr, contact); }
//! Redraw grid, curves, and markers. The draw code // does not clear clipRegion prior to painting. // \param p painter used for drawing void QwtPlot::drawCanvas(QPainter *p) { QwtDiMap map[axisCnt]; for ( int axis = 0; axis < axisCnt; axis++ ) map[axis] = canvasMap(axis); QRect rect = d_canvas->contentsRect(); // // draw grid // if ( d_grid.enabled() && axisEnabled( d_grid.xAxis() ) && axisEnabled( d_grid.yAxis() ) ) { d_grid.draw(p, rect, map[d_grid.xAxis()], map[d_grid.yAxis()]); } // // draw curves // QIntDictIterator<QwtPlotCurve> itc(*d_curves); for (QwtPlotCurve *curve = itc.toFirst(); curve != 0; curve = ++itc ) { if ( curve->enabled() && axisEnabled( curve->xAxis() ) && axisEnabled( curve->yAxis() ) ) { curve->draw(p, map[curve->xAxis()], map[curve->yAxis()]); } } // // draw markers // QIntDictIterator<QwtPlotMarker> itm(*d_markers); for (QwtPlotMarker *marker = itm.toFirst(); marker != 0; marker = ++itm ) { if ( marker->enabled() && axisEnabled( marker->xAxis() ) && axisEnabled( marker->yAxis() ) ) { marker->draw(p, map[marker->xAxis()].transform(marker->xValue()), map[marker->yAxis()].transform(marker->yValue()), rect); } } }
typename pstring_t<F>::iterator pstring_t<F>::find(const pstring_t search, iterator start) const { for (; start != end(); ++start) { iterator itc(start); auto cmp = search.begin(); while (itc != end() && cmp != search.end() && *itc == *cmp) { ++itc; ++cmp; } if (cmp == search.end()) return start; } return end(); }
//! Rebuild the scales and maps void QwtPlot::updateAxes() { int i; bool resetDone[axisCnt]; for (i = 0; i < axisCnt; i++) resetDone[i] = FALSE; // // Adjust autoscalers // QIntDictIterator<QwtPlotCurve> itc(*d_curves); for (QwtPlotCurve *c = itc.toFirst(); c != 0; c = ++itc ) { if (c->dataSize() > 0) // don't scale curves with no data { // (minXValue() et al. would return 0.0) int axis = c->xAxis(); if ( !resetDone[axis] ) { d_as[axis].reset(); resetDone[axis] = TRUE; } d_as[axis].adjust(c->minXValue(), c->maxXValue()); axis = c->yAxis(); if ( !resetDone[axis] ) { d_as[axis].reset(); resetDone[axis] = TRUE; } d_as[axis].adjust(c->minYValue(), c->maxYValue()); } } // // Adjust scales // for (i=0; i<axisCnt; i++) { d_sdiv[i] = d_as[i].scaleDiv(); d_scale[i]->setScaleDiv(d_sdiv[i]); } d_grid.setXDiv(d_sdiv[d_grid.xAxis()]); d_grid.setYDiv(d_sdiv[d_grid.yAxis()]); }
bool MsgEdit::adjustType() { if (m_bReceived) return true; Command cmd; cmd->menu_id = MenuMessage; cmd->param = (void*)(m_userWnd->m_id); cmd->id = m_userWnd->getMessageType(); Event e1(EventCheckState, cmd); if ((m_userWnd->getMessageType() != m_type) && e1.process()){ if (setType(m_userWnd->getMessageType())) return true; } cmd->id = m_type; Event e(EventCheckState, cmd); if (e.process()) return true; Event eMenu(EventGetMenuDef, (void*)MenuMessage); CommandsDef *cmdsMsg = (CommandsDef*)(eMenu.process()); CommandsList itc(*cmdsMsg, true); CommandDef *c; unsigned desired = m_userWnd->getMessageType(); bool bSet = false; while ((c = ++itc) != NULL){ if (c->id == CmdContactClients) continue; c->param = (void*)(m_userWnd->m_id); Event eCheck(EventCheckState, c); if (!eCheck.process()) continue; if (setType(c->id)){ bSet = true; break; } } m_userWnd->setMessageType(desired); return bSet; }
/* region<int> getDiffer( trackDocument * doc, int areaIndex, int start, int end, int time ) { boundaryArea & area = doc->areas[areaIndex]; boundaryCurve & curve = area.divisions.first(); boundaryCurveIndex index; index.curve = 0; index.size = curve.points.size; index.start = start; index.end = end; static array2<bool> flag; flag.allocate( doc->width, doc->height ); region<int> result; if ( ! time ) return result; area.update( time - 1 ); area.update( time ); region<int> prevShape, nowShape; { list< point2<int> > segments; bool checkStart = true; for ( boundaryCurveIndex::iterator iti( index ); iti; ++iti ) { curve.segment( segments, iti(), time - 1 ); } memset( flag.data, 0, sizeof( bool ) * flag.size ); for ( list< point2<int> >::iterator itp( segments ); itp; ++itp ) { flag( clamp( 0, itp->x, doc->width - 1 ), clamp( 0, itp->y, doc->height - 1 ) ) = true; } prevShape.set( flag, 0, 0 ); } { list< point2<int> > segments; bool checkStart = true; for ( boundaryCurveIndex::iterator iti( index ); iti; ++iti ) { curve.segment( segments, iti(), time ); } memset( flag.data, 0, sizeof( bool ) * flag.size ); for ( list< point2<int> >::iterator itp( segments ); itp; ++itp ) { flag( clamp( 0, itp->x, doc->width - 1 ), clamp( 0, itp->y, doc->height - 1 ) ) = true; } nowShape.set( flag, 0, 0 ); } region<int> round; round = nowShape | prevShape; { region<int> line; point2<int> p1 = curve.points[start]( time - 1 ); point2<int> p2 = curve.points[start]( time ); line.line( p1.x, p1.y, p2.x, p2.y ); round |= line; } { region<int> line; point2<int> p1 = curve.points[end]( time - 1 ); point2<int> p2 = curve.points[end]( time ); line.line( p1.x, p1.y, p2.x, p2.y ); round |= line; } round.fill( result ); return result; } */ void stateDocument::paint() { trackDocument * doc = trackDocument::get(); trackView * view = trackView::get(); if ( ! doc ) return; if ( ! view ) return; static image viewImage;//画面表示用画像 viewImage.topdown = false; double maxValue = doc->maxValues[doc->currentViewImageIndex]; double windowLevel = windowLevelBar->get(); double windowSize = windowSizeBar->get(); decimal rate = 255.0 / windowSize; decimal offset = windowLevel - windowSize / 2; imageInterface< pixelLuminance<int16> > * img = & doc->originalImages[doc->currentViewImageIndex]; switch ( view->mode & trackView::baseImageMask ) { case trackView::original: break; case trackView::vertEdge: img = & doc->verticalEdgeImages[doc->currentViewImageIndex]; break; case trackView::horzEdge: img = & doc->horizontalEdgeImages[doc->currentViewImageIndex]; break; default: offset = 0; rate = 0; break; } viewImage.create( img->width, img->height ); pixel p( 0, 0, 0, 255 ); if ( rate ) { for ( int y = 0; y < img->height; ++y ) { for ( int x = 0; x < img->width; ++x ) { p.r = p.g = p.b = static_cast<int8>( clamp<decimal>( 0, ( img->getInternal( x, y ).y - offset ) * rate, 255.0 ) ); viewImage.setInternal( x, y, p ); } } } else { for ( int y = 0; y < img->height; ++y ) { for ( int x = 0; x < img->width; ++x ) { viewImage.setInternal( x, y, p ); } } } //波の表示用の色 pixel colorV( 0, 0, 255, 255 ); pixel colorH( 0, 255, 0, 255 ); pixel colorA( 255, 255, 0, 255 ); pixel colorD( 255, 0, 255, 255 ); //論文投稿用の表示 if ( false && ( ( view->mode & trackView::baseImageMask ) == trackView::none ) ) { p.r = p.g = p.b = 0; for ( int y = 0; y < img->height; ++y ) { for ( int x = 0; x < img->width; ++x ) { viewImage.setInternal( x, y, p ); } } for ( int t = 0; t < doc->sizeTime(); ++t ) { pixel c; if ( view->mode & trackView::vertical ) { for ( array< list<link> >::iterator ita( doc->verticalLinks ); ita; ++ita ) { for ( list<link>::iterator it( ita() ); it; ++it ) { c.r = c.g = c.b = clamp<int>( 0, it->reliability * 255, 255 ); int x = it->cx * doc->wave[t] + it->bx; int y = it->cy * doc->wave[t] + it->by; viewImage.set( x, y, blendMax( viewImage.get( x, y ), c ) ); } } } if ( view->mode & trackView::horizontal ) { for ( array< list<link> >::iterator ita( doc->horizontalLinks ); ita; ++ita ) { for ( list<link>::iterator it( ita() ); it; ++it ) { c.r = c.g = c.b = clamp<int>( 0, it->reliability * 255, 255 ); int x = it->cx * doc->wave[t] + it->bx; int y = it->cy * doc->wave[t] + it->by; viewImage.set( x, y, blendMax( viewImage.get( x, y ), c ) ); } } } if ( view->mode & trackView::ascent ) { for ( array< list<link> >::iterator ita( doc->ascentLinks ); ita; ++ita ) { for ( list<link>::iterator it( ita() ); it; ++it ) { c.r = c.g = c.b = clamp<int>( 0, it->reliability * 255, 255 ); int x = it->cx * doc->wave[t] + it->bx; int y = it->cy * doc->wave[t] + it->by; viewImage.set( x, y, blendMax( viewImage.get( x, y ), c ) ); } } } if ( view->mode & trackView::descent ) { for ( array< list<link> >::iterator ita( doc->descentLinks ); ita; ++ita ) { for ( list<link>::iterator it( ita() ); it; ++it ) { c.r = c.g = c.b = clamp<int>( 0, it->reliability * 255, 255 ); int x = it->cx * doc->wave[t] + it->bx; int y = it->cy * doc->wave[t] + it->by; viewImage.set( x, y, blendMax( viewImage.get( x, y ), c ) ); } } } } } else if ( view->mode != trackView::original ) { /* if ( view->mode & trackView::vertical ) { checkMaximum<double> mx; for ( array< list<link> >::iterator ita( doc->verticalLinks ); ita; ++ita ) { for ( list<link>::iterator it( ita() ); it; ++it ) { mx( it->intensity ); } } for ( array< list<link> >::iterator ita( doc->verticalLinks ); ita; ++ita ) { for ( list<link>::iterator it( ita() ); it; ++it ) { pixel c = colorV; c.a = clamp<int>( 0, c.a * it->intensity / mx(), 255 ); int x = it->cx * doc->wave[doc->currentViewImageIndex] + it->bx; int y = it->cy * doc->wave[doc->currentViewImageIndex] + it->by; viewImage.set( x, y, blend( viewImage.get( x, y ), c ) ); } } } if ( view->mode & trackView::horizontal ) { checkMaximum<double> mx; for ( array< list<link> >::iterator ita( doc->horizontalLinks ); ita; ++ita ) { for ( list<link>::iterator it( ita() ); it; ++it ) { mx( it->intensity ); } } for ( array< list<link> >::iterator ita( doc->horizontalLinks ); ita; ++ita ) { for ( list<link>::iterator it( ita() ); it; ++it ) { pixel c = colorH; c.a = clamp<int>( 0, c.a * it->intensity / mx(), 255 ); int x = it->cx * doc->wave[doc->currentViewImageIndex] + it->bx; int y = it->cy * doc->wave[doc->currentViewImageIndex] + it->by; viewImage.set( x, y, blend( viewImage.get( x, y ), c ) ); } } } if ( view->mode & trackView::ascent ) { checkMaximum<double> mx; for ( array< list<link> >::iterator ita( doc->ascentLinks ); ita; ++ita ) { for ( list<link>::iterator it( ita() ); it; ++it ) { mx( it->intensity ); } } for ( array< list<link> >::iterator ita( doc->ascentLinks ); ita; ++ita ) { for ( list<link>::iterator it( ita() ); it; ++it ) { pixel c = colorA; c.a = clamp<int>( 0, c.a * it->intensity / mx(), 255 ); int x = it->cx * doc->wave[doc->currentViewImageIndex] + it->bx; int y = it->cy * doc->wave[doc->currentViewImageIndex] + it->by; viewImage.set( x, y, blend( viewImage.get( x, y ), c ) ); } } } if ( view->mode & trackView::descent ) { checkMaximum<double> mx; for ( array< list<link> >::iterator ita( doc->descentLinks ); ita; ++ita ) { for ( list<link>::iterator it( ita() ); it; ++it ) { mx( it->intensity ); } } for ( array< list<link> >::iterator ita( doc->descentLinks ); ita; ++ita ) { for ( list<link>::iterator it( ita() ); it; ++it ) { pixel c = colorD; c.a = clamp<int>( 0, c.a * it->intensity / mx(), 255 ); int x = it->cx * doc->wave[doc->currentViewImageIndex] + it->bx; int y = it->cy * doc->wave[doc->currentViewImageIndex] + it->by; viewImage.set( x, y, blend( viewImage.get( x, y ), c ) ); } } } */ if ( view->mode & trackView::vertical ) { for ( array< list<link> >::iterator ita( doc->verticalLinks ); ita; ++ita ) { for ( list<link>::iterator it( ita() ); it; ++it ) { pixel c = colorV; c.a = clamp<int>( 0, c.a * it->reliability, 255 ); int x = it->cx * doc->wave[doc->currentViewImageIndex] + it->bx; int y = it->cy * doc->wave[doc->currentViewImageIndex] + it->by; viewImage.set( x, y, blend( viewImage.get( x, y ), c ) ); } } } if ( view->mode & trackView::horizontal ) { for ( array< list<link> >::iterator ita( doc->horizontalLinks ); ita; ++ita ) { for ( list<link>::iterator it( ita() ); it; ++it ) { pixel c = colorH; c.a = clamp<int>( 0, c.a * it->reliability, 255 ); int x = it->cx * doc->wave[doc->currentViewImageIndex] + it->bx; int y = it->cy * doc->wave[doc->currentViewImageIndex] + it->by; viewImage.set( x, y, blend( viewImage.get( x, y ), c ) ); } } } if ( view->mode & trackView::ascent ) { for ( array< list<link> >::iterator ita( doc->ascentLinks ); ita; ++ita ) { for ( list<link>::iterator it( ita() ); it; ++it ) { pixel c = colorA; c.a = clamp<int>( 0, c.a * it->reliability, 255 ); int x = it->cx * doc->wave[doc->currentViewImageIndex] + it->bx; int y = it->cy * doc->wave[doc->currentViewImageIndex] + it->by; viewImage.set( x, y, blend( viewImage.get( x, y ), c ) ); } } } if ( view->mode & trackView::descent ) { for ( array< list<link> >::iterator ita( doc->descentLinks ); ita; ++ita ) { for ( list<link>::iterator it( ita() ); it; ++it ) { pixel c = colorD; c.a = clamp<int>( 0, c.a * it->reliability, 255 ); int x = it->cx * doc->wave[doc->currentViewImageIndex] + it->bx; int y = it->cy * doc->wave[doc->currentViewImageIndex] + it->by; viewImage.set( x, y, blend( viewImage.get( x, y ), c ) ); } } } } /* for ( int i = 0; i < 4; ++i ) { for ( array2<flicker>::iterator it( doc->flickers[i] ); it; ++it ) { if ( it->value < 0.25 ) continue; pixel c( 0, 255, 0, 255 ); c.a = clamp<int>( 0, c.a * it->value, 128 ); const point2<int> & pos = it->lnk.position( doc->currentViewImageIndex, doc->wave ); int x = pos.x, y = pos.y; viewImage.set( x, y, blend( viewImage.get( x, y ), c ) ); } } */ for ( list< boundaryArea >::iterator it( doc->areas ); it; ++it ) { it->update( doc->currentViewImageIndex ); } list< point2<int> > points; pixel linecolor( 255, 255, 0, 128 ); pixel pointcolor( 0, 255, 0, 255 ); pixel itnitialpointcolor( 0, 0, 255, 255 ); pixel editedpointcolor( 255, 0, 0, 255 ); /* for ( list< boundaryArea >::iterator it( doc->areas ); it; ++it ) { boundaryArea & area = it(); if ( ! area.enable ) continue; pixel areacolor( 0, 0, 0, 64 ); for ( list< boundaryPart >::iterator ita( area.parts ); ita; ++ita ) { areacolor.r = rand() % 256; areacolor.g = rand() % 256; areacolor.b = rand() % 256; areacolor.a = 128; boundaryPart & part = ita(); for ( region<int>::iterator itp( part.shapes[doc->currentViewImageIndex] ); itp; ++itp ) { int x = itp->x; int y = itp->y; viewImage.set( x, y, blend( viewImage.get( x, y ), areacolor ) ); } } } */ for ( list< boundaryArea >::iterator it( doc->areas ); it; ++it ) { //曲線の表示 if ( doc->show_curve ) { for ( list< point2<int> >::iterator itp( it->boundaryCurves[doc->currentViewImageIndex] ); itp; ++itp ) { const point2<int> & p = itp(); int x = p.x; int y = p.y; viewImage.set( x, y, blend( viewImage.get( x, y ), linecolor ) ); } } //制御点の表示 for ( list<boundaryPoint*>::iterator itc( it->controlPoints ); itc; ++itc ) { boundaryPoint & bp = *itc(); const point2<int> & p = bp( doc->currentViewImageIndex ); pixel c; switch ( bp.type( doc->currentViewImageIndex ) ) { case boundaryPointFrame::typeInitial: c = itnitialpointcolor; break; case boundaryPointFrame::typeEdited: c = editedpointcolor; break; case boundaryPointFrame::typeInterpolated: c = pointcolor; break; default: c = pointcolor; break; } for ( int y = p.y - 1; y <= p.y + 1; ++y ) { for ( int x = p.x - 1; x <= p.x + 1; ++x ) { viewImage.set( x, y, blend( viewImage.get( x, y ), c ) ); } } } } paint( viewImage ); }
/*! \brief Enable or disable the legend \param tf \c TRUE (enabled) or \c FALSE (disabled) \param curveKey Key of a existing curve. If curveKey < 0 the legends for all curves will be updated. \sa QwtPlot::setAutoLegend() \sa QwtPlot::setLegendPos() */ void QwtPlot::enableLegend( #ifndef QWT_NO_LEGEND bool enable, long curveKey #else bool, long #endif ) { #ifndef QWT_NO_LEGEND QwtPlotCurve *curCurve; bool isUpdateEnabled = d_legend->isUpdatesEnabled(); d_legend->setUpdatesEnabled(FALSE); if ( curveKey < 0 ) // legends for all curves { if ( enable ) { if ( d_legend->itemCnt() < d_curves->count() ) { // not all curves have a legend d_legend->clear(); QIntDictIterator<QwtPlotCurve> itc(*d_curves); itc.toFirst(); while ((curCurve = itc.current())) { d_legend->appendItem(curCurve->title(), curCurve->symbol(), curCurve->pen(), itc.currentKey()); ++itc; } } } else { if ( d_legend->itemCnt() > 0 ) d_legend->clear(); } } else { uint index = d_legend->findFirstKey(curveKey); if ( enable ) { curCurve = d_curves->find(curveKey); if ( curCurve && ( index >= d_legend->itemCnt() ) ) { // curve exists and has no legend d_legend->appendItem(curCurve->title(), curCurve->symbol(), curCurve->pen(), curveKey); } } else { if ( index < d_legend->itemCnt() ) d_legend->removeItem(index); } } d_legend->setUpdatesEnabled(isUpdateEnabled); updateLayout(); #endif }
void *MsgEdit::processEvent(Event *e) { if ((e->type() == EventContactChanged) && !m_bReceived){ Command cmd; cmd->id = m_type; cmd->menu_id = MenuMessage; cmd->param = (void*)(m_userWnd->m_id); Event e(EventCheckState, cmd); if (e.process()) return NULL; Event eMenu(EventGetMenuDef, (void*)MenuMessage); CommandsDef *cmdsMsg = (CommandsDef*)(eMenu.process()); CommandsList itc(*cmdsMsg, true); CommandDef *c; while ((c = ++itc) != NULL){ c->param = (void*)(m_userWnd->m_id); Event eCheck(EventCheckState, c); if (!eCheck.process()) continue; CommandDef *def; def = CorePlugin::m_plugin->messageTypes.find(c->id); if (def == NULL) continue; MessageDef *mdef = (MessageDef*)(def->param); if (mdef->flags & MESSAGE_SILENT) continue; if (mdef->create == NULL) continue; Message *msg = mdef->create(NULL); if (msg == NULL) continue; setMessage(msg, false); delete msg; break; } return NULL; } if (e->type() == EventMessageReceived){ Message *msg = (Message*)(e->param()); if (msg->getFlags() & MESSAGE_NOVIEW) return NULL; if ((msg->contact() == m_userWnd->id()) && (msg->type() != MessageStatus)){ if (CorePlugin::m_plugin->getContainerMode()){ bool bSetFocus = false; if (topLevelWidget() && topLevelWidget()->inherits("Container")){ Container *container = static_cast<Container*>(topLevelWidget()); if (container->wnd() == m_userWnd) bSetFocus = true; } setMessage(msg, bSetFocus); }else{ if (m_edit->isReadOnly()) QTimer::singleShot(0, this, SLOT(setupNext())); } } } if (e->type() == EventRealSendMessage){ MsgSend *s = (MsgSend*)(e->param()); if (s->edit == this){ sendMessage(s->msg); return e->param(); } } if (e->type() == EventCheckState){ CommandDef *cmd = (CommandDef*)(e->param()); if ((cmd->param == this) && (cmd->id == CmdTranslit)){ Contact *contact = getContacts()->contact(m_userWnd->id()); if (contact){ TranslitUserData *data = (TranslitUserData*)(contact->getUserData(CorePlugin::m_plugin->translit_data_id)); if (data){ cmd->flags &= ~COMMAND_CHECKED; if (data->Translit) cmd->flags |= COMMAND_CHECKED; } } return NULL; } if ((cmd->menu_id != MenuTextEdit) || (cmd->param != this)) return NULL; cmd->flags &= ~(COMMAND_CHECKED | COMMAND_DISABLED); switch (cmd->id){ case CmdUndo: if (m_edit->isReadOnly()) return NULL; if (!m_edit->isUndoAvailable()) cmd->flags |= COMMAND_DISABLED; return e->param(); case CmdRedo: if (m_edit->isReadOnly()) return NULL; if (!m_edit->isRedoAvailable()) cmd->flags |= COMMAND_DISABLED; return e->param(); case CmdCut: if (m_edit->isReadOnly()) return NULL; case CmdCopy: if (!m_edit->hasSelectedText()) cmd->flags |= COMMAND_DISABLED; return e->param(); case CmdPaste: if (m_edit->isReadOnly()) return NULL; if (QApplication::clipboard()->text().isEmpty()) cmd->flags |= COMMAND_DISABLED; return e->param(); case CmdClear: if (m_edit->isReadOnly()) return NULL; case CmdSelectAll: if (m_edit->text().isEmpty()) cmd->flags |= COMMAND_DISABLED; return e->param(); } return NULL; } if (e->type() == EventCommandExec){ CommandDef *cmd = (CommandDef*)(e->param()); if ((cmd->id == CmdSmile) && (cmd->param == this)){ Event eBtn(EventCommandWidget, cmd); QToolButton *btnSmile = (QToolButton*)(eBtn.process()); if (btnSmile){ SmilePopup *popup = new SmilePopup(this); QSize s = popup->minimumSizeHint(); popup->resize(s); connect(popup, SIGNAL(insert(int)), this, SLOT(insertSmile(int))); QPoint p = CToolButton::popupPos(btnSmile, popup); popup->move(p); popup->show(); } return e->param(); }
/*! Change color and fonts of a plot \sa QwtPlotPrintFilter::apply */ void QwtPlotPrintFilter::apply(QwtPlot *plot) const { QwtPlotPrintFilter *that = (QwtPlotPrintFilter *)this; delete that->d_cache; that->d_cache = new QwtPlotPrintFilterCache; QwtPlotPrintFilterCache &cache = *that->d_cache; if ( plot->d_lblTitle ) { QPalette palette = plot->d_lblTitle->palette(); cache.titleColor = palette.color( QPalette::Active, QColorGroup::Foreground); palette.setColor(QPalette::Active, QColorGroup::Foreground, color(cache.titleColor, Title)); plot->d_lblTitle->setPalette(palette); cache.titleFont = plot->d_lblTitle->font(); plot->d_lblTitle->setFont(font(cache.titleFont, Title)); } if ( plot->d_legend ) { QIntDictIterator<QWidget> it = plot->d_legend->itemIterator(); for ( QWidget *w = it.toFirst(); w != 0; w = ++it) { const int key = it.currentKey(); cache.legendFonts.insert(it.currentKey(), new QFont(w->font())); w->setFont(font(w->font(), Legend, key)); if ( w->inherits("QwtLegendButton") ) { QwtLegendButton *btn = (QwtLegendButton *)w; QwtSymbol symbol = btn->symbol(); QPen pen = symbol.pen(); QBrush brush = symbol.brush(); pen.setColor(color(pen.color(), CurveSymbol, key)); brush.setColor(color(brush.color(), CurveSymbol, key)); symbol.setPen(pen); symbol.setBrush(brush); btn->setSymbol(symbol); pen = btn->curvePen(); pen.setColor(color(pen.color(), Curve, key)); btn->setCurvePen(pen); } } } for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ ) { QwtScale *scale = plot->d_scale[axis]; if ( scale ) { cache.scaleColor[axis] = scale->palette().color( QPalette::Active, QColorGroup::Foreground); QPalette palette = scale->palette(); palette.setColor(QPalette::Active, QColorGroup::Foreground, color(cache.scaleColor[axis], AxisScale, axis)); scale->setPalette(palette); cache.scaleFont[axis] = scale->font(); scale->setFont(font(cache.scaleFont[axis], AxisScale, axis)); cache.scaleTitleColor[axis] = scale->titleColor(); scale->setTitleColor( color(cache.scaleTitleColor[axis], AxisTitle, axis)); cache.scaleTitleFont[axis] = scale->titleFont(); scale->setTitleFont( font(cache.scaleTitleFont[axis], AxisTitle, axis)); int startDist, endDist; scale->minBorderDist(startDist, endDist); scale->setBorderDist(startDist, endDist); } } cache.widgetBackground = plot->backgroundColor(); plot->setBackgroundColor(color(cache.widgetBackground, WidgetBackground)); cache.canvasBackground = plot->canvasBackground(); plot->setCanvasBackground(color(cache.canvasBackground, CanvasBackground)); QPen pen = plot->d_grid->majPen(); cache.gridColors[0] = pen.color(); pen.setColor(color(pen.color(), MajorGrid)); plot->d_grid->setMajPen(pen); pen = plot->d_grid->minPen(); cache.gridColors[1] = pen.color(); pen.setColor(color(pen.color(), MinorGrid)); plot->d_grid->setMinPen(pen); QIntDictIterator<QwtPlotCurve> itc(*plot->d_curves); for (QwtPlotCurve *c = itc.toFirst(); c != 0; c = ++itc ) { const int key = itc.currentKey(); QwtSymbol symbol = c->symbol(); QPen pen = symbol.pen(); cache.curveSymbolPenColors.insert(key, new QColor(pen.color())); pen.setColor(color(pen.color(), CurveSymbol, key)); symbol.setPen(pen); QBrush brush = symbol.brush(); cache.curveSymbolBrushColors.insert(key, new QColor(brush.color())); brush.setColor(color(brush.color(), CurveSymbol, key)); symbol.setBrush(brush); c->setSymbol(symbol); pen = c->pen(); cache.curveColors.insert(key, new QColor(pen.color())); pen.setColor(color(pen.color(), Curve, key)); c->setPen(pen); } QIntDictIterator<QwtPlotMarker> itm(*plot->d_markers); for (QwtPlotMarker *m = itm.toFirst(); m != 0; m = ++itm ) { const int key = itm.currentKey(); cache.markerFonts.insert(key, new QFont(m->font())); m->setFont(font(m->font(), Marker, key)); QPen pen = m->labelPen(); cache.markerLabelColors.insert(key, new QColor(pen.color())); pen.setColor(color(pen.color(), Marker, key)); m->setLabelPen(pen); pen = m->linePen(); cache.markerLineColors.insert(key, new QColor(pen.color())); pen.setColor(color(pen.color(), Marker, key)); m->setLinePen(pen); QwtSymbol symbol = m->symbol(); pen = symbol.pen(); cache.markerSymbolPenColors.insert(key, new QColor(pen.color())); pen.setColor(color(pen.color(), MarkerSymbol, key)); symbol.setPen(pen); QBrush brush = symbol.brush(); cache.markerSymbolBrushColors.insert(key, new QColor(brush.color())); brush.setColor(color(brush.color(), MarkerSymbol, key)); symbol.setBrush(brush); m->setSymbol(symbol); } }
/*! Reset color and fonts of a plot \sa QwtPlotPrintFilter::apply */ void QwtPlotPrintFilter::reset(QwtPlot *plot) const { if ( d_cache == 0 ) return; QFont *font; QColor *color; if ( plot->d_lblTitle ) { QPalette palette = plot->d_lblTitle->palette(); palette.setColor( QPalette::Active, QColorGroup::Foreground, d_cache->titleColor); plot->d_lblTitle->setPalette(palette); plot->d_lblTitle->setFont(d_cache->titleFont); } if ( plot->d_legend ) { QIntDictIterator<QWidget> it = plot->d_legend->itemIterator(); for ( QWidget *w = it.toFirst(); w != 0; w = ++it) { const int key = it.currentKey(); font = d_cache->legendFonts.find(key); if ( font ) w->setFont(*font); if ( w->inherits("QwtLegendButton") ) { QwtLegendButton *btn = (QwtLegendButton *)w; QwtSymbol symbol = btn->symbol(); color = d_cache->curveSymbolPenColors.find(key); if ( color ) { QPen pen = symbol.pen(); pen.setColor(*color); symbol.setPen(pen); } color = d_cache->curveSymbolBrushColors.find(key); if ( color ) { QBrush brush = symbol.brush(); brush.setColor(*color); symbol.setBrush(brush); } btn->setSymbol(symbol); color = d_cache->curveColors.find(key); if ( color ) { QPen pen = btn->curvePen(); pen.setColor(*color); btn->setCurvePen(pen); } } } } for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ ) { QwtScale *scale = plot->d_scale[axis]; if ( scale ) { QPalette palette = scale->palette(); palette.setColor(QPalette::Active, QColorGroup::Foreground, d_cache->scaleColor[axis]); scale->setPalette(palette); scale->setFont(d_cache->scaleFont[axis]); scale->setTitleColor(d_cache->scaleTitleColor[axis]); scale->setTitleFont(d_cache->scaleTitleFont[axis]); int startDist, endDist; scale->minBorderDist(startDist, endDist); scale->setBorderDist(startDist, endDist); } } plot->setBackgroundColor(d_cache->widgetBackground); plot->setCanvasBackground(d_cache->canvasBackground); QPen pen = plot->d_grid->majPen(); pen.setColor(d_cache->gridColors[0]); plot->d_grid->setMajPen(pen); pen = plot->d_grid->minPen(); pen.setColor(d_cache->gridColors[1]); plot->d_grid->setMinPen(pen); QIntDictIterator<QwtPlotCurve> itc(*plot->d_curves); for (QwtPlotCurve *c = itc.toFirst(); c != 0; c = ++itc ) { const int key = itc.currentKey(); QwtSymbol symbol = c->symbol(); color = d_cache->curveSymbolPenColors.find(key); if ( color ) { QPen pen = symbol.pen(); pen.setColor(*color); symbol.setPen(pen); } color = d_cache->curveSymbolBrushColors.find(key); if ( color ) { QBrush brush = symbol.brush(); brush.setColor(*color); symbol.setBrush(brush); } c->setSymbol(symbol); color = d_cache->curveColors.find(key); if ( color ) { QPen pen = c->pen(); pen.setColor(*color); c->setPen(pen); } } QIntDictIterator<QwtPlotMarker> itm(*plot->d_markers); for (QwtPlotMarker *m = itm.toFirst(); m != 0; m = ++itm ) { const int key = itm.currentKey(); font = d_cache->markerFonts.find(key); if ( font ) m->setFont(*font); color = d_cache->markerLabelColors.find(key); if ( color ) { QPen pen = m->labelPen(); pen.setColor(*color); m->setLabelPen(pen); } color = d_cache->markerLineColors.find(key); if ( color ) { QPen pen = m->linePen(); pen.setColor(*color); m->setLinePen(pen); } QwtSymbol symbol = m->symbol(); color = d_cache->markerSymbolPenColors.find(key); if ( color ) { QPen pen = symbol.pen(); pen.setColor(*color); symbol.setPen(pen); } color = d_cache->markerSymbolBrushColors.find(key); if ( color ) { QBrush brush = symbol.brush(); brush.setColor(*color); symbol.setBrush(brush); } m->setSymbol(symbol); } QwtPlotPrintFilter *that = (QwtPlotPrintFilter *)this; delete that->d_cache; that->d_cache = 0; }
void JobCreateScript(JobScriptOutput& output, const DubOptions *opt, bool bIncludeEditList = true, bool bIncludeTextInfo = true) { char *mem= NULL; char buf[4096]; long l; int audioSourceMode = g_project->GetAudioSourceMode(); switch(audioSourceMode) { case kVDAudioSourceMode_External: { const VDStringA& encodedFileName = VDEncodeScriptString(VDStringW(g_szInputWAVFile)); const VDStringA& encodedDriverName = VDEncodeScriptString(VDTextWToU8(g_project->GetAudioSourceDriverName(), -1)); // check if we have options to write out const InputFileOptions *opts = g_project->GetAudioSourceOptions(); if (opts) { int l; char buf[256]; l = opts->write(buf, (sizeof buf)/7*3); if (l) { membase64(buf+l, (char *)buf, l); output.addf("VirtualDub.audio.SetSource(\"%s\", \"%s\", \"%s\");", encodedFileName.c_str(), encodedDriverName.c_str(), buf+l); break; } } // no options output.addf("VirtualDub.audio.SetSource(\"%s\", \"%s\");", encodedFileName.c_str(), encodedDriverName.c_str()); } break; default: if (audioSourceMode >= kVDAudioSourceMode_Source) { int index = audioSourceMode - kVDAudioSourceMode_Source; if (!index) output.addf("VirtualDub.audio.SetSource(1);"); else output.addf("VirtualDub.audio.SetSource(1,%d);", index); break; } // fall through case kVDAudioSourceMode_None: output.addf("VirtualDub.audio.SetSource(0);"); break; } output.addf("VirtualDub.audio.SetMode(%d);", opt->audio.mode); output.addf("VirtualDub.audio.SetInterleave(%d,%d,%d,%d,%d);", opt->audio.enabled, opt->audio.preload, opt->audio.interval, opt->audio.is_ms, opt->audio.offset); output.addf("VirtualDub.audio.SetClipMode(%d,%d);", opt->audio.fStartAudio, opt->audio.fEndAudio); output.addf("VirtualDub.audio.SetConversion(%d,%d,%d,0,%d);", opt->audio.new_rate, opt->audio.newPrecision, opt->audio.newChannels, opt->audio.fHighQuality); if (opt->audio.mVolume >= 0.0f) output.addf("VirtualDub.audio.SetVolume(%d);", VDRoundToInt(256.0f * opt->audio.mVolume)); else output.addf("VirtualDub.audio.SetVolume();"); if (g_ACompressionFormat) { if (g_ACompressionFormat->mExtraSize) { mem = (char *)allocmem(((g_ACompressionFormat->mExtraSize+2)/3)*4 + 1); if (!mem) throw MyMemoryError(); membase64(mem, (char *)(g_ACompressionFormat+1), g_ACompressionFormat->mExtraSize); output.addf("VirtualDub.audio.SetCompressionWithHint(%d,%d,%d,%d,%d,%d,%d,\"%s\",\"%s\");" ,g_ACompressionFormat->mTag ,g_ACompressionFormat->mSamplingRate ,g_ACompressionFormat->mChannels ,g_ACompressionFormat->mSampleBits ,g_ACompressionFormat->mDataRate ,g_ACompressionFormat->mBlockSize ,g_ACompressionFormat->mExtraSize ,mem ,VDEncodeScriptString(g_ACompressionFormatHint).c_str() ); freemem(mem); } else output.addf("VirtualDub.audio.SetCompressionWithHint(%d,%d,%d,%d,%d,%d,\"%s\");" ,g_ACompressionFormat->mTag ,g_ACompressionFormat->mSamplingRate ,g_ACompressionFormat->mChannels ,g_ACompressionFormat->mSampleBits ,g_ACompressionFormat->mDataRate ,g_ACompressionFormat->mBlockSize ,VDEncodeScriptString(g_ACompressionFormatHint).c_str() ); } else output.addf("VirtualDub.audio.SetCompression();"); output.addf("VirtualDub.audio.EnableFilterGraph(%d);", opt->audio.bUseAudioFilterGraph); output.addf("VirtualDub.video.SetInputFormat(%d);", opt->video.mInputFormat); output.addf("VirtualDub.video.SetOutputFormat(%d);", opt->video.mOutputFormat); output.addf("VirtualDub.video.SetMode(%d);", opt->video.mode); output.addf("VirtualDub.video.SetSmartRendering(%d);", opt->video.mbUseSmartRendering); output.addf("VirtualDub.video.SetPreserveEmptyFrames(%d);", opt->video.mbPreserveEmptyFrames); output.addf("VirtualDub.video.SetFrameRate2(%u,%u,%d);", opt->video.mFrameRateAdjustHi, opt->video.mFrameRateAdjustLo, opt->video.frameRateDecimation); if (opt->video.frameRateTargetLo) { output.addf("VirtualDub.video.SetTargetFrameRate(%u,%u);", opt->video.frameRateTargetHi, opt->video.frameRateTargetLo); } output.addf("VirtualDub.video.SetIVTC(0, 0, 0, 0);"); if ((g_Vcompression.dwFlags & ICMF_COMPVARS_VALID) && g_Vcompression.fccHandler) { output.addf("VirtualDub.video.SetCompression(0x%08lx,%d,%d,%d);", g_Vcompression.fccHandler, g_Vcompression.lKey, g_Vcompression.lQ, g_Vcompression.lDataRate); l = ICGetStateSize(g_Vcompression.hic); if (l>0) { mem = (char *)allocmem(l + ((l+2)/3)*4 + 1); if (!mem) throw MyMemoryError(); if (ICGetState(g_Vcompression.hic, mem, l)<0) { freemem(mem); // throw MyError("Bad state data returned from compressor"); // Fine then, be that way. Stupid Pinnacle DV200 driver. mem = NULL; } if (mem) { membase64(mem+l, mem, l); // urk... Windows Media 9 VCM uses a very large configuration struct (~7K pre-BASE64). sprintf(buf, "VirtualDub.video.SetCompData(%d,\"", l); VDStringA line(buf); line += (mem+l); line += "\");"; output.adds(line.c_str()); freemem(mem); } } } else output.addf("VirtualDub.video.SetCompression();"); output.addf("VirtualDub.video.filters.Clear();"); // Add video filters FilterInstance *fa = (FilterInstance *)g_listFA.tail.next, *fa_next; int iFilter = 0; while(fa_next = (FilterInstance *)fa->next) { output.addf("VirtualDub.video.filters.Add(\"%s\");", strCify(fa->GetName())); if (fa->IsCroppingEnabled()) { const vdrect32& cropInsets = fa->GetCropInsets(); output.addf("VirtualDub.video.filters.instance[%d].SetClipping(%d,%d,%d,%d%s);" , iFilter , cropInsets.left , cropInsets.top , cropInsets.right , cropInsets.bottom , fa->IsPreciseCroppingEnabled() ? "" : ",0" ); } VDStringA scriptStr; if (fa->GetScriptString(scriptStr)) output.addf("VirtualDub.video.filters.instance[%d].%s;", iFilter, scriptStr.c_str()); if (!fa->IsEnabled()) output.addf("VirtualDub.video.filters.instance[%d].SetEnabled(false);", iFilter); VDParameterCurve *pc = fa->GetAlphaParameterCurve(); if (pc) { output.addf("declare curve = VirtualDub.video.filters.instance[%d].AddOpacityCurve();", iFilter); const VDParameterCurve::PointList& pts = pc->Points(); for(VDParameterCurve::PointList::const_iterator it(pts.begin()), itEnd(pts.end()); it!=itEnd; ++it) { const VDParameterCurvePoint& pt = *it; output.addf("curve.AddPoint(%g, %g, %d);", pt.mX, pt.mY, pt.mbLinear); } } ++iFilter; fa = fa_next; } // Add audio filters { VDAudioFilterGraph::FilterList::const_iterator it(g_audioFilterGraph.mFilters.begin()), itEnd(g_audioFilterGraph.mFilters.end()); int connidx = 0; int srcfilt = 0; output.addf("VirtualDub.audio.filters.Clear();"); for(; it!=itEnd; ++it, ++srcfilt) { const VDAudioFilterGraph::FilterEntry& fe = *it; output.addf("VirtualDub.audio.filters.Add(\"%s\");", strCify(VDTextWToU8(fe.mFilterName).c_str())); for(unsigned i=0; i<fe.mInputPins; ++i) { const VDAudioFilterGraph::FilterConnection& conn = g_audioFilterGraph.mConnections[connidx++]; output.addf("VirtualDub.audio.filters.Connect(%d, %d, %d, %d);", conn.filt, conn.pin, srcfilt, i); } VDPluginConfig::const_iterator itc(fe.mConfig.begin()), itcEnd(fe.mConfig.end()); for(; itc!=itcEnd; ++itc) { const unsigned idx = (*itc).first; const VDPluginConfigVariant& var = (*itc).second; switch(var.GetType()) { case VDPluginConfigVariant::kTypeU32: output.addf("VirtualDub.audio.filters.instance[%d].SetInt(%d, %d);", srcfilt, idx, var.GetU32()); break; case VDPluginConfigVariant::kTypeS32: output.addf("VirtualDub.audio.filters.instance[%d].SetInt(%d, %d);", srcfilt, idx, var.GetS32()); break; case VDPluginConfigVariant::kTypeU64: output.addf("VirtualDub.audio.filters.instance[%d].SetLong(%d, %I64d);", srcfilt, idx, var.GetU64()); break; case VDPluginConfigVariant::kTypeS64: output.addf("VirtualDub.audio.filters.instance[%d].SetLong(%d, %I64d);", srcfilt, idx, var.GetS64()); break; case VDPluginConfigVariant::kTypeDouble: output.addf("VirtualDub.audio.filters.instance[%d].SetDouble(%d, %g);", srcfilt, idx, var.GetDouble()); break; case VDPluginConfigVariant::kTypeAStr: output.addf("VirtualDub.audio.filters.instance[%d].SetString(%d, \"%s\");", srcfilt, idx, strCify(VDTextWToU8(VDTextAToW(var.GetAStr())).c_str())); break; case VDPluginConfigVariant::kTypeWStr: output.addf("VirtualDub.audio.filters.instance[%d].SetString(%d, \"%s\");", srcfilt, idx, strCify(VDTextWToU8(var.GetWStr(), -1).c_str())); break; case VDPluginConfigVariant::kTypeBlock: output.addf("VirtualDub.audio.filters.instance[%d].SetBlock(%d, %d, \"%s\");", srcfilt, idx, var.GetBlockLen(), VDEncodeBase64A(var.GetBlockPtr(), var.GetBlockLen()).c_str()); break; } } } } // Add subset information if (bIncludeEditList) { const FrameSubset& fs = g_project->GetTimeline().GetSubset(); output.addf("VirtualDub.subset.Clear();"); for(FrameSubset::const_iterator it(fs.begin()), itEnd(fs.end()); it!=itEnd; ++it) output.addf("VirtualDub.subset.Add%sRange(%I64d,%I64d);", it->bMask ? "Masked" : "", it->start, it->len); // Note that this must be AFTER the subset (we used to place it before, which was a bug). if (g_project->IsSelectionPresent()) { output.addf("VirtualDub.video.SetRangeFrames(%I64d,%I64d);", g_project->GetSelectionStartFrame(), g_project->GetSelectionEndFrame()); } else { output.addf("VirtualDub.video.SetRange();"); } } // Add text information if (bIncludeTextInfo) { typedef std::list<std::pair<uint32, VDStringA> > tTextInfo; const tTextInfo& textInfo = g_project->GetTextInfo(); output.addf("VirtualDub.project.ClearTextInfo();"); for(tTextInfo::const_iterator it(textInfo.begin()), itEnd(textInfo.end()); it!=itEnd; ++it) { char buf[5]={0}; memcpy(buf, &(*it).first, 4); output.addf("VirtualDub.project.AddTextInfo(\"%s\", \"%s\");", buf, VDEncodeScriptString((*it).second).c_str()); } } }
void UserConfig::fill() { ConfigItem::curIndex = 1; lstBox->clear(); Q3ListViewItem *parentItem; if (m_contact){ parentItem = new MainInfoItem(lstBox, CmdInfo); ClientDataIterator it(m_contact->clientData); void *data; while ((data = ++it) != NULL){ Client *client = m_contact->clientData.activeClient(data, it.client()); if (client == NULL) continue; CommandDef *cmds = client->infoWindows(m_contact, data); if (cmds){ parentItem = NULL; for (; cmds->text; cmds++){ if (parentItem){ new ClientItem(parentItem, it.client(), data, cmds); }else{ parentItem = new ClientItem(lstBox, it.client(), data, cmds); parentItem->setOpen(true); } } } } } parentItem = NULL; ClientUserData* data; if (m_contact) { data = &m_contact->clientData; } else { data = &m_group->clientData; } ClientDataIterator it(*data); list<unsigned> st; while (++it){ if ((it.client()->protocol()->description()->flags & PROTOCOL_AR_USER) == 0) continue; if (parentItem == NULL){ parentItem = new ConfigItem(lstBox, 0); parentItem->setText(0, i18n("Autoreply")); parentItem->setOpen(true); } for (const CommandDef *d = it.client()->protocol()->statusList(); d->text; d++){ if ((d->id == STATUS_ONLINE) || (d->id == STATUS_OFFLINE)) continue; list<unsigned>::iterator it; for (it = st.begin(); it != st.end(); ++it) if ((*it) == d->id) break; if (it != st.end()) continue; st.push_back(d->id); new ARItem(parentItem, d); } } parentItem = new ConfigItem(lstBox, 0); parentItem->setText(0, i18n("Settings")); parentItem->setPixmap(0, Pict("configure", lstBox->colorGroup().base()).pixmap()); parentItem->setOpen(true); CommandDef *cmd; CommandsMapIterator itc(CorePlugin::m_plugin->preferences); m_defaultPage = 0; while ((cmd = ++itc) != NULL){ new PrefItem(parentItem, cmd); if (m_defaultPage == 0) m_defaultPage = cmd->id; } QFontMetrics fm(lstBox->font()); unsigned w = 0; for (Q3ListViewItem *item = lstBox->firstChild(); item; item = item->nextSibling()){ w = QMAX(w, itemWidth(item, fm)); } lstBox->setFixedWidth(w); lstBox->setColumnWidth(0, w - 2); }