Example #1
0
Substitutions
Substitutions::operator*(const Substitution &s) const
{
    // composition
    Substitutions composition;

    // iterators
    ListIterator<Substitution *> ti(*psubs);

    // apply substitutions
    for ( ; !ti.done(); ti++)
    {
        Substitution newsub = (*ti())*s;
        if (!newsub.isDegenerate())
        {
            MustBeTrue(composition.insert(newsub) == OK);
        }
    }

    // copy any substitutions not in the original
    int found = 0;
    for (ti.reset() ; !ti.done(); ti++)
    {
        if (ti()->variable == s.variable)
        {
            found = 1;
            break;
        }
    }
    if (!found)
    {
        MustBeTrue(composition.insert(s) == OK);
    }
    return(composition);
}
Example #2
0
static void tCommentTokens() {
    TextInput::Settings settings;
    settings.generateCommentTokens = true;

    {
        TextInput ti(TextInput::FROM_STRING, "/* comment 1 */  //comment 2", settings);
        CHECK_BLOCK_COMMENT_TOKEN(ti, " comment 1 ", 1, 1);
        CHECK_LINE_COMMENT_TOKEN(ti, "comment 2", 1, 18);
    }

    {
        TextInput ti(TextInput::FROM_STRING, "/*\n comment\n 1 */  //comment 2", settings);
        CHECK_BLOCK_COMMENT_TOKEN(ti, "\n comment\n 1 ", 1, 1);
        CHECK_LINE_COMMENT_TOKEN(ti, "comment 2", 3, 8);
    }

    settings.otherCommentCharacter = '#';
    settings.otherCommentCharacter2 = ';';

    {
        TextInput ti(TextInput::FROM_STRING, "/* comment 1 */\n;comment 2\n#comment 3  //some text", settings);
        CHECK_BLOCK_COMMENT_TOKEN(ti, " comment 1 ", 1, 1);
        CHECK_LINE_COMMENT_TOKEN(ti, "comment 2", 2, 1);
        CHECK_LINE_COMMENT_TOKEN(ti, "comment 3  //some text", 3, 1);
    }
}
Example #3
0
int task_module::do_update_acceptable_task_list(player_obj *player, out_stream &os)
{
  static int t_int_vect[MAX_TASK_NUM];
  int add_len = 0;
  int del_len = 0;
  // head:add               tail:del
  ilist<int> &tl = task_config::instance()->get_all_task_list();
  for (ilist_node<int> *itor = tl.head();
       itor != NULL;
       itor = itor->next_)
  {
    int task_cid = itor->value_;
    bool in_acpt_list = task_module::is_in_acceptable_list(player, task_cid);

    const task_cfg_obj *tco = task_config::instance()->find(task_cid);
    if (NULL == tco) continue;

    if (!task_module::can_accept(player, tco))
    {
      if (in_acpt_list)
      {
        del_len++;
        t_int_vect[MAX_TASK_NUM - del_len] = task_cid;
        player->task_data_->task_acceptable_list_.remove(task_cid);
      }
    }else
    {
      if (!in_acpt_list)
      {
        t_int_vect[add_len] = task_cid;
        add_len++;
        player->task_data_->task_acceptable_list_.push_back(task_cid);
      }
    }
  }
  int total = add_len + del_len;
  if (0 == total) return 0;

  if (total >= 127)
  {
    e_log->wning("char %d update task list is too large [%d]!",
                 player->id(), total);
    total = 126;
  }

  for (int i = 0; i < add_len; ++i)
  {
    task_info ti(player->id(), t_int_vect[i], TASK_ST_ACCEPTABLE);
    task_module::do_fetch_task_info(player, TASK_ADD, &ti, os);
  }
  for (int i = MAX_TASK_NUM - del_len; i < MAX_TASK_NUM; ++i)
  {
    task_info ti(player->id(), t_int_vect[i], TASK_ST_ACCEPTABLE);
    task_module::do_fetch_task_info(player, TASK_DEL, &ti, os);
  }
  return total;
}
void
GenericRWLockImpl<IdT, CompareT>::acquireReadLock(const IdT id, const Timeout& timeout)
{
	TimeoutTimer timer(timeout);

	NonRecursiveMutexLock l(m_guard);
	typename IdMap::iterator info = m_lockerInfo.find(id);

	if (info != m_lockerInfo.end())
	{
		LockerInfo& ti(info->second);
		// id already have a read or write lock, so just increment.
		BLOCXX_ASSERT(ti.isReader() || ti.isWriter());
		++ti.readCount;
		return;
	}

	// id is a new reader
	while (!m_canRead || m_numWriters > 0)
	{
		if (!m_waiting_readers.timedWait(l, timer.asAbsoluteTimeout()))
		{
			BLOCXX_THROW(TimeoutException, "Timeout while waiting for read lock.");
		}
	}

	// Increase the reader count
	LockerInfo lockerInfo;
	lockerInfo.readCount = 1;
	lockerInfo.writeCount = 0;
	m_lockerInfo.insert(typename IdMap::value_type(id, lockerInfo));

	++m_numReaders;
}
bool LLNotificationsListener::Forwarder::matchType(const LLSD& filter, const std::string& type) const
{
    // Decide whether this notification matches filter:
    // undefined: forward all notifications
    if (filter.isUndefined())
    {
        return true;
    }
    // array of string: forward any notification matching any named type
    if (filter.isArray())
    {
        for (LLSD::array_const_iterator ti(filter.beginArray()), tend(filter.endArray());
             ti != tend; ++ti)
        {
            if (ti->asString() == type)
            {
                return true;
            }
        }
        // Didn't match any entry in the array
        return false;
    }
    // string: forward only the specific named type
    return (filter.asString() == type);
}
Example #6
0
void GPUProgram::BindingTable::parse(const std::string& code) {
    bindingArray.resize(0);

    TextInput ti(TextInput::FROM_STRING, code);
    
    while (ti.hasMore()) {
        Token t = ti.read();
        // Scan for "#"
        while (! symbolMatch(t, "#") && ti.hasMore()) {
            t = ti.read();
        }
    
        if (ti.hasMore()) {
            // Read the comment line
            Token t = ti.peek();
            if (t.type() == Token::SYMBOL) {
                ti.readSymbol();
                if (t.string() == "var") {

                    parseVariable(ti);

                } else if (t.string() == "const") {
                    
                    parseConstant(ti);

                }
            }
        }
    }
}
Example #7
0
//== do_xx method
int task_module::do_send_task_list_2_client(player_obj *player)
{
  out_stream os(client::send_buf, client::send_buf_len);
  char *cnt_ptr = os.wr_ptr();
  *cnt_ptr = 0;
  os << (char)0;

  task_info_map_itor itor = player->task_data_->task_info_map_.begin();
  for (int n = 0;
       itor != player->task_data_->task_info_map_.end() && n < 127;
       ++itor, ++n)
  {
    task_module::do_fetch_task_info(player, TASK_ADD, itor->second, os);
    (*cnt_ptr)++;
  }

  ilist_node<int> *acpt_itor = player->task_data_->task_acceptable_list_.head();
  for (; acpt_itor != NULL; acpt_itor = acpt_itor->next_)
  {
    task_info ti(player->id(), acpt_itor->value_, TASK_ST_ACCEPTABLE);
    task_module::do_fetch_task_info(player, TASK_ADD, &ti, os);
    (*cnt_ptr)++; 
  }
  return player->send_respond_ok(NTF_TASK_UPDATE, &os);
}
Example #8
0
  void volume_file_info::calcMinMax(unsigned int var, unsigned int time) const
  {
    thread_info ti(BOOST_CURRENT_FUNCTION);

    volume vol;
    const uint64 maxdim = 128; //read in 128^3 chunks
    for(unsigned int off_z = 0; off_z < ZDim(); off_z+=maxdim)
      for(unsigned int off_y = 0; off_y < YDim(); off_y+=maxdim)
	for(unsigned int off_x = 0; off_x < XDim(); off_x+=maxdim)
	  {
	    dimension read_dim(std::min(XDim()-off_x,maxdim),
			       std::min(YDim()-off_y,maxdim),
			       std::min(ZDim()-off_z,maxdim));
	    readVolumeFile(vol,filename(),var,time,
			   off_x,off_y,off_z,read_dim);
	    if(off_x==0 && off_y==0 && off_z==0)
	      {
		_data._min[var][time] = vol.min();
		_data._max[var][time] = vol.max();
	      }
	    else
	      {
		if(_data._min[var][time] > vol.min())
		  _data._min[var][time] = vol.min();
		if(_data._max[var][time] < vol.max())
		  _data._max[var][time] = vol.max();
	      }
	  }

    _data._minIsSet[var][time] = true;
    _data._maxIsSet[var][time] = true;
  }
Example #9
0
/* static */
void wxToolTip::UpdateVisibility()
{
    wxToolInfo ti(NULL, 0, wxRect());
    ti.uFlags = 0;

    if ( !SendTooltipMessage(ms_hwndTT, TTM_GETCURRENTTOOL, &ti) )
        return;

    wxWindow* const associatedWindow = wxFindWinFromHandle(ti.hwnd);
    if ( !associatedWindow )
        return;

    bool hideTT = false;
    if ( !associatedWindow->IsShownOnScreen() )
    {
        // If the associated window or its parent is hidden, the tooltip
        // shouldn't remain shown.
        hideTT = true;
    }
    else
    {
        // Even if it's not hidden, it could also be iconized.
        wxTopLevelWindow* const
            frame = wxDynamicCast(wxGetTopLevelParent(associatedWindow), wxTopLevelWindow);

        if ( frame && frame->IsIconized() )
            hideTT = true;
    }

    if ( hideTT )
        ::ShowWindow(ms_hwndTT, SW_HIDE);
}
Example #10
0
void Step::
        finishTask(Step::ptr step, int taskid, pBuffer result)
{
    Interval result_interval;
    if (result)
        result_interval = result->getInterval ();

    TASKINFO TaskInfo ti(format("Step::finishTask %2% on %1%")
              % step.raw ()->operation_name()
              % result_interval);

    if (result) {
        // Result must have the same number of channels and sample rate as previous cache.
        // Call deprecateCache(Interval::Interval_ALL) to erase the cache when chainging number of channels or sample rate.
        step.raw ()->cache_->put (result);
    }

    auto self = step.write ();
    int matched_task = self->running_tasks.count (taskid);
    if (1 != matched_task) {
        Log("C = %d, taskid = %x on %s") % matched_task % taskid % self->operation_name ();
        EXCEPTION_ASSERT_EQUALS( 1, matched_task );
    }

    Intervals expected_output = self->running_tasks[ taskid ];

    Intervals update_miss = expected_output - result_interval;
    self->not_started_ |= update_miss;

    if (!result) {
        TASKINFO TaskInfo(format("The task was cancelled. Restoring %1% for %2%")
                 % update_miss
                 % self->operation_name());
    } else {
        if (update_miss) {
            TaskInfo(format("These samples were supposed to be updated by the task but missed: %1% by %2%")
                     % update_miss
                     % self->operation_name());
        }
        if (result_interval - expected_output) {
            // These samples were not supposed to be updated by the task but were calculated anyway
            TaskInfo(format("Unexpected extras: %1% = (%2%) - (%3%) from %4%")
                     % (result_interval - expected_output)
                     % result_interval
                     % expected_output
                     % self->operation_name());

            // The samples are still marked as invalid. Would need to remove the
            // extra calculated samples from not_started_ but that would fail
            // in a situation where deprecatedCache is called after the task has
            // been created. So not_started_ can't be modified here (unless calls
            // to deprecatedCache were tracked).
        }
    }

    self->running_tasks.erase ( taskid );
    self.unlock ();

    step.raw ()->wait_for_tasks_.notify_all ();
}
Example #11
0
void main()
{
ThreadedTree t;
t.setup();
ThreadedInorderIterator ti(t);
ti.Inorder();
}
Example #12
0
void DoCleanup( void )
{
	int num_threads = 0, num_processes = 0;
	char process_name[1024];

	for ( PROCESS_ITER pi(Processes); pi; pi.Next() )
	{
		PROCESS *p = pi;
		if (p->IsSignalled())
			continue;
		num_processes++;
		fprintf(stderr, "process %04lx ", p->Id);
		if (p->Exe)
		{
			//fprintf(stderr, "%ws\n",  (((PE_SECTION *)(p->Exe))->ImageFileName).Buffer);
			SPrintUnicodeString(process_name, 1024, &(((PE_SECTION *)(p->Exe))->ImageFileName));
			fprintf(stderr, "%s\n", process_name);
		}
		else
			fprintf(stderr, "noname\n");

		for ( SIBLING_ITER ti(p->Threads); ti; ti.Next() )
		{
			THREAD *t = ti;
			if (t->IsSignalled())
				continue;
			fprintf(stderr, "\tthread %04lx\n", t->TraceId());
			num_threads++;
		}
	}
	if (num_threads || num_processes)
		fprintf(stderr, "%d threads %d processes left\n", num_threads, num_processes);
}
Example #13
0
void SendFeedbackDialog::
        replyFinished(QNetworkReply* reply)
{
    QString s = reply->readAll();
    TaskInfo ti("SendFeedback reply");
    TaskInfo("%s", s.replace("\\r\\n","\n").replace("\r","").toStdString().c_str());
    if (QNetworkReply::NoError != reply->error())
    {
        TaskInfo("SendFeedback error=%s (code %d)",
                 QNetworkReply::NoError == reply->error()?"no error":reply->errorString().toStdString().c_str(),
                 (int)reply->error());
    }

    if (QNetworkReply::NoError != reply->error())
        QMessageBox::warning(dynamic_cast<QWidget*>(parent()), "Could not send feedback", reply->errorString() + "\n" + s);
    else if (s.contains("sorry", Qt::CaseInsensitive) ||
             s.contains("error", Qt::CaseInsensitive) ||
             s.contains("fatal", Qt::CaseInsensitive) ||
             s.contains("fail", Qt::CaseInsensitive) ||
             s.contains("html", Qt::CaseInsensitive) ||
             !s.contains("sendfeedback finished", Qt::CaseInsensitive))
    {
        QMessageBox::warning(dynamic_cast<QWidget*>(parent()), "Could not send feedback", s);
    }
    else
    {
        QDialog::accept();
        QMessageBox::information(dynamic_cast<QWidget*>(parent()), "Feedback", "Your input has been sent. Thank you!");
        ui->textEditMessage->setText ("");
        ui->lineEditAttachFile->setText ("");
    }

    setEnabled( true );
}
Example #14
0
void ToonzImageData::getData(TRasterP &copiedRaster, double &dpiX, double &dpiY,
							 std::vector<TRectD> &rects, std::vector<TStroke> &strokes, std::vector<TStroke> &originalStrokes,
							 TAffine &transformation, TPalette *targetPalette) const
{
	if (!m_copiedRaster || (m_rects.empty() && m_strokes.empty()))
		return;
	copiedRaster = m_copiedRaster->clone();
	dpiX = m_dpiX;
	dpiY = m_dpiY;
	assert(m_palette);
	int i;
	for (i = 0; i < (int)m_rects.size(); i++)
		rects.push_back(m_rects[i]);
	for (i = 0; i < (int)m_strokes.size(); i++)
		strokes.push_back(m_strokes[i]);
	for (i = 0; i < (int)m_originalStrokes.size(); i++)
		originalStrokes.push_back(m_originalStrokes[i]);

	transformation = m_transformation;
	TRasterCM32P cmRas = copiedRaster;

	if (!targetPalette)
		targetPalette = new TPalette();

	if (!cmRas)
		return;
	std::set<int> usedStyles(m_usedStyles);
	TToonzImageP ti(cmRas, cmRas->getBounds());
	if (usedStyles.size() == 0)
		ToonzImageUtils::getUsedStyles(usedStyles, ti);
	std::map<int, int> indexTable;
	mergePalette(targetPalette, indexTable, m_palette, usedStyles);
	ToonzImageUtils::scrambleStyles(ti, indexTable);
	ti->setPalette(m_palette.getPointer());
}
Example #15
0
void TooltipView::
        draw()
{
    if (!model_->comment)
        return;

    if (!initialized)
        initialize();

    //if (visible)
    {
        drawMarkers();

        if (model_->automarking == TooltipModel::AutoMarkerWorking)
        {
            TaskInfo ti("TooltipView doesn't have all data yet");

            std::string prev_html = model_->comment->html();
            model_->showToolTip( model_->pos() );

            std::string html = model_->comment->html();

            if (model_->automarking != TooltipModel::AutoMarkerWorking)
                TaskInfo("TooltipView just finished\n%s", html.c_str());
            else if(html != prev_html)
                TaskInfo("Changed tooltip\n%s", html.c_str());

            render_view_->redraw();

            emit tooltipChanged();
        }
    }
}
Example #16
0
File: t6.c Project: 00001/plan9port
void
r_ti(int argc, Rune **argv)
{
	USED(argc);
	br();
	ti(evalscale(argv[1], 'm'));
}
Example #17
0
  //
  // Obj::PostLoad
  //
  // Post Load the Obj
  //
  void Obj::PostLoad()
  {
    // Resolve tag specific location messages
    for (BinTree<Location>::Iterator gi(&tags); *gi; gi++)
    {
      (*gi)->PostLoad();
    }

    // Resovle type specific location messages
    for (BinTree<Location>::Iterator ti(&types); *ti; ti++)
    {
      (*ti)->PostLoad();
    }

    // Resolve category specific location messages
    for (List<PropertyLocation>::Iterator pi(&properties); *pi; pi++)
    {
      (*pi)->PostLoad();
    }

    // Resolve default location (if there is one)
    if (defaultLocation)
    {
      defaultLocation->PostLoad();
    }
  }
Example #18
0
  void test_specialize_transforms_ivars_to_slots() {
    CompiledMethod* cm = CompiledMethod::create(state);
    Tuple* tup = Tuple::from(state, 1, state->symbol("@blah"));
    cm->literals(state, tup);

    InstructionSequence* iseq = InstructionSequence::create(state, 3);
    iseq->opcodes()->put(state, 0, Fixnum::from(InstructionSequence::insn_push_ivar));
    iseq->opcodes()->put(state, 1, Fixnum::from(0));
    iseq->opcodes()->put(state, 2, Fixnum::from(InstructionSequence::insn_push_nil));

    cm->iseq(state, iseq);

    VMMethod* vmm = new VMMethod(state, cm);

    Object::Info ti(ObjectType);
    ti.slots[state->symbol("@blah")->index()] = 5;
    ti.slot_locations.resize(6);
    ti.slot_locations[5] = 33;
    vmm->specialize(state, cm, &ti);

    TS_ASSERT_EQUALS(vmm->total, 3U);
    TS_ASSERT_EQUALS(vmm->opcodes[0], static_cast<unsigned int>(InstructionSequence::insn_push_my_offset));
    TS_ASSERT_EQUALS(vmm->opcodes[1], 33U);
    TS_ASSERT_EQUALS(vmm->opcodes[2], static_cast<unsigned int>(InstructionSequence::insn_push_nil));
  }
Example #19
0
static void tfunc1() {
    // Basic line number checking test.  Formerly would skip over line
    // numbers (i.e., report 1, 3, 5, 7 as the lines for the tokens), because
    // the newline would be consumed, pushed back to the input stream, then
    // consumed again (reincrementing the line number.)
    {
        TextInput ti(TextInput::FROM_STRING, "foo\nbar\nbaz\n");
        CHECK_SYM_TOKEN(ti, "foo", 1, 1);
        CHECK_SYM_TOKEN(ti, "bar", 2, 1);
        CHECK_SYM_TOKEN(ti, "baz", 3, 1);
        CHECK_END_TOKEN(ti,        4, 1);
    }
	
    CHECK_ONE_SPECIAL_SYM("@");
    CHECK_ONE_SPECIAL_SYM("(");
    CHECK_ONE_SPECIAL_SYM(")");
    CHECK_ONE_SPECIAL_SYM(",");
    CHECK_ONE_SPECIAL_SYM(";");
    CHECK_ONE_SPECIAL_SYM("{");
    CHECK_ONE_SPECIAL_SYM("}");
    CHECK_ONE_SPECIAL_SYM("[");
    CHECK_ONE_SPECIAL_SYM("]");
    CHECK_ONE_SPECIAL_SYM("#");
    CHECK_ONE_SPECIAL_SYM("$");
    CHECK_ONE_SPECIAL_SYM("?");
}
Example #20
0
bool GlobePicker::_intersectBound(iiMath::bound b, int recLevel, iiMath::matrix4 &modelMat)
{
	bool ret = false;
	iiMath::bound bc;
	PatchIdentity d;
	Utils::boundingBoxToPatch(b, d);
	double elev = 0;
	
	if(globeConfig::instance()->isUseElev())
	{
		TextureInterpolator ti( d );
		elev = ti.sample(0.5,0.5);
	}

	iiMath::vec3 n = Utils::WGS84_to_Cartesian( iiMath::vec3(b.center().y(), b.center().x(), elev) );
	iiMath::vec3 v = n * (_R * _T);

	iiMath::vec3 n1 = Utils::WGS84_to_Cartesian( iiMath::vec3(b.center().y() + b.radius(), b.center().x() + b.radius(), elev) );
	iiMath::vec3 v1 = n1 * (_R * _T);

	bc.set( v.v, (v-v1).length() );

	iiMath::bound bb = calcNewBound(bc, modelMat);

	if (intersect(bb))
	{
		if(recLevel > 8)
		{
			double latc = b.center().y();
			double lngc = b.center().x();

			if(lastHit.lat==0)
				lastHit.lat = latc;
			else
				lastHit.lat = (lastHit.lat + latc) / 2.0;
			if(lastHit.lng==0)
				lastHit.lng = lngc;
			else
				lastHit.lng = (lastHit.lng + lngc) / 2.0;

			return true;
		}

		iiMath::bound b0, b1, b2, b3;
		double radius2 = (b.radius()/2.0) * 1.4;
		b0.set(iiMath::vec3(b.center().x()-radius2, b.center().y()-radius2, elev), radius2);
		b1.set(iiMath::vec3(b.center().x()+radius2, b.center().y()-radius2, elev), radius2);
		b2.set(iiMath::vec3(b.center().x()-radius2, b.center().y()+radius2, elev), radius2);
		b3.set(iiMath::vec3(b.center().x()+radius2, b.center().y()+radius2, elev), radius2);
		int nextLevel = recLevel+1;
		bool r0, r1, r2, r3;
		r0 = _intersectBound(b0, nextLevel, modelMat);
		r1 = _intersectBound(b1, nextLevel, modelMat);
		r2 = _intersectBound(b2, nextLevel, modelMat);
		r3 = _intersectBound(b3, nextLevel, modelMat);
		ret = (r0 || r1 || r2 || r3);
	}

	return ret;
}
Example #21
0
ExportAudioDialog::ExportAudioDialog(
        Sawe::Project* project,
        SelectionModel* selection_model,
        RenderView* render_view
        )
            :
    QDialog(project->mainWindow()),
    ui(new Ui::ExportAudioDialog),
    project(project),
    selection_model(selection_model),
    render_view(render_view),
    total(0),
    drawnFinished_(false)
{
    EXCEPTION_ASSERTX(false, "not implemented: exportTarget");

    TaskInfo ti("ExportAudioDialog");
    ui->setupUi(this);

    update_timer.setSingleShot( true );
    update_timer.setInterval( 100 );
    connect( &update_timer, SIGNAL( timeout() ), SLOT( callUpdate() ) );

    setupGui();
}
Example #22
0
//..
// Now, we write a test function, 'runTest', to verify our simple wrapper
// type.  We start by wrapping a simple 'int' value:
//..
    void runTests()
    {
        int i = 42;

        Wrapper<int> ti(i);  const Wrapper<int>& TI = ti;
        ASSERT(42 == i);
        ASSERT(42 == TI.value());

        ti.value() = 13;
        ASSERT(42 == i);
        ASSERT(13 == TI.value());
//..
// Finally, we test 'Wrapper' with a reference type:
//..
        Wrapper<int&> tr(i);  const Wrapper<int&>& TR = tr;
        ASSERT(42 == i);
        ASSERT(42 == TR.value());

        tr.value() = 13;
        ASSERT(13 == i);
        ASSERT(13 == TR.value());

        i = 42;
        ASSERT(42 == i);
        ASSERT(42 == TR.value());
    }
Example #23
0
void      
TUrlLink::SetTooltip(TTooltip* tooltip)
{
  // Cleanup; via Condemned list if tooltip was created
  //
  if (Tooltip) {
    if (Tooltip->GetHandle())
      Tooltip->SendMessage(WM_CLOSE);
    else
      delete Tooltip;
  }

  // Store new tooltip and create if necessary
  //
  Tooltip = tooltip;
  if (Tooltip) {
    if(GetHandle() && !Tooltip->GetHandle()) {
      // Make sure tooltip is disabled so it does not take input focus
      Tooltip->ModifyStyle(0,WS_DISABLED);
      Tooltip->Create();
      TRect rect;
       GetClientRect(rect);
      TToolInfo ti(*this, rect, TOOLTIP_ID);
      ti.SetText(UrlAddress.c_str());
      Tooltip->AddTool(ti);
    }
  }
}
Example #24
0
void SaweTestClass::
        exec()
{
    TaskTimer ti("%s::%s", vartype(*this).c_str(), __FUNCTION__, NULL);

    Sawe::Application::global_ptr()->exec();
}
Example #25
0
btCollisionShape* VRPhysics::getConcaveShape() {
    btTriangleMesh* tri_mesh = new btTriangleMesh();

    vector<OSG::VRObject*> geos = vr_obj->getObjectListByType("Geometry");
    int N = 0;
	for (unsigned int j = 0; j<geos.size(); j++) {
        OSG::VRGeometry* geo = (OSG::VRGeometry*)geos[j];
        if (geo == 0) continue;
        if (geo->getMesh() == 0) continue;
        OSG::TriangleIterator ti(geo->getMesh());

        btVector3 vertexPos[3];

        while(!ti.isAtEnd()) {
            for (int i=0;i<3;i++) {
                OSG::Pnt3f p = ti.getPosition(i);
                for (int j=0;j<3;j++) vertexPos[i][j] = p[j];
            }

            tri_mesh->addTriangle(vertexPos[0]*scale[0], vertexPos[1]*scale[1], vertexPos[2]*scale[2]);
            ++ti;
            N++;
        }
    }
    if (N == 0) return 0;

    //cout << "\nConstruct Concave shape for " << vr_obj->getName() << endl;
    btBvhTriangleMeshShape* shape = new btBvhTriangleMeshShape(tri_mesh, true);
    return shape;
}
Example #26
0
bool
Tempo_Point::edit ( float *tempo )
{
    Tempo_Point_Editor ti( tempo );

    return ti.sucess();
}
Example #27
0
void ExternalAligner::read_alignment(Strings& rows,
                                     const std::string& file) const {
    TimeIncrementer ti(this);
    boost::shared_ptr<std::istream> aligned = name_to_istream(file);
    AlignmentReader reader(rows, *aligned);
    reader.read_all_sequences();
}
Example #28
0
void Sphere::readInUnitSphere(){
	ifstream file;
	file.open("data/objects/sphere.tri");
	if(!file.is_open()){
		cout<<"Cannot read in data/objects/sphere.tri!\n"<<flush;
		getchar();
	}
	int nPoint;
	file >> nPoint;
	for(int i = 0; i < nPoint; i++){
		double x,y,z;
		file >> x;
		file >> y;
		file >> z;
		MyPoint3D p(x,y,z);
		points.push_back(p);
	}
	int nIndex;
	file >> nIndex;
	for(int i = 0; i < nIndex; i++){
		int i0,i1,i2;
		file >> i0;
		file >> i1;
		file >> i2;
		TriFaceIndex ti(i0,i1,i2);
		indexes.push_back(ti);
	}
	file.close();
}
Example #29
0
void DataFilesModel::sort(int column, Qt::SortOrder order)
{
    // TODO: Make this more efficient
    emit layoutAboutToBeChanged();

    QList<EsmFile *> sortedFiles;

    QMultiMap<QString, QString> timestamps;

    foreach (EsmFile *file, mFiles)
        timestamps.insert(file->modified().toString(Qt::ISODate), file->fileName());

    QMapIterator<QString, QString> ti(timestamps);

    while (ti.hasNext()) {
        ti.next();

        QModelIndex index = indexFromItem(findItem(ti.value()));

        if (!index.isValid())
            continue;

        EsmFile *file = item(index.row());

        if (!file)
            continue;

        sortedFiles.append(file);
    }

    mFiles.clear();
    mFiles = sortedFiles;

    emit layoutChanged();
}
Example #30
0
static LLSD getTabInfo(LLPanel* tab)
{
    LLSD panels;
    for (LLPanel::tree_iterator_t ti(tab->beginTreeDFS()), tend(tab->endTreeDFS());
         ti != tend; ++ti)
    {
        // *ti is actually an LLView*, which had better not be NULL
        LLView* view(*ti);
        if (! view)
        {
            LL_ERRS("LLSideTrayListener") << "LLSideTrayTab '" << tab->getName()
                                          << "' has a NULL child LLView*" << LL_ENDL;
        }

        // The logic we use to decide what "panel" names to return is heavily
        // based on LLSideTray::showPanel(): the function that actually
        // implements the "SideTray.ShowPanel" operation. showPanel(), in
        // turn, depends on LLSideTray::openChildPanel(): when
        // openChildPanel() returns non-NULL, showPanel() stops searching
        // attached and detached LLSideTrayTab tabs.

        // For each LLSideTrayTab, openChildPanel() first calls
        // findChildView(panel_name, true). In other words, panel_name need
        // not be a direct LLSideTrayTab child, it's sought recursively.
        // That's why we use (begin|end)TreeDFS() in this loop.

        // But this tree_iterator_t loop will actually traverse every widget
        // in every panel. Returning all those names will not help our caller:
        // passing most such names to openChildPanel() would not do what we
        // want. Even though the code suggests that passing ANY valid
        // side-panel widget name to openChildPanel() will open the tab
        // containing that widget, results could get confusing since followup
        // (onOpen()) logic wouldn't be invoked, and showPanel() wouldn't stop
        // searching because openChildPanel() would return NULL.

        // We must filter these LLView items, using logic that (sigh!) mirrors
        // openChildPanel()'s own.

        // openChildPanel() returns a non-NULL LLPanel* when either:
        // - the LLView is a direct child of an LLSideTrayPanelContainer
        // - the LLView is itself an LLPanel.
        // But as LLSideTrayPanelContainer can directly contain LLView items
        // that are NOT themselves LLPanels (e.g. "sidebar_me" contains an
        // LLButton called "Jump Right Arrow"), we'd better focus only on
        // LLSideTrayPanelContainer children that are themselves LLPanel
        // items. Which means that the second test completely subsumes the
        // first.
        LLPanel* panel(dynamic_cast<LLPanel*>(view));
        if (panel)
        {
            // Maybe it's overkill to construct an LLSD::Map for each panel, but
            // the possibility remains that we might want to deliver more info
            // about each panel than just its name.
            panels.append(LLSDMap("name", panel->getName()));
        }
    }

    return LLSDMap("panels", panels);
}