summaryrefslogtreecommitdiff
path: root/MainWindow.cpp
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2020-06-24 23:53:33 +0930
committerDaniel Jones <admin@danieljon.es>2020-06-24 23:53:33 +0930
commit0b0ebd297afbd0ed302ae7b0eff25b916e3e80c2 (patch)
tree05c91a832e3e19fea6c22bf746311b4010978009 /MainWindow.cpp
parent91aff1783d364f3f2c814a90ec292cb89d5deb88 (diff)
downloadfoxlogicgates-0b0ebd297afbd0ed302ae7b0eff25b916e3e80c2.tar.gz
foxlogicgates-0b0ebd297afbd0ed302ae7b0eff25b916e3e80c2.zip
logic: for gates with only a single input, allow link selection on either input
Diffstat (limited to 'MainWindow.cpp')
-rw-r--r--MainWindow.cpp22
1 files changed, 8 insertions, 14 deletions
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())