Browse Source

[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
remotes/patch_testing@481
Don Ho 17 years ago
parent
commit
69a2054a32
  1. 2
      PowerEditor/src/Parameters.cpp
  2. 5
      PowerEditor/src/Parameters.h
  3. 25
      PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.cpp
  4. 2
      PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.h

2
PowerEditor/src/Parameters.cpp

@ -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';
}

5
PowerEditor/src/Parameters.h

@ -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;

25
PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.cpp

@ -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;
}

2
PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.h

@ -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;
};

Loading…
Cancel
Save