[ENHANCE] enhance AnsiCharactersInsertion feature.

[UPDATE] Implementation of document switcher is in progress.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@761 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2011-05-23 00:51:13 +00:00
parent 1309f8fa8e
commit 851284d90e
11 changed files with 103 additions and 45 deletions

View File

@ -22,7 +22,7 @@
<SubEntries>
<Item posX="1" posY="9" name="Copier dans le presse-papiers"/>
<Item posX="1" posY="10" name="Indentation"/>
<Item posX="1" posY="11" name="MAJUSCULE/minuscule"/>
<Item posX="1" posY="11" name="MAJUSCULE/miniscule"/>
<Item posX="1" posY="12" name="Ligne"/>
<Item posX="1" posY="13" name="Commentaire"/>
<Item posX="1" posY="14" name="Autocomplétion"/>
@ -249,7 +249,7 @@
</Menu>
<Dialog>
<Find title="" titleFind="Rechercher" titleReplace="Remplacer" titleFindInFiles="Rechercher dans les fichiers d'un dossier">
<Find title="" titleFind="Rechercher" titleReplace="Remplacer" titleFindInFiles="Rechercher dans les fichiers d'un dossier" titleMark="Marquer">
<Item id="1" name="Suivant"/>
<Item id="2" name="Annuler"/>
<Item id="1620" name="Recherche :"/>

View File

@ -706,6 +706,9 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
TaskListInfo * tli = (TaskListInfo *)wParam;
getTaskListInfo(tli);
if (lParam != 0)
return TRUE;
if (NppParameters::getInstance()->getNppGUI()._styleMRU)
{
tli->_currentIndex = 0;

View File

@ -50,8 +50,8 @@ void Notepad_plus::command(int id)
case IDM_FILE_OPEN:
{
fileOpen();
//launchFileSwitcherPanel();
//fileOpen();
launchFileSwitcherPanel();
}
break;

View File

@ -32,7 +32,7 @@ void ListView::init(HINSTANCE hInst, HWND parent)
// 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_SHAREIMAGELISTS | LVS_SHOWSELALWAYS;
_hSelf = ::CreateWindow(WC_LISTVIEW,
TEXT(""),

View File

@ -47,15 +47,60 @@ BOOL CALLBACK AnsiCharPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa
{
case NM_DBLCLK:
{
//printStr(TEXT("OK"));
LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) lParam;
int i = lpnmitem->iItem;
if (i == -1)
return TRUE;
insertChar((unsigned char)i);
return TRUE;
}
case LVN_KEYDOWN:
{
switch (((LPNMLVKEYDOWN)lParam)->wVKey)
{
case VK_RETURN:
{
int i = ListView_GetSelectionMark(_listView.getHSelf());
if (i == -1)
return TRUE;
insertChar((unsigned char)i);
return TRUE;
}
default:
break;
}
}
break;
default:
break;
}
}
return TRUE;
case WM_SIZE:
{
int width = LOWORD(lParam);
int height = HIWORD(lParam);
::MoveWindow(_listView.getHSelf(), 0, 0, width, height, TRUE);
break;
}
default :
return DockingDlgInterface::run_dlgProc(message, wParam, lParam);
}
return DockingDlgInterface::run_dlgProc(message, wParam, lParam);
}
void AnsiCharPanel::insertChar(unsigned char char2insert) const
{
char charStr[2];
charStr[0] = (unsigned char)i;
charStr[0] = char2insert;
charStr[1] = '\0';
wchar_t wCharStr[10];
char multiByteStr[10];
@ -80,27 +125,6 @@ BOOL CALLBACK AnsiCharPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa
WideCharToMultiByte(CP_UTF8, 0, wCharStr, -1, multiByteStr, sizeof(multiByteStr), NULL, NULL);
}
(*_ppEditView)->execute(SCI_REPLACESEL, 0, (LPARAM)"");
int len = (i < 128)?1:strlen(multiByteStr);
int len = (char2insert < 128)?1:strlen(multiByteStr);
(*_ppEditView)->execute(SCI_ADDTEXT, len, (LPARAM)multiByteStr);
return TRUE;
}
default:
break;
}
}
return TRUE;
case WM_SIZE:
{
int width = LOWORD(lParam);
int height = HIWORD(lParam);
::MoveWindow(_listView.getHSelf(), 0, 0, width, height, TRUE);
break;
}
default :
return DockingDlgInterface::run_dlgProc(message, wParam, lParam);
}
return DockingDlgInterface::run_dlgProc(message, wParam, lParam);
}

View File

@ -48,6 +48,7 @@ public:
};
void switchEncoding();
void insertChar(unsigned char char2insert) const;
protected:
virtual BOOL CALLBACK AnsiCharPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);

View File

@ -45,15 +45,31 @@ BOOL CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPA
if (i == -1)
return TRUE;
//printInt(i);
//printStr(TEXT("OK"));
int view2set = _fileListView.getViewInfoFromIndex(i);
int index2Switch = _fileListView.getDocIndexInfoFromIndex(i);
::SendMessage(_hParent, NPPM_ACTIVATEDOC, view2set, index2Switch);
activateDoc(i);
return TRUE;
}
case LVN_KEYDOWN:
{
switch (((LPNMLVKEYDOWN)lParam)->wVKey)
{
case VK_RETURN:
{
int i = ListView_GetSelectionMark(_fileListView.getHSelf());
if (i == -1)
return TRUE;
activateDoc(i);
return TRUE;
}
default:
break;
}
}
break;
default:
break;
}
@ -73,3 +89,10 @@ BOOL CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPA
}
return DockingDlgInterface::run_dlgProc(message, wParam, lParam);
}
void VerticalFileSwitcher::activateDoc(int i) const
{
int view2set = _fileListView.getViewInfoFromIndex(i);
int index2Switch = _fileListView.getDocIndexInfoFromIndex(i);
::SendMessage(_hParent, NPPM_ACTIVATEDOC, view2set, index2Switch);
}

View File

@ -45,6 +45,8 @@ public:
_hParent = parent2set;
};
void activateDoc(int i) const;
protected:
virtual BOOL CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);

View File

@ -23,7 +23,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
IDD_FILESWITCHER_PANEL DIALOGEX 26, 41, 142, 324
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE
CAPTION "File Switcher"
CAPTION "Doc Switcher"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
//LISTBOX IDC_LIST_FILESWITCHER,50,44,78,120,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP

View File

@ -32,7 +32,7 @@ void VerticalFileSwitcherListView::init(HINSTANCE hInst, HWND parent, HIMAGELIST
// Create the list-view window in report view with label editing enabled.
int listViewStyles = LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER\
| LVS_SINGLESEL | LVS_AUTOARRANGE\
| LVS_SHAREIMAGELISTS /*| WS_BORDER*/;
| LVS_SHAREIMAGELISTS | LVS_SHOWSELALWAYS;
_hSelf = ::CreateWindow(WC_LISTVIEW,
TEXT(""),
@ -52,10 +52,12 @@ void VerticalFileSwitcherListView::init(HINSTANCE hInst, HWND parent, HIMAGELIST
::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);
*/
ListView_SetExtendedListViewStyle(_hSelf, LVS_EX_FULLROWSELECT | LVS_EX_BORDERSELECT);
LVCOLUMN lvColumn;
lvColumn.mask = LVCF_WIDTH;
@ -84,7 +86,7 @@ LRESULT VerticalFileSwitcherListView::runProc(HWND hwnd, UINT Message, WPARAM wP
void VerticalFileSwitcherListView::initList()
{
::SendMessage(::GetParent(_hParent), WM_GETTASKLISTINFO, (WPARAM)&_taskListInfo, 0);
::SendMessage(::GetParent(_hParent), WM_GETTASKLISTINFO, (WPARAM)&_taskListInfo, TRUE);
for (size_t i = 0 ; i < _taskListInfo._tlfsLst.size() ; i++)
{
TaskLstFnStatus & fileNameStatus = _taskListInfo._tlfsLst[i];

View File

@ -32,6 +32,9 @@ public:
void initList();
int getViewInfoFromIndex(int index) const;
int getDocIndexInfoFromIndex(int index) const;
void setBgColour(int i) {
ListView_SetItemState(_hSelf, i, LVIS_SELECTED|LVIS_FOCUSED, 0xFF);
}
protected:
TaskListInfo _taskListInfo;