Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
Source Formatter
Ceniza:
Time to ask before writing a complex parser when it's maybe unnecessary...
Customizing AStyle plugin provides:
Indentation:
* Indentation size (in spaces)
* Force using TABs
* Convert TABs to spaces
* Fill empty lines with the whitespace of their previous lines
* Indent classes
* Indent switches
* Indent case: statement in switches
* Indent brackets
* Indent blocks
* Indent namespaces
* Indent labels
* Indent multi-line preprocessor definitions
Formatting
* Brackets
* Pad empty lines around header blocks
* Break 'else if()' header combinations into separate lines
* Insert space padding around operators
* Insert space padding around parenthesis
* Don't break complex statements and multiple statements residing in a single line
* Don't break one-line blocks
Good, now: what to keep, what to add, what to remove or just a full redisign that allows even further customizations (this one was my idea, but it'd take longer to implement)?
Takeshi Miya: that could be implemented in the current plugin, with some time :)
[edit]
Takeshi Miya: I just added a Preview button and removed the READONLY flag for the wxTextCtrl in AStyle's plugin. I still need to redesign it to share the wxTextCtrl across the 3 trabs.
Patch to change the wxTextCtrl for a cbEditor that reflects the editor settings is welcomed :)
Another text sample that includes more cases is also welcomed :)
[/edit]
tiwag:
the only thing which really bugs me using Astyle is, that
wxWidgets-typical macro constructs like
--- Code: ---BEGIN_EVENT_TABLE(MainFrame, wxFrame)
EVT_ERASE_BACKGROUND(MainFrame::OnEraseBackground)
EVT_SIZE(MainFrame::OnSize)
EVT_UPDATE_UI(idViewStatusbar, MainFrame::OnViewMenuUpdateUI)
EVT_MENU_RANGE(wxID_FILE1, wxID_FILE9, MainFrame::OnFileReopen)
EVT_PROJECT_ACTIVATE(MainFrame::OnProjectActivated)
EVT_SHOW_DOCK_WINDOW(MainFrame::OnRequestShowDockWindow)
END_EVENT_TABLE()
--- End code ---
lose their format. this maybe owns potential for enhancements ...
Ceniza:
tiwag: that'd need some kind of hack. That's what you get when playing with macros :)
Since it could also contribute with SourceFormatter's dialog, here's an example of AStyle's dialog with the Sample wxTextCtrl out of the wxNoteBook.
Evil for resolutions under 1024x768, and not that pretty IMHO, and couldn't find what else to add where the wxStaticTextSizer with title "Info" is now (maybe some random picture of a naked girl would make people launch that dialog more often, changing that 90/10/1 rule :P).
thomas:
--- Quote ---Good, now: what to keep, what to add, what to remove or just a full redisign that allows even further customizations (this one was my idea, but it'd take longer to implement)?
--- End quote ---
I am not sure if a redesign really takes that much longer. Adapting something existing (especially if you did not write it in the first place) is often tedious.
thomas:
--- Quote from: Ceniza on January 18, 2006, 09:07:12 am ---tiwag: that'd need some kind of hack. That's what you get when playing with macros :)
--- End quote ---
Hey! Why not an "indent between <regex> and <regex>" option? That might be good for other things, too (not just event tables).
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version