void CharCreateDialog::setAttributes(const StringVect &labels, const int available, const int min, const int max) { mMaxPoints = available; for (size_t i = 0; i < mAttributeLabel.size(); i++) { remove(mAttributeLabel[i]); delete2(mAttributeLabel[i]) remove(mAttributeSlider[i]); delete2(mAttributeSlider[i]) remove(mAttributeValue[i]); delete2(mAttributeValue[i]) } mAttributeLabel.resize(labels.size()); mAttributeSlider.resize(labels.size()); mAttributeValue.resize(labels.size()); const int w = 480; int h = 350; const int y = 118 + 29; for (unsigned i = 0, sz = static_cast<unsigned>(labels.size()); i < sz; i++) { mAttributeLabel[i] = new Label(this, labels[i]); mAttributeLabel[i]->setWidth(70); mAttributeLabel[i]->setPosition(5, y + i * 24); mAttributeLabel[i]->adjustSize(); add(mAttributeLabel[i]); mAttributeSlider[i] = new Slider(this, min, max, 1.0); mAttributeSlider[i]->setDimension(Rect(140, y + i * 24, 150, 12)); mAttributeSlider[i]->setActionEventId("statslider"); mAttributeSlider[i]->addActionListener(this); add(mAttributeSlider[i]); mAttributeValue[i] = new Label(this, toString(min)); mAttributeValue[i]->setPosition(295, y + i * 24); add(mAttributeValue[i]); } updateSliders(); if (!available) { mAttributesLeft->setVisible(Visible_false); h = y; setContentSize(w, h); } if (serverFeatures->haveCreateCharGender() && y < 160) { h = 160; setContentSize(w, h); } setButtonsPosition(w, h); }
void CharCreateDialog::setAttributes(const StringVect &labels, int available, int min, int max) { mMaxPoints = available; for (unsigned i = 0; i < mAttributeLabel.size(); i++) { remove(mAttributeLabel[i]); delete mAttributeLabel[i]; mAttributeLabel[i] = nullptr; remove(mAttributeSlider[i]); delete mAttributeSlider[i]; mAttributeSlider[i] = nullptr; remove(mAttributeValue[i]); delete mAttributeValue[i]; mAttributeValue[i] = nullptr; } mAttributeLabel.resize(labels.size()); mAttributeSlider.resize(labels.size()); mAttributeValue.resize(labels.size()); int w = 480; int h = 350; for (unsigned i = 0; i < labels.size(); i++) { mAttributeLabel[i] = new Label(labels[i]); mAttributeLabel[i]->setWidth(70); mAttributeLabel[i]->setPosition(5, 145 + i * 24); mAttributeLabel[i]->adjustSize(); add(mAttributeLabel[i]); mAttributeSlider[i] = new Slider(min, max); mAttributeSlider[i]->setDimension(gcn::Rectangle(140, 145 + i * 24, 150, 12)); mAttributeSlider[i]->setActionEventId("statslider"); mAttributeSlider[i]->addActionListener(this); add(mAttributeSlider[i]); mAttributeValue[i] = new Label(toString(min)); mAttributeValue[i]->setPosition(295, 145 + i * 24); add(mAttributeValue[i]); } mAttributesLeft->setPosition(15, 300); updateSliders(); mCancelButton->setPosition( w / 2, h - 5 - mCancelButton->getHeight()); mCreateButton->setPosition( mCancelButton->getX() - 5 - mCreateButton->getWidth(), h - 5 - mCancelButton->getHeight()); }
/*---------------------------------------------------------------------------------------------------------------------- | Returns simulated data stored in `sim_pattern_map' as a string in the form of a two-column table. The first column | is labeled "Count" and the second is labeled "Pattern". The Count column shows the number of times its associated | pattern was inserted using the insertPattern function. The Pattern column shows a representation of the pattern | itself, using symbols for states provided in the `state_symbols' argument. The `state_symbols' argument should be | a vector of single-character strings supplying a symbol to represent each state that might show up in any pattern. | Assumes that no state in any pattern stored in `sim_pattern_map' is greater than or equal to the length of the | `state_symbols' vector (because states are used as indices into `state_symbols'). */ std::string SimData::patternTable( const StringVect & state_symbols) /**< is a vector of strings representing states (e.g. {"A", "C", "G", "T"}). Note that each state symbol should be a string of length 1 (i.e. a single character) */ { PHYCAS_ASSERT(state_symbols.size() > 0); outstr.clear(); if (sim_pattern_map.empty()) { outstr = "Sorry, no patterns are stored"; } else { outstr = " Count Pattern"; for (pattern_map_t::iterator it = sim_pattern_map.begin(); it != sim_pattern_map.end(); ++it) { // Output the count first outstr << str(boost::format("\n%10.1f") % it->second) << " "; // Now output the pattern std::transform(it->first.begin(), it->first.end(), std::back_inserter(outstr), LookupStateSymbol(state_symbols)); } } return outstr; }
int main(int argc, char * argv[]) { bool pass = true; { StringVect perms = permutation_str_no_dup(""); pass = pass && perms.empty(); } { StringVect perms = permutation_str_no_dup("a"); pass = pass && (perms.size() == 1) && (std::find(perms.begin(), perms.end(), "a") != perms.end()) ; } { StringVect perms = permutation_str_no_dup("ab"); pass = pass && (perms.size() == 2) && (std::find(perms.begin(), perms.end(), "ab") != perms.end()) && (std::find(perms.begin(), perms.end(), "ba") != perms.end()) ; } { StringVect perms = permutation_str_no_dup("abc"); pass = pass && (perms.size() == 6) && (std::find(perms.begin(), perms.end(), "abc") != perms.end()) && (std::find(perms.begin(), perms.end(), "acb") != perms.end()) && (std::find(perms.begin(), perms.end(), "bac") != perms.end()) && (std::find(perms.begin(), perms.end(), "bca") != perms.end()) && (std::find(perms.begin(), perms.end(), "cab") != perms.end()) && (std::find(perms.begin(), perms.end(), "cba") != perms.end()) ; } return (pass ? 0 : -1); }
// ---------------------------------------------------------------------------- int main(int argc, char * argv[]) { std::fstream fs; fs.open("Project2Data.txt"); ProdInfo pi; // The current product info that is being dealt with. while (!fs.eof()) { StringVect lines; pi.Reset(); // Read the head lines. if (read_n_lines(fs, HEAD_LINES, lines) != HEAD_LINES) { // We run out of lines. Just break. std::cerr << "Not enough head lines." << std::endl; break; } // Parse the lines. StringPair sp; split_to_pair(rm_carriage(lines[0]), sp); pi.id = trim(sp.second); split_to_pair(rm_carriage(lines[1]), sp); pi.asin = trim(sp.second); split_to_pair(rm_carriage(lines[2]), sp); pi.title = trim(sp.second); split_to_pair(rm_carriage(lines[3]), sp); pi.group = trim(sp.second); // Read the categories. split_to_pair(lines[4], sp); int category_count = str_to_int(trim(sp.second)); if (read_n_lines(fs, category_count, lines) != category_count) { // We run out of lines. Just break. std::cerr << "Not enough category lines." << std::endl; break; } for (size_t i = 0; i < lines.size(); ++i) { pi.categories.push_back(trim(rm_carriage(lines[i]))); } // Write the product info into a SQL statement. std::cout << toSQL(pi) << std::endl; // Skip the blank lines. read_n_lines(fs, SEP_LINES, lines); } fs.close(); return 0; }
void DidYouKnowWindow::loadFile(const int num) { const std::string file = strprintf("tips/%d", num); std::string helpPath = branding.getStringValue("helpPath"); if (helpPath.empty()) helpPath = paths.getStringValue("help"); StringVect lines; TranslationManager::translateFile(helpPath.append(file).append(".txt"), translator, lines); for (size_t i = 0, sz = lines.size(); i < sz; ++i) mBrowserBox->addRow(lines[i]); }
/*---------------------------------------------------------------------------------------------------------------------- | Saves simulated data stored in `sim_pattern_map' to a file named `filename'. If the file already exists, it will be | overwritten without warning. If the file does not yet exist, it will be created. The file written will be a valid | NEXUS data file suitable for executing in phylogenetic analysis software that reads the NEXUS file format. The | supplied `taxon_names' will be used in the matrix command of the NEXUS file to specify the names of the taxa. | Assumes that the number of elements in `taxon_names' equals `pattern_length'. The `datatype' argument should be the | correct NEXUS datatype (e.g. "dna", "standard") for the data simulated. The symbols used for the states are | supplied in the `state_symbols' vector. Each element of this vector should be a single-character string. Assumes | that no state in any pattern stored in `sim_pattern_map' is greater than or equal to the length of the | `state_symbols' vector (because states are used as indices into `state_symbols'). */ void SimData::saveToNexusFile( const std::string filename, /**< is the name of the file to create containing the simulated data stored in this object */ const StringVect & taxon_names, /**< is a vector containing the taxon names to use in the saved file */ const std::string datatype, /**< is a string to be used as the NEXUS datatype (e.g. "dna" or "standard") */ const StringVect & state_symbols) /**< is a vector of strings representing states (e.g. {"A", "C", "G", "T"}). Note that each state symbol should be a string of length 1 (i.e. a single character) */ { std::cerr << "taxon_names size = " << taxon_names.size() << std::endl; std::cerr << "pattern_length = " << pattern_length << std::endl; std::cerr << "taxon_names: |"; std::copy(taxon_names.begin(), taxon_names.end(), std::ostream_iterator<std::string>(std::cerr, "|")); PHYCAS_ASSERT(state_symbols.size() > 0); PHYCAS_ASSERT(taxon_names.size() == pattern_length); // Find length of longest string in taxon_names vector; this is used later for formatting purposes // The 2 is included in case apostrophes are needed when taxon names are output in the matrix command unsigned length_of_longest_name = 2 + (unsigned)std::max_element(taxon_names.begin(), taxon_names.end(), StringLengthLess())->length(); std::ofstream outf(filename.c_str()); outf << "#nexus" << "\n\n"; outf << "begin data;" << "\n"; outf << str(boost::format(" dimensions ntax=%d nchar=%d;") % pattern_length % (unsigned)total_count) << "\n"; outf << " format datatype=" << datatype << ";" << "\n"; outf << " matrix" << "\n"; // Create a format string to use with boost::format that left-justifies (the "-" flag) the // taxon names in a field of width length_of_longest_name std::string fmtstr = str(boost::format(" %%-%ds") % length_of_longest_name); for (unsigned i = 0; i < pattern_length; ++i) { if (taxon_names[i].find(' ') != std::string::npos) { std::string s = "'"; s += taxon_names[i]; s += "'"; outf << str(boost::format(fmtstr) % s) << " "; } else { outf << str(boost::format(fmtstr) % taxon_names[i]) << " "; } #if 1 // Spit out characters in the order in which they were simulated. While this is a nice feature, // it currently requires storing the data twice (patternVect and sim_pattern_map) unsigned nchar = (unsigned)patternVect.size(); for (unsigned k = 0; k < nchar; ++k) { unsigned j = (unsigned)patternVect[k][i]; char s = state_symbols[j][0]; outf << s; } #else for (pattern_map_t::iterator it = sim_pattern_map.begin(); it != sim_pattern_map.end(); ++it) { // The first member of it is the state, which must be converted from its coded form // to the standard symbol for this data type (e.g. A, C, G or T for DNA characters) int8_t j = (*it).first[i]; PHYCAS_ASSERT(j < (int8_t)state_symbols.size()); char s = state_symbols[j][0]; // use the first (and hopefully only) character in the string at position j // The second member of it is the pattern count unsigned n = (unsigned)it->second; //@POL assuming counts not fractional for (unsigned k = 0; k < n; ++k) { outf << s; } } #endif outf << "\n"; } outf << " ;" << "\n"; outf << "end;" << "\n"; outf.close(); }
InventoryWindow::InventoryWindow(Inventory *const inventory) : Window("Inventory", Modal_false, nullptr, "inventory.xml"), ActionListener(), KeyListener(), SelectionListener(), InventoryListener(), AttributeListener(), mInventory(inventory), mItems(new ItemContainer(this, mInventory)), mUseButton(nullptr), mDropButton(nullptr), mOutfitButton(nullptr), mShopButton(nullptr), mCartButton(nullptr), mEquipmentButton(nullptr), mStoreButton(nullptr), mRetrieveButton(nullptr), mInvCloseButton(nullptr), mWeightBar(nullptr), mSlotsBar(new ProgressBar(this, 0.0F, 100, 0, ProgressColorId::PROG_INVY_SLOTS, "slotsprogressbar.xml", "slotsprogressbar_fill.xml")), mFilter(nullptr), mSortModel(new SortListModelInv), mSortDropDown(new DropDown(this, mSortModel, false, Modal_false, this, "sort")), mNameFilter(new TextField(this, "", true, this, "namefilter", true)), mSortDropDownCell(nullptr), mNameFilterCell(nullptr), mFilterCell(nullptr), mSlotsBarCell(nullptr), mSplit(false), mCompactMode(false) { mSlotsBar->setColor(getThemeColor(ThemeColorId::SLOTS_BAR), getThemeColor(ThemeColorId::SLOTS_BAR_OUTLINE)); if (inventory) { setCaption(gettext(inventory->getName().c_str())); setWindowName(inventory->getName()); switch (inventory->getType()) { case InventoryType::Inventory: case InventoryType::Trade: case InventoryType::Npc: #ifdef EATHENA_SUPPORT case InventoryType::Vending: case InventoryType::Mail: case InventoryType::Craft: #endif case InventoryType::TypeEnd: default: mSortDropDown->setSelected(config.getIntValue( "inventorySortOrder")); break; case InventoryType::Storage: mSortDropDown->setSelected(config.getIntValue( "storageSortOrder")); break; #ifdef EATHENA_SUPPORT case InventoryType::Cart: mSortDropDown->setSelected(config.getIntValue( "cartSortOrder")); break; #endif }; } else { // TRANSLATORS: inventory window name setCaption(_("Inventory")); setWindowName("Inventory"); mSortDropDown->setSelected(0); } if (setupWindow && inventory && inventory->getType() != InventoryType::Storage) { setupWindow->registerWindowForReset(this); } setResizable(true); setCloseButton(true); setSaveVisible(true); setStickyButtonLock(true); if (mainGraphics->mWidth > 600) setDefaultSize(450, 310, ImagePosition::CENTER); else setDefaultSize(387, 307, ImagePosition::CENTER); setMinWidth(310); setMinHeight(179); addKeyListener(this); mItems->addSelectionListener(this); ScrollArea *const invenScroll = new ScrollArea(this, mItems, getOptionBool("showbackground"), "inventory_background.xml"); invenScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); const int size = config.getIntValue("fontSize"); mFilter = new TabStrip(this, "filter_" + getWindowName(), size + 16); mFilter->addActionListener(this); mFilter->setActionEventId("tag_"); StringVect tags = ItemDB::getTags(); const size_t sz = tags.size(); for (size_t f = 0; f < sz; f ++) mFilter->addButton(tags[f], tags[f], false); if (!mInventory) { invInstances.push_back(this); return; } switch (mInventory->getType()) { case InventoryType::Inventory: { // TRANSLATORS: inventory button const std::string equip = _("Equip"); // TRANSLATORS: inventory button const std::string use = _("Use"); // TRANSLATORS: inventory button const std::string unequip = _("Unequip"); std::string longestUseString = getFont()->getWidth(equip) > getFont()->getWidth(use) ? equip : use; if (getFont()->getWidth(longestUseString) < getFont()->getWidth(unequip)) { longestUseString = unequip; } mUseButton = new Button(this, longestUseString, "use", this); // TRANSLATORS: inventory button mDropButton = new Button(this, _("Drop..."), "drop", this); // TRANSLATORS: inventory outfits button mOutfitButton = new Button(this, _("O"), "outfit", this); // TRANSLATORS: inventory cart button mCartButton = new Button(this, _("C"), "cart", this); // TRANSLATORS: inventory shop button mShopButton = new Button(this, _("S"), "shop", this); // TRANSLATORS: inventory equipment button mEquipmentButton = new Button(this, _("E"), "equipment", this); mWeightBar = new ProgressBar(this, 0.0F, 100, 0, ProgressColorId::PROG_WEIGHT, "weightprogressbar.xml", "weightprogressbar_fill.xml"); mWeightBar->setColor(getThemeColor(ThemeColorId::WEIGHT_BAR), getThemeColor(ThemeColorId::WEIGHT_BAR_OUTLINE)); // TRANSLATORS: outfits button tooltip mOutfitButton->setDescription(_("Outfits")); // TRANSLATORS: cart button tooltip mCartButton->setDescription(_("Cart")); // TRANSLATORS: shop button tooltip mShopButton->setDescription(_("Shop")); // TRANSLATORS: equipment button tooltip mEquipmentButton->setDescription(_("Equipment")); place(0, 0, mWeightBar, 4); mSlotsBarCell = &place(4, 0, mSlotsBar, 4); mSortDropDownCell = &place(8, 0, mSortDropDown, 3); mFilterCell = &place(0, 1, mFilter, 10).setPadding(3); mNameFilterCell = &place(8, 1, mNameFilter, 3); place(0, 2, invenScroll, 11).setPadding(3); place(0, 3, mUseButton); place(1, 3, mDropButton); ContainerPlacer placer = getPlacer(10, 3); placer(0, 0, mShopButton); placer(1, 0, mOutfitButton); placer(2, 0, mCartButton); placer(3, 0, mEquipmentButton); updateWeight(); break; } case InventoryType::Storage: { // TRANSLATORS: storage button mStoreButton = new Button(this, _("Store"), "store", this); // TRANSLATORS: storage button mRetrieveButton = new Button(this, _("Retrieve"), "retrieve", this); // TRANSLATORS: storage button mInvCloseButton = new Button(this, _("Close"), "close", this); mSlotsBarCell = &place(0, 0, mSlotsBar, 6); mSortDropDownCell = &place(6, 0, mSortDropDown, 1); mFilterCell = &place(0, 1, mFilter, 7).setPadding(3); mNameFilterCell = &place(6, 1, mNameFilter, 1); place(0, 2, invenScroll, 7, 4); place(0, 6, mStoreButton); place(1, 6, mRetrieveButton); place(6, 6, mInvCloseButton); break; } #ifdef EATHENA_SUPPORT case InventoryType::Cart: { // TRANSLATORS: storage button mStoreButton = new Button(this, _("Store"), "store", this); // TRANSLATORS: storage button mRetrieveButton = new Button(this, _("Retrieve"), "retrieve", this); // TRANSLATORS: storage button mInvCloseButton = new Button(this, _("Close"), "close", this); mWeightBar = new ProgressBar(this, 0.0F, 100, 0, ProgressColorId::PROG_WEIGHT, "weightprogressbar.xml", "weightprogressbar_fill.xml"); mWeightBar->setColor(getThemeColor(ThemeColorId::WEIGHT_BAR), getThemeColor(ThemeColorId::WEIGHT_BAR_OUTLINE)); mSlotsBarCell = &place(3, 0, mSlotsBar, 3); mSortDropDownCell = &place(6, 0, mSortDropDown, 1); mFilterCell = &place(0, 1, mFilter, 7).setPadding(3); mNameFilterCell = &place(6, 1, mNameFilter, 1); place(0, 0, mWeightBar, 3); place(0, 2, invenScroll, 7, 4); place(0, 6, mStoreButton); place(1, 6, mRetrieveButton); place(6, 6, mInvCloseButton); break; } #endif default: case InventoryType::Trade: case InventoryType::Npc: #ifdef EATHENA_SUPPORT case InventoryType::Vending: case InventoryType::Mail: case InventoryType::Craft: #endif case InventoryType::TypeEnd: break; }; Layout &layout = getLayout(); layout.setRowHeight(2, LayoutType::SET); mInventory->addInventoyListener(this); invInstances.push_back(this); if (inventory->isMainInventory()) { updateDropButton(); } else { if (!invInstances.empty()) invInstances.front()->updateDropButton(); } loadWindowState(); enableVisibleSound(true); }
InventoryWindow::InventoryWindow(Inventory *const inventory): Window("Inventory", false, nullptr, "inventory.xml"), gcn::ActionListener(), gcn::KeyListener(), gcn::SelectionListener(), InventoryListener(), mInventory(inventory), mItems(new ItemContainer(this, mInventory)), mWeight(), mSlots(), mUseButton(nullptr), mDropButton(nullptr), mSplitButton(nullptr), mOutfitButton(nullptr), mShopButton(nullptr), mEquipmentButton(nullptr), mStoreButton(nullptr), mRetrieveButton(nullptr), mInvCloseButton(nullptr), mWeightBar(nullptr), mSlotsBar(new ProgressBar(this, 0.0f, 100, 0, Theme::PROG_INVY_SLOTS)), mFilter(nullptr), mSortModel(new SortListModelInv), mSortDropDown(new DropDown(this, mSortModel, false, false, this, "sort")), mNameFilter(new TextField(this, "", true, this, "namefilter", true)), mSortDropDownCell(nullptr), mNameFilterCell(nullptr), mFilterCell(nullptr), mSlotsBarCell(nullptr), mSplit(false), mCompactMode(false) { if (inventory) { setCaption(gettext(inventory->getName().c_str())); setWindowName(inventory->getName()); } else { // TRANSLATORS: inventory window name setCaption(_("Inventory")); setWindowName("Inventory"); } listen(CHANNEL_ATTRIBUTES); if (setupWindow) setupWindow->registerWindowForReset(this); setResizable(true); setCloseButton(true); setSaveVisible(true); setStickyButtonLock(true); setDefaultSize(387, 307, ImageRect::CENTER); setMinWidth(310); setMinHeight(179); addKeyListener(this); mItems->addSelectionListener(this); gcn::ScrollArea *const invenScroll = new ScrollArea( mItems, getOptionBool("showbackground"), "inventory_background.xml"); invenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); const int size = config.getIntValue("fontSize"); mFilter = new TabStrip(this, "filter_" + getWindowName(), size + 16); mFilter->addActionListener(this); mFilter->setActionEventId("tag_"); mSortDropDown->setSelected(0); StringVect tags = ItemDB::getTags(); for (unsigned f = 0; f < tags.size(); f ++) mFilter->addButton(tags[f]); if (isMainInventory()) { // TRANSLATORS: inventory button const std::string equip = _("Equip"); // TRANSLATORS: inventory button const std::string use = _("Use"); // TRANSLATORS: inventory button const std::string unequip = _("Unequip"); std::string longestUseString = getFont()->getWidth(equip) > getFont()->getWidth(use) ? equip : use; if (getFont()->getWidth(longestUseString) < getFont()->getWidth(unequip)) { longestUseString = unequip; } mUseButton = new Button(this, longestUseString, "use", this); // TRANSLATORS: inventory button mDropButton = new Button(this, _("Drop..."), "drop", this); // TRANSLATORS: inventory button mSplitButton = new Button(this, _("Split"), "split", this); // TRANSLATORS: inventory button mOutfitButton = new Button(this, _("Outfits"), "outfit", this); // TRANSLATORS: inventory button mShopButton = new Button(this, _("Shop"), "shop", this); // TRANSLATORS: inventory button mEquipmentButton = new Button(this, _("Equipment"), "equipment", this); mWeightBar = new ProgressBar(this, 0.0f, 100, 0, Theme::PROG_WEIGHT); place(0, 0, mWeightBar, 4); mSlotsBarCell = &place(4, 0, mSlotsBar, 5); mSortDropDownCell = &place(9, 0, mSortDropDown, 2); mFilterCell = &place(0, 1, mFilter, 10).setPadding(3); mNameFilterCell = &place(9, 1, mNameFilter, 2); place(0, 2, invenScroll, 11).setPadding(3); place(0, 3, mUseButton); place(1, 3, mDropButton); place(8, 2, mSplitButton); place(8, 3, mShopButton); place(9, 3, mOutfitButton); place(10, 3, mEquipmentButton); updateWeight(); } else { // TRANSLATORS: storage button mStoreButton = new Button(this, _("Store"), "store", this); // TRANSLATORS: storage button mRetrieveButton = new Button(this, _("Retrieve"), "retrieve", this); // TRANSLATORS: storage button mInvCloseButton = new Button(this, _("Close"), "close", this); mSlotsBarCell = &place(0, 0, mSlotsBar, 6); mSortDropDownCell = &place(6, 0, mSortDropDown, 1); mFilterCell = &place(0, 1, mFilter, 7).setPadding(3); mNameFilterCell = &place(6, 1, mNameFilter, 1); place(0, 2, invenScroll, 7, 4); place(0, 6, mStoreButton); place(1, 6, mRetrieveButton); place(6, 6, mInvCloseButton); } Layout &layout = getLayout(); layout.setRowHeight(2, Layout::AUTO_SET); mInventory->addInventoyListener(this); invInstances.push_back(this); if (inventory && inventory->isMainInventory()) { updateDropButton(); } else { if (!invInstances.empty()) invInstances.front()->updateDropButton(); } loadWindowState(); enableVisibleSound(true); slotsChanged(mInventory); widgetResized(gcn::Event(nullptr)); if (!isMainInventory()) setVisible(true); }