@@ -355,7 +355,11 @@ InterSpec::InterSpec( WContainerWidget *parent )
355355 m_warningsWindow( 0 ),
356356 m_fileManager( 0 ),
357357 m_layout( 0 ),
358+ #if ( USE_FLEX_CHART_LAYOUT )
359+ m_chartsDiv ( nullptr ),
360+ #else
358361 m_chartsLayout ( 0 ),
362+ #endif
359363 m_toolsLayout ( 0 ),
360364 m_menuDiv( 0 ),
361365 m_peakInfoDisplay( 0 ),
@@ -526,14 +530,44 @@ InterSpec::InterSpec( WContainerWidget *parent )
526530
527531 m_peakModel = new PeakModel ( this );
528532#if ( USE_SPECTRUM_CHART_D3 )
533+
534+ #if ( USE_FLEX_CHART_LAYOUT )
535+ m_chartsDiv = new WContainerWidget ();
536+ m_chartsDiv->addStyleClass ( " ChartsDiv" );
537+
538+ /*
539+ //If flex layout is used, need to add at least the below to the CSS
540+ .ChartsDiv
541+ {
542+ display: flex;
543+ flex-direction: column;
544+ flex-wrap: nowrap;
545+ }
546+
547+ .ChartsDiv > .SpectrumDisplayDiv {
548+ flex-grow: 3;
549+ overflow: hidden;
550+ }
551+
552+ .ChartsDiv > .D3TimeChartParent {
553+ flex-grow: 2;
554+ overflow: hidden;
555+ }
556+
557+ */
558+
559+ m_spectrum = new D3SpectrumDisplayDiv (m_chartsDiv);
560+ m_timeSeries = new D3TimeChart (m_chartsDiv);
561+ #else
529562 m_spectrum = new D3SpectrumDisplayDiv ();
563+ m_timeSeries = new D3TimeChart ();
564+ #endif
565+
530566 m_peakModel->dataChanged ().connect ( m_spectrum, &D3SpectrumDisplayDiv::scheduleForegroundPeakRedraw );
531567 m_peakModel->rowsRemoved ().connect ( m_spectrum, &D3SpectrumDisplayDiv::scheduleForegroundPeakRedraw );
532568 m_peakModel->rowsInserted ().connect ( m_spectrum, &D3SpectrumDisplayDiv::scheduleForegroundPeakRedraw );
533569 m_peakModel->layoutChanged ().connect ( m_spectrum, &D3SpectrumDisplayDiv::scheduleForegroundPeakRedraw );
534570 m_peakModel->modelReset ().connect ( m_spectrum, &D3SpectrumDisplayDiv::scheduleForegroundPeakRedraw );
535-
536- m_timeSeries = new D3TimeChart ();
537571#else
538572 m_spectrum = new SpectrumDisplayDiv ();
539573 m_spectrum->setPlotAreaPadding ( 80 , 2 , 10 , 44 );
@@ -768,8 +802,13 @@ InterSpec::InterSpec( WContainerWidget *parent )
768802
769803 if ( m_menuDiv )
770804 m_layout->addWidget ( m_menuDiv, m_layout->rowCount (), 0 );
805+
806+ #if ( USE_FLEX_CHART_LAYOUT )
807+ m_layout->addWidget ( m_chartsDiv, m_layout->rowCount (), 0 );
808+ #else
771809 m_layout->addWidget ( m_spectrum, m_layout->rowCount (), 0 );
772810 m_layout->addWidget ( m_timeSeries, m_layout->rowCount (), 0 );
811+ #endif
773812
774813#if ( USE_SPECTRUM_CHART_D3 )
775814 // No need to updated the default axis titles
@@ -780,6 +819,7 @@ InterSpec::InterSpec( WContainerWidget *parent )
780819 m_timeSeries->chartDragged ().connect ( this , &InterSpec::timeChartDragged );
781820 m_timeSeries->chartClicked ().connect ( this , &InterSpec::timeChartClicked );
782821#else
822+
783823 m_timeSeries->enableLegend ( false );
784824 m_timeSeries->showHistogramIntegralsInLegend ( false );
785825 m_timeSeries->setMouseDragHighlights ( true , true );
@@ -5534,8 +5574,13 @@ void InterSpec::setToolTabsVisible( bool showToolTabs )
55345574 { // We are showing the tool tabs
55355575 if ( m_menuDiv )
55365576 m_layout->removeWidget ( m_menuDiv );
5577+
5578+ #if ( USE_FLEX_CHART_LAYOUT )
5579+ m_layout->removeWidget ( m_chartsDiv );
5580+ #else
55375581 m_layout->removeWidget ( m_spectrum );
55385582 m_layout->removeWidget ( m_timeSeries );
5583+ #endif
55395584 m_layout->clear ();
55405585
55415586 // We have to completely replace m_layout or else the vertical spacing
@@ -5623,7 +5668,9 @@ void InterSpec::setToolTabsVisible( bool showToolTabs )
56235668
56245669 m_energyCalTool->setWideLayout ();
56255670 m_toolsTabs->addTab ( m_energyCalTool, CalibrationTabTitle, TabLoadPolicy );
5626-
5671+
5672+ #if ( USE_FLEX_CHART_LAYOUT )
5673+ #else
56275674 m_chartsLayout = new WGridLayout ();
56285675 m_chartsLayout->setContentsMargins ( 0 , 0 , 0 , 0 );
56295676 m_chartsLayout->setHorizontalSpacing ( 0 );
@@ -5635,11 +5682,12 @@ void InterSpec::setToolTabsVisible( bool showToolTabs )
56355682 m_chartsLayout->setVerticalSpacing ( 0 );
56365683 }else
56375684 {
5638- m_chartsLayout->setRowStretch ( 0 , 3 );
5685+ m_chartsLayout->setRowStretch ( 0 , 20 );
56395686 m_chartsLayout->setRowStretch ( 1 , 2 );
56405687 m_chartsLayout->setRowResizable ( 0 );
56415688 m_chartsLayout->setVerticalSpacing ( layoutVertSpacing );
56425689 }
5690+ #endif
56435691
56445692 m_toolsLayout = new WGridLayout ();
56455693 m_toolsLayout->setContentsMargins ( 0 , 0 , 0 , 0 );
@@ -5650,7 +5698,13 @@ void InterSpec::setToolTabsVisible( bool showToolTabs )
56505698 int row = 0 ;
56515699 if ( m_menuDiv )
56525700 m_layout->addWidget ( m_menuDiv, row++, 0 );
5701+
5702+ #if ( USE_FLEX_CHART_LAYOUT )
5703+ m_layout->addWidget ( m_chartsDiv, row, 0 );
5704+ #else
56535705 m_layout->addLayout ( m_chartsLayout, row, 0 );
5706+ #endif
5707+
56545708 m_layout->setRowResizable ( row, true );
56555709 m_layout->setRowStretch ( row, 5 );
56565710
@@ -5706,8 +5760,13 @@ void InterSpec::setToolTabsVisible( bool showToolTabs )
57065760 }else
57075761 {
57085762 // We are hidding the tool tabs
5763+ #if ( USE_FLEX_CHART_LAYOUT )
5764+ m_layout->removeWidget ( m_chartsDiv );
5765+ #else
57095766 m_chartsLayout->removeWidget ( m_spectrum );
57105767 m_chartsLayout->removeWidget ( m_timeSeries );
5768+ m_chartsLayout = nullptr ;
5769+ #endif
57115770
57125771 if ( m_menuDiv )
57135772 m_layout->removeWidget ( m_menuDiv );
@@ -5724,7 +5783,7 @@ void InterSpec::setToolTabsVisible( bool showToolTabs )
57245783 m_referencePhotopeakLines->clearAllLines ();
57255784
57265785 m_toolsTabs = nullptr ;
5727- m_chartsLayout = nullptr ;
5786+
57285787 if ( !m_referencePhotopeakLinesWindow )
57295788 m_referencePhotopeakLines = nullptr ;
57305789 m_toolsLayout = nullptr ;
@@ -8247,12 +8306,12 @@ void InterSpec::timeChartDragged( const int sample_start_in, const int sample_en
82478306 action = ActionType::AddSamples;
82488307 else if ( modifiers.testFlag (KeyboardModifier::ControlModifier) )
82498308 action = ActionType::RemoveSamples;
8250- // else if( modifiers.testFlag(KeyboardModifier::MetaModifier) )//Meta key pressed ("Windows" or "Command" (Mac) key)
8251- // action = ...;
82528309
8253- const auto type = modifiers.testFlag (KeyboardModifier::AltModifier)
8254- ? SpecUtils::SpectrumType::Background
8255- : SpecUtils::SpectrumType::Foreground;
8310+ SpecUtils::SpectrumType type = SpecUtils::SpectrumType::Foreground;
8311+ if ( modifiers.testFlag (KeyboardModifier::AltModifier) )
8312+ type = SpecUtils::SpectrumType::Background;
8313+ else if ( modifiers.testFlag (KeyboardModifier::MetaModifier) )
8314+ type = SpecUtils::SpectrumType::SecondForeground;
82568315
82578316 const int sample_start = std::min ( sample_start_in, sample_end_in );
82588317 const int sample_end = std::max ( sample_start_in, sample_end_in );
@@ -10658,6 +10717,8 @@ vector<pair<float,int> > InterSpec::passthroughTimeToSampleNumber() const
1065810717
1065910718void InterSpec::setChartSpacing ()
1066010719{
10720+ #if ( USE_FLEX_CHART_LAYOUT )
10721+ #else
1066110722 const int vertSpacing = (m_timeSeries->isHidden () ? 0 : (isMobile () ? 10 : 5 ));
1066210723
1066310724 // Changing the vertical space doesnt seem to reliably trigger in Wt 3.3.4
@@ -10686,7 +10747,7 @@ void InterSpec::setChartSpacing()
1068610747 m_chartsLayout->setVerticalSpacing ( vertSpacing );
1068710748 m_chartsLayout->addWidget ( m_spectrum, 0 , 0 );
1068810749 m_chartsLayout->addWidget ( m_timeSeries, 1 , 0 );
10689- m_chartsLayout->setRowStretch ( 0 , 3 );
10750+ m_chartsLayout->setRowStretch ( 0 , 20 );
1069010751 m_chartsLayout->setRowStretch ( 1 , 2 );
1069110752 m_chartsLayout->setRowResizable ( 0 );
1069210753
@@ -10726,7 +10787,7 @@ void InterSpec::setChartSpacing()
1072610787 {
1072710788 m_spectrum->setMargin ( 0 , Wt::Top );
1072810789 }
10729-
10790+ # endif
1073010791}// void setChartSpacing()
1073110792
1073210793
0 commit comments