From 584d15e0b65fdc4037cd33b9efbe9044f0fda395 Mon Sep 17 00:00:00 2001 From: "eduardo.davila@creatis.insa-lyon.fr" Date: Mon, 3 Feb 2025 15:44:28 +0100 Subject: [PATCH] #3533 Maximized Option --- kernel/src/bbtkBlackBox.cxx | 4 +-- kernel/src/bbtkWxBlackBox.cxx | 31 ++++++++++++++++---- kernel/src/bbtkWxBlackBox.h | 4 +-- packages/wx/src/bbwxFreeMemoryAlert.cxx | 39 +++++++++++++------------ packages/wx/src/bbwxLayoutLine.cxx | 16 +--------- 5 files changed, 51 insertions(+), 43 deletions(-) diff --git a/kernel/src/bbtkBlackBox.cxx b/kernel/src/bbtkBlackBox.cxx index c6cd7cf..6d0afbb 100644 --- a/kernel/src/bbtkBlackBox.cxx +++ b/kernel/src/bbtkBlackBox.cxx @@ -775,7 +775,7 @@ namespace bbtk ) { -//printf("EED BlackBox::bbRecursiveExecute bbProcess start %s \n", bbGetFullName().c_str() ); +// printf("EED BlackBox::bbRecursiveExecute bbProcess start %s \n", bbGetFullName().c_str() ); //auto start = std::chrono::high_resolution_clock::now(); this->bbProcess(); @@ -783,7 +783,7 @@ namespace bbtk //auto duration = std::chrono::duration_cast(stop - start); //printf("EED BlackBox::bbRecursiveExecute bbProcess time= %ld %s \n", duration.count() , bbGetFullName().c_str() ); -//printf("EED BlackBox::bbRecursiveExecute bbProcess end %s \n", bbGetFullName().c_str() ); +// printf("EED BlackBox::bbRecursiveExecute bbProcess end %s \n", bbGetFullName().c_str() ); } // Manual analysis diff --git a/kernel/src/bbtkWxBlackBox.cxx b/kernel/src/bbtkWxBlackBox.cxx index f1b9544..5cff050 100644 --- a/kernel/src/bbtkWxBlackBox.cxx +++ b/kernel/src/bbtkWxBlackBox.cxx @@ -185,7 +185,7 @@ printf("EED WxFrame::~WxFrame\n"); wxDefaultPosition, size, wxRESIZE_BORDER | - wxSYSTEM_MENU | +// wxSYSTEM_MENU | wxCLOSE_BOX | wxMAXIMIZE_BOX | wxMINIMIZE_BOX | wxSTAY_ON_TOP | @@ -276,9 +276,9 @@ printf("EED WxFrame::~WxFrame\n"); std2wx( ConstructWinTitle() ), wxSize( bbGetInputWinWidth() , bbGetInputWinHeight() ) ); - w->Show(false); + w->Show(false); // w->ShowModal(); - } + } //========================================================================= //================================================================== @@ -322,19 +322,40 @@ printf("EED WxFrame::~WxFrame\n"); { if ((bbmWindow) && (!bbIsShown())) { + + //Try Maximized Window + if (bbGetInputWinMaximized()==true) + { + wxWindow *ww = bbGetOutputWidget(); + while (ww->GetParent()!=NULL) + { + ww = ww->GetParent(); + } // while + wxFrame *f = (wxFrame*)ww; + // f->Iconize(false); + f->Maximize(true); + // f->Raise(); + // f->Show(true); + // f->SetFocus(); + }// if WinMaximized + + + bbtkBlackBoxDebugMessage("widget",3,"==> WxBlackBox::bbShowWindow()" <ShowModal(); + ((WxDialog*)bbmWindow)->ShowModal(); } else { bbGetWindow()->Show(); bbSetShown(true); } // if Dialog + } // if Window shown } //================================================================== - //================================================================== + + //================================================================== void WxBlackBox::bbDestroyWindow() { bbtkBlackBoxDebugMessage("widget",3,"==> WxBlackBox::bbDestroyWindow("< +#include namespace bbwx { @@ -31,53 +33,52 @@ void FreeMemoryAlert::Process() double memfreeGB = (double) (wxGetFreeMemory().ToLong()/1000000000.0); if ( memfreeGB < bbGetInputFreeMemoryLimit() ) { - wxMessageBox(wxString::Format( "This application needs minimum %4.1f Gb to be executed correctly. \nTry to close somes applications you don't need. \n\n Actual free memory = %4.1f Gb\n",bbGetInputFreeMemoryLimit(), + /* + wxMessageBox( wxString::Format( "This application needs minimum %4.1f Gb to be executed correctly. \nTry to close somes applications you don't need. \n\n Actual free memory = %4.1f Gb\n" ,bbGetInputFreeMemoryLimit(), memfreeGB ), _T("Warning!"), - wxOK | wxICON_INFORMATION, - NULL); - } // if memfree - + wxOK | wxICON_INFORMATION | wxSTAY_ON_TOP | wxCENTRE , + NULL); + */ - + + wxMessageDialog *dial = new wxMessageDialog( wxApp::GetMainTopWindow() , wxT("Please select a Contour"), wxT("Warning"), wxOK | wxSTAY_ON_TOP| wxICON_EXCLAMATION ) ; + dial->ShowModal(); + } // if memfree } -//===== + +//===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void FreeMemoryAlert::bbUserSetDefaultValues() { - // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 bbSetInputFreeMemoryLimit(1); - } -//===== + +//===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void FreeMemoryAlert::bbUserInitializeProcessing() { - // THE INITIALIZATION METHOD BODY : // Here does nothing // but this is where you should allocate the internal/output pointers -// if any - - +// if any } -//===== + +//===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void FreeMemoryAlert::bbUserFinalizeProcessing() { - // THE FINALIZATION METHOD BODY : // Here does nothing // but this is where you should desallocate the internal/output pointers // if any - } -} -// EO namespace bbwx + +}// EO namespace bbwx diff --git a/packages/wx/src/bbwxLayoutLine.cxx b/packages/wx/src/bbwxLayoutLine.cxx index 3b25439..face218 100644 --- a/packages/wx/src/bbwxLayoutLine.cxx +++ b/packages/wx/src/bbwxLayoutLine.cxx @@ -74,24 +74,10 @@ void LayoutLine::bbUserFinalizeProcessing() { } +//----------------------------------------------------------------- void LayoutLine::Process() { PutWinTitle(); - - if (bbGetInputWinMaximized()==true) - { - wxWindow *ww = bbGetOutputWidget(); - while (ww->GetParent()!=NULL) - { - ww = ww->GetParent(); - } // while - wxFrame *f = (wxFrame*)ww; - f->Iconize(false); - f->Maximize(true); - f->Raise(); - f->Show(true); - f->SetFocus(); - }// if } /* -- 2.49.0