"Fossies" - the Fresh Open Source Software Archive

Member "rawtherapee-5.7/rtgui/toolpanel.cc" (10 Sep 2019, 4613 Bytes) of package /linux/misc/rawtherapee-5.7.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "toolpanel.cc" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 5.6_vs_5.7.

    1 /*
    2  *  This file is part of RawTherapee.
    3  *
    4  *  Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
    5  *
    6  *  RawTherapee is free software: you can redistribute it and/or modify
    7  *  it under the terms of the GNU General Public License as published by
    8  *  the Free Software Foundation, either version 3 of the License, or
    9  *  (at your option) any later version.
   10  *
   11  *  RawTherapee is distributed in the hope that it will be useful,
   12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14  *  GNU General Public License for more details.
   15  *
   16  *  You should have received a copy of the GNU General Public License
   17  *  along with RawTherapee.  If not, see <https://www.gnu.org/licenses/>.
   18  */
   19 #include "toolpanel.h"
   20 #include "toolpanelcoord.h"
   21 #include "guiutils.h"
   22 
   23 #include "../rtengine/procparams.h"
   24 
   25 using namespace rtengine::procparams;
   26 
   27 
   28 ToolVBox::ToolVBox() {
   29 //GTK318
   30 #if GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 20
   31     set_spacing(1);       // Vertical space between tools
   32     set_border_width(3);  // Space separating the tab's frame and the tools
   33 #endif
   34 //GTK318
   35 }
   36 
   37 ToolParamBlock::ToolParamBlock() {
   38 //GTK318
   39 #if GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 20
   40     set_spacing(2);       // Vertical space between parameters in a single tool
   41     set_border_width(5);  // Space separating the parameters of a tool and its surrounding frame
   42 #endif
   43 //GTK318
   44 }
   45 
   46 FoldableToolPanel::FoldableToolPanel(Gtk::Box* content, Glib::ustring toolName, Glib::ustring UILabel, bool need11, bool useEnabled) : ToolPanel(toolName, need11), parentContainer(nullptr), exp(nullptr), lastEnabled(true)
   47 {
   48     if (!content) {
   49         return;
   50     }
   51 
   52 //  exp->set_use_markup (true);
   53     if (need11) {
   54         Gtk::HBox *titleHBox = Gtk::manage(new Gtk::HBox());
   55 
   56         Gtk::Label *label = Gtk::manage(new Gtk::Label());
   57         label->set_markup(Glib::ustring("<b>") + escapeHtmlChars(UILabel) + Glib::ustring("</b>"));
   58         label->set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
   59         titleHBox->pack_start(*label, Gtk::PACK_EXPAND_WIDGET, 0);
   60 
   61         RTImage *image = Gtk::manage (new RTImage("one-to-one-small.png"));
   62         image->set_tooltip_text(M("TP_GENERAL_11SCALE_TOOLTIP"));
   63         titleHBox->pack_end(*image, Gtk::PACK_SHRINK, 0);
   64 
   65         exp = Gtk::manage (new MyExpander (useEnabled, titleHBox));
   66     } else {
   67         exp = Gtk::manage (new MyExpander (useEnabled, UILabel));
   68     }
   69 
   70     exp->signal_button_release_event().connect_notify( sigc::mem_fun(this, &FoldableToolPanel::foldThemAll) );
   71     enaConn = signal_enabled_toggled().connect( sigc::mem_fun(*this, &FoldableToolPanel::enabled_toggled) );
   72 
   73     exp->add (*content);
   74     exp->show ();
   75 }
   76 
   77 void FoldableToolPanel::foldThemAll (GdkEventButton* event)
   78 {
   79     if (event->button == 3) {
   80         if (listener) {
   81             (static_cast<ToolPanelCoordinator*>(listener))->foldAllButOne( parentContainer, this);
   82         } else {
   83             (static_cast<ToolPanelCoordinator*>(tmp))->foldAllButOne( parentContainer, this);
   84         }
   85     }
   86 }
   87 
   88 void FoldableToolPanel::enabled_toggled()
   89 {
   90     if (multiImage) {
   91         if (exp->get_inconsistent()) {
   92             exp->set_inconsistent (false);
   93             enaConn.block (true);
   94             exp->setEnabled (false);
   95             enaConn.block (false);
   96         } else if (lastEnabled) {
   97             exp->set_inconsistent (true);
   98         }
   99 
  100         lastEnabled = exp->getEnabled();
  101     }
  102 
  103     enabledChanged();
  104 }
  105 
  106 bool FoldableToolPanel::get_inconsistent()
  107 {
  108     return exp->get_inconsistent();
  109 }
  110 
  111 void FoldableToolPanel::set_inconsistent(bool isInconsistent)
  112 {
  113     exp->set_inconsistent(isInconsistent);
  114 }
  115 
  116 void FoldableToolPanel::setLevel (int level)
  117 {
  118     if (exp) {
  119         exp->setLevel(level);
  120     }
  121 }
  122 
  123 bool FoldableToolPanel::getEnabled()
  124 {
  125     return exp->getEnabled();
  126 }
  127 
  128 // do not emit the enabled_toggled event
  129 void FoldableToolPanel::setEnabled(bool isEnabled)
  130 {
  131     enaConn.block (true);
  132     exp->setEnabled(isEnabled);
  133     lastEnabled = isEnabled;
  134     enaConn.block (false);
  135 }
  136 
  137 void FoldableToolPanel::setEnabledTooltipMarkup(Glib::ustring tooltipMarkup)
  138 {
  139     if (exp) {
  140         exp->set_tooltip_markup(tooltipMarkup);
  141     }
  142 }
  143 
  144 void FoldableToolPanel::setEnabledTooltipText(Glib::ustring tooltipText)
  145 {
  146     if (exp) {
  147         exp->set_tooltip_text(tooltipText);
  148     }
  149 }
  150 
  151 void FoldableToolPanel::setGrayedOut(bool doGrayOut)
  152 {
  153     if (doGrayOut) {
  154         exp->setEnabled(false);
  155         exp->set_expanded(false);
  156         exp->set_sensitive(false);
  157     } else {
  158         exp->set_sensitive(true);
  159     }
  160 }
  161