feat(gui): compact track creation and make the inspector optional (phase 80)
This commit is contained in:
parent
9e380d4dd0
commit
e9d783146f
4 changed files with 198 additions and 41 deletions
|
|
@ -21,6 +21,7 @@
|
|||
#include <FL/Fl_Button.H>
|
||||
#include <FL/Fl_Group.H>
|
||||
#include <FL/Fl_Menu_Bar.H>
|
||||
#include <FL/Fl_Menu_Button.H>
|
||||
#include <FL/Fl_Tabs.H>
|
||||
#include <chrono>
|
||||
#include <cstdio>
|
||||
|
|
@ -342,7 +343,7 @@ int main(int argc, char **argv)
|
|||
CHECK(sequence != nullptr);
|
||||
char directory[] = "/tmp/xtc-gui-XXXXXX"; CHECK(mkdtemp(directory) != nullptr);
|
||||
std::string filename = std::string(directory) + "/song.xtc";
|
||||
press(find(&window, "Add track")); press(find(&window, "Add region"));
|
||||
auto *creation=dynamic_cast<Fl_Menu_Button *>(find(&window,"Create")); CHECK(creation); if(creation)creation->picked(creation->find_item("Empty track")); press(find(&window, "Add region"));
|
||||
size_t track_count, clip_count;
|
||||
CHECK(xtc_project_get_counts(sequence->project(), &track_count, &clip_count) == XTC_OK && track_count == 1 && clip_count == 1);
|
||||
xtc_clip_info region{};
|
||||
|
|
@ -957,10 +958,12 @@ int main(int argc, char **argv)
|
|||
MainWindow window(false,""); window.show();
|
||||
auto *sequence = timeline(&window);
|
||||
CHECK(sequence != nullptr);
|
||||
auto *midi = find(&window,"New MIDI track");
|
||||
auto *audio = find(&window,"New audio track");
|
||||
CHECK(midi && audio && find(&window,"Import WAV") && find(&window,"Edit MIDI notes"));
|
||||
press(midi);
|
||||
auto *create=dynamic_cast<Fl_Menu_Button *>(find(&window,"Create"));
|
||||
CHECK(create && create->find_item("New MIDI track") && create->find_item("Import WAV"));
|
||||
CHECK(sequence->x()<100);
|
||||
window.show_track_inspector(true);CHECK(sequence->x()>200);
|
||||
window.show_track_inspector(false);CHECK(sequence->x()<100);
|
||||
create->picked(create->find_item("New MIDI track"));
|
||||
size_t tracks = 0, clips = 0;
|
||||
xtc_project_get_counts(sequence->project(),&tracks,&clips);
|
||||
CHECK(tracks == 1 && clips == 1);
|
||||
|
|
@ -973,7 +976,7 @@ int main(int argc, char **argv)
|
|||
CHECK(window.undo(true) == XTC_OK);
|
||||
CHECK(sequence->select(track,clip)); pump();
|
||||
CHECK(contains(&window,"MIDI track"));
|
||||
press(audio);
|
||||
create->picked(create->find_item("New audio track"));
|
||||
xtc_project_get_counts(sequence->project(),&tracks,&clips); CHECK(tracks == 2 && clips == 1);
|
||||
const xtc_project *before = sequence->project();
|
||||
reserve_result = XTC_ERR_OUT_OF_MEMORY;
|
||||
|
|
@ -984,9 +987,9 @@ int main(int argc, char **argv)
|
|||
// Exercise the supported minimum and a larger workspace with real layout.
|
||||
for (auto size : {std::pair<int,int>{1220,720},{1600,1000}}) {
|
||||
window.resize(window.x(),window.y(),size.first,size.second); pump();
|
||||
CHECK(midi->x() >= 0 && midi->x()+midi->w() <= sequence->parent()->x());
|
||||
CHECK(create->x() >= 0 && create->x()+create->w() <= window.w());
|
||||
CHECK(sequence->parent()->x()+sequence->parent()->w() <= window.w());
|
||||
CHECK(find(&window,"Play")->visible_r() && midi->visible_r());
|
||||
CHECK(find(&window,"Play")->visible_r() && create->visible_r());
|
||||
}
|
||||
CHECK(window.save_project("/tmp/xtc-workspace.xtc") == XTC_OK);
|
||||
CHECK(window.new_project() == XTC_OK && window.open_project("/tmp/xtc-workspace.xtc") == XTC_OK);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue