gui/main_win.cc
changeset 1635 1d2e5352e99b
parent 1634 910b1bcb7d05
child 1645 4a04bb856ac7
equal deleted inserted replaced
15:503e880fdadb 16:9ee8228d263a
     1 #include "main_win.h"
     1 #include "main_win.h"
       
     2 #include "guipixbufs.h"
     2 
     3 
     3 MainWin::MainWin(const std::string& title) :
     4 MainWin::MainWin(const std::string& title) :
     4   mapwin("Map Setup", mapstorage, gd_canvas),
     5   mapwin("Map Setup", mapstorage, gd_canvas),
     5   newmapwin("Creating new map", gd_canvas), gd_canvas(mapstorage, mapwin, (Gtk::Window *)this)
     6   newmapwin("Creating new map", gd_canvas), gd_canvas(mapstorage, mapwin, (Gtk::Window *)this)
     6 {
     7 {
    11 
    12 
    12   // custom icons for the toolbar
    13   // custom icons for the toolbar
    13 
    14 
    14   Glib::RefPtr<Gtk::IconFactory> p_icon_factory = Gtk::IconFactory::create();
    15   Glib::RefPtr<Gtk::IconFactory> p_icon_factory = Gtk::IconFactory::create();
    15  
    16  
    16   std::vector<std::string> icon_path;
    17   Glib::RefPtr<Gdk::Pixbuf> p_move_pixbuf = Gdk::Pixbuf::create_from_inline(
    17   icon_path.push_back(DATADIR);
    18       2328, gui_icons_move);
    18   icon_path.push_back("pixmaps");
    19   Glib::RefPtr<Gdk::Pixbuf> p_addnode_pixbuf = Gdk::Pixbuf::create_from_inline(
    19   icon_path.push_back("gd");
    20       2328, gui_icons_addnode);
    20 
    21   Glib::RefPtr<Gdk::Pixbuf> p_addlink_pixbuf = Gdk::Pixbuf::create_from_inline(
    21   std::vector<std::string> move_icon_path(icon_path);
    22       2328, gui_icons_addlink);
    22   move_icon_path.push_back("move.png");
    23   Glib::RefPtr<Gdk::Pixbuf> p_delete_pixbuf = Gdk::Pixbuf::create_from_inline(
       
    24       2328, gui_icons_delete);
       
    25   Glib::RefPtr<Gdk::Pixbuf> p_editlink_pixbuf = Gdk::Pixbuf::create_from_inline(
       
    26       2328, gui_icons_editlink);
       
    27   Glib::RefPtr<Gdk::Pixbuf> p_editnode_pixbuf = Gdk::Pixbuf::create_from_inline(
       
    28       2328, gui_icons_editnode);
       
    29   Glib::RefPtr<Gdk::Pixbuf> p_newmap_pixbuf = Gdk::Pixbuf::create_from_inline(
       
    30       2328, gui_icons_newmap);
       
    31 
    23   Gtk::IconSource move_icon_source;
    32   Gtk::IconSource move_icon_source;
    24   move_icon_source.set_filename(Glib::build_filename(move_icon_path));
    33   move_icon_source.set_pixbuf(p_move_pixbuf);
    25   Gtk::IconSet move_icon_set;
    34   Gtk::IconSet move_icon_set;
    26   move_icon_set.add_source(move_icon_source);
    35   move_icon_set.add_source(move_icon_source);
    27   p_icon_factory->add(Gtk::StockID("gd-move"), move_icon_set);
    36   p_icon_factory->add(Gtk::StockID("gd-move"), move_icon_set);
    28 
    37 
    29   std::vector<std::string> addnode_icon_path(icon_path);
       
    30   addnode_icon_path.push_back("addnode.png");
       
    31   Gtk::IconSource addnode_icon_source;
    38   Gtk::IconSource addnode_icon_source;
    32   addnode_icon_source.set_filename(Glib::build_filename(addnode_icon_path));
    39   addnode_icon_source.set_pixbuf(p_addnode_pixbuf);
    33   Gtk::IconSet addnode_icon_set;
    40   Gtk::IconSet addnode_icon_set;
    34   addnode_icon_set.add_source(addnode_icon_source);
    41   addnode_icon_set.add_source(addnode_icon_source);
    35   p_icon_factory->add(Gtk::StockID("gd-addnode"), addnode_icon_set);
    42   p_icon_factory->add(Gtk::StockID("gd-addnode"), addnode_icon_set);
    36 
    43 
    37   std::vector<std::string> addlink_icon_path(icon_path);
       
    38   addlink_icon_path.push_back("addlink.png");
       
    39   Gtk::IconSource addlink_icon_source;
    44   Gtk::IconSource addlink_icon_source;
    40   addlink_icon_source.set_filename(Glib::build_filename(addlink_icon_path));
    45   addlink_icon_source.set_pixbuf(p_addlink_pixbuf);
    41   Gtk::IconSet addlink_icon_set;
    46   Gtk::IconSet addlink_icon_set;
    42   addlink_icon_set.add_source(addlink_icon_source);
    47   addlink_icon_set.add_source(addlink_icon_source);
    43   p_icon_factory->add(Gtk::StockID("gd-addlink"), addlink_icon_set);
    48   p_icon_factory->add(Gtk::StockID("gd-addlink"), addlink_icon_set);
    44 
    49 
    45   std::vector<std::string> delete_icon_path(icon_path);
       
    46   delete_icon_path.push_back("delete.png");
       
    47   Gtk::IconSource delete_icon_source;
    50   Gtk::IconSource delete_icon_source;
    48   delete_icon_source.set_filename(Glib::build_filename(delete_icon_path));
    51   delete_icon_source.set_pixbuf(p_delete_pixbuf);
    49   Gtk::IconSet delete_icon_set;
    52   Gtk::IconSet delete_icon_set;
    50   delete_icon_set.add_source(delete_icon_source);
    53   delete_icon_set.add_source(delete_icon_source);
    51   p_icon_factory->add(Gtk::StockID("gd-delete"), delete_icon_set);
    54   p_icon_factory->add(Gtk::StockID("gd-delete"), delete_icon_set);
    52 
    55 
    53   std::vector<std::string> editlink_icon_path(icon_path);
       
    54   editlink_icon_path.push_back("editlink.png");
       
    55   Gtk::IconSource editlink_icon_source;
    56   Gtk::IconSource editlink_icon_source;
    56   editlink_icon_source.set_filename(Glib::build_filename(editlink_icon_path));
    57   editlink_icon_source.set_pixbuf(p_editlink_pixbuf);
    57   Gtk::IconSet editlink_icon_set;
    58   Gtk::IconSet editlink_icon_set;
    58   editlink_icon_set.add_source(editlink_icon_source);
    59   editlink_icon_set.add_source(editlink_icon_source);
    59   p_icon_factory->add(Gtk::StockID("gd-editlink"), editlink_icon_set);
    60   p_icon_factory->add(Gtk::StockID("gd-editlink"), editlink_icon_set);
    60 
    61 
    61   std::vector<std::string> editnode_icon_path(icon_path);
       
    62   editnode_icon_path.push_back("editnode.png");
       
    63   Gtk::IconSource editnode_icon_source;
    62   Gtk::IconSource editnode_icon_source;
    64   editnode_icon_source.set_filename(Glib::build_filename(editnode_icon_path));
    63   editnode_icon_source.set_pixbuf(p_editnode_pixbuf);
    65   Gtk::IconSet editnode_icon_set;
    64   Gtk::IconSet editnode_icon_set;
    66   editnode_icon_set.add_source(editnode_icon_source);
    65   editnode_icon_set.add_source(editnode_icon_source);
    67   p_icon_factory->add(Gtk::StockID("gd-editnode"), editnode_icon_set);
    66   p_icon_factory->add(Gtk::StockID("gd-editnode"), editnode_icon_set);
    68 
    67 
    69   std::vector<std::string> newmap_icon_path(icon_path);
       
    70   newmap_icon_path.push_back("newmap.png");
       
    71   Gtk::IconSource newmap_icon_source;
    68   Gtk::IconSource newmap_icon_source;
    72   newmap_icon_source.set_filename(Glib::build_filename(newmap_icon_path));
    69   newmap_icon_source.set_pixbuf(p_newmap_pixbuf);
    73   Gtk::IconSet newmap_icon_set;
    70   Gtk::IconSet newmap_icon_set;
    74   newmap_icon_set.add_source(newmap_icon_source);
    71   newmap_icon_set.add_source(newmap_icon_source);
    75   p_icon_factory->add(Gtk::StockID("gd-newmap"), newmap_icon_set);
    72   p_icon_factory->add(Gtk::StockID("gd-newmap"), newmap_icon_set);
    76 
    73 
    77   p_icon_factory->add_default();
    74   p_icon_factory->add_default();