Console/Graphics advice requested lazarus / 39-Graphics ---------------------------------------------------------------------- Jackdaw · 2011-04-05 12:35 Hi everyone. Forgive me if the kind of help I need is available somewhere; I've looked and looked but in vain. The background. I'm a research statistician. I authored a specialized statistical language some years ago which implements a certain statistical theory. The language is freely available, but that's irrelevant I guess. I use this tool to help my research, and it gets occasionally used for other applications. This tool was written in Borland Pascal, but also ported to linux using GPC. It's 30k lines of code, mostly uncommented (ouch). The only three things worth knowing are: (1) it provides an interpreted language via a command console and via source files, so one types at the cursor to enter a command, and something happens - e.g. results are printed, something computes, etc. Fairly standard stuff. The language includes control statements (e.g. for loops, if - else -end) which can be entered over several console lines. Results can also be written to files allocated to different channels. (2) Some of the console commands produce a graphics window, which is non-interactive. The graphics window is used to portray results graphically. For example, the computation of a statistical model will generally dump some results to console or file and will also produce a plot of a certain kind. (3) I need to be able to save the plots to file, preferably as postscript or pdf, but failing that any format which converts to these with little or no loss of resolution. These plots end up as pictures in my books and research papers. The problem. This stuff was written in the 80s and early 90s. Times have changed and the compiler I used no longer works, and the code it produced no longer works. Therefore I seek alternatives. I should point out that I consider myself highly expert in traditional Pascal and a complete noob in object-oriented programming. I have converted the code to run under Lazarus/Freepascal, as a console application. This works fine for computation. For the graphics part, I can (and have) used the wingraph unit. This does seem to give about the right plots. A downside is that I seem able only to dump these to large bitmaps, which I would then need to process further. The issues. Option A: Stick with console application. Option B: Stick with wingraph and live with bitmaps. Option C: change the console part of the application to GUI driven. There would be some advantages to this but also some disadvantages - mainly time learning how to do it. Option D: change the graphics bit to a canvas(?) and draw on the canvas directly, driven by entered commands, and output the canvas to a pdf/ps file. Question. A&B currently work. Would A&D work, or would I have to go to C&D? Conditional question. If I go to A&D or C&D, are there ways simply to create a non-interactive canvas, and draw on it using console-type commands? Every example I've seen so far has plots appearing when a button is clicked, driven by on.buttonclick features. Conditional question. If I go to D would I be able to use standard parts of lazarus/freepascal, or would you advise installing something that would help. Any advice would be greatly appreciated. ---------------------------------------------------------------------- eny · 2011-04-05 13:38 Quote from: Jackdaw on April 05, 2011, 02:35:04 pmI should point out that I consider myself highly expert in traditional Pascal and a complete noob in object-oriented programming.If you consider yourself a beginner in Lazarus (more to the point: the LCL) then it's gonna take a fair amount of time to translate your project. QuoteQuestion. A&B currently work. Would A&D work, or would I have to go to C&D?If it works and you do not foresee a lot of changes on the software, leave it as it is (especially considering your experience with Lazarus). On the other hand it could be a fun and rewarding learning process. QuoteConditional question. If I go to A&D or C&D, are there ways simply to create a non-interactive canvas, and draw on it using console-type commands? Most  visual components can be used in a non- visual way. I.e. constructed and used without displaying them. So yes, you can create a TImage, draw on it and save it as a jpeg (for example). QuoteEvery example I've seen so far has plots appearing when a button is clicked, driven by on.buttonclick features.A consequence of the visual nature of most Lazarus applications. But by no means mandatory. QuoteConditional question. If I go to D would I be able to use standard parts of lazarus/freepascal, or would you advise installing something that would help.Lazarus is a very powerful environment with a lot of components readily available. QuoteAny advice would be greatly appreciated. My 2 cents ---------------------------------------------------------------------- Jackdaw · 2011-04-09 10:29 Thanks. I guess this is the consensus, as no other replies.