Skip to content

Commit

Permalink
Added functionality to copy and paste cells between Notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
arun3688 committed Sep 23, 2015
1 parent dbd1ef4 commit 7ab0a67
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
6 changes: 5 additions & 1 deletion OMNotebook/OMNotebookGUI/cellcommands.cpp
Expand Up @@ -288,7 +288,7 @@ namespace IAEX
void PasteCellsCommand::execute()
{
try
{
{
vector<Cell *> cells = application()->pasteboard();

// Insert new cells before this position.
Expand All @@ -311,6 +311,10 @@ namespace IAEX
}
}
}
else
{
QMessageBox::warning( 0, "Warning", "No Cells Copied to paste, To paste a cell, select the cells and perform copy", "OK" );
}

//2006-01-18 AF, set docuement changed
document()->setChanged( true );
Expand Down
15 changes: 13 additions & 2 deletions OMNotebook/OMNotebookGUI/notebook.cpp
Expand Up @@ -833,6 +833,15 @@ void NotebookWindow::createCellMenu()
previousCellAction->setStatusTip( tr("Move to previous cell") );
connect(previousCellAction, SIGNAL(triggered()), this, SLOT(moveCursorUp()));

copyCellAction = new QAction( tr("&Copy Cell"), this);
copyCellAction->setShortcut( tr("Ctrl+Shift+C") );
copyCellAction->setStatusTip( tr("Copy selected cell") );
connect(copyCellAction, SIGNAL(triggered()), this, SLOT(copyCell()));

pasteCellAction = new QAction( tr("&Paste Cell"), this);
pasteCellAction->setShortcut( tr("Ctrl+Shift+V") );
pasteCellAction->setStatusTip( tr("Paste in a cell") );
connect(pasteCellAction, SIGNAL(triggered()), this, SLOT(pasteCell()));

// 2005-10-07 AF, Porting, new code for creating menu
// 2006-04-27 AF, remove cut,copy,paste cell from menu
Expand All @@ -853,7 +862,8 @@ void NotebookWindow::createCellMenu()
cellMenu->addSeparator();
cellMenu->addAction( nextCellAction );
cellMenu->addAction( previousCellAction );

cellMenu->addAction( copyCellAction );
cellMenu->addAction( pasteCellAction );
QObject::connect(cellMenu, SIGNAL(aboutToShow()),
this, SLOT(updateCellMenu()));

Expand Down Expand Up @@ -2584,11 +2594,12 @@ void NotebookWindow::openFile(const QString filename)


if(subject_->isOpen())
{
application()->commandCenter()->executeCommand(new OpenFileCommand(filename_));
}
else
{
subject_ = new CellDocument(app_, QString::null);

subject_->executeCommand(new OpenFileCommand(filename_));
subject_->attach(this);

Expand Down
4 changes: 2 additions & 2 deletions OMNotebook/OMNotebookGUI/notebook.h
Expand Up @@ -262,8 +262,8 @@ private slots:
QAction *showExprAction;

//QAction *cutCellAction;
//QAction *copyCellAction;
//QAction *pasteCellAction;
QAction *copyCellAction;
QAction *pasteCellAction;
QAction *addCellAction;
QAction *ungroupCellAction; // Added 2006-04-26 AF
QAction *splitCellAction; // Added 2006-04-26 AF
Expand Down

0 comments on commit 7ab0a67

Please sign in to comment.