1 |
/* -*- c++ -*- |
/* |
2 |
* Copyright (C) 2006-2009 Andreas Persson |
* Copyright (C) 2006-2014 Andreas Persson |
3 |
* |
* |
4 |
* This program is free software; you can redistribute it and/or |
* This program is free software; you can redistribute it and/or |
5 |
* modify it under the terms of the GNU General Public License as |
* modify it under the terms of the GNU General Public License as |
27 |
#include <gtkmm/table.h> |
#include <gtkmm/table.h> |
28 |
|
|
29 |
#include "global.h" |
#include "global.h" |
30 |
|
#include "compat.h" |
31 |
|
|
32 |
// returns a human readable name of the given dimension type |
// returns a human readable name of the given dimension type |
33 |
static Glib::ustring __dimTypeAsString(gig::dimension_t d) { |
Glib::ustring dimTypeAsString(gig::dimension_t d) { |
34 |
char buf[32]; |
char buf[32]; |
35 |
switch (d) { |
switch (d) { |
36 |
case gig::dimension_none: |
case gig::dimension_none: |
218 |
); |
); |
219 |
|
|
220 |
show_all_children(); |
show_all_children(); |
221 |
|
|
222 |
|
resize(460,300); |
223 |
} |
} |
224 |
|
|
225 |
// update all GUI elements according to current gig::Region informations |
// update all GUI elements according to current gig::Region informations |
229 |
for (int i = 0; i < region->Dimensions; i++) { |
for (int i = 0; i < region->Dimensions; i++) { |
230 |
gig::dimension_def_t* dim = ®ion->pDimensionDefinitions[i]; |
gig::dimension_def_t* dim = ®ion->pDimensionDefinitions[i]; |
231 |
Gtk::TreeModel::Row row = *(refTableModel->append()); |
Gtk::TreeModel::Row row = *(refTableModel->append()); |
232 |
row[tableModel.m_dim_type] = __dimTypeAsString(dim->dimension); |
row[tableModel.m_dim_type] = dimTypeAsString(dim->dimension); |
233 |
row[tableModel.m_bits] = dim->bits; |
row[tableModel.m_bits] = dim->bits; |
234 |
row[tableModel.m_zones] = dim->zones; |
row[tableModel.m_zones] = dim->zones; |
235 |
row[tableModel.m_description] = __dimDescriptionAsString(dim->dimension); |
row[tableModel.m_description] = __dimDescriptionAsString(dim->dimension); |
258 |
Glib::RefPtr<Gtk::ListStore> refComboModel = Gtk::ListStore::create(comboModel); |
Glib::RefPtr<Gtk::ListStore> refComboModel = Gtk::ListStore::create(comboModel); |
259 |
for (int i = 0x01; i < 0xff; i++) { |
for (int i = 0x01; i < 0xff; i++) { |
260 |
Glib::ustring sType = |
Glib::ustring sType = |
261 |
__dimTypeAsString(static_cast<gig::dimension_t>(i)); |
dimTypeAsString(static_cast<gig::dimension_t>(i)); |
262 |
if (sType.find("Unknown") != 0) { |
if (sType.find("Unknown") != 0) { |
263 |
Gtk::TreeModel::Row row = *(refComboModel->append()); |
Gtk::TreeModel::Row row = *(refComboModel->append()); |
264 |
row[comboModel.m_type_id] = i; |
row[comboModel.m_type_id] = i; |
266 |
} |
} |
267 |
} |
} |
268 |
Gtk::Table table(2, 2); |
Gtk::Table table(2, 2); |
269 |
Gtk::Label labelDimType(_("Dimension:"), Gtk::ALIGN_LEFT); |
Gtk::Label labelDimType(_("Dimension:"), Gtk::ALIGN_START); |
270 |
Gtk::ComboBox comboDimType; |
Gtk::ComboBox comboDimType; |
271 |
comboDimType.set_model(refComboModel); |
comboDimType.set_model(refComboModel); |
272 |
comboDimType.pack_start(comboModel.m_type_id); |
comboDimType.pack_start(comboModel.m_type_id); |
273 |
comboDimType.pack_start(comboModel.m_type_name); |
comboDimType.pack_start(comboModel.m_type_name); |
274 |
Gtk::Label labelZones(_("Zones:"), Gtk::ALIGN_LEFT); |
Gtk::Label labelZones(_("Zones:"), Gtk::ALIGN_START); |
275 |
table.attach(labelDimType, 0, 1, 0, 1); |
table.attach(labelDimType, 0, 1, 0, 1); |
276 |
table.attach(comboDimType, 1, 2, 0, 1); |
table.attach(comboDimType, 1, 2, 0, 1); |
277 |
table.attach(labelZones, 0, 1, 1, 2); |
table.attach(labelZones, 0, 1, 1, 2); |
290 |
for (int i = 1; i <= 5; i++) { |
for (int i = 1; i <= 5; i++) { |
291 |
char buf[3]; |
char buf[3]; |
292 |
sprintf(buf, "%d", 1 << i); |
sprintf(buf, "%d", 1 << i); |
293 |
|
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 24) || GTKMM_MAJOR_VERSION < 2 |
294 |
comboZones.append_text(buf); |
comboZones.append_text(buf); |
295 |
|
#else |
296 |
|
comboZones.append(buf); |
297 |
|
#endif |
298 |
} |
} |
299 |
table.attach(comboZones, 1, 2, 1, 2); |
table.attach(comboZones, 1, 2, 1, 2); |
300 |
} else { |
} else { |