예제 #1
0
void TableData::insertColumn(int beforecol) {
  int R = rows();
  int C = columns();
  if (beforecol<0)
    beforecol = 0;
  if (beforecol>C)
    beforecol = C;

  qDebug() << "old text[" << text() << "]";

  QMap<RCPair, QString> oldcont = allContents(this);
  QMap<RCPair, QString> newcont;
  for (int r=0; r<R; r++)
    for (int c=0; c<C; c++)
      newcont[RCPair(r, c>=beforecol ? c+1 : c)] = oldcont[RCPair(r, c)];
  
  QMap<MarkupData *, MDPos> allmarks = allMarkupPos(this);

  for (auto pos: allmarks) 
    qDebug() << "old pos" << pos.toString();
  
  for (auto &pos: allmarks) 
    pos.insertColumn(beforecol);

  for (auto pos: allmarks) 
    qDebug() << "new pos" << pos.toString();
  
  qDebug() << "new text[" << buildContents(R, C+1, newcont) << "]";

  setColumns(C+1);
  setText(buildContents(R, C+1, newcont));
  for (auto *md: markups())
    updateMD(md, allmarks[md], this);
}
예제 #2
0
void TableData::deleteColumn(int col) {
  int R = rows();
  int C = columns();
  if (col<0 || col>=C || C==1)
    return;

  qDebug() << "old text[" << text() << "]";

  QMap<RCPair, QString> oldcont = allContents(this);
  QMap<RCPair, QString> newcont;
  for (int r=0; r<R; r++)
    for (int c=0; c<C-1; c++)
      newcont[RCPair(r, c)] = oldcont[RCPair(r, c>=col ? c+1 : c)];
  
  QMap<MarkupData *, MDPos> allmarks = allMarkupPos(this);

  for (auto pos: allmarks) 
    qDebug() << "old pos" << pos.toString();

  for (auto &pos: allmarks) 
    pos.deleteColumn(col);
  
  for (auto pos: allmarks) 
    qDebug() << "new pos" << pos.toString();

  qDebug() << "new text[" << buildContents(R, C-1, newcont) << "]";

  setColumns(C-1);
  setText(buildContents(R, C-1, newcont));
  for (auto *md: markups()) {
    updateMD(md, allmarks[md], this);
    if (md->start()>=md->end())
      deleteMarkup(md);
  }
}
예제 #3
0
void
ActionListViewItem::edit ()
{
    QWorkspace *ws = mainform->ws;
    aWindowsList *wl = mainform->wl;    
    QString oclass = md->objClass( obj );
    int objid = md->id( obj );
    if ( wl->find( objid ) ) {
	wl->get( objid )->setFocus();
	return;
    }
    
    if ( oclass == md_action )
    {
	dEditAction * e = new dEditAction ( ws, 0, WDestructiveClose );
	wl->insert( objid, e );
	editor = e;
	QObject::connect( mainform, SIGNAL( tosave() ), editor, SLOT( updateMD() ) );
	e->setData( this );
	e->show();
	e->moveToTopLeftCorner();
	mainform->addTab(++mainform->lastTabId,e->name());
	return;
    }
}
예제 #4
0
void TableData::insertRow(int beforerow) {
  int R = rows();
  int C = columns();
  if (beforerow<0)
    beforerow = 0;
  if (beforerow>R)
    beforerow = R;

  QMap<RCPair, QString> oldcont = allContents(this);
  QMap<RCPair, QString> newcont;
  for (int r=0; r<R; r++)
    for (int c=0; c<C; c++)
      newcont[RCPair(r>=beforerow ? r+1 : r, c)] = oldcont[RCPair(r, c)];
  
  QMap<MarkupData *, MDPos> allmarks = allMarkupPos(this);
  for (auto &pos: allmarks) 
    pos.insertRow(beforerow);
  
  setRows(R+1);
  setText(buildContents(R+1, C, newcont));
  for (auto *md: markups())
    updateMD(md, allmarks[md], this);
}
예제 #5
0
void TableData::deleteRow(int row) {
  int R = rows();
  int C = columns();
  if (row<0 || row>=R || R==1)
    return;

  QMap<RCPair, QString> oldcont = allContents(this);
  QMap<RCPair, QString> newcont;
  for (int r=0; r<R-1; r++)
    for (int c=0; c<C; c++)
      newcont[RCPair(r, c)] = oldcont[RCPair(r>=row ? r+1 : r, c)];
  
  QMap<MarkupData *, MDPos> allmarks = allMarkupPos(this);
  for (auto &pos: allmarks) 
    pos.deleteRow(row);
  
  setRows(R-1);
  setText(buildContents(R-1, C, newcont));
  for (auto *md: markups()) {
    updateMD(md, allmarks[md], this);
    if (md->start()>=md->end())
      deleteMarkup(md);
  }
}
예제 #6
0
void dEditToolbar::destroy()
{
    updateMD();
    ( (MainForm*)this->topLevelWidget() )->wl->remove( this );
    ( (MainForm*)this->topLevelWidget() )->removeTab(name());
}
예제 #7
0
void dEditColumns::destroy()
{
    updateMD();
    //( (MainForm*)this->topLevelWidget() )->wl->remove( this );
    //( (MainForm*)this->topLevelWidget() )->removeTab(name());
}
예제 #8
0
void dEditLang::destroy()
{
    updateMD();
    //( (MainForm*)this->topLevelWidget() )->removeTab(name());
}