Author: Yu Chen <[email protected]>
Date:   Sat Dec 22 20:10:27 2012 +0800

Enable compatibility to allow terms reworked Synfig Studio load old version 
settings file properly
Children Panel ->  Library Panel
Params Panel -> Parameters Panel
Groups Panel -> Sets Panel

---

 synfig-studio/src/gui/docks/dockdialog.cpp |   23 +++++++++++++++++++++++
 synfig-studio/src/gui/docks/dockdialog.h   |    3 +++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/synfig-studio/src/gui/docks/dockdialog.cpp 
b/synfig-studio/src/gui/docks/dockdialog.cpp
index 68e4fc8..05d078a 100644
--- a/synfig-studio/src/gui/docks/dockdialog.cpp
+++ b/synfig-studio/src/gui/docks/dockdialog.cpp
@@ -508,6 +508,23 @@ DockDialog::get_contents()const
        return ret;
 }
 
+
+///Enable compatiblity to allow terms reworked synfig studio load old settings 
file properly for panels:
+//params -> parameters, groups -> sets, children -> library), it should be 
removed in the future.
+void
+DockDialog::setting_map(synfig::String& settings, const synfig::String& 
strsrc, const synfig::String& strdst)
+{
+       synfig::String::size_type pos=0;
+       synfig::String::size_type srclen=strsrc.size();
+       synfig::String::size_type dstlen=strdst.size();
+       while((pos=settings.find(strsrc, pos))!=synfig::String::npos)
+       {
+               settings.replace(pos, srclen, strdst);
+               pos += dstlen;
+       }
+
+}
+
 void
 DockDialog::set_contents(const synfig::String& z)
 {
@@ -544,6 +561,12 @@ DockDialog::set_contents(const synfig::String& z)
                        str=String(str.begin()+separator+1,str.end());
                }
 
+               //Enable compatiblity to allow terms reworked synfig 
studio(Params -> Parameters, Children -> Library,
+               //Groups -> Sets) load the old version setting file properly.
+               setting_map(book_contents, "params", "parameters");
+               setting_map(book_contents, "children", "library");
+               setting_map(book_contents, "groups", "sets");
+
                try
                {
                        append_dock_book()->set_contents(book_contents);
diff --git a/synfig-studio/src/gui/docks/dockdialog.h 
b/synfig-studio/src/gui/docks/dockdialog.h
index 3abc2ce..69cbfcb 100644
--- a/synfig-studio/src/gui/docks/dockdialog.h
+++ b/synfig-studio/src/gui/docks/dockdialog.h
@@ -98,6 +98,9 @@ private:
 
        bool focused_widget_has_priority(Gtk::Widget* focused);
 
+       //Enable compatiblity to allow terms reworked synfig studio load old 
settings file properly for panels:
+       //params -> parameters, groups -> sets, children -> library), it should 
be removed in the future.
+       void setting_map(synfig::String& settings, const synfig::String& 
strscr, const synfig::String& strdst);
 
 public:
 


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to