void CMainWindow::onCommand (xl::uint id, xl::ui::CControlPtr /*ctrl*/) { switch (id) { case ID_NAV_NEXT: cmdNext(); break; case ID_NAV_PREV: cmdPrev(); break; case ID_NAV_ZOOMIN: case ID_NAV_ZOOMOUT: case ID_NAV_SWITCH: { CImageView *pView = (CImageView *)m_view.get(); assert(pView); if (id == ID_NAV_ZOOMIN) { pView->showLarger(CPoint(-1, -1)); } else if (id == ID_NAV_ZOOMOUT) { pView->showSmaller(CPoint(-1, -1)); } else { pView->showSwitch(CPoint(-1, -1)); } } break; case ID_SETTING: // launchAssociation(); { m_toolbar->setOpacity(0); CSettingDialog dlg(&m_gestureMap); dlg.DoModal(m_hWnd); } break; default: break; } }
/*! * Returns a pair with status bits. * * The first boolean represents valid input. * If the first boolean is true, the input is valid, otherwise invalid. * The second boolean is true if the command is the quit-command. */ std::pair<bool, bool> Asker::ProcessCommand(std::string command, Specification::Iterator & it) { bool cmdQuit = false; bool validCommand = true; // Remove leading ':' charachter command.erase(command.begin(), command.begin() + 1); // Get Arguments std::vector<std::string>* arguments = Command::InitArguments(command); Helpers::toLower((*arguments)[0]); if (arguments->size() == 1 || arguments->size() == 2) { if (arguments->at(0) == "next") { validCommand = cmdNext(arguments, it); } else if (arguments->at(0) == "back") { validCommand = cmdBack(arguments, it); } else if (arguments->at(0) == "goto" && arguments->size() == 2) { validCommand = cmdGoto(arguments, it); } else if (arguments->at(0) == "list" && arguments->size() == 1) { cmdList(); validCommand = true; } else if (arguments->at(0) == "quit" && arguments->size() == 1) { cmdQuit = true; } else { validCommand = false; } } else { validCommand = false; } // Finish delete arguments;