From: <ma...@us...> - 2003-12-26 11:36:36
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv2590 Modified Files: GUISettingsDlg.cpp MainDlg.cpp MainDlg.h Log Message: Fixed i18n that got broken by dynamic page-list storage implemention. Index: GUISettingsDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/GUISettingsDlg.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- GUISettingsDlg.cpp 25 Dec 2003 02:27:48 -0000 1.30 +++ GUISettingsDlg.cpp 26 Dec 2003 11:36:32 -0000 1.31 @@ -131,7 +131,7 @@ GetShowTool()->SetValue(show_toolbar); GetShowMenu()->SetValue(show_menubar); GetRememberLast()->SetValue(remember_last); - GetStartPage()->SetStringSelection(startpage); + GetStartPage()->SetStringSelection(_(startpage)); switch (tool_align) { case wxTB_HORIZONTAL: tool_align = 0; break; @@ -194,8 +194,12 @@ m_config->Write(wxT("Show ToolBar"), GetShowTool()->GetValue()); m_config->Write(wxT("Toolbar Alignment"), tool_align); m_config->Write(wxT("Show MenuBar"), GetShowMenu()->GetValue()); + Page *start_page = (Page*)GetStartPage()->GetClientData( + GetStartPage()->GetSelection() + ); m_config->Write( - wxT("StartPage"), GetStartPage()->GetStringSelection() + wxT("StartPage"), + mainframe->GetPageList().Find(start_page)->GetKeyString() ); m_config->Write(wxT("Remember last"), GetRememberLast()->GetValue()); @@ -485,18 +489,15 @@ wxStaticBox *item20 = new wxStaticBox( this, -1, _("Startup page") ); wxStaticBoxSizer *item19 = new wxStaticBoxSizer( item20, wxVERTICAL ); - wxString strs21[] = { - _("Servers"), - _("Search"), - _("Transfer"), - _("Shared Files"), - _("Messages"), - _("Statistics") - }; wxChoice *item21 = new wxChoice( - this, ID_STARTPAGE, wxDefaultPosition, wxSize(100,-1), - 6, strs21, 0 + this, ID_STARTPAGE, wxDefaultPosition, wxSize(100,-1) ); + for (size_t i=0;i<mainframe->GetPageList().GetCount();i++) { + item21->Append( + mainframe->GetPageList()[i]->short_title, + mainframe->GetPageList()[i] + ); + } #ifndef __WXX11__ item21->SetToolTip( _("Set which page will be displayed on program startup") Index: MainDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- MainDlg.cpp 25 Dec 2003 14:25:45 -0000 1.39 +++ MainDlg.cpp 26 Dec 2003 11:36:32 -0000 1.40 @@ -209,7 +209,8 @@ m_config->SetPath(wxT("/General")); m_config->Read(wxT("Remember last"), &remember_last, true); if (remember_last && !pages.IsEmpty()) { - m_config->Write(wxT("StartPage"), GetCurPage()->short_title); + m_config->Write(wxT("StartPage"), + pages.Find(GetCurPage())->GetKeyString()); } #ifdef wxHAS_TASK_BAR_ICON @@ -248,7 +249,7 @@ return false; /* Nothing to show */ } else if (to_show == wxT("")) { return false; /* Nothing to show */ - } else if (cur_page->short_title == to_show) { + } else if (pages.Find(cur_page)->GetKeyString() == to_show) { return false; /* Already shown */ } else if (pages.Find(to_show) == NULL) { return false; /* Not found */ @@ -322,7 +323,7 @@ if (pages.IsEmpty()) { break; } - names.Add(pages.Item(i)->GetData()->short_title); + names.Add(pages.Item(i)->GetKeyString()); } img->CalcToolBitmapSize(names); } @@ -447,28 +448,29 @@ wxASSERT_MSG(statisticswnd, wxT("Statistics Page creation failed.")); AddPage( - serverwnd, _("Servers"), _("Server list"), + serverwnd, wxT("Servers"), _("Servers"), _("Server list"), wxT("btn_servers"), ID_SERVERWND ); AddPage( - searchwnd, _("Search"), _("Search files"), + searchwnd, wxT("Search"), _("Search"), _("Search files"), wxT("btn_search"), ID_SEARCHWND ); AddPage( - transferwnd, _("Transfer"), _("File Transfer"), + transferwnd, wxT("Transfer"), _("Transfer"), _("File Transfer"), wxT("btn_transfer"), ID_TRANSFERWND ); AddPage( - sharedfileswnd, _("Shared Files"), _("Shared Files"), - wxT("btn_shared"), ID_SHAREDFILESWND + sharedfileswnd, wxT("Shared Files"), _("Shared Files"), + _("Shared Files"), wxT("btn_shared"), ID_SHAREDFILESWND ); AddPage( - messageswnd, _("Messaging"), _("Chatting"), + messageswnd, wxT("Messaging"), _("Messaging"), _("Chatting"), wxT("btn_messages"), ID_MESSAGESWND ); AddPage( - statisticswnd, _("Statistics"), _("Show live statistics"), - wxT("btn_statistics"), ID_STATISTICSWND + statisticswnd, wxT("Statistics"), _("Statistics"), + _("Show live statistics"), wxT("btn_statistics"), + ID_STATISTICSWND ); m_config->Read(wxT("/General/StartPage"), &start_page, wxT("Servers")); @@ -745,7 +747,7 @@ } if (event.GetId() == pages.Item(i)->GetData()->id) { tmp = SetActivePage( - pages.Item(i)->GetData()->short_title + pages.Item(i)->GetKeyString() ); if (!tmp) { GetToolBar()->ToggleTool(event.GetId(), true); @@ -956,7 +958,7 @@ start_up = true; if (!pages.IsEmpty()) { - SetActivePage(pages.Item(0)->GetData()->short_title); + SetActivePage(pages.Item(0)->GetKeyString()); } UpdateToolBar(); UpdateMenuBar(); @@ -982,6 +984,7 @@ /* Constructs a new `Page` structure from the values passed to us, adds it to */ /* pages list and updates tool/menubars as neccesery. */ /* @page Contents of the new page */ +/* @name UNTRANSLATED name for the page for internal handling */ /* @short_title Will be displayed on toolbar button */ /* @long_title Will be displayed as tooltip on toolbar */ /* @image Name of the image for toolbar button (will be looked */ @@ -990,15 +993,16 @@ /* @update_bars If true, also updates toolbar/menubars as neccesery */ /******************************************************************************/ void CMainDlg::AddPage( - wxPanel *page, const wxString &short_title, const wxString - &long_title, const wxString &image, wxWindowID id, bool update_bars + wxPanel *page, const wxString &name, const wxString &short_title, + const wxString &long_title, const wxString &image, wxWindowID id, + bool update_bars ) { if (page == NULL) { wxFAIL_MSG(wxT("Empty page passed for adding!")); return; } wxLogDebug( - wxT("Adding page `%s` with title `%s`, image `%s`."), + wxT("Adding page `%s` with title `%s`, image `%s`."), short_title.c_str(), long_title.c_str(), image.c_str() ); Page *newpage = new Page; @@ -1011,7 +1015,7 @@ if (!start_up) { img->MakeToolImage(newpage->short_title, newpage->image); } - pages.Append(short_title, newpage); + pages.Append(name, newpage); if (update_bars) { CreateMyToolBar(); Index: MainDlg.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- MainDlg.h 23 Dec 2003 00:40:50 -0000 1.16 +++ MainDlg.h 26 Dec 2003 11:36:32 -0000 1.17 @@ -128,8 +128,9 @@ void CreateMyToolBar(bool gen_images = false); /* Creates tbar */ void CreateMyMenuBar(); /* (re)Creates menubar */ void AddPage( /* Adds new page to frame */ - wxPanel *page, const wxString &short_title, const wxString - &long_title, const wxString &image, wxWindowID = -1, + wxPanel *page, const wxString &name, + const wxString &short_title, const wxString &long_title, + const wxString &image, wxWindowID = -1, bool updatebars = false ); void AddPage(Page *page, bool updatebars = false); /* Adds new page */ @@ -154,6 +155,7 @@ wxStaticText* GetStatusConnection() { /* Statusbar server name text */ return (wxStaticText*) FindWindow( ID_STATUS_CONNECTION ); } + PageList& GetPageList() { return pages; } private: DECLARE_EVENT_TABLE() |