void GBC::setButtonLabel(Gtk::Button * btn, string const & label) const
{
- //GTK+ Stock buttons take precedence
+ // GTK+ Stock buttons take precedence
if (!btn->get_use_stock())
btn->set_label(Glib::locale_to_utf8(label));
}
{}
-class stringcolumns : public Gtk::TreeModel::ColumnRecord {
-public:
- stringcolumns()
- {
- add(name);
- }
-
- Gtk::TreeModelColumn<Glib::ustring> name;
-};
-
-
void GCharacter::PopulateComboBox(Gtk::ComboBox * combo,
vector<string> const & strings)
{
- stringcolumns * cols = new stringcolumns;
- Glib::RefPtr<Gtk::ListStore> model = Gtk::ListStore::create(*cols);
+ Glib::RefPtr<Gtk::ListStore> model = Gtk::ListStore::create(cols_);
vector<string>::const_iterator it = strings.begin();
vector<string>::const_iterator end = strings.end();
- for(; it != end; ++it){
- Gtk::TreeModel::iterator iter = model->append();
- Gtk::TreeModel::Row row = *iter;
- row[cols->name] = *it;
- }
+ for(; it != end; ++it)
+ (*model->append())[stringcol_] = *it;
+
combo->set_model(model);
Gtk::CellRendererText * cell = Gtk::manage(new Gtk::CellRendererText);
combo->pack_start(*cell, true);
xml_->get_widget("ToggleAll", toggleallcheck_);
- //Get combobox addresses
+ // Get combobox addresses
xml_->get_widget("Family", familycombo_);
xml_->get_widget("Series", seriescombo_);
xml_->get_widget("Shape", shapecombo_);
xml_->get_widget("Size", sizecombo_);
xml_->get_widget("Misc", misccombo_);
- //Don't let the user change anything for read only documents
+ // Don't let the user change anything for read only documents
bcview().addReadOnly(familycombo_);
bcview().addReadOnly(seriescombo_);
bcview().addReadOnly(shapecombo_);
bcview().addReadOnly(misccombo_);
bcview().addReadOnly(toggleallcheck_);
- //Caption/identifier pairs for the parameters
+ // Caption/identifier pairs for the parameters
vector<FamilyPair> const family = getFamilyData();
vector<SeriesPair> const series = getSeriesData();
vector<ShapePair> const shape = getShapeData();
color_ = getSecond(color);
lang_ = getSecond(language);
+ // Setup the columnrecord we use for all combos
+ cols_.add(stringcol_);
// Load the captions into the comboboxes
PopulateComboBox(familycombo_, getFirst(family));
PopulateComboBox(seriescombo_, getFirst(series));
/* We use a table so that people with decent size screens don't
* have to scroll. However, this risks the popup being too wide
* for people with small screens, and it doesn't scroll horizontally.
- * Hopefully this is not too wide (and hopefully gtk gets fixed).*/
+ * Hopefully this is not too wide */
languagecombo_->set_wrap_width(3);
- //Load in the current settings
+ // We have to update *before* the signals are connected
update();
familycombo_->signal_changed().connect(
* in their documents.
*/
class GCharacter
- : public GViewCB<ControlCharacter, GViewGladeB > {
+ : public GViewCB<ControlCharacter, GViewGladeB> {
public:
///
GCharacter(Dialog &);
Gtk::ComboBox * sizecombo_;
Gtk::ComboBox * misccombo_;
+ Gtk::TreeModelColumn<Glib::ustring> stringcol_;
+ Gtk::TreeModel::ColumnRecord cols_;
+
Gtk::CheckButton * toggleallcheck_;
void GCharacter::onChange();
}
-//Produce a human readable version (eg "Ctrl+N")
+// Produce a human readable version (eg "Ctrl+N")
string const GLyXKeySym::print(key_modifier::state mod) const
{
string buf;
if (mod & key_modifier::alt)
buf += "Alt+";
- //Uppercase the first letter, for Ctrl+N rather than Ctrl+n,
- //and for Ctrl+Greater rather than Ctrl+GREATER
+ // Uppercase the first letter, for Ctrl+N rather than Ctrl+n,
+ // and for Ctrl+Greater rather than Ctrl+GREATER
string symname = getSymbolName();
if (!symname.empty()) {
symname[0] = lyx::support::uppercase(symname[0]);
leftradio_->set_active(false);
}
- //Find out which alignments options are available
+ // Find out which alignments options are available
LyXAlignment alignpos = controller().alignPossible();
blockradio_->set_sensitive(bool(alignpos & LYX_ALIGN_BLOCK));
centerradio_->set_sensitive(bool(alignpos & LYX_ALIGN_CENTER));
combo_.pack_start(*cell, true);
combo_.add_attribute(*cell,"text",0);
combo_.set_wrap_width(2);
- //Initially there's nothing in the liststore, so set the size
- //to avoid it jumping too much when the user does something that
- //causes the first update()
+ // Initially there's nothing in the liststore, so set the size
+ // to avoid it jumping too much when the user does something that
+ // causes the first update()
combo_.set_size_request(130,-1);
}
internal_ = false;
- //now that we've loaded something into the combobox, forget
- //the initial fixed size and let GTK decide.
+ // now that we've loaded something into the combobox, forget
+ // the initial fixed size and let GTK decide.
combo_.set_size_request(-1,-1);
}
owner_.getBox(position).children().push_back(
Gtk::Box_Helpers::Element(toolbar_, Gtk::PACK_SHRINK));
- tooltips_.enable();
+ toolbar_.set_tooltips(true);
}
void GToolbar::add(FuncRequest const & func, string const & tooltip)
toolbutton->set_data(gToolData,
reinterpret_cast<void*>(&const_cast<FuncRequest &>(func)));
- toolbutton->set_tooltip(tooltips_,tip);
+ toolbutton->set_tooltip(*toolbar_.get_tooltips_object(),tip);
+ /*toolbar_.get_tooltips_object()->set_tip(*toolbutton, tip);*/
+
toolbutton->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this,
>oolbar::clicked), FuncRequest(func)));
toolbar_.append(*toolbutton);
GView & owner_;
Gtk::Toolbar toolbar_;
- Gtk::Tooltips tooltips_;
boost::scoped_ptr<GLayoutBox> layout_;
};
box_map_[Right] = box_store_[5];
// Make all Boxes visible.
- top_box_.show();
top_box_.show_all();
// Define the components making up the window.