Ticket #7991: myModif.6.patch
File myModif.6.patch, 14.9 KB (added by , 13 years ago) |
---|
-
src/interface/Mainfrm.cpp
50 50 #include "toolbar.h" 51 51 #include "menu_bar.h" 52 52 #include "string_coalescer.h" 53 #include "select_dialog.h" 53 54 54 55 #ifdef __WXMSW__ 55 56 #include <wx/module.h> … … 67 68 DEFINE_EVENT_TYPE(fzEVT_TASKBAR_CLICK_DELAYED); 68 69 #endif 69 70 71 72 73 70 74 static int tab_hotkey_ids[10]; 71 75 72 76 BEGIN_EVENT_TABLE(CMainFrame, wxFrame) … … 336 340 m_pContextControl->CreateTab(); 337 341 338 342 m_pContextControl->GetCurrentControls(); 339 343 340 344 switch (message_log_position) 341 345 { 342 346 case 1: … … 508 512 delete m_pMenuBar; 509 513 } 510 514 m_pMenuBar = CMenuBar::Load(this); 511 515 512 516 if (!m_pMenuBar) 513 517 return false; 514 518 … … 610 614 { 611 615 OnMenuEditSettings(event); 612 616 } 617 else if(event.GetId() == XRCID("ID_MENU_EDIT_SELECT")) // Ma modification 618 { 619 OnSelectSettings(event); 620 621 } 613 622 else if (event.GetId() == XRCID("ID_MENU_EDIT_NETCONFWIZARD")) 614 623 { 615 624 CNetConfWizard wizard(this, COptions::Get()); … … 854 863 CSiteManager::GetBookmarks(controls->site_bookmarks->path, controls->site_bookmarks->bookmarks); 855 864 if (m_pMenuBar) 856 865 m_pMenuBar->UpdateBookmarkMenu(); 857 } 866 } 858 867 } 859 868 else if (event.GetId() == XRCID("ID_MENU_HELP_WELCOME")) 860 869 { … … 946 955 { 947 956 if ((*iter)->m_pEngine != pEngine) 948 957 continue; 949 958 950 959 pState = *iter; 951 960 break; 952 961 } … … 1239 1248 } 1240 1249 1241 1250 RememberSplitterPositions(); 1242 1251 1243 1252 #ifdef __WXMAC__ 1244 1253 if (m_pToolBar) 1245 1254 COptions::Get()->SetOption(OPTION_TOOLBAR_HIDDEN, m_pToolBar->IsShown() ? 0 : 1); … … 1534 1543 CheckChangedSettings(); 1535 1544 } 1536 1545 1546 void CMainFrame::OnSelectSettings(wxCommandEvent& event) 1547 { 1548 1549 CContextControl::_context_controls* controls = m_pContextControl->GetCurrentControls(); 1550 1551 CSelect_dialog *dlg= new CSelect_dialog(wxT("Select local files..."), (controls->pLocalListView)); 1552 dlg->ShowModal(); 1553 delete dlg; 1554 1555 } 1556 1537 1557 void CMainFrame::OnToggleLogView(wxCommandEvent& event) 1538 1558 { 1539 1559 if (!m_pTopSplitter) … … 1581 1601 shown = true; 1582 1602 } 1583 1603 } 1584 1604 1585 1605 if (COptions::Get()->GetOptionVal(OPTION_MESSAGELOG_POSITION) != 2) 1586 1606 COptions::Get()->SetOption(OPTION_SHOW_MESSAGELOG, shown); 1587 1607 } … … 1632 1652 continue; 1633 1653 1634 1654 controls->pLocalTreeViewPanel->SetHeader(controls->pLocalListViewPanel->DetachHeader()); 1635 1655 1636 1656 if (layout == 3 && swap) 1637 1657 controls->pLocalSplitter->SplitVertically(controls->pLocalListViewPanel, controls->pLocalTreeViewPanel); 1638 1658 else if (layout) … … 1796 1816 1797 1817 if (messagelog_position == -1) 1798 1818 messagelog_position = COptions::Get()->GetOptionVal(OPTION_MESSAGELOG_POSITION); 1799 1819 1800 1820 // First handle changes in message log position as it can make size of the other panes change 1801 1821 { 1802 1822 bool shown = m_pStatusView->IsShown(); 1803 1823 wxWindow* parent = m_pStatusView->GetParent(); 1804 1824 1805 1825 bool changed; 1806 1826 if (parent == m_pTopSplitter && messagelog_position != 0) 1807 1827 { … … 2203 2223 CContextControl::_context_controls* controls = m_pContextControl->GetCurrentControls(); 2204 2224 if (!controls) 2205 2225 return; 2206 2226 2207 2227 wxString posString; 2208 2228 2209 2229 // top_pos … … 2549 2569 // create another instance of the module and call its Exit() member. 2550 2570 // After that, the next call to a wxDisplay will create a new factory and 2551 2571 // get the new display layout from Windows. 2552 // 2572 // 2553 2573 // Note: Both the factory pattern as well as the dynamic object system 2554 2574 // are perfect example of bad design. 2555 2575 // -
src/interface/select_dialog.cpp
1 #include <filezilla.h> 2 /*#include <wx/utils.h> 3 #include <wx/stattext.h> 4 #include <wx/combobox.h> 5 #include <wx/textctrl.h> 6 #include <wx/sizer.h> 7 #include <wx/string.h> 8 #include <wx/statbox.h> 9 */ 10 11 #include "select_dialog.h" 12 #include "context_control.h" 13 #include "LocalListView.h" 14 15 BEGIN_EVENT_TABLE(CSelect_dialog,wxDialog) 16 17 EVT_BUTTON(BS,CSelect_dialog::select_button) 18 EVT_BUTTON(BE,CSelect_dialog::erase_button) 19 20 END_EVENT_TABLE() 21 22 CSelect_dialog::CSelect_dialog(const wxString title, CLocalListView *lv ) 23 : wxDialog(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600, 330)) // 600, 320 24 { 25 Centre(); 26 27 m_lv = lv; 28 29 m_buttonSelect = new wxButton(this, BS, wxT("Select"), wxPoint(50,270), wxDefaultSize, 0); 30 m_buttonErase = new wxButton(this, BE, _("&Unselect all"), wxPoint(140,270), wxDefaultSize, 0); 31 m_buttonCancel = new wxButton(this, wxID_CANCEL,wxT("Close"), wxPoint(370,270), wxDefaultSize, 0); 32 33 34 m_nameBox = new wxStaticBox(this, -1, wxT("Select by name"),wxPoint(20,23),wxSize(150,70)); 35 m_dateBox = new wxStaticBox(this, -1, wxT("Select by date"),wxPoint(200,23),wxSize(250,74)); 36 m_sizeBox = new wxStaticBox(this, -1, wxT("Select by size"),wxPoint(20,150),wxSize(550,80)); 37 38 m_nameText = new wxTextCtrl(this, -1,wxT(""),wxPoint(50,50)), wxSize(900,110); 39 40 m_comboD = new wxComboBox(this, -1, wxT("<unused>"), wxPoint(230,50), wxDefaultSize, 0, NULL, wxCB_READONLY); 41 42 m_comboS = new wxComboBox(this, -1, wxT("<unused>"), wxPoint(50,180), wxDefaultSize, 0, NULL, wxCB_READONLY); 43 m_sizeText = new wxTextCtrl(this, -1,wxT(""),wxPoint(280,180)); 44 wxStaticText *m_than = new wxStaticText(this, -1, wxT("than"),wxPoint(245,185)); 45 m_comboUnit = new wxComboBox(this, -1, wxT("ko (kilooctet)"), wxPoint(365,180), wxDefaultSize, 0, NULL, wxCB_READONLY); 46 47 m_comboS->Append(wxT("<unused>")); 48 m_comboS->Append(wxT("Larger")); 49 m_comboS->Append(wxT("Larger or equal")); 50 m_comboS->Append(wxT("Smaller")); 51 m_comboS->Append(wxT("Smaller or equal")); 52 53 m_comboD->Append(wxT("<unused>")); 54 m_comboD->Append(wxT("modified for 1 hour")); 55 m_comboD->Append(wxT("modified today")); 56 m_comboD->Append(wxT("modified for 2 days")); 57 m_comboD->Append(wxT("modified for 7 days")); 58 m_comboD->Append(wxT("modified for 1 month")); 59 60 m_comboUnit->Append(wxT("o (octet)")); 61 m_comboUnit->Append(wxT("ko (kilooctet)")); 62 m_comboUnit->Append(wxT("Mo (megaoctet)")); 63 m_comboUnit->Append(wxT("Go (gigaoctet)")); 64 65 66 67 } 68 69 void CSelect_dialog::select_button(wxCommandEvent& event) 70 { 71 wxString _name; 72 bool _dir; 73 wxLongLong _size; 74 wxDateTime _date; 75 bool _hasTime; 76 int i=0; 77 78 79 80 bool select; 81 82 int unit; 83 84 if (m_comboUnit->GetValue() == wxT("o (octet)")) unit = 1; 85 if (m_comboUnit->GetValue() == wxT("ko (kilooctet)")) unit = 1000; 86 if (m_comboUnit->GetValue() == wxT("Mo (megaoctet)")) unit = 1000000; 87 if (m_comboUnit->GetValue() == wxT("Go (gigaoctet)")) unit = 1000000000; 88 89 90 double sizeSpecified; 91 92 if (m_comboS->GetValue() != wxT("<unused>") && !(m_sizeText->GetValue()).ToDouble(&sizeSpecified)) 93 { 94 wxMessageBox( wxT("Incorrect number") ); 95 return; 96 } 97 98 m_lv->StartSelect(); 99 100 while(m_lv->GetNextFileSelect(_name, _dir, _size, _date, _hasTime)) 101 { 102 select = true; 103 104 if (_dir) select = false; // No select directory 105 106 // Name 107 if (!(_name.Contains(m_nameText->GetValue()))) select=false; 108 109 // Size 110 if (m_comboS->GetValue() == wxT("Larger") && sizeSpecified * unit >= _size.ToLong()) select = false ; 111 if (m_comboS->GetValue() == wxT("Larger or equal") && sizeSpecified * unit > _size.ToLong()) select = false ; 112 if (m_comboS->GetValue() == wxT("Smaller") && sizeSpecified * unit <= _size.ToLong()) select = false ; 113 if (m_comboS->GetValue() == wxT("Smaller or equal") && sizeSpecified * unit < _size.ToLong()) select = false ; 114 115 116 // Date 117 118 if (m_comboD->GetValue() == wxT("modified for 1 hour") && _date.IsEarlierThan(wxDateTime::UNow().Subtract(wxTimeSpan(1,0,0,0)))) select = false ; 119 if (m_comboD->GetValue() == wxT("modified today") && !(_date.IsSameDate(wxDateTime::UNow()))) select = false ; 120 if (m_comboD->GetValue() == wxT("modified for 2 days") && _date.IsEarlierThan(wxDateTime::UNow().Subtract(wxDateSpan(0,0,0,2)))) select = false ; 121 if (m_comboD->GetValue() == wxT("modified for 7 days") && _date.IsEarlierThan(wxDateTime::UNow().Subtract(wxDateSpan(0,0,1,0)))) select = false ; 122 if (m_comboD->GetValue() == wxT("modified for 1 month") && _date.IsEarlierThan(wxDateTime::UNow().Subtract(wxDateSpan(0,1,0,0)))) select = false ; 123 124 125 126 if (select) 127 m_lv->SetItemState(i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); 128 129 i++; 130 } 131 132 m_lv->FinishComparison(); 133 134 135 } 136 137 void CSelect_dialog::erase_button(wxCommandEvent& event) 138 { 139 wxString _name; 140 bool _dir; 141 wxLongLong _size; 142 wxDateTime _date; 143 bool _hasTime; 144 int i=0; 145 146 m_lv->StartSelect(); 147 148 while(m_lv->GetNextFileSelect(_name, _dir, _size, _date, _hasTime)) 149 { 150 m_lv->SetItemState(i, 0, wxLIST_STATE_SELECTED); 151 i++; 152 } 153 154 m_lv->FinishComparison(); 155 156 } -
src/interface/LocalListView.cpp
Modification de propriétés sur src/interface/select_dialog.cpp ___________________________________________________________________ Ajouté : svn:executable + *
1856 1856 } 1857 1857 } 1858 1858 1859 1860 void CLocalListView::StartSelect() 1861 { 1862 m_selectIndex = 0; 1863 } 1864 1865 bool CLocalListView::GetNextFileSelect(wxString& name, bool& dir, wxLongLong& size, wxDateTime& date, bool &hasTime) 1866 { 1867 1868 if (m_selectIndex >= m_fileData.size()) return false; 1869 1870 const CLocalFileData& data = m_fileData[m_indexMapping[m_selectIndex]]; 1871 1872 name = data.name; 1873 dir = data.dir; 1874 size = data.size; 1875 date = data.lastModified; 1876 hasTime = true; 1877 1878 m_selectIndex++; 1879 1880 return true; 1881 } 1882 1883 1884 1859 1885 bool CLocalListView::GetNextFile(wxString& name, bool& dir, wxLongLong& size, wxDateTime& date, bool &hasTime) 1860 1886 { 1861 1887 if (++m_comparisonIndex >= (int)m_originalIndexMapping.size()) … … 2219 2245 continue; 2220 2246 2221 2247 m_fileData[index].label = drive + _T(" (") + iter->volumeName + _T(")"); 2222 2248 2223 2249 RefreshItem(item); 2224 2250 } 2225 2251 } -
src/interface/select_dialog.h
1 #ifndef _SELECT_DIALOG_H 2 #define _SELECT_DIALOG_H 3 4 #include <wx/wx.h> 5 #include "context_control.h" 6 #include "LocalListView.h" 7 8 enum 9 { 10 BS=1, 11 BE=2 12 }; 13 14 class CSelect_dialog : public wxDialog 15 { 16 public: 17 CSelect_dialog(const wxString title, CLocalListView *lv); 18 19 void select_button(wxCommandEvent& event); 20 void erase_button (wxCommandEvent& event); 21 private: 22 23 wxButton *m_buttonSelect, *m_buttonCancel, *m_buttonErase; 24 wxComboBox *m_comboD, *m_comboS, *m_comboUnit; 25 wxTextCtrl *m_sizeText, *m_nameText; 26 wxStaticBox *m_sizeBox, *m_dateBox, *m_nameBox; 27 CLocalListView *m_lv; 28 29 DECLARE_EVENT_TABLE() 30 31 }; 32 #endif -
src/interface/Makefile.am
Modification de propriétés sur src/interface/select_dialog.h ___________________________________________________________________ Ajouté : svn:executable + *
64 64 RemoteListView.cpp \ 65 65 RemoteTreeView.cpp \ 66 66 search.cpp \ 67 select_dialog.cpp \ 67 68 settings/optionspage.cpp \ 68 69 settings/optionspage_connection.cpp \ 69 70 settings/optionspage_connection_active.cpp \ … … 176 177 RemoteListView.h \ 177 178 RemoteTreeView.h \ 178 179 search.h \ 180 select_dialog.h \ 179 181 settings/optionspage.h \ 180 182 settings/optionspage_connection.h \ 181 183 settings/optionspage_connection_active.h \ -
src/interface/resources/menus.xrc
43 43 </object> 44 44 <object class="wxMenu"> 45 45 <label>&Edit</label> 46 <object class="wxMenuItem" name="ID_MENU_EDIT_SELECT"> 47 <label>Se&lect local files...</label> 48 </object> 49 <object class="separator"/> 46 50 <object class="wxMenuItem" name="ID_MENU_EDIT_NETCONFWIZARD"> 47 51 <label>&Network configuration wizard...</label> 48 52 </object> … … 597 601 <label>&Configure speed limits...</label> 598 602 </object> 599 603 </object> 600 </resource> 601 No newline at end of file 604 </resource> -
src/interface/Mainfrm.h
55 55 void ProcessCommandLine(); 56 56 57 57 void PostInitialize(); 58 58 59 59 bool ConnectToServer(const CServer& server, const CServerPath& path = CServerPath()); 60 60 61 61 CContextControl* GetContextControl() { return m_pContextControl; } … … 117 117 void OnSiteManager(wxCommandEvent& event); 118 118 void OnProcessQueue(wxCommandEvent& event); 119 119 void OnMenuEditSettings(wxCommandEvent& event); 120 void OnSelectSettings(wxCommandEvent& event); 120 121 void OnToggleToolBar(wxCommandEvent& event); 121 122 void OnToggleLogView(wxCommandEvent& event); 122 123 void OnToggleLocalTreeView(wxCommandEvent& event); -
src/interface/LocalListView.h
64 64 virtual bool GetNextFile(wxString& name, bool &dir, wxLongLong &size, wxDateTime& date, bool &hasTime); 65 65 virtual void FinishComparison(); 66 66 67 virtual void StartSelect(); 68 virtual bool GetNextFileSelect(wxString& name, bool &dir, wxLongLong &size, wxDateTime& date, bool &hasTime); 69 67 70 virtual bool ItemIsDir(int index) const; 68 71 virtual wxLongLong ItemGetSize(int index) const; 69 72 … … 87 90 wxDropTarget* m_pDropTarget; 88 91 int m_dropTarget; 89 92 93 unsigned int m_selectIndex; 94 90 95 // Event handlers 91 96 DECLARE_EVENT_TABLE(); 92 97 void OnItemActivated(wxListEvent& event); -
src/tinyxml/tinyxml.cpp
57 57 { 58 58 unsigned char c = (unsigned char) str[i]; 59 59 60 if ( c == '&' ) 60 if ( c == '&' 61 && i < ( (int)str.length() - 2 ) 62 && str[i+1] == '#' 63 && str[i+2] == 'x' ) 61 64 { 65 // Hexadecimal character reference. 66 // Pass through unchanged. 67 // © -- copyright symbol, for example. 68 // 69 // The -1 is a bug fix from Rob Laveaux. It keeps 70 // an overflow from happening if there is no ';'. 71 // There are actually 2 ways to exit this loop - 72 // while fails (error case) and break (semicolon found). 73 // However, there is no mechanism (currently) for 74 // this function to return an error. 75 while ( i<(int)str.length()-1 ) 76 { 77 outString->append( str.c_str() + i, 1 ); 78 ++i; 79 if ( str[i] == ';' ) 80 break; 81 } 82 } 83 else if ( c == '&' ) 84 { 62 85 outString->append( entity[0].str, entity[0].strLength ); 63 86 ++i; 64 87 }