aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CGEHalfMove.cpp2
-rw-r--r--src/CGEHalfMove.hpp2
-rw-r--r--src/components/Margin.cpp4
-rw-r--r--src/components/Margin.hpp2
-rw-r--r--src/components/MoveTable.cpp17
5 files changed, 13 insertions, 14 deletions
diff --git a/src/CGEHalfMove.cpp b/src/CGEHalfMove.cpp
index 4deb57b..f26f19e 100644
--- a/src/CGEHalfMove.cpp
+++ b/src/CGEHalfMove.cpp
@@ -18,7 +18,7 @@ CGEHalfMove::CGEHalfMove(CGEHalfMove *parent) {
}
}
-CGEHalfMove::CGEHalfMove(std::string move)
+CGEHalfMove::CGEHalfMove(const std::string &move)
: MainLine(NULL), IsBlack(false), Number(0), Parent(NULL) {
this->move = move;
}
diff --git a/src/CGEHalfMove.hpp b/src/CGEHalfMove.hpp
index 28f6c34..681aee1 100644
--- a/src/CGEHalfMove.hpp
+++ b/src/CGEHalfMove.hpp
@@ -14,7 +14,7 @@ class CGEHalfMove {
public:
CGEHalfMove();
CGEHalfMove(CGEHalfMove *parent);
- CGEHalfMove(std::string move);
+ CGEHalfMove(const std::string &move);
/// @brief CUrrent move number
std::uint16_t Number;
diff --git a/src/components/Margin.cpp b/src/components/Margin.cpp
index 077cce5..f438130 100644
--- a/src/components/Margin.cpp
+++ b/src/components/Margin.cpp
@@ -21,8 +21,8 @@ void Margin::DrawMargin(Element e) {
elements.push_back(e);
}
-void Margin::DrawMargin(std::vector<Element> elts) {
- for(Element &e:elts){
+void Margin::DrawMargin(const std::vector<Element> &elts) {
+ for(Element e:elts){
DrawMargin(e);
}
}
diff --git a/src/components/Margin.hpp b/src/components/Margin.hpp
index 8c2f243..0c99efd 100644
--- a/src/components/Margin.hpp
+++ b/src/components/Margin.hpp
@@ -7,6 +7,6 @@ public:
Margin(Status *s);
void Refresh();
void DrawMargin(Element e);
- void DrawMargin(std::vector<Element> elts);
+ void DrawMargin(const std::vector<Element> &elts);
};
} // namespace cgeditor \ No newline at end of file
diff --git a/src/components/MoveTable.cpp b/src/components/MoveTable.cpp
index 7e51c9f..b08bf9e 100644
--- a/src/components/MoveTable.cpp
+++ b/src/components/MoveTable.cpp
@@ -211,14 +211,14 @@ std::uint32_t MoveTable::DrawComment(CGEHalfMove *m, std::uint32_t line,
}
line++; // Goto the right line
- /// ----- Compute comment bounding box values
+ /// ----- Compute comment bounding box values:
int nchar=m->comment.size();
int nline=ceil((double)nchar/(double)status->CommentCharPerLine);
std::uint16_t nrow=ceil(((nline*status->CommentCharHeight)+2*status->CommentPadding)/status->MoveHeight);
int width=status->CommentCharPerLine*status->CommentCharWidth+2*status->CommentPadding;
int height=nrow*status->MoveHeight;
- // Draw comment background
+ // ----- Draw comment background:
Element e;
e.prop = Property::Rectangle | Property::Comment;
e.x = move_bound.x -
@@ -229,19 +229,19 @@ std::uint32_t MoveTable::DrawComment(CGEHalfMove *m, std::uint32_t line,
e.height = height;
e.ShouldApplyScroll = true;
elements.push_back(e);
- // Update scrolling
+ // ----- Update scrolling:
if ((e.x + width) > status->MoveTableMaxX) {
status->MoveTableMaxX = e.x + width;
}
if ((e.y + height) > status->MoveTableMaxY) {
status->MoveTableMaxY = e.y + height;
}
- // Handle events:
+ // ----- Handle events:
if (status->LeftClick && IsMouseOver(e)) {
status->Events.push_back({Event::Type::CommentSelected, m});
}
- // Now draw each lines of the comment:
- Element l; // One line
+ // ----- Now draw each lines of the comment:
+ Element l; // One line of the comment
l.prop = Property::Comment|Property::Text;
l.x=e.x+status->CommentPadding;
l.y=e.y+status->CommentPadding;
@@ -257,17 +257,16 @@ std::uint32_t MoveTable::DrawComment(CGEHalfMove *m, std::uint32_t line,
elements.push_back(l);
l.y+=status->CommentCharHeight;
}
- // Do not forget to add marging before comment if indented:
+ // ----- Do not forget to add marging before comment if indented:
if (indent > 0) {
e.x -= status->MarginBarWidth;
VariationMargins.push_back(e);
}
line += nrow; // Skip right amount of lines
- // Since we already increment line for black later on:
+ // ----- Since we already increment line for black later on:
if (m->IsBlack || m->variations.size() > 0) {
line--;
}
-
return (line);
}