/** ***************************************************************************/ void Applications::DesktopAction::activate() { qApp->hideWidget(); if(term_) return CommandAction(Application::terminal.arg(exec_)).activate(); else return CommandAction(exec_).activate(); app_->incUsage(); }
status_t RuleRunner::RunAction(const BMessage &action, entry_ref &ref) { BString actionname; if (action.FindString("name",&actionname) != B_OK) { debugger("Couldn't find action name in RuleRunner::RunAction"); return B_ERROR; } if (actionname.Compare("Move it to…") == 0) return MoveAction(action,ref); else if (actionname.Compare("Copy it to…") == 0) return CopyAction(action,ref); else if (actionname.Compare("Rename it to…") == 0) return RenameAction(action,ref); else if (actionname.Compare("Open it") == 0) return OpenAction(action,ref); else if (actionname.Compare("Add it to the archive…") == 0) return ArchiveAction(action,ref); else if (actionname.Compare("Terminal command…") == 0) return CommandAction(action,ref); else if (actionname.Compare("Move it to the Trash") == 0) return TrashAction(action,ref); else if (actionname.Compare("Delete it") == 0) return DeleteAction(action,ref); return B_ERROR; }
void cDrawScenarioPoliEval::Keyboard(unsigned char key, int x, int y) { cDrawScenarioSimChar::Keyboard(key, x, y); if (key >= '1' && key <= '9') { CommandAction(key - '1'); } }
bool TextFormulaNode::DoCreatePlusFormulaNode(NodeEvent& nodeEvent) { SharedCaretState c = any_cast<SharedCaretState>(nodeEvent["caretState"]); //create a plus node and insert it into the parent after this node FormulaNode* p = new PlusFormulaNode(this, wnd); parent->InsertChild(p, parent->GetChildPos(this) + 1); nodeEvent["undoAction"] = CommandAction(this, 0, &FormulaNode::UndoCreatePlusFormulaNode); c->SetToNode(parent, parent->GetChildPos(this) + 1); return true; }
bool DocumentFormulaNode::DoInsertLine(NodeEvent& nodeEvent) { SharedCaretState c = any_cast<SharedCaretState>(nodeEvent["caretState"]); FormulaNode* node = c->GetNode(); int pos = GetFirstLevelChildPos(node); RootFormulaNode* rootNode = new RootFormulaNode(this); EmptyFormulaNode* n = new EmptyFormulaNode(rootNode); rootNode->AddChild(n); InsertChild(rootNode, pos + 1); nodeEvent["undoAction"] = CommandAction(rootNode, 0, &FormulaNode::UndoInsertLine); c->SetToNode(rootNode, 0); return true; }
bool RootFormulaNode::DoCreateEquationFormulaNode(NodeEvent& nodeEvent) { SharedCaretState c = any_cast<SharedCaretState>(nodeEvent["caretState"]); //create a equation node and move the first level nodes in its left side FormulaNode* e = new EquationFormulaNode(this, wnd); FormulaNode* g = new GroupFormulaNode(e, wnd); for (int i = 0, j = 0; i < childNodes->Count(); ++j) g->MoveChild((*childNodes)[0], j); e->InsertChild(g, 0); AddChild(e); //e->MoveChild((*childNodes)[0], 0); nodeEvent["undoAction"] = CommandAction(this, 0, &FormulaNode::UndoCreateDivisionFormulaNode); c->SetToNode(e, 1); return true; }
bool TextFormulaNode::DoInsertText(NodeEvent& nodeEvent) { Command* command = any_cast<Command*>(nodeEvent["command"]); QString str = any_cast<QString>(nodeEvent["text"]); SharedCaretState c = any_cast<SharedCaretState>(nodeEvent["caretState"]); int pos = c->GetPos(); QString text = GetText(); command->SetParam(this, "pos", pos); //update the item text = text.left(pos) + str + text.right(text.length() - pos); SetText(text); nodeEvent["undoAction"] = CommandAction(this, 0, &FormulaNode::UndoInsertText); c->SetToNode(this, pos + str.length()); return true; }
bool TextFormulaNode::DoCreatePowerFormulaNode(NodeEvent& nodeEvent) { SharedCaretState c = any_cast<SharedCaretState>(nodeEvent["caretState"]); FormulaNode* p = parent; int pos = parent->GetChildPos(this); //create a power node, insert current node into it and insert the result into the parent FormulaNode* d = new PowerFormulaNode(parent, wnd); FormulaNode* g = new GroupFormulaNode(d, wnd); g->MoveChild(this, 0); d->InsertChild(g, 0); g = new GroupFormulaNode(d, wnd); FormulaNode* n = new EmptyFormulaNode(g); g->AddChild(n); d->AddChild(g); p->InsertChild(d, pos); nodeEvent["undoAction"] = CommandAction(this, 0, &FormulaNode::UndoCreatePowerFormulaNode); c->SetToNode(g, 0); return true; }
bool TextFormulaNode::DoRemoveItem(NodeEvent& nodeEvent) { Command* command = any_cast<Command*>(nodeEvent["command"]); bool right = any_cast<bool>(nodeEvent["right"]); SharedCaretState c = any_cast<SharedCaretState>(nodeEvent["caretState"]); int pos = c->GetPos(); QString text = GetText(); if (right) { if (pos < text.length()) { command->SetParam(this, "str", QString(text.mid(pos, 1))); //update the item text = text.left(pos) + text.right(text.length() - pos - 1); SetText(text); c->SetToNode(this, pos); } else return false; } else { if (pos > 0) { command->SetParam(this, "str", QString(text.mid(pos - 1, 1))); //update the item text = text.left(pos - 1) + text.right(text.length() - pos); SetText(text); c->SetToNode(this, pos - 1); } else return false; } nodeEvent["undoAction"] = CommandAction(this, 0, &FormulaNode::UndoRemoveItem); return true; }