summaryrefslogtreecommitdiff
path: root/MainWindow.cpp
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2020-06-29 23:14:23 +0930
committerDaniel Jones <admin@danieljon.es>2020-06-29 23:14:23 +0930
commit193fda2d270f63c127edc5b1082ef14ad12b1175 (patch)
tree8423cc822fd704f4c7b659f0ff6c9580147c4b2a /MainWindow.cpp
parent1e76ef7d2df9d49a905f416774f33fdedfcf6f34 (diff)
downloadfoxlogicgates-193fda2d270f63c127edc5b1082ef14ad12b1175.tar.gz
foxlogicgates-193fda2d270f63c127edc5b1082ef14ad12b1175.zip
further work deriving gates from Object
Diffstat (limited to 'MainWindow.cpp')
-rw-r--r--MainWindow.cpp41
1 files changed, 32 insertions, 9 deletions
diff --git a/MainWindow.cpp b/MainWindow.cpp
index 49bee5a..51a66c2 100644
--- a/MainWindow.cpp
+++ b/MainWindow.cpp
@@ -261,10 +261,18 @@ MainWindow::draw()
{
/* draw border box if multuple gates selected */
Gate *selgate;
+ // FIXME: selgate needs to be an object and such
for (auto g = selected_gates.begin(); g != selected_gates.end(); ++g)
{
- selgate = (Gate*)(*g);
- dc_image.drawHashBox(selgate->get_x(), selgate->get_y(), selgate->get_width(), selgate->get_height());
+ switch ((*g)->get_object_type())
+ {
+ case Object::GATE:
+ selgate = (Gate*)(*g);
+ dc_image.drawHashBox(selgate->get_x(), selgate->get_y(), selgate->get_width(), selgate->get_height());
+ case Object::NONE:
+ default:
+ printf("drawing objects hashbox not implemented for type\n");
+ }
}
}
@@ -345,8 +353,8 @@ MainWindow::draw()
/* update options panel */
if (selected_gate)
{
- input_1_details->setText((selected_gate->get_input_gate1() ? selected_gate->get_input_gate1()->get_output_type_text().c_str() : "(None)"));
- input_2_details->setText((selected_gate->get_input_gate2() ? selected_gate->get_input_gate2()->get_output_type_text().c_str() : "(None)"));
+ input_1_details->setText((selected_gate->get_input_gate1() ? selected_gate->get_input_gate1()->get_object_name().c_str() : "(None)"));
+ input_2_details->setText((selected_gate->get_input_gate2() ? selected_gate->get_input_gate2()->get_object_name().c_str() : "(None)"));
output_details->setText(selected_gate->get_output_state() ? "ON" : "OFF");
}
else
@@ -825,10 +833,18 @@ MainWindow::on_left_mouse_down(FXObject*, FXSelector, void *ptr)
/* clear selection if we're not clicking on a selected gate */
for (auto g = selected_gates.begin(); g != selected_gates.end(); ++g)
{
- selgate = (Gate*)(*g);
- if (gate->get_id() == selgate->get_id())
+ switch ((*g)->get_object_type())
{
- found_gate = true;
+ case Object::GATE:
+ selgate = (Gate*)(*g);
+ if (gate->get_id() == selgate->get_id())
+ {
+ found_gate = true;
+ }
+ break;
+
+ case Object::NONE:
+ break;
}
}
@@ -981,8 +997,15 @@ MainWindow::on_key_release(FXObject *sender, FXSelector sel, void *ptr)
Gate *gate;
for (auto g = selected_gates.begin(); g != selected_gates.end(); ++g)
{
- gate = (Gate*)(*g);
- remove_gate(*gate);
+ switch ((*g)->get_object_type())
+ {
+ case Object::GATE:
+ gate = (Gate*)(*g);
+ remove_gate(*gate);
+ break;
+ case Object::NONE:
+ break;
+ }
}
}