|
39 | 39 | #include <Interface/Application/Connection.h> |
40 | 40 | #include <Interface/Application/Port.h> |
41 | 41 | #include <Interface/Application/PositionProvider.h> |
42 | | -#include <Interface/Application/GuiLogger.h> |
43 | 42 | #include <Interface/Application/ModuleLogWindow.h> |
44 | 43 | #include <Interface/Application/ClosestPortFinder.h> |
45 | 44 | #include <Interface/Application/Utility.h> |
@@ -210,24 +209,21 @@ namespace |
210 | 209 | } |
211 | 210 | } |
212 | 211 |
|
213 | | -namespace |
214 | | -{ |
215 | 212 | #ifdef WIN32 |
216 | | - const int moduleWidthThreshold = 110; |
217 | | - const int extraModuleWidth = 5; |
218 | | - const int extraWidthThreshold = 5; |
219 | | - const int smushFactor = 15; |
220 | | - const int titleFontSize = 8; |
221 | | - const int widgetHeightAdjust = -20; |
| 213 | + const int ModuleWidgetDisplayBase::moduleWidthThreshold = 110; |
| 214 | + const int ModuleWidgetDisplayBase::extraModuleWidth = 5; |
| 215 | + const int ModuleWidgetDisplayBase::extraWidthThreshold = 5; |
| 216 | + const int ModuleWidgetDisplayBase::smushFactor = 15; |
| 217 | + const int ModuleWidgetDisplayBase::titleFontSize = 8; |
| 218 | + const int ModuleWidgetDisplayBase::widgetHeightAdjust = -20; |
222 | 219 | #else |
223 | | - const int moduleWidthThreshold = 80; |
224 | | - const int extraModuleWidth = 5; |
225 | | - const int extraWidthThreshold = 5; |
226 | | - const int smushFactor = 15; |
227 | | - const int titleFontSize = 12; |
228 | | - const int widgetHeightAdjust = 1; |
| 220 | + const int ModuleWidgetDisplayBase::moduleWidthThreshold = 80; |
| 221 | + const int ModuleWidgetDisplayBase::extraModuleWidth = 5; |
| 222 | + const int ModuleWidgetDisplayBase::extraWidthThreshold = 5; |
| 223 | + const int ModuleWidgetDisplayBase::smushFactor = 15; |
| 224 | + const int ModuleWidgetDisplayBase::titleFontSize = 12; |
| 225 | + const int ModuleWidgetDisplayBase::widgetHeightAdjust = 1; |
229 | 226 | #endif |
230 | | -} |
231 | 227 |
|
232 | 228 | class ModuleWidgetDisplay : public Ui::Module, public ModuleWidgetDisplayBase |
233 | 229 | { |
@@ -514,6 +510,7 @@ ModuleWidget::ModuleWidget(NetworkEditor* ed, const QString& name, ModuleHandle |
514 | 510 | connectExecuteEnds(boost::bind(&ModuleWidget::executeEnds, this)); |
515 | 511 | connect(this, SIGNAL(executeEnds()), this, SLOT(changeExecuteButtonToPlay())); |
516 | 512 | connect(this, SIGNAL(signalExecuteButtonIconChangeToStop()), this, SLOT(changeExecuteButtonToStop())); |
| 513 | + qDebug() << width() << height(); |
517 | 514 | } |
518 | 515 |
|
519 | 516 | int ModuleWidget::buildDisplay(ModuleWidgetDisplayBase* display, const QString& name) |
@@ -569,22 +566,37 @@ void ModuleWidget::resizeBasedOnModuleName(ModuleWidgetDisplayBase* display, int |
569 | 566 | int pixelWidth = display->getTitleWidth(); |
570 | 567 | //std::cout << titleLabel_->text().toStdString() << std::endl; |
571 | 568 | //std::cout << "\tPixelwidth = " << pixelWidth << std::endl; |
572 | | - int extraWidth = pixelWidth - moduleWidthThreshold; |
| 569 | + int extraWidth = pixelWidth - ModuleWidgetDisplayBase::moduleWidthThreshold; |
573 | 570 | //std::cout << "\textraWidth = " << extraWidth << std::endl; |
574 | | - if (extraWidth > extraWidthThreshold) |
| 571 | + if (extraWidth > ModuleWidgetDisplayBase::extraWidthThreshold) |
575 | 572 | { |
576 | 573 | //std::cout << "\tGROWING MODULE Current width: " << width() << std::endl; |
577 | | - frame->resize(frame->width() + extraWidth + extraModuleWidth, frame->height()); |
| 574 | + frame->resize(frame->width() + extraWidth + ModuleWidgetDisplayBase::extraModuleWidth, frame->height()); |
578 | 575 | //std::cout << "\tNew width: " << width() << std::endl; |
579 | 576 | } |
580 | 577 | else |
581 | 578 | { |
582 | 579 | //std::cout << "\tSHRINKING MODULE Current width: " << width() << std::endl; |
583 | | - frame->resize(frame->width() - smushFactor, frame->height()); |
| 580 | + frame->resize(frame->width() - ModuleWidgetDisplayBase::smushFactor, frame->height()); |
584 | 581 | //std::cout << "\tNew width: " << width() << std::endl; |
585 | 582 | } |
586 | 583 | display->adjustLayout(frame->layout()); |
587 | | - frame->resize(frame->width(), frame->height() + widgetHeightAdjust); |
| 584 | + frame->resize(frame->width(), frame->height() + ModuleWidgetDisplayBase::widgetHeightAdjust); |
| 585 | + originalSize_ = size(); |
| 586 | +} |
| 587 | + |
| 588 | +void ModuleWidget::adjustHeight(int delta) |
| 589 | +{ |
| 590 | + auto frame = widget(fullIndex_); |
| 591 | + frame->setFixedHeight(originalSize_.height() + delta); |
| 592 | + resize(currentWidget()->size()); |
| 593 | +} |
| 594 | + |
| 595 | +void ModuleWidget::adjustWidth(int delta) |
| 596 | +{ |
| 597 | + auto frame = widget(fullIndex_); |
| 598 | + frame->setFixedWidth(originalSize_.width() + delta); |
| 599 | + resize(currentWidget()->size()); |
588 | 600 | } |
589 | 601 |
|
590 | 602 | void ModuleWidget::setupDisplayConnections(ModuleWidgetDisplayBase* display) |
|
0 commit comments