I just uploaded version 0.9 of the new CharM plugin.
It works similar to Windows Character Map, but with filters. Highlight a letter, select Plugins->CharM->Character Map and it presents you with variations for that letter. e.g. "a", "à", "á", and "ã" are all variations of each other.
It may also work with short pieces of text. For example, "a" is the HTML ASCII value of "a", so highlighting "a" will bring up the same options.
Click the option to replace the selected text.
Version 9.0 is fully functional. Right now it only presents options for letters with non-english variations, e.g. "ñ". If you have any suggestions for other letters or short pieces of text that you would like to see included in the default configuration, post them here. Also, I'm not entirely satisfied with the interface, so if you have suggestions of how to improve it, I'd like to hear them.
Since I'm the developer of both CharM and Simple Script, using either one won't hurt my feelings. There's some overlap, but they serve different purposes. Simple Script can be used to convert all of the special characters in a document with a single pass, and CharM is good for a quick conversion of a single character.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The package contains both a CharM.ini and a Substitution.ini file.
If you included both files intentionally, I think it's strange they both have the same contents. Seems like some remains of a previous naming.
By the way, when you see Character Map included in the title of the subject, don't you think it would have been better to simply name the Plug-In Character Map as well?
What's the use of having to explain a fancy name, that's just there for being fancy?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> The package contains both a CharM.ini and a Substitution.ini file. ... Seems like some remains of a previous naming.
Yes, that's exactly right. I forgot to take it out before zipping up the files. You can ignore the Substitution.ini file. It doesn't have any effect on the plugin.
> What's the use of having to explain a fancy name, that's just there for being fancy?
It's shorter. I decided to go with a shorter name in case I decide to make the form dockable in the future (probably not, but who knows?), so the name will fit better on the tab. I think most programmers, when they see "Char" in the name will recognize that it has something to do with text characters. You're right that it's not a perfect name, but if I continued to wait for a perfect name, I would never get it uploaded.
Anyway, it's too late now. The plugin has been named and now that it's up on SourceForge, we're stuck with it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Then I wonder why you included the description Character Map in the title. Isn't it to be specific about what the Plug-In is intended to do or be?
So why not simply name it like that to totally avoid the need of any explanation.
There were also a number of other names mentioned, even words you yourself used in other messages. I think those words by themselves were even more descriptive than CharM.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> Is there any possibility of utf-8 support, either in CharM or Simple Script? This is critical I think.
CharM: One of the reasons I created this was to give me a simpler plugin to experiment in for UTF-8 support. I've never used Delphi's WideString type before, so I don't know if it can even be done, but that's the plan at least.
Simple Script: This is a little trickier, because it uses StringLists extensively, and I'm not sure if they can work with WideStrings. Plus the Script Writer uses a standard Delphi TMemo component, which uses standard Strings. After I experiment with CharM, I can give you a better idea of whether this is possible in Simple Script.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> I've never used Delphi's WideString type before, so I don't know if it can even be done,
> but that's the plan at least.
Working with WideString variables themselves is almost as easy as working with String variables. However, the Delphi Run-Time Library contains a *lot* of functions which don't work explicitly with WideStrings. Sometimes, a function is overloaded so it works with strings as well as widestrings; sometimes, there's a separate function for widestrings, and sometimes there's no widestring version of the function at all.
To convert between WideString (which is UTF-16, really) and UTF-8, however, you'll have to use either the Windows API functions WideCharToMultiByte and MultiByteToWideChar, using code page 65001; or one of the Unicode conversion routines available in the Delphi Fundamentals routines: http://fundementals.sourceforge.net/unicode.html
Delphi seamlessly converts WideString to PWChar (PWideChar) as it does string to PChar (and vice versa).
Also note, that if you pass a WideString to a String variable, the widestring will be 'converted' automatically, without any warning, even if it means you'll be losing information!
> Simple Script: This is a little trickier, because it uses StringLists extensively,
> and I'm not sure if they can work with WideStrings.
TStringList doesn't support WideStrings. However, if you include 'use WideStrings' in your unit, you can use TWideStringList, which supports both WideStrings and regular strings.
> Plus the Script Writer uses a standard Delphi TMemo component,
> which uses standard Strings.
That can easily be replaced by a TTntMemo, part of the freeware TNT Unicode controls. It works exactly the same as a TMemo control, except that it works with WideStrings.
Good luck,
--
Martijn
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Oh, I forgot, you can also look at the HTMLTag plug-in, though its code is not all that readable (it's also far from finished).
I work with WideStrings internally, and only convert them as required whenever I'm reading or writing text from the scintilla component. I'm posting the most important bit here: the two functions that do the conversion.
Thanks for pointing me in the right direction. I'll work on converting CharM over to unicode first, then Simple Script later.
It looks like TTntMemo won't work for Simple Script. It's no longer freeware, and at any rate, unless it's distributed under a license that allows it to be redistributed in a project under the GPL, I don't think I can use it.
That's one area that confuses me about the GPL. The license allows you to use a non-free editing environment and compiler (Delphi is a perfect example) as long as the source code is free. But non-standard Delphi components blur the distinction between the editing environment and source code. If you add them to a project, they get compiled into the finished product, even if you don't write a single line of code for them. That's why I haven't used any third-party components.
I'll look for other solutions though. The rest of your post is very helpful.
Thanks again.
fidvo
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
License
Redistribution and use in binary forms, with or without modification, are permitted. Redistribution and use in source forms, with or without modification, are permitted provided that the redistributions of source code retain the above copyright.
Disclaimer
This software is provided by the author "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the author be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
============================================================
I can send the files to you, if you like. This license definitely seems to allow that.
It includes the source code, so you need have no compunctions about using third-party controls. At the very least, you can take a look at how they've done it. ;-)
The two advantages of the new (paid) TMS Unicode Component Pack, of course, are a) that they're continually being improved (they're already at version 1.5, 1.0 being the latest TntUnicode release at the time of takover), and that you get support.
Good luck in any case!
--
Martijn
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I mostly want to avoid characters with a single variation (i.e. a single row on the Character Map screen), because otherwise I would be adding every character into the .ini file, each with their own group, and frankly, that's just too much work.
However, the ones you gave as examples could all have multiple rows. For example, " also has “ and ” as variations. & could be expanded to "and".
I'll look at the other HTML control characters too. I suppose they're probably special enough to warrant their own group, even if they only have a single row.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I plan to add one. It's just a matter of getting around to designing an icon.
>I'd like to see an amodal dialog as well or dock it.
I'm a big fan of dockable plugins, but I'm not sure it's a good fit for this one, for two reasons.
1) How do you tell it when you want it to update the button captions? Doing it in real time would be a pain because it would tend to slow down Notepad++ because it would be constantly checking to see if there are options for the currently highlighted text. Better to have it check only when you pull up the window or type in the "Text to replace" box at the top. By the way, if you set a shortcut for it, it becomes very fast to replace a character (Highlight, hit your key combination, click a button).
2) There's the issue of screen real-estate if it's dockable. In other plug-ins, you can often rearrange the controls to make it fit nicely on the side or the bottom of the screen, but the nature of CharM really lends itself more to a square window.
I'm open to discussion on these points, so if both of these issues can be resolved, I don't mind changing it.
>By the way you can delete/replace the text in the "Set" pull down. It still works but not sure you're supposed to do that.
Good point. I'll fix it in the next version.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Look forward to the icon, always more convenient than ploughing through menus :-)
I agree that dockable doesn't really suit this plug-in. So make the dialog amodal. I'm a firm believer that all dialogs (except "You NOW have to act on this before I can carry on" type dialogs) should be amodal. I just hate not being able to type in N++ with CharM open.
all the best
Mark B
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Try by hotkey (ie same key that triggers the dialog) or just monitor for scintilla notifications that the selection has changed (SCN_UPDATEUI). I dont think its that heavy on the CPU to calculate the options, styling is probably much heavier.
I think it would be nice if you could change the UI so it can be docked, maybe alter the amount of rows/columns of buttons depending on the size of the window, adding a scrollbar besides or below them (Just a guess, but I think if you change some characters its likely that you will change to the same type, ie ANSI to ANSI HEX \x## or 0x##, maybe even always display the first column but scroll all the other ones).
BTW, if you ever were going to make a dockable dialog out of it, it automatically becomes a modeless dialog ;).
And oh, you can find nice icons at famfamfam, most of Notepad++ uses them.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just uploaded version 0.9 of the new CharM plugin.
It works similar to Windows Character Map, but with filters. Highlight a letter, select Plugins->CharM->Character Map and it presents you with variations for that letter. e.g. "a", "à", "á", and "ã" are all variations of each other.
It may also work with short pieces of text. For example, "a" is the HTML ASCII value of "a", so highlighting "a" will bring up the same options.
Click the option to replace the selected text.
Version 9.0 is fully functional. Right now it only presents options for letters with non-english variations, e.g. "ñ". If you have any suggestions for other letters or short pieces of text that you would like to see included in the default configuration, post them here. Also, I'm not entirely satisfied with the interface, so if you have suggestions of how to improve it, I'd like to hear them.
You can download it at:
http://sourceforge.net/project/showfiles.php?group_id=189927&package_id=264072
Your work is very appreciated however I still go on using Simple Script to do this job.
Since I'm the developer of both CharM and Simple Script, using either one won't hurt my feelings. There's some overlap, but they serve different purposes. Simple Script can be used to convert all of the special characters in a document with a single pass, and CharM is good for a quick conversion of a single character.
> I just uploaded version 0.9 of the new CharM plugin.
> Version 9.0 is fully functional.
When will 9.0 be available?
Oops. I meant version 0.9 is fully functional. Version 9.0 should be out in 2011.
The package contains both a CharM.ini and a Substitution.ini file.
If you included both files intentionally, I think it's strange they both have the same contents. Seems like some remains of a previous naming.
By the way, when you see Character Map included in the title of the subject, don't you think it would have been better to simply name the Plug-In Character Map as well?
What's the use of having to explain a fancy name, that's just there for being fancy?
> The package contains both a CharM.ini and a Substitution.ini file. ... Seems like some remains of a previous naming.
Yes, that's exactly right. I forgot to take it out before zipping up the files. You can ignore the Substitution.ini file. It doesn't have any effect on the plugin.
> What's the use of having to explain a fancy name, that's just there for being fancy?
It's shorter. I decided to go with a shorter name in case I decide to make the form dockable in the future (probably not, but who knows?), so the name will fit better on the tab. I think most programmers, when they see "Char" in the name will recognize that it has something to do with text characters. You're right that it's not a perfect name, but if I continued to wait for a perfect name, I would never get it uploaded.
Anyway, it's too late now. The plugin has been named and now that it's up on SourceForge, we're stuck with it.
Then I wonder why you included the description Character Map in the title. Isn't it to be specific about what the Plug-In is intended to do or be?
So why not simply name it like that to totally avoid the need of any explanation.
There were also a number of other names mentioned, even words you yourself used in other messages. I think those words by themselves were even more descriptive than CharM.
Hi fidvo,
Thanks for all the work on your plugins! Question:
Is there any possibility of utf-8 support, either in CharM or Simple Script? This is critical I think.
With respect and
Best wishes
Idris
> Is there any possibility of utf-8 support, either in CharM or Simple Script? This is critical I think.
CharM: One of the reasons I created this was to give me a simpler plugin to experiment in for UTF-8 support. I've never used Delphi's WideString type before, so I don't know if it can even be done, but that's the plan at least.
Simple Script: This is a little trickier, because it uses StringLists extensively, and I'm not sure if they can work with WideStrings. Plus the Script Writer uses a standard Delphi TMemo component, which uses standard Strings. After I experiment with CharM, I can give you a better idea of whether this is possible in Simple Script.
Hi Fidvo,
> I've never used Delphi's WideString type before, so I don't know if it can even be done,
> but that's the plan at least.
Working with WideString variables themselves is almost as easy as working with String variables. However, the Delphi Run-Time Library contains a *lot* of functions which don't work explicitly with WideStrings. Sometimes, a function is overloaded so it works with strings as well as widestrings; sometimes, there's a separate function for widestrings, and sometimes there's no widestring version of the function at all.
To convert between WideString (which is UTF-16, really) and UTF-8, however, you'll have to use either the Windows API functions WideCharToMultiByte and MultiByteToWideChar, using code page 65001; or one of the Unicode conversion routines available in the Delphi Fundamentals routines: http://fundementals.sourceforge.net/unicode.html
Delphi seamlessly converts WideString to PWChar (PWideChar) as it does string to PChar (and vice versa).
Also note, that if you pass a WideString to a String variable, the widestring will be 'converted' automatically, without any warning, even if it means you'll be losing information!
> Simple Script: This is a little trickier, because it uses StringLists extensively,
> and I'm not sure if they can work with WideStrings.
TStringList doesn't support WideStrings. However, if you include 'use WideStrings' in your unit, you can use TWideStringList, which supports both WideStrings and regular strings.
> Plus the Script Writer uses a standard Delphi TMemo component,
> which uses standard Strings.
That can easily be replaced by a TTntMemo, part of the freeware TNT Unicode controls. It works exactly the same as a TMemo control, except that it works with WideStrings.
Good luck,
--
Martijn
Oh, I forgot, you can also look at the HTMLTag plug-in, though its code is not all that readable (it's also far from finished).
I work with WideStrings internally, and only convert them as required whenever I'm reading or writing text from the scintilla component. I'm posting the most important bit here: the two functions that do the conversion.
============================================================
function TActiveDocument.AdjustFromCodePage(AText: string): WideString;
var
CP: integer;
ReqSize: integer;
begin
CP := SendMessage(SCI_GETCODEPAGE);
if CP = 0 then begin
Result := AText;
end else begin
ReqSize := MultiByteToWideChar(CP, 0, PChar(AText), System.Length(AText), nil, 0);
Result := StringOfChar(WideChar(#0), ReqSize + 1);
SetLength(Result, MultiByteToWideChar(CP, 0, PChar(AText), System.Length(AText), PWChar(Result), ReqSize + 1));
end;
end;
{ ------------------------------------------------------------------------------------------------ }
function TActiveDocument.AdjustToCodePage(AText: WideString): string;
var
CP: integer;
ReqSize: integer;
begin
CP := SendMessage(SCI_GETCODEPAGE);
if CP = 0 then begin
Result := AText;
end else begin
ReqSize := WideCharToMultiByte(CP, 0, PWChar(AText), System.Length(AText), nil, 0, nil, nil);
Result := StringOfChar(#0, ReqSize + 1);
SetLength(Result, WideCharToMultiByte(CP, 0, PWChar(AText), System.Length(AText), PChar(Result), ReqSize + 1, nil, nil));
end;
end;
============================================================
Martijn:
Thanks for pointing me in the right direction. I'll work on converting CharM over to unicode first, then Simple Script later.
It looks like TTntMemo won't work for Simple Script. It's no longer freeware, and at any rate, unless it's distributed under a license that allows it to be redistributed in a project under the GPL, I don't think I can use it.
That's one area that confuses me about the GPL. The license allows you to use a non-free editing environment and compiler (Delphi is a perfect example) as long as the source code is free. But non-standard Delphi components blur the distinction between the editing environment and source code. If you add them to a project, they get compiled into the finished product, even if you don't write a single line of code for them. That's why I haven't used any third-party components.
I'll look for other solutions though. The rest of your post is very helpful.
Thanks again.
fidvo
The TNT Unicode controls not freeware anymore! Now that's a shame... (Good thing I still have my old copies here. :-P)
The license I've got here says:
TntWare Delphi Unicode Controls
http://www.tntware.com/delphicontrols/unicode/
Copyright (c) 2002-2006, Troy Wolbrink (www.tntware.com)
License
Redistribution and use in binary forms, with or without modification, are permitted. Redistribution and use in source forms, with or without modification, are permitted provided that the redistributions of source code retain the above copyright.
Disclaimer
This software is provided by the author "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the author be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
============================================================
I can send the files to you, if you like. This license definitely seems to allow that.
It includes the source code, so you need have no compunctions about using third-party controls. At the very least, you can take a look at how they've done it. ;-)
The two advantages of the new (paid) TMS Unicode Component Pack, of course, are a) that they're continually being improved (they're already at version 1.5, 1.0 being the latest TntUnicode release at the time of takover), and that you get support.
Good luck in any case!
--
Martijn
Thank you, fidvo, for your reply :-) I do hope it works out. I really like Simple Script especially but I need it most for utf-8!
And thank you, vor0nwe, as well for your clarifications.
Best wishes
Idris
Hey favoridvo,
Could you please add control characters and their HTML equivalents (", ', & etc.) to the Character Map as well?
I mostly want to avoid characters with a single variation (i.e. a single row on the Character Map screen), because otherwise I would be adding every character into the .ini file, each with their own group, and frankly, that's just too much work.
However, the ones you gave as examples could all have multiple rows. For example, " also has “ and ” as variations. & could be expanded to "and".
I'll look at the other HTML control characters too. I suppose they're probably special enough to warrant their own group, even if they only have a single row.
Great work fidvo
Could we have a toolbar icon please?
I'd like to see an amodal dialog as well or dock it.
By the way you can delete/replace the text in the "Set" pull down. It still works but not sure you're supposed to do that.
Thanks of his plug-in.
Mark B
>Could we have a toolbar icon please?
I plan to add one. It's just a matter of getting around to designing an icon.
>I'd like to see an amodal dialog as well or dock it.
I'm a big fan of dockable plugins, but I'm not sure it's a good fit for this one, for two reasons.
1) How do you tell it when you want it to update the button captions? Doing it in real time would be a pain because it would tend to slow down Notepad++ because it would be constantly checking to see if there are options for the currently highlighted text. Better to have it check only when you pull up the window or type in the "Text to replace" box at the top. By the way, if you set a shortcut for it, it becomes very fast to replace a character (Highlight, hit your key combination, click a button).
2) There's the issue of screen real-estate if it's dockable. In other plug-ins, you can often rearrange the controls to make it fit nicely on the side or the bottom of the screen, but the nature of CharM really lends itself more to a square window.
I'm open to discussion on these points, so if both of these issues can be resolved, I don't mind changing it.
>By the way you can delete/replace the text in the "Set" pull down. It still works but not sure you're supposed to do that.
Good point. I'll fix it in the next version.
Hi
Look forward to the icon, always more convenient than ploughing through menus :-)
I agree that dockable doesn't really suit this plug-in. So make the dialog amodal. I'm a firm believer that all dialogs (except "You NOW have to act on this before I can carry on" type dialogs) should be amodal. I just hate not being able to type in N++ with CharM open.
all the best
Mark B
>I'm a firm believer that all dialogs ... should be amodal.
I generally agree with you. The issue of when to update the button captions still needs to be addressed if I'm going to change it though.
Try by hotkey (ie same key that triggers the dialog) or just monitor for scintilla notifications that the selection has changed (SCN_UPDATEUI). I dont think its that heavy on the CPU to calculate the options, styling is probably much heavier.
I think it would be nice if you could change the UI so it can be docked, maybe alter the amount of rows/columns of buttons depending on the size of the window, adding a scrollbar besides or below them (Just a guess, but I think if you change some characters its likely that you will change to the same type, ie ANSI to ANSI HEX \x## or 0x##, maybe even always display the first column but scroll all the other ones).
BTW, if you ever were going to make a dockable dialog out of it, it automatically becomes a modeless dialog ;).
And oh, you can find nice icons at famfamfam, most of Notepad++ uses them.
By the way, the above post is mine; I forgot to log in first. I just woke up from a nap, so I'm still a little groggy.
fidvo