Discussion:
[notepad-plus - Plugin Development] Plugins submenu
(too old to reply)
SourceForge.net
2008-11-06 08:16:44 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=5586805
By: zobo

Hi Don, Jens, all ...

I'm working on unicoding DBGP plugin, which is a painful process as Delphi does
not have simple unicode support. Rather I'm unicoding just the interface to
notepad.

Anyway, I'm trying to implement a new feature and I would like it to be in the
form of a submenu inside plugins menu.
I created a menu and then used MofidyMenu with MF_POPUP to attach this menu
to the desired plugins menu entry. Seem to work fine, I can even update this
menu with new elements, change the gray and checked flag etc. The problem is
that I don't know where the WM_COMMAND pops out when I click on a item from
this new submenu.
I'm not that good with Win32 API, but I'm guessing the WM_COMMAND from these
items goes to N++ main WndProc (because this new submenu is part of the main
menu now).

How would one go about creating a submenu inside the plugins menu?

Thanks and best regards.
-Zobo

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=482781
SourceForge.net
2008-11-06 10:17:59 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=5587458
By: harrybharry

The most reliable way is doing it like TextFX does: Put all submenu items in
the main plugins menu (like normal), then at startup move them in the submenu.
Notepad++ gets a chance to assign the proper WM_COMMAND values and can use the
default callback.

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=482781
SourceForge.net
2008-11-06 10:41:40 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=5587598
By: zobo

Hi Harry.

This is what I figured too, but the problem with this is, I have a dynamic number
of items in this submenu. As I can "pre generate" a number of items like you
suggested and perhaps get away with it, the API interface requires me to create
a new function for each item callback. If only N++ would pass the CmdID with
the function call (hint hint, improvement!).

Anyway, I was hoping to avoid this, any other ideas? I'd just love to get the
WM_COMMAND from N++ over the plugin API (same way get WM_CREATE for example)...

Thanks.
-Zobo

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=482781
SourceForge.net
2008-11-06 13:16:02 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=5588415
By: harrybharry

The Notepad++ polugin interface cant be altered too much since it would render
loads of plugins unusable. Its a limit we've hit numerous times before, and
the Unicode change already caused a massive amount of problems on its own, imagine
what would happen if the entire interface were to change :)

The reason I was so careful with WM_COMMAND is that it can easily conflict with
other plugins, there is no 'safe-range' here. How dynamic is that menu? If its
soemthing the user has to change as a setting, you could require a restart of
Notepad++, I think NppExec does it this way (you can ask DV for advice maybe?)
and it shouldn't be too much of a hassle to the user. You can also try to add
a small menu to your docked window, or toolbar, or some other list (you might
even manage to create some sort of accelerator table, Notepad++ can only assign
accelerators to items that were available on startup), like I did for FTP
profiles.
A few versions ago the rebar was reworked which allowed room for plugins to
add their own toolbar to Notepad++, which _can_ be made dynamic since the plugin
has control over it (to some degree). However, it was never tested _at all_
and thus not made available to prevent issues arising. If you are interested
in this, we can work from there.

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=482781
SourceForge.net
2008-11-06 13:38:09 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=5588531
By: zobo

Hi...

I agree, changing the interface can be a pain :) It's just an idea for when
something like this will happen.

Anyway, let me be specific of what dynamic means in my case. You use the debugging
plugin to debug PHP code. When a user starts a debugging session in a browser,
some server part connects to the plugin, thus creating a debugging session.
If in the course of this session another debugging session might be started
(this is not so uncommon, especially in AJAX apps) there needs to be a way to
switch between these sessions. This is where this submenu comes into play. For
each session, one element. Needles to say, the content of the menu will change
a lot in the course of the plugins life ...

Yes, I could probably put a pull down box somewhere else, but this seemed as
the nicest way to do it.

I'll think about everything, perhaps try the "preallocated" hack if it works
out. Unless, Is there a way to have a submenu that sends WM_COMMAND messages
to a different (plugin) window.

Best,
-Zobo

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=482781
SourceForge.net
2008-11-06 20:27:22 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=5590862
By: harrybharry

I was thinking about that last option you mentioned, but afaik the windows menu
control just dumps a WM_COMMAND to the messagepump (if that means anything)
and that's it, without much control over it.
If you want to switch between sessions I suggest you actually use a list or
dropdown somewhere else. Sounds like a repetitive task which you don't want
to browse the menu much for. Just selecting something at times is fine, but
when you have to do it a lot there are more efficient GUI elements for that,
such as a listbox, that's my point of view anyway. You can also try and spawn
a new dialog for each session, or create your own tab control inside the dialog
(I don't know how your plugin works since I never work with PHP).

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=482781
SourceForge.net
2008-11-07 07:16:01 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=5594194
By: vor0nwe

"which is a painful process as Delphi does not have simple unicode support."

No, it's not simple like toggling one switch. It's not all that difficult,
though: all I did was define a few special types:

{$IFDEF UNICODE}
  nppString = WideString;
nppChar = WChar;
nppPChar = PWChar;
{$ELSE}
nppString = AnsiString;
nppChar = AnsiChar;
nppPChar = PAnsiChar;
{$ENDIF}

and replaced the 'string' type by those, in all interactions with Notepad++
(not in the interfaces to Scintilla, mind you!).

I've had to use the -W function in a few API calls (instead of the -A function),
but then it worked as a charm...

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=482781

Continue reading on narkive:
Loading...