Ejemplo n.º 1
0
void tellstdfunc::stdDRAWWIRE::undo() {
   TEUNDO_DEBUG("drawwire(real, int) UNDO");
   telldata::ttlayout* wr = static_cast<telldata::ttlayout*>(UNDOPstack.front());UNDOPstack.pop_front();
   word la = getWordValue(UNDOPstack, true);
   laydata::tdtdesign* ATDB = DATC->lockDB();
      ATDB->destroy_this(wr->data(),la, DATC->TEDLIB());
   DATC->unlockDB();
   delete (wr);
   RefreshGL();
}
Ejemplo n.º 2
0
void tellstdfunc::stdCHANGELAY::undo()
{
   telldata::ttlist* pl = static_cast<telldata::ttlist*>(UNDOPstack.front());UNDOPstack.pop_front();
   word src = getWordValue(UNDOPstack, true);
   laydata::tdtdesign* ATDB = DATC->lockDB();
      ATDB->transferLayer(get_ttlaylist(pl), src);
   DATC->unlockDB();
   delete pl;
   RefreshGL();
}
Ejemplo n.º 3
0
void tellstdfunc::stdHIDECELLBOND::undo() {
   TEUNDO_DEBUG("hide_cellbox( bool ) UNDO");
   bool        hide  = getBoolValue(UNDOPstack,true);
   DATC->setcellbox_hidden(hide);
   wxCommandEvent eventGRIDUPD(wxEVT_SETINGSMENU);
   eventGRIDUPD.SetInt((hide ? tui::STS_CELLBOX_OFF : tui::STS_CELLBOX_ON));
   wxPostEvent(TopedCanvasW, eventGRIDUPD);
   LogFile << LogFile.getFN() << "(" << LogFile._2bool(hide) << ");"; LogFile.flush();
   RefreshGL();
}
Ejemplo n.º 4
0
int tellstdfunc::stdGRIDDEF::execute() {
   std::string  colname = getStringValue();
   real    step    = getOpValue();
   byte    no      = getByteValue();
   DATC->setGrid(no,step,colname);
   LogFile << LogFile.getFN() << "(" << no << "," << step << ",\"" <<
                                              colname << "\");";LogFile.flush();
   RefreshGL();
   return EXEC_NEXT;
}
Ejemplo n.º 5
0
void tellstdfunc::stdADDTEXT::undo() {
   TEUNDO_DEBUG("addtext(string, int, point, real, bool, real) UNDO");
   telldata::ttlayout* tx = static_cast<telldata::ttlayout*>(UNDOPstack.front());UNDOPstack.pop_front();
   word la = getWordValue(UNDOPstack, true);
   laydata::tdtdesign* ATDB = DATC->lockDB();
      ATDB->destroy_this(tx->data(),la);
   DATC->unlockDB();
   delete (tx);
   RefreshGL();
}
Ejemplo n.º 6
0
void tellstdfunc::stdADDBOXr::undo() {
   TEUNDO_DEBUG("addbox(point, real, real, int) UNDO");
   telldata::ttlayout* bx = static_cast<telldata::ttlayout*>(UNDOPstack.front());UNDOPstack.pop_front();
   word la = getWordValue(UNDOPstack, true);
   laydata::tdtdesign* ATDB = DATC->lockDB();
      ATDB->destroy_this(bx->data(),la, DATC->TEDLIB());
   DATC->unlockDB();
   delete (bx);
   RefreshGL();
}
Ejemplo n.º 7
0
void tellstdfunc::stdADDPOLY::undo() {
   TEUNDO_DEBUG("addpoly(point list, int) UNDO");
   telldata::ttlayout* ply = static_cast<telldata::ttlayout*>(UNDOPstack.front());UNDOPstack.pop_front();
   word la = getWordValue(UNDOPstack, true);
   laydata::tdtdesign* ATDB = DATC->lockDB();
      ATDB->destroy_this(ply->data(),la, DATC->TEDLIB());
   DATC->unlockDB();
   delete (ply);
   RefreshGL();
}
Ejemplo n.º 8
0
void tellstdfunc::stdFLIPYSEL::undo()
{
   TEUNDO_DEBUG("flipY(point) UNDO");
   telldata::ttpnt    *p1 = static_cast<telldata::ttpnt*>(UNDOPstack.front());UNDOPstack.pop_front();
   real DBscale = DATC->DBscale();
   laydata::tdtdesign* ATDB = DATC->lockDB();
      ATDB->flip_selected(TP(p1->x(), p1->y(), DBscale), false);
   DATC->unlockDB();
   delete p1; 
   RefreshGL();
}
Ejemplo n.º 9
0
void tellstdfunc::stdEDITTOP::undo() {
   TEUNDO_DEBUG("editpop( ) UNDO");
   laydata::tdtdesign* ATDB = DATC->lockDB();
      VERIFY(ATDB->editprev(true));
      browsers::celltree_open(ATDB->activecellname());
      telldata::ttlist* selected = static_cast<telldata::ttlist*>(UNDOPstack.front());UNDOPstack.pop_front();
      ATDB->select_fromList(get_ttlaylist(selected));
   DATC->unlockDB();   
   delete selected;
   RefreshGL();
}
Ejemplo n.º 10
0
int main(int argc, char** argv)
{
	const SDL_VideoInfo* info = NULL;
	int width=640;
	int height=480;
	int bpp=0;
	int flags=0;
	if(SDL_Init(SDL_INIT_VIDEO) < 0)
	{
		SDL_Quit();
		return 1;
	}
	info=SDL_GetVideoInfo();
	if(!info)
	{
		SDL_Quit();
		return 1;
	}
	bpp = info->vfmt->BitsPerPixel;
	SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
    SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
    SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
    SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
    SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
    
    flags = SDL_OPENGL | SDL_RESIZABLE;
    
    if(SDL_SetVideoMode(width, height, bpp, flags) < 0)
    {
		SDL_Quit();
		return 1;
	}
	StartGL();
	while(1)
	{
		SDL_Event event;
		while(SDL_PollEvent(&event))
		{
			switch (event.type){
				case SDL_KEYDOWN:
				SDL_Quit();
				return 0;
				break;
				case SDL_QUIT:
				SDL_Quit();
				return 0;
				break;
			}
		}
		RefreshGL();
		SDL_GL_SwapBuffers();
	}
	return 0;
}
Ejemplo n.º 11
0
int tellstdfunc::stdHIDECELLBOND::execute() {
   bool        hide  = getBoolValue();
   UNDOcmdQ.push_front(this);
   UNDOPstack.push_front(new telldata::ttbool(!hide));
   DATC->setcellbox_hidden(hide);
   wxCommandEvent eventGRIDUPD(wxEVT_SETINGSMENU);
   eventGRIDUPD.SetInt((hide ? tui::STS_CELLBOX_OFF : tui::STS_CELLBOX_ON));
   wxPostEvent(TopedCanvasW, eventGRIDUPD);
   LogFile << LogFile.getFN() << "(" << LogFile._2bool(hide) << ");"; LogFile.flush();
   RefreshGL();
   return EXEC_NEXT;
}
Ejemplo n.º 12
0
void tellstdfunc::stdCOPYSEL::undo()
{
   TEUNDO_DEBUG("copy(point point) UNDO");
   telldata::ttlist* pl = static_cast<telldata::ttlist*>(UNDOPstack.front());UNDOPstack.pop_front();
   laydata::tdtdesign* ATDB = DATC->lockDB();
      //clean up the memory (don't store in the Attic)
      ATDB->delete_selected(NULL, DATC->TEDLIB()); 
      ATDB->select_fromList(get_ttlaylist(pl));
   DATC->unlockDB();   
   delete (pl);
   RefreshGL();
}
Ejemplo n.º 13
0
int tellstdfunc::stdFLIPYSEL::execute()
{
   UNDOcmdQ.push_front(this);
   UNDOPstack.push_front(OPstack.top());
   telldata::ttpnt    *p1 = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop();
   real DBscale = DATC->DBscale();
   laydata::tdtdesign* ATDB = DATC->lockDB();
      ATDB->flip_selected(TP(p1->x(), p1->y(), DBscale), false);
   DATC->unlockDB();
   LogFile << LogFile.getFN() << "("<< *p1 << ");"; LogFile.flush();
   //delete p1; undo will delete them
   RefreshGL();
   return EXEC_NEXT;
}
Ejemplo n.º 14
0
int tellstdfunc::stdCHANGESTRING::execute()
{
   std::string newstring = getStringValue();
   laydata::tdtdesign* ATDB = DATC->lockDB();
      // first save the list of all currently selected components ...
      laydata::selectList* savelist = ATDB->copy_selist();
      // get a list of selected texts only
      laydata::selectList* texts4u = filter_selist(savelist, laydata::_lmtext);
      if (texts4u->empty())
      {
         for (laydata::selectList::const_iterator CL = savelist->begin(); CL != savelist->end(); CL++)
            delete CL->second;
         delete savelist;
         for (laydata::selectList::const_iterator CL = texts4u->begin(); CL != texts4u->end(); CL++)
            delete CL->second;
         delete texts4u;
         tell_log(console::MT_ERROR,"No text objects selected");
      }
      else
      {// just if we have selected texts
         UNDOcmdQ.push_front(this);
         // now unselect all ...
         ATDB->unselect_all();
         // ... and select back only text shapes
         ATDB->select_fromList(texts4u);
         // delete them from the DB - get back the list of deleted shapes.
         laydata::atticList* fha = DEBUG_NEW laydata::atticList();
         ATDB->delete_selected(fha, DATC->TEDLIB());
         // save the deleted shapes in the UNDO data stack
         UNDOPstack.push_front(make_ttlaylist(fha));
         // replace the strings
         laydata::atticList* fhba = replace_str(fha, newstring);
         telldata::ttlist* fhb = make_ttlaylist(fhba);
         // save the new texts in the UNDO data stack
         UNDOPstack.push_front(fhb);
         // add the new objects back to the DB
         ATDB->addlist(get_shlaylist(fhb));
         // now restore selection
         ATDB->select_fromList(savelist);
         ATDB->select_fromList(get_ttlaylist(fhb));
         // that's it!
         clean_atticlist(fha); delete fha;
         clean_atticlist(fhba);delete fhba;
         LogFile << LogFile.getFN() << "(\"" << newstring << "\");"; LogFile.flush();
         RefreshGL();
      }
   DATC->unlockDB();
   return EXEC_NEXT;
}
Ejemplo n.º 15
0
int tellstdfunc::stdLONGCURSOR::execute()
{
   bool        longcur  = getBoolValue();
   
   wxCommandEvent eventGRIDUPD(wxEVT_SETINGSMENU);
   eventGRIDUPD.SetInt((longcur ? tui::STS_LONG_CURSOR : tui::STS_SHORT_CURSOR));
   wxPostEvent(TopedMainW, eventGRIDUPD);

   wxCommandEvent eventCNVS(wxEVT_CANVAS_CURSOR);
   eventCNVS.SetInt((longcur ? 1 : 0));
   wxPostEvent(TopedCanvasW, eventCNVS);

   LogFile << LogFile.getFN() << "(" << LogFile._2bool(longcur) << ");"; LogFile.flush();
   RefreshGL();
   return EXEC_NEXT;
}
Ejemplo n.º 16
0
int tellstdfunc::stdCOPYSEL::execute()
{
   UNDOcmdQ.push_front(this);
   telldata::ttpnt    *p2 = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop();
   telldata::ttpnt    *p1 = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop();
   real DBscale = DATC->DBscale();
   laydata::tdtdesign* ATDB = DATC->lockDB();
      UNDOPstack.push_front(make_ttlaylist(ATDB->shapesel()));
      ATDB->copy_selected(TP(p1->x(), p1->y(), DBscale), TP(p2->x(), p2->y(), DBscale));
      OPstack.push(make_ttlaylist(ATDB->shapesel()));
   DATC->unlockDB();   
   LogFile << LogFile.getFN() << "("<< *p1 << "," << *p2 << ");"; LogFile.flush();
   delete p1; delete p2;
   RefreshGL();
   return EXEC_NEXT;
}
Ejemplo n.º 17
0
int tellstdfunc::stdGRID::execute() {
   bool  visu     = getBoolValue();
   byte    no     = getByteValue();
   if (NULL != DATC->grid(no))
   {
      UNDOcmdQ.push_front(this);
      UNDOPstack.push_front(new telldata::ttint(no));
      UNDOPstack.push_front(new telldata::ttbool(DATC->grid_visual(no)));
      gridON(no,visu);
      LogFile << LogFile.getFN() << "(" << no << "," << LogFile._2bool(visu) << ");";
      LogFile.flush();
      RefreshGL();
   }
   else
      tell_log(console::MT_ERROR,"Grid is not defined. Use definegrid(...) first");
   return EXEC_NEXT;
}
Ejemplo n.º 18
0
int tellstdfunc::stdADDBOX::execute() {
   UNDOcmdQ.push_front(this);
   word la = getWordValue();
   UNDOPstack.push_front(DEBUG_NEW telldata::ttint(la));
   telldata::ttwnd *w = static_cast<telldata::ttwnd*>(OPstack.top());OPstack.pop();
   real DBscale = DATC->DBscale();
   TP* p1DB = DEBUG_NEW TP(w->p1().x(), w->p1().y(), DBscale);
   TP* p2DB = DEBUG_NEW TP(w->p2().x(), w->p2().y(), DBscale);
   laydata::tdtdesign* ATDB = DATC->lockDB();
      telldata::ttlayout* bx = DEBUG_NEW telldata::ttlayout(ATDB->addbox(la, p1DB, p2DB),la);
   DATC->unlockDB();
   OPstack.push(bx); UNDOPstack.push_front(bx->selfcopy());
   LogFile << LogFile.getFN() << "("<< *w << "," << la << ");";LogFile.flush();
   delete w;
   RefreshGL();
   return EXEC_NEXT;
}
Ejemplo n.º 19
0
int tellstdfunc::stdEDITTOP::execute() {
   laydata::tdtdesign* ATDB = DATC->lockDB();
      telldata::ttlist* selected = make_ttlaylist(ATDB->shapesel());
      if (ATDB->edittop()) {
         UNDOcmdQ.push_front(this);
         UNDOPstack.push_front(selected);
         std::string name = ATDB->activecellname();
/*-!-*/  DATC->unlockDB();
         browsers::celltree_highlight(name);
         RefreshGL();
         LogFile << LogFile.getFN() << "();"; LogFile.flush();
      }
      else {
/*-!-*/  DATC->unlockDB();
         tell_log(console::MT_ERROR,"Already on the top level of the curent hierarchy");
         delete selected;
      }
   return EXEC_NEXT;
}
Ejemplo n.º 20
0
int tellstdfunc::stdEDITPREV::execute() {
   laydata::tdtdesign* ATDB = DATC->lockDB();
      telldata::ttlist* selected = make_ttlaylist(ATDB->shapesel());
      if (ATDB->editprev(false)) {
         UNDOcmdQ.push_front(this);
         UNDOPstack.push_front(selected);
         std::string name = ATDB->activecellname();
/*-!-*/  DATC->unlockDB();
         browsers::celltree_highlight(name);
         RefreshGL();
         LogFile << LogFile.getFN() << "();"; LogFile.flush();
      }
      else {
/*-!-*/  DATC->unlockDB();
         tell_log(console::MT_ERROR,"This is the first cell open during this session");
         delete selected;
      }
   return EXEC_NEXT;
}
Ejemplo n.º 21
0
int tellstdfunc::stdMOVESEL::execute()
{
   UNDOcmdQ.push_front(this);
   UNDOPstack.push_front(OPstack.top());
   telldata::ttpnt    *p2 = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop();
   UNDOPstack.push_front(OPstack.top());
   telldata::ttpnt    *p1 = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop();
   real DBscale = DATC->DBscale();
   // move_selected returns 3 select lists : Failed/Deleted/Added
   // This is because of the modify operations
   laydata::selectList* fadead[3];
   byte i;
   for (i = 0; i < 3; fadead[i++] = DEBUG_NEW laydata::selectList());
   laydata::tdtdesign* ATDB = DATC->lockDB();
      ATDB->move_selected(TP(p1->x(), p1->y(), DBscale), TP(p2->x(), p2->y(), DBscale), fadead);
      // save for undo operations ... 
      UNDOPstack.push_front(make_ttlaylist(fadead[0])); // first failed
      UNDOPstack.push_front(make_ttlaylist(fadead[1])); // then deleted
      UNDOPstack.push_front(make_ttlaylist(fadead[2])); // and added
      for (i = 0; i < 3; i++)
      {
         for (laydata::selectList::iterator CI = fadead[i]->begin(); CI != fadead[i]->end(); CI++)
         {
            laydata::dataList* sshape = CI->second;
            if (1 == i) // deleted list only
            {
               for (laydata::dataList::iterator CCI = sshape->begin(); CCI  != sshape->end(); CCI++)
               {
                  if (0 != CCI->second.size()) CCI->second.clear();
               }
            }
            delete sshape;
         }
         delete fadead[i];
      }
   DATC->unlockDB();
   LogFile << LogFile.getFN() << "("<< *p1 << "," << *p2 << ");"; LogFile.flush();
   //delete p1; delete p2; undo will delete them
   RefreshGL();
   return EXEC_NEXT;
}
Ejemplo n.º 22
0
int tellstdfunc::stdDRAWBOX::execute() {
   word     la = getWordValue();
   // stop the thread and wait for input from the GUI
   if (!tellstdfunc::waitGUInput(console::op_dbox, &OPstack)) return EXEC_ABORT;
   UNDOcmdQ.push_front(this);
   la = DATC->curcmdlay();
   UNDOPstack.push_front(DEBUG_NEW telldata::ttint(la));
   // get the data from the stack
   telldata::ttwnd *w = static_cast<telldata::ttwnd*>(OPstack.top());OPstack.pop();
   real DBscale = DATC->DBscale();
   TP* p1DB = DEBUG_NEW TP(w->p1().x(), w->p1().y(), DBscale);
   TP* p2DB = DEBUG_NEW TP(w->p2().x(), w->p2().y(), DBscale);
   laydata::tdtdesign* ATDB = DATC->lockDB();
      telldata::ttlayout* bx = DEBUG_NEW telldata::ttlayout(ATDB->addbox(la, p1DB, p2DB), la);
   DATC->unlockDB();
   OPstack.push(bx);UNDOPstack.push_front(bx->selfcopy());
   LogFile << "addbox("<< *w << "," << la << ");";LogFile.flush();
   delete w;
   RefreshGL();
   return EXEC_NEXT;
}
Ejemplo n.º 23
0
int tellstdfunc::stdADDBOXr::execute() {
   UNDOcmdQ.push_front(this);
   word     la = getWordValue();
   UNDOPstack.push_front(DEBUG_NEW telldata::ttint(la));
   real heigth = getOpValue();
   real width  = getOpValue();
   telldata::ttpnt *p1 = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop();
   telldata::ttpnt  p2 = telldata::ttpnt(p1->x()+width,p1->y()+heigth);
   real DBscale = DATC->DBscale();
   TP* p1DB = DEBUG_NEW TP(p1->x(), p1->y(), DBscale);
   TP* p2DB = DEBUG_NEW TP(p2.x() , p2.y() , DBscale);
   laydata::tdtdesign* ATDB = DATC->lockDB();
      telldata::ttlayout* bx = DEBUG_NEW telldata::ttlayout(ATDB->addbox(la, p1DB, p2DB), la);
   DATC->unlockDB();
   OPstack.push(bx);UNDOPstack.push_front(bx->selfcopy());
   LogFile << LogFile.getFN() << "("<< *p1 << "," << width << "," << heigth <<
                                              "," << la << ");"; LogFile.flush();
   delete p1;
   RefreshGL();
   return EXEC_NEXT;
}
Ejemplo n.º 24
0
int tellstdfunc::stdCELLREF::execute() {
   UNDOcmdQ.push_front(this);
   // get the parameters from the operand stack
   real   magn   = getOpValue();
   bool   flip   = getBoolValue();
   real   angle  = getOpValue();
   telldata::ttpnt  *rpnt  = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop();
   std::string name = getStringValue();
   real DBscale = DATC->DBscale();
   CTM ori(TP(rpnt->x(), rpnt->y(), DBscale), magn,angle,flip);
   laydata::tdtdesign* ATDB = DATC->lockDB();
      telldata::ttlayout* cl = DEBUG_NEW telldata::ttlayout(ATDB->addcellref(name,ori), 0);
   DATC->unlockDB();
   OPstack.push(cl); UNDOPstack.push_front(cl->selfcopy());
   LogFile << LogFile.getFN() << "(\""<< name << "\"," << *rpnt << "," << 
                     angle << "," << LogFile._2bool(flip) << "," << magn <<");";
   LogFile.flush();
   delete rpnt;
   RefreshGL();
   return EXEC_NEXT;
}
Ejemplo n.º 25
0
void tellstdfunc::stdROTATESEL::undo()
{
   TEUNDO_DEBUG("rotate(point real) UNDO");
   telldata::ttlist* added = static_cast<telldata::ttlist*>(UNDOPstack.front());UNDOPstack.pop_front();
   telldata::ttlist* deleted = static_cast<telldata::ttlist*>(UNDOPstack.front());UNDOPstack.pop_front();
   telldata::ttlist* failed = static_cast<telldata::ttlist*>(UNDOPstack.front());UNDOPstack.pop_front();
   real   angle  = 360 - getOpValue(UNDOPstack, true);
   telldata::ttpnt    *p1 = static_cast<telldata::ttpnt*>(UNDOPstack.front());UNDOPstack.pop_front();
   real DBscale = DATC->DBscale();
   laydata::tdtdesign* ATDB = DATC->lockDB();
      ATDB->unselect_fromList(get_ttlaylist(failed));
      ATDB->unselect_fromList(get_ttlaylist(added));
      laydata::selectList* fadead[3];
      byte i;
      for (i = 0; i < 3; fadead[i++] = DEBUG_NEW laydata::selectList());
      ATDB->rotate_selected(TP(p1->x(), p1->y(), DBscale), angle, fadead);
      //@TODO Here - an internal check can be done - all 3 of the fadead lists
      // MUST be empty, otherwise - god knows what's wrong!
      for (i = 0; i < 3; delete fadead[i++]);
      ATDB->select_fromList(get_ttlaylist(failed));
      // put back the replaced (deleted) shapes
      ATDB->addlist(get_shlaylist(deleted));
      // and select them
      ATDB->select_fromList(get_ttlaylist(deleted));
      // delete the added shapes
      for (word j = 0 ; j < added->mlist().size(); j++)
      {
         ATDB->destroy_this(static_cast<telldata::ttlayout*>(added->mlist()[j])->data(),
                           static_cast<telldata::ttlayout*>(added->mlist()[j])->layer(),
                           DATC->TEDLIB());
      }
   DATC->unlockDB();
   delete failed;
   delete deleted;
   delete added;
   delete p1;
   RefreshGL();
}
Ejemplo n.º 26
0
int tellstdfunc::stdEDITPUSH::execute() {
   telldata::ttpnt *p1 = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop();
   real DBscale = DATC->DBscale();
   TP p1DB = TP(p1->x(), p1->y(), DBscale);
   laydata::tdtdesign* ATDB = DATC->lockDB();
      telldata::ttlist* selected = make_ttlaylist(ATDB->shapesel());
      if (ATDB->editpush(p1DB)) {
         UNDOcmdQ.push_front(this);
         UNDOPstack.push_front(selected);
         std::string name = ATDB->activecellname();
/*-!-*/  DATC->unlockDB();
         browsers::celltree_highlight(name);
         RefreshGL();
         LogFile << LogFile.getFN() << "("<< *p1 << ");"; LogFile.flush();
      }
      else {
/*-!-*/  DATC->unlockDB();
         tell_log(console::MT_ERROR,"No cell reference found on this location");
         delete selected;
      }
   delete p1;
   return EXEC_NEXT;
}
Ejemplo n.º 27
0
int tellstdfunc::stdCHANGEREF::execute()
{
   std::string newref = getStringValue();
   laydata::shapeList* cells4u = NULL;
   laydata::tdtdesign* ATDB = DATC->lockDB();
      bool refok = ATDB->checkValidRef(newref);
      if (refok)
         cells4u = ATDB->ungroup_prep(DATC->TEDLIB());
   DATC->unlockDB();
   if (refok)
   {
      if (cells4u->empty())
      {
         tell_log(console::MT_ERROR,"No cell references selected");
         delete cells4u;
      }
      else
      {
         ATDB = DATC->lockDB();
            laydata::atticList* undol2 = ATDB->changeref(cells4u, newref);
         DATC->unlockDB();
         assert(NULL != undol2);
         UNDOcmdQ.push_front(this);
         // Push the list of the cells to be ungroupped first
         laydata::atticList undol;
         undol[0] = cells4u;
         UNDOPstack.push_front(make_ttlaylist(&undol));
         UNDOPstack.push_front(make_ttlaylist(undol2));
         delete cells4u;
         delete undol2;
         LogFile << LogFile.getFN() << "(\"" << newref << "\");"; LogFile.flush();
         RefreshGL();
      }
   }
   return EXEC_NEXT;
}
Ejemplo n.º 28
0
int tellstdfunc::stdADDTEXT::execute() {
   // get the parameters from the operand stack
   UNDOcmdQ.push_front(this);
   real   magn   = getOpValue();
   bool   flip   = getBoolValue();
   real   angle  = getOpValue();
   telldata::ttpnt  *rpnt  = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop();
   word      la  = getWordValue();
   UNDOPstack.push_front(DEBUG_NEW telldata::ttint(la));
   std::string text = getStringValue();
   real DBscale = DATC->DBscale();
   CTM ori(TP(rpnt->x(), rpnt->y(), DBscale),
                                     magn*DBscale/OPENGL_FONT_UNIT,angle,flip);
   laydata::tdtdesign* ATDB = DATC->lockDB();
      telldata::ttlayout* tx = DEBUG_NEW telldata::ttlayout(ATDB->addtext(la, text, ori), la);
   DATC->unlockDB();
   OPstack.push(tx);UNDOPstack.push_front(tx->selfcopy());
   LogFile << LogFile.getFN() << "(\"" << text << "\"," << la << "," << *rpnt <<
         "," << angle << "," << LogFile._2bool(flip) << "," << magn << ");";
   LogFile.flush();
   delete rpnt;
   RefreshGL();
   return EXEC_NEXT;
}
Ejemplo n.º 29
0
int tellstdfunc::stdCELLREF::execute() {
   // get the parameters from the operand stack
   real   magn   = getOpValue();
   bool   flip   = getBoolValue();
   real   angle  = getOpValue();
   telldata::ttpnt  *rpnt  = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop();
   std::string name = getStringValue();
   real DBscale = DATC->DBscale();
   CTM ori(TP(rpnt->x(), rpnt->y(), DBscale), magn,angle,flip);
   // check that target cell exists - otherwise tmp_draw can't obviously work.
   // there is another more extensive check when the cell is added, there the circular
   // references are checked as well 
   laydata::CellDefin strdefn;
   if (DATC->getCellNamePair(name, strdefn))
   {
      UNDOcmdQ.push_front(this);
      laydata::tdtdesign* ATDB = DATC->lockDB();
         telldata::ttlayout* cl = DEBUG_NEW telldata::ttlayout(ATDB->addcellref(strdefn,ori), REF_LAY);
      DATC->unlockDB();
      OPstack.push(cl); UNDOPstack.push_front(cl->selfcopy());
      LogFile << LogFile.getFN() << "(\""<< name << "\"," << *rpnt << "," << 
                        angle << "," << LogFile._2bool(flip) << "," << magn <<");";
      LogFile.flush();
      delete rpnt;
      RefreshGL();
      return EXEC_NEXT;
   }
   else
   {
      std::string news = "Cell \"";
      news += name; news += "\" is not defined";
      tell_log(console::MT_ERROR,news);
      delete rpnt;
      return EXEC_ABORT;
   }
}
Ejemplo n.º 30
0
int tellstdfunc::stdADDPOLY::execute() {
   word     la = getWordValue();
   telldata::ttlist *pl = static_cast<telldata::ttlist*>(OPstack.top());OPstack.pop();
   if (pl->size() >= 3) {
      UNDOcmdQ.push_front(this);
      UNDOPstack.push_front(DEBUG_NEW telldata::ttint(la));
      real DBscale = DATC->DBscale();
      laydata::tdtdesign* ATDB = DATC->lockDB();
         pointlist* plst = t2tpoints(pl,DBscale);
         telldata::ttlayout* ply = DEBUG_NEW telldata::ttlayout(ATDB->addpoly(la,plst), la);
         delete plst;
      DATC->unlockDB();
      OPstack.push(ply); UNDOPstack.push_front(ply->selfcopy());
      LogFile << LogFile.getFN() << "("<< *pl << "," << la << ");"; 
      LogFile.flush();
   }
   else {
      tell_log(console::MT_ERROR,"At least 3 points expected to create a polygon");
      OPstack.push(DEBUG_NEW telldata::ttlayout());
   }
   delete pl;
   RefreshGL();
   return EXEC_NEXT;
}