Skip to content

Commit

Permalink
Add vertical mode on phones.
Browse files Browse the repository at this point in the history
Make so turning phone vertically, gives about the same as the desktop interface; e.g., with the tool tabs visible.
Some other tools have been converted to be laid out okay, but a number more of them need work.
  • Loading branch information
wcjohns committed Aug 14, 2024
1 parent 1ca8e1c commit 3f22b3a
Show file tree
Hide file tree
Showing 41 changed files with 1,300 additions and 215 deletions.
16 changes: 12 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ option(
option(
PERFORM_DEVELOPER_CHECKS
"Performs additional computationally expensive tests during execution"
off
OFF
)
option(
USE_OSX_NATIVE_MENU
"Mirrors WMenus with OSX native NSMenu (not fully implemented)"
off
OFF
)


Expand Down Expand Up @@ -591,9 +591,9 @@ set(SpecUtils_NO_BOOST_LIB OFF

if( APPLE OR ANDROID )
set(SpecUtils_USE_WT_THREADPOOL OFF CACHE BOOL "")
else( APPLE or ANDROID )
else( APPLE OR ANDROID )
set(SpecUtils_USE_WT_THREADPOOL ON CACHE BOOL "")
endif( APPLE or ANDROID )
endif( APPLE OR ANDROID )
set(SpecUtils_EXTERNALLY_DEFINED_LOG_MESSAGE ON CACHE BOOL "")
set(SpecUtils_BUILD_UNIT_TESTS OFF CACHE BOOL "")
set(SpecUtils_BUILD_REGRESSION_TEST OFF CACHE BOOL "")
Expand Down Expand Up @@ -625,6 +625,14 @@ endif()
set_target_properties(InterSpecLib PROPERTIES PREFIX "")
set_target_properties(InterSpecLib PROPERTIES OUTPUT_NAME "InterSpec")

# Turn off some compiler warnings
target_compile_options(InterSpecLib PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wno-inconsistent-missing-override> # Turn off a bunch of warnings like: WTreeView:399:20: warning: 'headerWidget' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
$<$<CXX_COMPILER_ID:MSVC>:
>)


target_link_libraries(
InterSpecLib
PUBLIC
Expand Down
16 changes: 13 additions & 3 deletions InterSpec/InterSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,13 @@ class InterSpec : public Wt::WContainerWidget
void setToolTabsVisible( bool show );
bool toolTabsVisible() const;

#if( InterSpec_PHONE_ROTATE_FOR_TABS )
/** Function called when user changes the tool tab height.
We will remember this, so we can set it back
*/
void toolTabContentHeightChanged( int height );
#endif

/** Makes a MakeDrf Window and returns it, or if one was already present, returns it. */
MakeDrfWindow *showMakeDrfWindow();
/** Returns the pointer to current MakeDrf Window. Will by nullptr if not currently showing */
Expand Down Expand Up @@ -919,6 +926,8 @@ class InterSpec : public Wt::WContainerWidget
spectrum file contains any images.
*/
void checkEnableViewImageMenuItem();

void createFileParameterWindow( const SpecUtils::SpectrumType type );
protected:

//doFinishupSetSpectrumWork(...): intended to do things like calculate the
Expand All @@ -933,8 +942,6 @@ class InterSpec : public Wt::WContainerWidget
void doFinishupSetSpectrumWork( std::shared_ptr<SpecMeas> meas,
std::vector<boost::function<void(void)> > workers );

void createFileParameterWindow();

#if( USE_DETECTION_LIMIT_TOOL )
void fitNewPeakNotInRoiFromRightClick();
void startAddPeakFromRightClick();
Expand Down Expand Up @@ -1343,13 +1350,16 @@ class InterSpec : public Wt::WContainerWidget
//m_currentToolsTab: used to track which tab is currently showing when the
// tools tab is shown. This variable is necessary so that handleToolTabChanged(...)
// can know what tab is being changed from, and not just what tab is being
// changed to. In everyother function this variable will always be up to
// changed to. In every other function this variable will always be up to
// date when in tool tabs are shown.
int m_currentToolsTab;

//m_toolsTabs: will be null when not tool tabs are hidden, and non-null in
// when they are visible
Wt::WTabWidget *m_toolsTabs;
#if( InterSpec_PHONE_ROTATE_FOR_TABS )
int m_toolsTabsContentHeight;
#endif

EnergyCalTool *m_energyCalTool;
AuxWindow *m_energyCalWindow;
Expand Down
9 changes: 2 additions & 7 deletions InterSpec/InterSpec_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,12 @@ void log_developer_error( const char *location, const char *error );
// Ex, "9-Sep-2014 15:02:15"
#define DATE_TIME_FORMAT_STR "d-MMM-yyyy hh:mm:ss"

/** Define a number of channels where if the spectrum has more than this, we'll assume this is high-resolution.

TODO: should instead define an average keV per channel for this purpose. Some limited energy
range HPGe detectors may only have 4096 channels.
*/
#define HIGH_RES_NUM_CHANNELS 5000


// Prevent some compile warnings from using like _1 instead of
// boost::placeholders::_1 (I think this must be in the Wt
// headers, since our code uses the namespace prefixes)
#define BOOST_BIND_GLOBAL_PLACEHOLDERS

#define InterSpec_PHONE_ROTATE_FOR_TABS 1

#endif // InterSpec_config_h
9 changes: 9 additions & 0 deletions InterSpec/IsotopeSearchByEnergy.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ class IsotopeSearchByEnergy : public Wt::WContainerWidget
*/
std::shared_ptr<void> getDisableUndoRedoSentry();

#if( InterSpec_PHONE_ROTATE_FOR_TABS )
void setResultTableColumnWidths( const bool narrow );

/** Currently just repositions the results table, and adjusts its row sizes and visible columns. */
void setNarrowPhoneLayout( const bool narrow );
#endif
protected:
virtual void render( Wt::WFlags<Wt::RenderFlag> flags );

Expand All @@ -218,7 +224,9 @@ class IsotopeSearchByEnergy : public Wt::WContainerWidget

InterSpec *m_viewer;
D3SpectrumDisplayDiv *m_chart;
Wt::WContainerWidget *m_searchConditionsColumn;
Wt::WContainerWidget *m_searchEnergies;
Wt::WContainerWidget *m_assignBtnRow;
Wt::WPushButton *m_clearRefLines;
Wt::Signals::connection m_refLineUpdateConnection;
Wt::Signals::connection m_refLineClearConnection;
Expand All @@ -237,6 +245,7 @@ class IsotopeSearchByEnergy : public Wt::WContainerWidget
size_t m_nextSearchEnergy;
double m_minBr, m_minHl;


/** A struct that represents the GUI state, using basic types.
We will use this struct as an intermediary to/from XML, as well as for undo/redo state.
Expand Down
10 changes: 10 additions & 0 deletions InterSpec/PeakInfoDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class D3SpectrumDisplayDiv;
namespace Wt
{
class WImage;
class WLabel;
class WWidget;
class WMenuItem;
class WTabWidget;
Expand All @@ -61,6 +62,11 @@ class PeakInfoDisplay : public Wt::WContainerWidget

void handleChartLeftClick( const double energy );

#if( InterSpec_PHONE_ROTATE_FOR_TABS )
/** Currently just makes the buttons at the bottom be minimal. */
void setNarrowPhoneLayout( const bool narrow );
#endif

protected:
//init() must be called exactly once
void init();
Expand Down Expand Up @@ -91,6 +97,10 @@ class PeakInfoDisplay : public Wt::WContainerWidget
Wt::WInteractWidget *m_deletePeak;

Wt::WPushButton *m_searchForPeaks;

Wt::WPushButton *m_clearPeaksButton;
Wt::WPushButton *m_nucFromRefButton;
Wt::WLabel *m_peakAddRemoveLabel;
};//class PeakInfoDisplay

#endif // #ifndef PeakInfoDisplay_h
Expand Down
5 changes: 5 additions & 0 deletions InterSpec/ReferencePhotopeakDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,11 @@ class ReferencePhotopeakDisplay : public Wt::WContainerWidget

MoreNuclideInfoWindow *moreInfoWindow();

#if( InterSpec_PHONE_ROTATE_FOR_TABS )
/** Currently just hides or shows the table with gamma info. */
void setNarrowPhoneLayout( const bool narrow );
#endif

protected:
virtual void render( Wt::WFlags<Wt::RenderFlag> flags );

Expand Down
2 changes: 1 addition & 1 deletion InterSpec/SpecFileSummary.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class SpecFileSummary : public AuxWindow
};//enum EditableFields

public:
SpecFileSummary( InterSpec *specViewer );
SpecFileSummary( const SpecUtils::SpectrumType spec_type, InterSpec *specViewer );
virtual ~SpecFileSummary();

protected:
Expand Down
93 changes: 92 additions & 1 deletion InterSpec_resources/CompactFileManager.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@

display: flex;
flex-direction: column;
justify-content: space-around
justify-content: space-around;

overflow: hidden;
}

.CompactFileManager.Tabbed div.DispType {
margin-top: 0px;
border-top: none;
}

.CompactFileManager.LeftToRight div.DispType.Foreground {
Expand Down Expand Up @@ -108,7 +115,60 @@ div.DispType .SpecTitle {
overflow: hidden;
}

div.DispType .StretcherRow {
flex-grow: 10;
flex-shrink: 10;
}

div.DispType .SummaryTable {
align-self: center;
font-size: xx-small;
margin-top: 5px;
white-space: nowrap;
border-collapse: collapse;
border: 1px solid #e1e1e1;
}

div.DispType .SummaryTable td {
padding-top: 1px;
padding-bottom: 1px;
padding-left: 2px;
border-bottom: 1px solid #e1e1e1;
}

div.DispType .SummaryTable td:nth-child(odd) {
font-weight: bold;
text-align: center;
}

div.DispType .SummaryTable td:nth-child(even) {
text-align: left;
border-right: 1px solid #e1e1e1;

max-width: 60px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}

button.LinkBtn.GpsBtn, button.LinkBtn.GpsBtn:hover {
float: none;
height: 10px;
padding: 0px;
font-size: 6px;
}

button.LinkBtn.MoreInfoBtn, button.LinkBtn.MoreInfoBtn:hover {
float: right;
margin-right: 5px;
margin-left: auto; /* This is what makes the button float to the right side */
font-size: 6px;
}

div.DispType .BottomRow {
width: 100%;
overflow-x: hidden;

flex-grow: 1;

display: flex;
Expand Down Expand Up @@ -136,3 +196,34 @@ div.DispType div.ScaleFactorRow{
.SpecNormTxt {
width: 5em;
}

.CompactFileManager .TitleRow {
display: flex;
flex-direction: row;
/* justify-content: space-between; */
column-gap: 8px;
}

.CompactFileManager .SpecLeg {

}

.CompactFileManager .CompactFMLegBackground{
fill: var(--d3spec-chart-area-color, rgba(0,0,0,0));
}

.CompactFileManager .CompactFMLegLine {
stroke-width: 1px;
}

.CompactFileManager .CompactFMSpecLineForeground {
stroke: var(--d3spec-fore-line-color, black);
}

.CompactFileManager .CompactFMSpecLineBackground {
stroke: var(--d3spec-back-line-color, rgb(0,255,255) ); /* default cyan */
}

.CompactFileManager .CompactFMSpecLineSecondary {
stroke: var(--d3spec-second-line-color, rgb(0,128,128) ); /* default dark green */
}
9 changes: 9 additions & 0 deletions InterSpec_resources/DoseCalcWidget.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
min-height: 255px;
}

.NarrowDose .DoseEnterDiv{
min-height: 175px;
}

.DoseEnterEl {
width: 250px;
}
Expand All @@ -33,6 +37,11 @@
margin-right: 10px; /* to be about symetric with white-space on left side of dose tool*/
}

.NarrowDose .DoseAnswerDiv{
margin-right: 0px;
margin-top: 5px;
}

.DoseEnterTxt {
margin-top: 3px;
margin-left: 10px;
Expand Down
11 changes: 11 additions & 0 deletions InterSpec_resources/EnergyCalTool.css
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,17 @@ color: #E0F5FF;

}

@media (max-width: 350px) {
.CoefContent .CoefDisplay {
font-size: x-small;
}

.DetCalMenu {
width: 5em;
font-size: small;
}

}

.CoefContent .CoefDisplay
{
Expand Down
11 changes: 11 additions & 0 deletions InterSpec_resources/InterSpec.css
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,13 @@ ul.Wt-popupmenu > li > a > span > span:hover

.PeakInfoDisplayButtonDiv {
padding-left: 3px;
display: flex;
align-items: center;
}

.PeakInfoDisplayButtonDiv > .LinkBtn.DownloadBtn.Wt-btn.with-label
{
margin-left: auto;
}

.PeakInfoHlpBtn {
Expand Down Expand Up @@ -1563,6 +1570,10 @@ a:hover { color:#E88400; border-bottom:none; }
border-bottom: 1px solid #e1e1e1;
}

.IsPhone.Portrait .ToolTabTitledColumn .ToolTabColumnTitle {
font-size: 7pt;
}

.ToolTabTitledColumn .ToolTabTitledColumnContent
{
margin-left: 5px;
Expand Down
Loading

0 comments on commit 3f22b3a

Please sign in to comment.