src/ldDocument.cc

changeset 883
69b8adc9a669
parent 882
2f3cc8e045d5
child 885
9c4fc9b433ae
child 888
7ad8fb667084
equal deleted inserted replaced
882:2f3cc8e045d5 883:69b8adc9a669
171 void LDDocument::setImplicit (bool const& a) 171 void LDDocument::setImplicit (bool const& a)
172 { 172 {
173 if (m_isImplicit != a) 173 if (m_isImplicit != a)
174 { 174 {
175 m_isImplicit = a; 175 m_isImplicit = a;
176 print ("Setting implicity of %1 to %2\n", this, a ? "true" : "false");
176 177
177 if (a == false) 178 if (a == false)
178 { 179 {
179 g_explicitDocuments << self().toStrongRef(); 180 g_explicitDocuments << self().toStrongRef();
180 print ("Opened %1", name()); 181 print ("Opened %1", name());
184 if (g_win != null) 185 if (g_win != null)
185 g_win->R()->compiler()->compileDocument (self()); 186 g_win->R()->compiler()->compileDocument (self());
186 } 187 }
187 else 188 else
188 { 189 {
190 print ("Removing %1 from explicit documents...\n", this);
189 g_explicitDocuments.removeOne (self().toStrongRef()); 191 g_explicitDocuments.removeOne (self().toStrongRef());
192 print ("Removed %1", this);
190 print ("Closed %1", name()); 193 print ("Closed %1", name());
191 int count = 0;
192
193 for (LDObjectWeakPtr obj : g_allObjects)
194 {
195 if (obj == null)
196 continue;
197
198 LDSubfilePtr ref = obj.toStrongRef().dynamicCast<LDSubfile>();
199
200 if (ref != null and ref->fileInfo() == self())
201 count++;
202 }
203 } 194 }
204 195
205 if (g_win != null) 196 if (g_win != null)
206 g_win->updateDocumentList(); 197 g_win->updateDocumentList();
207 198
700 LDDocumentPtr file; 691 LDDocumentPtr file;
701 QString shortName = LDDocument::shortenName (path); 692 QString shortName = LDDocument::shortenName (path);
702 693
703 for (LDDocumentWeakPtr doc : g_allDocuments) 694 for (LDDocumentWeakPtr doc : g_allDocuments)
704 { 695 {
705 if (doc.toStrongRef()->name() == shortName) 696 if (doc != null and doc.toStrongRef()->name() == shortName)
706 { 697 {
707 documentToReplace = doc; 698 documentToReplace = doc;
708 break; 699 break;
709 } 700 }
710 } 701 }
1452 if (g_explicitDocuments.size() == 2 and 1443 if (g_explicitDocuments.size() == 2 and
1453 g_explicitDocuments[0]->name().isEmpty() and 1444 g_explicitDocuments[0]->name().isEmpty() and
1454 not g_explicitDocuments[1]->name().isEmpty() and 1445 not g_explicitDocuments[1]->name().isEmpty() and
1455 not g_explicitDocuments[0]->hasUnsavedChanges()) 1446 not g_explicitDocuments[0]->hasUnsavedChanges())
1456 { 1447 {
1457 g_explicitDocuments[0]->dismiss(); 1448 LDDocumentPtr filetoclose = g_explicitDocuments.first();
1449 filetoclose->dismiss();
1458 } 1450 }
1459 } 1451 }
1460 1452
1461 // ============================================================================= 1453 // =============================================================================
1462 // 1454 //

mercurial