aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikko Syrjä <mikko@3d-system.fi>2019-03-07 00:41:33 +0200
committerMikko Syrjä <mikko@3d-system.fi>2019-03-07 00:41:33 +0200
commit2cebcfa3e208cdf4af5bdf77a6d14ab079e8126a (patch)
treeb189f816738bf273c20aa1c59128ebec835ef5c2
parent152ca5fa1b949b822a6548181ba3ecf769926522 (diff)
downloadsymedit-2cebcfa3e208cdf4af5bdf77a6d14ab079e8126a.tar.gz
symedit-2cebcfa3e208cdf4af5bdf77a6d14ab079e8126a.zip
Compilation and help fixes.
-rw-r--r--Editor.qml62
-rw-r--r--help/eng/index.rst4
-rw-r--r--help/eng/menu.rst6
-rw-r--r--help/eng/tools.rst13
-rw-r--r--help/fin/index.rst4
-rw-r--r--help/fin/tools.rst13
-rw-r--r--image/bubble_icon&48.pngbin0 -> 3381 bytes
-rw-r--r--image/quarter_radius.pngbin0 -> 667 bytes
-rw-r--r--image/semi_radius.pngbin0 -> 822 bytes
-rwxr-xr-xlrelease.sh6
-rwxr-xr-xlupdate.sh7
-rw-r--r--main.qml3
-rw-r--r--qml.qrc3
-rw-r--r--symbol.cpp9
-rw-r--r--symedit.pro10
15 files changed, 104 insertions, 36 deletions
diff --git a/Editor.qml b/Editor.qml
index 67db735..94c9a05 100644
--- a/Editor.qml
+++ b/Editor.qml
@@ -189,6 +189,27 @@ Rectangle
context.stroke()
}
+ function paintsemicircle(context, center, start, end, radius, fill)
+ {
+/*
+// context.beginPath().moveTo((center.x + max + offsetx) * scalexy, (max - center.y + offsety) * scalexy)
+ context.beginPath().moveTo((start.x + max + offsetx) * scalexy, (max - start.y + offsety) * scalexy)
+ context.arcTo(
+ (start.x + max - radius + offsetx) * scalexy,
+ (max - start.y - radius + offsety) * scalexy,
+ (end.x + max - radius + offsetx) * scalexy,
+ (max - end.y - radius + offsety) * scalexy,
+ radius * scalexy)
+ if ( fill )
+ {
+ context.fillStyle = (fill === 2 ? paintcolor : backcolor)
+ context.fill()
+ }
+ else
+ context.stroke()
+*/
+ }
+
function setalignment(context, align)
{
switch ( align )
@@ -264,7 +285,7 @@ Rectangle
var operation = manager.getItemOperation(index)
var point, position = manager.getItemPosition(index)
- var fill = manager.getItemFill(index)
+ var radius, fill = manager.getItemFill(index)
if ( operation === Operation.Line )
{
point = manager.getItemPoint(index)
@@ -281,11 +302,21 @@ Rectangle
}
else if ( operation === Operation.Circle )
{
- var radius = manager.getItemValue(index)
+ radius = manager.getItemValue(index)
paintcircle(context, position, radius, fill)
if ( !preview && fill && index === active )
paintcircle(context, position, radius, false)
}
+ else if ( operation === Operation.Arc )
+ {
+/*
+ point = manager.getItemPoint(index)
+ radius = manager.getItemValue(index)
+ paintsemicircle(context, position, radius, fill)
+ if ( !preview && fill && index === active )
+ paintsemicircle(context, position, radius, false)
+*/
+ }
else if ( operation === Operation.Text )
{
setalignment(context, manager.getItemAlign(index))
@@ -334,7 +365,7 @@ Rectangle
if ( fillitem )
paintrect(context, Qt.point(cornerx, cornery), Qt.size(deltax, deltay), false)
}
- else if ( tool > 30 && tool < 40 ) // circle
+ else if ( tool > 30 && tool < 50 ) // circle or arc
{
var centerx, centery, radius
if ( tool === Editor.Tool.CircleCorner )
@@ -355,18 +386,29 @@ Rectangle
centerx = startx
centery = starty
}
+ else if ( tool === Editor.Tool.ArcSemi )
+ {
+ radius = Math.sqrt(deltax * deltax + deltay * deltay) / 2
+ centerx = (startx + mousex) / 2
+ centery = (starty + mousey) / 2
+ }
if ( radius )
{
var center = Qt.point(centerx, centery)
- paintcircle(context, center, radius, fillitem)
- if ( fillitem )
- paintcircle(context, center, radius, false)
+ if ( tool > 40 )
+ {
+ paintsemicircle(context, center, start, end, radius, fillitem)
+// if ( fillitem )
+// paintsemicircle(context, center, radius, false)
+ }
+ else
+ {
+ paintcircle(context, center, radius, fillitem)
+ if ( fillitem )
+ paintcircle(context, center, radius, false)
+ }
}
}
- else if ( tool > 40 && tool < 50 ) // arcs
- {
-
- }
else if ( tool > 50 && tool < 60 ) // text
{
if ( tool === Editor.Tool.Text )
diff --git a/help/eng/index.rst b/help/eng/index.rst
index bf9fbe6..7ad9881 100644
--- a/help/eng/index.rst
+++ b/help/eng/index.rst
@@ -14,5 +14,7 @@ SymEdit is symbol editor for symbols used by `3D-Win`_ survey application.
menu
tools
-Some toolbar button images are taken from Gentleface icon set: https://gentleface.com/free_icon_set.html
+.. _Gentleface: https://gentleface.com/free_icon_set.html
+
+Some toolbar button images are taken from `Gentleface`_ icon set.
diff --git a/help/eng/menu.rst b/help/eng/menu.rst
index d0efc8d..a7e0606 100644
--- a/help/eng/menu.rst
+++ b/help/eng/menu.rst
@@ -119,12 +119,12 @@ View
|in image| Zoom In
^^^^^^^^^^^^^^^^^^
-Zoomaa näyttöä lähemmäs.
+Zooms view closer.
|out image| Zoom Out
^^^^^^^^^^^^^^^^^^^^
-Zoomaa näyttöä kauemmas.
+Zooms view farther.
|all image| Maximum
^^^^^^^^^^^^^^^^^^^
@@ -139,7 +139,7 @@ Zoomaa ruudukon maksimikokoon ja lopettaa mahdollisen esikatselutilan.
|grid image| Show Grid
^^^^^^^^^^^^^^^^^^^^^^
-Näyttää 10x10 ruudukon symbolin taustalla.
+Shows 10x10 grid behind the symbol.
|preview image| Preview
^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/help/eng/tools.rst b/help/eng/tools.rst
index f0814b0..4997cf5 100644
--- a/help/eng/tools.rst
+++ b/help/eng/tools.rst
@@ -63,13 +63,18 @@ Piirtää ympyrän kahden vastakkaisen kehäpisteen välille.
Piirtää ympyrän keskipisteestä kehälle.
-Puoliympyrä
-^^^^^^^^^^^
+.. |arc semi image| image:: ../../image/semi_radius.png
+ :scale: 50 %
+.. |arc quarter image| image:: ../../image/quarter_radius.png
+ :scale: 50 %
+
+|arc semi image| Semicircle
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
xxx
-Neljännesympyrä
-^^^^^^^^^^^^^^^
+|arc quarter image| Quarter circle
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. |text image| image:: ../../image/text.png
:scale: 50 %
diff --git a/help/fin/index.rst b/help/fin/index.rst
index 03bad78..4320c92 100644
--- a/help/fin/index.rst
+++ b/help/fin/index.rst
@@ -14,5 +14,7 @@ SymEdit on symbolieditori `3D-Win`_ -maastomittausohjelman käyttämille symbole
menu
tools
-Osa työkalupalkin kuvakkeista on otettu Gentleface ikonisetistä: https://gentleface.com/free_icon_set.html
+.. _Gentleface: https://gentleface.com/free_icon_set.html
+
+Osa työkalupalkin kuvakkeista on otettu `Gentleface`_ ikonisetistä.
diff --git a/help/fin/tools.rst b/help/fin/tools.rst
index d1c9911..0ecb15d 100644
--- a/help/fin/tools.rst
+++ b/help/fin/tools.rst
@@ -63,13 +63,18 @@ Piirtää ympyrän kahden vastakkaisen kehäpisteen välille.
Piirtää ympyrän keskipisteestä kehälle.
-Puoliympyrä
-^^^^^^^^^^^
+.. |arc semi image| image:: ../../image/semi_radius.png
+ :scale: 50 %
+.. |arc quarter image| image:: ../../image/quarter_radius.png
+ :scale: 50 %
+
+|arc semi image| Puoliympyrä
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xxx
-Neljännesympyrä
-^^^^^^^^^^^^^^^
+|arc quarter image| Neljännesympyrä
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. |text image| image:: ../../image/text.png
:scale: 50 %
diff --git a/image/bubble_icon&48.png b/image/bubble_icon&48.png
new file mode 100644
index 0000000..a4f8db5
--- /dev/null
+++ b/image/bubble_icon&48.png
Binary files differ
diff --git a/image/quarter_radius.png b/image/quarter_radius.png
new file mode 100644
index 0000000..5f992f4
--- /dev/null
+++ b/image/quarter_radius.png
Binary files differ
diff --git a/image/semi_radius.png b/image/semi_radius.png
new file mode 100644
index 0000000..277791b
--- /dev/null
+++ b/image/semi_radius.png
Binary files differ
diff --git a/lrelease.sh b/lrelease.sh
index 1659f58..006702e 100755
--- a/lrelease.sh
+++ b/lrelease.sh
@@ -1,5 +1,5 @@
/home/mikko/Code/Qt5.12.1/5.12.1/gcc_64/bin/lrelease -idbased locale/symedit.*.ts
-# if [ $? -ne 0 ]; then
-# lrelease-qt5 -idbased locale/mobile.*.ts
-# fi
+if [ $? -ne 0 ]; then
+ lrelease-qt5 -idbased locale/symedit.*.ts
+fi
diff --git a/lupdate.sh b/lupdate.sh
index 50f821f..3c4df60 100755
--- a/lupdate.sh
+++ b/lupdate.sh
@@ -1,6 +1,5 @@
/home/mikko/Code/Qt5.12.1/5.12.1/gcc_64/bin/lupdate -locations none . -ts locale/symedit.ts locale/symedit.en_GB.ts locale/symedit.fi_FI.ts
-# lupdate -locations none qml -ts locale/mobile.ts
-# if [ $? -ne 0 ]; then
-# lupdate-qt5 -locations none qml -ts locale/mobile.ts
-# fi
+if [ $? -ne 0 ]; then
+ lupdate-qt5 -locations none . -ts locale/symedit.ts locale/symedit.en_GB.ts locale/symedit.fi_FI.ts
+fi
diff --git a/main.qml b/main.qml
index f3af889..69a4ab9 100644
--- a/main.qml
+++ b/main.qml
@@ -157,6 +157,9 @@ ApplicationWindow
BarTool { image: "image/circle_radius.png"; tooltip: qsTrId("id_tooltip_tool_circle_radius"); tool: Editor.Tool.CircleRadius }
BarTool { image: "image/circle_center.png"; tooltip: qsTrId("id_tooltip_tool_circle_center"); tool: Editor.Tool.CircleCenter }
BarSeparator { }
+ BarTool { image: "image/semi_radius.png"; tooltip: qsTrId("id_tooltip_tool_semi_radius"); tool: Editor.Tool.ArcSemi }
+ BarTool { image: "image/quarter_radius.png"; tooltip: qsTrId("id_tooltip_tool_quarter_radius"); tool: Editor.Tool.ArcQuarter }
+ BarSeparator { }
BarTool { image: "image/text.png"; tooltip: qsTrId("id_tooltip_tool_text"); tool: Editor.Tool.Text }
}
RowLayout
diff --git a/qml.qrc b/qml.qrc
index 1780ed7..a72d62c 100644
--- a/qml.qrc
+++ b/qml.qrc
@@ -34,5 +34,8 @@
<file>image/grid_icon&amp;48.png</file>
<file>image/info_icon&amp;48.png</file>
<file>image/zoom_icon&amp;48.png</file>
+ <file>image/bubble_icon&amp;48.png</file>
+ <file>image/semi_radius.png</file>
+ <file>image/quarter_radius.png</file>
</qresource>
</RCC>
diff --git a/symbol.cpp b/symbol.cpp
index 499a44c..5233497 100644
--- a/symbol.cpp
+++ b/symbol.cpp
@@ -70,6 +70,8 @@ void SymEditSymbol::Load(const QString& buffer)
Items.push_back(Item(Operation::Line, position, QPoint(x, y), fill));
else if ( type == 'B' )
Items.push_back(Item(Operation::Rectangle, position, QPoint(x, y), fill));
+ else if ( type == 'H' )
+ Items.push_back(Item(Operation::Arc, position, QPoint(x, y), fill));
position = QPoint(x, y);
}
else // single parameter
@@ -151,7 +153,12 @@ QString& SymEditSymbol::Save(QString& buffer) const
}
case Operation::Arc:
{
- //##
+ if ( item.Fill != fill )
+ fill = appendoption('F', buffer, item.Fill);
+ if ( item.Point != position )
+ appendvalue(buffer.append('U'), item.Point, 2);
+ appendvalue(buffer.append('H'), item.Value, 1);
+ position = item.Point;
break;
}
default: assert(0);
diff --git a/symedit.pro b/symedit.pro
index 974ead6..4586988 100644
--- a/symedit.pro
+++ b/symedit.pro
@@ -36,8 +36,12 @@ HEADERS += \
symbol.h
DISTFILES += \
+ .gitignore \
+ .editorconfig \
README.md \
- image/circle_center.kra \
+ lrelease.sh \
+ lupdate.sh \
+ image/circle_center.kra \
image/circle_corner.kra \
image/circle_radius.kra \
image/delete.kra \
@@ -47,13 +51,9 @@ DISTFILES += \
image/rotate_left.kra \
image/rotate_right.kra \
image/text.kra \
- .editorconfig \
- lrelease.sh \
- lupdate.sh \
locale/symedit.ts \
locale/symedit.fi_FI.ts \
locale/symedit.en_GB.ts \
- .gitignore \
help/Makefile \
help/fin/index.rst \
help/fin/menu.rst \