Wednesday, November 25, 2009

Small change to ConsoleWindow class

Some changes in the Core library:

The ConsoleWindow was a static item, allowing calls such as:

ConsoleWindow::error("parse error");

ConsoleWindow is no longer static. It belongs with MainWindow. So, the above calls are replaced with:

if (console())
console()->error("parse error");

The console() function exists in MainWindow, Tool, GraphicsScene, NetworkWindow, and TextEditor. All of these functions call MainWindow's console() function, so they return the same pointer. However, if there are two MainWindow instances, then each will contain a different case that some day there is some need to create two main windows.

Additionally, a new function, "eval", has been added, which current can be used to evaluate a Python expression because the Python plugin controls the console at the present.

console()->eval("print 1+2");

No comments: