Browse Source

[UPDATE] FunctionList in progress.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1026 f5eea248-9336-0410-98b8-ebc06183d4e3
remotes/trunk
Don Ho 12 years ago
parent
commit
9df4ec6b51
  1. 5
      PowerEditor/installer/nppSetup.nsi
  2. 4
      PowerEditor/src/Notepad_plus.cpp
  3. 3
      PowerEditor/src/Notepad_plus.rc
  4. 53
      PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp
  5. 2
      PowerEditor/src/WinControls/FunctionList/functionListPanel.h
  6. 9
      PowerEditor/src/WinControls/FunctionList/functionParser.cpp
  7. 35
      PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp
  8. BIN
      PowerEditor/src/icons/funcList_leaf.bmp
  9. BIN
      PowerEditor/src/icons/funcList_node.bmp
  10. 4
      PowerEditor/src/resource.h

5
PowerEditor/installer/nppSetup.nsi

@ -551,6 +551,11 @@ Section -"Notepad++" mainSection
Rename "$INSTDIR\plugins\NotepadSharp.dll" "$INSTDIR\plugins\disabled\NotepadSharp.dll"
Delete "$INSTDIR\plugins\NotepadSharp.dll"
IfFileExists "$INSTDIR\plugins\PreviewHTML.dll" 0 +4
MessageBox MB_OK "Due to the stability issue,$\nPreviewHTML.dll will be moved to the directory $\"disabled$\"" /SD IDOK
Rename "$INSTDIR\plugins\PreviewHTML.dll" "$INSTDIR\plugins\disabled\PreviewHTML.dll"
Delete "$INSTDIR\plugins\PreviewHTML.dll"
; Context Menu Management : removing old version of Context Menu module
IfFileExists "$INSTDIR\nppcm.dll" 0 +3
Exec 'regsvr32 /u /s "$INSTDIR\nppcm.dll"'

4
PowerEditor/src/Notepad_plus.cpp

@ -5199,7 +5199,7 @@ struct Quote{
const char *_quote;
};
const int nbQuote = 109;
const int nbQuote = 111;
Quote quotes[nbQuote] = {
{"Notepad++", "Good programmers use Notepad++ to code.\nExtreme programmers use MS Word to code, in Comic Sans, center aligned."},
{"Martin Golding", "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."},
@ -5303,6 +5303,8 @@ Quote quotes[nbQuote] = {
{"Anonymous #70", "If abortion is murder then are condoms kidnapping?"},
{"Anonymous #71", "Men also have feelings.\nFor example, they can feel hungry."},
{"Anonymous #72", "Project Manager:\nA person who thinks 9 women can deliver a baby in 1 month."},
{"Anonymous #73", "If you try and don't succeed, cheat. Repeat until caught. Then lie."},
{"Anonymous #74", "Olympics is the stupidest thing.\nPeople are so proud to be competing for their country.\nThey play their stupid song and raise some dumb flags.\nI'd love to see no flags raised, no song, no mention of country.\nOnly people."},
{"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..."},
{"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."},

3
PowerEditor/src/Notepad_plus.rc

@ -190,6 +190,9 @@ IDI_PROJECT_FOLDERCLOSE BITMAP "icons\\project_folder_close.bmp"
IDI_PROJECT_FILE BITMAP "icons\\project_file.bmp"
IDI_PROJECT_FILEINVALID BITMAP "icons\\project_file_invalid.bmp"
IDI_FUNCLIST_ROOT BITMAP "icons\\project_file.bmp"
IDI_FUNCLIST_NODE BITMAP "icons\\funcList_node.bmp"
IDI_FUNCLIST_LEAF BITMAP "icons\\funcList_leaf.bmp"
IDR_M30_MENU MENU
BEGIN

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

@ -30,6 +30,13 @@
#include "functionListPanel.h"
#include "ScintillaEditView.h"
#define CX_BITMAP 16
#define CY_BITMAP 16
#define INDEX_ROOT 0
#define INDEX_NODE 1
#define INDEX_LEAF 2
void FunctionListPanel::addEntry(const TCHAR *nodeName, const TCHAR *displayText, size_t pos)
{
HTREEITEM itemParent = NULL;
@ -42,13 +49,13 @@ void FunctionListPanel::addEntry(const TCHAR *nodeName, const TCHAR *displayText
itemParent = _treeView.searchSubItemByName(nodeName, root);
if (!itemParent)
{
itemParent = _treeView.addItem(nodeName, root, NULL, TEXT("-1"));
itemParent = _treeView.addItem(nodeName, root, INDEX_NODE, TEXT("-1"));
}
}
else
itemParent = root;
_treeView.addItem(displayText, itemParent, NULL, posStr);
_treeView.addItem(displayText, itemParent, INDEX_LEAF, posStr);
}
void FunctionListPanel::removeAllEntries()
@ -190,7 +197,7 @@ void FunctionListPanel::reload()
TCHAR *ext = ::PathFindExtension(fn);
if (_funcParserMgr.parse(fi, ext))
_treeView.addItem(fn, NULL, NULL, TEXT("-1"));
_treeView.addItem(fn, NULL, INDEX_ROOT, TEXT("-1"));
for (size_t i = 0; i < fi.size(); i++)
{
@ -269,6 +276,45 @@ void FunctionListPanel::notified(LPNMHDR notification)
}
BOOL FunctionListPanel::setImageList(int root_id, int node_id, int leaf_id)
{
HBITMAP hbmp;
const int nbBitmaps = 3;
// Creation of image list
if ((_hImaLst = ImageList_Create(CX_BITMAP, CY_BITMAP, ILC_COLOR32 | ILC_MASK, nbBitmaps, 0)) == NULL)
return FALSE;
// Add the bmp in the list
hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(root_id));
if (hbmp == NULL)
return FALSE;
ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
DeleteObject(hbmp);
hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(node_id));
if (hbmp == NULL)
return FALSE;
ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
DeleteObject(hbmp);
hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(leaf_id));
if (hbmp == NULL)
return FALSE;
ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
DeleteObject(hbmp);
if (ImageList_GetImageCount(_hImaLst) < nbBitmaps)
return FALSE;
// Set image list to the tree view
TreeView_SetImageList(_treeView.getHSelf(), _hImaLst, TVSIL_NORMAL);
return TRUE;
}
BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
@ -276,6 +322,7 @@ BOOL CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case WM_INITDIALOG :
{
_treeView.init(_hInst, _hSelf, IDC_LIST_FUNCLIST);
setImageList(IDI_FUNCLIST_ROOT, IDI_FUNCLIST_NODE, IDI_FUNCLIST_LEAF);
_treeView.display();
return TRUE;
}

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

@ -102,10 +102,12 @@ private:
std::vector<FuncInfo> _funcInfos;
std::vector< std::pair<int, int> > _skipZones;
std::vector<TreeStateNode> _treeStates;
HIMAGELIST _hImaLst;
generic_string parseSubLevel(size_t begin, size_t end, std::vector< generic_string > dataToSearch, int & foundPos);
size_t getBodyClosePos(size_t begin, const TCHAR *bodyOpenSymbol, const TCHAR *bodyCloseSymbol);
void notified(LPNMHDR notification);
void addInTreeStateArray(TreeStateNode tree2Update);
TreeStateNode* getFromTreeStateArray(generic_string fullFilePath);
BOOL setImageList(int root_id, int node_id, int leaf_id);
};
#endif // FUNCLISTPANEL_H

9
PowerEditor/src/WinControls/FunctionList/functionParser.cpp

@ -485,7 +485,12 @@ void FunctionParser::getInvertZones(vector< pair<int, int> > & destZones, vecto
}
else
{
// todo : check the begin
// check the begin
if (int(begin) < sourceZones[0].first)
{
destZones.push_back(pair<int, int>(begin, sourceZones[0].first - 1));
}
size_t i = 0;
for (; i < sourceZones.size() - 1; i++)
{
@ -496,7 +501,7 @@ void FunctionParser::getInvertZones(vector< pair<int, int> > & destZones, vecto
}
int lastBegin = sourceZones[i].second + 1;
if (lastBegin < int(end))
destZones.push_back(pair<int, int>(lastBegin, end));
destZones.push_back(pair<int, int>(lastBegin, end));
}
}

35
PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp

@ -256,7 +256,6 @@ void ProjectPanel::initMenus()
BOOL ProjectPanel::setImageList(int root_clean_id, int root_dirty_id, int project_id, int open_node_id, int closed_node_id, int leaf_id, int ivalid_leaf_id)
{
int i;
HBITMAP hbmp;
const int nbBitmaps = 7;
@ -267,52 +266,52 @@ BOOL ProjectPanel::setImageList(int root_clean_id, int root_dirty_id, int projec
// Add the bmp in the list
hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(root_clean_id));
if(hbmp == NULL)
if (hbmp == NULL)
return FALSE;
i =ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
DeleteObject(hbmp);
hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(root_dirty_id));
if(hbmp == NULL)
if (hbmp == NULL)
return FALSE;
i =ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
DeleteObject(hbmp);
hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(project_id));
if(hbmp == NULL)
if (hbmp == NULL)
return FALSE;
i =ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
DeleteObject(hbmp);
hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(open_node_id));
if(hbmp == NULL)
if (hbmp == NULL)
return FALSE;
i =ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
DeleteObject(hbmp);
hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(closed_node_id));
if(hbmp == NULL)
if (hbmp == NULL)
return FALSE;
i =ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
DeleteObject(hbmp);
hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(leaf_id));
if(hbmp == NULL)
if (hbmp == NULL)
return FALSE;
i =ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
DeleteObject(hbmp);
hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(ivalid_leaf_id));
if(hbmp == NULL)
if (hbmp == NULL)
return FALSE;
i =ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
ImageList_Add(_hImaLst, hbmp, (HBITMAP)NULL);
DeleteObject(hbmp);
if (ImageList_GetImageCount(_hImaLst) < nbBitmaps)
return FALSE;
// Set image list to the tree view
TreeView_SetImageList(_treeView.getHSelf(), _hImaLst, TVSIL_NORMAL);
TreeView_SetImageList(_treeView.getHSelf(), _hImaLst, TVSIL_NORMAL);
return TRUE;
}
@ -538,7 +537,7 @@ void ProjectPanel::openSelectFile()
void ProjectPanel::notified(LPNMHDR notification)
{
if((notification->hwndFrom == _treeView.getHSelf()))
if ((notification->hwndFrom == _treeView.getHSelf()))
{
TCHAR textBuffer[MAX_PATH];
TVITEM tvItem;
@ -742,7 +741,7 @@ void ProjectPanel::showContextMenu(int x, int y)
ScreenToClient(_treeView.getHSelf(), &(tvHitInfo.pt));
hTreeItem = TreeView_HitTest(_treeView.getHSelf(), &tvHitInfo);
if(tvHitInfo.hItem != NULL)
if (tvHitInfo.hItem != NULL)
{
// Make item selected
_treeView.selectItem(tvHitInfo.hItem);

BIN
PowerEditor/src/icons/funcList_leaf.bmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

BIN
PowerEditor/src/icons/funcList_node.bmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

4
PowerEditor/src/resource.h

@ -144,6 +144,10 @@
#define IDI_PROJECT_FILE 606
#define IDI_PROJECT_FILEINVALID 607
#define IDI_FUNCLIST_ROOT 620
#define IDI_FUNCLIST_NODE 621
#define IDI_FUNCLIST_LEAF 622
#define IDC_MY_CUR 1402
#define IDC_UP_ARROW 1403
#define IDC_DRAG_TAB 1404

Loading…
Cancel
Save