Browse Source

[ENHANCEMENT] Add button tips in function list.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1138 f5eea248-9336-0410-98b8-ebc06183d4e3
remotes/trunk
Don Ho 11 years ago
parent
commit
a171d5fbdc
  1. 7
      PowerEditor/installer/nativeLang/chinese.xml
  2. 7
      PowerEditor/installer/nativeLang/english.xml
  3. 7
      PowerEditor/installer/nativeLang/french.xml
  4. 10
      PowerEditor/src/Notepad_plus.cpp
  5. 24
      PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp
  6. 14
      PowerEditor/src/WinControls/FunctionList/functionListPanel.h
  7. 64
      PowerEditor/src/localization.cpp
  8. 2
      PowerEditor/src/localization.h

7
PowerEditor/installer/nativeLang/chinese.xml

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="Big5"?>
<NotepadPlus>
<Native-Langue name="中文繁體" filename="chinese.xml" >
<Native-Langue name="中文繁體" filename="chinese.xml" version="6.5.1">
<Menu>
<Main>
<!-- Main Menu Entries -->
@ -777,6 +777,11 @@
<FileAlreadyOpenedInNpp title="" message="The file is already opened in the Notepad++."/>
<DeleteFileFailed title="Delete File" message="Delete File failed"/>
</MessageBox>
<FunctionList>
<PanelTitle name="函數功能明細單"/>
<SortTip name="排序" />
<ReloadTip name="重新載入" />
</FunctionList>
<ProjectManager>
<PanelTitle name="計劃專案"/>
<WorkspaceRootName name="工作區"/>

7
PowerEditor/installer/nativeLang/english.xml

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="Windows-1252" ?>
<NotepadPlus>
<Native-Langue name="English" filename="english.xml" >
<Native-Langue name="English" filename="english.xml" version="6.5.1">
<Menu>
<Main>
<!-- Main Menu Entries -->
@ -777,6 +777,11 @@
<!-- $INT_REPLACE$ is a place holder, don't translate it -->
<NbFileToOpenImportantWarning title="Amount of files to open is too large" message="$INT_REPLACE$ files are about to be opened.\rAre you sure to open them?"/>
</MessageBox>
<FunctionList>
<PanelTitle name="Function List"/>
<SortTip name="Sort" />
<ReloadTip name="Reload" />
</FunctionList>
<ProjectManager>
<PanelTitle name="Project"/>
<WorkspaceRootName name="Workspace"/>

7
PowerEditor/installer/nativeLang/french.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252" ?>
<!-- Version française adaptée pour NOTEPAD++ V6.1.5 -->
<NotepadPlus>
<Native-Langue name="Français" filename="french.xml" >
<Native-Langue name="Français" filename="french.xml" version="6.5.1">
<Menu>
<Main>
<!-- Main Menu Entries -->
@ -798,6 +798,11 @@
<NppHelpAbsentWarning title="Le fichier n'existe pas" message=" n'existe pas. S'il vous plaît, le télécharger sur le site de Notepad++."/>
<SaveCurrentModifWarning title="Sauvegarder la modification en cours" message="Vous devez enregistrer la modification en cours. Toutes les modifications enregistrées ne peuvent pas être annulées. Continuer?"/>
</MessageBox>
<FunctionList>
<PanelTitle name="Liste des Fonctions"/>
<SortTip name="Trier" />
<ReloadTip name="Recharger" />
</FunctionList>
<ProjectManager>
<PanelTitle name="Projet"/>
<WorkspaceRootName name="Espace de travail"/>

10
PowerEditor/src/Notepad_plus.cpp

@ -5196,6 +5196,16 @@ void Notepad_plus::launchFunctionList()
// In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog
data.dlgID = IDM_VIEW_FUNC_LIST;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string title_temp = pNativeSpeaker->getFunctionListPanelLangStr("PanelTitle", FL_PANELTITLE);
static TCHAR title[32];
if (title_temp.length() < 32)
{
lstrcpy(title, title_temp.c_str());
data.pszName = title;
}
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, (LPARAM)&data);
}
_pFuncList->display();

24
PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp

@ -29,6 +29,7 @@
#include "precompiledHeaders.h"
#include "functionListPanel.h"
#include "ScintillaEditView.h"
#include "localization.h"
#define CX_BITMAP 16
#define CY_BITMAP 16
@ -374,7 +375,21 @@ bool FunctionListPanel::openSelection(const TreeView & treeView)
void FunctionListPanel::notified(LPNMHDR notification)
{
if (notification->hwndFrom == _treeView.getHSelf() || notification->hwndFrom == this->_treeViewSearchResult.getHSelf())
if (notification->code == TTN_GETDISPINFO)
{
LPTOOLTIPTEXT lpttt = (LPTOOLTIPTEXT)notification;
lpttt->hinst = NULL;
if (notification->idFrom == IDC_SORTBUTTON_FUNCLIST)
{
lstrcpy(lpttt->szText, _sortTipStr.c_str());
}
else if (notification->idFrom == IDC_RELOADBUTTON_FUNCLIST)
{
lstrcpy(lpttt->szText, _reloadTipStr.c_str());
}
}
else if (notification->hwndFrom == _treeView.getHSelf() || notification->hwndFrom == this->_treeViewSearchResult.getHSelf())
{
const TreeView & treeView = notification->hwndFrom == _treeView.getHSelf()?_treeView:_treeViewSearchResult;
switch (notification->code)
@ -549,7 +564,7 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
int editHeight = 20;
// Create toolbar menu
//int style = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TBSTYLE_TOOLTIPS |TBSTYLE_FLAT | CCS_TOP | BTNS_AUTOSIZE | CCS_NOPARENTALIGN | CCS_NORESIZE | CCS_NODIVIDER;
int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | BTNS_AUTOSIZE | BTNS_SEP;
int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | BTNS_AUTOSIZE | BTNS_SEP | TBSTYLE_TOOLTIPS;
_hToolbarMenu = CreateWindowEx(0,TOOLBARCLASSNAME,NULL, style,
0,0,0,0,_hSelf,(HMENU)0, _hInst, NULL);
@ -589,6 +604,11 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
::SendMessage(_hToolbarMenu, TB_AUTOSIZE, 0, 0);
ShowWindow(_hToolbarMenu, SW_SHOW);
// tips text for toolbar buttons
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
_sortTipStr = pNativeSpeaker->getAttrNameStr(_sortTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_SORTLOCALNODENAME);
_reloadTipStr = pNativeSpeaker->getAttrNameStr(_reloadTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_RELOADLOCALNODENAME);
_hSearchEdit = CreateWindowEx(0L, L"Edit", NULL,
WS_CHILD | WS_BORDER | WS_VISIBLE | ES_AUTOVSCROLL,

14
PowerEditor/src/WinControls/FunctionList/functionListPanel.h

@ -38,6 +38,14 @@
#include "functionParser.h"
#include "TreeView.h"
#define FL_PANELTITLE TEXT("Function List")
#define FL_SORTTIP TEXT("sort")
#define FL_RELOADTIP TEXT("Reload")
#define FL_FUCTIONLISTROOTNODE "FunctionList"
#define FL_SORTLOCALNODENAME "SortTip"
#define FL_RELOADLOCALNODENAME "ReloadTip"
class ScintillaEditView;
struct FuncInfo {
@ -85,7 +93,8 @@ struct TreeParams {
class FunctionListPanel : public DockingDlgInterface {
public:
FunctionListPanel(): DockingDlgInterface(IDD_FUNCLIST_PANEL), _ppEditView(NULL), _pTreeView(&_treeView) {};
FunctionListPanel(): DockingDlgInterface(IDD_FUNCLIST_PANEL), _ppEditView(NULL), _pTreeView(&_treeView),
_reloadTipStr(TEXT("Reload")), _sortTipStr(TEXT("Sort")) {};
void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView);
@ -118,6 +127,9 @@ private:
TreeView _treeView;
TreeView _treeViewSearchResult;
generic_string _sortTipStr;
generic_string _reloadTipStr;
ScintillaEditView **_ppEditView;
FunctionParsersManager _funcParserMgr;
std::vector<FuncInfo> _funcInfos;

64
PowerEditor/src/localization.cpp

@ -1058,20 +1058,15 @@ bool NativeLangSpeaker::changeDlgLang(HWND hDlg, const char *dlgTagName, char *t
dlgNode = searchDlgNode(dlgNode, dlgTagName);
if (!dlgNode) return false;
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
#endif
// Set Title
const char *titre = (dlgNode->ToElement())->Attribute("title");
if ((titre && titre[0]) && hDlg)
{
#ifdef UNICODE
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
::SetWindowText(hDlg, nameW);
#else
::SetWindowText(hDlg, titre);
#endif
if (title)
strcpy(title, titre);
}
@ -1090,12 +1085,8 @@ bool NativeLangSpeaker::changeDlgLang(HWND hDlg, const char *dlgTagName, char *t
HWND hItem = ::GetDlgItem(hDlg, id);
if (hItem)
{
#ifdef UNICODE
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
::SetWindowText(hItem, nameW);
#else
::SetWindowText(hItem, name);
#endif
}
}
}
@ -1115,22 +1106,15 @@ bool NativeLangSpeaker::getMsgBoxLang(const char *msgBoxTagName, generic_string
msgBoxNode = searchDlgNode(msgBoxNode, msgBoxTagName);
if (!msgBoxNode) return false;
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
#endif
// Set Title
const char *titre = (msgBoxNode->ToElement())->Attribute("title");
const char *msg = (msgBoxNode->ToElement())->Attribute("message");
if ((titre && titre[0]) && (msg && msg[0]))
{
#ifdef UNICODE
title = wmc->char2wchar(titre, _nativeLangEncoding);
message = wmc->char2wchar(msg, _nativeLangEncoding);
#else
title = titre;
message = msg;
#endif
return true;
}
return false;
@ -1167,12 +1151,8 @@ generic_string NativeLangSpeaker::getProjectPanelLangMenuStr(const char * nodeNa
if (name && name[0])
{
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
return wmc->char2wchar(name, _nativeLangEncoding);
#else
return name;
#endif
}
return defaultStr;
}
@ -1186,16 +1166,50 @@ generic_string NativeLangSpeaker::getProjectPanelLangStr(const char *nodeName, c
targetNode = targetNode->FirstChild(nodeName);
if (!targetNode) return defaultStr;
const char *name = (targetNode->ToElement())->Attribute("name");
if (name && name[0])
{
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
return wmc->char2wchar(name, _nativeLangEncoding);
}
return defaultStr;
}
generic_string NativeLangSpeaker::getAttrNameStr(const TCHAR *defaultStr, const char *nodeL1Name, const char *nodeL2Name) const
{
if (!_nativeLangA) return defaultStr;
TiXmlNodeA *targetNode = _nativeLangA->FirstChild(nodeL1Name);
if (!targetNode) return defaultStr;
if (nodeL2Name)
targetNode = targetNode->FirstChild(nodeL2Name);
if (!targetNode) return defaultStr;
const char *name = (targetNode->ToElement())->Attribute("name");
if (name && name[0])
{
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
return wmc->char2wchar(name, _nativeLangEncoding);
}
return defaultStr;
}
generic_string NativeLangSpeaker::getFunctionListPanelLangStr(const char *nodeName, const TCHAR *defaultStr) const
{
if (!_nativeLangA) return defaultStr;
TiXmlNodeA *targetNode = _nativeLangA->FirstChild("FunctionList");
if (!targetNode) return defaultStr;
targetNode = targetNode->FirstChild(nodeName);
if (!targetNode) return defaultStr;
// Set Title
const char *name = (targetNode->ToElement())->Attribute("name");
if (name && name[0])
{
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
return wmc->char2wchar(name, _nativeLangEncoding);
#else
return name;
#endif
}
return defaultStr;
}

2
PowerEditor/src/localization.h

@ -75,6 +75,8 @@ public:
bool getMsgBoxLang(const char *msgBoxTagName, generic_string & title, generic_string & message);
generic_string getProjectPanelLangMenuStr(const char * nodeName, int cmdID, const TCHAR *defaultStr) const;
generic_string getProjectPanelLangStr(const char *nodeName, const TCHAR *defaultStr) const;
generic_string getFunctionListPanelLangStr(const char *nodeName, const TCHAR *defaultStr) const;
generic_string getAttrNameStr(const TCHAR *defaultStr, const char *nodeL1Name, const char *nodeL2Name = NULL) const;
int messageBox(const char *msgBoxTagName, HWND hWnd, TCHAR *message, TCHAR *title, int msgBoxType, int intInfo = 0, TCHAR *strInfo = NULL);
private:
TiXmlNodeA *_nativeLangA;

Loading…
Cancel
Save