GUI's
- BigJohnT
-
Topic Author
- Offline
- Administrator
-
- Posts: 7000
- Thank you received: 1175
John
Please Log in or Create an account to join the conversation.
- gtom
- Offline
- Junior Member
-
- Posts: 31
- Thank you received: 0
If you take a look at windows, nobody will use pure C/C++ Python or similar except for small Applications.
About 95% of the Windows software is written in RAD (Rapid Application Development) languages.
Think that Mach (a popular Windows CNC App) is written in BASIC (Visual Basic)
Also you have to think about the TIME you need to write a Application and to learn about the operating systems API.
When i started mocca i was looking for a RAD Tool that works under linux. i found Lazarus/Freepascal the most powerful combination to write a GUI for emc.
1.) The LCL (the Lazarus Visual Components) are well documented and are available for all Widget-Sets and OS
(Gtk2,Gtk,Carbon,WinCE,MacOS etc...)
2.) The Editor and Form-Designer are perfect for writing big applications.
3.) The generated code is nearly 1:1 C Code
4) Pascal can directly link / be linked to C-Code and C librarys
5.) Pascal is available since the early 70s and is avaliable for all OS
6.) time-saving: you do not have to care about writing Dialogs, writing code for Events (keyboard,mouse ect)
Just click on the property, drop a control on a Form, move it, color it etc...
7.) Code is portable between OS
8.) If you are lost in your code just right-click on a function and you can follow the declaration / calling order
9) if you dont remember the params of a function just place the mouse over it and it will show you the params and the
file where this function was declared.
regards, Thomas
Please Log in or Create an account to join the conversation.
- BigJohnT
-
Topic Author
- Offline
- Administrator
-
- Posts: 7000
- Thank you received: 1175
Thanks for the good explanation on freepascal. As for windows I don't even care if it runs on windows at this point as I only have one windoz machine and 4 computers running Ubuntu. So it looks like the Gtk family of widgets kinda work for most rad applications.
What are the "connections" needed for mocca to communicate with EMC?
I would move your thread over here to this area but I'm afraid I might mess it up.
Thanks
John
Please Log in or Create an account to join the conversation.
- gtom
- Offline
- Junior Member
-
- Posts: 31
- Thank you received: 0
emcpas.cc is the C-Interface between emc and mocca.
emc2pas.pas are the pascal declarations.
These 2 files will be linked to emc's libemcini.so, libemchal.so, libemc.a, libnml.so
simcanon.cc is the C- interface to the RS274 interpreter for the preview.
glcanon.pas is the pascal code for the preview.
Those 2 were translated from the python code (gcodemodule.cc, glcanon.py,interpreter.py) to pascal.
Lazarus (the LCL component classes) implements the gui.
moccapkg is a custom "component - package":
Normaly on a linux system the theme-manager is involved in painting the visible controls.
This makes every gui dependend on the installed theme and window-manager. Take a look at your scrollbars. They will change in size,color,contrast etc depending on your theme. As mocca is intended to be used on "real" machines i wrote my own compnents (Button,Slider,Lister,Led)
TSlider is a kind of Scrollbar but does not depend on the theme. TLister is a Listbox where the selected line of GCode is centered in the control so you always see the next lines and the already executed lines. TMocButton is a Button that can show Bitmaps and Multiline-Text. This Button does not depend on the Theme Manager also to avoid those "modern", nearly unreadable Buttons. MocLed is a simple LED Control.
simulator.pas is a 3D Preview of the milled part (only for XYZ Machines). The idea itself came from Jeff Epplers gdepth.py, was translated to pascal and integrated in mocca. (This took just 6 Hrs of programming)
configreader.pas reads the mocca config file (a xml-file)
stylereader.pas reads for each visible window (Dialog) the style and appearance of the window (user can edit the design without touching the code itself)
regards Thomas
Please Log in or Create an account to join the conversation.
- cmorley
- Away
- Moderator
-
- Posts: 7919
- Thank you received: 2147
What made you decide to take on such a project?
Whats next for it Lathe support?
I really like the touch off screen by the way.
Please Log in or Create an account to join the conversation.
- gtom
- Offline
- Junior Member
-
- Posts: 31
- Thank you received: 0
Did you know pascal much before you started?
Yes, i knew pascal before i started this project cause in school we worked with VisualBasic, VisualC++ and Borland Delphi.
cmorley wrote:
What made you decide to take on such a project?
There have been several reasons to write a new Gui.
1) I liked the appearance of TkEmc but i missed the preview.
2.) I wanted a Gui that is similar to professional CNC Controls.
3.) i wanted a designable Gui
cmorley wrote:
Whats next for it Lathe support?
Lathe Support was started with Rev 142 of mocca, still some bugs in Lathe mode but we are working on it.
cmorley wrote:
I really like the touch off screen by the way.
Thanks, as mocca is designable you can place the controls where you want. You can size the buttons, change the command that will be executed on a button click etc. Mocca can also be run fullscreen (There are still problems caused by the window manager on some systems)
regards, Thomas
Please Log in or Create an account to join the conversation.
- ynneb
- Offline
- New Member
-
- Posts: 19
- Thank you received: 0
I am keen to know when you have found a way that regular users can easily design thier own screens.
I have tried Mocca but now EMC will not open up without crashes. Possibly because I am booting it under wubi within winows, although it did boot when I hadn't installed Mocca.
Anyway keep asking questions as I am keen to see what you can dig up.
gtom wrote:
Art Fenerty is a BIG C++ fan. I know that Mach is not written in VB, however the guy who has bought out Artsoft was a VB fan, although I doubt he has changed the Mach3 code to VB either.Think that Mach (a popular Windows CNC App) is written in BASIC (Visual Basic)
Please Log in or Create an account to join the conversation.
- gtom
- Offline
- Junior Member
-
- Posts: 31
- Thank you received: 0
The Mach3 Script dialect is something like Pascal, and the code itself contains lot of emc related stuff... StraightTraverse etc...
Maybe the interpreter is a emc RS274 interpreter ???

Please Log in or Create an account to join the conversation.
- ynneb
- Offline
- New Member
-
- Posts: 19
- Thank you received: 0
Even though I have had limited success with Mocca I can see that it is definately the way to go.
You should be able to achieve any design you want using it. If you do the main design as one big picture and have it as the background, you can then assign buttons, dros, sliders, etc over the top of the background picture.
I imagine the more users of Mocca, the more motive to develop it further.
Can I suggest you start doing a pictorial design using your favorite drawing software, and then we can worry about getting it all working next.
I think you will find Realdraw Pro a great program for creating your screen designs.
www.mediachance.com/realdraw/index.html
PS I have started to work on a design based soley on the graphics. Once done it will be only a matter of assigning the buttons etc over the top of it.
www.linuxcnc.org/component/option,com_ku...d,3637/lang,english/
Please Log in or Create an account to join the conversation.
- cmorley
- Away
- Moderator
-
- Posts: 7919
- Thank you received: 2147
I remember some talk on the EMC maillist about it.
Please Log in or Create an account to join the conversation.