Added two new classes.
authorladanyi
Wed, 25 Oct 2006 17:50:02 +0000
changeset 1738339178ae43d
parent 172 fc1e478697d3
child 174 95872af46fc4
Added two new classes.
Makefile.am
file_chooser_extra_widget.cc
file_chooser_extra_widget.h
map_window.cc
map_window.h
mapstorage.h
nbtab.cc
     1.1 --- a/Makefile.am	Wed Oct 25 13:21:24 2006 +0000
     1.2 +++ b/Makefile.am	Wed Oct 25 17:50:02 2006 +0000
     1.3 @@ -46,7 +46,11 @@
     1.4  	design_win.h \
     1.5  	design_win.cc \
     1.6  	dijkstrabox.h \
     1.7 -	dijkstrabox.cc
     1.8 +	dijkstrabox.cc \
     1.9 +	file_chooser_extra_widget.h \
    1.10 +	file_chooser_extra_widget.cc \
    1.11 +	map_window.h \
    1.12 +	map_window.cc
    1.13  
    1.14  glemon_CXXFLAGS = $(GTK_CFLAGS) $(LEMON_CFLAGS)
    1.15  # glemon_LDFLAGS = $(GTK_LIBS) $(LEMON_LIBS)
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/file_chooser_extra_widget.cc	Wed Oct 25 17:50:02 2006 +0000
     2.3 @@ -0,0 +1,46 @@
     2.4 +#include "file_chooser_extra_widget.h"
     2.5 +#include "mapstorage.h"
     2.6 +
     2.7 +FileChooserExtraWidget::FileChooserExtraWidget(MapStorage* ms) :
     2.8 +  Gtk::Expander("_Options", true),
     2.9 +  lblGUIData("Save GUI specific data to:"),
    2.10 +  rbGUISection("_GUI section", true),
    2.11 +  rbConfFile("s_eparate .conf file", true)
    2.12 +{
    2.13 +  std::cout << "FileChooserExtraWidget()" << std::endl;
    2.14 +
    2.15 +  Gtk::RadioButtonGroup group = rbGUISection.get_group();
    2.16 +  rbConfFile.set_group(group);
    2.17 +
    2.18 +  /*
    2.19 +  switch (pMapStorage->getGUIDataSaveLocation())
    2.20 +  {
    2.21 +    case GUI_SECTION:
    2.22 +      break;
    2.23 +    case CONF_FILE:
    2.24 +      break;
    2.25 +  }
    2.26 +  */
    2.27 +
    2.28 +  add(box);
    2.29 +  box.pack_start(lblGUIData, Gtk::PACK_SHRINK);
    2.30 +  box.pack_start(rbGUISection, Gtk::PACK_SHRINK);
    2.31 +  box.pack_start(rbConfFile, Gtk::PACK_SHRINK);
    2.32 +
    2.33 +  rbConfFile.signal_group_changed().connect(
    2.34 +      sigc::mem_fun(*this, &FileChooserExtraWidget::onRbToggled));
    2.35 +  rbGUISection.signal_group_changed().connect(
    2.36 +      sigc::mem_fun(*this, &FileChooserExtraWidget::onRbToggled));
    2.37 +
    2.38 +  show_all_children();
    2.39 +}
    2.40 +
    2.41 +void FileChooserExtraWidget::onRbToggled()
    2.42 +{
    2.43 +  std::cout << "onRbToggled()" << std::endl;
    2.44 +}
    2.45 +
    2.46 +FileChooserExtraWidget::~FileChooserExtraWidget()
    2.47 +{
    2.48 +  std::cout << "~FileChooserExtraWidget()" << std::endl;
    2.49 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/file_chooser_extra_widget.h	Wed Oct 25 17:50:02 2006 +0000
     3.3 @@ -0,0 +1,25 @@
     3.4 +#ifndef FILE_CHOOSER_EXTRA_WIDGET
     3.5 +#define FILE_CHOOSER_EXTRA_WIDGET
     3.6 +
     3.7 +#include <gtkmm/expander.h>
     3.8 +#include <gtkmm/box.h>
     3.9 +#include <gtkmm/radiobutton.h>
    3.10 +#include <gtkmm/label.h>
    3.11 +
    3.12 +class MapStorage;
    3.13 +
    3.14 +class FileChooserExtraWidget : public Gtk::Expander
    3.15 +{
    3.16 +  private:
    3.17 +    Gtk::VBox box;
    3.18 +    Gtk::Label lblGUIData;
    3.19 +    Gtk::RadioButton rbGUISection;
    3.20 +    Gtk::RadioButton rbConfFile;
    3.21 +    MapStorage* pMapStorage;
    3.22 +    void onRbToggled();
    3.23 +  public:
    3.24 +    FileChooserExtraWidget(MapStorage* ms);
    3.25 +    ~FileChooserExtraWidget();
    3.26 +};
    3.27 +
    3.28 +#endif
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/map_window.cc	Wed Oct 25 17:50:02 2006 +0000
     4.3 @@ -0,0 +1,24 @@
     4.4 +#include "map_window.h"
     4.5 +
     4.6 +MapWindow::MapWindow()
     4.7 +{
     4.8 +  refMapStore = Gtk::ListStore::create(mapColumns);
     4.9 +  //refMapStore->signal_row_changed().connect(sigc::mem_fun(*this, &Phy sicalProperties::onChannelChanged));
    4.10 +  twMap.set_model(refMapStore);
    4.11 +  twMap.append_column_editable("Name", mapColumns.colName);
    4.12 +  //twMap.append_column_editable("Value type", mapColumns.colValue);
    4.13 +  //twMap.append_column_editable("Map type", mapColumns.colType);
    4.14 +
    4.15 +  swMap.set_size_request(-1, 300);
    4.16 +  swMap.add(twMap);
    4.17 +  swMap.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    4.18 +
    4.19 +  swMap.add(twMap);
    4.20 +  add(swMap);
    4.21 +
    4.22 +  show_all_children();
    4.23 +}
    4.24 +
    4.25 +MapWindow::~MapWindow()
    4.26 +{
    4.27 +}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/map_window.h	Wed Oct 25 17:50:02 2006 +0000
     5.3 @@ -0,0 +1,34 @@
     5.4 +#ifndef MAP_WINDOW
     5.5 +#define MAP_WINDOW
     5.6 +
     5.7 +#include <gtkmm/window.h>
     5.8 +#include <gtkmm/liststore.h>
     5.9 +#include <gtkmm/treeview.h>
    5.10 +#include <gtkmm/scrolledwindow.h>
    5.11 +#include "mapstorage.h"
    5.12 +
    5.13 +class MapWindow : public Gtk::Window
    5.14 +{
    5.15 +  struct MapModelColumns : public Gtk::TreeModel::ColumnRecord
    5.16 +  {
    5.17 +    MapModelColumns()
    5.18 +    {
    5.19 +      add(colName);
    5.20 +      add(colValue);
    5.21 +      add(colType);
    5.22 +    }
    5.23 +    Gtk::TreeModelColumn<Glib::ustring> colName;
    5.24 +    Gtk::TreeModelColumn<MapStorage::value> colValue;
    5.25 +    Gtk::TreeModelColumn<MapStorage::type> colType;
    5.26 +  };
    5.27 +  private:
    5.28 +    MapModelColumns mapColumns;
    5.29 +    Glib::RefPtr<Gtk::ListStore> refMapStore;
    5.30 +    Gtk::TreeView twMap;
    5.31 +    Gtk::ScrolledWindow swMap;
    5.32 +  public:
    5.33 +    MapWindow();
    5.34 +    ~MapWindow();
    5.35 +};
    5.36 +
    5.37 +#endif
     6.1 --- a/mapstorage.h	Wed Oct 25 13:21:24 2006 +0000
     6.2 +++ b/mapstorage.h	Wed Oct 25 17:50:02 2006 +0000
     6.3 @@ -23,6 +23,8 @@
     6.4  class MapStorage
     6.5  {
     6.6  public:
     6.7 +  enum value {DOUBLE, STRING};
     6.8 +  enum type {NORMAL, GUI};
     6.9  
    6.10    ///The graph for which the datas are stored.
    6.11    Graph graph;
     7.1 --- a/nbtab.cc	Wed Oct 25 13:21:24 2006 +0000
     7.2 +++ b/nbtab.cc	Wed Oct 25 17:50:02 2006 +0000
     7.3 @@ -1,4 +1,5 @@
     7.4  #include <nbtab.h>
     7.5 +#include "file_chooser_extra_widget.h"
     7.6  
     7.7  NoteBookTab::NoteBookTab():mapwinexists(false), designwinexists(false)
     7.8  {
     7.9 @@ -117,6 +118,8 @@
    7.10    Gtk::FileChooserDialog fcdialog("Save File", Gtk::FILE_CHOOSER_ACTION_SAVE);
    7.11    fcdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    7.12    fcdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
    7.13 +  FileChooserExtraWidget w(&mapstorage);
    7.14 +  fcdialog.set_extra_widget(w);
    7.15    if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
    7.16    {
    7.17      Glib::ustring filename = fcdialog.get_filename();