-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit_GUI_lib.diff
More file actions
229 lines (189 loc) · 6.69 KB
/
Copy pathgit_GUI_lib.diff
File metadata and controls
229 lines (189 loc) · 6.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
diff --git a/include/GUI.cpp b/mod/GUI.cpp
index b0b2d81..314f497 100644
--- a/include/GUI.cpp
+++ b/mod/GUI.cpp
@@ -1,4 +1,4 @@
-#include "GUI.h"
+#include "Gui.h"
#include "std_lib_facilities.h"
#include <sstream>
diff --git a/include/Graph.cpp b/mod/Graph.cpp
index f9cb687..bc55a85 100644
--- a/include/Graph.cpp
+++ b/mod/Graph.cpp
@@ -310,7 +310,12 @@ bool can_open(const string& s)
// check if a file named s exists and can be opened for reading
{
ifstream ff(s.c_str());
- return ff;
+
+ //***************************************************************************
+ if (!ff) return false;
+ else return true;
+ //***************************************************************************
+ //return ff;
}
diff --git a/include/Graph.h b/mod/Graph.h
index efd5d24..85e6bd1 100644
--- a/include/Graph.h
+++ b/mod/Graph.h
@@ -7,7 +7,7 @@
//#include<string>
//#include<cmath>
#include "fltk.h"
-//#include "std_lib_facilities.h"
+#include "std_lib_facilities.h" //было закомментированно
namespace Graph_lib {
// defense against ill-behaved Linux macros:
@@ -156,7 +156,7 @@ public:
Shape& operator=(const Shape&) = delete;
private:
vector<Point> points; // not used by all shapes
- Color lcolor {fl_color()};
+ Color lcolor {static_cast<int>(fl_color())};
Line_style ls {0};
Color fcolor {Color::invisible};
diff --git a/include/MatrixIO11.h b/mod/MatrixIO11.h
index e623ba7..0db2f6f 100644
--- a/include/MatrixIO11.h
+++ b/mod/MatrixIO11.h
@@ -1,6 +1,6 @@
#include <iostream>
-#include "Matrix.h"
+#include "Matrix11.h"
namespace Numeric_lib {
diff --git a/include/Point.h b/mod/Point.h
index 85153e2..953b5fe 100644
--- a/include/Point.h
+++ b/mod/Point.h
@@ -8,8 +8,8 @@ namespace Graph_lib {
struct Point {
int x,y;
-// Point(int xx, int yy) : x(xx), y(yy) { }
-// Point() :x(0), y(0) { }
+ Point(int xx, int yy) : x(xx), y(yy) { } //был закомментирован
+ Point() :x(0), y(0) { } //был закомментирован
// Point& operator+=(Point d) { x+=d.x; y+=d.y; return *this; }
};
diff --git a/include/Simple_window.h b/mod/Simple_window.h
index d6071b6..77daaf7 100644
--- a/include/Simple_window.h
+++ b/mod/Simple_window.h
@@ -1,16 +1,16 @@
-#include "GUI.h" // for Simple_window only (doesn't really belong in Window.h)
+#include "Gui.h" // for Simple_window only (doesn't really belong in Window.h)
using namespace Graph_lib;
// Simple_window is basic scaffolding for ultra-simple interaction with graphics
// it provides one window with one "next" button for ultra-simple animation
-struct Simple_window : Window {
+struct Simple_window : Graph_lib::Window {
Simple_window(Point xy, int w, int h, const string& title )
- : Window(xy,w,h,title),
+ : Graph_lib::Window(xy,w,h,title),
button_pushed(false),
- next_button(Point(x_max()-70,0), 70, 20, "Next", cb_next) { attach(next_button); }
+ next_button(Point(x_max()-70,0), 70, 20, "Next", cb_next) { Graph_lib::Window::attach(next_button); }
void wait_for_button()
// modified event loop
diff --git a/include/Window.cpp b/mod/Window.cpp
index e48df57..a79f5e8 100644
--- a/include/Window.cpp
+++ b/mod/Window.cpp
@@ -1,6 +1,6 @@
#include "Window.h"
#include "Graph.h"
-#include "GUI.h"
+#include "Gui.h"
namespace Graph_lib {
diff --git a/include/Window.h b/mod/Window.h
index fbeab4c..88dc17d 100644
--- a/include/Window.h
+++ b/mod/Window.h
@@ -6,7 +6,7 @@
#include "std_lib_facilities.h"
#include "Point.h"
-//#include "GUI.h"
+//#include "Gui.h"
namespace Graph_lib {
diff --git a/include/fltk.h b/mod/fltk.h
index 3b79f8e..9e34d73 100644
--- a/include/fltk.h
+++ b/mod/fltk.h
@@ -1,17 +1,17 @@
#ifndef FLTK_GUARD
#define FLTK_GUARD 1
-#include "FL/Fl.H"
-#include "FL/Fl_Window.H"
-#include "FL/Fl_Button.H"
-#include "FL/Fl_Input.H"
-#include "FL/Fl_Output.H"
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
+#include <FL/Fl_Button.H>
+#include <FL/Fl_Input.H>
+#include <FL/Fl_Output.H>
#include <cstdlib> // for exit(0)
-#include "FL/fl_draw.H"
-#include "FL/Enumerations.H"
+#include <FL/fl_draw.H>
+#include <FL/Enumerations.H>
-#include "Fl/Fl_JPEG_Image.H"
-#include "Fl/Fl_GIF_Image.H"
+#include <FL/Fl_JPEG_Image.H>
+#include <FL/Fl_GIF_Image.H>
#endif
diff --git a/include/std_lib_facilities.h b/mod/std_lib_facilities.h
index 2fd388c..6817908 100644
--- a/include/std_lib_facilities.h
+++ b/mod/std_lib_facilities.h
@@ -19,10 +19,12 @@
Revised November 25 2013: remove support for pre-C++11 compilers, use C++11: <chrono>
Revised November 28 2013: add a few container algorithms
Revised June 8 2014: added #ifndef to workaround Microsoft C++11 weakness
+Revised Febrary 2 2015: randint() can now be seeded (see exercise 5.13).
+Revised August 3, 2020: a cleanup removing support for ancient compilers
*/
#ifndef H112
-#define H112 251113L
+#define H112 080315L
#include<iostream>
@@ -45,8 +47,6 @@
//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
typedef long Unicode;
//------------------------------------------------------------------------------
@@ -70,7 +70,7 @@ struct Range_error : out_of_range { // enhanced vector range error reporting
template< class T> struct Vector : public std::vector<T> {
using size_type = typename std::vector<T>::size_type;
-#ifdef _MSC_VER
+/* #ifdef _MSC_VER
// microsoft doesn't yet support C++11 inheriting constructors
Vector() { }
explicit Vector(size_type n) :std::vector<T>(n) {}
@@ -78,9 +78,8 @@ template< class T> struct Vector : public std::vector<T> {
template <class I>
Vector(I first, I last) : std::vector<T>(first, last) {}
Vector(initializer_list<T> list) : std::vector<T>(list) {}
-#else
+*/
using std::vector<T>::vector; // inheriting constructor
-#endif
T& operator[](unsigned int i) // rather than return at(i);
{
@@ -208,15 +207,21 @@ template<class R, class A> R narrow_cast(const A& a)
// random number generators. See 24.7.
+inline default_random_engine& get_rand()
+{
+ static default_random_engine ran; // note: not thread_local
+ return ran;
+};
+inline void seed_randint(int s) { get_rand().seed(s); }
-inline int randint(int min, int max) { static default_random_engine ran; return uniform_int_distribution<>{min, max}(ran); }
+inline int randint(int min, int max) { return uniform_int_distribution<>{min, max}(get_rand()); }
inline int randint(int max) { return randint(0, max); }
//inline double sqrt(int x) { return sqrt(double(x)); } // to match C++0x
-// container algorithms. See 21.9.
+// container algorithms. See 21.9. // C++ has better versions of this:
template<typename C>
using Value_type = typename C::value_type;