diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp index 2b436390f..45bf59ee4 100644 --- a/sources/exportdialog.cpp +++ b/sources/exportdialog.cpp @@ -419,8 +419,8 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee y0 += rowHeight; QRectF row_rect(x0, y0, list_rectangles[0] -> width(), rowHeight); fillRow(file_path, row_rect, diagram_list[i] -> border_and_titleblock.author(), - diagram_list[i] -> border_and_titleblock.title(), - diagram_list[i] -> border_and_titleblock.folio(), + diagram_list[i] -> title(), + QString::number(diagram_list[i] ->folioIndex()+1), diagram_list[i] -> border_and_titleblock.date().toString("dd/MM/yyyy")); } @@ -436,8 +436,8 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee y0 += rowHeight; QRectF row_rect(x0, y0, list_rectangles[1] -> width(), rowHeight); fillRow(file_path, row_rect, diagram_list[i] -> border_and_titleblock.author(), - diagram_list[i] -> border_and_titleblock.title(), - diagram_list[i] -> border_and_titleblock.folio(), + diagram_list[i] -> title(), + QString::number(diagram_list[i] ->folioIndex()+1), diagram_list[i] -> border_and_titleblock.date().toString("dd/MM/yyyy")); } diff --git a/sources/projectview.cpp b/sources/projectview.cpp index 15b9ba8bc..f4f35e274 100644 --- a/sources/projectview.cpp +++ b/sources/projectview.cpp @@ -339,7 +339,13 @@ void ProjectView::addDiagram(DiagramView *diagram, bool front) { // Add new tab for the diagram tabs_ -> addTab(diagram, QET::Icons::Diagram, diagram -> title()); diagram -> setFrameStyle(QFrame::Plain | QFrame::NoFrame); - diagrams_ << diagram; + + // Add diagram type is a folio list then add it just after the last folio list in project, else add it at the back. + //if (DiagramFolioList *ptr = dynamic_cast(diagram)) + //diagrams_.insert(DiagramFolioList::folioList_quantity, diagram); + //else + diagrams_ << diagram; + rebuildDiagramsMap(); connect(diagram, SIGNAL(showDiagram(Diagram*)), this, SLOT(showDiagram(Diagram*))); connect(diagram, SIGNAL(titleChanged(DiagramView *, const QString &)), this, SLOT(updateTabTitle(DiagramView *, const QString &))); @@ -350,8 +356,12 @@ void ProjectView::addDiagram(DiagramView *diagram, bool front) { // signal diagram was added emit(diagramAdded(diagram)); // move tab to front if wanted - if (front) - tabs_->moveTab(tabs_->count()-1, 0); + if (front) { //DiagramFolioList *ptr = dynamic_cast(diagram ->diagram())) { + //int tabCount = tabs_ -> count(); + //for (int i = 0; i < (tabCount-1) - (DiagramFolioList::folioList_quantity-1); i++) + //moveDiagramUp(diagram); + tabs_->moveTab(tabs_->count()-1, DiagramFolioList::folioList_quantity-1); + } } /** @@ -421,6 +431,7 @@ void ProjectView::removeDiagram(Diagram *diagram) { void ProjectView::showDiagram(DiagramView *diagram) { if (!diagram) return; tabs_ -> setCurrentWidget(diagram); + ; } /** diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp index c4638e9d7..7578e8d7e 100644 --- a/sources/qetdiagrameditor.cpp +++ b/sources/qetdiagrameditor.cpp @@ -652,7 +652,7 @@ bool QETDiagramEditor::newProject() { new_project -> setDefaultReportProperties(defaultReportProperties()); // add summary and new diagram - new_project -> addNewDiagramFolioList(); + //new_project -> addNewDiagramFolioList(); new_project -> addNewDiagram(); return(addProject(new_project)); @@ -1804,7 +1804,24 @@ void QETDiagramEditor::removeDiagramFromProject() { if (ProjectView *current_project = currentProject()) { if (DiagramView *current_diagram = current_project -> currentDiagram()) { can_update_actions = false; + bool isFolioList = false; + if (DiagramFolioList *ptr = dynamic_cast(current_diagram -> diagram())) + isFolioList = true; current_project -> removeDiagram(current_diagram); + if (isFolioList) { + foreach (DiagramView *diag, current_project -> diagrams()) { + if (DiagramFolioList *ptr = dynamic_cast(diag -> diagram())) { + current_project -> removeDiagram(diag); + } + } + } else if (current_project -> diagrams().size() % 58 == 0) { + foreach (DiagramView *diag, current_project -> diagrams()) { + DiagramFolioList *ptr = dynamic_cast(diag -> diagram()); + if (ptr && ptr -> getId() == DiagramFolioList::folioList_quantity-1) { + current_project -> removeDiagram(diag); + } + } + } } } } diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp index 6a0dede20..ca3409ef4 100644 --- a/sources/qetproject.cpp +++ b/sources/qetproject.cpp @@ -865,34 +865,12 @@ Diagram *QETProject::addNewDiagramFolioList() { */ void QETProject::removeDiagram(Diagram *diagram) { // ne fait rien si le projet est en lecture seule - if (isReadOnly()) return; - + if (isReadOnly()) return; if (!diagram || !diagrams_.contains(diagram)) return; - DiagramFolioList *ptr = dynamic_cast(diagram); - if (ptr) { - foreach (Diagram *diag, diagrams_) { - ptr = dynamic_cast(diag); - if (ptr) { - diagrams_.removeAll(ptr); - emit(diagramRemoved(this, ptr)); - delete ptr; - } - } - } else if (diagrams_.removeAll(diagram)) { + if (diagrams_.removeAll(diagram)) { emit(diagramRemoved(this, diagram)); delete diagram; - if (diagrams_.size() % 58 == 0) { - foreach (Diagram *diag, diagrams_) { - ptr = dynamic_cast(diag); - if (ptr && ptr -> getId() == DiagramFolioList::folioList_quantity-1) { - diagrams_.removeAll(ptr); - emit(diagramRemoved(this, ptr)); - delete ptr; - break; - } - } - } } updateDiagramsFolioData();