From 8a592bf71bb22d91c075c5a1292f75742056c40c Mon Sep 17 00:00:00 2001 From: Trevor SANDY Date: Fri, 3 Jan 2025 02:59:08 +0100 Subject: [PATCH] Add Insert Display Model menu action #704 --- builds/linux/obs/PKGBUILD | 2 +- builds/linux/obs/alldeps/PKGBUILD | 2 +- builds/linux/obs/alldeps/debian/changelog | 6 +-- builds/linux/obs/alldeps/debian/lpub3d.dsc | 2 +- builds/linux/obs/alldeps/lpub3d.spec | 6 +-- builds/linux/obs/debian/changelog | 6 +-- builds/linux/obs/debian/lpub3d.dsc | 2 +- builds/linux/obs/lpub3d.spec | 6 +-- builds/utilities/version.info | 2 +- gitversion.pri | 6 +-- mainApp/docs/README.txt | 2 +- mainApp/docs/RELEASE_NOTES.html | 2 +- mainApp/extras/LPub3D_Npp_UDL.xml | 4 +- mainApp/lpub.cpp | 17 ++++++++ mainApp/lpub.h | 1 + mainApp/lpub3d.appdata.xml | 4 +- mainApp/lpub3d.qrc | 1 + mainApp/metaitem.cpp | 44 +++++++++++++++++++++ mainApp/metaitem.h | 1 + mainApp/resources/insertdisplaymodel.png | Bin 0 -> 1819 bytes mainApp/traverse.cpp | 9 +++++ 21 files changed, 99 insertions(+), 26 deletions(-) create mode 100644 mainApp/resources/insertdisplaymodel.png diff --git a/builds/linux/obs/PKGBUILD b/builds/linux/obs/PKGBUILD index 0df4f52b6..64eb42f41 100755 --- a/builds/linux/obs/PKGBUILD +++ b/builds/linux/obs/PKGBUILD @@ -2,7 +2,7 @@ # Last Update: December 06, 2024 # Copyright (C) 2017 - 2024 by Trevor SANDY pkgname=lpub3d -pkgver=2.4.8.4034 +pkgver=2.4.8.4035 pkgrel=1 pkgdesc="An LDraw Building Instruction Editor" url="https://github.com/trevorsandy/lpub3d.git" diff --git a/builds/linux/obs/alldeps/PKGBUILD b/builds/linux/obs/alldeps/PKGBUILD index f9e3cdd68..f13968559 100644 --- a/builds/linux/obs/alldeps/PKGBUILD +++ b/builds/linux/obs/alldeps/PKGBUILD @@ -2,7 +2,7 @@ # Last Update: September 16, 2024 # Copyright (C) 2017 - 2024 by Trevor SANDY pkgname=lpub3d -pkgver=2.4.8.4034 +pkgver=2.4.8.4035 pkgrel=1 pkgdesc="An LDraw Building Instruction Editor" url="https://github.com/trevorsandy/lpub3d.git" diff --git a/builds/linux/obs/alldeps/debian/changelog b/builds/linux/obs/alldeps/debian/changelog index 96a54a09d..131ca7bed 100644 --- a/builds/linux/obs/alldeps/debian/changelog +++ b/builds/linux/obs/alldeps/debian/changelog @@ -1,5 +1,5 @@ -lpub3d (2.4.8.4034) debian; urgency=medium +lpub3d (2.4.8.4035) debian; urgency=medium - * LPub3D version 2.4.8.310.4034_20250103 for Linux + * LPub3D version 2.4.8.311.4035_20250103 for Linux - -- Trevor SANDY Fri, 03 Jan 2025 02:51:32 +0100 + -- Trevor SANDY Fri, 03 Jan 2025 02:59:40 +0100 diff --git a/builds/linux/obs/alldeps/debian/lpub3d.dsc b/builds/linux/obs/alldeps/debian/lpub3d.dsc index 1bac337b3..94091f169 100644 --- a/builds/linux/obs/alldeps/debian/lpub3d.dsc +++ b/builds/linux/obs/alldeps/debian/lpub3d.dsc @@ -2,7 +2,7 @@ Format: 1.0 Source: lpub3d Binary: lpub3d Architecture: any -Version: 2.4.8.4034 +Version: 2.4.8.4035 Maintainer: Trevor SANDY Homepage: https://trevorsandy.github.io/lpub3d/ Standards-Version: 3.9.7 diff --git a/builds/linux/obs/alldeps/lpub3d.spec b/builds/linux/obs/alldeps/lpub3d.spec index a9ca39f57..7b3bedd15 100644 --- a/builds/linux/obs/alldeps/lpub3d.spec +++ b/builds/linux/obs/alldeps/lpub3d.spec @@ -120,7 +120,7 @@ BuildRequires: fdupes Summary: An LDraw Building Instruction Editor Name: lpub3d Icon: lpub3d.xpm -Version: 2.4.8.4034 +Version: 2.4.8.4035 Release: %{?dist} URL: https://trevorsandy.github.io/lpub3d Vendor: Trevor SANDY @@ -816,10 +816,10 @@ update-desktop-database || true %endif %changelog -* Fri Jan 03 2025 - trevor.dot.sandy.at.gmail.dot.com 2.4.8.4034 +* Fri Jan 03 2025 - trevor.dot.sandy.at.gmail.dot.com 2.4.8.4035 - LPub3D 2.3.8 enhancements and fixes - see RELEASE_NOTES for details -* Fri Jan 03 2025 - trevor.dot.sandy.at.gmail.dot.com 2.4.8.4034 +* Fri Jan 03 2025 - trevor.dot.sandy.at.gmail.dot.com 2.4.8.4035 - LPub3D 2.3.7 enhancements and fixes - see RELEASE_NOTES for details * Tue May 31 2022 - trevor dot sandy at gmail dot com 2.4.4.2670 diff --git a/builds/linux/obs/debian/changelog b/builds/linux/obs/debian/changelog index 107880477..7ef00cd34 100644 --- a/builds/linux/obs/debian/changelog +++ b/builds/linux/obs/debian/changelog @@ -1,5 +1,5 @@ -lpub3d (2.4.8.4034) debian; urgency=medium +lpub3d (2.4.8.4035) debian; urgency=medium - * LPub3D version 2.4.8.310.4034_20250103 for Linux + * LPub3D version 2.4.8.311.4035_20250103 for Linux - -- Trevor SANDY Fri, 03 Jan 2025 02:51:21 +0100 + -- Trevor SANDY Fri, 03 Jan 2025 02:59:29 +0100 diff --git a/builds/linux/obs/debian/lpub3d.dsc b/builds/linux/obs/debian/lpub3d.dsc index 2d7bfe0a4..d16efb320 100755 --- a/builds/linux/obs/debian/lpub3d.dsc +++ b/builds/linux/obs/debian/lpub3d.dsc @@ -2,7 +2,7 @@ Format: 1.0 Source: lpub3d Binary: lpub3d Architecture: any -Version: 2.4.8.4034 +Version: 2.4.8.4035 Maintainer: Trevor SANDY Homepage: https://trevorsandy.github.io/lpub3d/ Standards-Version: 3.9.7 diff --git a/builds/linux/obs/lpub3d.spec b/builds/linux/obs/lpub3d.spec index 365d06499..b467f277c 100755 --- a/builds/linux/obs/lpub3d.spec +++ b/builds/linux/obs/lpub3d.spec @@ -82,7 +82,7 @@ BuildRequires: fdupes Summary: An LDraw Building Instruction Editor Name: lpub3d Icon: lpub3d.xpm -Version: 2.4.8.4034 +Version: 2.4.8.4035 Release: 1%{?dist} URL: https://trevorsandy.github.io/lpub3d Vendor: Trevor SANDY @@ -314,10 +314,10 @@ update-desktop-database || true %endif %changelog -* Fri Jan 03 2025 - trevor.dot.sandy.at.gmail.dot.com 2.4.8.4034 +* Fri Jan 03 2025 - trevor.dot.sandy.at.gmail.dot.com 2.4.8.4035 - LPub3D 2.4.4 enhancements and fixes - see RELEASE_NOTES for details -* Fri Jan 03 2025 - trevor.dot.sandy.at.gmail.dot.com 2.4.8.4034 +* Fri Jan 03 2025 - trevor.dot.sandy.at.gmail.dot.com 2.4.8.4035 - LPub3D 2.4.4 enhancements and fixes - see RELEASE_NOTES for details * Tue May 31 2022 - trevor dot sandy at gmail dot com 2.4.4.2670 diff --git a/builds/utilities/version.info b/builds/utilities/version.info index 8d1aaba94..0ffde0f7b 100755 --- a/builds/utilities/version.info +++ b/builds/utilities/version.info @@ -1 +1 @@ -2 4 8 310 4034 388405f7a +2 4 8 311 4035 7bd216452 diff --git a/gitversion.pri b/gitversion.pri index bc87b26d1..a4dfaa0e0 100644 --- a/gitversion.pri +++ b/gitversion.pri @@ -44,7 +44,7 @@ equals(GIT_DIR, undefined) { # Check if we do not have a valid version number (i.e. no version tag found) isEmpty(GIT_VERSION) { - GIT_REVISION = 310 + GIT_REVISION = 311 GIT_SHA = $$system($$GIT_BASE_COMMAND rev-parse --short HEAD 2> $$NULL_DEVICE) GIT_COMMIT = $$system($$GIT_BASE_COMMAND rev-list --count HEAD 2> $$NULL_DEVICE) GIT_VERSION = v$${VERSION}-$${GIT_REVISION}-$${GIT_SHA} @@ -72,7 +72,7 @@ equals(GIT_DIR, undefined) { # Get commit count GIT_COMMIT = $$system($$GIT_BASE_COMMAND rev-list --count HEAD 2> $$NULL_DEVICE) isEmpty(GIT_COMMIT) { - GIT_COMMIT = 4034 + GIT_COMMIT = 4035 message("~~~ ERROR LPUB3D! GIT_COMMIT NOT DEFINED, USING $$GIT_COMMIT ~~~") } @@ -120,7 +120,7 @@ if (equals(USE_GIT_VER_FILE, true)|equals(USE_VERSION_INFO_VAR, true)) { GIT_VERSION = $$cat($$GIT_VER_FILE, lines) } else { message("~~~ ERROR LPUB3D! $$GIT_DIR_ENV VERSION_INFO FILE $$GIT_VER_FILE NOT FOUND ~~~") - GIT_VERSION = $${VERSION}.310.4034.388405f7a + GIT_VERSION = $${VERSION}.311.4035.7bd216452 message("~~~ $${LPUB3D} GIT_DIR [$$GIT_DIR_ENV, USING VERSION] $$GIT_VERSION ~~~") GIT_VERSION ~= s/\./" " } diff --git a/mainApp/docs/README.txt b/mainApp/docs/README.txt index 9cd5236b6..7fb0d6f0c 100755 --- a/mainApp/docs/README.txt +++ b/mainApp/docs/README.txt @@ -1,4 +1,4 @@ -LPub3D 2.4.8.310.4034 (03 01 2025 02:51:32) +LPub3D 2.4.8.311.4035 (03 01 2025 02:59:40) Features, enhancements, fixes and changes ------------ diff --git a/mainApp/docs/RELEASE_NOTES.html b/mainApp/docs/RELEASE_NOTES.html index fd87875b6..32b60f2f4 100644 --- a/mainApp/docs/RELEASE_NOTES.html +++ b/mainApp/docs/RELEASE_NOTES.html @@ -80,7 +80,7 @@

LPub3D Official release.

    -
  1. LPub3D 2.4.8.310.4034 (03 01 2025 02:51:32)

  2. +
  3. LPub3D 2.4.8.311.4035 (03 01 2025 02:59:40)

  4. 2.4.8.264 Feature - Increase the capability to change Edge Lines size #772
  5. 2.4.8.264 Enhancement - Add reload file option to LDraw search directories dialog #801
  6. 2.4.8.264 Enhancement - Add renderer arguments and environment vars to global settings #775
  7. diff --git a/mainApp/extras/LPub3D_Npp_UDL.xml b/mainApp/extras/LPub3D_Npp_UDL.xml index 9f02bc431..55afe3e0c 100644 --- a/mainApp/extras/LPub3D_Npp_UDL.xml +++ b/mainApp/extras/LPub3D_Npp_UDL.xml @@ -14,8 +14,8 @@ ;; ;; Author......: Trevor SANDY ;; Name........: LPub3D_Npp_UDL.xml -;; Version.....: 2.4.8.310.4034 -;; Last Update.: Fri, 03 Jan 2025 02:51:32 +0100 +;; Version.....: 2.4.8.311.4035 +;; Last Update.: Fri, 03 Jan 2025 02:59:40 +0100 ;; License.....: GPLv3 ;; Homepage....: https://trevorsandy.github.io/lpub3d ;; Copyright (C) 2021 - 2024 by Trevor SANDY diff --git a/mainApp/lpub.cpp b/mainApp/lpub.cpp index 0dcc9f805..71201513c 100644 --- a/mainApp/lpub.cpp +++ b/mainApp/lpub.cpp @@ -296,6 +296,11 @@ void Gui::deletePage() lpub->mi.deletePage(); } +void Gui::insertDisplayModel() +{ + lpub->mi.insertPicture(); +} + void Gui::addPicture() { lpub->mi.insertPicture(); @@ -5265,6 +5270,14 @@ void Gui::createActions() lpub->actions.insert(addPictureAct->objectName(), Action(QStringLiteral("Edit.Add Picture"), addPictureAct)); connect(addPictureAct, SIGNAL(triggered()), gui, SLOT(addPicture())); + QAction *insertDisplayModelAct = new QAction(QIcon(":/resources/insertdisplaymodel.png"),tr("Insert Display Model"),gui); + insertDisplayModelAct->setObjectName("insertDisplayModelAct.1"); + insertDisplayModelAct->setShortcut(QStringLiteral("Ctrl+Alt+K")); + insertDisplayModelAct->setStatusTip(tr("Insert a Display Model page command")); + insertDisplayModelAct->setEnabled(false); + lpub->actions.insert(insertDisplayModelAct->objectName(), Action(QStringLiteral("Edit.Insert Display Model"), insertDisplayModelAct)); + connect(insertDisplayModelAct, SIGNAL(triggered()), gui, SLOT(insertDisplayModel())); + QAction *addTextAct = new QAction(QIcon(":/resources/addtext.png"),tr("Add Text"),gui); addTextAct->setObjectName("addTextAct.1"); addTextAct->setShortcut(QStringLiteral("Ctrl+Alt+T")); @@ -6655,6 +6668,7 @@ void Gui::enableActions() gui->getAct("projectSetupAct.1")->setEnabled(true); gui->getAct("fadeStepsSetupAct.1")->setEnabled(true); gui->getAct("highlightStepSetupAct.1")->setEnabled(true); + gui->getAct("insertDisplayModelAct.1")->setEnabled(true); gui->getAct("addPictureAct.1")->setEnabled(true); gui->getAct("removeLPubFormatDocumentAct.1")->setEnabled(true); gui->getAct("removeLPubFormatBomAct.1")->setEnabled(true); @@ -6762,6 +6776,7 @@ void Gui::disableActions() gui->getAct("projectSetupAct.1")->setEnabled(false); gui->getAct("fadeStepsSetupAct.1")->setEnabled(false); gui->getAct("highlightStepSetupAct.1")->setEnabled(false); + gui->getAct("insertDisplayModelAct.1")->setEnabled(false); gui->getAct("addPictureAct.1")->setEnabled(false); gui->getAct("removeLPubFormatBomAct.1")->setEnabled(false); gui->getAct("removeLPubFormatDocumentAct.1")->setEnabled(false); @@ -6990,6 +7005,7 @@ void Gui::createMenus() editMenu->addAction(gui->getAct("insertNumberedPageAct.1")); editMenu->addAction(gui->getAct("appendNumberedPageAct.1")); editMenu->addAction(gui->getAct("deletePageAct.1")); + editMenu->addAction(gui->getAct("insertDisplayModelAct.1")); editMenu->addAction(gui->getAct("addPictureAct.1")); editMenu->addAction(gui->getAct("addTextAct.1")); editMenu->addAction(gui->getAct("addBomAct.1")); @@ -7336,6 +7352,7 @@ void Gui::createToolBars() editToolBar->addAction(gui->getAct("insertNumberedPageAct.1")); editToolBar->addAction(gui->getAct("appendNumberedPageAct.1")); editToolBar->addAction(gui->getAct("deletePageAct.1")); + editToolBar->addAction(gui->getAct("insertDisplayModelAct.1")); editToolBar->addAction(gui->getAct("addPictureAct.1")); editToolBar->addAction(gui->getAct("addTextAct.1")); editToolBar->addAction(gui->getAct("addBomAct.1")); diff --git a/mainApp/lpub.h b/mainApp/lpub.h index 8cd625ac4..d5777bf8f 100644 --- a/mainApp/lpub.h +++ b/mainApp/lpub.h @@ -1935,6 +1935,7 @@ private slots: void insertNumberedPage(); void appendNumberedPage(); void deletePage(); + void insertDisplayModel(); void addPicture(); void addText(); void addBom(); diff --git a/mainApp/lpub3d.appdata.xml b/mainApp/lpub3d.appdata.xml index 4e7fc52b7..4f036016f 100644 --- a/mainApp/lpub3d.appdata.xml +++ b/mainApp/lpub3d.appdata.xml @@ -78,9 +78,9 @@ lpub3d24 - + -

    LPub3D 03.01.2025 v2.4.8 r310 Continuous Build. +

    LPub3D 03.01.2025 v2.4.8 r311 Continuous Build. Feature - Increase the capability to change Edge Lines size #772 Enhancement - Add reload file option to LDraw search directories dialog #801 Enhancement - Add renderer arguments and environment vars to global settings #775 diff --git a/mainApp/lpub3d.qrc b/mainApp/lpub3d.qrc index e1b755158..82f4d8bd8 100644 --- a/mainApp/lpub3d.qrc +++ b/mainApp/lpub3d.qrc @@ -178,6 +178,7 @@ resources/importldd.png resources/importsetinventory.png resources/insertcoverpage.png + resources/insertdisplaymodel.png resources/insertpage.png resources/instructionsetup.png resources/italic.png diff --git a/mainApp/metaitem.cpp b/mainApp/metaitem.cpp index aa6c8d282..ee2fac669 100644 --- a/mainApp/metaitem.cpp +++ b/mainApp/metaitem.cpp @@ -2918,6 +2918,7 @@ void MetaItem::insertNumberedPage() QString meta = "0 !LPUB INSERT PAGE"; insertPage(meta); } + void MetaItem::appendNumberedPage() { QString meta = "0 !LPUB INSERT PAGE"; @@ -3072,6 +3073,49 @@ void MetaItem::deletePage() endMacro(); } +void MetaItem::insertDisplayModel() +{ + if (lpub->page.coverPage) { + emit gui->messageSig(LOG_ERROR, QObject::tr("Inserting a display model to a cover page is not allowed.")); + return; + } + + if (lpub->currentStep) { + if (lpub->currentStep->multiStep) { + emit gui->messageSig(LOG_ERROR, QObject::tr("Inserting a display model to a multi-step page is not allowed.")); + return; + } + + if (lpub->currentStep->calledOut) { + emit gui->messageSig(LOG_ERROR, QObject::tr("Inserting a display model to a called out page is not allowed.")); + return; + } + } + + QString meta = "0 !LPUB INSERT DISPLAY_MODEL"; + + Where topOfStep = Gui::topOfPages[Gui::displayPageNum-1]; + + scanPastGlobal(topOfStep); + + QString line = lpub->ldrawFile.readLine(topOfStep.modelName,topOfStep.lineNumber + 1); // appended line + QStringList argv; + split(line,argv); + bool skipStepMeta = (argv.size() >= 2 && + argv[0] == "0" && + (argv[1] == "STEP" || + argv[1] == "ROTSTEP")); + + QString pageMeta = "0 !LPUB INSERT PAGE"; + Where here = topOfStep + 1; + beginMacro("InsertDisplayModel"); + if (!skipStepMeta) + appendMeta(topOfStep,"0 STEP"); + appendPage(pageMeta, here); + appendMeta(here,meta); + endMacro(); +} + void MetaItem::insertPicture() { QString title = QFileDialog::tr("Select Image"); diff --git a/mainApp/metaitem.h b/mainApp/metaitem.h index 25f1e94df..a4d4be508 100644 --- a/mainApp/metaitem.h +++ b/mainApp/metaitem.h @@ -484,6 +484,7 @@ class MetaItem bool deleteFinalModelStep(bool = false); bool insertFinalModelStep(); + void insertDisplayModel(); void insertPicture(); void insertText(); void insertBOM(); diff --git a/mainApp/resources/insertdisplaymodel.png b/mainApp/resources/insertdisplaymodel.png new file mode 100644 index 0000000000000000000000000000000000000000..6218eadf5e29e78ac9210c0c0775ccc91f6f98e6 GIT binary patch literal 1819 zcmZ8hc{JNu8~!C?3sGsJQp+TteYBQX2CcT35>d5{U2RoW`xb*Bs->1zwaQEd6|_?m zYiX;sg=q=;HP)u3c2W$fQn8F+eme90^WAfv`#kS^-{-yeo^#L5w6h@~;4*Lk01!mW zvkoBR4j>`~&e3G@I!KUc2Z9+;!;)JB16Y9Rc~by*k|W0V6$E3^2urtU0FZcf00=X@ z;u4s|kj!04KZRc=#rj7119rZFVI)l(b4Q%MCSFr#r$yj7So7T9m3Wy*R0l-BKoF3D z2m%mLS%HxKS09{44I=O@4+S+I0tF;Nb_Wrd4*Ql50`-L0>QNtf`|b zq4gK}gly{t9SvP*$BEM1V!dy_L zuXxq>wR0!~7o8>>ahb$?B}BMB+61YXfzLqdNp>4eSC8Br+vWAuV^kM(;23choWURW ze(68XbNjBuqvOgs38HkS`o;6VL9cd+vfQ;w0i_DE0mH@QT87r|4M(z3jJv60>^pkI z0_0UY=+gD}u`E-_{Bf3hQNI5lGex2CN4nQWBVM2pP^&wW!lqKkCiLz$%+=^9%sVwG zj0Ac_88{7~>{cMb8qTnJo{(Vh?uh`6?e2l+)^mykmOIW^_J?Q%S7g<*34!UI*k5s} zLJpdexH}m|%@-dQ3K$-1Q+}6#n`Jt#~oWZBI;K(6tyod8<~M}o-k0r1iK zmUi*bGbr`Y;wo!-y#vhfjdRPItuc{o!@yV~Wx)b#YL@(@qYboSxnfl|Ev z|GK@|Q@xQ9b-PIHo~Cs(saOf${1@}Xc0SLT67>tq?4;@>{}AK5LjQ=Tz4ywUgb0=5 zMO8WpFD2;5*}(|tNMLrSjOncv&iY$Rr%8P-wfwnu4rI?rIPJEvJU1RLAD<=9&4X93 z)*5-cD~}-ypuP8PqUA=KW+tjQC87Q&LhidI7QssXk52MYA}XES~v=9$R$!w373Sq z5$s=gOy;b8oM+X?p1Zp`tC;7Ee!?1T?5O*MMJ-QU+5XJ!Z|sQbn`ci&Ax$J`Ey+{& z>2%iH_oT44-y(Atk{DYZF($d-Z&6i;A|jF@J$PY~0L;!MIMR$a6Y)u<5zC=>b(dbkq;?1gkTfO;-GZEG)^^!t% z@aXI{Zv-{^ae@qu-_TLofJe`6B?TpA*Rg%3i&uDIOL!C2enjH&VAdfloG*L-hf--V ilc(!0Se>AD&OTI>$XvFyp5`6=@I-T)vo&Tu*Zv0H0UvMx literal 0 HcmV?d00001 diff --git a/mainApp/traverse.cpp b/mainApp/traverse.cpp index 30e79c2d5..801db0dfc 100644 --- a/mainApp/traverse.cpp +++ b/mainApp/traverse.cpp @@ -1636,6 +1636,15 @@ int Gui::drawPage( return static_cast(HitInvalidLDrawLine); } } else { /*InsertDisplayModelRc*/ + QString parseErrorMsg; + if (lpub->page.coverPage) + parseErrorMsg = tr("Cannot insert a display model to a cover page."); + if (multiStep) + parseErrorMsg = tr("Cannot insert a display model to a multi-step page."); + if (opts.calledOut) + parseErrorMsg = tr("Cannot insert a display model to a called out page."); + if (!parseErrorMsg.isEmpty()) + emit gui->parseErrorSig(parseErrorMsg,opts.current); curMeta.LPub.assem.showStepNumber.setValue(false); opts.displayModel = true; if (Gui::stepContains(top,partTypeLineRx)) {