Tommy 碎碎念

Tommy Wu's blog

« 上一篇 | 下一篇 »

讓 FileZilla3 rc1 記得之前的視窗大小與位置
post by tommy @ 13 八月, 2007 22:53

前幾天 FileZilla 作者發表了 FileZilla 3.0 RC1 的版本. 終於進入 RC 的階段了. 對我來說, 我在 FileZilla 2.x 裡頭會用到的功能, 在這個版本中多數都已經存在了. 所以就想之後都改用 FileZilla 3 的版本. 不過.... 用了一下, 發現... 這個版本仍然不會記錄之前的 UI 大小與位置, 也就是每次執行時, 所出現的畫面並不是我熟悉的, 變成每次都要調整一次. 所以... 乾脆自己修改一下, 加上這個功能來使用.這個修正如下:

diff -Nur Filezilla3/src/interface/Mainfrm.cpp Filezilla3.patch/src/interface/Mainfrm.cpp
--- Filezilla3/src/interface/Mainfrm.cpp Mon Aug 13 14:01:20 2007
+++ Filezilla3.patch/src/interface/Mainfrm.cpp Mon Aug 13 17:19:00 2007
@@ -29,6 +29,7 @@
#include "export.h"
#include "import.h"
#include "recursive_operation.h"
+#include <wx/tokenzr.h>
 
#ifndef __WXMSW__
#include "resources/filezilla.xpm"
@@ -198,7 +199,7 @@
m_pStatusView = new CStatusView(m_pTopSplitter, -1);
m_pQueuePane = new CQueue(m_pBottomSplitter, this, m_pAsyncRequestQueue);
m_pQueueView = m_pQueuePane->GetQueueView();
-
+
m_pLocalTreeViewPanel = new CView(m_pLocalSplitter);
m_pLocalListViewPanel = new CView(m_pLocalSplitter);
m_pLocalTreeView = new CLocalTreeView(m_pLocalTreeViewPanel, -1, m_pState, m_pQueueView);
@@ -251,7 +252,7 @@
m_pLocalListViewPanel->SetHeader(m_pLocalViewHeader);
m_pLocalSplitter->Initialize(m_pLocalListViewPanel);
}
-
+
m_pRemoteViewHeader = new CRemoteViewHeader(m_pRemoteSplitter, m_pState);
if (COptions::Get()->GetOptionVal(OPTION_SHOW_TREE_REMOTE))
{
@@ -275,6 +276,38 @@
 
Layout();
 
+ // is_maximized win_x win_y win_width win_height top_pos bottom_height view_pos view_height local_pos remote_pos
+ wxString posString = COptions::Get()->GetOption(OPTION_WINDOW_POSITION);
+ wxStringTokenizer tokens(posString, _T(" "));
+ int count = tokens.CountTokens();
+ unsigned long * aPosValues = new unsigned long[count];
+ for (int i = 0; i < count; i++) {
+ wxString token = tokens.GetNextToken();
+ token.ToULong(aPosValues + i);
+ }
+ if (count == 11) {
+ if (aPosValues[0])
+ Maximize();
+ else {
+ Move(aPosValues[1], PosaValues[2]);
+ SetClientSize(aPosValues[3], aPosValues[4]);
+ }
+ m_pTopSplitter->SetSashPosition(aPosValues[5]);
+
+ int x, y;
+ m_pBottomSplitter->GetClientSize(&x, &y);
+ y -= aPosValues[6];
+ if (y < 100) y = 100;
+ m_pBottomSplitter->SetSashPosition(y);
+
+ m_ViewSplitterSashPos = (float)aPosValues[7]/aPosValues[8];
+ m_pViewSplitter->SetSashPosition(aPosValues[7]);
+
+ m_pLocalSplitter->SetSashPosition(aPosValues[9]);
+ m_pRemoteSplitter->SetSashPosition(aPosValues[10]);
+ }
+ delete [] aValues;
+
wxString localDir = COptions::Get()->GetOption(OPTION_LASTLOCALDIR);
if (!m_pState->SetLocalDir(localDir))
m_pState->SetLocalDir(_T("/"));
@@ -750,6 +783,35 @@
 
void CMainFrame::OnClose(wxCloseEvent &event)
{
+ wxString posString;
+ // is_maximized
+ locations += wxString::Format(_T("%d "), IsMaximized() ? 1 : 0);
+ int x, y;
+ // pos_x pos_y
+ GetPosition(&x, &y);
+ posString += wxString::Format(_T("%d %d "), x, y);
+ // pos_width pos_height
+ GetClientSize(&x, &y);
+ posString += wxString::Format(_T("%d %d "), x, y);
+ // top_pos
+ posString += wxString::Format(_T("%d "), m_pTopSplitter->GetSashPosition());
+ // bottom_height
+ m_pBottomSplitter->GetClientSize(&x, &y);
+ posString += wxString::Format(_T("%d "), y - m_pBottomSplitter->GetSashPosition());
+ // view_pos
+ posString += wxString::Format(_T("%d "), m_pViewSplitter->GetSashPosition());
+ // view_height
+ m_pViewSplitter->GetClientSize(&x, &y);
+ if (COptions::Get()->GetOptionVal(OPTION_FILEPANE_LAYOUT) != 1)
+ posString += wxString::Format(_T("%d "), x);
+ else
+ posString += wxString::Format(_T("%d "), y);
+ // local_pos
+ posString += wxString::Format(_T("%d "), m_pLocalSplitter->GetSashPosition());
+ // remote_pos
+ posString += wxString::Format(_T("%d "), m_pRemoteSplitter->GetSashPosition());
+ COptions::Get()->SetOption(OPTION_WINDOW_POSITION, posString);
+
Show(false);
m_bQuit = true;
delete m_pSendLed;
diff -Nur Filezilla3/src/interface/Options.cpp Filezilla3.patch/src/interface/Options.cpp
--- Filezilla3/src/interface/Options.cpp Mon Aug 13 14:01:21 2007
+++ Filezilla3.patch/src/interface/Options.cpp Mon Aug 13 16:59:12 2007
@@ -81,7 +81,8 @@
{ "Queue successful autoclear", number, _T("0") },
{ "Queue column widths", string, _T("") },
{ "Local filelist colwidths", string, _T("") },
- { "Remote filelist colwidths", string, _T("") }
+ { "Remote filelist colwidths", string, _T("") },
+ { "Window position and size", string, _T("") }
};
 
COptions::COptions()
@@ -195,7 +196,7 @@
{
if (!SetOptionNoSave(nID, value))
return false;
-
+
if (m_pXmlFile)
m_pXmlFile->Save();
 
@@ -416,7 +417,7 @@
return;
 
TiXmlElement *element = m_pXmlFile->GetElement();
-
+
while (path != _T(""))
{
wxString sub;
diff -Nur Filezilla3/src/interface/Options.h Filezilla3.patch/src/interface/Options.h
--- Filezilla3/src/interface/Options.h Mon Aug 13 14:01:21 2007
+++ Filezilla3.patch/src/interface/Options.h Mon Aug 13 16:58:26 2007
@@ -35,6 +35,7 @@
OPTION_QUEUE_COLUMN_WIDTHS,
OPTION_LOCALFILELIST_COLUMN_WIDTHS,
OPTION_REMOTEFILELIST_COLUMN_WIDTHS,
+ OPTION_WINDOW_POSITION,
 
// Has to be last element
OPTIONS_NUM
@@ -57,7 +58,7 @@
 
virtual bool SetOption(unsigned int nID, int value);
virtual bool SetOption(unsigned int nID, wxString value);
-
+
bool SetOptionNoSave(unsigned int nID, int value);
bool SetOptionNoSave(unsigned int nID, wxString value);
 
@@ -72,7 +73,7 @@
 
void SaveColumnWidths(const wxListCtrl* const pListCtrl, unsigned int optionId);
bool ReadColumnWidths(unsigned int optionId, unsigned int count, unsigned long* widths);
-
+
protected:
COptions();
virtual ~COptions();

Patch 可以由這兒抓取: http://www.teatime.com.tw/~tommy/mypatch/filezilla3_rc1_save_position.patch
製作出來的 Windows 執行檔可以由這兒抓: http://www.teatime.com.tw/~tommy/files/filezilla/filezilla3_rc1_save_position.7z
Patch 已送給作者:  https://sourceforge.net/tracker/?func=detail&atid=372243&aid=1773124&group_id=21558

這樣子處理之後, 果然使用上就順手多了.

在 FileZilla 3 RC1 中, 除了這個問題外, 我覺得還有兩個小問題:

  • Keep Alive 的功能還沒有, 所以隔一段時間就會斷線.
  • 在 Queue 裡頭的檔案, 不能暫時停止, 只能移除.

 如果你認為這兩個小問題對你沒影響, 歡迎也加入 FileZilla 3 的使用行列吧. 


2007/08/14: 

作者做了部份修改之後, 把這個 patch 納入官方版本中了. (另外... 好像 SourceForge 上頭的 CVS 與 SVN 並沒有同步.... 目前在 CVS 上頭的版本比較舊, 要抓 SVN 上頭的才會是最新的版本)

Del.icio.us Furl HEMiDEMi Technorati MyShare
commons icon [1] Re:讓 FileZilla3 rc1 記得之前的視窗大小與位置 [ 回覆 ]

小弟還是覺得 2.0.x版的 filezilla 比較習慣。
除上 tommy兄所提的兩個小問題以外,小弟還蠻常直接從 local端直接「執行」檔案,不過,3.0這個功能也被拿掉了。

commons icon [2] Re:讓 FileZilla3 rc1 記得之前的視窗大小與位置 [ 回覆 ]

作者有說, FZ3 不是 explorer, 執行的功能, 我想也許不會被加回去吧.
keepalive 的功能, 前幾天作者加上了,下一個版本就會有.

其實我常用的功能, 目前在 FZ3 都有了. 對我來說, 影響並不大.

FZ2 應該以後只會有 security issue 的修正吧.

迴響
暱稱:
標題:
個人網頁:
電子郵件:
authimage

迴響

  

Bad Behavior 已經阻擋了 92 個過去 7 天試圖闖關的垃圾迴響與引用。
Power by LifeType. Template design by JamesHuang. Valid XHTML and CSS