Extend app input planning to UI state
This commit is contained in:
@@ -280,6 +280,10 @@ struct PlanAppInputArgs {
|
||||
bool spacebar = false;
|
||||
bool vr_active = false;
|
||||
bool key_up = false;
|
||||
bool ui_visible = true;
|
||||
bool has_canvas = true;
|
||||
std::uint32_t main_child_count = 2;
|
||||
std::uint32_t panel_child_count = 4;
|
||||
bool bad_float = false;
|
||||
};
|
||||
|
||||
@@ -2071,7 +2075,7 @@ void print_help()
|
||||
<< " plan-app-startup [--run-counter N] [--auto-timelapse-disabled] [--vr-controllers-disabled] [--license-invalid]\n"
|
||||
<< " plan-app-startup-resources [--width N] [--height N] [--bad-size]\n"
|
||||
<< " plan-app-frame [--redraw] [--animate] [--no-designer-layout] [--no-main-layout] [--no-canvas] [--no-canvas-document] [--vr-active] [--ui-hidden] [--vr-only] [--resize-width N] [--resize-height N] [--bad-resize]\n"
|
||||
<< " plan-app-input --kind pointer|gesture|cancel|main|key [--x N] [--y N] [--x1 N] [--y1 N] [--prev-x N] [--prev-y N] [--prev-x1 N] [--prev-y1 N] [--zoom N] [--no-designer-layout] [--no-main-layout] [--spacebar] [--vr-active] [--key-up] [--bad-float]\n"
|
||||
<< " plan-app-input --kind pointer|gesture|cancel|main|key|ui-toggle|stylus [--x N] [--y N] [--x1 N] [--y1 N] [--prev-x N] [--prev-y N] [--prev-x1 N] [--prev-y1 N] [--zoom N] [--no-designer-layout] [--no-main-layout] [--spacebar] [--vr-active] [--key-up] [--ui-hidden] [--no-canvas] [--main-child-count N] [--panel-child-count N] [--bad-float]\n"
|
||||
<< " plan-app-shutdown\n"
|
||||
<< " plan-command-convert [--project FILE] [--output FILE] [--canvas-resolution N]\n"
|
||||
<< " plan-app-status [--doc-name NAME] [--unsaved] [--resolution N] [--resolution-index N] [--zoom N] [--history-bytes N] [--recording-running] [--encoder-available] [--encoded-frames N] [--framebuffer-fetch] [--float32] [--float32-linear] [--float16]\n"
|
||||
@@ -3960,6 +3964,28 @@ pp::foundation::Status parse_plan_app_input_args(
|
||||
args.vr_active = true;
|
||||
} else if (key == "--key-up") {
|
||||
args.key_up = true;
|
||||
} else if (key == "--ui-hidden") {
|
||||
args.ui_visible = false;
|
||||
} else if (key == "--no-canvas") {
|
||||
args.has_canvas = false;
|
||||
} else if (key == "--main-child-count") {
|
||||
if (i + 1 >= argc) {
|
||||
return pp::foundation::Status::invalid_argument("missing value for option");
|
||||
}
|
||||
const auto value = pp::foundation::parse_u32(argv[++i]);
|
||||
if (!value) {
|
||||
return value.status();
|
||||
}
|
||||
args.main_child_count = value.value();
|
||||
} else if (key == "--panel-child-count") {
|
||||
if (i + 1 >= argc) {
|
||||
return pp::foundation::Status::invalid_argument("missing value for option");
|
||||
}
|
||||
const auto value = pp::foundation::parse_u32(argv[++i]);
|
||||
if (!value) {
|
||||
return value.status();
|
||||
}
|
||||
args.panel_child_count = value.value();
|
||||
} else if (key == "--bad-float") {
|
||||
args.bad_float = true;
|
||||
} else {
|
||||
@@ -4070,6 +4096,33 @@ int plan_app_input(int argc, char** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (args.kind == "ui-toggle") {
|
||||
const auto plan = pp::app::plan_app_ui_visibility_toggle(
|
||||
args.ui_visible,
|
||||
args.has_main_layout,
|
||||
args.main_child_count,
|
||||
args.panel_child_count);
|
||||
if (!plan) {
|
||||
print_error("plan-app-input", plan.status().message);
|
||||
return 2;
|
||||
}
|
||||
std::cout << "{\"ok\":true,\"command\":\"plan-app-input\",\"kind\":\"ui-toggle\""
|
||||
<< ",\"nextUiVisible\":" << json_bool(plan.value().next_ui_visible)
|
||||
<< ",\"firstPanelChildIndex\":" << plan.value().first_panel_child_index
|
||||
<< ",\"panelChildCount\":" << plan.value().panel_child_count
|
||||
<< "}\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (args.kind == "stylus") {
|
||||
const auto plan = pp::app::plan_app_stylus_attach(args.has_canvas);
|
||||
std::cout << "{\"ok\":true,\"command\":\"plan-app-input\",\"kind\":\"stylus\""
|
||||
<< ",\"setHasStylus\":" << json_bool(plan.set_has_stylus)
|
||||
<< ",\"enableCanvasTouchLock\":" << json_bool(plan.enable_canvas_touch_lock)
|
||||
<< "}\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
print_error("plan-app-input", "unknown input plan kind");
|
||||
return 2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user