From 4399221be98064d075f92f9c9a0b4cbbcc9f4775 Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Fri, 26 Jun 2020 22:22:46 +0930 Subject: canvas can be scrolled now --- MainWindow.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/MainWindow.cpp b/MainWindow.cpp index 77a3b3d..eaf1286 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -12,6 +12,8 @@ #include "MainWindow.h" #include "FXMessageBox.h" +#include "FXScrollArea.h" +#include "FXScrollBar.h" #include "fxdefs.h" #include #include @@ -82,12 +84,13 @@ MainWindow::create_ui() new FXLabel(canvasFrame,"foxlogicgates", NULL, JUSTIFY_CENTER_X|LAYOUT_FILL_X); new FXHorizontalSeparator(canvasFrame, SEPARATOR_GROOVE|LAYOUT_FILL_X); - scroll_area = new FXScrollWindow(canvasFrame, FX::SCROLLERS_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN); + scroll_area = new FXScrollWindow(canvasFrame, FX::SCROLLERS_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_Y); scroll_area->setBackColor(canvasFrame->getBackColor()); - canvas = new FXCanvas(scroll_area, this, ID_CANVAS, FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_ROW|LAYOUT_FILL_COLUMN); - - canvas_image = new FXBMPImage(app, NULL, 0, 5000, 5000); + FXPacker *canvas_packer = new FXPacker(scroll_area, LAYOUT_FILL_X|LAYOUT_FILL_Y); + canvas_packer->setBackColor(scroll_area->getBackColor()); + canvas = new FXCanvas(canvas_packer, this, ID_CANVAS, LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT|FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 2048, 2048); + canvas_image = new FXBMPImage(app, NULL, 0, 2048, 2048); new FXLabel(toolsFrame, "Toolbox", NULL, JUSTIFY_CENTER_X|LAYOUT_FILL_X); new FXHorizontalSeparator(toolsFrame, SEPARATOR_RIDGE|LAYOUT_FILL_X); @@ -269,7 +272,7 @@ MainWindow::draw() continue; Gate *in_gate1 = gate1->get_input_gate1(); Gate *in_gate2 = gate1->get_input_gate2(); - if (gate1->get_input_gate1() != nullptr) + if (in_gate1 != nullptr) { if (in_gate1 == selected_input.gate) { @@ -291,7 +294,7 @@ MainWindow::draw() dc_image.setForeground(FXRGB(0, 0, 0)); } } - if (gate1->get_input_gate2() != nullptr) + if (in_gate2 != nullptr) { if (in_gate2 == selected_input.gate) { -- cgit v1.2.3