Gui::MacroManager Class Reference

Macro recording and play back management The purpos of this class is to handle record function calls from a command and save it in a macro file (so far). More...

#include <Macro.h>

Inheritance diagram for Gui::MacroManager:
Base::Observer< const char * >

List of all members.

Public Types

enum  LineType { Base, Gui }
 

Line type enumeration.

More...
enum  MacroType { File, App, Doc }
 

Macro type enumeration.

More...

Public Member Functions

void addLine (LineType Type, const char *sLine)
 insert a new line in the macro
void cancel (void)
 cancels the recording session
void commit (void)
 close (and save) the recording session
PythonDebuggerdebugger () const
 Get the Python debugger.
bool isOpen (void) const
 indicates if a macro recording in in progress
void OnChange (Base::Subject< const char * > &rCaller, const char *sReason)
 Observes its parameter group.
void open (MacroType eType, const char *sName)
 Opens a new Macro recording session Starts a session with the type and the name of the macro.
void run (MacroType eType, const char *sName)
void setModule (const char *sModule)
 Set the active module This is normaly done by the workbench switch.

Protected Member Functions

 MacroManager ()
 ~MacroManager ()

Protected Attributes

bool guiAsComment
QString macroInProgress
 Container for the macro.
QString macroName
 name of the macro
bool openMacro
Base::Reference< ParameterGrpparams
PythonConsolepyConsole
PythonDebuggerpyDebugger
bool recordGui
bool scriptToPyConsole

Friends

struct ApplicationP

Detailed Description

Macro recording and play back management The purpos of this class is to handle record function calls from a command and save it in a macro file (so far).

Author:
Jürgen Riegel

Definition at line 43 of file Macro.h.


Member Enumeration Documentation

Line type enumeration.

Enumerator:
Base 

The line effects only the document and Application (FreeCAD).

Gui 

The line effects the Gui (FreeCADGui).

Definition at line 59 of file Macro.h.

Macro type enumeration.

Enumerator:
File 

The macro will be saved in a file.

App 

The macro belongs to the Application and will be saved in the UserParameter.

Doc 

Teh macro belongs to the Document and will be saved and restored with the Document.

Definition at line 52 of file Macro.h.


Constructor & Destructor Documentation

MacroManager::MacroManager (  )  [protected]
MacroManager::~MacroManager (  )  [protected]

Definition at line 63 of file Macro.cpp.

References params, and pyDebugger.


Member Function Documentation

void MacroManager::addLine ( LineType  Type,
const char *  sLine 
)
void MacroManager::cancel ( void   ) 

cancels the recording session

Definition at line 149 of file Macro.cpp.

References Base::Console(), macroInProgress, macroName, and openMacro.

Referenced by commit(), and Gui::Dialog::DlgMacroRecordImp::on_buttonCancel_clicked().

void MacroManager::commit ( void   ) 

close (and save) the recording session

Definition at line 93 of file Macro.cpp.

References cancel(), Base::Console(), DrawingExample::file, macroInProgress, macroName, and openMacro.

Referenced by StdCmdMacroStopRecord::activated(), and Gui::Dialog::DlgMacroRecordImp::on_buttonStop_clicked().

PythonDebugger * MacroManager::debugger (  )  const

Get the Python debugger.

Definition at line 232 of file Macro.cpp.

References pyDebugger.

Referenced by Gui::PythonEditorView::PythonEditorView().

bool Gui::MacroManager::isOpen ( void   )  const [inline]
void MacroManager::OnChange ( Base::Subject< const char * > &  rCaller,
const char *  sReason 
) [virtual]

Observes its parameter group.

Implements Base::Observer< const char * >.

Definition at line 69 of file Macro.cpp.

References guiAsComment, params, recordGui, and scriptToPyConsole.

void MacroManager::open ( MacroType  eType,
const char *  sName 
)

Opens a new Macro recording session Starts a session with the type and the name of the macro.

All user interactions will be recorded as long as the commit() or cancel() isn't called. There is only one recording session possible. Trying to open a second one causes an exception:

Parameters:
eType Type of the macro
sName Name or path of the macro
See also:
commit()
cancel()

Definition at line 76 of file Macro.cpp.

References Base::Console(), File, macroInProgress, macroName, and openMacro.

Referenced by Gui::Dialog::DlgMacroRecordImp::on_buttonStart_clicked().

void MacroManager::run ( MacroType  eType,
const char *  sName 
)
void MacroManager::setModule ( const char *  sModule  ) 

Set the active module This is normaly done by the workbench switch.

It sets the actually active application module so when the macro gets started the right import can be issued.

Definition at line 184 of file Macro.cpp.

References macroInProgress, and openMacro.

Referenced by Gui::Command::invoke().


Friends And Related Function Documentation

friend struct ApplicationP [friend]

Definition at line 105 of file Macro.h.


Member Data Documentation

Definition at line 99 of file Macro.h.

Referenced by addLine(), and OnChange().

Container for the macro.

Definition at line 95 of file Macro.h.

Referenced by addLine(), cancel(), commit(), open(), and setModule().

QString Gui::MacroManager::macroName [protected]

name of the macro

Definition at line 96 of file Macro.h.

Referenced by cancel(), commit(), and open().

bool Gui::MacroManager::openMacro [protected]

Definition at line 97 of file Macro.h.

Referenced by addLine(), cancel(), commit(), open(), and setModule().

Definition at line 103 of file Macro.h.

Referenced by MacroManager(), OnChange(), and ~MacroManager().

Definition at line 101 of file Macro.h.

Referenced by addLine().

Definition at line 102 of file Macro.h.

Referenced by debugger(), and ~MacroManager().

bool Gui::MacroManager::recordGui [protected]

Definition at line 98 of file Macro.h.

Referenced by addLine(), and OnChange().

Definition at line 100 of file Macro.h.

Referenced by addLine(), and OnChange().


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