-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtoolbox.cc
More file actions
50 lines (43 loc) · 1.08 KB
/
toolbox.cc
File metadata and controls
50 lines (43 loc) · 1.08 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
// Copyright...
#include "toolbox.h"
using std::string;
namespace pdfsketch {
void Toolbox::SelectTool(const std::string& tool) {
printf("select tool: %s\n", tool.c_str());
Tool new_tool = ARROW;
if (tool == "Arrow") {
new_tool = ARROW;
} else if (tool == "Text") {
new_tool = TEXT;
} else if (tool == "Circle") {
new_tool = CIRCLE;
} else if (tool == "Rectangle") {
new_tool = RECTANGLE;
} else if (tool == "Squiggle") {
new_tool = SQUIGGLE;
} else if (tool == "Checkmark") {
new_tool = CHECKMARK;
} else {
printf("Unknown tool: %s\n", tool.c_str());
return;
}
SelectTool(new_tool);
}
void Toolbox::SelectTool(Tool tool) {
current_ = tool;
if (delegate_) {
delegate_->ToolSelected(current_);
}
}
string Toolbox::ToolAsString(Toolbox::Tool tool) {
switch (tool) {
case ARROW: return "Arrow";
case TEXT: return "Text";
case CIRCLE: return "Circle";
case RECTANGLE: return "Rectangle";
case SQUIGGLE: return "Squiggle";
case CHECKMARK: return "Checkmark";
}
return "UnknownTool";
}
} // namespace pdfsketch