Browse Source

[NEW_FEATURE] Add "paste HTML content" and "paste RTF content" commands.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@740 f5eea248-9336-0410-98b8-ebc06183d4e3
remotes/trunk
Don Ho 14 years ago
parent
commit
a5083edfb5
  1. 1
      PowerEditor/installer/nativeLang/english.xml
  2. 2
      PowerEditor/installer/nativeLang/french.xml
  3. 9
      PowerEditor/src/Notepad_plus.rc
  4. 33
      PowerEditor/src/NppCommands.cpp
  5. BIN
      PowerEditor/src/localizationString.h
  6. 3
      PowerEditor/src/menuCmdID.h

1
PowerEditor/installer/nativeLang/english.xml

@ -28,6 +28,7 @@
<Item posX="1" posY="14" name="Auto-Completion"/>
<Item posX="1" posY="15" name="EOL Conversion"/>
<Item posX="1" posY="16" name="Blank Operations"/>
<Item posX="1" posY="17" name="Paste Special"/>
<Item posX="2" posY="16" name="Mark All"/>
<Item posX="2" posY="17" name="Unmark All"/>
<Item posX="2" posY="18" name="Jump Up"/>

2
PowerEditor/installer/nativeLang/french.xml

@ -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/miniscule"/>
<Item posX="1" posY="11" name="MAJUSCULE/minuscule"/>
<Item posX="1" posY="12" name="Ligne"/>
<Item posX="1" posY="13" name="Commentaire"/>
<Item posX="1" posY="14" name="Autocomplétion"/>

9
PowerEditor/src/Notepad_plus.rc

@ -255,14 +255,19 @@ BEGIN
POPUP "Blank Operations"
BEGIN
MENUITEM "Trim Trailing Space", IDM_EDIT_TRIMTRAILING
MENUITEM "Trim Leading Space", IDM_EDIT_TRIMLINEHEAD
MENUITEM "Trim Leading and Trailing Space", IDM_EDIT_TRIM_BOTH
MENUITEM "Trim Leading Space", IDM_EDIT_TRIMLINEHEAD
MENUITEM "Trim Leading and Trailing Space", IDM_EDIT_TRIM_BOTH
MENUITEM "EOL to Space", IDM_EDIT_EOL2WS
MENUITEM "Remove Unnecessary Blank and EOL", IDM_EDIT_TRIMALL
MENUITEM SEPARATOR
MENUITEM "TAB to Space", IDM_EDIT_TAB2SW
MENUITEM "Space to TAB", IDM_EDIT_SW2TAB
END
POPUP "Paste Special"
BEGIN
MENUITEM "Paste HTML Content", IDM_EDIT_PASTE_AS_HTML
MENUITEM "Paste RTF Content", IDM_EDIT_PASTE_AS_RTF
END
MENUITEM SEPARATOR
MENUITEM "Column Mode...", IDM_EDIT_COLUMNMODETIP
MENUITEM "Column Editor...", IDM_EDIT_COLUMNMODE

33
PowerEditor/src/NppCommands.cpp

@ -21,6 +21,10 @@
#include "ShortcutMapper.h"
#include "TaskListDlg.h"
#define CF_HTML TEXT("HTML Format")
#define CF_RTF TEXT("Rich Text Format")
void Notepad_plus::macroPlayback(Macro macro)
{
_pEditView->execute(SCI_BEGINUNDOACTION);
@ -142,6 +146,35 @@ void Notepad_plus::command(int id)
}
break;
case IDM_EDIT_PASTE_AS_RTF:
case IDM_EDIT_PASTE_AS_HTML:
{
UINT f = RegisterClipboardFormat(id==IDM_EDIT_PASTE_AS_HTML?CF_HTML:CF_RTF);
if (!IsClipboardFormatAvailable(f))
return;
if (!OpenClipboard(NULL))
return;
HGLOBAL hglb = GetClipboardData(f);
if (hglb != NULL)
{
LPSTR lptstr = (LPSTR)GlobalLock(hglb);
if (lptstr != NULL)
{
// Call the application-defined ReplaceSelection
// function to insert the text and repaint the
// window.
_pEditView->execute(SCI_REPLACESEL, 0, (LPARAM)lptstr);
GlobalUnlock(hglb);
}
}
CloseClipboard();
}
break;
case IDM_EDIT_DELETE:
_pEditView->execute(WM_CLEAR);
break;

BIN
PowerEditor/src/localizationString.h

Binary file not shown.

3
PowerEditor/src/menuCmdID.h

@ -99,6 +99,9 @@
#define IDM_EDIT_BLOCK_COMMENT_SET (IDM_EDIT + 35)
#define IDM_EDIT_BLOCK_UNCOMMENT (IDM_EDIT + 36)
#define IDM_EDIT_COLUMNMODETIP (IDM_EDIT + 37)
#define IDM_EDIT_PASTE_AS_HTML (IDM_EDIT + 38)
#define IDM_EDIT_PASTE_AS_RTF (IDM_EDIT + 39)
#define IDM_EDIT_AUTOCOMPLETE (50000 + 0)
#define IDM_EDIT_AUTOCOMPLETE_CURRENTFILE (50000 + 1)

Loading…
Cancel
Save