From: Pablo d'A. <da...@us...> - 2005-08-10 22:05:59
|
Update of /cvsroot/hugin/hugin/src/hugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1364/hugin Modified Files: CPEditorPanel.cpp CPImageCtrl.cpp ImagesPanel.cpp LensPanel.cpp MainFrame.cpp OptimizePanel.cpp huginApp.cpp Log Message: work around some changed behaviour and bugs in wxWidgets 2.6.1 on unix (wxgtk). Splitters are restored to their original size and 'f' key finetunes on the image with the mouse cursor over it. also updated translations. Index: MainFrame.cpp =================================================================== RCS file: /cvsroot/hugin/hugin/src/hugin/MainFrame.cpp,v retrieving revision 1.158 retrieving revision 1.159 diff -u -d -r1.158 -r1.159 --- MainFrame.cpp 9 Aug 2005 05:27:58 -0000 1.158 +++ MainFrame.cpp 10 Aug 2005 22:05:45 -0000 1.159 @@ -145,6 +145,7 @@ EVT_MENU(XRCID( "action_edit_text_dialog"), MainFrame::OnTextEdit) //EVT_NOTEBOOK_PAGE_CHANGED(XRCID( "controls_notebook"), MainFrame::UpdatePanels) EVT_CLOSE( MainFrame::OnExit) + EVT_SIZE(MainFrame::OnSize) END_EVENT_TABLE() // change this variable definition @@ -154,7 +155,7 @@ //WX_DEFINE_ARRAY() MainFrame::MainFrame(wxWindow* parent, Panorama & pano) - : pano(pano) + : pano(pano), m_doRestoreLayout(false) { wxString splashPath; wxFileName::SplitPath( wxTheApp->argv[0], &splashPath, NULL, NULL ); @@ -323,9 +324,13 @@ #ifdef USE_WX253 SetSizeHints(600,400); #endif + + #if 0 bool maximized = config->Read(wxT("/MainFrame/maximized"), 0l) != 0; if (maximized) { this->Maximize(); + // explicitly layout after maximize + this->Layout(); } else { //size int w = config->Read(wxT("/MainFrame/width"),-1l); @@ -344,6 +349,7 @@ Move(0, 44); } } +#endif // set progress display for image cache. ImageCache::getInstance().setProgressDisplay(this); @@ -359,6 +365,11 @@ } wxYield(); + + // disable automatic Layout() calls, to it by hand + SetAutoLayout(false); + + // By using /SUBSYSTEM:CONSOLE /ENTRY:"WinMainCRTStartup" in the linker // options for the debug build, a console window will be used for stdout // and stderr. No need to redirect to a file. Better security since we can't @@ -408,13 +419,13 @@ void MainFrame::RestoreLayout() { - DEBUG_TRACE(""); + DEBUG_TRACE(""); // restore layout of child widgets, now that all widgets have been created, // are of similar size - cpe->RestoreLayout(); - lens_panel->RestoreLayout(); - images_panel->RestoreLayout(); - DEBUG_TRACE(""); +// cpe->RestoreLayout(); +// lens_panel->RestoreLayout(); +// images_panel->RestoreLayout(); + DEBUG_TRACE(""); } //void MainFrame::panoramaChanged(PT::Panorama &panorama) @@ -1289,6 +1300,36 @@ } } + +void MainFrame::OnSize(wxSizeEvent &e) +{ + wxSize sz = this->GetSize(); + wxSize csz = this->GetClientSize(); + wxSize vsz = this->GetVirtualSize(); + DEBUG_TRACE(" size:" << sz.x << "," << sz.y << + " client: "<< csz.x << "," << csz.y << + " virtual: "<< vsz.x << "," << vsz.y); + + Layout(); + // redo layout if requested + if (m_doRestoreLayout) { + m_doRestoreLayout = false; + // first, layout everything. This should ensure that the + // children have the correct size + // then restore the layout + RestoreLayout(); + } + e.Skip(); +} + +void MainFrame::RestoreLayoutOnNextResize() +{ + m_doRestoreLayout = true; + cpe->RestoreLayoutOnNextResize(); + lens_panel->RestoreLayoutOnNextResize(); + images_panel->RestoreLayoutOnNextResize(); +} + /// hack.. kind of a pseudo singleton... MainFrame * MainFrame::Get() { Index: huginApp.cpp =================================================================== RCS file: /cvsroot/hugin/hugin/src/hugin/huginApp.cpp,v retrieving revision 1.85 retrieving revision 1.86 diff -u -d -r1.85 -r1.86 --- huginApp.cpp 20 May 2005 14:09:47 -0000 1.85 +++ huginApp.cpp 10 Aug 2005 22:05:45 -0000 1.86 @@ -52,7 +52,7 @@ wxString MacGetPathTOBundledResourceFile(CFStringRef filename) { wxString theResult = wxT(""); - + CFBundleRef mainbundle = CFBundleGetMainBundle(); if(mainbundle == NULL) { @@ -87,7 +87,7 @@ wxString MacGetPathTOBundledExecutableFile(CFStringRef filename) { wxString theResult = wxT(""); - + CFBundleRef mainbundle = CFBundleGetMainBundle(); if(mainbundle == NULL) { @@ -153,6 +153,7 @@ bool huginApp::OnInit() { + DEBUG_TRACE("=========================== huginApp::OnInit() begin ==================="); SetAppName(wxT("hugin")); wxString m_huginPath; @@ -200,7 +201,7 @@ if (config->HasEntry(wxT("locale_path"))){ locale.AddCatalogLookupPathPrefix( config->Read(wxT("locale_path")).c_str() ); } - + #ifdef __WXMAC__ wxString thePath = MacGetPathTOBundledResourceFile(CFSTR("locale")); if(thePath != wxT("")) @@ -277,7 +278,7 @@ #endif #endif - + #ifdef __WXMAC__ // If hugin is starting with file opening AppleEvent, MacOpenFile will be called on first wxYield(). // Those need to be initialised before first call of Yield which happens in Mainframe constructor. @@ -326,7 +327,35 @@ // show the frame. frame->Show(TRUE); - frame->RestoreLayout(); + + // restore layout + frame->RestoreLayoutOnNextResize(); + + // setup main frame size, after it has been created. + bool maximized = config->Read(wxT("/MainFrame/maximized"), 0l) != 0; + if (maximized) { + frame->Maximize(); + // explicitly layout after maximize + } else { + //size + int w = config->Read(wxT("/MainFrame/width"),-1l); + int h = config->Read(wxT("/MainFrame/height"),-1l); + if (w >0) { + frame->SetClientSize(w,h); + } else { + frame->Fit(); + } + //position + int x = config->Read(wxT("/MainFrame/positionX"),-1l); + int y = config->Read(wxT("/MainFrame/positionY"),-1l); + if ( y > 0) { + frame->Move(x, y); + } else { + frame->Move(0, 44); + } + } + + // TODO: check if we need to load images. if (argc == 2) { @@ -356,7 +385,7 @@ // suppress tiff warnings TIFFSetWarningHandler(0); - DEBUG_TRACE(""); + DEBUG_TRACE("=========================== huginApp::OnInit() end ==================="); return true; } @@ -379,14 +408,14 @@ #ifdef __WXMAC__ void huginApp::MacOpenFile(const wxString &fileName) -{ +{ if(!m_macInitDone) { m_macOpenFileOnStart=true; m_macFileNameToOpenOnStart = fileName; return; } - + if(frame) frame->MacOnOpenFile(fileName); } #endif Index: ImagesPanel.cpp =================================================================== RCS file: /cvsroot/hugin/hugin/src/hugin/ImagesPanel.cpp,v retrieving revision 1.88 retrieving revision 1.89 diff -u -d -r1.88 -r1.89 --- ImagesPanel.cpp 18 Jul 2005 12:05:57 -0000 1.88 +++ ImagesPanel.cpp 10 Aug 2005 22:05:45 -0000 1.89 @@ -86,7 +86,7 @@ // Define a constructor for the Images Panel ImagesPanel::ImagesPanel(wxWindow *parent, const wxPoint& pos, const wxSize& size, Panorama* pano) : wxPanel (parent, -1, wxDefaultPosition, wxDefaultSize, wxEXPAND|wxGROW), - pano(*pano) + pano(*pano), m_restoreLayoutOnResize(false) { DEBUG_TRACE(""); @@ -149,6 +149,10 @@ pano->addObserver(this); DEBUG_TRACE("end"); +#ifdef USE_WX253 + SetAutoLayout(false); +#endif + m_degDigits = wxConfigBase::Get()->Read(wxT("/General/DegreeFractionalDigitsEdit"),3); } @@ -158,8 +162,8 @@ DEBUG_TRACE("dtor"); #ifdef USE_WX253 - int sashPos; - sashPos = m_img_splitter->GetSashPosition(); + int sashPos; + sashPos = m_img_splitter->GetSashPosition(); DEBUG_INFO("Image panel sash pos: " << sashPos); wxConfigBase::Get()->Write(wxT("/ImageFrame/sashPos"), sashPos); #endif @@ -182,8 +186,9 @@ #ifdef USE_WX253 int winWidth, winHeight; GetClientSize(&winWidth, &winHeight); - DEBUG_INFO( "image panel: " << winWidth <<"x"<< winHeight ); - m_img_splitter->SetSashPosition(wxConfigBase::Get()->Read(wxT("/ImageFrame/sashPos"),300)); + int sP = wxConfigBase::Get()->Read(wxT("/ImageFrame/sashPos"),winWidth/2); + m_img_splitter->SetSashPosition(sP); + DEBUG_INFO( "image panel: " << winWidth <<"x"<< winHeight << " sash pos: " << sP); #endif } @@ -195,6 +200,7 @@ void ImagesPanel::OnSize( wxSizeEvent & e ) { + #ifdef USE_WX253 int winWidth, winHeight; GetClientSize(&winWidth, &winHeight); @@ -210,7 +216,13 @@ DEBUG_INFO( "image panel: " << new_size.GetWidth() <<"x"<< new_size.GetHeight() ); #endif UpdatePreviewImage(); - e.Skip(); + + if (m_restoreLayoutOnResize) { + m_restoreLayoutOnResize = false; + RestoreLayout(); + } + + e.Skip(); } #ifdef USE_WX253 Index: CPImageCtrl.cpp =================================================================== RCS file: /cvsroot/hugin/hugin/src/hugin/CPImageCtrl.cpp,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- CPImageCtrl.cpp 2 Jun 2005 07:50:54 -0000 1.51 +++ CPImageCtrl.cpp 10 Aug 2005 22:05:45 -0000 1.52 @@ -871,6 +871,9 @@ CPEvent ev(this, CPEvent::RIGHT_CLICK, FDiff2D(0,0)); emit(ev); } else { + // wxWidgets 2.6.1 using gtk 2 doesn't set the event object + // properly.. do it here by hand + e.SetEventObject(this); DEBUG_DEBUG("forwarding key " << e.m_keyCode << " origin: id:" << e.m_id << " obj: " << e.GetEventObject()); @@ -878,6 +881,7 @@ //GetParent()->GetEventHandler()->ProcessEvent(e); m_editPanel->GetEventHandler()->ProcessEvent(e); } + e.Skip(); } void CPImageCtrl::OnKeyUp(wxKeyEvent & e) @@ -931,7 +935,7 @@ void CPImageCtrl::OnMouseEnter(wxMouseEvent & e) { - DEBUG_TRACE(""); + DEBUG_TRACE("MOUSE Enter, setting focus"); SetFocus(); } @@ -984,7 +988,7 @@ { int x,y; GetViewStart( &x, &y ); - + wxSize winSize = GetClientSize(); wxSize imgSize; imgSize.x = bitmap.GetWidth(); Index: OptimizePanel.cpp =================================================================== RCS file: /cvsroot/hugin/hugin/src/hugin/OptimizePanel.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- OptimizePanel.cpp 30 May 2005 12:46:30 -0000 1.32 +++ OptimizePanel.cpp 10 Aug 2005 22:05:45 -0000 1.33 @@ -120,10 +120,10 @@ OptimizePanel::~OptimizePanel() { DEBUG_TRACE("dtor, writing config"); - wxSize sz = GetClientSize(); - wxConfigBase * config = wxConfigBase::Get(); - config->Write(wxT("/OptimizerPanel/width"),sz.GetWidth()); - config->Write(wxT("/OptimizerPanel/height"),sz.GetHeight()); +// wxSize sz = GetClientSize(); +// wxConfigBase * config = wxConfigBase::Get(); +// config->Write(wxT("/OptimizerPanel/width"),sz.GetWidth()); +// config->Write(wxT("/OptimizerPanel/height"),sz.GetHeight()); m_pano->removeObserver(this); DEBUG_TRACE("dtor end"); } @@ -429,7 +429,7 @@ } } -void OptimizePanel::runOptimizer(const OptimizeVector & optvars, +void OptimizePanel::runOptimizer(const OptimizeVector & optvars, const PanoramaOptions & options, const UIntSet & imgs) { @@ -565,7 +565,7 @@ } // do not try to do anything on our own // if the user selected custom - if (mode != OPT_CUSTOM && m_pano->getNrOfImages() > 0) + if (mode != OPT_CUSTOM && m_pano->getNrOfImages() > 0) { // get anchor image unsigned int refImg = m_pano->getOptions().optimizeReferenceImage; @@ -574,13 +574,13 @@ int nHCP = 0; int nVCP = 0; const CPVector & cps = m_pano->getCtrlPoints(); - for (CPVector::const_iterator it = cps.begin(); it != cps.end(); it++) + for (CPVector::const_iterator it = cps.begin(); it != cps.end(); it++) { // control points - if (it->mode == ControlPoint::X) + if (it->mode == ControlPoint::X) { nVCP++; - } else if (it->mode == ControlPoint::Y) + } else if (it->mode == ControlPoint::Y) { nHCP++; } Index: LensPanel.cpp =================================================================== RCS file: /cvsroot/hugin/hugin/src/hugin/LensPanel.cpp,v retrieving revision 1.84 retrieving revision 1.85 diff -u -d -r1.84 -r1.85 --- LensPanel.cpp 5 Aug 2005 19:53:22 -0000 1.84 +++ LensPanel.cpp 10 Aug 2005 22:05:45 -0000 1.85 @@ -212,6 +212,11 @@ XRCCTRL(*this, "lens_panel", wxPanel)->SetSize ( new_size ); DEBUG_INFO( "" << new_size.GetWidth() <<"x"<< new_size.GetHeight() ); #endif + + if (m_restoreLayoutOnResize) { + m_restoreLayoutOnResize = false; + RestoreLayout(); + } } void LensPanel::UpdateLensDisplay () Index: CPEditorPanel.cpp =================================================================== RCS file: /cvsroot/hugin/hugin/src/hugin/CPEditorPanel.cpp,v retrieving revision 1.105 retrieving revision 1.106 diff -u -d -r1.105 -r1.106 --- CPEditorPanel.cpp 26 Jul 2005 06:07:44 -0000 1.105 +++ CPEditorPanel.cpp 10 Aug 2005 22:05:45 -0000 1.106 @@ -110,12 +110,13 @@ EVT_BUTTON(XRCID("cp_editor_previous_img"), CPEditorPanel::OnPrevImg) EVT_BUTTON(XRCID("cp_editor_next_img"), CPEditorPanel::OnNextImg) EVT_BUTTON(XRCID("cp_editor_finetune_button"), CPEditorPanel::OnFineTuneButton) + EVT_SIZE(CPEditorPanel::OnSize) END_EVENT_TABLE() CPEditorPanel::CPEditorPanel(wxWindow * parent, PT::Panorama * pano) : cpCreationState(NO_POINT), m_pano(pano), m_leftImageNr(UINT_MAX), m_rightImageNr(UINT_MAX), m_listenToPageChange(true), m_detailZoomFactor(1), - m_selectedPoint(UINT_MAX) + m_selectedPoint(UINT_MAX), m_restoreLayoutOnResize(false) { DEBUG_TRACE(""); @@ -2060,3 +2061,12 @@ int colNum = e.GetColumn(); wxConfigBase::Get()->Write( wxString::Format(wxT("/CPEditorPanel/ColumnWidth%d"),colNum), m_cpList->GetColumnWidth(colNum) ); } + +void CPEditorPanel::OnSize(wxSizeEvent & e) +{ + Layout(); + if (m_restoreLayoutOnResize) { + m_restoreLayoutOnResize = false; + RestoreLayout(); + } +} |