Changeset 184:4e8704aae278 in glemon-0.x
- Timestamp:
- 01/10/07 15:37:46 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/glemon/trunk@3125
- Files:
-
- 2 added
- 2 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile.am
r173 r184 50 50 file_chooser_extra_widget.h \ 51 51 file_chooser_extra_widget.cc \ 52 map_window.h \53 map_window.cc52 background_chooser_dialog.h \ 53 background_chooser_dialog.cc 54 54 55 55 glemon_CXXFLAGS = $(GTK_CFLAGS) $(LEMON_CFLAGS) -
graph_displayer_canvas.cc
r180 r184 26 26 isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""), 27 27 edgemap_to_edit(""), autoscale(true), zoomtrack(false), radius_size(20), edge_width(10), 28 was_redesigned(false), is_drawn(false), mytab(mainw) 28 was_redesigned(false), is_drawn(false), mytab(mainw), 29 background_set(false) 29 30 { 30 31 //base event handler is move tool … … 35 36 active_edge=INVALID; 36 37 forming_edge=INVALID; 38 39 setBackground(); 40 } 41 42 void GraphDisplayerCanvas::setBackground() 43 { 44 if (background_set) 45 { 46 delete background; 47 } 48 if (mytab.mapstorage.isBackgroundSet()) 49 { 50 background_set = true; 51 refBackground = Gdk::Pixbuf::create_from_file( 52 mytab.mapstorage.getBackgroundFilename()); 53 background = new Gnome::Canvas::Pixbuf( 54 *(root()), 55 0.0 - refBackground->get_width() / 2.0, 56 0.0 - refBackground->get_height() / 2.0, 57 refBackground); 58 background->lower_to_bottom(); 59 } 60 else 61 { 62 background_set = false; 63 } 37 64 } 38 65 -
graph_displayer_canvas.h
r179 r184 442 442 443 443 XY calcArrowPos(XY, XY, XY, XY, int); 444 445 bool background_set; 446 Glib::RefPtr<Gdk::Pixbuf> refBackground; 447 Gnome::Canvas::Pixbuf *background; 448 public: 449 void setBackground(); 444 450 }; 445 451 -
main_win.cc
r174 r184 23 23 #include "main_win.h" 24 24 #include "guipixbufs.h" 25 #include "background_chooser_dialog.h" 25 26 26 27 #include "i18n.h" … … 114 115 ag->add( Gtk::Action::create("ViewZoom100", Gtk::Stock::ZOOM_100), 115 116 sigc::mem_fun(*this, &MainWin::zoom100)); 117 ag->add( Gtk::Action::create("SetBackground", _("Set Background...")), 118 sigc::mem_fun(*this, &MainWin::createBackgroundChooser)); 116 119 117 120 ag->add( Gtk::Action::create("ShowMenu", _("_Show")) ); … … 174 177 " <menuitem action='ViewZoom100' />" 175 178 " <menuitem action='ViewZoomFit' />" 179 " <menuitem action='SetBackground' />" 176 180 " </menu>" 177 181 " <menu action='ShowMenu'>" … … 581 585 tabs[active_tab]->reDesignGraph(); 582 586 } 587 588 void MainWin::createBackgroundChooser() 589 { 590 BackgroundChooserDialog dialog(&(tabs[active_tab]->mapstorage)); 591 dialog.run(); 592 } -
main_win.h
r174 r184 262 262 263 263 virtual void reDesignGraph(); 264 265 void createBackgroundChooser(); 264 266 }; 265 267 -
mapstorage.cc
r177 r184 18 18 19 19 #include "mapstorage.h" 20 #include "nbtab.h" 20 21 #include "gui_writer.h" 21 22 #include "gui_reader.h" … … 28 29 const double p_d=40000; 29 30 30 MapStorage::MapStorage( ) : modified(false), file_name(""), arrow_pos_read_ok(false), iterations(i_d), attraction(a_d), propulsation(p_d)31 MapStorage::MapStorage(NoteBookTab& tab) : mytab(tab), modified(false), file_name(""), arrow_pos_read_ok(false), iterations(i_d), attraction(a_d), propulsation(p_d), background_set(false) 31 32 { 32 33 nodemap_storage["coordinates_x"] = new Graph::NodeMap<double>(graph); … … 553 554 signal_design_win.emit(attraction, propulsation, iterations); 554 555 } 556 557 void MapStorage::setBackground(const std::string& file_name) 558 { 559 if (file_name == background_file_name) return; 560 if (file_name == "") 561 { 562 background_file_name = ""; 563 background_set = false; 564 } 565 else 566 { 567 background_file_name = file_name; 568 background_set = true; 569 } 570 mytab.gd_canvas->setBackground(); 571 } 572 573 const std::string& MapStorage::getBackgroundFilename() 574 { 575 return background_file_name; 576 } 577 578 bool MapStorage::isBackgroundSet() 579 { 580 return background_set; 581 } 582 583 double MapStorage::getBackgroundScaling() 584 { 585 return background_scaling; 586 } 587 588 void MapStorage::setBackgroundScaling(double scaling) 589 { 590 background_scaling = scaling; 591 } -
mapstorage.h
r177 r184 25 25 #include "xymap.h" 26 26 #include <libgnomecanvasmm.h> 27 28 class NoteBookTab; 27 29 28 30 ///class MapStorage handles NodeMaps and EdgeMaps. … … 39 41 class MapStorage 40 42 { 43 private: 44 std::string background_file_name; 45 bool background_set; 46 double background_scaling; 47 NoteBookTab& mytab; 41 48 public: 42 enum value {DOUBLE, STRING}; 43 enum type {NORMAL, GUI}; 44 49 void setBackground(const std::string& file_name); 50 const std::string& getBackgroundFilename(); 51 bool isBackgroundSet(); 52 double getBackgroundScaling(); 53 void setBackgroundScaling(double scaling); 45 54 ///The graph for which the datas are stored. 46 55 Graph graph; … … 123 132 ///Its all activity is initializing default values 124 133 ///for different visualization attributes. 125 MapStorage( );134 MapStorage(NoteBookTab& tab); 126 135 127 136 ///Destructor of MapStorage -
nbtab.cc
r177 r184 20 20 #include "file_chooser_extra_widget.h" 21 21 22 NoteBookTab::NoteBookTab():mapwinexists(false), designwinexists(false) 22 NoteBookTab::NoteBookTab():mapwinexists(false), designwinexists(false), mapstorage(*this) 23 23 { 24 24 Gtk::ScrolledWindow *pScrolledWindow = manage(new Gtk::ScrolledWindow);
Note: See TracChangeset
for help on using the changeset viewer.