35
35
#include "itemlist-dialog.h"
37
#include "../gui/input-helpers.h"
38
#include "../gui/error-utils.h"
41
#include "../Configuration.h"
42
#include "../Itemlist.h"
45
#include "../ucompose.hpp"
37
#include "gui/input-helpers.h"
38
#include "gui/error-utils.h"
41
#include "Configuration.h"
45
#include "ucompose.hpp"
47
47
#include "glade-helpers.h"
187
void ItemlistDialog::addItem(Item *item)
187
void ItemlistDialog::addItemProto(ItemProto *itemproto)
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;
194
194
void ItemlistDialog::on_item_selected()
200
200
static int inhibit_bonus_checkbuttons;
202
void ItemlistDialog::fill_item_info(Item *item)
202
void ItemlistDialog::fill_item_info(ItemProto *item)
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;
299
299
void ItemlistDialog::on_add1str_toggled()
301
on_checkbutton_toggled(add1str_checkbutton, Item::ADD1STR);
301
on_checkbutton_toggled(add1str_checkbutton, ItemProto::ADD1STR);
304
304
void ItemlistDialog::on_add2str_toggled()
306
on_checkbutton_toggled(add2str_checkbutton, Item::ADD2STR);
306
on_checkbutton_toggled(add2str_checkbutton, ItemProto::ADD2STR);
309
309
void ItemlistDialog::on_add3str_toggled()
311
on_checkbutton_toggled(add3str_checkbutton, Item::ADD3STR);
311
on_checkbutton_toggled(add3str_checkbutton, ItemProto::ADD3STR);
314
314
void ItemlistDialog::on_add1stack_toggled()
316
on_checkbutton_toggled(add1stack_checkbutton, Item::ADD1STACK);
316
on_checkbutton_toggled(add1stack_checkbutton, ItemProto::ADD1STACK);
319
319
void ItemlistDialog::on_add2stack_toggled()
321
on_checkbutton_toggled(add2stack_checkbutton, Item::ADD2STACK);
321
on_checkbutton_toggled(add2stack_checkbutton, ItemProto::ADD2STACK);
324
324
void ItemlistDialog::on_add3stack_toggled()
326
on_checkbutton_toggled(add3stack_checkbutton, Item::ADD3STACK);
326
on_checkbutton_toggled(add3stack_checkbutton, ItemProto::ADD3STACK);
329
329
void ItemlistDialog::on_flystack_toggled()
331
on_checkbutton_toggled(flystack_checkbutton, Item::FLYSTACK);
331
on_checkbutton_toggled(flystack_checkbutton, ItemProto::FLYSTACK);
334
334
void ItemlistDialog::on_doublemovestack_toggled()
336
on_checkbutton_toggled(doublemovestack_checkbutton, Item::DOUBLEMOVESTACK);
336
on_checkbutton_toggled(doublemovestack_checkbutton, ItemProto::DOUBLEMOVESTACK);
339
339
void ItemlistDialog::on_add2goldpercity_toggled()
341
on_checkbutton_toggled(add2goldpercity_checkbutton, Item::ADD2GOLDPERCITY);
341
on_checkbutton_toggled(add2goldpercity_checkbutton, ItemProto::ADD2GOLDPERCITY);
344
344
void ItemlistDialog::on_add3goldpercity_toggled()
346
on_checkbutton_toggled(add2goldpercity_checkbutton, Item::ADD3GOLDPERCITY);
346
on_checkbutton_toggled(add2goldpercity_checkbutton, ItemProto::ADD3GOLDPERCITY);
349
349
void ItemlistDialog::on_add4goldpercity_toggled()
351
on_checkbutton_toggled(add4goldpercity_checkbutton, Item::ADD4GOLDPERCITY);
351
on_checkbutton_toggled(add4goldpercity_checkbutton, ItemProto::ADD4GOLDPERCITY);
354
354
void ItemlistDialog::on_add5goldpercity_toggled()
356
on_checkbutton_toggled(add5goldpercity_checkbutton, Item::ADD5GOLDPERCITY);
356
on_checkbutton_toggled(add5goldpercity_checkbutton, ItemProto::ADD5GOLDPERCITY);