Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CanvasWindow Class Reference

#include <CanvasWindow.h>

Inheritance diagram for CanvasWindow:

Inheritance graph
[legend]
Collaboration diagram for CanvasWindow:

Collaboration graph
[legend]
List of all members.

Detailed Description

A concrete window class that contains the canvas and responds to menu item and tool bar events from the window and messages sent by the Inspector.

Attention:
This class should implement those actions specific to HippoDraw as an application. All changes to the CanvasView should be implemented in the that class so that other applications can benefit from the implementation.
Bug:
If a document could not be opened, error messages displays, but one get a new empty canvas window.
It is not throwing an exception which is read to be caught.

Bug:
@ Windows only, not all the canvas is initially shown.
Run displays.py and the CanvasWindow needs manual resizing for all the canvas to be seen.

Bug:
The View/Cut empty pages button doesn't work and is not enabled.

Requests:
@ Be able to retrieve from SIP Python module, information on the active displays such as axis labels, etc.

Requests:
Have a editable NTuple table view.

Requests:
@ Be able to group canvas items together and set parameters to all of them at once.
This makes sense for some Inspector tabbed panes but not for others.

Requests:
@ Open documents read only.
This could be the default when the file Open menu item is used.

Requests:
@ Have CanvasWindow size a setting.

Requests:
A clear all button on the tool bar.

Requests:
A setting on whether to prompt user or not for clear all.

Todo:
@@ Be able to ask canvas if it is saved from Python.

Todo:
Make it a setting if the Inspector window comes up automatically or not.

Todo:
Respond to Page Up and Page Down keys.

Todo:
Needs something to display on the canvas for values only seen in the Inspector.
One example is the name of the ntuple file. This is so that the document when printed can be more useful as a stand alone.

Author:
Jim Chiang <jchiang@slac.stanford.edu>

Kaustuv <kaustuv@stanford.edu>

Paul F. Kunz <Paul_Kunz@slac.stanford.edu>

Sanket B. Malde <sanket@stanford.edu>

Definition at line 106 of file CanvasWindow.h.

Public Member Functions

void addDisplay (PlotterBase *plotter)
 Adds a new plot to the canvas and selects it.
void addFuncDisplay (PlotterBase *plotter, const std::string &name)
 Adds function textual display to the canvas.
void addPlotDisplay (PlotterBase *plotter, bool select)
 Adds a new plot display to the canvas.
void addPlotDisplay (PlotterBase *plotter)
 Adds a new plot display to the canvas.
void addTextDisplay (PlotterBase *plotter, const std::string &type, const std::string &text)
 Adds a textual display to the canvas of type type.
void addTextDisplay (PlotterBase *plotter, const std::string &type)
 Adds a textual display to the canvas of type type.
std::pair< double, double > addTextDisplayAt (PlotterBase *plotter, const std::string &type, const std::string &text, double xrel, double yrel)
 Adds a text display at the relative position (xrel, yrel) in the selected item's coordinates.
bool allowClose ()
 If document has changed and not saved, opens a dialog box for user to choose to save, discard or cancel.
 CanvasWindow (const CanvasWindow &)
 A copy constructor that does nothing except keep boost.python happy.
 CanvasWindow (QWidget *parent=0, const char *name=0, Qt::WFlags fl=Qt::WType_TopLevel)
 constructor.
void clear ()
 Removes all items from the canvas.
virtual bool closeNoPrompt ()
 Closes the window.
virtual void customEvent (QCustomEvent *event)
 Responds to QCustomEvents.
virtual void fileNew ()
 Creates a new document CanvasWindow.
void fileSave ()
 Saves the document.
virtual void fileSaveAs ()
 Saves the document after display a file dialog to the user.
virtual void fileSaveSelectedImages (const std::string &filename)
 Saves the selected ViewBase objects as an image file with the given filename.
virtual void fileSaveSelectedImages ()
 Saves the selected ViewBase object as an image file.
void fillPlotterList (std::vector< PlotterBase * > &plotter_list)
 Clears and fills plotter_list with all the PlotterBase objects on the canvas.
CanvasViewgetCanvasView ()
 Returns the CanvasView object.
QtViewgetViewFor (const PlotterBase *plotter) const
 Returns the QtView object that is the Observer of the plotter.
void inhibitClose (bool yes=true)
 If yes is true, sets a flag so that this object will not accept close events.
void initFromFile (const std::string &filename)
 Initializes this object from contents of file.
const std::vector< double > & mouseEventData ()
 Retrieve a vector (x, y, z) points from the next mouse event.
void print (const std::string &filename)
 Prints the view to Postscript file without prompting user.
void removeDisplay (PlotterBase *plotter)
 Removes the plotter and its view from the canvas.
void saveAllAs (const std::string &filename)
 Saves the document along with its NTuple objects.
void saveAs (const std::string &filename)
 Saves the document to the specified file.
void saveAsImage (const PlotterBase *plotter, const std::string &filename)
 Saves the plotter as image file.
void savePlotAsImage (const PlotterBase *plotter, const std::string &filename)
 Saves the plotter as image file.
void savePlotAsImageImmediate (const PlotterBase *plotter, const std::string &filename)
 Save plot as image file without posting an event.
PlotterBaseselectedPlotter ()
 Returns the selected plotter.
void setAddedSelected (bool yes)
 Sets to flag to make plots in their selected state when added to the canvas.
void setAllowClose (bool yes=true)
 Sets the window to allowed to be closed by user without prompting.
void setAllSelected (bool flag=true)
 Select or de-select all views in the window.
void setCaption ()
 Sets the Windows title.
void setChanged (bool flag=true)
 Sets the changed flag.
void setIntervalEnabled (bool yes=true)
 Sets the display interval feature to enabled if yes is true, otherwise sets it to disabled.
void setPlotMatrix (unsigned int columns, unsigned int rows)
 Sets the number of columns and rows of plots on each page.
void setSelected (QtView *view)
 Select a specific view in the window.
void updateActions ()
 Update Action objects.
const std::vector< const ViewBase * > & views ()
 Returns the list of ViewBase objects on the canvas.
virtual ~CanvasWindow ()

Static Public Member Functions

static void resetFontSize ()
 Resets the font size to be no larger than 10.

Protected Slots

virtual void on_fileBrowse_actived ()
 Browse a document file, without opening a window for it.
virtual void on_fileExit_activated ()
 Responds to the Quit item in the File menu.
virtual void on_fileOpen_activated ()
 Opens an existing file.

Protected Member Functions

virtual void closeEvent (QCloseEvent *e)
 Informs the application object that is window is about to close.
virtual void editClear ()
 Responds to "Clear" menu item.
virtual void editCopy ()
virtual void editCut ()
 Removes selected items from canvas and add them to the pasteboard.
virtual void editDelete ()
 Removes selected items from canvas without copying them to the pasteboard.
virtual void editPaste ()
virtual void editReTile ()
 Re tiles the entire document.
virtual void editReTilePage ()
 Re tiles only the current page.
virtual void editSelectAll ()
 Sets all QCanvasItem objects to selected.
virtual void editUndo ()
 Responds to the undo action.
virtual void fileExportTextTuple ()
virtual void filePrint ()
 Prints the canvas to a Postscript file.
virtual void fileSaveAll ()
 Saves the canvas document and any NTuple that were not read from or written to a file.
virtual void fileSaveAllAs ()
 Saves the canvas document and its NTuple.
virtual void helpAbout ()
 Brings up standard window showing version, authors, etc.
virtual void hideEvent (QHideEvent *e)
 Informs the application object that the window has been hidden.
void nextView ()
 Switches View to the next view for the selected item on the canvas.
virtual void on_aboutQt_activated ()
 Brings up Qt's about message box.
void previousView ()
 Switches View to the previous view for the selected item on the canvas.
virtual void resizeEvent (QResizeEvent *)
 Informs the Canvas to resize as well.
virtual void settingCanvas ()
 Sets the canvas settings.
virtual void settingFonts ()
 Sets the font settings.
virtual void settingPrinter ()
 Sets the printer settings.
virtual void setZoomMode ()
 Sets the zoom mode to true or false.
virtual void showEvent (QShowEvent *e)
 Informs the application object that the window has been shown.
virtual void viewAddPage ()
 Adds a page to the canvas.
virtual void viewLock ()
 Locks a canvas item.
virtual void viewShowInspector ()
 Shows the Inspector window.
virtual void viewShowPickTable ()
 Shows the pick table window.
virtual void viewShowPlotTable ()
 Shows the plot table.
virtual void viewUnlock ()
 Unlocks a canvas item.
virtual void viewZoomIn ()
 Enlarges the view of the canvas.
virtual void viewZoomOut ()
 Reduces the view of the canvas.
virtual void viewZoomReset ()
 Returns the view of the canvas to normal.
virtual void windowActivationChange (bool oldActive)
 Informs the application object if this window has become the active one.

Private Member Functions

bool areDataSourcesSaved ()
 Returns true if all the data sources used by the document have been saved to or read from a file.
bool setFilenameFromDialog ()
 Sets the file name of document.
void setTitleFileName (const std::string &name)
 Sets the file name component of the window's title.

Private Attributes

bool m_allow_close
 A flag set to true to allow the window to close without prompting the user.
CanvasViewm_browsed_canvas
 The CanvasView object that is being browsed.
CanvasViewm_canvas_view
 The CanvasView object which is the central widget.
QString m_changed
 The changed status part of the window title.
QtFileDialogm_file_dialog
 The open file dialog for this window.
std::string m_filename
 The file name part of the window title.
bool m_filenameExists
 True if filename has been assigned, false if not.
bool m_hasChanged
 The current changed status.
bool m_inhibit_close
 A flag set to true if the CanvasWindow should not accept a close event.
QString m_prefix
 The prefix part of the window title.
XmlControllerm_xml_controller
 The controller object capable of serializing the canvas contents as XML and serializing them.

Static Private Attributes

static PlotTables_plot_table = 0
 The singleton instance of PlotTable.


Constructor & Destructor Documentation

CanvasWindow::CanvasWindow QWidget parent = 0,
const char *  name = 0,
Qt::WFlags  fl = Qt::WType_TopLevel
 

constructor.

The arguments are defined by the inherited Qt QMainWindow class

Definition at line 65 of file CanvasWindow.cxx.

References WindowController::instance(), QtXMLController::instance(), m_canvas_view, m_file_dialog, m_xml_controller, WindowController::newWindow(), and setCaption().

Referenced by fileNew(), and on_fileOpen_activated().

CanvasWindow::CanvasWindow const CanvasWindow  ) 
 

A copy constructor that does nothing except keep boost.python happy.

Without it, boost.python interface wouldn't compile because QMainWindow copy constructor is private.

Definition at line 117 of file CanvasWindow.cxx.

CanvasWindow::~CanvasWindow  )  [virtual]
 

Definition at line 122 of file CanvasWindow.cxx.

References QCanvasView::canvas(), and m_canvas_view.


Member Function Documentation

void CanvasWindow::addDisplay PlotterBase plotter  ) 
 

Adds a new plot to the canvas and selects it.

Definition at line 856 of file CanvasWindow.cxx.

References CanvasView::addPlotDisplay(), and m_canvas_view.

void CanvasWindow::addFuncDisplay PlotterBase plotter,
const std::string name
 

Adds function textual display to the canvas.

Definition at line 839 of file CanvasWindow.cxx.

References CanvasView::addFuncDisplay(), and m_canvas_view.

Referenced by Inspector::summaryNew().

void CanvasWindow::addPlotDisplay PlotterBase plotter,
bool  select
 

Adds a new plot display to the canvas.

Adds a new plot display to the canvas and puts it in selected state if select is true.

Definition at line 851 of file CanvasWindow.cxx.

References CanvasView::addPlotDisplay(), and m_canvas_view.

void CanvasWindow::addPlotDisplay PlotterBase plotter  ) 
 

Adds a new plot display to the canvas.

Adds a new plot display to the canvas and puts it in selected state if user settings are so set.

Definition at line 846 of file CanvasWindow.cxx.

References CanvasView::addPlotDisplay(), and m_canvas_view.

Referenced by PyCanvas::addDisplay(), and Inspector::newPlotButton_clicked().

void CanvasWindow::addTextDisplay PlotterBase plotter,
const std::string type,
const std::string text
 

Adds a textual display to the canvas of type type.

This method is used when the text type requires additional text.

Definition at line 820 of file CanvasWindow.cxx.

References CanvasView::addTextDisplay(), and m_canvas_view.

void CanvasWindow::addTextDisplay PlotterBase plotter,
const std::string type
 

Adds a textual display to the canvas of type type.

Definition at line 812 of file CanvasWindow.cxx.

References CanvasView::addTextDisplay(), and m_canvas_view.

Referenced by PyCanvas::addText(), and Inspector::summaryNew().

std::pair< double, double > CanvasWindow::addTextDisplayAt PlotterBase plotter,
const std::string type,
const std::string text,
double  xrel,
double  yrel
 

Adds a text display at the relative position (xrel, yrel) in the selected item's coordinates.

This method returns the relative coordinates of the lower left corner as a pair of doubles.

Definition at line 829 of file CanvasWindow.cxx.

References CanvasView::addTextDisplayAt(), and m_canvas_view.

Referenced by PyCanvas::addTextAt().

bool CanvasWindow::allowClose  ) 
 

If document has changed and not saved, opens a dialog box for user to choose to save, discard or cancel.

Otherwise, return true. Intended to be used for closeEvent.

Definition at line 191 of file CanvasWindow.cxx.

References QString::append(), QString::arg(), fileSave(), QMessageBox::information(), m_allow_close, m_canvas_view, m_filename, and m_hasChanged.

Referenced by closeEvent(), and WindowController::okToQuit().

bool CanvasWindow::areDataSourcesSaved  )  [private]
 

Returns true if all the data sources used by the document have been saved to or read from a file.

If any data sources are only in memory, then inform the user with dialog and return false.

Definition at line 587 of file CanvasWindow.cxx.

References XmlController::areDataSourcesSaved(), QMessageBox::critical(), m_canvas_view, m_xml_controller, CanvasView::views(), and views().

Referenced by fileSave(), and fileSaveAs().

void CanvasWindow::clear  ) 
 

Removes all items from the canvas.

See also:
editClear()

Definition at line 570 of file CanvasWindow.cxx.

References CanvasView::clear(), and m_canvas_view.

Referenced by editClear().

void CanvasWindow::closeEvent QCloseEvent e  )  [protected, virtual]
 

Informs the application object that is window is about to close.

Definition at line 242 of file CanvasWindow.cxx.

References QCloseEvent::accept(), allowClose(), QString::append(), QCloseEvent::ignore(), QMessageBox::information(), WindowController::instance(), m_allow_close, m_canvas_view, and m_inhibit_close.

bool CanvasWindow::closeNoPrompt  )  [virtual]
 

Closes the window.

If no_prompt is true, the user will not be prompted, otherwise the user gets a dialog with which he can cancel the close operation.

Definition at line 235 of file CanvasWindow.cxx.

References QWidget::close(), and m_allow_close.

void CanvasWindow::customEvent QCustomEvent event  )  [virtual]
 

Responds to QCustomEvents.

Responds to SaveAsImageEvent custom events. All others are ignored.

Definition at line 136 of file CanvasWindow.cxx.

References PlotTableEvent::Close, PlotTableEvent::Copy, m_browsed_canvas, m_canvas_view, s_plot_table, savePlotAsImage(), and num_util::type().

void CanvasWindow::editClear  )  [protected, virtual]
 

Responds to "Clear" menu item.

Prompts the user with a warning dialog, then removes all canvas items or not depending on user response.

See also:
clear()

Definition at line 378 of file CanvasWindow.cxx.

References QString::append(), clear(), WindowController::instance(), updateActions(), and QMessageBox::warning().

void CanvasWindow::editCopy  )  [protected, virtual]
 

Definition at line 368 of file CanvasWindow.cxx.

References CanvasView::copySelectedToPasteboard(), WindowController::instance(), m_canvas_view, and updateActions().

void CanvasWindow::editCut  )  [protected, virtual]
 

Removes selected items from canvas and add them to the pasteboard.

Definition at line 396 of file CanvasWindow.cxx.

References CanvasView::deleteSelected(), WindowController::instance(), m_canvas_view, and updateActions().

void CanvasWindow::editDelete  )  [protected, virtual]
 

Removes selected items from canvas without copying them to the pasteboard.

Definition at line 404 of file CanvasWindow.cxx.

References CanvasView::deleteSelected(), WindowController::instance(), m_canvas_view, and updateActions().

void CanvasWindow::editPaste  )  [protected, virtual]
 

Definition at line 436 of file CanvasWindow.cxx.

References CanvasView::copyFromPasteboard(), and m_canvas_view.

void CanvasWindow::editReTile  )  [protected, virtual]
 

Re tiles the entire document.

Definition at line 414 of file CanvasWindow.cxx.

References m_canvas_view, and CanvasView::reTile().

void CanvasWindow::editReTilePage  )  [protected, virtual]
 

Re tiles only the current page.

Definition at line 421 of file CanvasWindow.cxx.

References m_canvas_view, and CanvasView::reTilePage().

void CanvasWindow::editSelectAll  )  [protected, virtual]
 

Sets all QCanvasItem objects to selected.

Definition at line 443 of file CanvasWindow.cxx.

References WindowController::instance(), m_canvas_view, FigureEditor::setAllSelected(), and updateActions().

void CanvasWindow::editUndo  )  [protected, virtual]
 

Responds to the undo action.

Definition at line 428 of file CanvasWindow.cxx.

References m_canvas_view, CanvasView::notifyObservers(), and CanvasView::restoreFromSelectCopy().

void CanvasWindow::fileExportTextTuple  )  [protected, virtual]
 

Definition at line 735 of file CanvasWindow.cxx.

References QtFileDialog::getTextSuffix(), and m_canvas_view.

void CanvasWindow::fileNew  )  [virtual]
 

Creates a new document CanvasWindow.

Definition at line 451 of file CanvasWindow.cxx.

References CanvasWindow(), WindowController::instance(), and setCaption().

Referenced by hippodraw::Python::export_CanvasWindow().

void CanvasWindow::filePrint  )  [protected, virtual]
 

Prints the canvas to a Postscript file.

Todo:
Add the `.ps' subscript to the file name if missing.

Definition at line 363 of file CanvasWindow.cxx.

References m_canvas_view, and CanvasView::print().

void CanvasWindow::fileSave  ) 
 

Saves the document.

If the document already corresponds to a saved document, prompts the user with a warning dialog before over writing the file. If no file name has been assigned, then invokes the fileSaveAs() member function.

Definition at line 619 of file CanvasWindow.cxx.

References QString::append(), areDataSourcesSaved(), fileSaveAs(), m_filename, m_filenameExists, m_hasChanged, saveAs(), and QMessageBox::warning().

Referenced by allowClose().

void CanvasWindow::fileSaveAll  )  [protected, virtual]
 

Saves the canvas document and any NTuple that were not read from or written to a file.

The NTuple objects are saved in the same directory as the canvas document. Their name becomes just the file name with index number with the suffix ".tnt". The path is striped from the name.

Definition at line 671 of file CanvasWindow.cxx.

References fileSaveAllAs(), m_filename, m_filenameExists, and saveAllAs().

void CanvasWindow::fileSaveAllAs  )  [protected, virtual]
 

Saves the canvas document and its NTuple.

This function is similar to fileSaveAll(), but it always prompts the user for a filename.

Definition at line 682 of file CanvasWindow.cxx.

References m_filename, saveAllAs(), and setFilenameFromDialog().

Referenced by fileSaveAll().

void CanvasWindow::fileSaveAs  )  [virtual]
 

Saves the document after display a file dialog to the user.

Definition at line 657 of file CanvasWindow.cxx.

References areDataSourcesSaved(), m_filename, saveAs(), and setFilenameFromDialog().

Referenced by fileSave().

void CanvasWindow::fileSaveSelectedImages const std::string filename  )  [virtual]
 

Saves the selected ViewBase objects as an image file with the given filename.

Definition at line 710 of file CanvasWindow.cxx.

References m_canvas_view, and CanvasView::saveSelectedImages().

void CanvasWindow::fileSaveSelectedImages  )  [virtual]
 

Saves the selected ViewBase object as an image file.

Definition at line 705 of file CanvasWindow.cxx.

References m_canvas_view, and CanvasView::saveSelectedImages().

Referenced by PyCanvas::saveSelectedImages().

void CanvasWindow::fillPlotterList std::vector< PlotterBase * > &  plotter_list  ) 
 

Clears and fills plotter_list with all the PlotterBase objects on the canvas.

Definition at line 884 of file CanvasWindow.cxx.

References m_canvas_view.

CanvasView * CanvasWindow::getCanvasView  ) 
 

Returns the CanvasView object.

Definition at line 728 of file CanvasWindow.cxx.

References m_canvas_view.

Referenced by WindowController::newWindow().

QtView * CanvasWindow::getViewFor const PlotterBase plotter  )  const
 

Returns the QtView object that is the Observer of the plotter.

Definition at line 891 of file CanvasWindow.cxx.

References CanvasView::getViewFor(), and m_canvas_view.

Referenced by PyCanvas::findSelectedView().

void CanvasWindow::helpAbout  )  [protected, virtual]
 

Brings up standard window showing version, authors, etc.

Definition at line 783 of file CanvasWindow.cxx.

References m_canvas_view.

void CanvasWindow::hideEvent QHideEvent e  )  [protected, virtual]
 

Informs the application object that the window has been hidden.

Definition at line 291 of file CanvasWindow.cxx.

References WindowController::instance().

void CanvasWindow::inhibitClose bool  yes = true  ) 
 

If yes is true, sets a flag so that this object will not accept close events.

Definition at line 301 of file CanvasWindow.cxx.

References m_inhibit_close.

Referenced by WindowController::aboutToClose(), and WindowController::newWindow().

void CanvasWindow::initFromFile const std::string filename  ) 
 

Initializes this object from contents of file.

Definition at line 559 of file CanvasWindow.cxx.

References m_canvas_view, setChanged(), and setTitleFileName().

Referenced by on_fileBrowse_actived(), and on_fileOpen_activated().

const std::vector< double > & CanvasWindow::mouseEventData  ) 
 

Retrieve a vector (x, y, z) points from the next mouse event.

Definition at line 1001 of file CanvasWindow.cxx.

References m_canvas_view, and CanvasView::mouseEventData().

Referenced by PyCanvas::mouseData().

void CanvasWindow::nextView  )  [protected]
 

Switches View to the next view for the selected item on the canvas.

Definition at line 980 of file CanvasWindow.cxx.

References m_canvas_view, CanvasView::selectedPlotter(), and selectedPlotter().

Referenced by previousView().

void CanvasWindow::on_aboutQt_activated  )  [protected, virtual]
 

Brings up Qt's about message box.

Definition at line 790 of file CanvasWindow.cxx.

References QMessageBox::aboutQt().

void CanvasWindow::on_fileBrowse_actived  )  [protected, virtual, slot]
 

Browse a document file, without opening a window for it.

Definition at line 461 of file CanvasWindow.cxx.

References initFromFile(), QString::latin1(), m_browsed_canvas, m_file_dialog, s_plot_table, and QString::stripWhiteSpace().

void CanvasWindow::on_fileExit_activated  )  [protected, virtual, slot]
 

Responds to the Quit item in the File menu.

Definition at line 743 of file CanvasWindow.cxx.

References WindowController::instance().

void CanvasWindow::on_fileOpen_activated  )  [protected, virtual, slot]
 

Opens an existing file.

Opens an existing document or data file after prompting the user for the document's file name and/or type.

Definition at line 497 of file CanvasWindow.cxx.

References CanvasWindow(), initFromFile(), QString::latin1(), m_canvas_view, m_file_dialog, setChanged(), and QString::stripWhiteSpace().

void CanvasWindow::previousView  )  [protected]
 

Switches View to the previous view for the selected item on the canvas.

Definition at line 969 of file CanvasWindow.cxx.

References m_canvas_view, nextView(), CanvasView::selectedPlotter(), and selectedPlotter().

void CanvasWindow::print const std::string filename  ) 
 

Prints the view to Postscript file without prompting user.

Definition at line 1036 of file CanvasWindow.cxx.

References m_canvas_view.

void CanvasWindow::removeDisplay PlotterBase plotter  ) 
 

Removes the plotter and its view from the canvas.

Todo:
This method should only be in the CanvasView.

Definition at line 865 of file CanvasWindow.cxx.

References m_canvas_view, and CanvasView::removeDisplay().

Referenced by PyCanvas::removeDisplay().

void CanvasWindow::resetFontSize  )  [static]
 

Resets the font size to be no larger than 10.

Definition at line 107 of file CanvasWindow.cxx.

References QApplication::font(), QFont::pointSize(), QApplication::setFont(), QFont::setPointSize(), and num_util::size().

Referenced by QtApp::QtApp().

void CanvasWindow::resizeEvent QResizeEvent  )  [protected, virtual]
 

Informs the Canvas to resize as well.

Definition at line 575 of file CanvasWindow.cxx.

References m_canvas_view, QWidget::resizeEvent(), and FigureEditor::resizeEvent().

void CanvasWindow::saveAllAs const std::string filename  ) 
 

Saves the document along with its NTuple objects.

Requests:
Raise error dialog if saving doesn't work.

Definition at line 693 of file CanvasWindow.cxx.

References QtFileDialog::getTextSuffix(), NTupleController::instance(), m_file_dialog, and saveAs().

Referenced by fileSaveAll(), and fileSaveAllAs().

void CanvasWindow::saveAs const std::string filename  ) 
 

Saves the document to the specified file.

Definition at line 717 of file CanvasWindow.cxx.

References m_canvas_view, setCaption(), setChanged(), and setTitleFileName().

Referenced by fileSave(), fileSaveAs(), saveAllAs(), and PyCanvas::saveAs().

void CanvasWindow::saveAsImage const PlotterBase plotter,
const std::string filename
 

Saves the plotter as image file.

The filename should have suffix appropriate for the image format desired. If no suffix is given, then a file dialog may be opened. If file exists, it will be over-written as this method is intended to be call from Python script. It locks and locks the application object so it maybe called from a non-GUI thread.

Definition at line 937 of file CanvasWindow.cxx.

References m_canvas_view, and savePlotAsImage().

void CanvasWindow::savePlotAsImage const PlotterBase plotter,
const std::string filename
 

Saves the plotter as image file.

The filename should have suffix appropriate for the image format desired. If no suffix is given, then a file dialog may be opened. If file exists, it will be over-written as this method is intended to be call from Python script.

Attention:
Calling this method from a non GUI thread could be dangerous. It would be better to post a SaveAsImageEvent custom event to the CanvasWindow.

Definition at line 928 of file CanvasWindow.cxx.

References QApplication::postEvent().

Referenced by customEvent(), saveAsImage(), and savePlotAsImageImmediate().

void CanvasWindow::savePlotAsImageImmediate const PlotterBase plotter,
const std::string filename
 

Save plot as image file without posting an event.

Definition at line 947 of file CanvasWindow.cxx.

References m_canvas_view, and savePlotAsImage().

Referenced by PyCanvas::saveAsImage().

PlotterBase * CanvasWindow::selectedPlotter  ) 
 

Returns the selected plotter.

Todo:
This method should go away or return null pointer if multiple plots are selected.

Definition at line 872 of file CanvasWindow.cxx.

References m_canvas_view, and CanvasView::selectedPlotter().

Referenced by PyCanvas::getCut(), PyCanvas::getDisplay(), nextView(), and previousView().

void CanvasWindow::setAddedSelected bool  yes  ) 
 

Sets to flag to make plots in their selected state when added to the canvas.

Definition at line 1051 of file CanvasWindow.cxx.

References m_canvas_view.

void CanvasWindow::setAllowClose bool  yes = true  ) 
 

Sets the window to allowed to be closed by user without prompting.

Definition at line 183 of file CanvasWindow.cxx.

References m_allow_close.

void CanvasWindow::setAllSelected bool  flag = true  ) 
 

Select or de-select all views in the window.

Definition at line 955 of file CanvasWindow.cxx.

References m_canvas_view, and FigureEditor::setAllSelected().

void CanvasWindow::setCaption  ) 
 

Sets the Windows title.

The windows title depends on an number of attributes. They are collected to set the title.

Definition at line 795 of file CanvasWindow.cxx.

References m_changed, m_filename, m_prefix, and QWidget::setCaption().

Referenced by CanvasWindow(), fileNew(), saveAs(), setChanged(), WindowController::setFirstWindow(), and QtApp::setFirstWindow().

void CanvasWindow::setChanged bool  flag = true  ) 
 

Sets the changed flag.

If the changed status has already set to true and flag is true, this member function does nothing. Otherwise, updates the window's title bar to reflect the document's current status.

See also:
m_hasChanged.

Definition at line 306 of file CanvasWindow.cxx.

References WindowController::instance(), m_changed, m_hasChanged, setCaption(), and updateActions().

Referenced by initFromFile(), on_fileOpen_activated(), saveAs(), and CanvasView::setChanged().

bool CanvasWindow::setFilenameFromDialog  )  [private]
 

Sets the file name of document.

Sets the file name of the canvas document from a QtFileDialog with the user. Returns true if the user gave the dialog a file name. Returns false if the user canceled.

Definition at line 648 of file CanvasWindow.cxx.

References m_file_dialog, m_filename, and m_filenameExists.

Referenced by fileSaveAllAs(), and fileSaveAs().

void CanvasWindow::setIntervalEnabled bool  yes = true  ) 
 

Sets the display interval feature to enabled if yes is true, otherwise sets it to disabled.

Definition at line 896 of file CanvasWindow.cxx.

References m_canvas_view, and CanvasView::setIntervalEnabled().

void CanvasWindow::setPlotMatrix unsigned int  columns,
unsigned int  rows
 

Sets the number of columns and rows of plots on each page.

Definition at line 1043 of file CanvasWindow.cxx.

References m_canvas_view.

void CanvasWindow::setSelected QtView view  ) 
 

Select a specific view in the window.

Definition at line 962 of file CanvasWindow.cxx.

References m_canvas_view, and FigureEditor::setSelectedItem().

Referenced by PyCanvas::selectDisplay().

void CanvasWindow::settingCanvas  )  [protected, virtual]
 

Sets the canvas settings.

Definition at line 1015 of file CanvasWindow.cxx.

References m_canvas_view.

void CanvasWindow::settingFonts  )  [protected, virtual]
 

Sets the font settings.

Definition at line 1022 of file CanvasWindow.cxx.

References QFontDialog::getFont(), and m_canvas_view.

void CanvasWindow::settingPrinter  )  [protected, virtual]
 

Sets the printer settings.

Definition at line 1008 of file CanvasWindow.cxx.

References m_canvas_view.

void CanvasWindow::setTitleFileName const std::string name  )  [private]
 

Sets the file name component of the window's title.

Definition at line 804 of file CanvasWindow.cxx.

References m_filename, and m_filenameExists.

Referenced by initFromFile(), and saveAs().

void CanvasWindow::setZoomMode  )  [protected, virtual]
 

Sets the zoom mode to true or false.

Definition at line 992 of file CanvasWindow.cxx.

References m_canvas_view.

void CanvasWindow::showEvent QShowEvent e  )  [protected, virtual]
 

Informs the application object that the window has been shown.

Definition at line 296 of file CanvasWindow.cxx.

References WindowController::instance().

void CanvasWindow::updateActions  ) 
 

Update Action objects.

Sets enable status of QAction objects such as menu items and tool bar icons.

Definition at line 324 of file CanvasWindow.cxx.

References QtXMLController::instance(), m_canvas_view, CanvasView::selectedViews(), and views().

Referenced by editClear(), editCopy(), editCut(), editDelete(), editSelectAll(), setChanged(), WindowController::updateActions(), viewLock(), viewUnlock(), and windowActivationChange().

void CanvasWindow::viewAddPage  )  [protected, virtual]
 

Adds a page to the canvas.

Definition at line 582 of file CanvasWindow.cxx.

References FigureEditor::addPage(), and m_canvas_view.

void CanvasWindow::viewLock  )  [protected, virtual]
 

Locks a canvas item.

Locks a canvas item so it can not be moved or resized.

Definition at line 769 of file CanvasWindow.cxx.

References m_canvas_view, FigureEditor::setLocked(), and updateActions().

const vector< const ViewBase * > & CanvasWindow::views  ) 
 

Returns the list of ViewBase objects on the canvas.

Definition at line 877 of file CanvasWindow.cxx.

References m_canvas_view, and CanvasView::views().

Referenced by areDataSourcesSaved(), PyCanvas::findSelectedView(), PyCanvas::getDisplays(), and updateActions().

void CanvasWindow::viewShowInspector  )  [protected, virtual]
 

Shows the Inspector window.

Definition at line 903 of file CanvasWindow.cxx.

References m_canvas_view.

void CanvasWindow::viewShowPickTable  )  [protected, virtual]
 

Shows the pick table window.

Definition at line 921 of file CanvasWindow.cxx.

References m_canvas_view, and CanvasView::viewShowPickTable().

void CanvasWindow::viewShowPlotTable  )  [protected, virtual]
 

Shows the plot table.

Definition at line 910 of file CanvasWindow.cxx.

References m_canvas_view, s_plot_table, and PlotTable::setCanvas().

void CanvasWindow::viewUnlock  )  [protected, virtual]
 

Unlocks a canvas item.

Unlocks a canvas item so it can be moved and resized.

Definition at line 777 of file CanvasWindow.cxx.

References m_canvas_view, FigureEditor::setLocked(), and updateActions().

void CanvasWindow::viewZoomIn  )  [protected, virtual]
 

Enlarges the view of the canvas.

Definition at line 750 of file CanvasWindow.cxx.

References m_canvas_view, and FigureEditor::viewZoomIn().

void CanvasWindow::viewZoomOut  )  [protected, virtual]
 

Reduces the view of the canvas.

Definition at line 755 of file CanvasWindow.cxx.

References m_canvas_view, and FigureEditor::viewZoomOut().

void CanvasWindow::viewZoomReset  )  [protected, virtual]
 

Returns the view of the canvas to normal.

Definition at line 762 of file CanvasWindow.cxx.

References m_canvas_view.

void CanvasWindow::windowActivationChange bool  oldActive  )  [protected, virtual]
 

Informs the application object if this window has become the active one.

Attention:
The implementation of this function informs the singleton instance of the application that this window has become the active one. Therefore, the implementation of the constructor must not cause this method to be called before the application object is full constructed.

Definition at line 167 of file CanvasWindow.cxx.

References WindowController::instance(), m_canvas_view, updateActions(), and QWidget::windowActivationChange().


Member Data Documentation

bool CanvasWindow::m_allow_close [private]
 

A flag set to true to allow the window to close without prompting the user.

Definition at line 157 of file CanvasWindow.h.

Referenced by allowClose(), closeEvent(), closeNoPrompt(), and setAllowClose().

CanvasView* CanvasWindow::m_browsed_canvas [private]
 

The CanvasView object that is being browsed.

Definition at line 126 of file CanvasWindow.h.

Referenced by customEvent(), and on_fileBrowse_actived().

CanvasView* CanvasWindow::m_canvas_view [private]
 

The CanvasView object which is the central widget.

Definition at line 122 of file CanvasWindow.h.

Referenced by addDisplay(), addFuncDisplay(), addPlotDisplay(), addTextDisplay(), addTextDisplayAt(), allowClose(), areDataSourcesSaved(), CanvasWindow(), clear(), closeEvent(), customEvent(), editCopy(), editCut(), editDelete(), editPaste(), editReTile(), editReTilePage(), editSelectAll(), editUndo(), fileExportTextTuple(), filePrint(), fileSaveSelectedImages(), fillPlotterList(), getCanvasView(), getViewFor(), helpAbout(), initFromFile(), mouseEventData(), nextView(), on_fileOpen_activated(), previousView(), print(), removeDisplay(), resizeEvent(), saveAs(), saveAsImage(), savePlotAsImageImmediate(), selectedPlotter(), setAddedSelected(), setAllSelected(), setIntervalEnabled(), setPlotMatrix(), setSelected(), settingCanvas(), settingFonts(), settingPrinter(), setZoomMode(), updateActions(), viewAddPage(), viewLock(), views(), viewShowInspector(), viewShowPickTable(), viewShowPlotTable(), viewUnlock(), viewZoomIn(), viewZoomOut(), viewZoomReset(), windowActivationChange(), and ~CanvasWindow().

QString CanvasWindow::m_changed [private]
 

The changed status part of the window title.

Definition at line 139 of file CanvasWindow.h.

Referenced by setCaption(), and setChanged().

QtFileDialog* CanvasWindow::m_file_dialog [private]
 

The open file dialog for this window.

Definition at line 130 of file CanvasWindow.h.

Referenced by CanvasWindow(), on_fileBrowse_actived(), on_fileOpen_activated(), saveAllAs(), and setFilenameFromDialog().

std::string CanvasWindow::m_filename [private]
 

The file name part of the window title.

Definition at line 136 of file CanvasWindow.h.

Referenced by allowClose(), fileSave(), fileSaveAll(), fileSaveAllAs(), fileSaveAs(), setCaption(), setFilenameFromDialog(), and setTitleFileName().

bool CanvasWindow::m_filenameExists [private]
 

True if filename has been assigned, false if not.

Definition at line 160 of file CanvasWindow.h.

Referenced by fileSave(), fileSaveAll(), setFilenameFromDialog(), and setTitleFileName().

bool CanvasWindow::m_hasChanged [private]
 

The current changed status.

If true, the document has been changed since last saved or opened. If false the document has not been changed since saved or opened.

Definition at line 148 of file CanvasWindow.h.

Referenced by allowClose(), fileSave(), and setChanged().

bool CanvasWindow::m_inhibit_close [private]
 

A flag set to true if the CanvasWindow should not accept a close event.

Definition at line 152 of file CanvasWindow.h.

Referenced by closeEvent(), and inhibitClose().

QString CanvasWindow::m_prefix [private]
 

The prefix part of the window title.

Definition at line 133 of file CanvasWindow.h.

Referenced by setCaption().

XmlController* CanvasWindow::m_xml_controller [private]
 

The controller object capable of serializing the canvas contents as XML and serializing them.

Definition at line 119 of file CanvasWindow.h.

Referenced by areDataSourcesSaved(), and CanvasWindow().

PlotTable * CanvasWindow::s_plot_table = 0 [static, private]
 

The singleton instance of PlotTable.

Definition at line 57 of file CanvasWindow.cxx.

Referenced by customEvent(), on_fileBrowse_actived(), and viewShowPlotTable().


The documentation for this class was generated from the following files:
Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3