From 1e5115b0b40bcf57501d4b0b5dce8e7ecd61432d Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 24 Nov 2014 04:57:26 +0100 Subject: Q-Register loading and saving using the IOView class * EW can save Q-Registers now * the new E% may be used to save a q-register without making it the current document --- src/qregisters.h | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'src/qregisters.h') diff --git a/src/qregisters.h b/src/qregisters.h index 80222f8..9dd3989 100644 --- a/src/qregisters.h +++ b/src/qregisters.h @@ -27,6 +27,7 @@ #include "sciteco.h" #include "interface.h" +#include "ioview.h" #include "undo.h" #include "rbtree.h" #include "parser.h" @@ -35,8 +36,8 @@ namespace SciTECO { namespace QRegisters { - /* initialized after Interface.main() in main() */ - extern ViewCurrent view; + /* initialized after Interface::main() in main() */ + extern IOView view; } /* @@ -134,12 +135,12 @@ public: void execute(bool locals = true); + /* + * Load and save already care about undo token + * creation. + */ void load(const gchar *filename); - inline void - undo_load(void) - { - undo_set_string(); - } + void save(const gchar *filename); }; class QRegisterBufferInfo : public QRegister { @@ -356,6 +357,16 @@ private: State *done(const gchar *str); }; +class StateEPctCommand : public StateExpectQReg { +private: + State *got_register(QRegister ®); +}; + +class StateSaveQReg : public StateExpectFile { +private: + State *done(const gchar *str); +}; + class StateCtlUCommand : public StateExpectQReg { public: StateCtlUCommand() : StateExpectQReg(true) {} @@ -433,6 +444,8 @@ namespace States { extern StatePopQReg popqreg; extern StateEQCommand eqcommand; extern StateLoadQReg loadqreg; + extern StateEPctCommand epctcommand; + extern StateSaveQReg saveqreg; extern StateCtlUCommand ctlucommand; extern StateEUCommand eucommand; extern StateSetQRegString setqregstring_nobuilding; -- cgit v1.2.3