[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),\ _pXmlShortcutDoc(NULL), _pXmlContextMenuDoc(NULL), _pXmlSessionDoc(NULL),\
_nbUserLang(0), _hUser32(NULL), _hUXTheme(NULL),\ _nbUserLang(0), _hUser32(NULL), _hUXTheme(NULL),\
_transparentFuncAddr(NULL), _enableThemeDialogTextureFuncAddr(NULL),\ _transparentFuncAddr(NULL), _enableThemeDialogTextureFuncAddr(NULL),\
_isTaskListRBUTTONUP_Active(false) _isTaskListRBUTTONUP_Active(false), _fileSaveDlgFilterIndex(-1)
{ {
_appdataNppDir[0] = '\0'; _appdataNppDir[0] = '\0';
} }

View File

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

View File

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

View File

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