Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

indent/unindent plugin

(1/3) > >>

danselmi:
Hello

I use codeblocks for HDL editing (on my every day job) so i added indent/unindent mechanism for vhdl and verilog.
For vhdl I also added the feature that codeblocks replaces the three characters ',' '.' and ';' if they are repeated (pressed twice in 400 ms behind each other):
,, will be replaced with <=  .. will be replaced with =>  and  ;; will be replaced with :=


Am I right, that it is not yet possible to implement indent/unindent through a plugin?

I think this should be easy:

* Add an interface to cbEditor (two static methods and some static attributes) to register/unregister a function-pointer corresponding to a lexer number.
* A plugin has to register (set function pointer(s)) for a specific language (wxSCI_LEX_CPP or wxSCI_LEX...) in the attach method and to unregister in the detach method.
* In the OnEditorCharAdded method select the function corresponding to the current lexer.
Advantages:

* It is not needed to change cbEditor to add a new language.
* Only the needed languages can be loaded.
* An unstable indent/unindent mechanism can be disabled.Disadvantages:

* We have to provide a way to acces functions like GetLastNonWhitespaceChar() and FindBlockStart() from these plugins to reuse them.
* Speed?
* If the "repeat" mechanism is useful for other languages too, we should provide a way to use the same wxTimer object. A timer is a finite resource.
What do you think?


Thank you very much for developing Code::Blocks!



[attachment deleted by admin]

dje:
Hi !

With current plugin architecture, you can add items to menu, contextual menu and editors.
I don't understand why you could succeed in implementing a plugin that match your need.

Dje

danselmi:
Hi

As you could see in the attachment from the previous post: I have not implemented these features
in a plugin but in the core.

My question was if this is the right place or if it would be better to extend the archtecture to make these
things possible in a plugin and not only in the core.
Further i have drawn a way to implement this interface to the current architecture (and reviewed it roughly).
I have not realized these changes. First I'd like to get some feedback.

Daniel

Edit: perhaps this is the wrong place for this post?

danselmi:
Hi

Is there a plan to extend the plugin architecture to implement indent/unindent in a plugin?

You can find pros/cons in my first post.

Daniel

dje:
Hi !

I think your need is too specific to be implemented in the core.
I personnally use ... in my comments and wouldn't like to see something else happen.

Plugin API is stable since C::B 8.02. That was a requirement to release it.
I see no reason in what you want to do to change it.

I think you should be more precise on your problem, maybe no change is required.
If you need a new feature, you can post it at BerliOS

Dje

Navigation

[0] Message Index

[#] Next page

Go to full version