Dear all,
I'd like to suggest some minor adjustment to the core-code.
Why ?
--------
When developing my ClearCase plug-in (and an upcoming plug-in) I created a new pane in the MessageManager.
When writing stuff to such a pane, aka MessageLog, only text is added, causing the content to grow.
From time to time the user probably wants to clear this.
Sometimes with every command that could write to the log, the previous content could be automatically cleared, but even in that case I think it's a better solution in the design. I guess that adding to those logs will eventually use more and more memory as text is added.
Current Situation :
-------------------------
All those panels/Logs derive from the class MessageLog. There are 2 derived classes :
- SimpleTextLog (which contains a wxTextCtrl) examples : the Build Log, Code::Blocks, Debug Log
- SimpleListLog (which contains a wxListCtrl) examples : Search Results, Build Messages
An example when some of them get cleared is in the Compilergcc.cpp
-> m_Log->GetTextControl()->Clear();
-> m_pListLog()->Clear() (which talks to its wxListCtrl)
Observations :
-------------------
Althoug m_Log and m_pListLog are not exactly on the same level of inheritance, m_pListLog has I think 1 level more, it needs one visible level less to get the actual stuff cleared.
Suggestion :
-----------------
Enhance the interface of the MessageLog class with the pure function :
- virtual void ClearLog() = 0;
Note : we could also call it just Clear instead of ClearLog
Consequences :
---------------------
1) SimpleTextLog need to implement this :
void SimpleTextLog::ClearLog()
{
m_Text->Clear();
}
2) SimpleListLog::ClearLog()
{
Clear();
}
--> with all these additions we did not break any code I guess.
--> We could simplify things (for example in compilergcc.cpp)
m_Log->ClearLog();
m_pListLog->ClearLog();
And now we can add extra functionality (where it all started with), in the context menu that shows up when you right click in the pane of the MessageLog, we could add an extra menu entry "ClearLog", which then calls the ClearLog of it's MessageLog.
The messageManager keeps track of the mappings of the PageIndex and the MessageLog through the m_LogIDs array.
If I am not misataking the context menu shown in the messagemanger is a 'enabled/disabled' version of the edit menu from cbeditor.cpp ?
As already said, maybe the name can be just Clear.
What do you think, could this be done in/before RC3 ?
I did not 'yet' created a feature request for it, since it is not just a feature request, it is also a minor design change.
kind regards,
Lieven