I started a GTKMM application about 6 months ago and it’s reached the point where everything works and I actually use it daily. It’s essentially a database application that reads in data files from another application, generates graphs and lets you easily sort and view the data. I like it.
HOWEVER, I believe my code is a mess and when I went to implement another feature today I realized that I probably made a wrong turn somewhere.
My main window GUI is defined in a glade file and ALL of the GUI (other than my plot widget which is a custom widget based on a Gtk::DrawingArea) is in a single file. It is FULL of pointers to widgets and treestores that all get setup in the constructor and deleted in the destructor.
The entire GUI is a main window split into different panes so it made sense to have everything in 1 file. Also, different panes need to “communicate” with other panes.
How should I better organize my code so that it is maintainable? Do I make a new class that is essentially a collection of widgets and then place that “super widget” in my main window (say each pane is a super widget)?
GTKMM tutorials are generally very minimalistic so I couldn’t get much insight there.
I currently work on a large GTKMM application. The general rule that is followed throughout the codebase is that each Frame (containing a collection of widgets) is its own class in its own cpp file. These classes are then instantiated in the main function as singleton classes each exposing a getFrame method.
So this can be added to the larger application with: