GDeLTK

TCL/TK

Notepad++

Wine

Linux

XML

FOP

Guitare

Voyages?

Citations

Reste à faire

edit SideBar


Améliorer la coloration syntaxique du langage TCL dans Notepad++

Corrections à apporter dans le projet scintilla

La coloration syntaxique de TCL/TK est gérée dans par scintilla. Il faut modifier le fichier LexTCL.cxx puis compiler la solution avec VC++2008 pour obtenir scilexer.dll.

Les améliorations concernent l'ajout de règles de gestions...

  1. http://leohome.free.fr/download/npp/LexTCL.cxx

Corrections à apporter dans le projet notepad ++

Il faut modifier les fichiers suivants :

  1. http://leohome.free.fr/download/npp/ScintillaEditView.cpp
  2. http://leohome.free.fr/download/npp/ScintillaEditView.h

[Note] Les fichiers langs.xml, langs.model.xml et styler.model.xml ont aussi été modifiés pour améliorer la coloration syntaxique.

Corrections dans ScintillaEditView.h

	//suppression HL
	//void setTclLexer();
	//fin suppression HL
    void setObjCLexer(LangType type);
	void setUserLexer(const TCHAR *userLangName = NULL);
	void setExternalLexer(LangType typeDoc);
	void setEmbeddedJSLexer();
    void setPhpEmbeddedLexer();
    void setEmbeddedAspLexer();
	//Simple lexers
	// ajout HL
	void setTclLexer() {
		setLexer(SCLEX_TCL, L_TCL, LIST_0 | LIST_1 | LIST_2 | LIST_3 | LIST_4 | LIST_5 | LIST_6);
	};
	// fin ajout HL

Corrections dans ScintillaEditView.cpp

Elles consistent à mettre en commentaire les lignes suivantes :

 /*
 void ScintillaEditView::setTclLexer()
 {
	const char *tclInstrs;
        const char *tclTypes;


    execute(SCI_SETLEXER, SCLEX_TCL); 

	const TCHAR *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
	makeStyle(L_TCL, pKwArray);

	basic_string<char> keywordListInstruction("");
	basic_string<char> keywordListType("");
	if (pKwArray[LANG_INDEX_INSTR])
	{
 #ifdef UNICODE
		basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_INSTR];
		keywordListInstruction = wstring2string(kwlW, CP_ACP);
 #else
		keywordListInstruction = pKwArray[LANG_INDEX_INSTR];
 #endif
	}
	tclInstrs = getCompleteKeywordList(keywordListInstruction, L_TCL, LANG_INDEX_INSTR);

	if (pKwArray[LANG_INDEX_TYPE])
	{
 #ifdef UNICODE
		basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_TYPE];
		keywordListType = wstring2string(kwlW, CP_ACP);
 #else
		keywordListType = pKwArray[LANG_INDEX_TYPE];
 #endif
	}
	tclTypes = getCompleteKeywordList(keywordListType, L_TCL, LANG_INDEX_TYPE);

	execute(SCI_SETKEYWORDS, 0, (LPARAM)tclInstrs);
	execute(SCI_SETKEYWORDS, 1, (LPARAM)tclTypes);
 }
 */

Mettre à jour la version de Notepad ++ dans npp 5.7

Tout se passe dans les fichiers ressource.h et Notepad_plus.rc

  1. Editer le fichier \PowerEditor\src\resource.h
  2. modifier la ligne #define NOTEPAD_PLUS_VERSION TEXT("Notepad++ v5.7.0.1 modifié pour TCL/TK")
  3. Editer le fichier \PowerEditor\src\Notepad_plus.rc
  4. modifier la ligne : LTEXT NOTEPAD_PLUS_VERSION, IDC_STATIC,70,20,165,11
  5. modifier la ligne : LTEXT UNICODE_ANSI_MODE, IDC_STATIC,210,20,65,11

Modifications supplémentaires pour le fonctionnement sous wine

Sous wine 1.2, l'IHM "Searching...\nPress Enter to Cancel" gèle lors de la recherche dans des fichiers. Pour y remédier, je désactive l'affichage de cette IHM dans le fichier PowerEditor\src\Notepad_plus.cpp (à 2 endroits) :

	// modification HL
	//if (fileNames.size() > 1)
	//	CancelThreadHandle = ::CreateThread(NULL, 0, AsyncCancelFindInFiles, _hSelf, 0, NULL);
	// fin modification HL
  • désactiver la mise à jour automatique des fichiers (cf. config.xml)
  • définir la taille de la tabulation à 3 caractères (cf. config.xml)
  • à faire : affichage des bulles d'aide (problème complexe à résoudre)

Compiler npp 5.7

la compilation s'effectue sous VC++2008 :

  1. ouvrir le projet npp
  2. dans les propriétés du projet, effacer les commandes dans évènement de génération > évènement après génération > ligne de commande.
  3. lancer la compilation

Corrections à apporter dans l'installation

  1. ajouter le fichier tcl.xml dans installer/APIs
  2. ajouter les fichiers suivants dans bin :
    • notepad++.exe
    • scilexer.dll
    • NppShell64_01.dll
    • contextMenu.xml
    • langs.xml
    • lang.model.xml
    • config.model.xml (pour désactiver la mise à jour automatique des fichiers)
    • styler.model.xml
    • change.log
  3. ajouter les plugins suivants dans bin/plugins
    • Function List (y compris le fichier xml de personnalisation des règles pour tcl/tk)
    • Light explorer
    • xml tools
    • XBracketLight
    • SnippetPlus
  4. modifier le script de création d'installation nsi

à compléter : mettre en ligne le fichier nppSetup5.7.0.1.nsi

Mettre à jour la version de Notepad ++ dans npp 5.51 (obsolète)

  1. Editer le fichier \PowerEditor\src\resource.h
  2. modifier la ligne ##define NOTEPAD_PLUS_VERSION TEXT("Notepad++ v5.5.1.1 modifié pour TCL/TK")
  3. http://leohome.free.fr/download/npp/resource.h
  4. Editer le fichier Notepad_plus.rc
  5. modifier la ligne : LTEXT NOTEPAD_PLUS_VERSION, IDC_STATIC,50,16,150,19
  6. modifier la ligne : LTEXT UNICODE_ANSI_MODE, IDC_STATIC,200,16,65,11

Scripts modifiés pour intégrer la coloration syntaxique du langage TCL (obsolète)

Script d'installation modifié

http://leohome.free.fr/download/npp/notepad++5.01.2.nsi

Corriger la coloration syntaxique de tcl dans npp 5.01

1 / dans ScintillaEditView.cpp :

 switch (typeDoc)
    {
    case L_C :
    case L_CPP :
    case L_JS:
    case L_JAVA :
    case L_RC :
    case L_CS :
 remove->    case L_TCL :
           setCppLexer(typeDoc); break;

...

    case L_LUA :
           setLuaLexer(); break;

 add ->      case L_TCL :
 add ->        setTclLexer(typeDoc); break;

      case L_MAKEFILE :
           setMakefileLexer(); break;

2/ in ScintillaEditView.h

            void setLuaLexer() {
               setLexer(SCLEX_LUA, L_LUA, LIST_0 | LIST_1 | LIST_2 |LIST_3);
            };
 add ->   void setTclLexer() {
 add ->      setLexer(SCLEX_TCL, L_TCL, LIST_0 | LIST_1 | LIST_2 | LIST_3 | LIST_4 | LIST_5 | LIST_6);
 add ->   };
            void setMakefileLexer() {
               execute(SCI_SETLEXER, SCLEX_MAKEFILE);
               makeStyle(L_MAKEFILE);
            };