Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/include/SAM_FresnelPhysical.h
Original file line number Diff line number Diff line change
Expand Up @@ -2655,6 +2655,8 @@ extern "C"

SAM_EXPORT double* SAM_FresnelPhysical_Outputs_rec_thermal_eff_aget(SAM_table ptr, int* length, SAM_error *err);

SAM_EXPORT double* SAM_FresnelPhysical_Outputs_rec_time_in_startup_aget(SAM_table ptr, int* length, SAM_error *err);

SAM_EXPORT double* SAM_FresnelPhysical_Outputs_recirculating_aget(SAM_table ptr, int* length, SAM_error *err);

SAM_EXPORT double* SAM_FresnelPhysical_Outputs_rh_aget(SAM_table ptr, int* length, SAM_error *err);
Expand Down
2 changes: 2 additions & 0 deletions api/include/SAM_FresnelPhysicalIph.h
Original file line number Diff line number Diff line change
Expand Up @@ -2713,6 +2713,8 @@ extern "C"

SAM_EXPORT double* SAM_FresnelPhysicalIph_Outputs_rec_thermal_eff_aget(SAM_table ptr, int* length, SAM_error *err);

SAM_EXPORT double* SAM_FresnelPhysicalIph_Outputs_rec_time_in_startup_aget(SAM_table ptr, int* length, SAM_error *err);

SAM_EXPORT double* SAM_FresnelPhysicalIph_Outputs_recirculating_aget(SAM_table ptr, int* length, SAM_error *err);

SAM_EXPORT double* SAM_FresnelPhysicalIph_Outputs_rh_aget(SAM_table ptr, int* length, SAM_error *err);
Expand Down
2 changes: 2 additions & 0 deletions api/include/SAM_TroughPhysical.h
Original file line number Diff line number Diff line change
Expand Up @@ -3655,6 +3655,8 @@ extern "C"

SAM_EXPORT double* SAM_TroughPhysical_Outputs_rec_op_mode_final_aget(SAM_table ptr, int* length, SAM_error *err);

SAM_EXPORT double* SAM_TroughPhysical_Outputs_rec_time_in_startup_aget(SAM_table ptr, int* length, SAM_error *err);

SAM_EXPORT double* SAM_TroughPhysical_Outputs_recirculating_aget(SAM_table ptr, int* length, SAM_error *err);

SAM_EXPORT double SAM_TroughPhysical_Outputs_required_number_of_loops_for_SM1_nget(SAM_table ptr, SAM_error *err);
Expand Down
2 changes: 2 additions & 0 deletions api/include/SAM_TroughPhysicalIph.h
Original file line number Diff line number Diff line change
Expand Up @@ -3519,6 +3519,8 @@ extern "C"

SAM_EXPORT double* SAM_TroughPhysicalIph_Outputs_qinc_costh_aget(SAM_table ptr, int* length, SAM_error *err);

SAM_EXPORT double* SAM_TroughPhysicalIph_Outputs_rec_time_in_startup_aget(SAM_table ptr, int* length, SAM_error *err);

SAM_EXPORT double* SAM_TroughPhysicalIph_Outputs_recirculating_aget(SAM_table ptr, int* length, SAM_error *err);

SAM_EXPORT double SAM_TroughPhysicalIph_Outputs_required_number_of_loops_for_SM1_nget(SAM_table ptr, SAM_error *err);
Expand Down
10 changes: 10 additions & 0 deletions api/modules/SAM_FresnelPhysical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4953,6 +4953,16 @@ SAM_EXPORT double* SAM_FresnelPhysical_Outputs_rec_thermal_eff_aget(SAM_table pt
return result;
}

SAM_EXPORT double* SAM_FresnelPhysical_Outputs_rec_time_in_startup_aget(SAM_table ptr, int* length, SAM_error *err){
double* result = nullptr;
translateExceptions(err, [&]{
result = ssc_data_get_array(ptr, "rec_time_in_startup", length);
if (!result)
make_access_error("SAM_FresnelPhysical", "rec_time_in_startup");
});
return result;
}

SAM_EXPORT double* SAM_FresnelPhysical_Outputs_recirculating_aget(SAM_table ptr, int* length, SAM_error *err){
double* result = nullptr;
translateExceptions(err, [&]{
Expand Down
10 changes: 10 additions & 0 deletions api/modules/SAM_FresnelPhysicalIph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5077,6 +5077,16 @@ SAM_EXPORT double* SAM_FresnelPhysicalIph_Outputs_rec_thermal_eff_aget(SAM_table
return result;
}

SAM_EXPORT double* SAM_FresnelPhysicalIph_Outputs_rec_time_in_startup_aget(SAM_table ptr, int* length, SAM_error *err){
double* result = nullptr;
translateExceptions(err, [&]{
result = ssc_data_get_array(ptr, "rec_time_in_startup", length);
if (!result)
make_access_error("SAM_FresnelPhysicalIph", "rec_time_in_startup");
});
return result;
}

SAM_EXPORT double* SAM_FresnelPhysicalIph_Outputs_recirculating_aget(SAM_table ptr, int* length, SAM_error *err){
double* result = nullptr;
translateExceptions(err, [&]{
Expand Down
10 changes: 10 additions & 0 deletions api/modules/SAM_TroughPhysical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6898,6 +6898,16 @@ SAM_EXPORT double* SAM_TroughPhysical_Outputs_rec_op_mode_final_aget(SAM_table p
return result;
}

SAM_EXPORT double* SAM_TroughPhysical_Outputs_rec_time_in_startup_aget(SAM_table ptr, int* length, SAM_error *err){
double* result = nullptr;
translateExceptions(err, [&]{
result = ssc_data_get_array(ptr, "rec_time_in_startup", length);
if (!result)
make_access_error("SAM_TroughPhysical", "rec_time_in_startup");
});
return result;
}

SAM_EXPORT double* SAM_TroughPhysical_Outputs_recirculating_aget(SAM_table ptr, int* length, SAM_error *err){
double* result = nullptr;
translateExceptions(err, [&]{
Expand Down
10 changes: 10 additions & 0 deletions api/modules/SAM_TroughPhysicalIph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6630,6 +6630,16 @@ SAM_EXPORT double* SAM_TroughPhysicalIph_Outputs_qinc_costh_aget(SAM_table ptr,
return result;
}

SAM_EXPORT double* SAM_TroughPhysicalIph_Outputs_rec_time_in_startup_aget(SAM_table ptr, int* length, SAM_error *err){
double* result = nullptr;
translateExceptions(err, [&]{
result = ssc_data_get_array(ptr, "rec_time_in_startup", length);
if (!result)
make_access_error("SAM_TroughPhysicalIph", "rec_time_in_startup");
});
return result;
}

SAM_EXPORT double* SAM_TroughPhysicalIph_Outputs_recirculating_aget(SAM_table ptr, int* length, SAM_error *err){
double* result = nullptr;
translateExceptions(err, [&]{
Expand Down
92 changes: 78 additions & 14 deletions src/casewin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <wx/statline.h>
#include <wx/tokenzr.h>
#include <wx/dir.h>
#include <wx/gdicmn.h>

#include <wex/exttree.h>
#include <wex/exttext.h>
Expand Down Expand Up @@ -65,6 +66,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "macro.h"

#include "../resource/graph.cpng"
#include "../resource/notes.cpng"


class CollapsePaneCtrl : public wxPanel
{
Expand Down Expand Up @@ -147,16 +150,11 @@ BEGIN_EVENT_TABLE( CaseWindow, wxSplitterWindow )
EVT_LISTBOX( ID_INPUTPAGELIST, CaseWindow::OnCommand )
EVT_DATAVIEW_SELECTION_CHANGED(ID_TechTree, CaseWindow::OnTree)
EVT_DATAVIEW_ITEM_COLLAPSING(ID_TechTree, CaseWindow::OnTreeCollapsing)

// EVT_DATAVIEW_ITEM_START_EDITING(ID_TechTree, CaseWindow::OnTreeActivated)
// EVT_DATAVIEW_ITEM_ACTIVATED(ID_TechTree, CaseWindow::OnTreeActivated)
//EVT_LISTBOX( ID_TechTree, CaseWindow::OnCommand)
EVT_BUTTON( ID_EXCL_BUTTON, CaseWindow::OnCommand )
EVT_LISTBOX( ID_EXCL_RADIO, CaseWindow::OnCommand)
EVT_CHECKBOX( ID_COLLAPSE, CaseWindow::OnCommand )
EVT_MENU_RANGE( ID_EXCL_OPTION, ID_EXCL_OPTION_MAX, CaseWindow::OnCommand )
EVT_LISTBOX( ID_EXCL_TABLIST, CaseWindow::OnCommand )

EVT_NOTEBOOK_PAGE_CHANGED( ID_PAGES, CaseWindow::OnSubNotebookPageChanged )
EVT_NOTEBOOK_PAGE_CHANGED( ID_BASECASE_PAGES, CaseWindow::OnSubNotebookPageChanged )
END_EVENT_TABLE()
Expand All @@ -177,7 +175,7 @@ CaseWindow::CaseWindow( wxWindow *parent, Case *c )
wxFont lafont(*wxNORMAL_FONT);
lafont.SetWeight(wxFONTWEIGHT_BOLD);

m_pageNote = 0;
m_pageNote = new PageNote(this); // create page note before m_pageFlipper adds pages
m_currentGroup = 0;

// navigation menu objects
Expand Down Expand Up @@ -297,8 +295,6 @@ CaseWindow::CaseWindow( wxWindow *parent, Case *c )
SetMinimumPaneSize( 50 );
SplitVertically( m_left_panel, m_pageFlipper, (int)(210*xScale) );

m_pageNote = new PageNote( this );

// load page note window geometry
int nw_xrel, nw_yrel, nw_w, nw_h;
double sf = wxGetScreenHDScale();
Expand Down Expand Up @@ -637,6 +633,8 @@ bool CaseWindow::GenerateReport( wxString pdffile, wxString templfile, VarValue

void CaseWindow::OnTree(wxDataViewEvent &evt)
{
UpdateNotesIcon(); // when leaving a page and notes erased

m_pageFlipper->SetSelection(0);
wxDataViewItem dvi = evt.GetItem();
if (!dvi.IsOk())
Expand All @@ -660,10 +658,30 @@ void CaseWindow::OnTree(wxDataViewEvent &evt)
else {
m_currentSelection = evt.GetItem();
}

/*
if (HasPageNote(GetCurrentContext())) {
m_navigationMenu->SetItemIcon(m_currentSelection, wxBitmapBundle::FromBitmap(wxBITMAP_PNG_FROM_DATA(notes)));
//m_navigationMenu->im // TODO set images and override onImagesChanged method to show notes icon
m_navigationMenu->Refresh();
}
// update all navigation items note icon
m_navigationMenu->get
auto bmb = wxBitmapBundle::FromBitmap(wxBITMAP_PNG_FROM_DATA(notes));
for (size_t i = 0; i < m_pageGroups.size(); i++)
if (HasPageNote(m_pageGroups[i]->HelpContext)
m_currentGroup = m_pageGroups[i];

*/


wxString title = m_navigationMenu->GetItemText(m_currentSelection);
m_navigationMenu->SetFocus();
SwitchToInputPage(title);

m_left_panel->Layout(); // Issue 1552
// wxVariant x = wxDataViewIconText("text", wxBitmapBundle::FromBitmap(wxBITMAP_PNG_FROM_DATA(notes)));
// m_navigationMenu->SetItemData(m_currentSelection,(wxClientData*) & x);
}

void CaseWindow::OnTreeCollapsing(wxDataViewEvent& evt)
Expand Down Expand Up @@ -1076,7 +1094,7 @@ bool CaseWindow::SwitchToInputPage( const wxString &name )
wxBusyCursor wait;
// m_inputPagePanel->Freeze();

//DetachCurrentInputPage();
// DetachCurrentInputPage();

m_currentGroup = 0;
for( size_t i=0;i<m_pageGroups.size();i++ )
Expand All @@ -1100,6 +1118,8 @@ bool CaseWindow::SwitchToInputPage( const wxString &name )
// if ( m_inputPageList->GetStringSelection() != name )
int p = m_inputPageList->Find(name);
m_inputPageList->Select( p );
m_inputPageList->Refresh();
m_left_panel->Layout();// try to force onPaint call for the input page list

return true;
}
Expand Down Expand Up @@ -1469,7 +1489,7 @@ void CaseWindow::UpdateConfiguration()
if (cfg->TechnologyFullName.Contains("Generic")) return; //if generic get out of the loop

wxDataViewItem dvi = m_navigationMenu->GetNthChild(wxDataViewItem(0), 0);
if (m_navigationMenu->IsContainer(dvi)) {
if (dvi.IsOk() && m_navigationMenu->IsContainer(dvi)) {
dvi = m_navigationMenu->GetNthChild(dvi, 0);
}

Expand All @@ -1479,7 +1499,7 @@ void CaseWindow::UpdateConfiguration()
}

// check for orphaned notes and if any found add to first page per Github issue 796
CheckAndUpdateNotes(inputPageHelpContext);
// CheckAndUpdateNotes(inputPageHelpContext);

m_szsims->Clear(true);
if (m_case->GetTechnology().Contains("wave") || m_case->GetTechnology().Contains("tidal")) {
Expand Down Expand Up @@ -1577,12 +1597,56 @@ void CaseWindow::UpdatePageNote()
// update ID
m_lastPageNoteId = GetCurrentContext();

// update text on page note
// update text on page note
wxString text = m_case->RetrieveNote( m_lastPageNoteId );
m_pageNote->SetText(text);
m_pageNote->Show( SamApp::Window()->GetCurrentCaseWindow() == this && !text.IsEmpty() );

bool bShowNote = SamApp::Window()->GetCurrentCaseWindow() == this && !text.IsEmpty();

m_pageNote->Show( bShowNote );

UpdateNotesIcon();
}

void CaseWindow::UpdateNotesIcon()
{
wxDataViewModel* model = m_navigationMenu->GetModel();
if (!model)
return;

// Get the invisible root item
wxDataViewItem root = model->GetParent(wxDataViewItem(nullptr));

// Start iteration (depth-first traversal shown)
UpdateNotesIconChildren(model, root);
}

void CaseWindow::UpdateNotesIconChildren(wxDataViewModel* model, const wxDataViewItem& parent)
{
wxDataViewItemArray children;
model->GetChildren(parent, children);
for (const wxDataViewItem& child : children) {
// Check if the child item has a note
bool bShowNote = false;
for (auto pg : m_pageGroups) {
if (pg->SideBarLabel == m_navigationMenu->GetItemText(child))
bShowNote = HasPageNote(pg->HelpContext);
}

if (bShowNote) {
m_navigationMenu->SetItemIcon(child, wxBitmapBundle::FromBitmap(wxBITMAP_PNG_FROM_DATA(notes)));
}
else {
m_navigationMenu->SetItemIcon(child, wxNullBitmap);
}
// Recursively check its children if it's a container
if (model->IsContainer(child)) {
UpdateNotesIconChildren(model, child);
}
}
}


void CaseWindow::ShowPageNote()
{
m_pageNote->Show();
Expand All @@ -1600,7 +1664,7 @@ bool CaseWindow::HasPageNote(const wxString &id)
return !id.IsEmpty() && !m_case->RetrieveNote(id).IsEmpty();
}

void CaseWindow::OnSubNotebookPageChanged( wxNotebookEvent & )
void CaseWindow::OnSubNotebookPageChanged( wxNotebookEvent &evt )
{
// common event handler for notebook page events to update the page note
UpdatePageNote();
Expand Down
4 changes: 3 additions & 1 deletion src/casewin.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ class CaseWindow : public wxSplitterWindow, CaseEventListener

wxString GetCurrentContext();
void UpdatePageNote();
void UpdateNotesIcon();
void UpdateNotesIconChildren(wxDataViewModel* model, const wxDataViewItem& parent);
//void IterateChildren(wxDataViewCtrl* myDVC, wxDataViewModel* model, const wxDataViewItem& parent)
void CheckAndUpdateNotes(const wxArrayString& inputPageHelpContext);
bool HasPageNote( const wxString &id );
void ShowPageNote( );
Expand Down Expand Up @@ -175,7 +178,6 @@ class CaseWindow : public wxSplitterWindow, CaseEventListener
virtual void OnCaseEvent( Case *, CaseEvent & );
void OnSubNotebookPageChanged( wxNotebookEvent &evt );


DECLARE_EVENT_TABLE();
};

Expand Down
6 changes: 3 additions & 3 deletions src/ipagelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static wxColour SelectColour(204,204,204);
static wxColour BackColour(243,243,243);

InputPageList::InputPageList(wxWindow *parent, int id, const wxPoint &pos, const wxSize &size)
: wxScrolledWindow(parent,id, pos, size, wxBORDER_NONE)
: wxScrolledWindow(parent,id, pos, size, wxBORDER_NONE | wxFULL_REPAINT_ON_RESIZE)
{
SetBackgroundStyle(wxBG_STYLE_CUSTOM);
SetBackgroundColour( BackColour );
Expand Down Expand Up @@ -273,8 +273,8 @@ void InputPageList::OnPaint(wxPaintEvent &)

dc.SetBackground( wxBrush( GetBackgroundColour() ) );

if (g_notesBitmap.IsOk() && m_caseWin
&& m_caseWin->HasPageNote( m_items[i].resource ) )
// if (g_notesBitmap.IsOk() && m_caseWin
// && m_caseWin->HasPageNote( m_items[i].resource ) )
{
// int tx_w = dc.GetTextExtent( m_items[i].name ).GetWidth();
dc.DrawBitmap(g_notesBitmap,
Expand Down
22 changes: 17 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@ bool MainWindow::CreateNewCase( const wxString &_name, wxString tech, wxString f
c->LoadDefaults();
m_project.AddCase(GetUniqueCaseName(_name), c);
CreateCaseWindow( c );
UpdateAllPageNotes();

return true;
}

Expand Down Expand Up @@ -533,6 +535,11 @@ void MainWindow::DeleteCaseWindow( Case *c )
m_caseNotebook->DeletePage( m_caseNotebook->FindPage( cw ) );
m_caseTabList->Remove( m_project.GetCaseName( c ) );
m_caseTabList->Refresh();

if (m_caseTabList->Count() > 0) {
wxString case_name = m_caseTabList->GetLabel(0);
SwitchToCaseWindow(case_name);
}
}

extern void ShowIDEWindow();
Expand Down Expand Up @@ -1240,17 +1247,22 @@ bool MainWindow::SwitchToCaseWindow( const wxString &case_name )
}
}

// update all the page notes so they get
// hidden/shown appropriately
for( size_t i=0;i<m_caseNotebook->GetPageCount();i++ )
if ( CaseWindow *cw = dynamic_cast<CaseWindow*>( m_caseNotebook->GetPage(i) ) )
cw->UpdatePageNote();
UpdateAllPageNotes();

return true;
}
else return false;
}

void MainWindow::UpdateAllPageNotes()
{
// update all the page notes so they get
// hidden/shown appropriately
for (size_t i = 0; i<m_caseNotebook->GetPageCount(); i++)
if (CaseWindow* cw = dynamic_cast<CaseWindow*>(m_caseNotebook->GetPage(i)))
cw->UpdatePageNote();
}

void MainWindow::OnCaseTabChange( wxCommandEvent &evt )
{
int sel = evt.GetSelection();
Expand Down
2 changes: 2 additions & 0 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ class MainWindow : public wxFrame
void DeleteCaseWindow( Case *c );
bool SwitchToCaseWindow( const wxString &name );

void UpdateAllPageNotes();

bool LoadProject( const wxString &file );
bool SaveProject( const wxString &file );

Expand Down
Loading
Loading