~ubuntu-branches/ubuntu/saucy/lordsawar/saucy

« back to all changes in this revision

Viewing changes to src/editor/itemlist-dialog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese, Barry deFreese
  • Date: 2008-12-20 13:52:12 UTC
  • mfrom: (1.1.6 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20081220135212-noeb2w3y98ebo7o9
Tags: 0.1.4-1
[ Barry deFreese ]
* New upstream release.
* Move 0.0.8-2.1 changelog entry to correct point in changelog.
* Make lordsawar-data suggest lordsawar.
* Update my e-mail address.
* Add build-depends on intltool, uuid-dev, and libboost-dev.
* Don't install locales since there are no translations currently.
* Add simple man page for new lordsawar-pbm binary.
* Drop gcc4.3 patches as they have been fixed upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
#include "itemlist-dialog.h"
36
36
 
37
 
#include "../gui/input-helpers.h"
38
 
#include "../gui/error-utils.h"
39
 
 
40
 
#include "../defs.h"
41
 
#include "../Configuration.h"
42
 
#include "../Itemlist.h"
43
 
#include "../Tile.h"
44
 
 
45
 
#include "../ucompose.hpp"
 
37
#include "gui/input-helpers.h"
 
38
#include "gui/error-utils.h"
 
39
 
 
40
#include "defs.h"
 
41
#include "Configuration.h"
 
42
#include "Itemlist.h"
 
43
#include "Tile.h"
 
44
 
 
45
#include "ucompose.hpp"
46
46
 
47
47
#include "glade-helpers.h"
48
48
 
77
77
 
78
78
    Itemlist::iterator iter = d_itemlist->begin();
79
79
    for (;iter != d_itemlist->end(); iter++)
80
 
      addItem((*iter).second);
 
80
      addItemProto((*iter).second);
81
81
      
82
82
    Uint32 max = d_itemlist->size();
83
83
    if (max)
165
165
      // Row selected
166
166
      Gtk::TreeModel::Row row = *iterrow;
167
167
 
168
 
      Item *a = row[items_columns.item];
 
168
      ItemProto *a = row[items_columns.item];
169
169
      fill_item_info(a);
170
170
    }
171
171
}
184
184
  dialog->hide();
185
185
}
186
186
 
187
 
void ItemlistDialog::addItem(Item *item)
 
187
void ItemlistDialog::addItemProto(ItemProto *itemproto)
188
188
{
189
189
  Gtk::TreeIter i = items_list->append();
190
 
  (*i)[items_columns.name] = item->getName();
191
 
  (*i)[items_columns.item] = item;
 
190
  (*i)[items_columns.name] = itemproto->getName();
 
191
  (*i)[items_columns.item] = itemproto;
192
192
}
193
193
 
194
194
void ItemlistDialog::on_item_selected()
199
199
 
200
200
static int inhibit_bonus_checkbuttons;
201
201
 
202
 
void ItemlistDialog::fill_item_info(Item *item)
 
202
void ItemlistDialog::fill_item_info(ItemProto *item)
203
203
{
204
204
  name_entry->set_text(item->getName());
205
205
  inhibit_bonus_checkbuttons = 1;
206
 
  add1str_checkbutton->set_active(item->getBonus(Item::ADD1STR));
207
 
  add2str_checkbutton->set_active(item->getBonus(Item::ADD2STR));
208
 
  add3str_checkbutton->set_active(item->getBonus(Item::ADD3STR));
209
 
  add1stack_checkbutton->set_active(item->getBonus(Item::ADD1STACK));
210
 
  add2stack_checkbutton->set_active(item->getBonus(Item::ADD2STACK));
211
 
  add3stack_checkbutton->set_active(item->getBonus(Item::ADD3STACK));
212
 
  flystack_checkbutton->set_active(item->getBonus(Item::FLYSTACK));
 
206
  add1str_checkbutton->set_active(item->getBonus(ItemProto::ADD1STR));
 
207
  add2str_checkbutton->set_active(item->getBonus(ItemProto::ADD2STR));
 
208
  add3str_checkbutton->set_active(item->getBonus(ItemProto::ADD3STR));
 
209
  add1stack_checkbutton->set_active(item->getBonus(ItemProto::ADD1STACK));
 
210
  add2stack_checkbutton->set_active(item->getBonus(ItemProto::ADD2STACK));
 
211
  add3stack_checkbutton->set_active(item->getBonus(ItemProto::ADD3STACK));
 
212
  flystack_checkbutton->set_active(item->getBonus(ItemProto::FLYSTACK));
213
213
  doublemovestack_checkbutton->set_active 
214
 
    (item->getBonus(Item::DOUBLEMOVESTACK));
 
214
    (item->getBonus(ItemProto::DOUBLEMOVESTACK));
215
215
  add2goldpercity_checkbutton->set_active
216
 
    (item->getBonus(Item::ADD2GOLDPERCITY));
 
216
    (item->getBonus(ItemProto::ADD2GOLDPERCITY));
217
217
  add3goldpercity_checkbutton->set_active
218
 
    (item->getBonus(Item::ADD3GOLDPERCITY));
 
218
    (item->getBonus(ItemProto::ADD3GOLDPERCITY));
219
219
  add4goldpercity_checkbutton->set_active
220
 
    (item->getBonus(Item::ADD4GOLDPERCITY));
 
220
    (item->getBonus(ItemProto::ADD4GOLDPERCITY));
221
221
  add5goldpercity_checkbutton->set_active
222
 
    (item->getBonus(Item::ADD5GOLDPERCITY));
 
222
    (item->getBonus(ItemProto::ADD5GOLDPERCITY));
223
223
  inhibit_bonus_checkbuttons = 0;
224
224
}
225
225
 
231
231
  if (iterrow) 
232
232
    {
233
233
      Gtk::TreeModel::Row row = *iterrow;
234
 
      Item *a = row[items_columns.item];
 
234
      ItemProto *a = row[items_columns.item];
235
235
      a->setName(name_entry->get_text());
236
236
      row[items_columns.name] = name_entry->get_text();
237
237
    }
239
239
void ItemlistDialog::on_add_item_clicked()
240
240
{
241
241
  //add a new empty item to the itemlist
242
 
  Item *a = new Item("Untitled", false, NULL);
 
242
  ItemProto *a = new ItemProto("Untitled", 0);
243
243
  //add it to the treeview
244
244
  Gtk::TreeIter i = items_list->append();
245
245
  a->setName("Untitled");
257
257
  if (iterrow) 
258
258
    {
259
259
      Gtk::TreeModel::Row row = *iterrow;
260
 
      Item *a = row[items_columns.item];
 
260
      ItemProto *a = row[items_columns.item];
261
261
      items_list->erase(iterrow);
262
262
      d_itemlist->remove(a);
263
263
    }
271
271
void ItemlistDialog::run()
272
272
{
273
273
    dialog->show_all();
274
 
    int response = dialog->run();
 
274
    dialog->run();
275
275
}
276
276
 
277
277
void ItemlistDialog::on_checkbutton_toggled(Gtk::CheckButton *checkbutton, 
278
 
                                            Item::Bonus bonus)
 
278
                                            ItemProto::Bonus bonus)
279
279
{
280
280
  if (inhibit_bonus_checkbuttons)
281
281
    return;
298
298
 
299
299
void ItemlistDialog::on_add1str_toggled()
300
300
{
301
 
  on_checkbutton_toggled(add1str_checkbutton, Item::ADD1STR);
 
301
  on_checkbutton_toggled(add1str_checkbutton, ItemProto::ADD1STR);
302
302
}
303
303
 
304
304
void ItemlistDialog::on_add2str_toggled()
305
305
{
306
 
  on_checkbutton_toggled(add2str_checkbutton, Item::ADD2STR);
 
306
  on_checkbutton_toggled(add2str_checkbutton, ItemProto::ADD2STR);
307
307
}
308
308
 
309
309
void ItemlistDialog::on_add3str_toggled()
310
310
{
311
 
  on_checkbutton_toggled(add3str_checkbutton, Item::ADD3STR);
 
311
  on_checkbutton_toggled(add3str_checkbutton, ItemProto::ADD3STR);
312
312
}
313
313
 
314
314
void ItemlistDialog::on_add1stack_toggled()
315
315
{
316
 
  on_checkbutton_toggled(add1stack_checkbutton, Item::ADD1STACK);
 
316
  on_checkbutton_toggled(add1stack_checkbutton, ItemProto::ADD1STACK);
317
317
}
318
318
 
319
319
void ItemlistDialog::on_add2stack_toggled()
320
320
{
321
 
  on_checkbutton_toggled(add2stack_checkbutton, Item::ADD2STACK);
 
321
  on_checkbutton_toggled(add2stack_checkbutton, ItemProto::ADD2STACK);
322
322
}
323
323
 
324
324
void ItemlistDialog::on_add3stack_toggled()
325
325
{
326
 
  on_checkbutton_toggled(add3stack_checkbutton, Item::ADD3STACK);
 
326
  on_checkbutton_toggled(add3stack_checkbutton, ItemProto::ADD3STACK);
327
327
}
328
328
 
329
329
void ItemlistDialog::on_flystack_toggled()
330
330
{
331
 
  on_checkbutton_toggled(flystack_checkbutton, Item::FLYSTACK);
 
331
  on_checkbutton_toggled(flystack_checkbutton, ItemProto::FLYSTACK);
332
332
}
333
333
 
334
334
void ItemlistDialog::on_doublemovestack_toggled()
335
335
{
336
 
  on_checkbutton_toggled(doublemovestack_checkbutton, Item::DOUBLEMOVESTACK);
 
336
  on_checkbutton_toggled(doublemovestack_checkbutton, ItemProto::DOUBLEMOVESTACK);
337
337
}
338
338
 
339
339
void ItemlistDialog::on_add2goldpercity_toggled()
340
340
{
341
 
  on_checkbutton_toggled(add2goldpercity_checkbutton, Item::ADD2GOLDPERCITY);
 
341
  on_checkbutton_toggled(add2goldpercity_checkbutton, ItemProto::ADD2GOLDPERCITY);
342
342
}
343
343
 
344
344
void ItemlistDialog::on_add3goldpercity_toggled()
345
345
{
346
 
  on_checkbutton_toggled(add2goldpercity_checkbutton, Item::ADD3GOLDPERCITY);
 
346
  on_checkbutton_toggled(add2goldpercity_checkbutton, ItemProto::ADD3GOLDPERCITY);
347
347
}
348
348
 
349
349
void ItemlistDialog::on_add4goldpercity_toggled()
350
350
{
351
 
  on_checkbutton_toggled(add4goldpercity_checkbutton, Item::ADD4GOLDPERCITY);
 
351
  on_checkbutton_toggled(add4goldpercity_checkbutton, ItemProto::ADD4GOLDPERCITY);
352
352
}
353
353
 
354
354
void ItemlistDialog::on_add5goldpercity_toggled()
355
355
{
356
 
  on_checkbutton_toggled(add5goldpercity_checkbutton, Item::ADD5GOLDPERCITY);
 
356
  on_checkbutton_toggled(add5goldpercity_checkbutton, ItemProto::ADD5GOLDPERCITY);
357
357
}