00001 /*************************************************************************** 00002 * Copyright (c) 2004 Jürgen Riegel <juergen.riegel@web.de> * 00003 * * 00004 * This file is part of the FreeCAD CAx development system. * 00005 * * 00006 * This library is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU Library General Public * 00008 * License as published by the Free Software Foundation; either * 00009 * version 2 of the License, or (at your option) any later version. * 00010 * * 00011 * This library is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU Library General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Library General Public * 00017 * License along with this library; see the file COPYING.LIB. If not, * 00018 * write to the Free Software Foundation, Inc., 59 Temple Place, * 00019 * Suite 330, Boston, MA 02111-1307, USA * 00020 * * 00021 ***************************************************************************/ 00022 00023 00024 #ifndef GUI_MACRO_H 00025 #define GUI_MACRO_H 00026 00027 // Std. configurations 00028 #include <QString> 00029 #include <Base/Observer.h> 00030 #include <Base/Parameter.h> 00031 00032 00033 namespace Gui { 00034 struct ApplicationP; 00035 class PythonConsole; 00036 class PythonDebugger; 00037 00043 class GuiExport MacroManager : public Base::Observer<const char*> 00044 { 00045 protected: 00046 MacroManager(); 00047 ~MacroManager(); 00048 00049 public: 00050 00052 enum MacroType { 00053 File, 00054 App, 00055 Doc 00056 }; 00057 00059 enum LineType { 00060 Base, 00061 Gui, 00062 }; 00063 00073 void open(MacroType eType,const char *sName); 00075 void commit(void); 00077 void cancel(void); 00079 bool isOpen(void) const {return openMacro;} 00081 void addLine(LineType Type,const char* sLine); 00087 void setModule(const char* sModule); 00088 void run(MacroType eType,const char *sName); 00090 PythonDebugger* debugger() const; 00092 void OnChange(Base::Subject<const char*> &rCaller, const char * sReason); 00093 00094 protected: 00095 QString macroInProgress; 00096 QString macroName; 00097 bool openMacro; 00098 bool recordGui; 00099 bool guiAsComment; 00100 bool scriptToPyConsole; 00101 PythonConsole* pyConsole; // link to the python console 00102 PythonDebugger* pyDebugger; 00103 Base::Reference<ParameterGrp> params; // link to the Macro parameter group 00104 00105 friend struct ApplicationP; 00106 }; 00107 00108 } // namespace Gui 00109 00110 00111 #endif // GUI_MACRO_H