use of doc.mathobjects.MathObject in project OpenNotebook by jaltekruse.
the class NotebookPanel method delete.
public void delete() {
if (getCurrentDocViewer().getFocusedObject() != null) {
MathObject mObj = getCurrentDocViewer().getFocusedObject();
mObj.getParentContainer().removeObject(mObj);
if (mObj == getCurrentDocViewer().getTempGroup()) {
getCurrentDocViewer().resetAndRemoveTempGroup();
}
mObj.setParentContainer(null);
mObj.setJustDeleted(true);
getCurrentDocViewer().setFocusedObject(null);
getCurrentDocViewer().addUndoState();
getCurrentDocViewer().repaint();
} else if (getCurrentDocViewer().getSelectedPage() != null) {
deletePage();
} else {
JOptionPane.showMessageDialog(null, "Please select a page or object first.", ERROR, JOptionPane.INFORMATION_MESSAGE);
return;
}
}
use of doc.mathobjects.MathObject in project OpenNotebook by jaltekruse.
the class NotebookPanel method group.
public void group() {
MathObject focusedObj = getCurrentDocViewer().getFocusedObject();
if (focusedObj != null && focusedObj == getCurrentDocViewer().getTempGroup()) {
getCurrentDocViewer().getTempGroup().getParentContainer().removeObject(focusedObj);
MathObject newGroup = getCurrentDocViewer().getTempGroup().clone();
focusedObj.getParentContainer().addObject(newGroup);
getCurrentDocViewer().resetTempGroup();
// make sure this comes after the call to resetAndRemoveTempGroup, when a
// new focused object is set it places the objects in the temp group
// back on the page, which is not what is needed here
getCurrentDocViewer().setFocusedObject(newGroup);
getCurrentDocViewer().addUndoState();
getCurrentDocViewer().repaint();
}
}
use of doc.mathobjects.MathObject in project OpenNotebook by jaltekruse.
the class NotebookPanel method paste.
public void paste() {
MathObject focusedObj = getCurrentDocViewer().getFocusedObject();
if (getClipBoardContents() == null) {
JOptionPane.showMessageDialog(null, "Clipboard is empty.", "Empty Clipboard", JOptionPane.WARNING_MESSAGE);
return;
}
if (focusedObj != null) {
MathObject newObj = getClipBoardContents().clone();
newObj.setxPos(focusedObj.getxPos());
// offset the new object a little so the user knows that it was added
newObj.setyPos(focusedObj.getyPos() + 10);
newObj.setParentContainer(focusedObj.getParentContainer());
focusedObj.getParentContainer().addObject(newObj);
getCurrentDocViewer().setFocusedObject(newObj);
} else if (getCurrentDocViewer().getSelectedPage() != null) {
MathObject newObj = getClipBoardContents().clone();
newObj.setParentContainer(getCurrentDocViewer().getSelectedPage());
getCurrentDocViewer().getSelectedPage().addObject(newObj);
getCurrentDocViewer().setFocusedObject(newObj);
} else {
JOptionPane.showMessageDialog(null, "Please select a page, or an object on the desired page first.", "Select Location for Paste", JOptionPane.WARNING_MESSAGE);
return;
}
getCurrentDocViewer().addUndoState();
getCurrentDocViewer().repaint();
}
use of doc.mathobjects.MathObject in project OpenNotebook by jaltekruse.
the class NotebookPanel method destroyDoc.
public void destroyDoc(Document doc) {
for (Page p : doc.getPages()) {
p.setParentDoc(null);
for (MathObject mObj : p.getObjects()) {
mObj.setParentContainer(null);
}
p.removeAllObjects();
}
doc.removeAllPages();
doc.setDocViewerPanel(null);
}
use of doc.mathobjects.MathObject in project OpenNotebook by jaltekruse.
the class NotebookPanel method bringToBack.
public void bringToBack() {
MathObject mObj = getCurrentDocViewer().getFocusedObject();
if (mObj != null) {
mObj.getParentPage().bringObjectToBack(mObj);
getCurrentDocViewer().addUndoState();
getCurrentDocViewer().repaint();
}
}
Aggregations