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

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

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

revision 2903 by schoenebeck, Tue May 3 14:08:34 2016 UTC revision 2928 by schoenebeck, Fri Jul 1 14:09:25 2016 UTC
# Line 41  static Glib::RefPtr<Gdk::Pixbuf> createI Line 41  static Glib::RefPtr<Gdk::Pixbuf> createI
41      int w = 0;      int w = 0;
42      int h = 0; // ignored      int h = 0; // ignored
43      Gtk::IconSize::lookup(Gtk::ICON_SIZE_SMALL_TOOLBAR, w, h);      Gtk::IconSize::lookup(Gtk::ICON_SIZE_SMALL_TOOLBAR, w, h);
44        if (!theme->has_icon(name))
45            return Glib::RefPtr<Gdk::Pixbuf>();
46      Glib::RefPtr<Gdk::Pixbuf> pixbuf = theme->load_icon(name, w, Gtk::ICON_LOOKUP_GENERIC_FALLBACK);      Glib::RefPtr<Gdk::Pixbuf> pixbuf = theme->load_icon(name, w, Gtk::ICON_LOOKUP_GENERIC_FALLBACK);
47      if (pixbuf->get_height() != targetH) {      if (pixbuf->get_height() != targetH) {
48          pixbuf = pixbuf->scale_simple(targetH, targetH, Gdk::INTERP_BILINEAR);          pixbuf = pixbuf->scale_simple(targetH, targetH, Gdk::INTERP_BILINEAR);
# Line 48  static Glib::RefPtr<Gdk::Pixbuf> createI Line 50  static Glib::RefPtr<Gdk::Pixbuf> createI
50      return pixbuf;      return pixbuf;
51  }  }
52    
53    static Glib::RefPtr<Gdk::Pixbuf> createIcon(std::vector<std::string> alternativeNames, const Glib::RefPtr<Gdk::Screen>& screen) {
54        for (int i = 0; i < alternativeNames.size(); ++i) {
55            Glib::RefPtr<Gdk::Pixbuf> buf = createIcon(alternativeNames[i], screen);
56            if (buf) return buf;
57        }
58        return Glib::RefPtr<Gdk::Pixbuf>();
59    }
60    
61  ScriptEditor::ScriptEditor() :  ScriptEditor::ScriptEditor() :
62      m_statusLabel("",  Gtk::ALIGN_START),      m_statusLabel("",  Gtk::ALIGN_START),
63      m_applyButton(_("_Apply"), true),      m_applyButton(_("_Apply"), true),
# Line 58  ScriptEditor::ScriptEditor() : Line 68  ScriptEditor::ScriptEditor() :
68      m_vm = NULL;      m_vm = NULL;
69  #endif  #endif
70    
71      m_errorIcon = createIcon("dialog-error", get_screen());      // depending on GTK version and installed themes, there may be different
72      m_warningIcon = createIcon("dialog-warning-symbolic", get_screen());      // icons, and different names for them, so for each type of icon we use,
73      m_successIcon = createIcon("emblem-default", get_screen());      // we provide a list of possible icon names, the first one found to be
74        // installed on the local system from the list will be used and loaded for
75        // the respective purpose (so order matters in those lists)
76        //
77        // (see https://developer.gnome.org/gtkmm/stable/namespaceGtk_1_1Stock.html for
78        // available icon names)
79        std::vector<std::string> errorIconNames;
80        errorIconNames.push_back("dialog-error");
81        errorIconNames.push_back("media-record");
82        errorIconNames.push_back("process-stop");
83    
84        std::vector<std::string> warningIconNames;
85        warningIconNames.push_back("dialog-warning-symbolic");
86        warningIconNames.push_back("dialog-warning");
87    
88        std::vector<std::string> successIconNames;
89        successIconNames.push_back("emblem-default");
90        successIconNames.push_back("tools-check-spelling");
91    
92        m_errorIcon = createIcon(errorIconNames, get_screen());
93        m_warningIcon = createIcon(warningIconNames, get_screen());
94        m_successIcon = createIcon(successIconNames, get_screen());
95    
96      add(m_vbox);      add(m_vbox);
97    

Legend:
Removed from v.2903  
changed lines
  Added in v.2928

  ViewVC Help
Powered by ViewVC