Example #1
0
PUBLIC bool removeRec(cchar *tableName, cchar *key)
{
    if (ediRemoveRec(getDatabase(), tableName, key) < 0) {
        feedback("error", "Cannot delete %s", stitle(tableName));
        return 0;
    }
    feedback("info", "Deleted %s", stitle(tableName));
    return 1;
}
Example #2
0
PUBLIC bool updateRec(EdiRec *rec)
{
    if (!rec) {
        feedback("error", "Cannot save record");
        return 0;
    }
    setRec(rec);
    if (ediUpdateRec(getDatabase(), rec) < 0) {
        feedback("error", "Cannot save %s", stitle(rec->tableName));
        return 0;
    }
    feedback("info", "Saved %s", stitle(rec->tableName));
    return 1;
}
Example #3
0
/*! \file 
\brief To display non Fary drawings
 */
void DrawPolrec(QPainter *p,pigalePaint *paint)
  {TopologicalGraph G(paint->GCP);
  Prop1<tstring> title(G.Set(),PROP_TITRE);
  Prop1<Tpoint> pmin(G.Set(),PROP_POINT_MIN);
  Prop<Tpoint> p1(G.Set(tvertex()),PROP_DRAW_POINT_1);
  Prop<Tpoint> p2(G.Set(tvertex()),PROP_DRAW_POINT_2);
  Prop<double> x1(G.Set(tedge()),PROP_DRAW_DBLE_1 );
  Prop<double> x2(G.Set(tedge()),PROP_DRAW_DBLE_2 );
  Prop<double> y1(G.Set(tedge()),PROP_DRAW_DBLE_3 );
  Prop<double> y2(G.Set(tedge()),PROP_DRAW_DBLE_4);
  Prop<double> y(G.Set(tedge()),PROP_DRAW_DBLE_5);
  Prop<short> ecolor(G.Set(tedge()),PROP_COLOR);
  Prop<short> vcolor(G.Set(tvertex()),PROP_COLOR);
  Prop<bool> isTree(G.Set(tedge()),PROP_ISTREE); 
  Prop<int> elabel(G.Set(tedge()),PROP_LABEL); 
  Prop<int> ewidth(G.Set(tedge()),PROP_WIDTH);

  bool drawTextEdges = (G.ne() < 100);
  QString stitle(~title());
  if(drawTextEdges)paint->DrawText(p,pmin().x(),pmin().y(),stitle);
  
  // draw vertices
  for(tvertex v = 1;v <= G.nv();v++)
      {double dx = (p2[v].x() - p1[v].x()) ;   
      double x = p1[v].x() ;     
      double y = p1[v].y(); 
      paint->DrawText(p,x,y, dx,1.,v,vcolor[v]);
      }
  // draw edges
  Tpoint e1,e2,e3,e4;
   for(tedge e = 1;e <= G.ne();e++)
       {if(isTree[e])
           {e1 = Tpoint(x1[e],y1[e]);
           e2 = Tpoint(x1[e],y2[e]);
           paint->DrawSeg(p,e1,e2,ecolor[e],ewidth[e]);
           }
       else // cotree edges   (x1,y1) -> (x1,y) -> (x2,y) -> (x2,y2)
           {e1 = Tpoint(x1[e],y1[e]);
           e2 = Tpoint(x1[e],y[e]);
           e3 = Tpoint(x2[e],y[e]);
           e4 = Tpoint(x2[e],y2[e]);
           paint->DrawSeg(p,e1,e2,ecolor[e],ewidth[e]);
           paint->DrawSeg(p,e2,e3,ecolor[e],ewidth[e]);
           paint->DrawSeg(p,e3,e4,ecolor[e],ewidth[e]);
           if(drawTextEdges)
               {QString label=QString("%1").arg(elabel[e]);
               // text is drawn at  position of lower edge occu
               paint->DrawText(p,x1[e],y[e],label);
               }
           }
       }
  }
Example #4
0
DevEditor* DevGUI::createEditor(const QString &title, bool show)
{
    QString stitle(title.isEmpty()
			? QString(tr("noname_%1")).arg(++noname_count)
			: title);
				
	DevEditor *edit = new DevEditor(stitle, DevEdit::fromFile);
	actionClose->setEnabled(true);
    
	if ( !show )
		return edit;
	
    int tab = Editor->addTab(edit, QFileInfo(stitle).fileName());
    Editor->setCurrentIndex(tab);
    Editor->show();
    
    edit->setFocus();
    return edit;
}