X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fsynfigapp%2Fuimanager.cpp;h=4259e7058b642924e5896fe34bb81c2a67a75890;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=0aa0450d424715728e0592c9b5a3e317aeb715b4;hpb=c3ad95144d148602f672e95ddda1f18fc35502f8;p=synfig.git diff --git a/synfig-studio/trunk/src/synfigapp/uimanager.cpp b/synfig-studio/trunk/src/synfigapp/uimanager.cpp index 0aa0450..4259e70 100644 --- a/synfig-studio/trunk/src/synfigapp/uimanager.cpp +++ b/synfig-studio/trunk/src/synfigapp/uimanager.cpp @@ -33,6 +33,8 @@ #include #include +#include "general.h" + #endif /* === U S I N G =========================================================== */ @@ -47,6 +49,33 @@ using namespace synfigapp; /* === M E T H O D S ======================================================= */ UIInterface::Response +ConsoleUIInterface::confirmation(const std::string &title, const std::string &primaryText, + const std::string &secondaryText, const std::string &confirmPhrase, + const std::string &cancelPhrase, Response dflt) +{ + cout << title << ": " << primaryText << endl; + cout << secondaryText; + + if (dflt == RESPONSE_OK) + cout << "(" << confirmPhrase << "/" << cancelPhrase << ")" << endl; + else + cout << "(" << cancelPhrase << "/" << confirmPhrase << ")" << endl; + + string resp; + cin >> resp; + + if (dflt == RESPONSE_OK) + { + if (resp == cancelPhrase) + return RESPONSE_CANCEL; + return RESPONSE_OK; + } + if (resp == confirmPhrase) + return RESPONSE_OK; + return RESPONSE_CANCEL; +} + +UIInterface::Response ConsoleUIInterface::yes_no(const std::string &title, const std::string &message,Response dflt) { cout<