1 |
/* -*- c++ -*- |
/* -*- c++ -*- |
2 |
* Copyright (C) 2006, 2007 Andreas Persson |
* Copyright (C) 2006-2008 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 |
218 |
// update all GUI elements according to current gig::Region informations |
// update all GUI elements according to current gig::Region informations |
219 |
void DimensionManager::refreshManager() { |
void DimensionManager::refreshManager() { |
220 |
refTableModel->clear(); |
refTableModel->clear(); |
221 |
for (int i = 0; i < region->Dimensions; i++) { |
if (region) { |
222 |
gig::dimension_def_t* dim = ®ion->pDimensionDefinitions[i]; |
for (int i = 0; i < region->Dimensions; i++) { |
223 |
Gtk::TreeModel::Row row = *(refTableModel->append()); |
gig::dimension_def_t* dim = ®ion->pDimensionDefinitions[i]; |
224 |
row[tableModel.m_dim_type] = __dimTypeAsString(dim->dimension); |
Gtk::TreeModel::Row row = *(refTableModel->append()); |
225 |
row[tableModel.m_bits] = dim->bits; |
row[tableModel.m_dim_type] = __dimTypeAsString(dim->dimension); |
226 |
row[tableModel.m_zones] = 1 << dim->bits; //TODO: for now we calculate it here until libgig always ensures 'zones' to be correct |
row[tableModel.m_bits] = dim->bits; |
227 |
row[tableModel.m_description] = __dimDescriptionAsString(dim->dimension); |
row[tableModel.m_zones] = 1 << dim->bits; //TODO: for now we calculate it here until libgig always ensures 'zones' to be correct |
228 |
row[tableModel.m_definition] = dim; |
row[tableModel.m_description] = __dimDescriptionAsString(dim->dimension); |
229 |
|
row[tableModel.m_definition] = dim; |
230 |
|
} |
231 |
} |
} |
232 |
|
set_sensitive(region); |
233 |
} |
} |
234 |
|
|
235 |
void DimensionManager::show(gig::Region* region) { |
void DimensionManager::show(gig::Region* region) { |
239 |
deiconify(); |
deiconify(); |
240 |
} |
} |
241 |
|
|
242 |
|
void DimensionManager::set_region(gig::Region* region) { |
243 |
|
this->region = region; |
244 |
|
refreshManager(); |
245 |
|
} |
246 |
|
|
247 |
void DimensionManager::addDimension() { |
void DimensionManager::addDimension() { |
248 |
try { |
try { |
249 |
Gtk::Dialog dialog("New Dimension", true /*modal*/); |
Gtk::Dialog dialog("New Dimension", true /*modal*/); |
323 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
324 |
gig::dimension_def_t* dim = row[tableModel.m_definition]; |
gig::dimension_def_t* dim = row[tableModel.m_definition]; |
325 |
region->DeleteDimension(dim); |
region->DeleteDimension(dim); |
|
// remove respective row from table |
|
|
refTableModel->erase(it); |
|
326 |
// let everybody know there was a change |
// let everybody know there was a change |
327 |
region_changed_signal.emit(region); |
region_changed_signal.emit(region); |
328 |
|
// update all GUI elements |
329 |
|
refreshManager(); |
330 |
} catch (RIFF::Exception e) { |
} catch (RIFF::Exception e) { |
331 |
// notify that the changes are over (i.e. to avoid dead locks) |
// notify that the changes are over (i.e. to avoid dead locks) |
332 |
region_changed_signal.emit(region); |
region_changed_signal.emit(region); |