-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Moved the application toolbar code into a separate class. Currently…
… the right-click menu is not themed, and drag and drop is non-functional. - Two different forms are now supported for the command string: 1. "[command]" [parameters] 2. [command] [parameters] git-svn-id: https://explorerplus.svn.sourceforge.net/svnroot/explorerplus/trunk@519 a26bab42-55fb-42b1-bc7e-414d9f4e121a
- Loading branch information
derceg
committed
Dec 10, 2012
1 parent
e4dcc56
commit 6192765
Showing
22 changed files
with
1,193 additions
and
1,224 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#ifndef APPLICATIONTOOLBAR_INCLUDED | ||
#define APPLICATIONTOOLBAR_INCLUDED | ||
|
||
#include <vector> | ||
#include "Explorer++_internal.h" | ||
#include "ApplicationToolbarDropHandler.h" | ||
|
||
#import <msxml3.dll> raw_interfaces_only | ||
|
||
class CApplicationToolbar; | ||
|
||
struct ApplicationButton_t | ||
{ | ||
std::wstring Name; | ||
std::wstring Command; | ||
BOOL ShowNameOnToolbar; | ||
|
||
int ID; | ||
}; | ||
|
||
class CApplicationToolbarPersistentSettings | ||
{ | ||
public: | ||
|
||
~CApplicationToolbarPersistentSettings(); | ||
|
||
static CApplicationToolbarPersistentSettings &GetInstance(); | ||
|
||
void SaveRegistrySettings(HKEY hParentKey); | ||
void LoadRegistrySettings(HKEY hParentKey); | ||
|
||
void SaveXMLSettings(MSXML2::IXMLDOMDocument *pXMLDom,MSXML2::IXMLDOMElement *pe); | ||
void LoadXMLSettings(MSXML2::IXMLDOMNode *pNode); | ||
|
||
private: | ||
|
||
friend CApplicationToolbar; | ||
|
||
CApplicationToolbarPersistentSettings(); | ||
|
||
CApplicationToolbarPersistentSettings(const CApplicationToolbarPersistentSettings &); | ||
CApplicationToolbarPersistentSettings & operator=(const CApplicationToolbarPersistentSettings &); | ||
|
||
void AddButton(std::wstring Name,std::wstring Command,BOOL ShowNameOnToolbar); | ||
|
||
std::vector<ApplicationButton_t> m_Buttons; | ||
int m_IDCounter; | ||
}; | ||
|
||
class CApplicationToolbar | ||
{ | ||
friend LRESULT CALLBACK ParentProcStub(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam,UINT_PTR uIdSubclass,DWORD_PTR dwRefData); | ||
|
||
public: | ||
|
||
CApplicationToolbar(HWND hToolbar,UINT uIDStart,UINT uIDEnd,HINSTANCE hInstance,IExplorerplusplus *pexpp); | ||
~CApplicationToolbar(); | ||
|
||
private: | ||
|
||
static const UINT_PTR PARENT_SUBCLASS_ID = 1; | ||
|
||
struct ApplicationInfo_t | ||
{ | ||
std::wstring Application; | ||
std::wstring Parameters; | ||
}; | ||
|
||
LRESULT CALLBACK ParentProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam); | ||
|
||
void Initialize(); | ||
|
||
void NewItem(); | ||
void OpenItem(int iItem); | ||
void ShowItemProperties(int iItem); | ||
void DeleteItem(int iItem); | ||
|
||
void AddButtonsToToolbar(); | ||
void AddButtonToToolbar(const ApplicationButton_t &Button); | ||
void UpdateButton(int iItem); | ||
|
||
ApplicationInfo_t ProcessCommand(const std::wstring &Command); | ||
ApplicationButton_t *MapToolbarButtonToItem(int index); | ||
|
||
HWND m_hToolbar; | ||
|
||
HINSTANCE m_hInstance; | ||
|
||
UINT m_uIDStart; | ||
UINT m_uIDEnd; | ||
|
||
int m_RightClickItem; | ||
|
||
IExplorerplusplus *m_pexpp; | ||
|
||
CApplicationToolbarDropHandler *m_patd; | ||
|
||
CApplicationToolbarPersistentSettings *m_atps; | ||
}; | ||
|
||
#endif |
136 changes: 136 additions & 0 deletions
136
Explorer++/Explorer++/ApplicationToolbarButtonDialog.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
/****************************************************************** | ||
* | ||
* Project: Explorer++ | ||
* File: iServiceProvider.cpp | ||
* License: GPL - See COPYING in the top level directory | ||
* | ||
* New/edit dialog for the application toolbar. | ||
* | ||
* Written by David Erceg | ||
* www.explorerplusplus.com | ||
* | ||
*****************************************************************/ | ||
|
||
#include "stdafx.h" | ||
#include "ApplicationToolbarButtonDialog.h" | ||
#include "MainResource.h" | ||
|
||
|
||
CApplicationToolbarButtonDialog::CApplicationToolbarButtonDialog(HINSTANCE hInstance, | ||
int iResource,HWND hParent,ApplicationButton_t *Button,bool IsNew) : | ||
m_Button(Button), | ||
m_IsNew(IsNew), | ||
CBaseDialog(hInstance,iResource,hParent,false) | ||
{ | ||
|
||
} | ||
|
||
CApplicationToolbarButtonDialog::~CApplicationToolbarButtonDialog() | ||
{ | ||
|
||
} | ||
|
||
INT_PTR CApplicationToolbarButtonDialog::OnInitDialog() | ||
{ | ||
if(m_IsNew) | ||
{ | ||
TCHAR szTemp[64]; | ||
LoadString(GetInstance(),IDS_GENERAL_NEWAPPLICATIONBUTTON, | ||
szTemp,SIZEOF_ARRAY(szTemp)); | ||
SetWindowText(m_hDlg,szTemp); | ||
} | ||
|
||
SetDlgItemText(m_hDlg,IDC_APP_EDIT_NAME,m_Button->Name.c_str()); | ||
SetDlgItemText(m_hDlg,IDC_APP_EDIT_COMMAND,m_Button->Command.c_str()); | ||
|
||
UINT uCheck = m_Button->ShowNameOnToolbar ? BST_CHECKED : BST_UNCHECKED; | ||
CheckDlgButton(m_hDlg,IDC_CHECK_SHOWAPPNAME,uCheck); | ||
|
||
HWND hEditName = GetDlgItem(m_hDlg,IDC_APP_EDIT_NAME); | ||
SendMessage(hEditName,EM_SETSEL,0,-1); | ||
SetFocus(hEditName); | ||
|
||
return 0; | ||
} | ||
|
||
INT_PTR CApplicationToolbarButtonDialog::OnCommand(WPARAM wParam,LPARAM lParam) | ||
{ | ||
switch(LOWORD(wParam)) | ||
{ | ||
case IDC_APP_BUTTON_CHOOSE_FILE: | ||
OnChooseFile(); | ||
break; | ||
|
||
case IDOK: | ||
OnOk(); | ||
break; | ||
|
||
case IDCANCEL: | ||
OnCancel(); | ||
break; | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
void CApplicationToolbarButtonDialog::OnChooseFile() | ||
{ | ||
/* TODO: Text needs to be localized. */ | ||
TCHAR *Filter = _T("Programs (*.exe)\0*.exe\0All Files\0*.*\0\0"); | ||
TCHAR FullFileName[MAX_PATH] = EMPTY_STRING; | ||
|
||
OPENFILENAME ofn; | ||
ofn.lStructSize = sizeof(ofn); | ||
ofn.hwndOwner = m_hDlg; | ||
ofn.lpstrFilter = Filter; | ||
ofn.lpstrCustomFilter = NULL; | ||
ofn.nMaxCustFilter = 0; | ||
ofn.nFilterIndex = 0; | ||
ofn.lpstrFile = FullFileName; | ||
ofn.nMaxFile = SIZEOF_ARRAY(FullFileName); | ||
ofn.lpstrFileTitle = NULL; | ||
ofn.nMaxFileTitle = 0; | ||
ofn.lpstrInitialDir = NULL; | ||
ofn.lpstrTitle = NULL; | ||
ofn.Flags = OFN_ENABLESIZING|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST; | ||
ofn.lpstrDefExt = _T("exe"); | ||
ofn.lCustData = NULL; | ||
ofn.lpfnHook = NULL; | ||
ofn.pvReserved = NULL; | ||
ofn.dwReserved = NULL; | ||
ofn.FlagsEx = NULL; | ||
|
||
BOOL bRet = GetOpenFileName(&ofn); | ||
|
||
if(bRet) | ||
{ | ||
SetDlgItemText(m_hDlg,IDC_APP_EDIT_COMMAND,FullFileName); | ||
} | ||
} | ||
|
||
void CApplicationToolbarButtonDialog::OnOk() | ||
{ | ||
/* TODO: Must not be empty. */ | ||
TCHAR Name[512]; | ||
GetDlgItemText(m_hDlg,IDC_APP_EDIT_NAME,Name,SIZEOF_ARRAY(Name)); | ||
|
||
TCHAR Command[512]; | ||
GetDlgItemText(m_hDlg,IDC_APP_EDIT_COMMAND,Command,SIZEOF_ARRAY(Command)); | ||
|
||
m_Button->Name = Name; | ||
m_Button->Command = Command; | ||
m_Button->ShowNameOnToolbar = IsDlgButtonChecked(m_hDlg,IDC_CHECK_SHOWAPPNAME) == BST_CHECKED; | ||
|
||
EndDialog(m_hDlg,1); | ||
} | ||
|
||
void CApplicationToolbarButtonDialog::OnCancel() | ||
{ | ||
EndDialog(m_hDlg,0); | ||
} | ||
|
||
INT_PTR CApplicationToolbarButtonDialog::OnClose() | ||
{ | ||
EndDialog(m_hDlg,0); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#ifndef APPLICATIONTOOLBARBUTTONDIALOG_INCLUDED | ||
#define APPLICATIONTOOLBARBUTTONDIALOG_INCLUDED | ||
|
||
#include "ApplicationToolbar.h" | ||
#include "../Helper/BaseDialog.h" | ||
#include "../Helper/DialogSettings.h" | ||
|
||
class CApplicationToolbarButtonDialog : public CBaseDialog | ||
{ | ||
public: | ||
|
||
CApplicationToolbarButtonDialog(HINSTANCE hInstance,int iResource,HWND hParent,ApplicationButton_t *Button,bool IsNew); | ||
~CApplicationToolbarButtonDialog(); | ||
|
||
protected: | ||
|
||
INT_PTR OnInitDialog(); | ||
INT_PTR OnCommand(WPARAM wParam,LPARAM lParam); | ||
INT_PTR OnClose(); | ||
|
||
private: | ||
|
||
void OnChooseFile(); | ||
|
||
void OnOk(); | ||
void OnCancel(); | ||
|
||
ApplicationButton_t *m_Button; | ||
bool m_IsNew; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.