本文整理汇总了C++中NativeLangSpeaker类的典型用法代码示例。如果您正苦于以下问题:C++ NativeLangSpeaker类的具体用法?C++ NativeLangSpeaker怎么用?C++ NativeLangSpeaker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NativeLangSpeaker类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initPopupMenus
void FileBrowser::initPopupMenus()
{
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string edit_removeFolderFromFileBrowser = pNativeSpeaker->getProjectPanelLangMenuStr("FileBrowserContextMenu", IDM_FILEBROWSER_REMOVEROOTFOLDER, PM_EDITREMOVE);
/*
generic_string edit_rename = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_FILEBROWSER_RENAME, PM_EDITRENAME);
generic_string edit_addfolder = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_FILEBROWSER_NEWFOLDER, PM_EDITNEWFOLDER);
generic_string edit_addfiles = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_FILEBROWSER_ADDFILES, PM_EDITADDFILES);
edit_rename = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_FILEBROWSER_RENAME, PM_EDITRENAME);
edit_addfolder = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_FILEBROWSER_NEWFOLDER, PM_EDITNEWFOLDER);
edit_addfiles = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_FILEBROWSER_ADDFILES, PM_EDITADDFILES);
edit_remove = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_FILEBROWSER_DELETEFOLDER, PM_EDITREMOVE);
*/
_hGlobalMenu = ::CreatePopupMenu();
_hRootMenu = ::CreatePopupMenu();
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_REMOVEROOTFOLDER, edit_removeFolderFromFileBrowser.c_str());
_hFolderMenu = ::CreatePopupMenu();
//::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_NEWFOLDER, edit_addfolder.c_str());
//::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_ADDFILES, edit_addfiles.c_str());
_hFileMenu = ::CreatePopupMenu();
//::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_RENAME, edit_rename.c_str());
//::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_DELETEFILE, edit_remove.c_str());
//::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_MODIFYFILEPATH, edit_modifyfile.c_str());
}
示例2: newWorkSpace
void ProjectPanel::newWorkSpace()
{
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string workspace = pNativeSpeaker->getAttrNameStr(PM_WORKSPACEROOTNAME, "ProjectManager", "WorkspaceRootName");
_treeView.addItem(workspace.c_str(), TVI_ROOT, INDEX_CLEAN_ROOT);
setWorkSpaceDirty(false);
_workSpaceFilePath = TEXT("");
}
示例3: sizeof
void ListView::init(HINSTANCE hInst, HWND parent)
{
Window::init(hInst, parent);
INITCOMMONCONTROLSEX icex;
// Ensure that the common control DLL is loaded.
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
icex.dwICC = ICC_LISTVIEW_CLASSES;
InitCommonControlsEx(&icex);
// Create the list-view window in report view with label editing enabled.
int listViewStyles = LVS_REPORT | LVS_NOSORTHEADER\
| LVS_SINGLESEL | LVS_AUTOARRANGE\
| LVS_SHAREIMAGELISTS | LVS_SHOWSELALWAYS;
_hSelf = ::CreateWindow(WC_LISTVIEW,
TEXT(""),
WS_CHILD | listViewStyles,
0,
0,
0,
0,
_hParent,
(HMENU) NULL,
hInst,
NULL);
if (!_hSelf)
{
throw std::runtime_error("ListView::init : CreateWindowEx() function return null");
}
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this);
_defaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, (LONG_PTR)staticProc));
DWORD exStyle = ListView_GetExtendedListViewStyle(_hSelf);
exStyle |= LVS_EX_FULLROWSELECT | LVS_EX_BORDERSELECT ;
ListView_SetExtendedListViewStyle(_hSelf, exStyle);
LVCOLUMN lvColumn;
lvColumn.mask = LVCF_TEXT|LVCF_WIDTH;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string valStr = pNativeSpeaker->getAttrNameStr(TEXT("Value"), "AsciiInsertion", "ColumnVal");
generic_string hexStr = pNativeSpeaker->getAttrNameStr(TEXT("Hex"), "AsciiInsertion", "ColumnHex");
generic_string charStr = pNativeSpeaker->getAttrNameStr(TEXT("Character"), "AsciiInsertion", "ColumnChar");
lvColumn.cx = 45;
lvColumn.pszText = (TCHAR *)valStr.c_str();
ListView_InsertColumn(_hSelf, 0, &lvColumn);
lvColumn.cx = 45;
lvColumn.pszText = (TCHAR *)hexStr.c_str();
ListView_InsertColumn(_hSelf, 1, &lvColumn);
lvColumn.cx = 70;
lvColumn.pszText = (TCHAR *)charStr.c_str();
ListView_InsertColumn(_hSelf, 2, &lvColumn);
}
示例4: initList
void VerticalFileSwitcherListView::initList()
{
TaskListInfo taskListInfo;
static HWND nppHwnd = ::GetParent(_hParent);
::SendMessage(nppHwnd, WM_GETTASKLISTINFO, (WPARAM)&taskListInfo, TRUE);
NppParameters *nppParams = NppParameters::getInstance();
NativeLangSpeaker *pNativeSpeaker = nppParams->getNativeLangSpeaker();
bool isExtColumn = !nppParams->getNppGUI()._fileSwitcherWithoutExtColumn;
RECT rc;
::GetClientRect(_hParent, &rc);
int totalWidth = rc.right - rc.left;
generic_string nameStr = pNativeSpeaker->getAttrNameStr(TEXT("Name"), FS_ROOTNODE, FS_CLMNNAME);
//insertColumn(nameStr.c_str(), 150, 0);
insertColumn(nameStr.c_str(), (isExtColumn ? totalWidth - 50 : totalWidth), 0);
//bool isExtColumn = !nppParams->getNppGUI()._fileSwitcherWithoutExtColumn;
if (isExtColumn)
{
generic_string extStr = pNativeSpeaker->getAttrNameStr(TEXT("Ext."), FS_ROOTNODE, FS_CLMNEXT);
insertColumn(extStr.c_str(), 50, 1);
}
for (size_t i = 0, len = taskListInfo._tlfsLst.size(); i < len ; ++i)
{
TaskLstFnStatus & fileNameStatus = taskListInfo._tlfsLst[i];
TaskLstFnStatus *tl = new TaskLstFnStatus(fileNameStatus._iView, fileNameStatus._docIndex, fileNameStatus._fn, fileNameStatus._status, (void *)fileNameStatus._bufID);
TCHAR fn[MAX_PATH];
lstrcpy(fn, ::PathFindFileName(fileNameStatus._fn.c_str()));
if (isExtColumn)
{
::PathRemoveExtension(fn);
}
LVITEM item;
item.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
item.pszText = fn;
item.iItem = static_cast<int32_t>(i);
item.iSubItem = 0;
item.iImage = fileNameStatus._status;
item.lParam = (LPARAM)tl;
ListView_InsertItem(_hSelf, &item);
if (isExtColumn)
{
ListView_SetItemText(_hSelf, i, 1, (LPTSTR)::PathFindExtension(fileNameStatus._fn.c_str()));
}
}
ListView_SetItemState(_hSelf, taskListInfo._currentIndex, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
}
示例5: TiXmlDocument
bool ProjectPanel::openWorkSpace(const TCHAR *projectFileName)
{
TiXmlDocument *pXmlDocProject = new TiXmlDocument(projectFileName);
bool loadOkay = pXmlDocProject->LoadFile();
if (!loadOkay)
return false;
TiXmlNode *root = pXmlDocProject->FirstChild(TEXT("NotepadPlus"));
if (!root)
return false;
TiXmlNode *childNode = root->FirstChildElement(TEXT("Project"));
if (!childNode)
return false;
if (!::PathFileExists(projectFileName))
return false;
_treeView.removeAllItems();
_workSpaceFilePath = projectFileName;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string workspace = pNativeSpeaker->getAttrNameStr(PM_WORKSPACEROOTNAME, "ProjectManager", "WorkspaceRootName");
HTREEITEM rootItem = _treeView.addItem(workspace.c_str(), TVI_ROOT, INDEX_CLEAN_ROOT);
for ( ; childNode ; childNode = childNode->NextSibling(TEXT("Project")))
{
HTREEITEM projectItem = _treeView.addItem((childNode->ToElement())->Attribute(TEXT("name")), rootItem, INDEX_PROJECT);
buildTreeFrom(childNode, projectItem);
}
setWorkSpaceDirty(false);
_treeView.expand(rootItem);
delete pXmlDocProject;
return loadOkay;
}
示例6: updateMenu
void LastRecentFileList::updateMenu()
{
NppParameters *pNppParam = NppParameters::getInstance();
if (!_hasSeparators && _size > 0)
{
//add separators
NativeLangSpeaker *pNativeLangSpeaker = pNppParam->getNativeLangSpeaker();
generic_string recentFileList = pNativeLangSpeaker->getSpecialMenuEntryName("RecentFiles");
generic_string openAllFiles = pNativeLangSpeaker->getNativeLangMenuString(IDM_OPEN_ALL_RECENT_FILE);
generic_string cleanFileList = pNativeLangSpeaker->getNativeLangMenuString(IDM_CLEAN_RECENT_FILE_LIST);
if (recentFileList == TEXT(""))
recentFileList = TEXT("&Recent Files");
if (openAllFiles == TEXT(""))
openAllFiles = TEXT("Open All Recent Files");
if (cleanFileList == TEXT(""))
cleanFileList = TEXT("Empty Recent Files List");
if (!isSubMenuMode())
::InsertMenu(_hMenu, _posBase + 0, MF_BYPOSITION, UINT(-1), 0);
::InsertMenu(_hMenu, _posBase + 1, MF_BYPOSITION, IDM_OPEN_ALL_RECENT_FILE, openAllFiles.c_str());
::InsertMenu(_hMenu, _posBase + 2, MF_BYPOSITION, IDM_CLEAN_RECENT_FILE_LIST, cleanFileList.c_str());
::InsertMenu(_hMenu, _posBase + 3, MF_BYPOSITION, UINT(-1), 0);
_hasSeparators = true;
if (isSubMenuMode())
{
::InsertMenu(_hParentMenu, _posBase + 0, MF_BYPOSITION | MF_POPUP, UINT(_hMenu), (LPCTSTR)recentFileList.c_str());
::InsertMenu(_hParentMenu, _posBase + 1, MF_BYPOSITION, UINT(-1), 0);
}
}
else if (_hasSeparators && _size == 0) //remove separators
{
::RemoveMenu(_hMenu, _posBase + 3, MF_BYPOSITION);
::RemoveMenu(_hMenu, IDM_CLEAN_RECENT_FILE_LIST, MF_BYCOMMAND);
::RemoveMenu(_hMenu, IDM_OPEN_ALL_RECENT_FILE, MF_BYCOMMAND);
::RemoveMenu(_hMenu, _posBase + 0, MF_BYPOSITION);
_hasSeparators = false;
if (isSubMenuMode())
{
// Remove "Recent Files" Entry and the separator from the main menu
::RemoveMenu(_hParentMenu, _posBase + 1, MF_BYPOSITION);
::RemoveMenu(_hParentMenu, _posBase + 0, MF_BYPOSITION);
// Remove the last left separator from the submenu
::RemoveMenu(_hMenu, 0, MF_BYPOSITION);
}
}
//Remove all menu items
for(int i = 0; i < _size; ++i)
{
::RemoveMenu(_hMenu, _lrfl.at(i)._id, MF_BYCOMMAND);
}
//Then readd them, so everything stays in sync
for(int j = 0; j < _size; ++j)
{
generic_string strBuffer(BuildMenuFileName(pNppParam->getRecentFileCustomLength(), j, _lrfl.at(j)._name));
::InsertMenu(_hMenu, _posBase + j, MF_BYPOSITION, _lrfl.at(j)._id, strBuffer.c_str());
}
}
示例7: switch
void ProjectPanel::popupMenuCmd(int cmdID)
{
// get selected item handle
HTREEITEM hTreeItem = _treeView.getSelection();
if (!hTreeItem)
return;
switch (cmdID)
{
//
// Toolbar menu buttons
//
case IDB_PROJECT_BTN:
{
POINT p = getMenuDisplayPoint(0);
TrackPopupMenu(_hWorkSpaceMenu, TPM_LEFTALIGN, p.x, p.y, 0, _hSelf, NULL);
}
break;
case IDB_EDIT_BTN:
{
POINT p = getMenuDisplayPoint(1);
HMENU hMenu = NULL;
NodeType nodeType = getNodeType(hTreeItem);
if (nodeType == nodeType_project)
hMenu = _hProjectMenu;
else if (nodeType == nodeType_folder)
hMenu = _hFolderMenu;
else if (nodeType == nodeType_file)
hMenu = _hFileMenu;
if (hMenu)
TrackPopupMenu(hMenu, TPM_LEFTALIGN, p.x, p.y, 0, _hSelf, NULL);
}
break;
//
// Toolbar menu commands
//
case IDM_PROJECT_NEWPROJECT :
{
HTREEITEM root = _treeView.getRoot();
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string newProjectLabel = pNativeSpeaker->getAttrNameStr(PM_NEWPROJECTNAME, "ProjectManager", "NewProjectName");
HTREEITEM addedItem = _treeView.addItem(newProjectLabel.c_str(), root, INDEX_PROJECT);
setWorkSpaceDirty(true);
_treeView.expand(hTreeItem);
TreeView_EditLabel(_treeView.getHSelf(), addedItem);
}
break;
case IDM_PROJECT_NEWWS :
{
if (_isDirty)
{
int res = ::MessageBox(_hSelf, TEXT("The current workspace was modified. Do you want to save the current project?"), TEXT("New Workspace"), MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL);
if (res == IDYES)
{
if (!saveWorkSpace())
return;
}
else if (res == IDNO)
{
// Don't save so do nothing here
}
else if (res == IDCANCEL)
{
// User cancels action "New Workspace" so we interrupt here
return;
}
}
_treeView.removeAllItems();
newWorkSpace();
}
break;
case IDM_PROJECT_RENAME :
TreeView_EditLabel(_treeView.getHSelf(), hTreeItem);
break;
case IDM_PROJECT_NEWFOLDER :
{
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string newFolderLabel = pNativeSpeaker->getAttrNameStr(PM_NEWFOLDERNAME, "ProjectManager", "NewFolderName");
addFolder(hTreeItem, newFolderLabel.c_str());
setWorkSpaceDirty(true);
}
break;
case IDM_PROJECT_MOVEDOWN :
{
if (_treeView.moveDown(hTreeItem))
setWorkSpaceDirty(true);
}
break;
case IDM_PROJECT_MOVEUP :
{
if (_treeView.moveUp(hTreeItem))
setWorkSpaceDirty(true);
//.........这里部分代码省略.........
示例8: initMenus
void ProjectPanel::initMenus()
{
_hWorkSpaceMenu = ::CreatePopupMenu();
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string new_workspace = pNativeSpeaker->getProjectPanelLangMenuStr("WorkspaceMenu", IDM_PROJECT_NEWWS, PM_NEWWORKSPACE);
generic_string open_workspace = pNativeSpeaker->getProjectPanelLangMenuStr("WorkspaceMenu", IDM_PROJECT_OPENWS, PM_OPENWORKSPACE);
generic_string reload_workspace = pNativeSpeaker->getProjectPanelLangMenuStr("WorkspaceMenu", IDM_PROJECT_RELOADWS, PM_RELOADWORKSPACE);
generic_string save_workspace = pNativeSpeaker->getProjectPanelLangMenuStr("WorkspaceMenu", IDM_PROJECT_SAVEWS, PM_SAVEWORKSPACE);
generic_string saveas_workspace = pNativeSpeaker->getProjectPanelLangMenuStr("WorkspaceMenu", IDM_PROJECT_SAVEASWS, PM_SAVEASWORKSPACE);
generic_string saveacopyas_workspace = pNativeSpeaker->getProjectPanelLangMenuStr("WorkspaceMenu", IDM_PROJECT_SAVEACOPYASWS, PM_SAVEACOPYASWORKSPACE);
generic_string newproject_workspace = pNativeSpeaker->getProjectPanelLangMenuStr("WorkspaceMenu", IDM_PROJECT_NEWPROJECT, PM_NEWPROJECTWORKSPACE);
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_NEWWS, new_workspace.c_str());
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_OPENWS, open_workspace.c_str());
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_RELOADWS, reload_workspace.c_str());
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEWS, save_workspace.c_str());
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEASWS, saveas_workspace.c_str());
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEACOPYASWS, saveacopyas_workspace.c_str());
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, (UINT)-1, 0);
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_NEWPROJECT, newproject_workspace.c_str());
generic_string edit_moveup = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_PROJECT_MOVEUP, PM_MOVEUPENTRY);
generic_string edit_movedown = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_PROJECT_MOVEDOWN, PM_MOVEDOWNENTRY);
generic_string edit_rename = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_PROJECT_RENAME, PM_EDITRENAME);
generic_string edit_addfolder = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_PROJECT_NEWFOLDER, PM_EDITNEWFOLDER);
generic_string edit_addfiles = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_PROJECT_ADDFILES, PM_EDITADDFILES);
generic_string edit_addfilesRecursive = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_PROJECT_ADDFILESRECUSIVELY, PM_EDITADDFILESRECUSIVELY);
generic_string edit_remove = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_PROJECT_DELETEFOLDER, PM_EDITREMOVE);
_hProjectMenu = ::CreatePopupMenu();
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MOVEUP, edit_moveup.c_str());
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MOVEDOWN, edit_movedown.c_str());
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, UINT(-1), 0);
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_RENAME, edit_rename.c_str());
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_NEWFOLDER, edit_addfolder.c_str());
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_ADDFILES, edit_addfiles.c_str());
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_ADDFILESRECUSIVELY, edit_addfilesRecursive.c_str());
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_DELETEFOLDER, edit_remove.c_str());
edit_moveup = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_PROJECT_MOVEUP, PM_MOVEUPENTRY);
edit_movedown = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_PROJECT_MOVEDOWN, PM_MOVEDOWNENTRY);
edit_rename = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_PROJECT_RENAME, PM_EDITRENAME);
edit_addfolder = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_PROJECT_NEWFOLDER, PM_EDITNEWFOLDER);
edit_addfiles = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_PROJECT_ADDFILES, PM_EDITADDFILES);
edit_addfilesRecursive = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_PROJECT_ADDFILESRECUSIVELY, PM_EDITADDFILESRECUSIVELY);
edit_remove = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_PROJECT_DELETEFOLDER, PM_EDITREMOVE);
_hFolderMenu = ::CreatePopupMenu();
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MOVEUP, edit_moveup.c_str());
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MOVEDOWN, edit_movedown.c_str());
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, UINT(-1), 0);
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_PROJECT_RENAME, edit_rename.c_str());
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_PROJECT_NEWFOLDER, edit_addfolder.c_str());
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_PROJECT_ADDFILES, edit_addfiles.c_str());
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_PROJECT_ADDFILESRECUSIVELY, edit_addfilesRecursive.c_str());
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_PROJECT_DELETEFOLDER, edit_remove.c_str());
edit_moveup = pNativeSpeaker->getProjectPanelLangMenuStr("FileMenu", IDM_PROJECT_MOVEUP, PM_MOVEUPENTRY);
edit_movedown = pNativeSpeaker->getProjectPanelLangMenuStr("FileMenu", IDM_PROJECT_MOVEDOWN, PM_MOVEDOWNENTRY);
edit_rename = pNativeSpeaker->getProjectPanelLangMenuStr("FileMenu", IDM_PROJECT_RENAME, PM_EDITRENAME);
edit_remove = pNativeSpeaker->getProjectPanelLangMenuStr("FileMenu", IDM_PROJECT_DELETEFILE, PM_EDITREMOVE);
generic_string edit_modifyfile = pNativeSpeaker->getProjectPanelLangMenuStr("FileMenu", IDM_PROJECT_MODIFYFILEPATH, PM_EDITMODIFYFILE);
_hFileMenu = ::CreatePopupMenu();
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MOVEUP, edit_moveup.c_str());
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MOVEDOWN, edit_movedown.c_str());
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, UINT(-1), 0);
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_RENAME, edit_rename.c_str());
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_DELETEFILE, edit_remove.c_str());
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MODIFYFILEPATH, edit_modifyfile.c_str());
}
示例9: switch
BOOL CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{
switch (message)
{
case WM_COMMAND :
{
switch (wParam)
{
case IDCANCEL :
display(false);
return TRUE;
case IDOK :
{
TCHAR cmd[MAX_PATH];
::GetDlgItemText(_hSelf, IDC_COMBO_RUN_PATH, cmd, MAX_PATH);
_cmdLine = cmd;
HINSTANCE hInst = run(_hParent);
if (int(hInst) > 32)
{
addTextToCombo(_cmdLine.c_str());
display(false);
}
else
{
removeTextFromCombo(_cmdLine.c_str());
}
return TRUE;
}
case IDC_BUTTON_SAVE :
{
std::vector<UserCommand> & theUserCmds = (NppParameters::getInstance())->getUserCommandList();
int nbCmd = theUserCmds.size();
int cmdID = ID_USER_CMD + nbCmd;
TCHAR cmd[MAX_PATH];
::GetDlgItemText(_hSelf, IDC_COMBO_RUN_PATH, cmd, MAX_PATH);
UserCommand uc(Shortcut(), cmd, cmdID);
uc.init(_hInst, _hSelf);
if (uc.doDialog() != -1)
{
HMENU hRunMenu = ::GetSubMenu((HMENU)::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_RUN);
int const posBase = 2;
if (nbCmd == 0)
::InsertMenu(hRunMenu, posBase - 1, MF_BYPOSITION, (unsigned int)-1, 0);
theUserCmds.push_back(uc);
::InsertMenu(hRunMenu, posBase + nbCmd, MF_BYPOSITION, cmdID, uc.toMenuItemString().c_str());
if (nbCmd == 0)
{
// Insert the separator and modify/delete command
::InsertMenu(hRunMenu, posBase + nbCmd + 1, MF_BYPOSITION, (unsigned int)-1, 0);
NativeLangSpeaker *pNativeLangSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string nativeLangShortcutMapperMacro = pNativeLangSpeaker->getNativeLangMenuString(IDM_SETTING_SHORTCUT_MAPPER_MACRO);
if (nativeLangShortcutMapperMacro == TEXT(""))
nativeLangShortcutMapperMacro = TEXT("Modify Shortcut/Delete Command...");
::InsertMenu(hRunMenu, posBase + nbCmd + 2, MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_RUN, nativeLangShortcutMapperMacro.c_str());
}
(NppParameters::getInstance())->getAccelerator()->updateShortcuts();
}
return TRUE;
}
case IDC_BUTTON_FILE_BROWSER :
{
FileDialog fd(_hSelf, _hInst);
fd.setExtFilter(TEXT("Executable file : "), TEXT(".exe"), TEXT(".com"), TEXT(".cmd"), TEXT(".bat"), NULL);
fd.setExtFilter(TEXT("All files : "), TEXT(".*"), NULL);
if (const TCHAR *fn = fd.doOpenSingleFileDlg())
{
if(wcschr(fn, ' ') != NULL)
{
generic_string fn_quotes(fn);
fn_quotes = TEXT("\"") + fn_quotes + TEXT("\"");
addTextToCombo(fn_quotes.c_str());
}
else
{
addTextToCombo(fn);
}
}
return TRUE;
}
default :
break;
}
}
}
return FALSE;
}
示例10: switch
INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
// Make edit field red if not found
case WM_CTLCOLOREDIT :
{
// if the text not found modify the background color of the editor
static HBRUSH hBrushBackground = CreateSolidBrush(BCKGRD_COLOR);
TCHAR text2search[MAX_PATH] ;
::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text2search));
if (text2search[0] == '\0')
{
return FALSE; // no text, use the default color
}
HTREEITEM searchViewRoot = _treeViewSearchResult.getRoot();
if (searchViewRoot)
{
if (_treeViewSearchResult.getChildFrom(searchViewRoot))
return FALSE; // children on root found, use the default color
}
else
return FALSE; // no root (no parser), use the default color
// text not found
SetTextColor((HDC)wParam, TXT_COLOR);
SetBkColor((HDC)wParam, BCKGRD_COLOR);
return (LRESULT)hBrushBackground;
}
case WM_INITDIALOG :
{
int editWidth = NppParameters::getInstance()->_dpiManager.scaleX(100);
int editWidthSep = NppParameters::getInstance()->_dpiManager.scaleX(105); //editWidth + 5
int editHeight = NppParameters::getInstance()->_dpiManager.scaleY(20);
// Create toolbar menu
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,nullptr, _hInst, NULL);
oldFunclstToolbarProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hToolbarMenu, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(funclstToolbarProc)));
TBBUTTON tbButtons[3];
// Add the bmap image into toolbar's imagelist
TBADDBITMAP addbmp = {_hInst, 0};
addbmp.nID = IDI_FUNCLIST_SORTBUTTON;
::SendMessage(_hToolbarMenu, TB_ADDBITMAP, 1, reinterpret_cast<LPARAM>(&addbmp));
addbmp.nID = IDI_FUNCLIST_RELOADBUTTON;
::SendMessage(_hToolbarMenu, TB_ADDBITMAP, 1, reinterpret_cast<LPARAM>(&addbmp));
// Place holder of search text field
tbButtons[0].idCommand = 0;
tbButtons[0].iBitmap = editWidthSep;
tbButtons[0].fsState = TBSTATE_ENABLED;
tbButtons[0].fsStyle = BTNS_SEP; //This is just a separator (blank space)
tbButtons[0].iString = 0;
tbButtons[1].idCommand = IDC_SORTBUTTON_FUNCLIST;
tbButtons[1].iBitmap = 0;
tbButtons[1].fsState = TBSTATE_ENABLED;
tbButtons[1].fsStyle = BTNS_CHECK | BTNS_AUTOSIZE;
tbButtons[1].iString = reinterpret_cast<INT_PTR>(TEXT(""));
tbButtons[2].idCommand = IDC_RELOADBUTTON_FUNCLIST;
tbButtons[2].iBitmap = 1;
tbButtons[2].fsState = TBSTATE_ENABLED;
tbButtons[2].fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE;
tbButtons[2].iString = reinterpret_cast<INT_PTR>(TEXT(""));
::SendMessage(_hToolbarMenu, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
::SendMessage(_hToolbarMenu, TB_SETBUTTONSIZE, 0, MAKELONG(16, 16));
::SendMessage(_hToolbarMenu, TB_ADDBUTTONS, sizeof(tbButtons) / sizeof(TBBUTTON), reinterpret_cast<LPARAM>(&tbButtons));
::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(0, L"Edit", NULL,
WS_CHILD | WS_BORDER | WS_VISIBLE | ES_AUTOVSCROLL,
2, 2, editWidth, editHeight,
_hToolbarMenu, reinterpret_cast<HMENU>(IDC_SEARCHFIELD_FUNCLIST), _hInst, 0 );
HFONT hf = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
if (hf)
::SendMessage(_hSearchEdit, WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0));
_treeViewSearchResult.init(_hInst, _hSelf, IDC_LIST_FUNCLIST_AUX);
_treeView.init(_hInst, _hSelf, IDC_LIST_FUNCLIST);
setTreeViewImageList(IDI_FUNCLIST_ROOT, IDI_FUNCLIST_NODE, IDI_FUNCLIST_LEAF);
_treeView.display();
return TRUE;
}
case WM_DESTROY:
//.........这里部分代码省略.........