/[svn]/gigedit/trunk/src/gigedit/dimensionmanager.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/dimensionmanager.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3225 by schoenebeck, Fri May 26 22:10:16 2017 UTC revision 3364 by schoenebeck, Tue Nov 14 18:07:25 2017 UTC
# Line 17  Line 17 
17   * 02110-1301 USA.   * 02110-1301 USA.
18   */   */
19    
20  #include <glibmmconfig.h>  #include "compat.h"
21  // threads.h must be included first to be able to build with  // threads.h must be included first to be able to build with
22  // G_DISABLE_DEPRECATED  // G_DISABLE_DEPRECATED
23  #if (GLIBMM_MAJOR_VERSION == 2 && GLIBMM_MINOR_VERSION == 31 && GLIBMM_MICRO_VERSION >= 2) || \  #if (GLIBMM_MAJOR_VERSION == 2 && GLIBMM_MINOR_VERSION == 31 && GLIBMM_MICRO_VERSION >= 2) || \
# Line 27  Line 27 
27    
28  #include "dimensionmanager.h"  #include "dimensionmanager.h"
29    
30  #include <gtkmm/stock.h>  #if HAS_GTKMM_STOCK
31    # include <gtkmm/stock.h>
32    #endif
33  #include <gtkmm/messagedialog.h>  #include <gtkmm/messagedialog.h>
34  #include <gtkmm/dialog.h>  #include <gtkmm/dialog.h>
35  #include <gtkmm/comboboxtext.h>  #include <gtkmm/comboboxtext.h>
36  #include <gtkmm/spinbutton.h>  #include <gtkmm/spinbutton.h>
37  #include <gtkmm/table.h>  #include <gtkmm/label.h>
38    #if USE_GTKMM_GRID
39    # include <gtkmm/grid.h>
40    #else
41    # include <gtkmm/table.h>
42    #endif
43    
44  #include "global.h"  #include "global.h"
45  #include "compat.h"  #include "compat.h"
# Line 244  void IntSetCellRenderer::valueChanged() Line 251  void IntSetCellRenderer::valueChanged()
251  }  }
252    
253  DimensionManager::DimensionManager() :  DimensionManager::DimensionManager() :
254    #if HAS_GTKMM_STOCK
255      addButton(Gtk::Stock::ADD), removeButton(Gtk::Stock::REMOVE),      addButton(Gtk::Stock::ADD), removeButton(Gtk::Stock::REMOVE),
256    #else
257        addButton(_("_Add"), true), removeButton(_("_Remove"), true),
258    #endif
259      allRegionsCheckBox(_("All Regions"))      allRegionsCheckBox(_("All Regions"))
260  {  {
261      ignoreColumnClicked = true;      ignoreColumnClicked = true;
# Line 254  DimensionManager::DimensionManager() : Line 265  DimensionManager::DimensionManager() :
265          set_position(Gtk::WIN_POS_MOUSE);          set_position(Gtk::WIN_POS_MOUSE);
266      }      }
267    
268    #if !HAS_GTKMM_STOCK
269        // see : https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
270        addButton.set_icon_name("list-add");
271        removeButton.set_icon_name("list-remove");
272    #endif
273    
274      set_title(_("Dimensions of selected Region"));      set_title(_("Dimensions of selected Region"));
275      add(vbox);      add(vbox);
276      scrolledWindow.add(treeView);      scrolledWindow.add(treeView);
# Line 261  DimensionManager::DimensionManager() : Line 278  DimensionManager::DimensionManager() :
278      scrolledWindow.show();      scrolledWindow.show();
279      vbox.pack_start(buttonBox, Gtk::PACK_SHRINK);      vbox.pack_start(buttonBox, Gtk::PACK_SHRINK);
280      buttonBox.set_layout(Gtk::BUTTONBOX_END);      buttonBox.set_layout(Gtk::BUTTONBOX_END);
281    #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22)
282        buttonBox.set_margin(5);
283    #else
284      buttonBox.set_border_width(5);      buttonBox.set_border_width(5);
285    #endif
286      buttonBox.show();      buttonBox.show();
287      buttonBox.pack_start(allRegionsCheckBox, Gtk::PACK_EXPAND_PADDING);      buttonBox.pack_start(allRegionsCheckBox, Gtk::PACK_EXPAND_PADDING);
288      buttonBox.pack_start(addButton, Gtk::PACK_SHRINK);      buttonBox.pack_start(addButton, Gtk::PACK_SHRINK);
# Line 301  DimensionManager::DimensionManager() : Line 322  DimensionManager::DimensionManager() :
322          sigc::mem_fun(*this, &DimensionManager::onAllRegionsCheckBoxToggled)          sigc::mem_fun(*this, &DimensionManager::onAllRegionsCheckBoxToggled)
323      );      );
324    
325    #if HAS_GTKMM_SHOW_ALL_CHILDREN
326      show_all_children();      show_all_children();
327    #endif
328  }  }
329    
330  bool DimensionManager::allRegions() const {  bool DimensionManager::allRegions() const {
# Line 440  void DimensionManager::onColumnClicked() Line 463  void DimensionManager::onColumnClicked()
463                  count++;                  count++;
464              }              }
465          }          }
466    #if USE_GTKMM_GRID
467            Gtk::Grid table;
468    #else
469          Gtk::Table table(1, 2);          Gtk::Table table(1, 2);
470    #endif
471          Gtk::Label labelDimType(_("Dimension:"), Gtk::ALIGN_START);          Gtk::Label labelDimType(_("Dimension:"), Gtk::ALIGN_START);
472          Gtk::ComboBox comboDimType;          Gtk::ComboBox comboDimType;
473          comboDimType.set_model(refComboModel);          comboDimType.set_model(refComboModel);
# Line 448  void DimensionManager::onColumnClicked() Line 475  void DimensionManager::onColumnClicked()
475          comboDimType.pack_start(comboModel.m_type_name);          comboDimType.pack_start(comboModel.m_type_name);
476          table.attach(labelDimType, 0, 1, 0, 1);          table.attach(labelDimType, 0, 1, 0, 1);
477          table.attach(comboDimType, 1, 2, 0, 1);          table.attach(comboDimType, 1, 2, 0, 1);
478    #if USE_GTKMM_BOX
479            dialog.get_content_area()->pack_start(table);
480    #else
481          dialog.get_vbox()->pack_start(table);          dialog.get_vbox()->pack_start(table);
482    #endif
483    
484    #if HAS_GTKMM_STOCK
485          dialog.add_button(Gtk::Stock::OK, 0);          dialog.add_button(Gtk::Stock::OK, 0);
486          dialog.add_button(Gtk::Stock::CANCEL, 1);          dialog.add_button(Gtk::Stock::CANCEL, 1);
487    #else
488            dialog.add_button(_("_OK"), 0);
489            dialog.add_button(_("_Cancel"), 1);
490    #endif
491    #if HAS_GTKMM_SHOW_ALL_CHILDREN
492          dialog.show_all_children();          dialog.show_all_children();
493    #endif
494                    
495          comboDimType.set_active(oldTypeIndex);          comboDimType.set_active(oldTypeIndex);
496    
# Line 544  void DimensionManager::addDimension() { Line 582  void DimensionManager::addDimension() {
582              row[comboModel.m_type_name] = sType;              row[comboModel.m_type_name] = sType;
583          }          }
584      }      }
585    #if USE_GTKMM_GRID
586        Gtk::Grid table;
587    #else
588      Gtk::Table table(2, 2);      Gtk::Table table(2, 2);
589    #endif
590      Gtk::Label labelDimType(_("Dimension:"), Gtk::ALIGN_START);      Gtk::Label labelDimType(_("Dimension:"), Gtk::ALIGN_START);
591      Gtk::ComboBox comboDimType;      Gtk::ComboBox comboDimType;
592      comboDimType.set_model(refComboModel);      comboDimType.set_model(refComboModel);
593      comboDimType.pack_start(comboModel.m_type_id);      comboDimType.pack_start(comboModel.m_type_id);
594      comboDimType.pack_start(comboModel.m_type_name);      comboDimType.pack_start(comboModel.m_type_name);
595      Gtk::Label labelZones(_("Zones:"), Gtk::ALIGN_START);      Gtk::Label labelZones(_("Zones:"), Gtk::ALIGN_START);
596    #if USE_GTKMM_GRID
597        table.attach(labelDimType, 0, 0);
598        table.attach(comboDimType, 1, 0);
599        table.attach(labelZones, 0, 1);
600    #else
601      table.attach(labelDimType, 0, 1, 0, 1);      table.attach(labelDimType, 0, 1, 0, 1);
602      table.attach(comboDimType, 1, 2, 0, 1);      table.attach(comboDimType, 1, 2, 0, 1);
603      table.attach(labelZones, 0, 1, 1, 2);      table.attach(labelZones, 0, 1, 1, 2);
604    #endif
605    
606    #if USE_GTKMM_BOX
607        dialog.get_content_area()->pack_start(table);
608    #else
609      dialog.get_vbox()->pack_start(table);      dialog.get_vbox()->pack_start(table);
610    #endif
611    
612      // number of zones: use a combo box with fix values for gig      // number of zones: use a combo box with fix values for gig
613      // v2 and a spin button for v3      // v2 and a spin button for v3
# Line 584  void DimensionManager::addDimension() { Line 637  void DimensionManager::addDimension() {
637          table.attach(spinZones, 1, 2, 1, 2);          table.attach(spinZones, 1, 2, 1, 2);
638      }      }
639    
640    #if HAS_GTKMM_STOCK
641      dialog.add_button(Gtk::Stock::OK, 0);      dialog.add_button(Gtk::Stock::OK, 0);
642      dialog.add_button(Gtk::Stock::CANCEL, 1);      dialog.add_button(Gtk::Stock::CANCEL, 1);
643    #else
644        dialog.add_button(_("_OK"), 0);
645        dialog.add_button(_("_Cancel"), 1);
646    #endif
647    #if HAS_GTKMM_SHOW_ALL_CHILDREN
648      dialog.show_all_children();      dialog.show_all_children();
649    #endif
650    
651      if (!dialog.run()) { // OK selected ...      if (!dialog.run()) { // OK selected ...
652          Gtk::TreeModel::iterator iterType = comboDimType.get_active();          Gtk::TreeModel::iterator iterType = comboDimType.get_active();

Legend:
Removed from v.3225  
changed lines
  Added in v.3364

  ViewVC Help
Powered by ViewVC