Trivial and WS changes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9073 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Spray 2004-10-10 15:10:37 +00:00
parent ba7ff6f4a1
commit 90d13ee068
8 changed files with 29 additions and 38 deletions

View File

@ -38,7 +38,7 @@ void GBC::setWidgetEnabled(Gtk::Widget * widget, bool enabled) const
void GBC::setButtonLabel(Gtk::Button * btn, string const & label) const 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()) if (!btn->get_use_stock())
btn->set_label(Glib::locale_to_utf8(label)); btn->set_label(Glib::locale_to_utf8(label));
} }

View File

@ -33,29 +33,15 @@ GCharacter::GCharacter(Dialog & parent)
{} {}
class stringcolumns : public Gtk::TreeModel::ColumnRecord {
public:
stringcolumns()
{
add(name);
}
Gtk::TreeModelColumn<Glib::ustring> name;
};
void GCharacter::PopulateComboBox(Gtk::ComboBox * combo, void GCharacter::PopulateComboBox(Gtk::ComboBox * combo,
vector<string> const & strings) 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 it = strings.begin();
vector<string>::const_iterator end = strings.end(); vector<string>::const_iterator end = strings.end();
for(; it != end; ++it){ for(; it != end; ++it)
Gtk::TreeModel::iterator iter = model->append(); (*model->append())[stringcol_] = *it;
Gtk::TreeModel::Row row = *iter;
row[cols->name] = *it;
}
combo->set_model(model); combo->set_model(model);
Gtk::CellRendererText * cell = Gtk::manage(new Gtk::CellRendererText); Gtk::CellRendererText * cell = Gtk::manage(new Gtk::CellRendererText);
combo->pack_start(*cell, true); combo->pack_start(*cell, true);
@ -79,7 +65,7 @@ void GCharacter::doBuild()
xml_->get_widget("ToggleAll", toggleallcheck_); xml_->get_widget("ToggleAll", toggleallcheck_);
//Get combobox addresses // Get combobox addresses
xml_->get_widget("Family", familycombo_); xml_->get_widget("Family", familycombo_);
xml_->get_widget("Series", seriescombo_); xml_->get_widget("Series", seriescombo_);
xml_->get_widget("Shape", shapecombo_); xml_->get_widget("Shape", shapecombo_);
@ -88,7 +74,7 @@ void GCharacter::doBuild()
xml_->get_widget("Size", sizecombo_); xml_->get_widget("Size", sizecombo_);
xml_->get_widget("Misc", misccombo_); 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(familycombo_);
bcview().addReadOnly(seriescombo_); bcview().addReadOnly(seriescombo_);
bcview().addReadOnly(shapecombo_); bcview().addReadOnly(shapecombo_);
@ -98,7 +84,7 @@ void GCharacter::doBuild()
bcview().addReadOnly(misccombo_); bcview().addReadOnly(misccombo_);
bcview().addReadOnly(toggleallcheck_); bcview().addReadOnly(toggleallcheck_);
//Caption/identifier pairs for the parameters // Caption/identifier pairs for the parameters
vector<FamilyPair> const family = getFamilyData(); vector<FamilyPair> const family = getFamilyData();
vector<SeriesPair> const series = getSeriesData(); vector<SeriesPair> const series = getSeriesData();
vector<ShapePair> const shape = getShapeData(); vector<ShapePair> const shape = getShapeData();
@ -116,6 +102,8 @@ void GCharacter::doBuild()
color_ = getSecond(color); color_ = getSecond(color);
lang_ = getSecond(language); lang_ = getSecond(language);
// Setup the columnrecord we use for all combos
cols_.add(stringcol_);
// Load the captions into the comboboxes // Load the captions into the comboboxes
PopulateComboBox(familycombo_, getFirst(family)); PopulateComboBox(familycombo_, getFirst(family));
PopulateComboBox(seriescombo_, getFirst(series)); PopulateComboBox(seriescombo_, getFirst(series));
@ -128,10 +116,10 @@ void GCharacter::doBuild()
/* We use a table so that people with decent size screens don't /* We use a table so that people with decent size screens don't
* have to scroll. However, this risks the popup being too wide * have to scroll. However, this risks the popup being too wide
* for people with small screens, and it doesn't scroll horizontally. * 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); languagecombo_->set_wrap_width(3);
//Load in the current settings // We have to update *before* the signals are connected
update(); update();
familycombo_->signal_changed().connect( familycombo_->signal_changed().connect(

View File

@ -27,7 +27,7 @@ namespace frontend {
* in their documents. * in their documents.
*/ */
class GCharacter class GCharacter
: public GViewCB<ControlCharacter, GViewGladeB > { : public GViewCB<ControlCharacter, GViewGladeB> {
public: public:
/// ///
GCharacter(Dialog &); GCharacter(Dialog &);
@ -60,6 +60,9 @@ private:
Gtk::ComboBox * sizecombo_; Gtk::ComboBox * sizecombo_;
Gtk::ComboBox * misccombo_; Gtk::ComboBox * misccombo_;
Gtk::TreeModelColumn<Glib::ustring> stringcol_;
Gtk::TreeModel::ColumnRecord cols_;
Gtk::CheckButton * toggleallcheck_; Gtk::CheckButton * toggleallcheck_;
void GCharacter::onChange(); void GCharacter::onChange();

View File

@ -96,7 +96,7 @@ char GLyXKeySym::getISOEncoded(string const & /*encoding*/) const
} }
//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 const GLyXKeySym::print(key_modifier::state mod) const
{ {
string buf; string buf;
@ -108,8 +108,8 @@ string const GLyXKeySym::print(key_modifier::state mod) const
if (mod & key_modifier::alt) if (mod & key_modifier::alt)
buf += "Alt+"; buf += "Alt+";
//Uppercase the first letter, for Ctrl+N rather than Ctrl+n, // Uppercase the first letter, for Ctrl+N rather than Ctrl+n,
//and for Ctrl+Greater rather than Ctrl+GREATER // and for Ctrl+Greater rather than Ctrl+GREATER
string symname = getSymbolName(); string symname = getSymbolName();
if (!symname.empty()) { if (!symname.empty()) {
symname[0] = lyx::support::uppercase(symname[0]); symname[0] = lyx::support::uppercase(symname[0]);

View File

@ -113,7 +113,7 @@ void GParagraph::update()
leftradio_->set_active(false); leftradio_->set_active(false);
} }
//Find out which alignments options are available // Find out which alignments options are available
LyXAlignment alignpos = controller().alignPossible(); LyXAlignment alignpos = controller().alignPossible();
blockradio_->set_sensitive(bool(alignpos & LYX_ALIGN_BLOCK)); blockradio_->set_sensitive(bool(alignpos & LYX_ALIGN_BLOCK));
centerradio_->set_sensitive(bool(alignpos & LYX_ALIGN_CENTER)); centerradio_->set_sensitive(bool(alignpos & LYX_ALIGN_CENTER));

View File

@ -66,9 +66,9 @@ GLayoutBox::GLayoutBox(LyXView & owner,
combo_.pack_start(*cell, true); combo_.pack_start(*cell, true);
combo_.add_attribute(*cell,"text",0); combo_.add_attribute(*cell,"text",0);
combo_.set_wrap_width(2); combo_.set_wrap_width(2);
//Initially there's nothing in the liststore, so set the size // Initially there's nothing in the liststore, so set the size
//to avoid it jumping too much when the user does something that // to avoid it jumping too much when the user does something that
//causes the first update() // causes the first update()
combo_.set_size_request(130,-1); combo_.set_size_request(130,-1);
@ -123,8 +123,8 @@ void GLayoutBox::update()
} }
internal_ = false; internal_ = false;
//now that we've loaded something into the combobox, forget // now that we've loaded something into the combobox, forget
//the initial fixed size and let GTK decide. // the initial fixed size and let GTK decide.
combo_.set_size_request(-1,-1); combo_.set_size_request(-1,-1);
} }
@ -209,7 +209,7 @@ GToolbar::GToolbar(ToolbarBackend::Toolbar const & tbb, LyXView & owner)
owner_.getBox(position).children().push_back( owner_.getBox(position).children().push_back(
Gtk::Box_Helpers::Element(toolbar_, Gtk::PACK_SHRINK)); Gtk::Box_Helpers::Element(toolbar_, Gtk::PACK_SHRINK));
tooltips_.enable(); toolbar_.set_tooltips(true);
} }
void GToolbar::add(FuncRequest const & func, string const & tooltip) void GToolbar::add(FuncRequest const & func, string const & tooltip)
@ -249,7 +249,9 @@ void GToolbar::add(FuncRequest const & func, string const & tooltip)
toolbutton->set_data(gToolData, toolbutton->set_data(gToolData,
reinterpret_cast<void*>(&const_cast<FuncRequest &>(func))); 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, toolbutton->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this,
&GToolbar::clicked), FuncRequest(func))); &GToolbar::clicked), FuncRequest(func)));
toolbar_.append(*toolbutton); toolbar_.append(*toolbutton);

View File

@ -75,7 +75,6 @@ private:
GView & owner_; GView & owner_;
Gtk::Toolbar toolbar_; Gtk::Toolbar toolbar_;
Gtk::Tooltips tooltips_;
boost::scoped_ptr<GLayoutBox> layout_; boost::scoped_ptr<GLayoutBox> layout_;
}; };

View File

@ -75,7 +75,6 @@ GView::GView()
box_map_[Right] = box_store_[5]; box_map_[Right] = box_store_[5];
// Make all Boxes visible. // Make all Boxes visible.
top_box_.show();
top_box_.show_all(); top_box_.show_all();
// Define the components making up the window. // Define the components making up the window.