From 0b0ebd297afbd0ed302ae7b0eff25b916e3e80c2 Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Wed, 24 Jun 2020 23:53:33 +0930 Subject: logic: for gates with only a single input, allow link selection on either input --- MainWindow.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'MainWindow.cpp') diff --git a/MainWindow.cpp b/MainWindow.cpp index 8b22243..c7456ce 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -429,6 +429,14 @@ MainWindow::find_selected_input(int x, int y) { input_gate = selected_gate->get_input_gate2(); } + else + { + /* special check for gates with only one input */ + if (selected_gate->get_gate_type() == Gate::NOT || selected_gate->get_gate_type() == Gate::OUTPUT) + { + input_gate = selected_gate->get_input_gate1(); + } + } break; } @@ -625,20 +633,6 @@ MainWindow::on_key_release(FXObject *sender, FXSelector sel, void *ptr) } else if (selected_gate) { - /* delete gate and all associations */ - /* - * 2 inputs - * x outputs - * - * inputs: - * if input1/2 != null: - * call their remove_gate_id with this gate id - * update that gate - * outputs: - * iterate through ouputs - * call remove_input_gate with this gate id - * update that gate - */ Gate *gate; /* delete inputs */ if (selected_gate->get_input_gate1()) -- cgit v1.2.3