Relacs
0.9.8
|
#include <macros.h>
Public Types | |
typedef deque< MacroCommand * > ::iterator | iterator |
Public Slots | |
void | run (void) |
void | launch (void) |
void | popup (void) |
void | dialog (void) |
void | acceptDialog (void) |
void | dialogAction (int r) |
void | dialogClosed (int r) |
Public Member Functions | |
Macro (void) | |
Macro (Str name, Macros *mcs) | |
Macro (const Macro ¯o) | |
string | name (void) const |
Options & | variables (void) |
string | variablesStr (void) const |
void | addParameter (const Str ¶m) |
string | expandParameter (const Str ¶ms) const |
int | action (void) const |
void | setAction (int action) |
void | delAction (int action) |
bool | button (void) const |
MacroButton * | pushButton (void) const |
void | addButton (const string &keys) |
bool | menu (void) const |
void | addMenu (QMenu *menu, int &num) |
string | menuStr (void) const |
bool | key (void) const |
string | setKey (int &index) |
void | clear (void) |
bool | keep (void) const |
bool | overwrite (void) const |
int | size (void) const |
MacroCommand * | command (int index) |
void | push (MacroCommand *mc) |
iterator | begin (void) |
iterator | end (void) |
string | load (ifstream ¯ostream, string &line, int &linenum, string &warnings) |
void | check (string &warnings) |
void | checkOptions (string &warnings) |
void | setMacroIndices (void) |
void | init (int macronum) |
void | reloadRePro (RePro *repro) |
void | clearButton (void) |
void | setRunButton (void) |
void | setStackButton (bool base) |
Static Public Member Functions | |
static void | createIcons (int size) |
static void | destroyIcons (void) |
Static Public Attributes | |
static const int | StartUp = 0x01 |
static const int | ShutDown = 0x02 |
static const int | FallBack = 0x04 |
static const int | ExplicitFallBack = 0x08 |
static const int | StartSession = 0x10 |
static const int | StopSession = 0x20 |
static const int | NoMacro = 0x40 |
Friends | |
ostream & | operator<< (ostream &str, const Macro ¯o) |
A single Macro.
typedef deque<MacroCommand*>::iterator iterator |
Iterator used to iterate through the commands.
Macro | ( | void | ) |
Default constructor.
Construct a new macro with name name.
References Macro::addParameter(), Options::clear(), Str::erase(), Macro::ExplicitFallBack, Macro::FallBack, Str::find(), Macro::ShutDown, Macro::StartSession, Macro::StartUp, Macro::StopSession, Str::stripped(), Str::substr(), and Str::WordSpace.
string name | ( | void | ) | const |
The name of the macro.
Referenced by Macro::addMenu(), MacroCommand::check(), and Macro::expandParameter().
Options & variables | ( | void | ) |
Returns the macro variables.
Referenced by MacroCommand::dialog(), MacroCommand::run(), and MacroCommand::start().
string variablesStr | ( | void | ) | const |
Returns the macro variables as a string.
References Options::save(), and Options::size().
void addParameter | ( | const Str & | param | ) |
Add parameter from param to the macros variables.
References Options::load(), and Options::setToDefaults().
Referenced by Macro::Macro().
string expandParameter | ( | const Str & | params | ) | const |
Replaces macro variables in params by their value.
References Str::erase(), Str::find(), relacs::floor(), Parameter::isNotype(), Parameter::isNumber(), relacs::max(), relacs::min(), Macro::name(), Str::number(), Str::preventLast(), RELACSWidget::printlog(), relacs::rnd(), Macros::RW, StrQueue::size(), Str::stripped(), Str::substr(), Parameter::text(), and Str::WhiteSpace.
Referenced by MacroCommand::acceptDialog(), MacroCommand::checkOptions(), MacroCommand::dialog(), and MacroCommand::execute().
int action | ( | void | ) | const |
The type of action on which this macro is executed.
Referenced by MacroCommand::execute(), relacs::operator<<(), and Macro::setAction().
void setAction | ( | int | action | ) |
Set the Macro's action flag to action.
References Macro::action().
void delAction | ( | int | action | ) |
Delete the action flag action from the Macro's action.
bool button | ( | void | ) | const |
True if this Macro has a button.
Referenced by relacs::operator<<().
MacroButton * pushButton | ( | void | ) | const |
The button of the macro.
void addButton | ( | const string & | keys | ) |
Add button for the macro and its commands to menu.
References Macro::clearButton(), Macro::launch(), and Macro::popup().
bool menu | ( | void | ) | const |
True if this Macro has a menu.
Referenced by relacs::operator<<().
void addMenu | ( | QMenu * | menu, |
int & | num | ||
) |
Add menu for the macro and its commands to menu. num counts the number of macro menus (not each macro gets a menu!).
References Macro::dialog(), Options::empty(), Macro::menuStr(), Macro::name(), and Macro::run().
string menuStr | ( | void | ) | const |
Forms a string for the menu consisting of the macro name and its variables.
References Options::FirstOnly, Macros::MenuWidth, Options::save(), and Options::size().
Referenced by Macro::acceptDialog(), and Macro::addMenu().
bool key | ( | void | ) | const |
True if this Macro has a shortcut key.
string setKey | ( | int & | index | ) |
Set a shortcut key for the Macro and return it as a string.
References Macro::FallBack.
void clear | ( | void | ) |
Clear menu and button.
bool keep | ( | void | ) | const |
True if this Macro is not to be cleared.
bool overwrite | ( | void | ) | const |
True if this Macro overwrites existing ones.
int size | ( | void | ) | const |
The number of commands the macro owns.
Referenced by MacroCommand::addMenu(), and relacs::operator<<().
MacroCommand * command | ( | int | index | ) |
The index -th command of this Macro .
void push | ( | MacroCommand * | mc | ) |
Add the command mc to the list of commands.
Macro::iterator begin | ( | void | ) |
Returns an iterator pointing to the first command pointer.
Macro::iterator end | ( | void | ) |
Returns an iterator pointing behind the last command pointer.
string load | ( | ifstream & | macrostream, |
string & | line, | ||
int & | linenum, | ||
string & | warnings | ||
) |
Load commands from a file until a new macro definition is encountered. Returns the stripped line and in line the full line containing the macro definition or macro parameter. linenum holds the current line number and is incremented whenever load() reads a line. Warnings are appended tp warnings .
References MacroCommand::BrowseCom, MacroCommand::command(), MacroCommand::DetectorCom, Str::empty(), MacroCommand::FilterCom, Str::find(), relacs::line(), MacroCommand::MessageCom, MacroCommand::name(), MacroCommand::parameter(), MacroCommand::setReProCommand(), MacroCommand::ShellCom, MacroCommand::ShutdownCom, MacroCommand::StartSessionCom, MacroCommand::StopSessionCom, Str::strip(), MacroCommand::SwitchCom, MacroCommand::UnknownCom, and Str::WhiteSpace.
void check | ( | string & | warnings | ) |
Check and expand commands. Warnings are appended tp warnings .
References Str::find(), Str::findBracket(), Str::mid(), Str::replace(), MacroCommand::ReProCom, and MacroCommand::setParameter().
void checkOptions | ( | string & | warnings | ) |
Check options for repros. Warnings are appended tp warnings .
void setMacroIndices | ( | void | ) |
Set the indices of macro commands.
References Macros::index(), and MacroCommand::MacroCom.
void init | ( | int | macronum | ) |
Initialize the number of this macro and the command numbers.
void reloadRePro | ( | RePro * | repro | ) |
Update the macro for the reloaded repro repro.
void clearButton | ( | void | ) |
void setRunButton | ( | void | ) |
Set the icon indicating a running macro.
void setStackButton | ( | bool | base | ) |
Set the icon indicating the stack position.
|
static |
|
static |
|
slot |
Runs this macro.
References RELACSWidget::displayData(), Macro::launch(), and Macros::RW.
Referenced by Macro::addMenu().
|
slot |
Stops the currently running repro and starts this macro.
References Macro::FallBack, Options::setDefaults(), Macros::startMacro(), and Macros::store().
Referenced by Macro::addButton(), and Macro::run().
|
slot |
Open the popup menu right above the macro's button.
Referenced by Macro::addButton().
|
slot |
Opens a macro dialog.
References OptDialog::Accept, Macro::acceptDialog(), OptDialog::addButton(), OptDialog::addOptions(), OptDialog::addSeparator(), Macro::dialogAction(), Macro::dialogClosed(), Options::empty(), OptDialog::exec(), relacs::exp(), OptDialog::setCaption(), OptDialog::setRejectCode(), OptDialog::setVerticalSpacing(), and Options::size().
Referenced by Macro::addMenu().
|
slot |
Accept the edited input from the dialog.
References Macro::menuStr(), and Options::setToDefaults().
Referenced by Macro::dialog().
|
slot |
|
slot |
Unsets the DialogOpen flag.
Referenced by Macro::dialog().
|
friend |
Write information of the Macro to str.
|
static |
This Macro is the startup Macro.
Referenced by Macros::check(), Macro::Macro(), and relacs::operator<<().
|
static |
This Macro is the shutdown Macro.
Referenced by Macros::check(), Macro::Macro(), and relacs::operator<<().
|
static |
This Macro is the fallback Macro.
Referenced by Macros::check(), Macro::launch(), Macro::Macro(), relacs::operator<<(), and Macro::setKey().
|
static |
This Macro explicitly requested to be the fallback Macro.
Referenced by RePros::activateRePro(), and Macro::Macro().
|
static |
This Macro is the startsession Macro.
Referenced by Macros::check(), Macro::clearButton(), Macro::Macro(), and relacs::operator<<().
|
static |
This Macro is the stopsession Macro.
Referenced by Macros::check(), Macro::Macro(), and relacs::operator<<().
|
static |
This is no Macro.
Referenced by ReProData::start().