📄 mainfrm.cpp
字号:
{
TRACE0("Statusleiste konnte nicht erstellt werden\n");
return -1; // Fehler bei Erstellung
}
RECT MyRect;
m_wndStatusBar.GetItemRect(m_wndStatusBar.CommandToIndex(ID_INDICATOR_PROGRESS_PANE), &MyRect);
//Create the progress control
m_ProgressCtrl.Create(WS_VISIBLE|WS_CHILD, MyRect, &m_wndStatusBar, m_wndStatusBar.CommandToIndex(ID_INDICATOR_PROGRESS_PANE));
m_ProgressCtrl.SetRange(0,100); //Set the range to between 0 and 100
m_ProgressCtrl.SetStep(1); // Set the step amount
m_ProgressCtrl.ShowWindow(SW_HIDE);
m_wndStatusBar.GetItemRect(m_wndStatusBar.CommandToIndex(ID_INDICATOR_RECVLED), &MyRect);
RECT rc;
m_wndStatusBar.GetItemRect(m_wndStatusBar.CommandToIndex(ID_INDICATOR_PROGRESS_PANE), &rc);
// Reposition the progress control correctly!
m_ProgressCtrl.SetWindowPos(&wndTop, rc.left, rc.top, rc.right - rc.left,
rc.bottom - rc.top, 0);
m_ProgressCtrl.SetShowText(TRUE);
//Create the first LED control
m_RecvLed.Create(_T(""), WS_VISIBLE|WS_CHILD, MyRect, &m_wndStatusBar, m_wndStatusBar.CommandToIndex(ID_INDICATOR_RECVLED));
m_RecvLed.SetLed( CLed::LED_COLOR_GREEN, CLed::LED_OFF, CLed::LED_ROUND);
m_wndStatusBar.GetItemRect(m_wndStatusBar.CommandToIndex(ID_INDICATOR_RECVLED), &rc);
// Reposition the first LED correctly!
m_RecvLed.SetWindowPos(&wndTop, rc.left, rc.top, rc.right - rc.left,
rc.bottom - rc.top, 0);
//Create the second LED control
m_SendLed.Create(_T(""), WS_VISIBLE|WS_CHILD, MyRect, &m_wndStatusBar, m_wndStatusBar.CommandToIndex(ID_INDICATOR_SENDLED));
m_SendLed.SetLed( CLed::LED_COLOR_RED, CLed::LED_OFF, CLed::LED_ROUND);
m_wndStatusBar.GetItemRect(m_wndStatusBar.CommandToIndex(ID_INDICATOR_SENDLED), &rc);
// Reposition the second LED correctly!
m_SendLed.SetWindowPos(&wndTop, rc.left, rc.top, rc.right - rc.left,
rc.bottom - rc.top, 0);
m_wndStatusBar.SetPaneInfo(0,m_wndStatusBar.GetItemID(0),SBPS_STRETCH|SBPS_NOBORDERS,200);
m_wndStatusBar.SetPaneInfo(m_wndStatusBar.CommandToIndex(ID_INDICATOR_PROGRESS_PANE),ID_INDICATOR_PROGRESS_PANE,SBPS_NORMAL,100);
m_wndStatusBar.SetPaneInfo(m_wndStatusBar.CommandToIndex(ID_INDICATOR_SECURESERVER),ID_INDICATOR_SECURESERVER,SBPS_NOBORDERS,20);
m_wndStatusBar.SetPaneInfo(m_wndStatusBar.CommandToIndex(ID_INDICATOR_RECVLED),ID_INDICATOR_RECVLED,SBPS_NOBORDERS,6);
m_wndStatusBar.SetPaneInfo(m_wndStatusBar.CommandToIndex(ID_INDICATOR_SENDLED),ID_INDICATOR_SENDLED,SBPS_NOBORDERS,0);
// ZU ERLEDIGEN: Entfernen, wenn Sie keine QuickInfos w黱schen
m_pWndToolBar->SetBarStyle(m_pWndToolBar->GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY);
m_pFileZillaApi=new CFileZillaApi;
m_pFileZillaApi->Init(GetSafeHwnd());
m_nFileZillaApiMessageID = m_pFileZillaApi->GetMessageID();
m_pFileZillaApi->SetDebugLevel(COptions::GetOptionVal(OPTION_DEBUGTRACE)?4:0);
m_bShowHiddenFiles=COptions::GetOptionVal(OPTION_ALWAYSSHOWHIDDEN);
if (m_pFileZillaApi)
m_pFileZillaApi->SetOption(FZAPI_OPTION_SHOWHIDDEN, m_bShowHiddenFiles);
m_pCommandQueue=new CCommandQueue(m_pFileZillaApi);
m_bShowTree=TRUE;
m_bShowRemoteTree=TRUE;
m_bShowQueue=1;
m_bQuit=FALSE;
m_hcArrow = AfxGetApp()->LoadStandardCursor(IDC_ARROW);
m_hcNo = AfxGetApp()->LoadStandardCursor(IDC_NO);
m_bShowMessageLog=TRUE;
//Set initial size of queue pane
int size=0,temp=0;
m_wndVertSplitter.GetRowInfo(1,size,temp);
m_wndVertSplitter.SetRowInfo(1,size-120,temp);
m_wndVertSplitter.RecalcLayout();
int s1,s2;
if (!m_nLocalTreeViewLocation)
{
m_wndLocalSplitter.GetRowInfo(1,s2,temp);
m_wndLocalSplitter.GetRowInfo(0,s1,temp);
if (s1>s2)
m_wndLocalSplitter.SetRowInfo(0,(s1+s2)/2,1);
}
else
{
m_wndLocalSplitter.GetColumnInfo(1,s2,temp);
m_wndLocalSplitter.GetColumnInfo(0,s1,temp);
if (s1 > s2)
m_wndLocalSplitter.SetColumnInfo(0,(s1+s2)/2,1);
}
if (!m_nRemoteTreeViewLocation)
{
m_wndRemoteSplitter.GetRowInfo(1, s2, temp);
m_wndRemoteSplitter.GetRowInfo(0, s1, temp);
if (s1>s2)
m_wndRemoteSplitter.SetRowInfo(0,(s1+s2)/2,1);
}
else
{
m_wndRemoteSplitter.GetColumnInfo(1, s2, temp);
m_wndRemoteSplitter.GetColumnInfo(0, s1, temp);
if (s1>s2)
m_wndRemoteSplitter.SetColumnInfo(0,(s1+s2)/2,1);
}
//Load the icon which indicates secure sites
m_pSecureIconCtrl->Create(_T(""), WS_CHILD|SS_ICON,CRect(0,0,16,16),&m_wndStatusBar,m_wndStatusBar.CommandToIndex(ID_INDICATOR_SECURESERVER));
m_pSecureIconCtrl->SetIcon( ::LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_SECURE)));
int cx,cx2;
m_wndMainSplitter.GetColumnInfo(0,cx,temp);
m_wndMainSplitter.GetColumnInfo(1,cx2,temp);
m_wndMainSplitter.SetColumnInfo(0,(cx+cx2)/2,0);
((CQueueCtrl*)GetQueuePane()->GetListCtrl())->UpdateStatusbar();
//Restore window size and position
RestoreSize();
//Hide panes disabled in options
if (COptions::GetOptionVal(OPTION_SHOWNOTOOLBAR))
OnViewToolbar();
if (COptions::GetOptionVal(OPTION_SHOWNOQUICKCONNECTBAR))
OnViewQuickconnectBar();
if (COptions::GetOptionVal(OPTION_SHOWNOSTATUSBAR))
OnViewStatusBar();
if (COptions::GetOptionVal(OPTION_SHOWNOMESSAGELOG))
OnViewMessagelog();
if (COptions::GetOptionVal(OPTION_SHOWNOTREEVIEW))
OnShowtree();
if (!COptions::GetOptionVal(OPTION_SHOWREMOTETREEVIEW))
OnShowremotetree();
if (COptions::GetOptionVal(OPTION_SHOWNOQUEUE))
OnShowqueue();
m_nSecTimerID=SetTimer(1, 1000, 0);
CString folder=COptions::GetOption(OPTION_DEFAULTFOLDER);
CFileStatus64 status;
if (folder!="")
{
folder.TrimRight( _T("\\") );
if (folder.Right(1)!=_T(":") )
if (!GetStatus64(folder, status))
folder="c:";
folder+="\\";
}
SetLocalFolder(folder);
if (COptions::GetOptionVal(OPTION_SHOWSITEMANAGERONSTARTUP))
{
ShowWindow(SW_SHOW);
OnSitemanager();
}
if (COptions::GetOptionVal(OPTION_ENABLEDEBUGMENU))
{
CMenu *pMenu=GetMenu();
if (pMenu->AppendMenu(MF_STRING|MF_POPUP, ID_MENU_DEBUG, _T("&Debug")))
{
MENUITEMINFO info={0};
info.cbSize=sizeof(info);
info.fMask |= MIIM_SUBMENU;
if (GetMenuItemInfo(pMenu->GetSafeHmenu(), pMenu->GetMenuItemCount( )-1, TRUE, &info))
{
CMenu SubMenu;
SubMenu.CreateMenu();
info.hSubMenu=SubMenu.Detach();
if (SetMenuItemInfo(pMenu->m_hMenu, pMenu->GetMenuItemCount( )-1, TRUE, &info))
{
pMenu=pMenu->GetSubMenu(pMenu->GetMenuItemCount( )-1);
if (pMenu)
{
pMenu->AppendMenu(MF_STRING, ID_MENU_DEBUG_DUMPDIRCACHE, _T("&Dump Directory &Cache"));
pMenu->AppendMenu(MF_STRING, ID_MENU_DEBUG_CRASH, _T("&Crash"));
}
}
}
}
}
CFileExistsDlg::SetOverwriteSettings(COptions::GetOptionVal(OPTION_FILEEXISTSACTION)-1);
//Initialize Minimize to tray button
if (COptions::GetOptionVal(OPTION_MINIMIZETOTRAY) == 2)
{
if (m_pMinTrayBtn)
delete m_pMinTrayBtn;
m_pMinTrayBtn = new CMinTrayBtn(this);
m_pMinTrayBtn->Hook(this);
m_pMinTrayBtn->MinTrayBtnShow();
}
return 0;
}
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
// Unterteiltes Fenster erstellen
if (!m_wndVertSplitter.CreateStatic(this, 3, 1))
return FALSE;
if (!m_wndVertSplitter.CreateView(0, 0, RUNTIME_CLASS(CStatusView), CSize(100, 95), pContext))
{
m_wndVertSplitter.DestroyWindow();
return FALSE;
}
// add the second splitter pane - which is a nested splitter with 2 rows
if (!m_wndMainSplitter.CreateStatic(
&m_wndVertSplitter, // our parent window is the first splitter
1, 2, // the new splitter is 2 rows, 1 column
WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
m_wndVertSplitter.IdFromRowCol(1, 0)
// new splitter is in the 2nd row, 1st column of first splitter
))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
if (!m_wndVertSplitter.CreateView(2, 0, RUNTIME_CLASS(CQueueView), CSize(100, 95), pContext))
{
m_wndVertSplitter.DestroyWindow();
return FALSE;
}
m_wndVertSplitter.SetRowInfo(1,4025,1);
// add the second splitter pane - which is a nested splitter with 2 rows
int numrows = 2 - m_nLocalTreeViewLocation;
int numcols = 1 + m_nLocalTreeViewLocation;
if (!m_wndLocalSplitter.CreateStatic(
&m_wndMainSplitter, // our parent window is the first splitter
numrows, numcols,
WS_CHILD | WS_VISIBLE | WS_BORDER , // style, WS_BORDER is needed
m_wndMainSplitter.IdFromRowCol(0, 0)
// new splitter is in the 2nd row, 1st column of first splitter
))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
// add the second splitter pane - which is a nested splitter with 2 rows
numrows = 2 - m_nRemoteTreeViewLocation;
numcols = 1 + m_nRemoteTreeViewLocation;
if (!m_wndRemoteSplitter.CreateStatic(
&m_wndMainSplitter, // our parent window is the first splitter
numrows, numcols,
WS_CHILD | WS_VISIBLE | WS_BORDER , // style, WS_BORDER is needed
m_wndMainSplitter.IdFromRowCol(0, 1)
// new splitter is in the 2nd row, 1st column of first splitter
))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
m_wndMainSplitter.SetColumnInfo( 0, 432, 1);
//Create the local view header
m_pLocalViewHeader=new t_LocalViewHeader;
memset(m_pLocalViewHeader, 0, sizeof(t_LocalViewHeader));
m_pLocalViewHeader->m_pEdit = new CLocalComboCompletion;
m_pLocalViewHeader->m_pEdit->Create(CBS_AUTOHSCROLL|WS_CHILD|WS_VISIBLE|WS_VSCROLL|CBS_DROPDOWN|CBS_SORT, CRect(0,0,100,200), this, 0);
m_pLocalViewHeader->m_pEdit->InitStorage(10,1000);
HFONT hFont = ( HFONT )GetStockObject(DEFAULT_GUI_FONT);
CFont *font=CFont::FromHandle(hFont);
m_pLocalViewHeader->m_pEdit->SetFont(font);
m_pLocalViewHeader->m_pLabelBackground=new CStatic;
m_pLocalViewHeader->m_pLabelBackground->Create(_T(""), WS_CHILD|WS_VISIBLE, CRect(1, 1, 0, 0), this);
CString str;
str.LoadString(IDS_VIEWLABEL_LOCAL);
str=" " + str + " ";
m_pLocalViewHeader->m_pLabel=new CStatic;
m_pLocalViewHeader->m_pLabel->Create(str, WS_CHILD|WS_VISIBLE|SS_RIGHT, CRect(1, 1, 0, 0), this);
m_pLocalViewHeader->m_pLabel->SetFont(font);
m_pLocalViewHeader->m_LabelTextSize.cx=m_pLocalViewHeader->m_LabelTextSize.cy=-1;
CDC *pDC=m_pLocalViewHeader->m_pLabel->GetDC();
CFont *pOldFont=pDC->SelectObject(font);
GetTextExtentPoint32( pDC->GetSafeHdc(), str, str.GetLength(), &m_pLocalViewHeader->m_LabelTextSize );
pDC->SelectObject(pOldFont);
m_pLocalViewHeader->m_pLabel->ReleaseDC(pDC);
//Create the remote view header
m_pRemoteViewHeader=new t_RemoteViewHeader;
memset(m_pRemoteViewHeader, 0, sizeof(t_RemoteViewHeader));
m_pRemoteViewHeader->m_pEdit = new CRemoteComboCompletion;
m_pRemoteViewHeader->m_pEdit->Create(CBS_AUTOHSCROLL|WS_CHILD|WS_VISIBLE|WS_VSCROLL|CBS_DROPDOWN|CBS_SORT, CRect(0,0,100,200), this, 0);
m_pRemoteViewHeader->m_pEdit->InitStorage(10,1000);
m_pRemoteViewHeader->m_pEdit->EnableWindow(FALSE);
hFont = ( HFONT )GetStockObject(DEFAULT_GUI_FONT);
font=CFont::FromHandle(hFont);
m_pRemoteViewHeader->m_pEdit->SetFont(font);
m_pRemoteViewHeader->m_pLabelBackground=new CStatic;
m_pRemoteViewHeader->m_pLabelBackground->Create(_T(""),WS_CHILD|WS_VISIBLE,CRect(1, 1, 0, 0), this);
str.LoadString(IDS_VIEWLABEL_REMOTE);
str=" " + str + " ";
m_pRemoteViewHeader->m_pLabel=new CStatic;
m_pRemoteViewHeader->m_pLabel->Create(str,WS_CHILD|WS_VISIBLE|SS_RIGHT,CRect(1, 1, 0, 0), this);
m_pRemoteViewHeader->m_pLabel->SetFont(font);
m_pRemoteViewHeader->m_LabelTextSize.cx=m_pRemoteViewHeader->m_LabelTextSize.cy=-1;
pDC=m_pRemoteViewHeader->m_pLabel->GetDC();
pOldFont=pDC->SelectObject(font);
GetTextExtentPoint32( pDC->GetSafeHdc(), str, str.GetLength(), &m_pRemoteViewHeader->m_LabelTextSize );
pDC->SelectObject(pOldFont);
m_pRemoteViewHeader->m_pLabel->ReleaseDC(pDC);
// now create the two views inside the nested splitter
if (!m_wndLocalSplitter.CreateView(0, 0,
RUNTIME_CLASS(CLocalView), CSize(300, 145), pContext))
{
TRACE0("Failed to create third pane\n");
return FALSE;
}
int row = 1 - m_nLocalTreeViewLocation;
int col = m_nLocalTreeViewLocation;
if (!m_wndLocalSplitter.CreateView(row, col,
RUNTIME_CLASS(CLocalView2), CSize(300, 200), pContext))
{
TRACE0("Failed to create third pane\n");
return FALSE;
}
//Now create the ftp view
if (!m_wndRemoteSplitter.CreateView(0, 0,
RUNTIME_CLASS(CFtpTreeView), CSize(300, 145), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
row = 1 - m_nRemoteTreeViewLocation;
col = m_nRemoteTreeViewLocation;
if (!m_wndRemoteSplitter.CreateView(row, col,
RUNTIME_CLASS(CFtpView), CSize(300, 200), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
GetLocalPane()->m_pOwner=this;
GetLocalPane2()->m_pOwner=this;
initialized=1;
PostMessage(WM_FILEZILLA_PROCESSCMDLINE);
m_nLocalListViewStyle=COptions::GetOptionVal(OPTION_LOCALLISTVIEWSTYLE);
m_nRemoteListViewStyle=COptions::GetOptionVal(OPTION_REMOTELISTVIEWSTYLE);
GetFtpPane()->m_pListCtrl->SetListStyle(m_nRemoteListViewStyle);
GetLocalPane2()->m_pListCtrl->SetListStyle(m_nLocalListViewStyle);
m_nHideLocalColumns=COptions::GetOptionVal(OPTION_HIDELOCALCOLUMNS);
GetLocalPane2()->m_pListCtrl->UpdateColumns(m_nHideLocalColumns);
m_nHideRemoteColumns=COptions::GetOptionVal(OPTION_HIDEREMOTECOLUMNS);
GetFtpPane()->m_pListCtrl->UpdateColumns(m_nHideRemoteColumns);
return TRUE;
}
//////////////////
// Helper function to register a new window class based on an already
// existing window class, but with a different name and icon.
// Returns new name if successful; otherwise NULL.
//
static LPCTSTR RegisterSimilarClass(LPCTSTR lpszNewClassName,
LPCTSTR lpszOldClassName, UINT nIDResource)
{
// Get class info for old class.
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -