summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2016-07-24 15:05:29 +0000
committerjabiertxof <info@marker.es>2016-07-24 15:05:29 +0000
commit06caba8f2caeb07011e492d7218f0b8f6b28e801 (patch)
tree2b81440d4cd726919a6226d8036156eb55c206bb
parentOrder and cleanup of some LPE (diff)
downloadinkscape-06caba8f2caeb07011e492d7218f0b8f6b28e801.tar.gz
inkscape-06caba8f2caeb07011e492d7218f0b8f6b28e801.zip
Fises to toggle button and coding style
(bzr r15021)
-rw-r--r--share/icons/icons.svg2
-rw-r--r--share/icons/symbolic_icons.svg2
-rw-r--r--src/live_effects/parameter/togglebutton.cpp70
-rw-r--r--src/live_effects/parameter/togglebutton.h8
-rw-r--r--src/ui/widget/registered-widget.cpp6
-rw-r--r--src/ui/widget/registered-widget.h3
6 files changed, 46 insertions, 45 deletions
diff --git a/share/icons/icons.svg b/share/icons/icons.svg
index 8323795bc..4a65cd3f1 100644
--- a/share/icons/icons.svg
+++ b/share/icons/icons.svg
@@ -4090,7 +4090,7 @@ http://www.inkscape.org/</dc:description>
<rect y="-639.9971" x="730.8575" height="1.022964" width="1.022542" id="rect6954" style="color:#000000;fill:#6464ff;fill-opacity:0.3921569;fill-rule:evenodd;stroke:#6464ff;stroke-width:0.2557612;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:0" transform="rotate(44.40522)" />
</g>
<g id="on" transform="translate(658.5112,-35.5352)">
-<ellipse style="color:#000000;fill:url(#linearGradient33206);fill-rule:evenodd;stroke:url(#linearGradient33208);stroke-linejoin:round" id="ellipse10646" cx="18.48884" cy="207.5353" rx="6.611154" ry="6.515604" transform="translate(-1.031494e-7,-4.35791e-5)" />
+<ellipse style="color:#000000;fill:url(#linearGradient33206);fill-rule:evenodd;stroke:url(#linearGradient33208);stroke-linejoin:round" id="ellipse10646" cx="18.48884" cy="207.5353" rx="6.611154" ry="6.515604" />
<path sodipodi:nodetypes="ccc" inkscape:connector-curvature="0" id="path10653" d="M 15.35239,207.5955 17.38434,209.4915 21.62529,205.579" style="color:#000000;fill:none;stroke:url(#linearGradient33214)" />
<ellipse transform="matrix(0.8723531,0,0,0.8723531,2.360043,26.49119)" ry="6.515604" rx="6.611154" cy="207.5353" cx="18.48884" id="ellipse10289" style="color:#000000;fill:none;stroke:url(#linearGradient33204);stroke-linejoin:round" />
<rect style="color:#000000;fill:none;stroke-width:0.531496" id="rect9056-1" width="15.99999" height="15.99999" x="10.48884" y="199.5352" />
diff --git a/share/icons/symbolic_icons.svg b/share/icons/symbolic_icons.svg
index aee4937c5..762bf6fd1 100644
--- a/share/icons/symbolic_icons.svg
+++ b/share/icons/symbolic_icons.svg
@@ -3241,7 +3241,7 @@
</g>
<g id="on" transform="translate(454.5112,482.827)">
<rect y="199.5352" x="10.48884" height="16" width="16" id="rect23222-9" style="fill:none" />
-<ellipse style="color:#000000;fill:none;stroke:url(#linearGradient19282);stroke-linejoin:round" id="ellipse10646" cx="18.48884" cy="207.5353" rx="6.611154" ry="6.515604" transform="translate(-1.031494e-7,-4.35791e-5)" />
+<ellipse style="color:#000000;fill:none;stroke:url(#linearGradient19282);stroke-linejoin:round" id="ellipse10646" cx="18.48884" cy="207.5353" rx="6.611154" ry="6.515604" />
<path sodipodi:nodetypes="ccc" inkscape:connector-curvature="0" id="path10653" d="M 15.35239,207.5955 17.38434,209.4915 21.62529,205.579" style="color:#000000;fill:none;stroke:url(#linearGradient19282)" />
</g>
<g id="off" transform="translate(429.5112,500.3125)">
diff --git a/src/live_effects/parameter/togglebutton.cpp b/src/live_effects/parameter/togglebutton.cpp
index 47a8b5615..c761731b7 100644
--- a/src/live_effects/parameter/togglebutton.cpp
+++ b/src/live_effects/parameter/togglebutton.cpp
@@ -24,10 +24,10 @@ namespace LivePathEffect {
ToggleButtonParam::ToggleButtonParam( const Glib::ustring& label, const Glib::ustring& tip,
const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr,
Effect* effect, bool default_value, const Glib::ustring& inactive_label,
- char const * icon_active, char const * icon_inactive,
- Inkscape::IconSize icon_size)
+ char const * _icon_active, char const * _icon_inactive,
+ Inkscape::IconSize _icon_size)
: Parameter(label, tip, key, wr, effect), value(default_value), defvalue(default_value),
- inactiveLabel(inactive_label), iconActive(icon_active), iconInactive(icon_inactive), iconSize(icon_size)
+ inactive_label(inactive_label), _icon_active(_icon_active), _icon_inactive(_icon_inactive), _icon_size(_icon_size)
{
checkwdg = NULL;
}
@@ -75,38 +75,40 @@ ToggleButtonParam::param_newWidget()
param_effect->getRepr(),
param_effect->getSPDoc()) );
#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget * boxButton = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_set_homogeneous(GTK_BOX(boxButton), false);
+ GtkWidget * box_button = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_box_set_homogeneous(GTK_BOX(box_button), false);
#else
- GtkWidget * boxButton = gtk_hbox_new (false, 0);
+ GtkWidget * box_button = gtk_hbox_new (false, 0);
#endif
- GtkWidget * labelButton = gtk_label_new ("");
+ GtkWidget * label_button = gtk_label_new ("");
if (!param_label.empty()) {
- if(value || inactiveLabel.empty()){
- gtk_label_set_text(GTK_LABEL(labelButton), param_label.c_str());
+ if(value || inactive_label.empty()){
+ gtk_label_set_text(GTK_LABEL(label_button), param_label.c_str());
}else{
- gtk_label_set_text(GTK_LABEL(labelButton), inactiveLabel.c_str());
+ gtk_label_set_text(GTK_LABEL(label_button), inactive_label.c_str());
}
}
- gtk_widget_show(labelButton);
- if ( iconActive ) {
- if(!iconInactive){
- iconInactive = iconActive;
+ gtk_widget_show(label_button);
+ if ( _icon_active ) {
+ if(!_icon_inactive){
+ _icon_inactive = _icon_active;
}
- gtk_widget_show(boxButton);
- GtkWidget *iconButton = sp_icon_new(iconSize, iconActive);
+ gtk_widget_show(box_button);
+ GtkWidget *icon_button = NULL;
if(!value){
- iconButton = sp_icon_new(iconSize, iconInactive);
+ icon_button = sp_icon_new(_icon_size, _icon_inactive);
+ } else {
+ icon_button = sp_icon_new(_icon_size, _icon_active);
}
- gtk_widget_show(iconButton);
- gtk_box_pack_start (GTK_BOX(boxButton), iconButton, false, false, 1);
+ gtk_widget_show(icon_button);
+ gtk_box_pack_start (GTK_BOX(box_button), icon_button, false, false, 1);
if (!param_label.empty()) {
- gtk_box_pack_start (GTK_BOX(boxButton), labelButton, false, false, 1);
+ gtk_box_pack_start (GTK_BOX(box_button), label_button, false, false, 1);
}
}else{
- gtk_box_pack_start (GTK_BOX(boxButton), labelButton, false, false, 1);
+ gtk_box_pack_start (GTK_BOX(box_button), label_button, false, false, 1);
}
- checkwdg->add(*Gtk::manage(Glib::wrap(boxButton)));
+ checkwdg->add(*Gtk::manage(Glib::wrap(box_button)));
checkwdg->setActive(value);
checkwdg->setProgrammatically = false;
checkwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change togglebutton parameter"));
@@ -126,25 +128,27 @@ ToggleButtonParam::refresh_button()
if(!checkwdg){
return;
}
- Gtk::Widget * boxButton = checkwdg->get_child();
- if(!boxButton){
+ Gtk::Widget * box_button = checkwdg->get_child();
+ if(!box_button){
return;
}
- GList * childs = gtk_container_get_children(GTK_CONTAINER(boxButton->gobj()));
- guint totalWidgets = g_list_length (childs);
+ GList * childs = gtk_container_get_children(GTK_CONTAINER(box_button->gobj()));
+ guint total_widgets = g_list_length (childs);
if (!param_label.empty()) {
- if(value || inactiveLabel.empty()){
- gtk_label_set_text(GTK_LABEL(g_list_nth_data(childs, totalWidgets-1)), param_label.c_str());
+ if(value || inactive_label.empty()){
+ gtk_label_set_text(GTK_LABEL(g_list_nth_data(childs, total_widgets-1)), param_label.c_str());
}else{
- gtk_label_set_text(GTK_LABEL(g_list_nth_data(childs, totalWidgets-1)), inactiveLabel.c_str());
+ gtk_label_set_text(GTK_LABEL(g_list_nth_data(childs, total_widgets-1)), inactive_label.c_str());
}
}
- if ( iconActive ) {
- GdkPixbuf * iconPixbuf = sp_pixbuf_new( iconSize, iconActive );
+ if ( _icon_active ) {
+ GdkPixbuf * icon_pixbuf = NULL;
if(!value){
- iconPixbuf = sp_pixbuf_new( iconSize, iconInactive);
+ icon_pixbuf = sp_pixbuf_new( _icon_size, _icon_inactive );
+ } else {
+ icon_pixbuf = sp_pixbuf_new( _icon_size, _icon_active );
}
- gtk_image_set_from_pixbuf (GTK_IMAGE(g_list_nth_data(childs, 0)), iconPixbuf);
+ gtk_image_set_from_pixbuf (GTK_IMAGE(g_list_nth_data(childs, 0)), icon_pixbuf);
}
}
diff --git a/src/live_effects/parameter/togglebutton.h b/src/live_effects/parameter/togglebutton.h
index 4e545bcfd..8390fec86 100644
--- a/src/live_effects/parameter/togglebutton.h
+++ b/src/live_effects/parameter/togglebutton.h
@@ -59,10 +59,10 @@ private:
void refresh_button();
bool value;
bool defvalue;
- const Glib::ustring inactiveLabel;
- const char * iconActive;
- const char * iconInactive;
- Inkscape::IconSize iconSize;
+ const Glib::ustring inactive_label;
+ const char * _icon_active;
+ const char * _icon_inactive;
+ Inkscape::IconSize _icon_size;
Inkscape::UI::Widget::RegisteredToggleButton * checkwdg;
sigc::signal<void> _signal_toggled;
diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp
index 298377af3..572845668 100644
--- a/src/ui/widget/registered-widget.cpp
+++ b/src/ui/widget/registered-widget.cpp
@@ -113,10 +113,8 @@ RegisteredToggleButton::~RegisteredToggleButton()
_toggled_connection.disconnect();
}
-RegisteredToggleButton::RegisteredToggleButton (const Glib::ustring& /*label*/, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, SPDocument *doc_in, char const *active_str, char const *inactive_str)
+RegisteredToggleButton::RegisteredToggleButton (const Glib::ustring& /*label*/, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, SPDocument *doc_in, char const *icon_active, char const *icon_inactive)
: RegisteredWidget<Gtk::ToggleButton>()
- , _active_str(active_str)
- , _inactive_str(inactive_str)
{
init_parent(key, wr, repr_in, doc_in);
setProgrammatically = false;
@@ -149,7 +147,7 @@ RegisteredToggleButton::on_toggled()
return;
_wr->setUpdating (true);
- write_to_xml(get_active() ? _active_str : _inactive_str);
+ write_to_xml(get_active() ? "true" : "false");
//The slave button is greyed out if the master button is untoggled
for (std::list<Gtk::Widget*>::const_iterator i = _slavewidgets.begin(); i != _slavewidgets.end(); ++i) {
(*i)->set_sensitive(get_active());
diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h
index 9d2489712..ab2e4c8e4 100644
--- a/src/ui/widget/registered-widget.h
+++ b/src/ui/widget/registered-widget.h
@@ -166,7 +166,7 @@ protected:
class RegisteredToggleButton : public RegisteredWidget<Gtk::ToggleButton> {
public:
virtual ~RegisteredToggleButton();
- RegisteredToggleButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL, char const *active_str = "true", char const *inactive_str = "false");
+ RegisteredToggleButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL, char const *icon_active = "true", char const *icon_inactive = "false");
void setActive (bool);
@@ -183,7 +183,6 @@ public:
// if a callback checks it, it must reset it back to false
protected:
- char const *_active_str, *_inactive_str;
sigc::connection _toggled_connection;
void on_toggled();
};