]> git.lyx.org Git - lyx.git/commitdiff
Trivial and WS changes
authorJohn Spray <spray@lyx.org>
Sun, 10 Oct 2004 15:10:37 +0000 (15:10 +0000)
committerJohn Spray <spray@lyx.org>
Sun, 10 Oct 2004 15:10:37 +0000 (15:10 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9073 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/gtk/GBC.C
src/frontends/gtk/GCharacter.C
src/frontends/gtk/GCharacter.h
src/frontends/gtk/GLyXKeySym.C
src/frontends/gtk/GParagraph.C
src/frontends/gtk/GToolbar.C
src/frontends/gtk/GToolbar.h
src/frontends/gtk/GView.C

index a987ff9ba5042a34c2b5b48f7fd0b25f7512a179..3d3febd7925c65f4a4684bea3f5fabadd3277f99 100644 (file)
@@ -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));
 }
index ce0f8f0499cd8e23e22586e5ba413af816cf78ed..60403a962b15e23e388f0d167a361f7d84ee1050 100644 (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,
                                  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);
@@ -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<FamilyPair>   const family = getFamilyData();
        vector<SeriesPair>   const series = getSeriesData();
        vector<ShapePair>    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(
index ebd7990a12433455b0608038d227d241e382ac4e..56b83dbd6a2d559b2c0626d4e49e815a1685d21d 100644 (file)
@@ -27,7 +27,7 @@ namespace frontend {
  * in their documents.
  */
 class GCharacter
-       : public GViewCB<ControlCharacter, GViewGladeB > {
+       : public GViewCB<ControlCharacter, GViewGladeB> {
 public:
        ///
        GCharacter(Dialog &);
@@ -60,6 +60,9 @@ private:
        Gtk::ComboBox * sizecombo_;
        Gtk::ComboBox * misccombo_;
 
+       Gtk::TreeModelColumn<Glib::ustring> stringcol_;
+       Gtk::TreeModel::ColumnRecord cols_;
+
        Gtk::CheckButton * toggleallcheck_;
 
        void GCharacter::onChange();
index 36631ae7c60fc7d7aa5c0cd1e84dc8a5da84129f..1c17e0a05f70269f5475177d47591cf02c218631 100644 (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 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]);
index d5d325109d62e83b127457787bcae0a8f3d1c6c0..a63582aa79cc73b42ce1ae8117905c1b3b4137db 100644 (file)
@@ -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));
index 9017fa57db52274b15eb67a7104c0079a7f975f2..da99d2c48b18cb9fe877b7c39311a4c5d4121c53 100644 (file)
@@ -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<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,
                        &GToolbar::clicked), FuncRequest(func)));
                toolbar_.append(*toolbutton);
index 4730964518bb6c8415c0259c29a713d28eec3d90..414cd7a26ca2435b9636d5f7560b7d6d07466c0e 100644 (file)
@@ -75,7 +75,6 @@ private:
 
        GView & owner_;
        Gtk::Toolbar toolbar_;
-       Gtk::Tooltips tooltips_;
        boost::scoped_ptr<GLayoutBox> layout_;
 };
 
index c58b864de136ae6e4719604dc617e03d71915969..44d193e07228a1d14a31afe84ad4abbd56399d8a 100644 (file)
@@ -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.