src/file.cpp

changeset 522
afa691788bdb
parent 519
63135a8abd41
child 527
47c068f2e7e3
equal deleted inserted replaced
521:b85554206155 522:afa691788bdb
362 362
363 if (numWarnings) 363 if (numWarnings)
364 *numWarnings = 0; 364 *numWarnings = 0;
365 365
366 // Calculate the amount of lines 366 // Calculate the amount of lines
367 for (str line : *f) 367 for (str line : *f)
368 lines << line; 368 lines << line;
369 369
370 f->rewind(); 370 f->rewind();
371 371
372 FileLoader* loader = new FileLoader; 372 FileLoader* loader = new FileLoader;
1105 1105
1106 m_curfile = f; 1106 m_curfile = f;
1107 1107
1108 if (g_win && f) 1108 if (g_win && f)
1109 { // A ton of stuff needs to be updated 1109 { // A ton of stuff needs to be updated
1110 g_win->clearSelection();
1111 g_win->updateFileListItem (f); 1110 g_win->updateFileListItem (f);
1112 g_win->buildObjList(); 1111 g_win->buildObjList();
1113 g_win->updateTitle(); 1112 g_win->updateTitle();
1114 g_win->R()->setFile (f); 1113 g_win->R()->setFile (f);
1115 g_win->R()->resetAngles(); 1114 g_win->R()->resetAngles();
1122 // ============================================================================= 1121 // =============================================================================
1123 // ----------------------------------------------------------------------------- 1122 // -----------------------------------------------------------------------------
1124 int LDFile::countExplicitFiles() 1123 int LDFile::countExplicitFiles()
1125 { int count = 0; 1124 { int count = 0;
1126 1125
1127 for (LDFile * f : g_loadedFiles) 1126 for (LDFile* f : g_loadedFiles)
1128 if (f->implicit() == false) 1127 if (f->implicit() == false)
1129 count++; 1128 count++;
1130 1129
1131 return count; 1130 return count;
1132 } 1131 }
1153 delete g_logoedStud2; 1152 delete g_logoedStud2;
1154 1153
1155 g_logoedStud = openDATFile ("stud-logo.dat", true); 1154 g_logoedStud = openDATFile ("stud-logo.dat", true);
1156 g_logoedStud2 = openDATFile ("stud2-logo.dat", true); 1155 g_logoedStud2 = openDATFile ("stud2-logo.dat", true);
1157 } 1156 }
1157
1158 // =============================================================================
1159 // -----------------------------------------------------------------------------
1160 void LDFile::addToSelection (LDObject* obj) // [protected]
1161 { if (obj->selected())
1162 return;
1163
1164 assert (obj->file() == this);
1165 m_sel << obj;
1166 obj->setSelected (true);
1167 }
1168
1169 // =============================================================================
1170 // -----------------------------------------------------------------------------
1171 void LDFile::removeFromSelection (LDObject* obj) // [protected]
1172 { if (!obj->selected())
1173 return;
1174
1175 assert (obj->file() == this);
1176 m_sel.removeOne (obj);
1177 obj->setSelected (false);
1178 }
1179
1180 // =============================================================================
1181 // -----------------------------------------------------------------------------
1182 void LDFile::clearSelection()
1183 { for (LDObject* obj : m_sel)
1184 removeFromSelection (obj);
1185
1186 assert (m_sel.isEmpty());
1187 }
1188
1189 // =============================================================================
1190 // -----------------------------------------------------------------------------
1191 const QList<LDObject*>& LDFile::selection() const
1192 { return m_sel;
1193 }

mercurial