Toolbar has custom icons now. Works only when installed.
authorladanyi
Wed, 17 Aug 2005 12:35:43 +0000
changeset 1634910b1bcb7d05
parent 1633 4bc163d55528
child 1635 1d2e5352e99b
Toolbar has custom icons now. Works only when installed.
gui/Makefile.am
gui/main_win.cc
gui/mapstorage.cc
     1.1 --- a/gui/Makefile.am	Tue Aug 16 20:17:43 2005 +0000
     1.2 +++ b/gui/Makefile.am	Wed Aug 17 12:35:43 2005 +0000
     1.3 @@ -1,10 +1,6 @@
     1.4  AM_CPPFLAGS = -I$(top_srcdir)
     1.5  LDADD = $(top_builddir)/lemon/libemon.la
     1.6  
     1.7 -
     1.8 -noinst_DATA = guipixbufs.h
     1.9 -CLEANFILES = $(noinst_DATA)
    1.10 -
    1.11  bin_PROGRAMS = gd
    1.12  
    1.13  gd_SOURCES = \
    1.14 @@ -30,23 +26,15 @@
    1.15  
    1.16  gd_CXXFLAGS = $(GTK_CFLAGS)
    1.17  gd_LDFLAGS = $(GTK_LIBS)
    1.18 +gd_CPPFLAGS = -DDATADIR=\"$(datadir)\"
    1.19  
    1.20 -IMAGES = addlink.png addnode.png delete.png \
    1.21 -	editlink.png editnode.png move.png newmap.png
    1.22 +pixmapdir = $(datadir)/pixmaps/gd
    1.23  
    1.24 -VARIABLES = \
    1.25 -	gui_icons_addlink $(srcdir)/addlink.png \
    1.26 -	gui_icons_addnode $(srcdir)/addnode.png \
    1.27 -	gui_icons_delete $(srcdir)/delete.png \
    1.28 -	gui_icons_editlink $(srcdir)/editlink.png \
    1.29 -	gui_icons_editnode $(srcdir)/editnode.png \
    1.30 -	gui_icons_move $(srcdir)/move.png \
    1.31 -	gui_icons_newmap $(srcdir)/newmap.png
    1.32 -
    1.33 -
    1.34 -guipixbufs.h: $(IMAGES)
    1.35 -	gdk-pixbuf-csource \
    1.36 -	--raw --build-list $(VARIABLES) > guipixbufs.h ||  \
    1.37 -	( rm -f guipixbufs.h && false )
    1.38 -
    1.39 -EXTRA_DIST = $(IMAGES) guipixbufs.h
    1.40 +pixmap_DATA =
    1.41 +	addlink.png \
    1.42 +	addnode.png \
    1.43 +	delete.png \
    1.44 +	editlink.png \
    1.45 +	editnode.png \
    1.46 +	move.png \
    1.47 +	newmap.png
     2.1 --- a/gui/main_win.cc	Tue Aug 16 20:17:43 2005 +0000
     2.2 +++ b/gui/main_win.cc	Wed Aug 17 12:35:43 2005 +0000
     2.3 @@ -8,6 +8,75 @@
     2.4    set_default_size(WIN_WIDTH,WIN_HEIGHT);
     2.5    add(vbox);
     2.6  
     2.7 +
     2.8 +  // custom icons for the toolbar
     2.9 +
    2.10 +  Glib::RefPtr<Gtk::IconFactory> p_icon_factory = Gtk::IconFactory::create();
    2.11 + 
    2.12 +  std::vector<std::string> icon_path;
    2.13 +  icon_path.push_back(DATADIR);
    2.14 +  icon_path.push_back("pixmaps");
    2.15 +  icon_path.push_back("gd");
    2.16 +
    2.17 +  std::vector<std::string> move_icon_path(icon_path);
    2.18 +  move_icon_path.push_back("move.png");
    2.19 +  Gtk::IconSource move_icon_source;
    2.20 +  move_icon_source.set_filename(Glib::build_filename(move_icon_path));
    2.21 +  Gtk::IconSet move_icon_set;
    2.22 +  move_icon_set.add_source(move_icon_source);
    2.23 +  p_icon_factory->add(Gtk::StockID("gd-move"), move_icon_set);
    2.24 +
    2.25 +  std::vector<std::string> addnode_icon_path(icon_path);
    2.26 +  addnode_icon_path.push_back("addnode.png");
    2.27 +  Gtk::IconSource addnode_icon_source;
    2.28 +  addnode_icon_source.set_filename(Glib::build_filename(addnode_icon_path));
    2.29 +  Gtk::IconSet addnode_icon_set;
    2.30 +  addnode_icon_set.add_source(addnode_icon_source);
    2.31 +  p_icon_factory->add(Gtk::StockID("gd-addnode"), addnode_icon_set);
    2.32 +
    2.33 +  std::vector<std::string> addlink_icon_path(icon_path);
    2.34 +  addlink_icon_path.push_back("addlink.png");
    2.35 +  Gtk::IconSource addlink_icon_source;
    2.36 +  addlink_icon_source.set_filename(Glib::build_filename(addlink_icon_path));
    2.37 +  Gtk::IconSet addlink_icon_set;
    2.38 +  addlink_icon_set.add_source(addlink_icon_source);
    2.39 +  p_icon_factory->add(Gtk::StockID("gd-addlink"), addlink_icon_set);
    2.40 +
    2.41 +  std::vector<std::string> delete_icon_path(icon_path);
    2.42 +  delete_icon_path.push_back("delete.png");
    2.43 +  Gtk::IconSource delete_icon_source;
    2.44 +  delete_icon_source.set_filename(Glib::build_filename(delete_icon_path));
    2.45 +  Gtk::IconSet delete_icon_set;
    2.46 +  delete_icon_set.add_source(delete_icon_source);
    2.47 +  p_icon_factory->add(Gtk::StockID("gd-delete"), delete_icon_set);
    2.48 +
    2.49 +  std::vector<std::string> editlink_icon_path(icon_path);
    2.50 +  editlink_icon_path.push_back("editlink.png");
    2.51 +  Gtk::IconSource editlink_icon_source;
    2.52 +  editlink_icon_source.set_filename(Glib::build_filename(editlink_icon_path));
    2.53 +  Gtk::IconSet editlink_icon_set;
    2.54 +  editlink_icon_set.add_source(editlink_icon_source);
    2.55 +  p_icon_factory->add(Gtk::StockID("gd-editlink"), editlink_icon_set);
    2.56 +
    2.57 +  std::vector<std::string> editnode_icon_path(icon_path);
    2.58 +  editnode_icon_path.push_back("editnode.png");
    2.59 +  Gtk::IconSource editnode_icon_source;
    2.60 +  editnode_icon_source.set_filename(Glib::build_filename(editnode_icon_path));
    2.61 +  Gtk::IconSet editnode_icon_set;
    2.62 +  editnode_icon_set.add_source(editnode_icon_source);
    2.63 +  p_icon_factory->add(Gtk::StockID("gd-editnode"), editnode_icon_set);
    2.64 +
    2.65 +  std::vector<std::string> newmap_icon_path(icon_path);
    2.66 +  newmap_icon_path.push_back("newmap.png");
    2.67 +  Gtk::IconSource newmap_icon_source;
    2.68 +  newmap_icon_source.set_filename(Glib::build_filename(newmap_icon_path));
    2.69 +  Gtk::IconSet newmap_icon_set;
    2.70 +  newmap_icon_set.add_source(newmap_icon_source);
    2.71 +  p_icon_factory->add(Gtk::StockID("gd-newmap"), newmap_icon_set);
    2.72 +
    2.73 +  p_icon_factory->add_default();
    2.74 +  
    2.75 +
    2.76    ag=Gtk::ActionGroup::create();
    2.77  
    2.78    ag->add( Gtk::Action::create("FileMenu", "_File") );
    2.79 @@ -39,19 +108,21 @@
    2.80        sigc::mem_fun(this->mapwin, &MapWin::show));
    2.81  
    2.82    Gtk::RadioAction::Group tool_group;
    2.83 -  ag->add( Gtk::RadioAction::create(tool_group, "MoveItem", Gtk::Stock::CONVERT, "Move"),
    2.84 +  ag->add( Gtk::RadioAction::create(tool_group, "MoveItem", Gtk::StockID("gd-move"), "Move"),
    2.85        sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 0) );
    2.86 -  ag->add( Gtk::RadioAction::create(tool_group, "CreateNode", Gtk::Stock::NO, "Create node"),
    2.87 +  ag->add( Gtk::RadioAction::create(tool_group, "CreateNode", Gtk::StockID("gd-addnode"), "Create node"),
    2.88        sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 1) );
    2.89 -  ag->add( Gtk::RadioAction::create(tool_group, "CreateEdge", Gtk::Stock::REMOVE, "Create edge"),
    2.90 +  ag->add( Gtk::RadioAction::create(tool_group, "CreateEdge", Gtk::StockID("gd-addlink"), "Create edge"),
    2.91        sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 2) );
    2.92 -  ag->add( Gtk::RadioAction::create(tool_group, "EraseItem", Gtk::Stock::DELETE, "Delete"),
    2.93 +  ag->add( Gtk::RadioAction::create(tool_group, "EraseItem", Gtk::StockID("gd-delete"), "Delete"),
    2.94        sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 3) );
    2.95 -  ag->add( Gtk::Action::create("EditEdgeMap", Gtk::Stock::PROPERTIES),
    2.96 +
    2.97 +  ag->add( Gtk::RadioAction::create(tool_group, "EditEdgeMap", Gtk::StockID("gd-editlink"), "Edit edge map"),
    2.98        sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 4) );
    2.99 -  ag->add( Gtk::Action::create("EditNodeMap", Gtk::Stock::PREFERENCES),
   2.100 +  ag->add( Gtk::RadioAction::create(tool_group, "EditNodeMap", Gtk::StockID("gd-editnode"), "Edit node map"),
   2.101        sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 5) );
   2.102 -  ag->add( Gtk::Action::create("AddMap", Gtk::Stock::NEW),
   2.103 +
   2.104 +  ag->add( Gtk::Action::create("AddMap", Gtk::StockID("gd-newmap")),
   2.105        sigc::mem_fun ( this->newmapwin, &NewMapWin::show ) );
   2.106  
   2.107    uim=Gtk::UIManager::create();
   2.108 @@ -99,6 +170,7 @@
   2.109        "    <toolitem action='EraseItem' />"
   2.110        "    <toolitem action='EditEdgeMap' />"
   2.111        "    <toolitem action='EditNodeMap' />"
   2.112 +      "    <separator />"
   2.113        "    <toolitem action='AddMap' />"
   2.114        "  </toolbar>"
   2.115        "</ui>";
     3.1 --- a/gui/mapstorage.cc	Tue Aug 16 20:17:43 2005 +0000
     3.2 +++ b/gui/mapstorage.cc	Wed Aug 17 12:35:43 2005 +0000
     3.3 @@ -1,4 +1,5 @@
     3.4  #include "mapstorage.h"
     3.5 +#include <cmath>
     3.6  
     3.7  MapStorage::MapStorage() : modified(false), file_name("")
     3.8  {