Example #1
0
    void show()
    {
      openfluid::core::UnitsCollection* TestUnitsColl = 0;

      if (!mp_SimulationBlob)
      {
        mp_Dialog->set_message("I am DummyModalWindow\n"
          "Nb of units in TestUnits class: no CoreRepository\n"
          "Nothing to do");
      }
      else
      {
        unsigned int Size = 0;

        TestUnitsColl = mp_SimulationBlob->getCoreRepository().getUnits(
            "TestUnits");

        if (TestUnitsColl)
          Size = TestUnitsColl->getList()->size();

        mp_Dialog->set_message(Glib::ustring::compose("I am DummyModalWindow\n"
          "Nb of units in TestUnits class: %1\n"
          "Clicking ok will add a Unit of class \"TestUnits\"", Size));
      }

      if (mp_Dialog->run() == Gtk::RESPONSE_OK && mp_SimulationBlob)
      {
        unsigned int NextId = 1;

        if (TestUnitsColl)
        {
          openfluid::core::UnitsList_t* TestUnits = TestUnitsColl->getList();
          if (!TestUnits->empty())
          {
            NextId = TestUnits->end().operator --()->getID() + 1;

            while (TestUnitsColl->getUnit(NextId))
              NextId++;
          }

        }

        openfluid::core::Unit U("TestUnits", NextId, 1,
            openfluid::core::InstantiationInfo::DESCRIPTOR);

        mp_SimulationBlob->getCoreRepository().addUnit(U);

        signal_ChangedOccurs().emit();
      }

      mp_Dialog->hide();
    }
    void onRefresh()
    {
      unsigned int Size = 0;

      if (!mp_SimulationBlob)
        mp_Dialog->set_message("I am DummyModelessWindow\n"
          "Nb of units in TestUnits class: no CoreRepository\n"
          "Nothing to do");
      else
      {
        mp_TestUnitsColl = mp_SimulationBlob->getCoreRepository().getUnits(
            "TestUnits");

        if (mp_TestUnitsColl)
          Size = mp_TestUnitsColl->getList()->size();

        mp_Dialog->set_message(Glib::ustring::compose(
            "I am DummyModelessWindow\n"
              "Nb of units in TestUnits class: %1\n"
              "Clicking ok will add a Unit of class \"TestUnits\"", Size));
      }
    }
Example #3
0
void ErrorPopup::on_message(const Glib::ustring& msg_, GxLogger::MsgType tp, bool plugged) {
    if (plugged) {
	return;
    }
    if (tp == GxLogger::kError) {
	if (active) {
	    msg += "\n" + msg_;
	    if (msg.size() > 1000) {
		msg.substr(msg.size()-1000);
	    }
	    if (dialog) {
		dialog->set_message(msg);
	    }
	} else {
	    msg = msg_;
	    active = true;
	    show_msg();
	}
    }
}