[NEW] Add the GUI part of delimiter selection (Ctrl + Mouse Double Click).

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1081 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2013-07-22 00:27:33 +00:00
parent 9382bd3292
commit c47a5e7c1d
10 changed files with 159 additions and 14 deletions

View File

@ -203,7 +203,6 @@
<Item id="44032" name="Toggle Full Screen Mode"/> <Item id="44032" name="Toggle Full Screen Mode"/>
<Item id="44033" name="Restore Default Zoom"/> <Item id="44033" name="Restore Default Zoom"/>
<Item id="44034" name="Always on Top"/> <Item id="44034" name="Always on Top"/>
<Item id="44049" name="Summary..."/>
<Item id="44035" name="Synchronise Vertical Scrolling"/> <Item id="44035" name="Synchronise Vertical Scrolling"/>
<Item id="44036" name="Synchronise Horizontal Scrolling"/> <Item id="44036" name="Synchronise Horizontal Scrolling"/>
<Item id="44041" name="Show Wrap Symbol"/> <Item id="44041" name="Show Wrap Symbol"/>

View File

@ -203,7 +203,6 @@
<Item id="44032" name="Toggle Full Screen Mode"/> <Item id="44032" name="Toggle Full Screen Mode"/>
<Item id="44033" name="Restore Default Zoom"/> <Item id="44033" name="Restore Default Zoom"/>
<Item id="44034" name="Always on Top"/> <Item id="44034" name="Always on Top"/>
<Item id="44049" name="Summary..."/>
<Item id="44035" name="Synchronise Vertical Scrolling"/> <Item id="44035" name="Synchronise Vertical Scrolling"/>
<Item id="44036" name="Synchronise Horizontal Scrolling"/> <Item id="44036" name="Synchronise Horizontal Scrolling"/>
<Item id="44041" name="Show Wrap Symbol"/> <Item id="44041" name="Show Wrap Symbol"/>

View File

@ -5314,7 +5314,7 @@ Quote quotes[nbQuote] = {
{"Anonymous #99", "Mondays are not so bad.\nIt's your job that sucks."}, {"Anonymous #99", "Mondays are not so bad.\nIt's your job that sucks."},
{"Gandhi", "Earth provides enough to satisfy every man's need, but not every man's greed."}, {"Gandhi", "Earth provides enough to satisfy every man's need, but not every man's greed."},
{"R. D. Laing", "Life is a sexually transmitted disease and the mortality rate is one hundred percent."}, {"R. D. Laing", "Life is a sexually transmitted disease and the mortality rate is one hundred percent."},
{"Apple fan boy", "I'll buy a second iPhone 5 and buy a lot of iOS applications so that Apple will be able to buy Samsung (this shitty company) to shut it down and all the Apple haters will be forced to have an iPhone. Muhahaha..."}, {"Apple fan boy", "I'll buy a second iPhone 5 and buy a lot of iOS applications so that Apple will be able to buy Samsung (this shitty company)\nto shut it down and all the Apple haters will be forced to have an iPhone. Muhahaha..."},
{"Motherf*cker", "Thousands of my potential children died on your mother's face last night."}, {"Motherf*cker", "Thousands of my potential children died on your mother's face last night."},
{"Hustle Man", "Politicians are like sperm.\nOne in a million turn out to be an actual human being."}, {"Hustle Man", "Politicians are like sperm.\nOne in a million turn out to be an actual human being."},
{"Confucius", "It's good to meet girl in park.\nBut better to park meat in girl."}, {"Confucius", "It's good to meet girl in park.\nBut better to park meat in girl."},

View File

@ -561,11 +561,11 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
_replaceClosePos.left = p.x; _replaceClosePos.left = p.x;
_replaceClosePos.top = p.y; _replaceClosePos.top = p.y;
p = getLeftTopPoint(::GetDlgItem(_hSelf, IDREPLACEALL)); p = getTopPoint(::GetDlgItem(_hSelf, IDREPLACEALL));
_findInFilesClosePos.left = p.x; _findInFilesClosePos.left = p.x;
_findInFilesClosePos.top = p.y; _findInFilesClosePos.top = p.y;
p = getLeftTopPoint(::GetDlgItem(_hSelf, IDCANCEL)); p = getTopPoint(::GetDlgItem(_hSelf, IDCANCEL));
_findClosePos.left = p.x; _findClosePos.left = p.x;
_findClosePos.top = p.y + 10; _findClosePos.top = p.y + 10;

View File

@ -327,3 +327,19 @@ BEGIN
CONTROL "Always in multi-instance mode",IDC_MULTIINST_RADIO,"Button",BS_AUTORADIOBUTTON,123,87,218,10 CONTROL "Always in multi-instance mode",IDC_MULTIINST_RADIO,"Button",BS_AUTORADIOBUTTON,123,87,218,10
CONTROL "Default (mono-instance)",IDC_MONOINST_RADIO,"Button",BS_AUTORADIOBUTTON,123,106,196,10 CONTROL "Default (mono-instance)",IDC_MONOINST_RADIO,"Button",BS_AUTORADIOBUTTON,123,106,196,10
END END
IDD_PREFERENCE_DELIMITERSETTINGS_BOX DIALOGEX 0, 0, 455, 185
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Delimiter selection settings (Ctrl + Mouse double click)",IDC_DELIMITERSETTINGS_GB_STATIC,89,44,268,89,BS_CENTER
RTEXT "Open",IDD_STATIC_OPENDELIMITER,117,67,34,8
EDITTEXT IDC_EDIT_OPENDELIMITER,156,65,10,14
LTEXT "bla bla bla bla bla bla",IDD_STATIC_BLABLA,172,67,56,8
LTEXT "bla bla bla bla bla bla bla bla bla bla bla bla",IDD_STATIC_BLABLA2NDLINE,132,87,126,8
EDITTEXT IDC_EDIT_CLOSEDELIMITER,237,65,10,14
LTEXT "Close",IDD_STATIC_CLOSEDELIMITER,252,67,47,8
CONTROL "Allow on several lines",IDD_SEVERALLINEMODEON_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,109,160,10
END

View File

@ -136,6 +136,9 @@ BOOL CALLBACK PreferenceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
_multiInstDlg.init(_hInst, _hSelf); _multiInstDlg.init(_hInst, _hSelf);
_multiInstDlg.create(IDD_PREFERENCE_MULTIINSTANCE_BOX, false, false); _multiInstDlg.create(IDD_PREFERENCE_MULTIINSTANCE_BOX, false, false);
_delimiterSettingsDlg.init(_hInst, _hSelf);
_delimiterSettingsDlg.create(IDD_PREFERENCE_DELIMITERSETTINGS_BOX, false, false);
_wVector.push_back(DlgInfo(&_barsDlg, TEXT("General"), TEXT("Global"))); _wVector.push_back(DlgInfo(&_barsDlg, TEXT("General"), TEXT("Global")));
_wVector.push_back(DlgInfo(&_marginsDlg, TEXT("Editing"), TEXT("Scintillas"))); _wVector.push_back(DlgInfo(&_marginsDlg, TEXT("Editing"), TEXT("Scintillas")));
_wVector.push_back(DlgInfo(&_defaultNewDocDlg, TEXT("New Document"), TEXT("NewDoc"))); _wVector.push_back(DlgInfo(&_defaultNewDocDlg, TEXT("New Document"), TEXT("NewDoc")));
@ -148,6 +151,7 @@ BOOL CALLBACK PreferenceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
_wVector.push_back(DlgInfo(&_backupDlg, TEXT("Backup"), TEXT("Backup"))); _wVector.push_back(DlgInfo(&_backupDlg, TEXT("Backup"), TEXT("Backup")));
_wVector.push_back(DlgInfo(&_autoCompletionDlg, TEXT("Auto-Completion"), TEXT("AutoCompletion"))); _wVector.push_back(DlgInfo(&_autoCompletionDlg, TEXT("Auto-Completion"), TEXT("AutoCompletion")));
_wVector.push_back(DlgInfo(&_multiInstDlg, TEXT("Multi-Instance"), TEXT("MultiInstance"))); _wVector.push_back(DlgInfo(&_multiInstDlg, TEXT("Multi-Instance"), TEXT("MultiInstance")));
_wVector.push_back(DlgInfo(&_delimiterSettingsDlg, TEXT("Delimiter"), TEXT("Delimiter")));
_wVector.push_back(DlgInfo(&_settingsDlg, TEXT("MISC."), TEXT("MISC"))); _wVector.push_back(DlgInfo(&_settingsDlg, TEXT("MISC."), TEXT("MISC")));
@ -171,6 +175,7 @@ BOOL CALLBACK PreferenceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
_backupDlg.reSizeTo(rc); _backupDlg.reSizeTo(rc);
_autoCompletionDlg.reSizeTo(rc); _autoCompletionDlg.reSizeTo(rc);
_multiInstDlg.reSizeTo(rc); _multiInstDlg.reSizeTo(rc);
_delimiterSettingsDlg.reSizeTo(rc);
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters *pNppParam = NppParameters::getInstance();
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture();
@ -287,6 +292,7 @@ void PreferenceDlg::destroy()
_backupDlg.destroy(); _backupDlg.destroy();
_autoCompletionDlg.destroy(); _autoCompletionDlg.destroy();
_multiInstDlg.destroy(); _multiInstDlg.destroy();
_delimiterSettingsDlg.destroy();
} }
BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
@ -2402,6 +2408,7 @@ BOOL CALLBACK MultiInstDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_MONOINST_RADIO, BM_SETCHECK, multiInstSetting == monoInst?BST_CHECKED:BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_MONOINST_RADIO, BM_SETCHECK, multiInstSetting == monoInst?BST_CHECKED:BST_UNCHECKED, 0);
} }
break; break;
case WM_COMMAND : case WM_COMMAND :
{ {
switch (wParam) switch (wParam)
@ -2432,3 +2439,102 @@ BOOL CALLBACK MultiInstDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
return FALSE; return FALSE;
} }
BOOL CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
{
NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI());
switch (Message)
{
case WM_INITDIALOG :
{
TCHAR opener[2];
opener[0] = nppGUI._leftmostDelimiter;
opener[1] = '\0';
TCHAR closer[2];
closer[0] = nppGUI._rightmostDelimiter;
closer[1] = '\0';
bool onSeveralLines = nppGUI._delimiterSelectionOnEntireDocument;
::SendDlgItemMessage(_hSelf, IDC_EDIT_OPENDELIMITER, EM_LIMITTEXT, 1, 0);
::SendDlgItemMessage(_hSelf, IDC_EDIT_CLOSEDELIMITER, EM_LIMITTEXT, 1, 0);
::SendDlgItemMessage(_hSelf, IDC_EDIT_OPENDELIMITER, WM_SETTEXT, 0, (LPARAM)opener);
::SendDlgItemMessage(_hSelf, IDC_EDIT_CLOSEDELIMITER, WM_SETTEXT, 0, (LPARAM)closer);
::SendDlgItemMessage(_hSelf, IDD_SEVERALLINEMODEON_CHECK, BM_SETCHECK, onSeveralLines?BST_CHECKED:BST_UNCHECKED, 0);
POINT point = getTopPoint(::GetDlgItem(_hSelf, IDD_STATIC_BLABLA), false);
_singleLineModePoint.x = point.x + 4;
_singleLineModePoint.y = point.y - 4;
point = getTopPoint(::GetDlgItem(_hSelf, IDD_STATIC_BLABLA2NDLINE), false);
_multiLineModePoint.x = point.x + 4;
_multiLineModePoint.y = point.y - 4;
::GetClientRect(::GetDlgItem(_hSelf, IDC_EDIT_CLOSEDELIMITER), &_closerRect);
_closerRect.right = _closerRect.right - _closerRect.left + 4;
_closerRect.bottom = _closerRect.bottom - _closerRect.top + 4;
::GetClientRect(::GetDlgItem(_hSelf, IDD_STATIC_CLOSEDELIMITER), &_closerLabelRect);
_closerLabelRect.right = _closerLabelRect.right - _closerLabelRect.left + 4;
_closerLabelRect.bottom = _closerLabelRect.bottom - _closerLabelRect.top + 4;
::ShowWindow(::GetDlgItem(_hSelf, IDD_STATIC_BLABLA2NDLINE),onSeveralLines?SW_SHOW:SW_HIDE);
POINT *p = onSeveralLines?&_multiLineModePoint:&_singleLineModePoint;
::MoveWindow(::GetDlgItem(_hSelf, IDC_EDIT_CLOSEDELIMITER), p->x, p->y, _closerRect.right, _closerRect.bottom, TRUE);
::MoveWindow(::GetDlgItem(_hSelf, IDD_STATIC_CLOSEDELIMITER), p->x + _closerRect.right + 4, p->y + 4, _closerLabelRect.right, _closerLabelRect.bottom, TRUE);
return TRUE;
}
case WM_COMMAND :
{
if (HIWORD(wParam) == EN_CHANGE)
{
switch (LOWORD(wParam))
{
case IDC_EDIT_OPENDELIMITER:
{
TCHAR opener[2];
::SendDlgItemMessage(_hSelf, IDC_EDIT_OPENDELIMITER, WM_GETTEXT, MAX_PATH, (LPARAM)opener);
nppGUI._leftmostDelimiter = static_cast<char>(opener[0]);
return TRUE;
}
case IDC_EDIT_CLOSEDELIMITER:
{
TCHAR closer[2];
::SendDlgItemMessage(_hSelf, IDC_EDIT_CLOSEDELIMITER, WM_GETTEXT, MAX_PATH, (LPARAM)closer);
nppGUI._rightmostDelimiter = static_cast<char>(closer[0]);
return TRUE;
}
default:
return FALSE;
}
}
switch (wParam)
{
case IDD_SEVERALLINEMODEON_CHECK :
{
bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDD_SEVERALLINEMODEON_CHECK, BM_GETCHECK, 0, 0));
nppGUI._delimiterSelectionOnEntireDocument = isChecked;
::ShowWindow(::GetDlgItem(_hSelf, IDD_STATIC_BLABLA2NDLINE),isChecked?SW_SHOW:SW_HIDE);
POINT *p = isChecked?&_multiLineModePoint:&_singleLineModePoint;
::MoveWindow(::GetDlgItem(_hSelf, IDC_EDIT_CLOSEDELIMITER), p->x, p->y, _closerRect.right, _closerRect.bottom, TRUE);
::MoveWindow(::GetDlgItem(_hSelf, IDD_STATIC_CLOSEDELIMITER), p->x + _closerRect.right + 4, p->y + 4, _closerLabelRect.right, _closerLabelRect.bottom, TRUE);
return TRUE;
}
default :
return FALSE;
}
}
break;
}
return FALSE;
}

View File

@ -202,6 +202,17 @@ private :
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
}; };
class DelimiterSettingsDlg : public StaticDialog
{
public :
DelimiterSettingsDlg() {};
private :
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
POINT _singleLineModePoint, _multiLineModePoint;
RECT _closerRect, _closerLabelRect;
};
class PreferenceDlg : public StaticDialog class PreferenceDlg : public StaticDialog
{ {
friend class NativeLangSpeaker; friend class NativeLangSpeaker;
@ -249,6 +260,7 @@ private :
BackupDlg _backupDlg; BackupDlg _backupDlg;
AutoCompletionDlg _autoCompletionDlg; AutoCompletionDlg _autoCompletionDlg;
MultiInstDlg _multiInstDlg; MultiInstDlg _multiInstDlg;
DelimiterSettingsDlg _delimiterSettingsDlg;
}; };

View File

@ -110,6 +110,16 @@
#define IDC_BORDERWIDTHVAL_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 32) #define IDC_BORDERWIDTHVAL_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 32)
#define IDC_BORDERWIDTH_SLIDER (IDD_PREFERENCE_MARGEIN_BOX + 33) #define IDC_BORDERWIDTH_SLIDER (IDD_PREFERENCE_MARGEIN_BOX + 33)
#define IDD_PREFERENCE_DELIMITERSETTINGS_BOX 6250 //(IDD_PREFERENCE_BOX + 250)
#define IDC_DELIMITERSETTINGS_GB_STATIC (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 1)
#define IDD_STATIC_OPENDELIMITER (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 2)
#define IDC_EDIT_OPENDELIMITER (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 3)
#define IDC_EDIT_CLOSEDELIMITER (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 4)
#define IDD_STATIC_CLOSEDELIMITER (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 5)
#define IDD_SEVERALLINEMODEON_CHECK (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 6)
#define IDD_STATIC_BLABLA (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 7)
#define IDD_STATIC_BLABLA2NDLINE (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 8)
#define IDD_PREFERENCE_SETTING_BOX 6300 //(IDD_PREFERENCE_BOX + 300) #define IDD_PREFERENCE_SETTING_BOX 6300 //(IDD_PREFERENCE_BOX + 300)
#define IDC_TABSETTING_GB_STATIC (IDD_PREFERENCE_SETTING_BOX + 1) #define IDC_TABSETTING_GB_STATIC (IDD_PREFERENCE_SETTING_BOX + 1)
#define IDC_CHECK_REPLACEBYSPACE (IDD_PREFERENCE_SETTING_BOX + 2) #define IDC_CHECK_REPLACEBYSPACE (IDD_PREFERENCE_SETTING_BOX + 2)

View File

@ -71,11 +71,14 @@ public :
void display(bool toShow = true) const; void display(bool toShow = true) const;
POINT getLeftTopPoint(HWND hwnd/*, POINT & p*/) const { POINT getTopPoint(HWND hwnd, bool isLeft = true) const {
RECT rc; RECT rc;
::GetWindowRect(hwnd, &rc); ::GetWindowRect(hwnd, &rc);
POINT p; POINT p;
p.x = rc.left; if (isLeft)
p.x = rc.left;
else
p.x = rc.right;
p.y = rc.top; p.y = rc.top;
::ScreenToClient(_hSelf, &p); ::ScreenToClient(_hSelf, &p);
return p; return p;

File diff suppressed because one or more lines are too long