Gui::EditorView Class Reference

A special view class which sends the messages from the application to the editor and embeds it in a window. More...

#include <EditorView.h>

Inheritance diagram for Gui::EditorView:
Gui::MDIView Gui::WindowParameter Gui::BaseView Base::BaseClass Gui::PythonEditorView

List of all members.

Public Member Functions

bool canClose (void)
 Checking on close state.
virtual void drawMarker (int line, int x, int y, QPainter *)
 EditorView (QPlainTextEdit *editor, QWidget *parent)
 Constructs a EditorView which is a child of 'parent', with the name 'name'.
QString fileName () const
QPlainTextEdit * getEditor () const
const char * getName (void) const
 returns the name of the view (important for messages)
void OnChange (Base::Subject< const char * > &rCaller, const char *rcReason)
bool onHasMsg (const char *pMsg) const
 Checks if the action pMsg is available.
bool onMsg (const char *pMsg, const char **ppReturn)
 Runs the action specified by pMsg.
void onUpdate (void)
 get called when the document is updated
QStringList redoActions () const
 Get the redo history.
QStringList undoActions () const
 Get the undo history.
 ~EditorView ()
 Destroys the object and frees any allocated resources.
Standard actions of the editor



void copy ()
 Copies any selected text to the clipboard.
void cut ()
 Copies the selected text to the clipboard and deletes it from the text edit.
bool open (const QString &f)
 Opens the file fileName.
void paste ()
 Pastes the text from the clipboard into the text edit at the current cursor position.
void print ()
 Shows the printer dialog.
void printPdf ()
 Prints the document into a Pdf file.
void printPreview ()
void redo ()
 Redoes the last operation.
bool saveAs ()
 Saves the content of the editor to a file specified by the appearing file dialog.
void undo ()
 Undoes the last operation.

Protected Member Functions

void focusInEvent (QFocusEvent *e)

Detailed Description

A special view class which sends the messages from the application to the editor and embeds it in a window.

Author:
Werner Mayer

Definition at line 44 of file EditorView.h.


Constructor & Destructor Documentation

EditorView::EditorView ( QPlainTextEdit *  editor,
QWidget *  parent 
)

Constructs a EditorView which is a child of 'parent', with the name 'name'.

Definition at line 76 of file EditorView.cpp.

References Gui::EditorViewP::activityTimer, draftlibs::fcgeo::connect(), Gui::WindowParameter::getWindowParameter(), Gui::EditorViewP::lock, and Gui::EditorViewP::textEdit.

EditorView::~EditorView (  ) 

Destroys the object and frees any allocated resources.

Definition at line 119 of file EditorView.cpp.

References Gui::EditorViewP::activityTimer, and Gui::WindowParameter::getWindowParameter().


Member Function Documentation

bool EditorView::canClose ( void   )  [virtual]

Checking on close state.

Reimplemented from Gui::MDIView.

Definition at line 240 of file EditorView.cpp.

References Gui::EditorViewP::textEdit.

void EditorView::copy ( void   ) 

Copies any selected text to the clipboard.

Definition at line 314 of file EditorView.cpp.

References Gui::EditorViewP::textEdit.

Referenced by onMsg().

void EditorView::cut ( void   ) 

Copies the selected text to the clipboard and deletes it from the text edit.

If there is no selected text nothing happens.

Definition at line 306 of file EditorView.cpp.

References Gui::EditorViewP::textEdit.

Referenced by onMsg().

void EditorView::drawMarker ( int  line,
int  x,
int  y,
QPainter *   
) [virtual]

Reimplemented in Gui::PythonEditorView.

Definition at line 127 of file EditorView.cpp.

QString EditorView::fileName (  )  const
void EditorView::focusInEvent ( QFocusEvent *  e  )  [protected]

Definition at line 484 of file EditorView.cpp.

References Gui::EditorViewP::textEdit.

QPlainTextEdit * EditorView::getEditor (  )  const
const char* Gui::EditorView::getName ( void   )  const [inline, virtual]

returns the name of the view (important for messages)

Reimplemented from Gui::BaseView.

Definition at line 57 of file EditorView.h.

void EditorView::OnChange ( Base::Subject< const char * > &  rCaller,
const char *  rcReason 
)

Reimplemented from Gui::WindowParameter.

Definition at line 136 of file EditorView.cpp.

References Gui::WindowParameter::getWindowParameter().

bool EditorView::onHasMsg ( const char *  pMsg  )  const [virtual]

Checks if the action pMsg is available.

This is for enabling/disabling the corresponding buttons or menu items for this action.

Reimplemented from Gui::MDIView.

Reimplemented in Gui::PythonEditorView.

Definition at line 205 of file EditorView.cpp.

References Gui::EditorViewP::textEdit.

bool EditorView::onMsg ( const char *  pMsg,
const char **  ppReturn 
) [virtual]

Runs the action specified by pMsg.

Reimplemented from Gui::MDIView.

Reimplemented in Gui::PythonEditorView.

Definition at line 170 of file EditorView.cpp.

References copy(), cut(), paste(), redo(), saveAs(), and undo().

void Gui::EditorView::onUpdate ( void   )  [inline, virtual]

get called when the document is updated

Reimplemented from Gui::BaseView.

Definition at line 58 of file EditorView.h.

bool EditorView::open ( const QString &  f  ) 
void EditorView::paste ( void   ) 

Pastes the text from the clipboard into the text edit at the current cursor position.

If there is no text in the clipboard nothing happens.

Definition at line 323 of file EditorView.cpp.

References Gui::EditorViewP::textEdit.

Referenced by onMsg().

void EditorView::print (  )  [virtual]

Shows the printer dialog.

Reimplemented from Gui::MDIView.

Definition at line 361 of file EditorView.cpp.

References Gui::EditorViewP::textEdit.

Referenced by printPreview().

void EditorView::printPdf (  )  [virtual]

Prints the document into a Pdf file.

Reimplemented from Gui::MDIView.

Definition at line 388 of file EditorView.cpp.

References draftlibs::dxfReader::filename, Gui::FileDialog::getSaveFileName(), and Gui::EditorViewP::textEdit.

void EditorView::printPreview (  )  [virtual]

Reimplemented from Gui::MDIView.

Definition at line 371 of file EditorView.cpp.

References draftlibs::fcgeo::connect(), and print().

void EditorView::redo ( void   ) 

Redoes the last operation.

If there is no operation to undo, i.e. there is no undo step in the undo/redo history, nothing happens.

Definition at line 347 of file EditorView.cpp.

References Gui::EditorViewP::lock, Gui::EditorViewP::redos, Gui::EditorViewP::textEdit, and Gui::EditorViewP::undos.

Referenced by onMsg().

QStringList EditorView::redoActions (  )  const

Get the redo history.

Definition at line 479 of file EditorView.cpp.

References Gui::EditorViewP::redos.

Referenced by Gui::Dialog::RedoDialog::onFetchInfo().

bool EditorView::saveAs ( void   ) 

Saves the content of the editor to a file specified by the appearing file dialog.

Definition at line 265 of file EditorView.cpp.

References Gui::FileDialog::getSaveFileName().

Referenced by onMsg().

void EditorView::undo ( void   ) 

Undoes the last operation.

If there is no operation to undo, i.e. there is no undo step in the undo/redo history, nothing happens.

Definition at line 332 of file EditorView.cpp.

References Gui::EditorViewP::lock, Gui::EditorViewP::redos, Gui::EditorViewP::textEdit, and Gui::EditorViewP::undos.

Referenced by onMsg().

QStringList EditorView::undoActions (  )  const

Get the undo history.

Definition at line 471 of file EditorView.cpp.

References Gui::EditorViewP::undos.

Referenced by Gui::Dialog::UndoDialog::onFetchInfo().


The documentation for this class was generated from the following files:

Generated on Wed Nov 23 19:02:00 2011 for FreeCAD by  doxygen 1.6.1