[ENHANCEMENT] New auto-add extension behaviour :

the chosen filter is remembered on the next launch.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@56 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2007-10-20 14:10:42 +00:00
parent 798ffa148e
commit 681bb5943a
4 changed files with 27 additions and 7 deletions

View File

@ -30,7 +30,7 @@ NppParameters::NppParameters() : _pXmlDoc(NULL),_pXmlUserDoc(NULL), _pXmlUserSty
_pXmlShortcutDoc(NULL), _pXmlContextMenuDoc(NULL), _pXmlSessionDoc(NULL),\
_nbUserLang(0), _hUser32(NULL), _hUXTheme(NULL),\
_transparentFuncAddr(NULL), _enableThemeDialogTextureFuncAddr(NULL),\
_isTaskListRBUTTONUP_Active(false)
_isTaskListRBUTTONUP_Active(false), _fileSaveDlgFilterIndex(-1)
{
_appdataNppDir[0] = '\0';
}

View File

@ -895,6 +895,9 @@ public:
void setIsNoPlugin(bool noPlugin) {_noPlugin = noPlugin;};
bool isNoPlugin() const {return _noPlugin;};
void setFileSaveDlgFilterIndex(int ln) {_fileSaveDlgFilterIndex = ln;};
int getFileSaveDlgFilterIndex() const {return _fileSaveDlgFilterIndex;};
bool isRemappingShortcut() const {return _shortcuts.size() != 0;};
vector<CommandShortcut> & getUserShortcuts() {return _shortcuts;};
@ -1004,6 +1007,8 @@ private:
int _lineNumber2Go;
bool _noPlugin;
int _fileSaveDlgFilterIndex;
// All Styles (colours & fonts)
LexerStylerArray _lexerStylerArray;
StyleArray _widgetStyleArray;

View File

@ -271,16 +271,20 @@ UINT_PTR CALLBACK FileDialog::OFNHookProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
{
case WM_INITDIALOG :
{
NppParameters *pNppParam = NppParameters::getInstance();
int index = pNppParam->getFileSaveDlgFilterIndex();
::SetWindowLong(hWnd, GWL_USERDATA, (long)staticThis);
hFileDlg = ::GetParent(hWnd);
goToCenter(hFileDlg);
/*if (staticThis->_initIndex != -1)
if (index != -1)
{
HWND typeControl = ::GetDlgItem(hFileDlg, cmb1);
::SendMessage(typeControl, CB_SETCURSEL, staticThis->_initIndex, 0);
HWND fnControl = ::GetDlgItem(hFileDlg, edt1);
currentExt = addExt(fnControl, typeControl);
}*/
::SendMessage(typeControl, CB_SETCURSEL, index, 0);
//HWND fnControl = ::GetDlgItem(hFileDlg, edt1);
//currentExt = addExt(fnControl, typeControl);
}
oldProc = (WNDPROC)::SetWindowLong(hFileDlg, GWL_WNDPROC, (LONG)fileDlgProc);
return FALSE;
}
@ -295,6 +299,7 @@ UINT_PTR CALLBACK FileDialog::OFNHookProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
}
return FALSE;
}
BOOL APIENTRY FileDialog::run(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
@ -312,6 +317,16 @@ BOOL APIENTRY FileDialog::run(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
break;
}
case CDN_FILEOK :
{
HWND typeControl = ::GetDlgItem(::GetParent(hWnd), cmb1);
int index = ::SendMessage(typeControl, CB_GETCURSEL, 0, 0);
NppParameters *pNppParam = NppParameters::getInstance();
pNppParam->setFileSaveDlgFilterIndex(index);
break;
}
default :
return FALSE;
}

View File

@ -25,6 +25,7 @@
#include <vector>
#include <string>
#include "SysMsg.h"
#include "Parameters.h"
const int nbExtMax = 256;
const int extLenMax = 64;
@ -105,7 +106,6 @@ private:
char _extArray[nbExtMax][extLenMax];
int _nbExt;
//int _initIndex;
static FileDialog *staticThis;
};