diff --git a/DlgAbout.cpp b/DlgAbout.cpp index fa8b4d0..0c1734b 100755 --- a/DlgAbout.cpp +++ b/DlgAbout.cpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // // NppSnippets - Code Snippets plugin for Notepad++ // -// Copyright (C) 2010-2012 Frank Fesevur // +// Copyright (C) 2010-2013 Frank Fesevur // // // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -38,10 +38,11 @@ struct VersionInfo WCHAR* text; }; -#define MAX_VERSION_INFO 10 +#define MAX_VERSION_INFO 11 static VersionInfo s_info[MAX_VERSION_INFO] = { + { {1,3,0,0}, {2013, 6,30}, L"- Fixed problem with inserting UTF snippets.\n- Fixed wrong title of Import Library dialog.\n- Fixed some potential bugs found when trying to fix GCC compilation.\n- Converted the documentation from ODT to DocBook.\n- Upgrade to SQLite version 3.7.17" }, { {1,2,0,0}, {2013, 1, 8}, L"- There was an inconsistency between the documentation and code about the name of the option to specify your custom path for the database. Use DBFile from now on. For backwards compatibility the DBPath entry will still be recognized.\n- When a snippets creates a new document and the current document is empty, it reuses the current one and does not start a new.\n- Added Duplicate snippet function to context menu.\n- New (simple) templates library.\n- Upgrade to SQLite version 3.7.15.1" }, { {1,1,0,0}, {2012, 1, 2}, L"- You can now add a new snippet to a library based upon the current selection or based upon the content of the clipboard.\n- Installation has been improved. A template database is provided and when the plugin tries to find the database and it can't find it, it copies this template database to the AppData plugin-config directory.\n- The About dialog now shows the changelog.\n- When you upgrade the very first time the changelog for the current version will be shown.\n- When you didn't select a specific library for a certain language, the automatic selection of the library is improved. The first language specific library is preferred over the first general library.\n- Resized the edit snippet dialog.\n- Upgrade to SQLite version 3.7.9" }, { {1,0,0,0}, {2011, 9, 6}, L"- The selection or cursor position are now restored after inserting a snippet." }, @@ -56,7 +57,7 @@ static VersionInfo s_info[MAX_VERSION_INFO] = static int s_showTill = MAX_VERSION_INFO; -/////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// // static BOOL OnInitDialog(HWND hDlg) @@ -98,7 +99,7 @@ static BOOL OnInitDialog(HWND hDlg) return TRUE; } -/////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// // static BOOL CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) @@ -141,7 +142,7 @@ static BOOL CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPar return FALSE; } -/////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// // Show the About Dialog, with all version information void ShowAboutDlg() @@ -150,7 +151,7 @@ void ShowAboutDlg() DialogBox(g_hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), g_nppData._nppHandle, (DLGPROC) DlgProc); } -/////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// // Show the About Dialog, with version information until 'prevVer' void ShowAboutDlgVersion(Version prevVer) diff --git a/README.md b/README.md index 6edda6d..fc75516 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ NppSnippets =========== -NppSnippets is an easy to use snippet / template plug-in: Similarity with the TextPad Clip Library is no accident. To insert a snippet simply double click on the item in the list and the snippet is inserted at the current cursor position. To edit right-click on that item. +NppSnippets is an easy to use snippet / template plug-in. Similarity with the TextPad Clip Library is no accident. To insert a snippet simply double click on the item in the list and the snippet is inserted at the current cursor position. To edit right-click on that item. The project page, with downloads and issue tracker, is at https://code.google.com/p/nppsnippets/ -Version 1.2.0 (8 January 2013) -* There was an inconsistency between the documentation and code about the name of the option to specify your custom path for the database. Use DBFile from now on. For backwards compatibility the DBPath entry will still be recognized. -* When a snippets creates a new document and the current document is empty, it reuses the current one and does not start a new. -* Added Duplicate snippet function to context menu. -* New (simple) templates library. -* Upgrade to SQLite version 3.7.15.1 +Version 1.3.0 (30 June 2013) +* Fixed problem with inserting UTF snippets. +* Fixed wrong title of Import Library dialog. +* Fixed some potential bugs found when trying to fix GCC compilation. +* Converted the documentation from ODT to DocBook. +* Upgrade to SQLite version 3.7.17 diff --git a/Version.h b/Version.h index fc3d880..8d6daf6 100755 --- a/Version.h +++ b/Version.h @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // // NppSnippets - Code Snippets plugin for Notepad++ // -// Copyright (C) 2010-2012 Frank Fesevur // +// Copyright (C) 2010-2013 Frank Fesevur // // // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -22,9 +22,9 @@ #ifndef __VERSION_H__ #define __VERSION_H__ -#define VERSION_NUMBER 1,2,0,0 -#define VERSION_NUMBER_STR "1.2.0" -#define VERSION_NUMBER_WSTR L"1.2.0" +#define VERSION_NUMBER 1,3,0,0 +#define VERSION_NUMBER_STR "1.3.0" +#define VERSION_NUMBER_WSTR L"1.3.0" #define COPYRIGHT_STR "Copyright 2010-2013 by Frank Fesevur" #define VERSION_DIGITS 4 diff --git a/__Docs/ReadMe.odt b/__Docs/ReadMe.odt deleted file mode 100755 index 516ad57..0000000 Binary files a/__Docs/ReadMe.odt and /dev/null differ diff --git a/__Docs/ReadMe.xml b/__Docs/ReadMe.xml index e9cbade..e2dc397 100644 --- a/__Docs/ReadMe.xml +++ b/__Docs/ReadMe.xml @@ -2,6 +2,7 @@ + ]>
@@ -10,7 +11,7 @@ NppSnippets, Snippets plug-in for Notepad++ NppSnippets FrankFesevur - 2013-01-08 + 2013-06-27 @@ -23,7 +24,7 @@ The easiest way to install this plugin is by using the Plugin Manager: from the "Plugins" menu, choose the "Plugin Manager" and "Show Plugin Manager". Select the "Snippets" plugin and choose "install" and follow the instructions on the screen. To manually install the plugin, copy NppSnippets.dll to the plugins directory and copy Template.sqlite to the plugins/config directory in the user's "Application Data" directory and name it NppSnippets.sqlite. On my Windows 7 machine this directory is C:\Users\Frank\AppData\Roaming\Notepad++\plugins\config. Then (re)start Notepad++. You can place the database in the plugins/config directory in the Notepad++ installation directory typically in the "Program Files" directory, but this could result in a read-only database due to file permissions and/or User Account Control (UAC). Therefore it is advised to put it in your "Application Data" directory. - You can also specify a custom path (like a shared network path or your Dropbox directory) for your database by manually editing the NppSnippets.ini file and adding a DBFile entry pointing to the full path name of the database. + You can also specify a custom path (like a shared network path or your Dropbox directory) for your database by manually editing the NppSnippets.ini file and adding a DBFile entry pointing to the full path name of the database. The NppSnippets.ini is in your "Application Data" directory. When you automatically upgrade through the Plugin Manager your database is not touched. If you are manually upgrading at least replace the existing dll. It is up to you if you override your own database with the template database provided in the archive. If you have not changed existing snippets or added your own, it is recommended to use the database in the archive. Note that this is a Unicode plug-in, so it doesn't work with an ANSI versions of Notepad++. The Microsoft Visual C++ 2005 Redistributable Package needs to be installed on the computer as well. @@ -43,159 +44,22 @@ Database - NppSnippets uses a SQLite database to store the content. In the archive is a file named NppSnippets.sql. With this you can generate a new (almost empty) SQLite database. At least SQLite 3.6.19 is needed because a foreign key constrains are used and the plug-in will need this when the editing the data through the GUI. So be sure not to create the database with an older SQLite management tool that breaks this. + NppSnippets uses a SQLite database named NppSnippets.sqlite to store all the content. + In the archive is a file named NppSnippets.sql. With this you can generate a new (almost empty) SQLite database. At least SQLite 3.6.19 is needed because a foreign key constrains are used and the plug-in will need this when editing the data through the GUI. So be sure not to create the database with an older SQLite management tool that breaks this. You should only update, insert or delete records and not modify the structure of the database. That can cause the plug-in (and as a result of that Notepad++ itself) to crash. - The database structure is quite simple. There are four tables Library, LibraryLang, Snippets and LangLastUsed. There is a one-to-many relation between Library and LibraryLang, between Library and Snippets and between Library and LangLastUsed. They are all linked to each other with the LibraryID field. It is possible to have multiple libraries per language and one library can be used for many languages. - For every library at least one record in the LibraryLang and Snippets tables is needed. - - - Table Library - - - - Field - Description - - - - - LibraryID - The unique identifier of this library - - - Name - Name of the library - - - CreatedBy - Who created this library - - - Comments - Comments about this library - - - SortBy - Which fields of Snippets are used to sort 0 = "Name, Sort" 1 = "Sort, Name" - - - -
- - - Table LibraryLang - - - - Field - Description - - - - - LibraryID - The library this item is part of - - - Lang - - LangType from Notepad_plus_msgs.h. There are two special cases: - - Libs with Lang = -1 are shown when there is no library for the current language - Libs with Lang = -2 are shown for every language - - - - - -
- - - Table Snippets - - - - Field - Description - - - - - SnippetID - The unique identifier of this snippet - - - LibraryID - The library this item is part of - - - Name - The name of the snippet - - - BeforeSelection - The text inserted before the current cursor / selection - - - AfterSelection - The text inserted after the current cursor / selection - - - ReplaceSelection - Replace a selection or ignore the selection and insert - - - NewDocument - Create a new document before inserting this snippet? - - - NewDocumentLang - Change the language of the new document to this language - - - Sort - Can determine the order of the snipping in the list. Depends on Library(SortBy) how the list is sorted - - - -
- - - Table LangLastUsed - - - - Field - Description - - - - - Lang - LangType from Notepad_plus_msgs.h - - - LibraryID - This library is the last one used for this language - - - -
- - The current schema user_version of the database is 3. - + The database structure is quite simple. There are four tables Library, LibraryLang, Snippets and LangLastUsed. There is a one-to-many relation between Library and LibraryLang, between Library and Snippets and between Library and LangLastUsed. They are all linked to each other with the LibraryID field. It is possible to have multiple libraries per language and one library can be used for many languages. For every library at least one record in the LibraryLang and Snippets tables is needed. + There is a more detailed description of the fields in the tables in . The current schema user_version of the database is 3.
Why a SQLite database and not plain text files? - All the snippets are in one SQLite database. SQLite is fast and easy to use. With SQLite most of the file and storage handling is taken care of. This is much more efficient then designing my own (complex) file format and implementing a parser and a writer, although I understand that editing a SQLite database is not as easy to edit for some as editing plain text files. But there is a user interface for editing the snippets. + All the snippets are stored in one SQLite database. SQLite is fast and easy to use. With SQLite most of the file and storage handling is taken care of. This is much more efficient then designing my own (complex) file format and implementing a parser and a writer, although I understand that editing a SQLite database is not as easy to edit for some as editing plain text files. But there is a user interface for editing the snippets. Provided Snippets Libraries At this moment the template database is filled with these libraries. If you upgrade from a previous version your databases is not changed. If you want to try any of the new libraries, you must manually import those libraries from the template database. - @@ -285,7 +149,7 @@ Real template handling: variables in the snippets Select a text, right-click that selection and add as new snippet. - If anyone can fix the MinGW compatible makefile, I can eliminate the need for the Visual C++ Redistributable Package. + If anyone can fix the MinGW compatible makefile, I can eliminate the need for the Visual C++ Redistributable Package and provide nightly builds. If possible, drag-and-drop from the list to the active document. Add keyboard shortcut keys to a snippet. It seems to be impossible to change shortcut keys on the fly. If anybody know how to get this to work, let me know! Remember the last select snippet from the list. Useful when switching between different languages. @@ -329,12 +193,12 @@ Release history - Version 1.3.0 (xx XXXXX 2013) + Version 1.3.0 (30 June 2013) - Fixed problem with inserting UTF snippets. + Fixed problem with inserting UTF snippets (issue #3). Fixed wrong title of Import Library dialog. Fixed some potential bugs found when trying to fix GCC compilation. - Converted the documentation from ODT to DocBook. + Converted the documentation from ODT to DocBook. Because of that an on-line version of the documentation is available as well. Upgrade to SQLite version 3.7.17 @@ -441,6 +305,7 @@ + &app_tabdef; &app_lic;
diff --git a/__Docs/tabledef.xml b/__Docs/tabledef.xml new file mode 100644 index 0000000..1f2e318 --- /dev/null +++ b/__Docs/tabledef.xml @@ -0,0 +1,133 @@ + + Table definitions + + Table Library + + + + Field + Description + + + + + LibraryID + The unique identifier of this library + + + Name + Name of the library + + + CreatedBy + Who created this library + + + Comments + Comments about this library + + + SortBy + Which fields of Snippets are used to sort 0 = "Name, Sort" 1 = "Sort, Name" + + + +
+ + Table LibraryLang + + + + Field + Description + + + + + LibraryID + The library this item is part of + + + Lang + + LangType from Notepad_plus_msgs.h. There are two special cases: + + Libs with Lang = -1 are shown when there is no library for the current language + Libs with Lang = -2 are shown for every language + + + + + +
+ + Table Snippets + + + + Field + Description + + + + + SnippetID + The unique identifier of this snippet + + + LibraryID + The library this item is part of + + + Name + The name of the snippet + + + BeforeSelection + The text inserted before the current cursor / selection + + + AfterSelection + The text inserted after the current cursor / selection + + + ReplaceSelection + Replace a selection or ignore the selection and insert + + + NewDocument + Create a new document before inserting this snippet? + + + NewDocumentLang + Change the language of the new document to this language + + + Sort + Can determine the order of the snipping in the list. Depends on Library(SortBy) how the list is sorted + + + +
+ + Table LangLastUsed + + + + Field + Description + + + + + Lang + LangType from Notepad_plus_msgs.h + + + LibraryID + This library is the last one used for this language + + + +
+