89 connect (ui.objectList, SIGNAL (itemSelectionChanged()), this, SLOT (selectionChanged())); |
89 connect (ui.objectList, SIGNAL (itemSelectionChanged()), this, SLOT (selectionChanged())); |
90 connect (ui.objectList, SIGNAL (itemDoubleClicked (QListWidgetItem*)), this, SLOT (objectListDoubleClicked (QListWidgetItem*))); |
90 connect (ui.objectList, SIGNAL (itemDoubleClicked (QListWidgetItem*)), this, SLOT (objectListDoubleClicked (QListWidgetItem*))); |
91 connect (m_tabs, SIGNAL (currentChanged(int)), this, SLOT (tabSelected())); |
91 connect (m_tabs, SIGNAL (currentChanged(int)), this, SLOT (tabSelected())); |
92 connect (m_tabs, SIGNAL (tabCloseRequested (int)), this, SLOT (closeTab (int))); |
92 connect (m_tabs, SIGNAL (tabCloseRequested (int)), this, SLOT (closeTab (int))); |
93 |
93 |
94 if (ActivePrimitiveScanner() != nullptr) |
94 if (ActivePrimitiveScanner()) |
95 connect (ActivePrimitiveScanner(), SIGNAL (workDone()), this, SLOT (updatePrimitives())); |
95 connect (ActivePrimitiveScanner(), SIGNAL (workDone()), this, SLOT (updatePrimitives())); |
96 else |
96 else |
97 updatePrimitives(); |
97 updatePrimitives(); |
98 |
98 |
99 m_msglog = new MessageManager; |
99 m_msglog = new MessageManager; |
1029 // Updates various actions, undo/redo are set enabled/disabled where appropriate, togglable actions are updated based |
1029 // Updates various actions, undo/redo are set enabled/disabled where appropriate, togglable actions are updated based |
1030 // on configuration, etc. |
1030 // on configuration, etc. |
1031 // |
1031 // |
1032 void MainWindow::updateActions() |
1032 void MainWindow::updateActions() |
1033 { |
1033 { |
1034 if (m_currentDocument != nullptr and m_currentDocument->history() != nullptr) |
1034 if (m_currentDocument and m_currentDocument->history()) |
1035 { |
1035 { |
1036 EditHistory* his = m_currentDocument->history(); |
1036 EditHistory* his = m_currentDocument->history(); |
1037 int pos = his->position(); |
1037 int pos = his->position(); |
1038 ui.actionUndo->setEnabled (pos != -1); |
1038 ui.actionUndo->setEnabled (pos != -1); |
1039 ui.actionRedo->setEnabled (pos < (long) his->size() - 1); |
1039 ui.actionRedo->setEnabled (pos < (long) his->size() - 1); |
1256 // TODO: document may be null, this shouldn't be the case |
1256 // TODO: document may be null, this shouldn't be the case |
1257 // |
1257 // |
1258 void MainWindow::changeDocument (LDDocument* document) |
1258 void MainWindow::changeDocument (LDDocument* document) |
1259 { |
1259 { |
1260 // Implicit files were loaded for caching purposes and may never be switched to. |
1260 // Implicit files were loaded for caching purposes and may never be switched to. |
1261 if (document != nullptr and document->isCache()) |
1261 if (document and document->isCache()) |
1262 return; |
1262 return; |
1263 |
1263 |
1264 m_currentDocument = document; |
1264 m_currentDocument = document; |
1265 |
1265 |
1266 if (document) |
1266 if (document) |