]> git.lyx.org Git - features.git/commitdiff
some small changes
authorLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 27 Sep 2004 19:04:17 +0000 (19:04 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 27 Sep 2004 19:04:17 +0000 (19:04 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9017 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/gtk/ChangeLog
src/frontends/gtk/GCharacter.C
src/frontends/gtk/GMathPanel.C
src/frontends/gtk/GView.C
src/frontends/gtk/GWorkArea.C
src/frontends/gtk/GWorkArea.h
src/frontends/gtk/lyx_gui.C

index 674f172458a15b70aa102d4ac1f218887c4fc866..3e47427ee84825377dcbe5dd453b5049fb1c0748 100644 (file)
@@ -1,3 +1,21 @@
+2004-09-27  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * lyx_gui.C (start): change comment
+       (start): use for_each instead of explicit loop
+
+       * GWorkArea.h: store shared_ptr in the Maps.
+
+       * GWorkArea.C (~ColorCache): delete
+       (getColor): adjust
+       (getXftColor): adjust
+       (cacheColor): adjust
+       (cacheXftColor): adjust
+       (clear): simplify
+
+       * GView.C (GView): use show_all() instead of explict loop
+
+       * GMathPanel.C (doBuild): ws change
+
 2004-09-27  John Spray  <spray_john@users.sourceforge.net>
 
        * The Character dialog
index 6f7d1abd737d7007051c25416dad71d2b84e1ec3..c38ac169f6f76fc32b0d0437f74cbe4bc38edf42 100644 (file)
@@ -39,7 +39,7 @@ public:
        {
                add(name);
        }
-       
+
        Gtk::TreeModelColumn<Glib::ustring> name;
 };
 
index b453d1cf019cd1320c61f96381968e93cbef7e55..0645601c0c3c843faf3d49c1f4733f6894f17edc 100644 (file)
@@ -129,7 +129,7 @@ void GMathPanel::doBuild()
        listStore_ = Gtk::ListStore::create(listCols_);
        functions_->set_model(listStore_);
        functions_->append_column("Functions", listCol_);
-               
+
        listSel_ = functions_->get_selection();
        listSel_->signal_changed().connect(
                sigc::mem_fun(*this, &GMathPanel::onFunctionSelected));
index 0864f8a3f3eafccb2fcf9dc8d19cbb925699dcac..485c9f30424bc84fed436b4b4a0f19cd4e7041fc 100644 (file)
@@ -76,10 +76,7 @@ GView::GView()
 
        // Make all Boxes visible.
        top_box_.show();
-       BoxStore::iterator it = box_store_.begin();
-       BoxStore::iterator const end = box_store_.end();
-       for (; it != end; ++it)
-               (*it)->show();
+       top_box_.show_all();
 
        // Define the components making up the window.
        menubar_.reset(new GMenubar(this, menubackend));
index 8399c380040df140eaae4c914a6ccce19f8c0b73..f6ac721abcb8bbf270e9e3668e5ec2a43ae950eb 100644 (file)
@@ -19,6 +19,8 @@
 #include "funcrequest.h"
 #include "LColor.h"
 
+using boost::shared_ptr;
+
 using std::string;
 
 namespace lyx {
@@ -27,47 +29,35 @@ namespace frontend {
 ColorCache colorCache;
 
 
-ColorCache::~ColorCache()
-{
-       clear();
-}
-
-
 Gdk::Color * ColorCache::getColor(LColor_color clr)
 {
        MapIt it = cache_.find(clr);
-       return it == cache_.end() ? 0 : it->second;
+       return it == cache_.end() ? 0 : it->second.get();
 }
 
 
 XftColor * ColorCache::getXftColor(LColor_color clr)
 {
        MapIt2 it = cache2_.find(clr);
-       return it == cache2_.end() ? 0 : it->second;
+       return it == cache2_.end() ? 0 : it->second.get();
 }
 
 
 void ColorCache::cacheColor(LColor_color clr, Gdk::Color * gclr)
 {
-       cache_[clr] = gclr;
+       cache_[clr] = shared_ptr<Gdk::Color>(gclr);
 }
 
 
 void ColorCache::cacheXftColor(LColor_color clr, XftColor * xclr)
 {
-       cache2_[clr] = xclr;
+       cache2_[clr] = shared_ptr<XftColor>(xclr);
 }
 
 
 void ColorCache::clear()
 {
-       MapIt it = cache_.begin();
-       for (; it != cache_.end(); ++it)
-               delete it->second;
        cache_.clear();
-       MapIt2 it2 = cache2_.begin();
-       for (; it2 != cache2_.end(); ++it2)
-               delete it2->second;
        cache2_.clear();
 }
 
index aa53daf51c9636ed8492bbcabb1ff79976148b63..eaeb971e08d51815c61ed2662b4a23393ccaffc8 100644 (file)
@@ -29,11 +29,10 @@ namespace frontend {
 
 class ColorCache {
 public:
-       typedef std::map<LColor_color, Gdk::Color *> Map;
+       typedef std::map<LColor_color, boost::shared_ptr<Gdk::Color> > Map;
        typedef Map::iterator MapIt;
-       typedef std::map<LColor_color, XftColor *> Map2;
+       typedef std::map<LColor_color, boost::shared_ptr<XftColor> > Map2;
        typedef Map2::iterator MapIt2;
-       ~ColorCache();
        Gdk::Color * getColor(LColor_color);
        XftColor * getXftColor(LColor_color);
        void cacheColor(LColor_color, Gdk::Color *);
index f215c60c748eccae5d7bd5789c2e88a4ee15928c..9ab4a78abbadb31175607789a4655cdb39259102 100644 (file)
@@ -336,16 +336,14 @@ void lyx_gui::start(string const & batch, std::vector<string> const & files)
        view.show();
        view.init();
 
-       // FIXME: some code below needs moving
+       // FIXME: server code below needs moving
 
        lyxserver = new LyXServer(&view.getLyXFunc(), lyxrc.lyxpipes);
        lyxsocket = new LyXServerSocket(&view.getLyXFunc(),
                          os::slashify_path(os::getTmpDir() + "/lyxsocket"));
 
-       std::vector<string>::const_iterator cit = files.begin();
-       std::vector<string>::const_iterator end = files.end();
-       for (; cit != end; ++cit)
-               view.view()->loadLyXFile(*cit, true);
+       for_each(files.begin(), files.end(),
+                bind(&BufferView::loadLyXFile, view.view(), _1, true));
 
        // handle the batch commands the user asked for
        if (!batch.empty()) {