Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add point operation & Solid hatch load from file #312

Merged
merged 20 commits into from
Jul 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lcUI/lcadpaperviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using namespace lc::ui;
using namespace lc::viewer;

#define PAPER_WIDTH 300
#define PAPER_HEIGHT 200
#define PAPER_HEIGHT -200

LCADPaperViewer::LCADPaperViewer(QWidget* parent,int id = 0):LCADViewer(parent),_id(id){
_gradientBackground = std::make_shared<drawable::PaperBackground>(PAPER_WIDTH, PAPER_HEIGHT);
Expand Down Expand Up @@ -47,4 +47,4 @@ void LCADPaperViewer::setDocument(std::shared_ptr<lc::storage::Document> documen

void LCADPaperViewer::onMouseMoveEvent(){
emit setActive(_id);
};
};
12 changes: 9 additions & 3 deletions lcUI/lcadviewerproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ LCADViewerProxy::LCADViewerProxy(QWidget* parent=0){
gridLayout->addWidget(_tabWidget, 0, 0, 1, 1);

_tabWidget->addTab(_modelViewerImpl, tr("Model"));
_tabWidget->addTab(_modelViewerImpl, tr("Paper 1"));//Just for init, removed later
_tabWidget->addTab(_modelViewerImpl, tr("Paper 2"));

_paperViewers = new LCADPaperViewerImpl(this);

//Connections to receive active View
Expand All @@ -44,16 +47,19 @@ void LCADViewerProxy::setDocument(std::shared_ptr<lc::storage::Document> documen
_modelViewerImpl->setDocument(document);
_paperViewers->setDocument(document);

_tabWidget->removeTab(1);
_tabWidget->removeTab(1);

//For each block create viewport
auto view = document->blockByName("*Paper_Space");
auto x = _paperViewers->getViewer();
x->setDocument(document,view);
_tabWidget->addTab(x,"Paper 1");
_tabWidget->addTab(x,tr("Paper 1"));

view = document->blockByName("*Paper_Space0");
x = _paperViewers->getViewer();
x->setDocument(document,view);
_tabWidget->addTab(x,"Paper 2");
_tabWidget->addTab(x,tr("Paper 2"));
}

void LCADViewerProxy::setActive(LCADViewer* view,bool isModel){
Expand All @@ -70,4 +76,4 @@ void LCADViewerProxy::setActive(LCADViewer* view,bool isModel){
connect(_activeView, SIGNAL(mouseReleaseEvent()), this, SIGNAL(mouseReleaseEvent()));
connect(_activeView, SIGNAL(keyPressEvent(int)), this, SIGNAL(keyPressEvent(int)));
}
}
}
11 changes: 11 additions & 0 deletions lcUI/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ void MainWindow::ConnectInputEvents()
QObject::connect(findMenuItemByObjectName("actionSelect_All"), &QAction::triggered, this, &MainWindow::selectAll);
QObject::connect(findMenuItemByObjectName("actionSelect_None"), &QAction::triggered, this, &MainWindow::selectNone);
QObject::connect(findMenuItemByObjectName("actionInvert_Selection"), &QAction::triggered, this, &MainWindow::invertSelection);
QObject::connect(findMenuItemByObjectName("actionClear_Undoable_Stack"), &QAction::triggered, this, &MainWindow::clearUndoableStack);
}

/* Menu functions */
Expand Down Expand Up @@ -541,26 +542,36 @@ void MainWindow::openFile()
void MainWindow::undo()
{
_cadMdiChild.undoManager()->undo();
_cadMdiChild.viewer()->update();
}

void MainWindow::clearUndoableStack()
{
_cadMdiChild.undoManager()->removeUndoables();
}

void MainWindow::redo()
{
_cadMdiChild.undoManager()->redo();
_cadMdiChild.viewer()->update();
}

void MainWindow::selectAll()
{
_cadMdiChild.viewer()->docCanvas()->selectAll();
_cadMdiChild.viewer()->update();
}

void MainWindow::selectNone()
{
_cadMdiChild.viewer()->docCanvas()->removeSelection();
_cadMdiChild.viewer()->update();
}

void MainWindow::invertSelection()
{
_cadMdiChild.viewer()->docCanvas()->inverseSelection();
_cadMdiChild.viewer()->update();
}

void MainWindow::runCustomizeToolbar() {
Expand Down
1 change: 1 addition & 0 deletions lcUI/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ namespace lc
void selectAll();
void selectNone();
void invertSelection();
void clearUndoableStack();

// Customize toolbar slots
void runCustomizeToolbar();
Expand Down
6 changes: 6 additions & 0 deletions lcUI/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
<addaction name="actionClear_Undoable_Stack"/>
<addaction name="separator"/>
<addaction name="actionPolyline"/>
<addaction name="actionPoint"/>
<addaction name="actionSpline"/>
</widget>
</widget>
Expand Down Expand Up @@ -289,6 +290,11 @@
<string>&amp;Polyline</string>
</property>
</action>
<action name="actionPoint">
<property name="text">
<string>P&amp;oint</string>
</property>
</action>
<action name="actionSpline">
<property name="text">
<string>&amp;Spline</string>
Expand Down
116 changes: 116 additions & 0 deletions lcUI/ui/icons/divide.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 76 additions & 0 deletions lcUI/ui/icons/point.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions lcUI/ui/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
<addaction name="menuEllipse"/>
<addaction name="menuDimension"/>
<addaction name="actionPolyline"/>
<addaction name="actionPoint"/>
<addaction name="actionSpline"/>
</widget>
<addaction name="menuDemo_Project"/>
Expand Down Expand Up @@ -294,6 +295,11 @@
<string>&amp;Polyline</string>
</property>
</action>
<action name="actionPoint">
<property name="text">
<string>P&amp;oint</string>
</property>
</action>
<action name="actionSpline">
<property name="text">
<string>&amp;Spline</string>
Expand Down
2 changes: 2 additions & 0 deletions lcUI/ui/resource.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
<file alias="snap_grid.svg">icons/snap_grid.svg</file>
<file alias="snap_intersection.svg">icons/snap_intersection.svg</file>
<file alias="snap_middle.svg">icons/snap_middle.svg</file>
<file alias="point.svg">icons/point.svg</file>
<file alias="divide.svg">icons/divide.svg</file>
</qresource>
</RCC>
2 changes: 1 addition & 1 deletion lcUILua/actions/copyoperation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ function CopyOperation:close()
luaInterface:deleteEvent('mouseMove', self)
luaInterface:deleteEvent('point', self)

luaInterface:triggerEvent('operationFinished')
luaInterface:triggerEvent('operationFinished', self.widget)
end
end
Loading