From: Lars Gullik Bjønnes Date: Mon, 27 Sep 2004 19:04:17 +0000 (+0000) Subject: some small changes X-Git-Tag: 1.6.10~14993 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=fa371fa1eb23a2dd21100025485c618a0d87ffe7;p=features.git some small changes git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9017 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/gtk/ChangeLog b/src/frontends/gtk/ChangeLog index 674f172458..3e47427ee8 100644 --- a/src/frontends/gtk/ChangeLog +++ b/src/frontends/gtk/ChangeLog @@ -1,3 +1,21 @@ +2004-09-27 Lars Gullik Bjønnes + + * 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 * The Character dialog diff --git a/src/frontends/gtk/GCharacter.C b/src/frontends/gtk/GCharacter.C index 6f7d1abd73..c38ac169f6 100644 --- a/src/frontends/gtk/GCharacter.C +++ b/src/frontends/gtk/GCharacter.C @@ -39,7 +39,7 @@ public: { add(name); } - + Gtk::TreeModelColumn name; }; diff --git a/src/frontends/gtk/GMathPanel.C b/src/frontends/gtk/GMathPanel.C index b453d1cf01..0645601c0c 100644 --- a/src/frontends/gtk/GMathPanel.C +++ b/src/frontends/gtk/GMathPanel.C @@ -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)); diff --git a/src/frontends/gtk/GView.C b/src/frontends/gtk/GView.C index 0864f8a3f3..485c9f3042 100644 --- a/src/frontends/gtk/GView.C +++ b/src/frontends/gtk/GView.C @@ -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)); diff --git a/src/frontends/gtk/GWorkArea.C b/src/frontends/gtk/GWorkArea.C index 8399c38004..f6ac721abc 100644 --- a/src/frontends/gtk/GWorkArea.C +++ b/src/frontends/gtk/GWorkArea.C @@ -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(gclr); } void ColorCache::cacheXftColor(LColor_color clr, XftColor * xclr) { - cache2_[clr] = xclr; + cache2_[clr] = shared_ptr(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(); } diff --git a/src/frontends/gtk/GWorkArea.h b/src/frontends/gtk/GWorkArea.h index aa53daf51c..eaeb971e08 100644 --- a/src/frontends/gtk/GWorkArea.h +++ b/src/frontends/gtk/GWorkArea.h @@ -29,11 +29,10 @@ namespace frontend { class ColorCache { public: - typedef std::map Map; + typedef std::map > Map; typedef Map::iterator MapIt; - typedef std::map Map2; + typedef std::map > Map2; typedef Map2::iterator MapIt2; - ~ColorCache(); Gdk::Color * getColor(LColor_color); XftColor * getXftColor(LColor_color); void cacheColor(LColor_color, Gdk::Color *); diff --git a/src/frontends/gtk/lyx_gui.C b/src/frontends/gtk/lyx_gui.C index f215c60c74..9ab4a78abb 100644 --- a/src/frontends/gtk/lyx_gui.C +++ b/src/frontends/gtk/lyx_gui.C @@ -336,16 +336,14 @@ void lyx_gui::start(string const & batch, std::vector 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::const_iterator cit = files.begin(); - std::vector::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()) {