1 /* === S Y N F I G ========================================================= */
2 /*! \file uimanager.cpp
3 ** \brief Template File
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
10 ** This package is free software; you can redistribute it and/or
11 ** modify it under the terms of the GNU General Public License as
12 ** published by the Free Software Foundation; either version 2 of
13 ** the License, or (at your option) any later version.
15 ** This package is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ** General Public License for more details.
21 /* ========================================================================= */
23 /* === H E A D E R S ======================================================= */
32 #include "uimanager.h"
40 /* === U S I N G =========================================================== */
44 using namespace synfig;
45 using namespace synfigapp;
47 /* === M A C R O S ========================================================= */
49 /* === M E T H O D S ======================================================= */
52 ConsoleUIInterface::confirmation(const std::string &title, const std::string &primaryText,
53 const std::string &secondaryText, const std::string &confirmPhrase,
54 const std::string &cancelPhrase, Response dflt)
56 cout << title << ": " << primaryText << endl;
57 cout << secondaryText;
59 if (dflt == RESPONSE_OK)
60 cout << "(" << confirmPhrase << "/" << cancelPhrase << ")" << endl;
62 cout << "(" << cancelPhrase << "/" << confirmPhrase << ")" << endl;
67 if (dflt == RESPONSE_OK)
69 if (resp == cancelPhrase)
70 return RESPONSE_CANCEL;
73 if (resp == confirmPhrase)
75 return RESPONSE_CANCEL;
79 ConsoleUIInterface::yes_no(const std::string &title, const std::string &message,Response dflt)
81 cout<<title<<": "<<message<<' ';
83 cout<<_("(no/yes)")<<endl;
85 cout<<_("(yes/no)")<<endl;
105 UIInterface::Response
106 ConsoleUIInterface::yes_no_cancel(const std::string &title, const std::string &message, Response dflt)
108 cout<<title<<": "<<message<<' ';
109 if(dflt==RESPONSE_NO)
110 cout<<_("(no/yes)")<<endl;
112 cout<<_("(yes/no)")<<endl;
116 if(dflt==RESPONSE_NO)
132 UIInterface::Response
133 ConsoleUIInterface::ok_cancel(const std::string &title, const std::string &message,Response dflt)
135 cout<<title<<": "<<message<<' ';
136 if(dflt==RESPONSE_CANCEL)
137 cout<<_("(cancel/ok)")<<endl;
139 cout<<_("(ok/cancel)")<<endl;
143 if(dflt==RESPONSE_CANCEL)
148 return RESPONSE_CANCEL;
153 return RESPONSE_CANCEL;
160 ConsoleUIInterface::task(const std::string &task)
167 ConsoleUIInterface::error(const std::string &task)
169 cout<<_("error: ")<<task<<endl;
174 ConsoleUIInterface::warning(const std::string &task)
176 cout<<_("warning: ")<<task<<endl;
181 ConsoleUIInterface::amount_complete(int /*current*/, int /*total*/)