Mercurial > hg > dmlib
diff edmain.cpp @ 401:2fdf440ea66a
Fix some segfaults, etc.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 19 Oct 2012 16:28:06 +0300 |
parents | f44a89a25c97 |
children | 0f290af63fc1 |
line wrap: on
line diff
--- a/edmain.cpp Fri Oct 19 15:56:59 2012 +0300 +++ b/edmain.cpp Fri Oct 19 16:28:06 2012 +0300 @@ -100,7 +100,6 @@ setWindowTitle(QCoreApplication::applicationName()); memset(&engine, 0, sizeof(engine)); - changed = FALSE; initSDL = FALSE; currTimeline = NULL; @@ -207,17 +206,9 @@ // Setup GUI elements createMainGUI(); - createNewFile(); - DMTimelineTrack *tr = NULL; - dmTimelineAddTrack(currTimeline->tl, &tr, "Penis"); - dmTimelineAddTrack(currTimeline->tl, &tr, "Cyrbe"); - dmTimelineAddTrack(currTimeline->tl, &tr, "Pasci"); - dmTimelineAddTrack(currTimeline->tl, &tr, "Lol"); - +// createNewFile(); timelineView->setTimeline(currTimeline); - settingsRestore(); - initEffectsAndResources(); statusMsg("Application started."); } @@ -377,7 +368,6 @@ update(); historyReset(); - changed = false; updateMenuStates(); } @@ -402,7 +392,6 @@ update(); historyReset(); - changed = false; updateMenuStates(); } } @@ -445,7 +434,9 @@ // void DemoEditor::historyReset() { - changed = false; + if (currTimeline != NULL) + currTimeline->scrub(); + undoHistoryPos = -1; undoHistoryMax = DOC_UNDO_MAX; undoHistory.clear(); @@ -454,7 +445,10 @@ void DemoEditor::historyPush(QString description) { - if (!undoHistory.isEmpty() && undoHistory.last()->state == "-") + if (currTimeline == NULL) + return; + + if (!undoHistory.isEmpty() && undoHistory.last()->state() == "-") { delete undoHistory.takeLast(); } @@ -465,19 +459,22 @@ } TimelineObject *copy = new TimelineObject(currTimeline); - copy->state = description; + copy->setState(description); undoHistory.append(copy); } void DemoEditor::historyTop() { + if (currTimeline == NULL) + return; + TimelineObject *copy = new TimelineObject(currTimeline); - copy->state = "-"; + copy->setState("-"); undoHistory.append(copy); undoHistoryPos = undoHistory.size() - 1; - changed = true; + currTimeline->touch(); updateMenuStates(); update(); } @@ -499,7 +496,7 @@ undoHistoryPos++; delete currTimeline; currTimeline = new TimelineObject(undoHistory.at(undoHistoryPos)); - changed = true; + currTimeline->touch(); updateMenuStates(); update(); @@ -514,7 +511,7 @@ undoHistoryPos--; delete currTimeline; currTimeline = new TimelineObject(undoHistory.at(undoHistoryPos)); - changed = true; + currTimeline->touch(); updateMenuStates(); update();