From 6cbf0f778c804e643592d306e3e2c93a3a82904e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikko=20Syrj=C3=A4?= Date: Wed, 24 Jul 2019 22:02:50 +0300 Subject: Initial tool for rotated text. --- Editor.qml | 19 +++++++++++++------ image/text.kra | Bin 26752 -> 0 bytes image/text.png | Bin 634 -> 0 bytes image/text_horizontal.kra | Bin 0 -> 449592 bytes image/text_horizontal.png | Bin 0 -> 700 bytes image/text_rotated.kra | Bin 0 -> 457477 bytes image/text_rotated.png | Bin 0 -> 1195 bytes locale/symedit.en_GB.qm | Bin 7633 -> 8084 bytes locale/symedit.en_GB.ts | 26 +++++++++++++++++--------- locale/symedit.fi_FI.qm | Bin 8323 -> 8810 bytes locale/symedit.fi_FI.ts | 28 ++++++++++++++++++---------- locale/symedit.ts | 16 ++++------------ main.qml | 6 ++++-- qml.qrc | 5 +++-- symbol.cpp | 2 +- symedit.cpp | 33 ++++++++++++--------------------- symedit.pro | 13 +++++++------ 17 files changed, 79 insertions(+), 69 deletions(-) delete mode 100644 image/text.kra delete mode 100644 image/text.png create mode 100644 image/text_horizontal.kra create mode 100644 image/text_horizontal.png create mode 100644 image/text_rotated.kra create mode 100644 image/text_rotated.png diff --git a/Editor.qml b/Editor.qml index 0d0406b..97e8c1e 100644 --- a/Editor.qml +++ b/Editor.qml @@ -14,7 +14,8 @@ Rectangle CircleCenter = 33, ArcSemi = 41, ArcQuarter = 42, - Text = 51 + TextHorizontal = 51, + TextRotated = 52 } property int units: 100 @@ -94,7 +95,7 @@ Rectangle } else if ( !preview ) { - if ( tool > 50 && tool < 60 ) // text + if ( tool === Editor.Tool.TextHorizontal ) { if ( manager.addTextItem(Operation.Text, Qt.point(endx, endy), textvalue, colorindex, alignment) ) symbol = manager.getSymbol(true) @@ -155,6 +156,10 @@ Rectangle //## } } + else if ( tool === Editor.Tool.TextRotated ) + { + //## + } } else // activate last { @@ -305,7 +310,7 @@ Rectangle var point, position for ( index = 0; index < count; index++ ) { - var operation = manager.getItemOperation(index) + operation = manager.getItemOperation(index) position = manager.getItemPosition(index) fill = manager.getItemFill(index) color = manager.getItemColor(index) @@ -437,10 +442,12 @@ Rectangle } else if ( tool > 50 && tool < 60 ) // text { - if ( tool === Editor.Tool.Text ) - { - setalignment(context, alignment) + setalignment(context, alignment) + if ( tool === Editor.Tool.TextHorizontal ) painttext(context, textvalue, Qt.point(mousex, mousey), true) + else if ( tool === Editor.Tool.TextRotated ) + { + //## } } } diff --git a/image/text.kra b/image/text.kra deleted file mode 100644 index 9365a71..0000000 Binary files a/image/text.kra and /dev/null differ diff --git a/image/text.png b/image/text.png deleted file mode 100644 index 8589db5..0000000 Binary files a/image/text.png and /dev/null differ diff --git a/image/text_horizontal.kra b/image/text_horizontal.kra new file mode 100644 index 0000000..96c3d6e Binary files /dev/null and b/image/text_horizontal.kra differ diff --git a/image/text_horizontal.png b/image/text_horizontal.png new file mode 100644 index 0000000..dd651e9 Binary files /dev/null and b/image/text_horizontal.png differ diff --git a/image/text_rotated.kra b/image/text_rotated.kra new file mode 100644 index 0000000..fa238e0 Binary files /dev/null and b/image/text_rotated.kra differ diff --git a/image/text_rotated.png b/image/text_rotated.png new file mode 100644 index 0000000..6c7444c Binary files /dev/null and b/image/text_rotated.png differ diff --git a/locale/symedit.en_GB.qm b/locale/symedit.en_GB.qm index 097f2b5..0f5d2f6 100644 Binary files a/locale/symedit.en_GB.qm and b/locale/symedit.en_GB.qm differ diff --git a/locale/symedit.en_GB.ts b/locale/symedit.en_GB.ts index e51f7f1..412444d 100644 --- a/locale/symedit.en_GB.ts +++ b/locale/symedit.en_GB.ts @@ -137,9 +137,13 @@ Quarter Circle - + - Text + Horizontal text + + + + Rotated text @@ -155,15 +159,15 @@ - Open file + Open file - Save file + Save file - Save file with other name + Save file with other name @@ -249,13 +253,17 @@ Quarter circle radius - + + + Horizontal text + + - Draw text + Rotated text - <b>Editor:</b> + <b>Editor:</b> @@ -275,7 +283,7 @@ - <b>Symbol:</b> + <b>Symbol:</b> diff --git a/locale/symedit.fi_FI.qm b/locale/symedit.fi_FI.qm index 94a7822..571b972 100644 Binary files a/locale/symedit.fi_FI.qm and b/locale/symedit.fi_FI.qm differ diff --git a/locale/symedit.fi_FI.ts b/locale/symedit.fi_FI.ts index 95fee5a..b6823e2 100644 --- a/locale/symedit.fi_FI.ts +++ b/locale/symedit.fi_FI.ts @@ -137,11 +137,15 @@ Neljännesympyrä - + - Teksti + Vaakasuora teksti + + + + Käännetty teksti - + &Ohje @@ -155,15 +159,15 @@ - Avaa tiedosto + Avaa tiedosto - Tallenna tiedosto + Tallenna tiedosto - Tallenna tiedosto nimellä + Tallenna tiedosto nimellä @@ -249,13 +253,17 @@ Neljännesympyrä säde - + + + Vaakasuora teksti + + - Piirrä teksti + Käännetty teksti - <b>Editori:</b> + <b>Editori:</b> @@ -275,7 +283,7 @@ - <b>Symboli:</b> + <b>Symboli:</b> diff --git a/locale/symedit.ts b/locale/symedit.ts index 5ef7b66..0ec4982 100644 --- a/locale/symedit.ts +++ b/locale/symedit.ts @@ -125,15 +125,11 @@ - + - - - - - + @@ -217,15 +213,11 @@ - - - - - + - + diff --git a/main.qml b/main.qml index 03cb89c..75c1780 100644 --- a/main.qml +++ b/main.qml @@ -106,7 +106,8 @@ ApplicationWindow MenuTool { text: qsTrId("id_menu_tool_arc_quarter"); tool: Editor.Tool.ArcQuarter } */ MenuSeparator { } - MenuTool { text: qsTrId("id_menu_tool_text"); tool: Editor.Tool.Text } + MenuTool { text: qsTrId("id_menu_tool_text_horizontal"); tool: Editor.Tool.TextHorizontal } +// MenuTool { text: qsTrId("id_menu_tool_text_rotated"); tool: Editor.Tool.TextRotated } } Menu { @@ -173,7 +174,8 @@ ApplicationWindow 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 } + BarTool { image: "image/text_horizontal.png"; tooltip: qsTrId("id_tooltip_tool_text_horizontal"); tool: Editor.Tool.TextHorizontal } +// BarTool { image: "image/text_rotated.png"; tooltip: qsTrId("id_tooltip_tool_text_rotated"); tool: Editor.Tool.TextRotated } } RowLayout { diff --git a/qml.qrc b/qml.qrc index 81d24bf..7bdbb94 100644 --- a/qml.qrc +++ b/qml.qrc @@ -13,8 +13,9 @@ image/rotate_left.png image/rotate_right.png image/save_icon48.png - image/text.png - image/delete.png + image/text_horizontal.png + image/text_rotated.png + image/delete.png image/redo_icon48.png image/undo_icon48.png image/copy_icon48.png diff --git a/symbol.cpp b/symbol.cpp index a429e42..f3bae2f 100644 --- a/symbol.cpp +++ b/symbol.cpp @@ -233,7 +233,7 @@ SymEditSymbol::Item& SymEditSymbol::AddItem(Operation::Type operation, QPoint po //! Add symbol item. /*! \param operation Item operation. - \param point Item position. + \param point Start position. \param end End position. \param value Item value. \param color Item color index. diff --git a/symedit.cpp b/symedit.cpp index e2e687c..cc892d9 100644 --- a/symedit.cpp +++ b/symedit.cpp @@ -303,7 +303,8 @@ QPoint SymEditManager::getItemPosition(int index) const return QPoint(0, 0); } -//! Get item int value. +//@{ +//! Get item data value. /*! \param index Item index. \return Item value. @@ -317,12 +318,6 @@ int SymEditManager::getItemValue(int index) const } return 0; } - -//! Get item point value. -/*! - \param index Item index. - \return Item value. -*/ QPoint SymEditManager::getItemPoint(int index) const { if ( Symbol.GetItemCount() ) @@ -334,12 +329,6 @@ QPoint SymEditManager::getItemPoint(int index) const } return QPoint(0, 0); } - -//! Get item text value. -/*! - \param index Item index. - \return Item value. -*/ QString SymEditManager::getItemText(int index) const { if ( Symbol.GetItemCount() ) @@ -349,8 +338,6 @@ QString SymEditManager::getItemText(int index) const } return ""; } - -// int SymEditManager::getItemColor(int index) const { if ( Symbol.GetItemCount() ) @@ -360,8 +347,6 @@ int SymEditManager::getItemColor(int index) const } return 1; } - -// int SymEditManager::getItemFill(int index) const { if ( Symbol.GetItemCount() ) @@ -371,8 +356,6 @@ int SymEditManager::getItemFill(int index) const } return 0; } - -// int SymEditManager::getItemAlign(int index) const { if ( Symbol.GetItemCount() ) @@ -382,6 +365,7 @@ int SymEditManager::getItemAlign(int index) const } return 0; } +//@} //! Select item nearest to point. /*! @@ -515,7 +499,7 @@ void SymEditManager::help(QString topic) const Q_UNUSED(topic); QString path = QCoreApplication::applicationDirPath(); path.append("/help/").append(Language).append("/symedit/index.html"); - if ( QFileInfo(path).exists() ) + if ( QFileInfo(path).exists() ) // release QDesktopServices::openUrl(QUrl(path.insert(0, "file:///"), QUrl::TolerantMode)); else // visual studio { @@ -523,12 +507,19 @@ void SymEditManager::help(QString topic) const path.append("/../threedee/help/").append(Language).append("/symedit/index.html"); if ( QFileInfo(path).exists() ) QDesktopServices::openUrl(QUrl(path.insert(0, "file:///"), QUrl::TolerantMode)); - else // qt creator + else // qt creator (windows) { path = QCoreApplication::applicationDirPath(); path.append("/../../symedit/help/").append(Language).append("/_build/html/index.html"); if ( QFileInfo(path).exists() ) QDesktopServices::openUrl(QUrl(path.insert(0, "file:///"), QUrl::TolerantMode)); + else // qt creator (linux) + { + path = QCoreApplication::applicationDirPath(); + path.append("/../symedit/help/").append(Language).append("/_build/html/index.html"); + if ( QFileInfo(path).exists() ) + QDesktopServices::openUrl(QUrl(path.insert(0, "file:///"), QUrl::TolerantMode)); + } } } } diff --git a/symedit.pro b/symedit.pro index 15a5955..07d62e2 100644 --- a/symedit.pro +++ b/symedit.pro @@ -51,14 +51,15 @@ DISTFILES += \ image/circle_center.kra \ image/circle_diameter.kra \ image/circle_corner.kra \ - image/rectangle_center.kra \ - image/rectangle_corner.kra \ + image/rectangle_center.kra \ + image/rectangle_corner.kra \ image/semi_diameter.kra \ image/quarter_radius.kra \ - image/text.kra \ - locale/symedit.ts \ - locale/symedit.fi_FI.ts \ - locale/symedit.en_GB.ts \ + image/text_horizontal.kra \ + image/text_rotated.kra \ + locale/symedit.ts \ + locale/symedit.fi_FI.ts \ + locale/symedit.en_GB.ts \ help/Makefile \ help/fin/index.rst \ help/fin/menu.rst \ -- cgit v1.2.3