Skip to content

Commit

Permalink
Add Insert Display Model menu action #704
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorsandy committed Jan 3, 2025
1 parent c9ea531 commit 8a592bf
Show file tree
Hide file tree
Showing 21 changed files with 99 additions and 26 deletions.
2 changes: 1 addition & 1 deletion builds/linux/obs/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion builds/linux/obs/alldeps/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions builds/linux/obs/alldeps/debian/changelog
Original file line number Diff line number Diff line change
@@ -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 <[email protected]> Fri, 03 Jan 2025 02:51:32 +0100
-- Trevor SANDY <[email protected]> Fri, 03 Jan 2025 02:59:40 +0100
2 changes: 1 addition & 1 deletion builds/linux/obs/alldeps/debian/lpub3d.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
Homepage: https://trevorsandy.github.io/lpub3d/
Standards-Version: 3.9.7
Expand Down
6 changes: 3 additions & 3 deletions builds/linux/obs/alldeps/lpub3d.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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: <B_CNT>%{?dist}
URL: https://trevorsandy.github.io/lpub3d
Vendor: Trevor SANDY
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions builds/linux/obs/debian/changelog
Original file line number Diff line number Diff line change
@@ -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 <[email protected]> Fri, 03 Jan 2025 02:51:21 +0100
-- Trevor SANDY <[email protected]> Fri, 03 Jan 2025 02:59:29 +0100
2 changes: 1 addition & 1 deletion builds/linux/obs/debian/lpub3d.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
Homepage: https://trevorsandy.github.io/lpub3d/
Standards-Version: 3.9.7
Expand Down
6 changes: 3 additions & 3 deletions builds/linux/obs/lpub3d.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion builds/utilities/version.info
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2 4 8 310 4034 388405f7a
2 4 8 311 4035 7bd216452
6 changes: 3 additions & 3 deletions gitversion.pri
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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 ~~~")
}

Expand Down Expand Up @@ -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/\./" "
}
Expand Down
2 changes: 1 addition & 1 deletion mainApp/docs/README.txt
Original file line number Diff line number Diff line change
@@ -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
------------
Expand Down
2 changes: 1 addition & 1 deletion mainApp/docs/RELEASE_NOTES.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ <h2>LPub3D Official release.</h2>
</div>
<table class="tg">
<ol id="ticketOL"><!-- Update update-config-files.sh/bat on line change -->
<li><code><h4>LPub3D 2.4.8.310.4034 (03 01 2025 02:51:32)</h4></code></li>
<li><code><h4>LPub3D 2.4.8.311.4035 (03 01 2025 02:59:40)</h4></code></li>
<li><code><a href="https://github.com/trevorsandy/lpub3d/issues/772">2.4.8.264 Feature - Increase the capability to change Edge Lines size #772</a></code></li>
<li><code><a href="https://github.com/trevorsandy/lpub3d/issues/801">2.4.8.264 Enhancement - Add reload file option to LDraw search directories dialog #801</a></code></li>
<li><code><a href="https://github.com/trevorsandy/lpub3d/issues/775">2.4.8.264 Enhancement - Add renderer arguments and environment vars to global settings #775</a></code></li>
Expand Down
4 changes: 2 additions & 2 deletions mainApp/extras/LPub3D_Npp_UDL.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions mainApp/lpub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ void Gui::deletePage()
lpub->mi.deletePage();
}

void Gui::insertDisplayModel()
{
lpub->mi.insertPicture();
}

void Gui::addPicture()
{
lpub->mi.insertPicture();
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down
1 change: 1 addition & 0 deletions mainApp/lpub.h
Original file line number Diff line number Diff line change
Expand Up @@ -1935,6 +1935,7 @@ private slots:
void insertNumberedPage();
void appendNumberedPage();
void deletePage();
void insertDisplayModel();
void addPicture();
void addText();
void addBom();
Expand Down
4 changes: 2 additions & 2 deletions mainApp/lpub3d.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@
<binary>lpub3d24</binary>
​</provides>
<releases>
<release version="2.4.8.4034" date="2025-01-03">
<release version="2.4.8.4035" date="2025-01-03">
<description>
<p>LPub3D 03.01.2025 v2.4.8 r310 Continuous Build.
<p>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
Expand Down
1 change: 1 addition & 0 deletions mainApp/lpub3d.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
<file alias="importldd.png">resources/importldd.png</file>
<file alias="importsetinventory.png">resources/importsetinventory.png</file>
<file alias="insertcoverpage.png">resources/insertcoverpage.png</file>
<file alias="insertdisplaymodel.png">resources/insertdisplaymodel.png</file>
<file alias="insertpage.png">resources/insertpage.png</file>
<file alias="instructionsetup.png">resources/instructionsetup.png</file>
<file alias="italic.png">resources/italic.png</file>
Expand Down
44 changes: 44 additions & 0 deletions mainApp/metaitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2918,6 +2918,7 @@ void MetaItem::insertNumberedPage()
QString meta = "0 !LPUB INSERT PAGE";
insertPage(meta);
}

void MetaItem::appendNumberedPage()
{
QString meta = "0 !LPUB INSERT PAGE";
Expand Down Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions mainApp/metaitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ class MetaItem
bool deleteFinalModelStep(bool = false);
bool insertFinalModelStep();

void insertDisplayModel();
void insertPicture();
void insertText();
void insertBOM();
Expand Down
Binary file added mainApp/resources/insertdisplaymodel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions mainApp/traverse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1636,6 +1636,15 @@ int Gui::drawPage(
return static_cast<int>(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)) {
Expand Down

0 comments on commit 8a592bf

Please sign in to comment.