Browse Source

[NEW_FEATURE] Change the behaviour of Styles Configurator :

1. Remove "Apply" button.
2. Cancel to restore the old setting.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@20 f5eea248-9336-0410-98b8-ebc06183d4e3
pull/343/head^2
donho 17 years ago
parent
commit
7047f34cb0
  1. BIN
      PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.aps
  2. 37
      PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp
  3. 18
      PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h
  4. 2
      PowerEditor/src/WinControls/Preference/preference.rc
  5. 3
      PowerEditor/src/WinControls/Preference/preferenceDlg.cpp

BIN
PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.aps

Binary file not shown.

37
PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp

@ -65,7 +65,6 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
_lsArray = (NppParameters::getInstance())->getLStylerArray();
_globalStyles = (NppParameters::getInstance())->getGlobalStylers();
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, (LPARAM)"Global Styles");
// All the lexers
for (int i = 0 ; i < _lsArray.getNbLexer() ; i++)
@ -190,18 +189,28 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
break;
case IDCANCEL :
if (_isDirty)
{
_lsArray = (NppParameters::getInstance())->getLStylerArray();
_globalStyles = (NppParameters::getInstance())->getGlobalStylers();
_isDirty = false;
setVisualFromStyleList();
}
::EnableWindow(::GetDlgItem(_hSelf, IDOK), FALSE);
::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), !_isSync);
display(false);
return TRUE;
//::MessageBox(NULL, "cancel", "", MB_OK);
if (_isDirty)
{
//::MessageBox(NULL, "dirty", "", MB_OK);
LexerStylerArray & lsArray = (NppParameters::getInstance())->getLStylerArray();
StyleArray & globalStyles = (NppParameters::getInstance())->getGlobalStylers();
globalStyles = _globalStyles = _gstyles2restored;
lsArray = _lsArray = _styles2restored;
_isDirty = false;
setVisualFromStyleList();
::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0);
}
//else
//::MessageBox(NULL, "no dirty", "", MB_OK);
//::EnableWindow(::GetDlgItem(_hSelf, IDOK), FALSE);
::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), !_isSync);
display(false);
return TRUE;
/*
case IDOK : //_isDirty == true;
{
LexerStylerArray & lsa = (NppParameters::getInstance())->getLStylerArray();
@ -216,7 +225,7 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0);
return TRUE;
}
*/
case IDC_SAVECLOSE_BUTTON :
{
if (_isDirty)
@ -690,7 +699,7 @@ void WordStyleDlg::apply()
globalStyles = _globalStyles;
::EnableWindow(::GetDlgItem(_hSelf, IDOK), FALSE);
_isDirty = false;
//_isDirty = false;
_isSync = false;
::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0);
}

18
PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h

@ -74,14 +74,25 @@ public :
void doDialog(bool isRTL = false) {
if (!isCreated())
{
create(IDD_STYLER_DLG, isRTL);
_styles2restored = (NppParameters::getInstance())->getLStylerArray();
_gstyles2restored = (NppParameters::getInstance())->getGlobalStylers();
//::MessageBox(NULL, "", "gogogogo", MB_OK);
}
if (!::IsWindowVisible(_hSelf))
{
_styles2restored = (NppParameters::getInstance())->getLStylerArray();
_gstyles2restored = (NppParameters::getInstance())->getGlobalStylers();
//::MessageBox(NULL, "", "gogogogo", MB_OK);
}
display();
};
virtual void redraw() const {
_pFgColour->redraw();
_pBgColour->redraw();
//StaticDialog::redraw();
::InvalidateRect(_hStyleInfoStaticText, NULL, TRUE);
::UpdateWindow(_hStyleInfoStaticText);
};
@ -112,6 +123,9 @@ private :
LexerStylerArray _lsArray;
StyleArray _globalStyles;
LexerStylerArray _styles2restored;
StyleArray _gstyles2restored;
ColourStaticTextHooker colourHooker;
bool _isDirty;
@ -166,7 +180,7 @@ private :
};
long notifyDataModified() {
_isDirty = true;
::EnableWindow(::GetDlgItem(_hSelf, IDOK), TRUE);
//::EnableWindow(::GetDlgItem(_hSelf, IDOK), TRUE);
::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), TRUE);
return TRUE;
}

2
PowerEditor/src/WinControls/Preference/preference.rc

@ -176,7 +176,7 @@ BEGIN
CTEXT "Top",IDC_MT_STATIC,197,46,54,8
LTEXT "Right",IDC_MR_STATIC,257,78,29,8
CTEXT "Bottom",IDC_MB_STATIC,197,111,54,8
GROUPBOX "Marge Setting (Unit:mm)",IDC_MARGESETTINGS_STATIC,153,
GROUPBOX "Margin Setting (Unit:mm)",IDC_MARGESETTINGS_STATIC,153,
32,144,96,BS_CENTER
END

3
PowerEditor/src/WinControls/Preference/preferenceDlg.cpp

@ -31,6 +31,7 @@ BOOL CALLBACK PreferenceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
_printSettingsDlg.init(_hInst, _hSelf);
_printSettingsDlg.create(IDD_PREFERENCE_PRINT_BOX);
_printSettings2Dlg.init(_hInst, _hSelf);
_printSettings2Dlg.create(IDD_PREFERENCE_PRINT2_BOX);
@ -45,7 +46,7 @@ BOOL CALLBACK PreferenceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
_wVector.push_back(DlgInfo(&_defaultNewDocDlg, "New Document", "NewDoc"));
_wVector.push_back(DlgInfo(&_fileAssocDlg, "File Association", "FileAssoc"));
_wVector.push_back(DlgInfo(&_langMenuDlg, "Language Menu", "LangMenu"));
_wVector.push_back(DlgInfo(&_printSettingsDlg, "Print - Colour and Marge", "Print1"));
_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(&_settingsDlg, "MISC", "MISC"));

Loading…
Cancel
Save