Changed the "tagrelease" and "tagstable" make targets to use subversion. Also increme...
[synfig.git] / synfig-studio / tags / stable / src / sinfgapp / uimanager.cpp
1 /* === S I N F G =========================================================== */
2 /*!     \file uimanager.cpp
3 **      \brief Template File
4 **
5 **      $Id: uimanager.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
6 **
7 **      \legal
8 **      Copyright (c) 2002 Robert B. Quattlebaum Jr.
9 **
10 **      This software and associated documentation
11 **      are CONFIDENTIAL and PROPRIETARY property of
12 **      the above-mentioned copyright holder.
13 **
14 **      You may not copy, print, publish, or in any
15 **      other way distribute this software without
16 **      a prior written agreement with
17 **      the copyright holder.
18 **      \endlegal
19 */
20 /* ========================================================================= */
21
22 /* === H E A D E R S ======================================================= */
23
24 #ifdef USING_PCH
25 #       include "pch.h"
26 #else
27 #ifdef HAVE_CONFIG_H
28 #       include <config.h>
29 #endif
30
31 #include "uimanager.h"
32 #include <iostream>
33 #include <string>
34
35 #endif
36
37 /* === U S I N G =========================================================== */
38
39 using namespace std;
40 using namespace etl;
41 using namespace sinfg;
42 using namespace sinfgapp;
43
44 /* === M A C R O S ========================================================= */
45
46 /* === M E T H O D S ======================================================= */
47
48 UIInterface::Response
49 ConsoleUIInterface::yes_no(const std::string &title, const std::string &message,Response dflt)
50 {
51         cout<<title<<": "<<message<<' ';
52         if(dflt==RESPONSE_NO)
53                 cout<<_("(no/yes)")<<endl;
54         else
55                 cout<<_("(yes/no)")<<endl;
56         string resp;
57         cin>>resp;
58
59         if(dflt==RESPONSE_NO)
60         {
61                 if(resp=="yes")
62                         return RESPONSE_YES;
63                 else
64                         return RESPONSE_NO;
65         }
66         else
67         {
68                 if(resp=="no")
69                         return RESPONSE_NO;
70                 else
71                         return RESPONSE_YES;
72         }
73 }
74
75 UIInterface::Response
76 ConsoleUIInterface::yes_no_cancel(const string &title, const string &message,Response dflt)
77 {
78         cout<<title<<": "<<message<<' ';
79         if(dflt==RESPONSE_NO)
80                 cout<<_("(no/yes)")<<endl;
81         else
82                 cout<<_("(yes/no)")<<endl;
83         string resp;
84         cin>>resp;
85
86         if(dflt==RESPONSE_NO)
87         {
88                 if(resp=="yes")
89                         return RESPONSE_YES;
90                 else
91                         return RESPONSE_NO;
92         }
93         else
94         {
95                 if(resp=="no")
96                         return RESPONSE_NO;
97                 else
98                         return RESPONSE_YES;
99         }
100 }
101
102 UIInterface::Response
103 ConsoleUIInterface::ok_cancel(const std::string &title, const std::string &message,Response dflt)
104 {
105         cout<<title<<": "<<message<<' ';
106         if(dflt==RESPONSE_CANCEL)
107                 cout<<_("(cancel/ok)")<<endl;
108         else
109                 cout<<_("(ok/cancel)")<<endl;
110         string resp;
111         cin>>resp;
112
113         if(dflt==RESPONSE_CANCEL)
114         {
115                 if(resp=="ok")
116                         return RESPONSE_OK;
117                 else
118                         return RESPONSE_CANCEL;
119         }
120         else
121         {
122                 if(resp=="cancel")
123                         return RESPONSE_CANCEL;
124                 else
125                         return RESPONSE_OK;
126         }
127 }
128         
129 bool
130 ConsoleUIInterface::task(const std::string &task)
131 {
132         cout<<task<<endl;
133         return true;
134 }
135
136 bool
137 ConsoleUIInterface::error(const std::string &task)
138 {
139         cout<<_("error: ")<<task<<endl;
140         return true;
141 }
142
143 bool
144 ConsoleUIInterface::warning(const std::string &task)
145 {
146         cout<<_("warning: ")<<task<<endl;
147         return true;
148 }
149
150 bool
151 ConsoleUIInterface::amount_complete(int current, int total)
152 {
153         return true;
154 }
155
156
157