Author: Yu Chen <[email protected]>
Date: Thu Mar 29 03:10:42 2012 +0800
Update zoom factor filters
---
synfig-studio/src/gui/preview.cpp | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/synfig-studio/src/gui/preview.cpp
b/synfig-studio/src/gui/preview.cpp
index c27c515..1ffb05c 100644
--- a/synfig-studio/src/gui/preview.cpp
+++ b/synfig-studio/src/gui/preview.cpp
@@ -1044,30 +1044,35 @@ void studio::Widget_Preview::eraseall()
}
}
-
void Widget_Preview::on_zoom_entry_activated()
{
Gtk::Entry* entry = zoom_preview.get_entry();
String str(entry->get_text());
- std::transform(str.begin(),str.end(),str.begin(),&tolower);
- Glib::ustring text = str;
- locale_from_utf8 (text);
- const std::string c = text.c_str();
+ string digi = "0123456789";
+ int first = str.find_first_of(digi);
- if (text == _("Fit") || text == "fit")
+ if (first == string::npos)
{
entry->set_text(_("Fit"));
+ entry->set_position(-1);
+
+ return ;
}
- else
+ int last = str.find_first_not_of(digi);
+
+ if (last == string::npos)
{
- // unsigned int pos=0;
- // int read;
- // float amount;
+ last = str.find_last_of(digi) + 1;
+ }
- // entry->set_text(c + "%");
+ if (first > last)
+ {
+ entry->set_text (_("Fit"));
}
+ else entry->set_text(str.substr(first, last - first) + "%");
+
entry->set_position(-1);
}
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl