diff --git a/ui/frame.cpp b/ui/frame.cpp index e7665a8..2c84730 100644 --- a/ui/frame.cpp +++ b/ui/frame.cpp @@ -37,7 +37,13 @@ static int INJECTED_PREVIEW_FUNC(CHiPubNode *preview) { CHiValue *val = CHi_Crawl(&preview->sinks[0]); if(val->type == CUTIHI_VAL_SAMPLE && val->data.sample) { - globaldis->viewer->SetImage(val->data.sample); + float t = CHi_Time_Get(preview->ng); + globaldis->CallAfter([=](){ + globaldis->viewer->SetImage(val->data.sample); + globaldis->timeline->Refresh(); + + globaldis->stba->SetStatusText(wxString::Format("%02i:%02i:%06.03fs", (int) (t / 3600), (int) (t / 60), fmodf(t, 60))); + }); } return 1; @@ -301,21 +307,6 @@ Frame::Frame() : wxFrame(NULL, wxID_ANY, "Cuticle", wxDefaultPosition, {wxSystem } else { CHi_BeginCompilation(graph->backendNG); toolbar.btnPerform->SetLabel("Kill"); - - std::thread{[=](){ - while(graph->backendNG->compilationStatus == CUTIHI_COMP_RUNNING) { - CallAfter([=](){ - float t = CHi_Time_Get(graph->backendNG); - stba->SetStatusText(wxString::Format("%02i:%02i:%06.03fs", (int) (t / 3600), (int) (t / 60), fmodf(t, 60))); - }); - - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - - CallAfter([=](){ - stba->SetStatusText("Compilation has ended."); - }); - }}.detach(); } }); @@ -412,6 +403,9 @@ void Frame::LoadProject(std::string filename) { auto tlba = ((Frame*) ng->ud)->tlba; tlba->EnableTool(wxID_SAVE, true); tlba->EnableTool(wxID_OPEN, true); + + auto stba = ((Frame*) ng->ud)->stba; + stba->SetStatusText("Compilation has ended."); }); };