From 90d13ee0681e6b48fa6fdfa3ae21bb0a604a80dc Mon Sep 17 00:00:00 2001 From: John Spray Date: Sun, 10 Oct 2004 15:10:37 +0000 Subject: [PATCH] Trivial and WS changes git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9073 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/gtk/GBC.C | 2 +- src/frontends/gtk/GCharacter.C | 34 +++++++++++----------------------- src/frontends/gtk/GCharacter.h | 5 ++++- src/frontends/gtk/GLyXKeySym.C | 6 +++--- src/frontends/gtk/GParagraph.C | 2 +- src/frontends/gtk/GToolbar.C | 16 +++++++++------- src/frontends/gtk/GToolbar.h | 1 - src/frontends/gtk/GView.C | 1 - 8 files changed, 29 insertions(+), 38 deletions(-) diff --git a/src/frontends/gtk/GBC.C b/src/frontends/gtk/GBC.C index a987ff9ba5..3d3febd792 100644 --- a/src/frontends/gtk/GBC.C +++ b/src/frontends/gtk/GBC.C @@ -38,7 +38,7 @@ void GBC::setWidgetEnabled(Gtk::Widget * widget, bool enabled) 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()) btn->set_label(Glib::locale_to_utf8(label)); } diff --git a/src/frontends/gtk/GCharacter.C b/src/frontends/gtk/GCharacter.C index ce0f8f0499..60403a962b 100644 --- a/src/frontends/gtk/GCharacter.C +++ b/src/frontends/gtk/GCharacter.C @@ -33,29 +33,15 @@ GCharacter::GCharacter(Dialog & parent) {} -class stringcolumns : public Gtk::TreeModel::ColumnRecord { -public: - stringcolumns() - { - add(name); - } - - Gtk::TreeModelColumn name; -}; - - void GCharacter::PopulateComboBox(Gtk::ComboBox * combo, vector const & strings) { - stringcolumns * cols = new stringcolumns; - Glib::RefPtr model = Gtk::ListStore::create(*cols); + Glib::RefPtr model = Gtk::ListStore::create(cols_); vector::const_iterator it = strings.begin(); vector::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); @@ -79,7 +65,7 @@ void GCharacter::doBuild() 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_); @@ -88,7 +74,7 @@ void GCharacter::doBuild() 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_); @@ -98,7 +84,7 @@ void GCharacter::doBuild() bcview().addReadOnly(misccombo_); bcview().addReadOnly(toggleallcheck_); - //Caption/identifier pairs for the parameters + // Caption/identifier pairs for the parameters vector const family = getFamilyData(); vector const series = getSeriesData(); vector const shape = getShapeData(); @@ -116,6 +102,8 @@ void GCharacter::doBuild() 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)); @@ -128,10 +116,10 @@ void GCharacter::doBuild() /* 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( diff --git a/src/frontends/gtk/GCharacter.h b/src/frontends/gtk/GCharacter.h index ebd7990a12..56b83dbd6a 100644 --- a/src/frontends/gtk/GCharacter.h +++ b/src/frontends/gtk/GCharacter.h @@ -27,7 +27,7 @@ namespace frontend { * in their documents. */ class GCharacter - : public GViewCB { + : public GViewCB { public: /// GCharacter(Dialog &); @@ -60,6 +60,9 @@ private: Gtk::ComboBox * sizecombo_; Gtk::ComboBox * misccombo_; + Gtk::TreeModelColumn stringcol_; + Gtk::TreeModel::ColumnRecord cols_; + Gtk::CheckButton * toggleallcheck_; void GCharacter::onChange(); diff --git a/src/frontends/gtk/GLyXKeySym.C b/src/frontends/gtk/GLyXKeySym.C index 36631ae7c6..1c17e0a05f 100644 --- a/src/frontends/gtk/GLyXKeySym.C +++ b/src/frontends/gtk/GLyXKeySym.C @@ -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 buf; @@ -108,8 +108,8 @@ string const GLyXKeySym::print(key_modifier::state mod) const 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]); diff --git a/src/frontends/gtk/GParagraph.C b/src/frontends/gtk/GParagraph.C index d5d325109d..a63582aa79 100644 --- a/src/frontends/gtk/GParagraph.C +++ b/src/frontends/gtk/GParagraph.C @@ -113,7 +113,7 @@ void GParagraph::update() 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)); diff --git a/src/frontends/gtk/GToolbar.C b/src/frontends/gtk/GToolbar.C index 9017fa57db..da99d2c48b 100644 --- a/src/frontends/gtk/GToolbar.C +++ b/src/frontends/gtk/GToolbar.C @@ -66,9 +66,9 @@ GLayoutBox::GLayoutBox(LyXView & owner, 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); @@ -123,8 +123,8 @@ void GLayoutBox::update() } 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); } @@ -209,7 +209,7 @@ GToolbar::GToolbar(ToolbarBackend::Toolbar const & tbb, LyXView & owner) 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) @@ -249,7 +249,9 @@ void GToolbar::add(FuncRequest const & func, string const & tooltip) toolbutton->set_data(gToolData, reinterpret_cast(&const_cast(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); diff --git a/src/frontends/gtk/GToolbar.h b/src/frontends/gtk/GToolbar.h index 4730964518..414cd7a26c 100644 --- a/src/frontends/gtk/GToolbar.h +++ b/src/frontends/gtk/GToolbar.h @@ -75,7 +75,6 @@ private: GView & owner_; Gtk::Toolbar toolbar_; - Gtk::Tooltips tooltips_; boost::scoped_ptr layout_; }; diff --git a/src/frontends/gtk/GView.C b/src/frontends/gtk/GView.C index c58b864de1..44d193e072 100644 --- a/src/frontends/gtk/GView.C +++ b/src/frontends/gtk/GView.C @@ -75,7 +75,6 @@ GView::GView() box_map_[Right] = box_store_[5]; // Make all Boxes visible. - top_box_.show(); top_box_.show_all(); // Define the components making up the window. -- 2.39.5