Development: Getting started - t-oster/VisiCut GitHub Wiki

This is a guide for people who want to start contributing to VisiCut as a developer.

Setting up the environment

Necessary software

  • Debian/Ubuntu:
    • needed: sudo apt-get install git openjdk-11-jdk maven
    • recommended: sudo apt-get install netbeans
    • optional: sudo apt-get install fakeroot checkinstall nsis inkscape librsvg2-bin translate-toolkit
    • Note that NetBeans is not available on Debian 10 (Buster), but can be downloaded here (alternatively: IntelliJ IDEA (Community Edition)).
    • translate-toolkit will make the prop2po and po2prop Tool available (they are useful for the translation)
  • Windows:
  • macOS:

If you want to build the installer, Debian/Ubuntu is recommended because you can generate the packages for all other operating systems from there.

Editing the Graphical User Interface layout

If you want to change the GUI layout (add or change interface elements), some parts are created using the Swing GUI Form Editor which was removed from NetBeans after version 7.0.1. Because this old version (http://netbeans.org/downloads/7.0.1/index.html) has problems with Java 11, we suggest that you use Netbeans 11.2 (or possibly newer) and download the following two plugins:

  • Form Editor: http://plugins.netbeans.org/plugin/43853/swing-application-framework-support
  • Beansbinding Support for Form Editor: https://github.com/emilianbold/nb-apache-form-binding/releases/tag/emi-1.0 To install the plugins, open Netbeans and click on Tools - Plugins - Downloaded - click "Add plugins...", open the file and then click Install. Uninstallation is unfortunately only possible by removing your netbeans folder (Linux: ~/.netbeans/). If you're only changing non-UI code, you don't need this; but please use it instead of manually editing the auto-generated UI code. Otherwise you'll desynchronize the code and the form XML which is painful to fix. In the Netbeans text editor, the auto-generated code parts are grayed out so you can't accidentally modify them.

IntelliJ IDEA provides a Swing UI editor, too. It is a built-in plugin and is available in the open-source Community Edition, too. However, most if not all .form files are incompatible at this point. This might change in the future.

Initial setup

using the commandline

  • Open up a terminal (git bash on windows)
  • cd to a folder, where you want to have the VisiCut sources e.g.:
cd Desktop
  • clone the VisiCut repository including the LibLaserCut repository
git clone --recursive https://github.com/t-oster/VisiCut.git
  • If you get an error message that --recursive is unsupported (old version of Mac OSX e.g.), use:
git clone https://github.com/t-oster/VisiCut.git
cd VisiCut
git submodule init
git submodule update
  • Open up NetBeans
  • Open the LibLaserCut project, then the VisiCut project:
  • File->Open Project
  • select the path where you cloned the VisiCut repository, expand it and select the subfolder "LibLaserCut"
  • Hit 'Clean and Build'
  • File->Open Project
  • now select the VisiCut path

Congratulations. You should now have the latest Visicut version.

If you have this setup and want to start developing, always update to the latest develop-version first, see later.

using NetBeans

NetBeans – Teams – Git – Clone - https://github.com/t-oster/VisiCut/

„Do you want to initialize submodules?“ → Yes

Open Projects – select VisiCut and LibLaserCut – Open

If it shows "Problems detected in Project": Resolve Problems – „JDK 1.8 not found“ – Resolve – use existing Java: JDK11

Switch to Projects tab

Select Liblasercut first, right click on project, choose Clean and Build

Select VisiCut

To solve some dependencies right click pom.xml in Project Files and select Run Maven->Goals. Type initialize as the goal and click OK.

As an alternative run mvn initialize in a shell at the Visicut projects folder (default ~/NetBeansProjects/VisiCut).

Edit files, e.g. VisiCut – Source Packages – com.t_oster-VisiCut.gui.VisiCutApp.java

IntelliJ IDEA

Note: while the Community Edition is sufficient, the commercial one will work just as fine, too.

  1. Clone the project, either manually (see above) or through IntelliJ IDEA. Make sure you clone the submodules as well. You can use the Git commandline after cloning the project to do so. Open the built-in terminal and enter git submodule update --init --recursive.
  2. Add the LibLaserCut submodule as a project to the parent project. Follow this guide and attach the project accordingly. This will ensure that changes in LibLaserCut will be compiled and linked into the resulting binaries, allowing you to develop both projects at the same time.

Compiling and running

Commandline

Run make run to compile and run VisiCut. LibLaserCut is compiled automatically.

Run make to only compile without running, and make clean to remove all built files.

NetBeans

To compile and run, select the VisiCut (not „LibLaserCut“) project and then select „Run – Run Project“. For debugging, use „Debug – Debug Project“ instead. Compilation may take some minutes for the first time. Click on specific source line to add a breakpoint.

Updating to the latest version

If you want to develop and publish a fix or a feature, read submit a fix or feature

Distribution

To create distribute files for the different platforms run distribute.sh

cd distribute; ./distribute.sh

(answer "n" for all packages you don't need like windows etc.)

To view compile errors you need to run make manually, in the main folder.