src/mainWindow.cc

changeset 784
f82ab4d3c7b4
parent 776
624131d0163d
child 786
71d786ce0dcc
equal deleted inserted replaced
783:1db20d88650f 784:f82ab4d3c7b4
722 } 722 }
723 } 723 }
724 724
725 // ============================================================================= 725 // =============================================================================
726 // 726 //
727 bool MainWindow::save (LDDocument* doc, bool saveAs) 727 bool MainWindow::save (LDDocumentPtr doc, bool saveAs)
728 { 728 {
729 String path = doc->fullPath(); 729 String path = doc->fullPath();
730 730
731 if (saveAs || path.isEmpty()) 731 if (saveAs || path.isEmpty())
732 { 732 {
887 m_updatingTabs = true; 887 m_updatingTabs = true;
888 888
889 while (m_tabs->count() > 0) 889 while (m_tabs->count() > 0)
890 m_tabs->removeTab (0); 890 m_tabs->removeTab (0);
891 891
892 for (LDDocument* f : g_loadedFiles) 892 for (LDDocumentPtr f : LDDocument::explicitDocuments())
893 { 893 {
894 // Don't list implicit files unless explicitly desired.
895 if (f->isImplicit() && not cfg::listImplicitFiles)
896 continue;
897
898 // Add an item to the list for this file and store the tab index 894 // Add an item to the list for this file and store the tab index
899 // in the document so we can find documents by tab index. 895 // in the document so we can find documents by tab index.
900 f->setTabIndex (m_tabs->addTab ("")); 896 f->setTabIndex (m_tabs->addTab (""));
901 updateDocumentListItem (f); 897 updateDocumentListItem (f);
902 } 898 }
904 m_updatingTabs = false; 900 m_updatingTabs = false;
905 } 901 }
906 902
907 // ============================================================================= 903 // =============================================================================
908 // 904 //
909 void MainWindow::updateDocumentListItem (LDDocument* doc) 905 void MainWindow::updateDocumentListItem (LDDocumentPtr doc)
910 { 906 {
911 bool oldUpdatingTabs = m_updatingTabs; 907 bool oldUpdatingTabs = m_updatingTabs;
912 m_updatingTabs = true; 908 m_updatingTabs = true;
913 909
914 if (doc->tabIndex() == -1) 910 if (doc->tabIndex() == -1)
939 void MainWindow::changeCurrentFile() 935 void MainWindow::changeCurrentFile()
940 { 936 {
941 if (m_updatingTabs) 937 if (m_updatingTabs)
942 return; 938 return;
943 939
944 LDDocument* f = null; 940 LDDocumentPtr f;
945 int tabIndex = m_tabs->currentIndex(); 941 int tabIndex = m_tabs->currentIndex();
946 942
947 // Find the file pointer of the item that was selected. 943 // Find the file pointer of the item that was selected.
948 for (LDDocument* it : g_loadedFiles) 944 for (LDDocumentPtr it : LDDocument::explicitDocuments())
949 { 945 {
950 if (it->tabIndex() == tabIndex) 946 if (it->tabIndex() == tabIndex)
951 { 947 {
952 f = it; 948 f = it;
953 break; 949 break;
966 // 962 //
967 void MainWindow::refreshObjectList() 963 void MainWindow::refreshObjectList()
968 { 964 {
969 #if 0 965 #if 0
970 ui->objectList->clear(); 966 ui->objectList->clear();
971 LDDocument* f = getCurrentDocument(); 967 LDDocumentPtr f = getCurrentDocument();
972 968
973 for (LDObjectPtr obj : *f) 969 for (LDObjectPtr obj : *f)
974 ui->objectList->addItem (obj->qObjListEntry); 970 ui->objectList->addItem (obj->qObjListEntry);
975 971
976 #endif 972 #endif

mercurial