[NEW_FEATURE] Trigger Auto-Completion automatically (Not yet finished).
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@29 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
1388b2282b
commit
8d99c62d5f
@ -1840,8 +1840,16 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
||||
}
|
||||
|
||||
case SCN_CHARADDED:
|
||||
{
|
||||
charAdded(static_cast<char>(notification->ch));
|
||||
const NppGUI & nppGUI = NppParameters::getInstance()->getNppGUI();
|
||||
if (nppGUI._autocStatus == nppGUI.autoc_word)
|
||||
autoCompFromCurrentFile();
|
||||
else if (nppGUI._autocStatus == nppGUI.autoc_func)
|
||||
showAutoComp();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SCN_UPDATEUI:
|
||||
braceMatch();
|
||||
|
@ -542,6 +542,8 @@ struct NppGUI
|
||||
char _backupDir[MAX_PATH];
|
||||
DockingManagerData _dockingData;
|
||||
GlobalOverride _globalOverride;
|
||||
enum AutocStatus{autoc_none, autoc_func, autoc_word};
|
||||
AutocStatus _autocStatus;
|
||||
};
|
||||
|
||||
struct ScintillaViewParams
|
||||
|
@ -226,12 +226,18 @@ IDD_PREFERENCE_BACKUP_BOX DIALOGEX 0, 0, 305, 147
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "None",IDC_RADIO_BKNONE,"Button",BS_AUTORADIOBUTTON,34,19,87,10
|
||||
CONTROL "Simple Backup",IDC_RADIO_BKSIMPLE,"Button",BS_AUTORADIOBUTTON,34,31,111,10
|
||||
CONTROL "Verbose Backup",IDC_RADIO_BKVERBOSE,"Button",BS_AUTORADIOBUTTON,34,43,111,10
|
||||
GROUPBOX "User custom backup directory",IDC_BACKUPDIRGRP_STATIC,25,65,260,51
|
||||
CONTROL "",IDC_BACKUPDIR_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,21,65,8,10
|
||||
RTEXT "Directory :",IDD_BACKUPDIR_STATIC,29,87,40,8
|
||||
EDITTEXT IDC_BACKUPDIR_EDIT,76,85,179,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "...",IDD_BACKUPDIR_BROWSE_BUTTON,262,85,16,14
|
||||
GROUPBOX "Backup",IDC_STATIC,9,0,289,83,BS_CENTER
|
||||
CONTROL "None",IDC_RADIO_BKNONE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,34,10,87,10
|
||||
CONTROL "Simple Backup",IDC_RADIO_BKSIMPLE,"Button",BS_AUTORADIOBUTTON,158,10,111,10
|
||||
CONTROL "Verbose Backup",IDC_RADIO_BKVERBOSE,"Button",BS_AUTORADIOBUTTON,158,24,111,10
|
||||
GROUPBOX "User custom backup directory",IDC_BACKUPDIR_USERCUSTOMDIR_GRPSTATIC,25,36,260,40
|
||||
CONTROL "",IDC_BACKUPDIR_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,21,36,8,10
|
||||
RTEXT "Directory :",IDD_BACKUPDIR_STATIC,29,53,40,8
|
||||
EDITTEXT IDC_BACKUPDIR_EDIT,76,51,179,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "...",IDD_BACKUPDIR_BROWSE_BUTTON,262,51,16,14
|
||||
GROUPBOX "Auto-completion",IDD_AUTOC_GRPSTATIC,9,89,289,56,BS_CENTER
|
||||
CONTROL "Enable Auto-completion on each input",IDD_AUTOC_ENABLECHECK, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,24,99,141,10
|
||||
CONTROL "Function completion",IDD_AUTOC_FUNCRADIO,"Button",BS_AUTORADIOBUTTON | WS_GROUP,41,114,145,10
|
||||
CONTROL "Word completion",IDD_AUTOC_WORDRADIO,"Button",BS_AUTORADIOBUTTON,41,130,145,10
|
||||
END
|
||||
|
||||
|
@ -48,7 +48,7 @@ BOOL CALLBACK PreferenceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
|
||||
_wVector.push_back(DlgInfo(&_langMenuDlg, "Language Menu", "LangMenu"));
|
||||
_wVector.push_back(DlgInfo(&_printSettingsDlg, "Print - Colour and Margin", "Print1"));
|
||||
_wVector.push_back(DlgInfo(&_printSettings2Dlg, "Print - Header and Footer", "Print2"));
|
||||
_wVector.push_back(DlgInfo(&_backupDlg, "Backup", "Backup"));
|
||||
_wVector.push_back(DlgInfo(&_backupDlg, "Backup/Auto-completion", "Backup"));
|
||||
_wVector.push_back(DlgInfo(&_settingsDlg, "MISC", "MISC"));
|
||||
_ctrlTab.createTabs(_wVector);
|
||||
_ctrlTab.display();
|
||||
@ -1192,7 +1192,6 @@ BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
case WM_INITDIALOG :
|
||||
{
|
||||
|
||||
int ID2Check = 0;
|
||||
|
||||
switch (nppGUI._backup)
|
||||
@ -1214,7 +1213,17 @@ BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_EDIT, WM_SETTEXT, 0, (LPARAM)nppGUI._backupDir);
|
||||
|
||||
updateGUI();
|
||||
bool isEnableAutoC = nppGUI._autocStatus != nppGUI.autoc_none;
|
||||
|
||||
::SendDlgItemMessage(_hSelf, IDD_AUTOC_ENABLECHECK, BM_SETCHECK, isEnableAutoC?BST_CHECKED:BST_UNCHECKED, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDD_AUTOC_FUNCRADIO, BM_SETCHECK, nppGUI._autocStatus == nppGUI.autoc_func?BST_CHECKED:BST_UNCHECKED, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDD_AUTOC_WORDRADIO, BM_SETCHECK, nppGUI._autocStatus == nppGUI.autoc_word?BST_CHECKED:BST_UNCHECKED, 0);
|
||||
if (!isEnableAutoC)
|
||||
{
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_FUNCRADIO), FALSE);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_WORDRADIO), FALSE);
|
||||
}
|
||||
updateBackupGUI();
|
||||
return TRUE;
|
||||
}
|
||||
case WM_COMMAND :
|
||||
@ -1238,28 +1247,28 @@ BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
case IDC_RADIO_BKSIMPLE:
|
||||
{
|
||||
nppGUI._backup = bak_simple;
|
||||
updateGUI();
|
||||
updateBackupGUI();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case IDC_RADIO_BKVERBOSE:
|
||||
{
|
||||
nppGUI._backup = bak_verbose;
|
||||
updateGUI();
|
||||
updateBackupGUI();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case IDC_RADIO_BKNONE:
|
||||
{
|
||||
nppGUI._backup = bak_none;
|
||||
updateGUI();
|
||||
updateBackupGUI();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case IDC_BACKUPDIR_CHECK:
|
||||
{
|
||||
nppGUI._useDir = !nppGUI._useDir;
|
||||
updateGUI();
|
||||
updateBackupGUI();
|
||||
return TRUE;
|
||||
}
|
||||
case IDD_BACKUPDIR_BROWSE_BUTTON :
|
||||
@ -1268,6 +1277,38 @@ BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case IDD_AUTOC_ENABLECHECK :
|
||||
{
|
||||
bool isEnableAutoC = BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDD_AUTOC_ENABLECHECK, BM_GETCHECK, 0, 0);
|
||||
|
||||
if (isEnableAutoC)
|
||||
{
|
||||
::SendDlgItemMessage(_hSelf, IDD_AUTOC_FUNCRADIO, BM_SETCHECK, BST_CHECKED, 0);
|
||||
nppGUI._autocStatus = nppGUI.autoc_func;
|
||||
}
|
||||
else
|
||||
{
|
||||
::SendDlgItemMessage(_hSelf, IDD_AUTOC_FUNCRADIO, BM_SETCHECK, BST_UNCHECKED, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDD_AUTOC_WORDRADIO, BM_SETCHECK, BST_UNCHECKED, 0);
|
||||
nppGUI._autocStatus = nppGUI.autoc_none;
|
||||
}
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_FUNCRADIO), isEnableAutoC);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_WORDRADIO), isEnableAutoC);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case IDD_AUTOC_FUNCRADIO :
|
||||
{
|
||||
nppGUI._autocStatus = nppGUI.autoc_func;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case IDD_AUTOC_WORDRADIO :
|
||||
{
|
||||
nppGUI._autocStatus = nppGUI.autoc_word;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
default :
|
||||
return FALSE;
|
||||
}
|
||||
@ -1277,7 +1318,7 @@ BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void BackupDlg::updateGUI()
|
||||
void BackupDlg::updateBackupGUI()
|
||||
{
|
||||
bool noBackup = BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_RADIO_BKNONE, BM_GETCHECK, 0, 0);
|
||||
bool isEnableGlobableCheck = false;
|
||||
@ -1288,7 +1329,7 @@ void BackupDlg::updateGUI()
|
||||
isEnableGlobableCheck = true;
|
||||
isEnableLocalCheck = BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_CHECK, BM_GETCHECK, 0, 0);
|
||||
}
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_BACKUPDIRGRP_STATIC), isEnableGlobableCheck);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_BACKUPDIR_USERCUSTOMDIR_GRPSTATIC), isEnableGlobableCheck);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_BACKUPDIR_CHECK), isEnableGlobableCheck);
|
||||
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDD_BACKUPDIR_STATIC), isEnableLocalCheck);
|
||||
|
@ -106,7 +106,7 @@ class BackupDlg : public StaticDialog
|
||||
public :
|
||||
BackupDlg() {};
|
||||
private :
|
||||
void updateGUI();
|
||||
void updateBackupGUI();
|
||||
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
||||
};
|
||||
|
||||
|
@ -153,8 +153,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
#define IDD_PREFERENCE_BACKUP_BOX 6800 //(IDD_PREFERENCE_BOX + 800)
|
||||
#define IDC_BACKUPDIRGRP_STATIC (IDD_PREFERENCE_BACKUP_BOX + 1)
|
||||
#define IDC_BACKUPDIR_GRP_STATIC (IDD_PREFERENCE_BACKUP_BOX + 1)
|
||||
#define IDC_BACKUPDIR_CHECK (IDD_PREFERENCE_BACKUP_BOX + 2)
|
||||
#define IDD_BACKUPDIR_STATIC (IDD_PREFERENCE_BACKUP_BOX + 3)
|
||||
#define IDC_BACKUPDIR_EDIT (IDD_PREFERENCE_BACKUP_BOX + 4)
|
||||
#define IDD_BACKUPDIR_BROWSE_BUTTON (IDD_PREFERENCE_BACKUP_BOX + 5)
|
||||
#define IDC_BACKUPDIR_USERCUSTOMDIR_GRPSTATIC (IDD_PREFERENCE_BACKUP_BOX + 4)
|
||||
#define IDC_BACKUPDIR_EDIT (IDD_PREFERENCE_BACKUP_BOX + 5)
|
||||
#define IDD_BACKUPDIR_BROWSE_BUTTON (IDD_PREFERENCE_BACKUP_BOX + 6)
|
||||
#define IDD_AUTOC_GRPSTATIC (IDD_PREFERENCE_BACKUP_BOX + 7)
|
||||
#define IDD_AUTOC_ENABLECHECK (IDD_PREFERENCE_BACKUP_BOX + 8)
|
||||
#define IDD_AUTOC_FUNCRADIO (IDD_PREFERENCE_BACKUP_BOX + 9)
|
||||
#define IDD_AUTOC_WORDRADIO (IDD_PREFERENCE_BACKUP_BOX + 10)
|
||||
|
@ -580,6 +580,10 @@
|
||||
RelativePath="..\src\resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\WinControls\Preference\resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\WinControls\StaticDialog\RunDlg\RunDlg.h"
|
||||
>
|
||||
|
Loading…
Reference in New Issue
Block a user