5bca604f0c06d7d3c0c8d746e2aabefb53d2bb43
Stefan Schuermans begin of simulator: window...

Stefan Schuermans authored 7 years ago

1) /*
2)  * EtherPix simulator
3)  *
4)  * Copyright 2017 Stefan Schuermans <stefan schuermans info>
5)  *
6)  * This program is free software: you can redistribute it and/or modify
7)  * it under the terms of the GNU General Public License as published by
8)  * the Free Software Foundation, version 3 of the License.
9)  *
10)  *
11)  * This program is distributed in the hope that it will be useful,
12)  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13)  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14)  * GNU General Public License for more details.
15)  *
16)  * You should have received a copy of the GNU Lesser General Public License
17)  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18)  */
19) 
20) #include <gtkmm.h>
21) #include <iostream>
22) #include <string.h>
23) 
Stefan Schuermans begin of config file parsing

Stefan Schuermans authored 7 years ago

24) #include "config.h"
Stefan Schuermans begin of simulator: window...

Stefan Schuermans authored 7 years ago

25) #include "etherpix_sim.glade.h"
26) #include "main_window.h"
27) 
28) int main(int argc, char *argv[])
29) {
30)   // instantiate GTK main loop
31)   Gtk::Main kit(argc, argv);
32) 
33)   // parse arguments
34)   if (argc < 2) {
35)     std::cerr << "usage: " << argv[0] << " <sim_config.etps>" << std::endl;
36)     return 2;
37)   }
Stefan Schuermans begin of config file parsing

Stefan Schuermans authored 7 years ago

38)   char *configFile = argv[1];
Stefan Schuermans begin of simulator: window...

Stefan Schuermans authored 7 years ago

39) 
40)   try {
41) 
Stefan Schuermans begin of config file parsing

Stefan Schuermans authored 7 years ago

42)     // parse config file
43)     Config config(configFile);
44) 
Stefan Schuermans begin of simulator: window...

Stefan Schuermans authored 7 years ago

45)     // create window
46)     Glib::RefPtr<Gtk::Builder> builder =
47)       Gtk::Builder::create_from_string(widgets_etherpix_sim);
48) 
49)     // connect main window to its class
50)     MainWindow *mainWindow;
51)     builder->get_widget_derived("MainWindow", mainWindow);
Stefan Schuermans implement drawing pixels

Stefan Schuermans authored 7 years ago

52)     mainWindow->setConfig(config);
Stefan Schuermans begin of simulator: window...

Stefan Schuermans authored 7 years ago

53) 
54)     // append config file name to window title
Stefan Schuermans begin of config file parsing

Stefan Schuermans authored 7 years ago

55)     mainWindow->set_title(mainWindow->get_title() + " - " + configFile);