This is an old revision of the document! Table of ContentsUsing the Eclipse IDE to work on RosegardenGet Rosegarden Source From SVNTo get started we'll need the source code for Rosegarden. We can get a copy of it from sourceforge using subversion (svn). Since we are going to use the source with Eclipse, we'll need to make sure that we set up the directories in a way that will make Eclipse happy. Eclipse likes to have a directory for its “workspace” and a directory within the workspace for the “project”. So I usually create a workspace directory like this: $ mkdir rosegarden-workspace Then I get the source into a directory within the workspace dir: $ cd rosegarden-workspace $ svn checkout svn+ssh://userid@svn.code.sf.net/p/rosegarden/code/trunk/rosegarden rosegarden-svn $ cd rosegarden-svn Replace “userid” with your sourceforge user ID. See the subversion quick start for more ways to download. Get DependenciesIn order to successfully build Rosegarden, there are a number of libraries you'll need. If you are using a distro with apt (Ubuntu, Debian…), you can try getting the build-dep's for Rosegarden. This might work for you, so try it first: $ sudo apt-get build-dep rosegarden In Ubuntu I get this error because I am using jack2: The following packages have unmet dependencies: libjack-dev : Depends: libjack0 (= 1:0.124.1+20140122git5013bed0-3) but it is not going to be installed E: Build-dependencies for rosegarden could not be satisfied. If you get the same, try this: $ sudo apt-get install libjack-jackd2-dev $ sudo apt-get build-dep rosegarden …and you should be ready to build. Configure and BuildNow it's time to try configuring the Rosegarden source. First we need to get everything set up to run configure: $ make distclean It's ok if you get an error about “no makefile” on the previous step. $ sh ./bootstrap.sh Now we should be able to run configure. Here's how I run it with 32-bit (i386) versions of Ubuntu. I need the “–with-qtlibdir” option because Ubuntu puts the Qt libraries in an architecture-specific location: $ ./configure --enable-debug --with-qtlibdir=/usr/lib/i386-linux-gnu With 64-bit (amd64) versions of Ubuntu: $ ./configure --enable-debug --with-qtlibdir=/usr/lib/x86_64-linux-gnu There may be errors when you run configure due to missing libraries. You'll need to track those down and re-run configure. Once configure has run successfully to completion, you can build Rosegarden with make: $ make To make sure the build was successful, try running it: $ ./rosegarden If you have a machine with multiple cores (who doesn't these days?) you probably want to add this to the end of your .bashrc file to tell make that it can run multiple jobs simulataneously: export MAKEFLAGS="-j `nproc`" This will take effect the next time you start a terminal. It should speed up the build significantly. If you just need to build Rosegarden, you can stop here. Otherwise, if you are interested in doing some development with Eclipse, read on…. Install EclipseThe Eclipse IDE can be downloaded here: http://www.eclipse.org/ I download the Linux C/C++ version which is usually called something like “Eclipse IDE for C/C++ Developers”. It's just a tarball you can expand and then look for the “eclipse” directory with the “eclipse” binary. That's pretty much it. NOTE: If you upgrade your OS, it's a good idea to wipe out your Eclipse install and start fresh. There are config files within the Eclipse install directory that can get out of sync and cause trouble with a new OS. Set Up Rosegarden Source Under EclipseNote: These instructions were developed using Eclipse 4.4 (Luna). Since we set up the directory structure in a way that Eclipse likes, getting Eclipse to find the source and work with it is easy. Launch Eclipse. It will first ask for the location of your workspace. Give it the rosegarden-workspace directory that we created earlier. Since this is a new workspace, you'll get the Eclipse welcome screen. In the upper right is a button for the “Workbench”. Click it. Go to File > New > Makefile Project with Existing Code. In the “Project Name” field type rosegarden-svn. For the “Existing Code Location” provide the path to the rosegarden-svn directory. In the Toolchain list, select “Linux GCC”. Click Finish. You should now be able to build with Project > Build All (Ctrl+B). To run the program, you'll need to set up a Run Configuration. Go to Run > Run Configurations. Select “C/C++ Application” and hit the New button. Verify that the C/C++ Application field says “rosegarden”, and the Project field says “rosegarden-svn”. Click Run to test. You should now be able to run with Run > Run (Ctrl+F11). You should also be able to debug with F11 or Run > Debug. If you get an error about “The selection cannot be launched, and there are no recent launches,” you need to go back into the Run Configuration and hit the Run button in there to establish the first run. That will then be used each time F11 or Ctrl-F11 are pressed. Include FilesTo make sure Eclipse is aware of the various Qt include files, we need to tell Eclipse where the Qt includes are located. Select the “rosegarden-svn” project in the Project Explorer and go to File > Properties. In the “type filter text” box, type “paths” and hit enter. This should get you quickly to Paths and Symbols. Click on the “Includes” tab and then the “GNU C++” language. In the “Include directories” box, add the following: /usr/include/qt4 /usr/include/qt4/QtCore /usr/include/qt4/QtGui /usr/include/qt4/QtXml Click Ok. When asked if you “wish to rebuild” the index, click “Yes”. It will take some time for Eclipse to rebuild the index. The “C/C++ Indexer” indicator at the bottom of the window will let you know how far along the process is. Configuring TabsRosegarden coding standards call for using spaces instead of tabs. To configure Eclipse, you'll need to make changes in two places. First, the editor. Go to Window > Preferences > General > Editors > Text Editors. Here you will find an “Insert spaces for tabs” checkbox. Make sure it is checked. Second, the code formatter. Go to Window > Preferences > C/C++ > Code Style > Formatter. Make sure the “Profile name” is “K&R [built-in]”. Click on the “Edit…” button next to the profile name. In the Indentation tab, set “Tab policy” to “Spaces only”. Change the “Profile name” to “K&R with spaces”. Click on Ok and Ok. Now all your tabs will be spaces. Faster Builds
If your machine has multiple cores and/or hyperthreading, you'll want to set up make for multiple jobs (make's -j option). To do that within Eclipse, go to Window > Preferences > C/C++ > Build > Environment, add an environment variable MAKEFLAGS, and set it to “-j4” (or whatever is best for your hardware, the Scalability ModeWith large source files, many of Eclipse's features are disabled by something called “scalability mode”. Since Rosegarden has some rather large source files, this can be a problem. To adjust, go to Window > Preferences > C/C++ > Editor > Scalability. Increase the “number of lines” field from 5000 to 10000. If you end up seeing the scalability mode alert dialog, you can always increase this number even further. Auto-Save Before BuildBy default, Eclipse doesn't automatically save your files when you build. If you would prefer that behavior, go to Window > Preferences > General > Workspace. Set the “Save automatically before build” checkbox. This avoids build errors if you forget to save a file that you've changed. Unlimited Console BufferBy default, Eclipse limits debug console output to 80,000 bytes. Rosegarden generates a lot of debug output. It's a good idea to turn this limit off. Go to Window > Preferences > Run/Debug > Console. Uncheck “Limit console output”. Upgrade NotesWhen upgrading to a new version of eclipse, it's a good idea to delete all the Eclipse config files in your workspace and project so the new version can start fresh. You'll have to go through all the configuration again, but things should be a bit more stable. Key things to delete for the Indigo to Juno upgrade: rosegarden-workspace/.metadata rosegarden-workspace/RemoteSystemsTempFiles rosegarden-workspace/rosegarden-svn/.cproject rosegarden-workspace/rosegarden-svn/.project Juno to Kepler had the same files and directories to delete along with a new one: rosegarden-workspace/rosegarden-svn/.settings Ubuntu 12.04-14.04 IssuesUnity IconIt appears that adding an icon to the dash still requires gnome-desktop-item-edit. See the “Unity Icon” section in the “Ubuntu 11.10 Issues” below for details. Ubuntu 11.10 IssuesBlack on Black TooltipsWhen you hover over an identifier in Eclipse, you'll get a tooltip that provides some helpful information about that identifier. However, with Ubuntu 11.10's Ambiance theme, the tooltip background color is black, and Eclipse doesn't handle this correctly. It tries to display black-on-black text, which is just a little tough to read. First, make sure you are using the Ambiance theme. Go to System Settings > Appearance and note that the theme in the lower right is “Ambiance”. What about the other Ubuntu 11.10 themes? Radiance has the same problem. The HighContrast theme does not have this problem, but it's really ugly. And while HighContrastInverse does at least provide almost readable black on blue tooltip text, it is also pretty ugly. So, to avoid hacking anything, you could try HighContrast. But I'm betting you won't like it. The solution I use is to hack the Ambiance theme to change the tooltip foreground color to black and the background color to white. To do this, you'll need to edit the following three files: /usr/share/themes/Ambiance/gtk-3.0/settings.ini /usr/share/themes/Ambiance/gtk-3.0/gtk.css /usr/share/themes/Ambiance/gtk-2.0/gtkrc Search within those files for “tooltip” and you should find “tooltip_bg_color” and “tooltip_fg_color”. The syntax of each of these files is a little different, but should be pretty clear. Just change tooltip_bg_color to #ffffff and tooltip_fg_color to #000000. You might need to log out and back in, but once these changes are picked up, tooltips in Eclipse will work fine. References: Unity IconThere appear to be two main ways to create a Unity icon for an application. The first uses a GUI, and the second involves creating an eclipse.desktop file. Apparently there is no native “Unity” way to add an icon to Unity. GUIThe GUI approach uses the GNOME desktop item editor: sudo apt-get install gnome-panel sudo gnome-desktop-item-edit /usr/share/applications --create-new Give it the name “Eclipse”. Point it to the eclipse binary in the eclipse install directory. And finally, use the icon that is in the eclipse install directory. Click close, and Eclipse will now appear in the dash. You can even drag and drop it onto the launcher if you wish. eclipse.desktopYou can also just create an eclipse.desktop file in /usr/share/applications instead of installing all of the above GUI tools. Here's mine: [Desktop Entry] Type=Application Name=Eclipse CDT Comment=Eclipse IDE for C/C++ Icon=<path-to-eclipse>/icon.xpm Exec=<path-to-eclipse>/eclipse Terminal=false Categories=Development You'll need to adjust the “<path-to-eclipse>” to point to where you expanded Eclipse. More WaysThere are several other ways to add an application to the dash. See this page for more: http://askubuntu.com/questions/67753/how-do-i-add-an-application-to-the-dash |