diff options
| author | Ted Gould <ted@gould.cx> | 2010-07-13 20:16:51 +0000 |
|---|---|---|
| committer | Ted Gould <ted@gould.cx> | 2010-07-13 20:16:51 +0000 |
| commit | ef2d72d29fce61231bdd7888ab8330503158e9d6 (patch) | |
| tree | 4685bfddef010181fdd87fc182016b994f2b69d9 /src/ui | |
| parent | Pulling in a more recent trunk (diff) | |
| parent | Translations. Romanian nsh file update. (diff) | |
| download | inkscape-ef2d72d29fce61231bdd7888ab8330503158e9d6.tar.gz inkscape-ef2d72d29fce61231bdd7888ab8330503158e9d6.zip | |
Upgrading to trunk
(bzr r8254.1.57)
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/clipboard.cpp | 19 | ||||
| -rw-r--r-- | src/ui/dialog/aboutbox.cpp | 349 | ||||
| -rw-r--r-- | src/ui/dialog/dialog-manager.cpp | 6 | ||||
| -rw-r--r-- | src/ui/dialog/document-properties.cpp | 1 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 9 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.cpp | 5 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.h | 2 | ||||
| -rw-r--r-- | src/ui/dialog/print-colors-preview-dialog.cpp | 3 | ||||
| -rw-r--r-- | src/ui/dialog/swatches.cpp | 200 | ||||
| -rw-r--r-- | src/ui/dialog/swatches.h | 3 | ||||
| -rw-r--r-- | src/ui/tool/curve-drag-point.cpp | 8 | ||||
| -rw-r--r-- | src/ui/tool/node-tool.cpp | 4 | ||||
| -rw-r--r-- | src/ui/tool/node.cpp | 44 | ||||
| -rw-r--r-- | src/ui/tool/transform-handle-set.cpp | 28 | ||||
| -rw-r--r-- | src/ui/uxmanager.cpp | 120 | ||||
| -rw-r--r-- | src/ui/uxmanager.h | 18 | ||||
| -rw-r--r-- | src/ui/widget/page-sizer.cpp | 80 | ||||
| -rw-r--r-- | src/ui/widget/page-sizer.h | 12 |
18 files changed, 602 insertions, 309 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index dd1f981b5..0a64e7fa7 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -653,23 +653,23 @@ void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection) void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) { // copy fill and stroke styles (patterns and gradients) - SPStyle *style = SP_OBJECT_STYLE(item); + SPStyle *style = item->style; if (style && (style->fill.isPaintserver())) { - SPObject *server = SP_OBJECT_STYLE_FILL_SERVER(item); - if (SP_IS_LINEARGRADIENT(server) || SP_IS_RADIALGRADIENT(server)) { + SPPaintServer *server = item->style->getFillPaintServer(); + if ( SP_IS_LINEARGRADIENT(server) || SP_IS_RADIALGRADIENT(server) ) { _copyGradient(SP_GRADIENT(server)); } - if (SP_IS_PATTERN(server)) { + if ( SP_IS_PATTERN(server) ) { _copyPattern(SP_PATTERN(server)); } } if (style && (style->stroke.isPaintserver())) { - SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER(item); - if (SP_IS_LINEARGRADIENT(server) || SP_IS_RADIALGRADIENT(server)) { + SPPaintServer *server = item->style->getStrokePaintServer(); + if ( SP_IS_LINEARGRADIENT(server) || SP_IS_RADIALGRADIENT(server) ) { _copyGradient(SP_GRADIENT(server)); } - if (SP_IS_PATTERN(server)) { + if ( SP_IS_PATTERN(server) ) { _copyPattern(SP_PATTERN(server)); } } @@ -1057,6 +1057,8 @@ void ClipboardManagerImpl::_applyPathEffect(SPItem *item, gchar const *effectsta { SPLPEItem *lpeitem = SP_LPE_ITEM(item); // for each effect in the stack, check if we need to fork it before adding it to the item + sp_lpe_item_fork_path_effects_if_necessary(lpeitem, 1); + std::istringstream iss(effectstack); std::string href; while (std::getline(iss, href, ';')) @@ -1065,8 +1067,7 @@ void ClipboardManagerImpl::_applyPathEffect(SPItem *item, gchar const *effectsta if (!obj) { return; } - // if the effectstack is not used by anyone, we might as well take it - LivePathEffectObject *lpeobj = LIVEPATHEFFECT(obj)->fork_private_if_necessary(1); + LivePathEffectObject *lpeobj = LIVEPATHEFFECT(obj); sp_lpe_item_add_path_effect(lpeitem, lpeobj); } } diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index bbd02fa5d..8d467d53f 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -216,7 +216,7 @@ void AboutBox::initStrings() { * To update it, execute this snippet of sed magic in the toplevel * source directory: * - * sed -e 's/^\(.*\) \([^ ]*\)*$/\2_ \1/' ../../../AUTHORS + * sed -e 's/^\(.*\) \([^ ]*\)*$/\2_ \1/' AUTHORS | sort | sed -e 's/^\([^_]*\)_ \(.*\)$/\2 \1/;s/^.*$/"\0\\n"/;$s/\\n//' | zenity --text-info @@ -224,140 +224,152 @@ void AboutBox::initStrings() { * and paste the result from the combo box here. */ authors_text = - "Maximilian Albert\n" - "Josh Andler\n" - "Jean-François Barraud\n" - "Bill Baxter\n" - "John Bintz\n" - "Arpad Biro\n" - "Nicholas Bishop\n" - "Joshua L. Blocher\n" - "Henrik Bohre\n" - "Boldewyn\n" - "Daniel Borgmann\n" - "Bastien Bouclet\n" - "Hans Breuer\n" - "Gustav Broberg\n" - "Christopher Brown\n" - "Marcus Brubaker\n" - "Luca Bruno\n" - "Nicu Buculei\n" - "Bulia Byak\n" - "Ian Caldwell\n" - "Gail Carmichael\n" - "Ed Catmur\n" - "Chema Celorio\n" - "Johan Ceuppens\n" - "Zbigniew Chyla\n" - "Alexander Clausen\n" - "John Cliff\n" - "Kees Cook\n" - "Ben Cromwell\n" - "Robert Crosbie\n" - "Jon Cruz\n" - "Aurélie De-Cooman\n" - "Milosz Derezynski\n" - "Daniel Díaz\n" - "Bruno Dilly\n" - "Larry Doolittle\n" - "Tim Dwyer\n" - "Maxim V. Dziumanenko\n" - "Johan Engelen\n" - "Miklos Erdelyi\n" - "Ulf Erikson\n" - "Noé Falzon\n" - "Frank Felfe\n" - "Andrew Fitzsimon\n" - "Edward Flick\n" - "Marcin Floryan\n" - "Ben Fowler\n" - "Fred\n" - "Cedric Gemy\n" - "Steren Giannini\n" - "Olivier Gondouin\n" - "Ted Gould\n" - "Toine de Greef\n" - "Michael Grosberg\n" - "Bryce Harrington\n" - "Dale Harvey\n" - "Aurélio Heckert\n" - "Carl Hetherington\n" - "Jos Hirth\n" - "Thomas Holder\n" - "Joel Holdsworth\n" - "Alan Horkan\n" - "Karl Ove Hufthammer\n" - "Richard Hughes\n" - "Nathan Hurst\n" - "inductiveload\n" - "Thomas Ingham\n" - "Jean-Olivier Irisson\n" - "Bob Jamison\n" - "jEsuSdA\n" - "Lauris Kaplinski\n" - "Lynn Kerby\n" - "Niko Kiirala\n" - "James Kilfiger\n" - "Jason Kivlighn\n" - "Adrian Knoth\n" - "Krzysztof Kosiński\n" - "Petr Kovar\n" - "Raph Levien\n" - "Diederik van Lierop\n" - "Nicklas Lindgren\n" - "Vitaly Lipatov\n" - "Ivan Louette\n" - "Colin Marquardt\n" - "Dmitry G. Mastrukov\n" - "Matiphas\n" - "Michael Meeks\n" - "Federico Mena\n" - "MenTaLguY\n" - "Aubanel Monnier\n" - "Tim Mooney\n" - "Derek P. Moore\n" - "Peter Moulder\n" - "Jörg Müller\n" - "Yukihiro Nakai\n" - "Victor Navez\n" - "Christian Neumair\n" - "Andreas Nilsson\n" - "Mitsuru Oka\n" - "Marten Owens\n" - "Alvin Penner\n" - "Jon Phillips\n" - "Zdenko Podobny\n" - "Alexandre Prokoudine\n" - "Jean-René Reinhard\n" - "Alexey Remizov\n" - "Frederic Rodrigo\n" - "Hugo Rodrigues\n" - "Juarez Rudsatz\n" - "Xavier Conde Rueda\n" - "Felipe Corrêa da Silva Sanches\n" - "Christian Schaller\n" - "Marco Scholten\n" - "Tom von Schwerdtner\n" - "Danilo Šegan\n" - "Shivaken\n" - "Michael Sloan\n" - "Boštjan Špetič\n" - "Aaron Spike\n" - "Kaushik Sridharan\n" - "Ralf Stephan\n" - "Dariusz Stojek\n" - "Pat Suwalski\n" - "Adib Taraben\n" - "Hugh Tebby\n" - "Jonas Termeau\n" - "David Turner\n" - "Andre Twupack\n" - "Aleksandar Urošević\n" - "Lucas Vieites\n" - "Michael Wybrow\n" - "Daniel Yacob\n" - "Masatake Yamato\n" - "David Yip"; + "Maximilian Albert\n" + "Josh Andler\n" + "Tavmjong Bah\n" + "Pierre Barbry-Blot\n" + "Jean-François Barraud\n" + "Bill Baxter\n" + "John Beard\n" + "John Bintz\n" + "Arpad Biro\n" + "Nicholas Bishop\n" + "Joshua L. Blocher\n" + "Henrik Bohre\n" + "Boldewyn\n" + "Daniel Borgmann\n" + "Bastien Bouclet\n" + "Hans Breuer\n" + "Gustav Broberg\n" + "Christopher Brown\n" + "Marcus Brubaker\n" + "Luca Bruno\n" + "Nicu Buculei\n" + "Bulia Byak\n" + "Pierre Caclin\n" + "Ian Caldwell\n" + "Gail Carmichael\n" + "Ed Catmur\n" + "Chema Celorio\n" + "Johan Ceuppens\n" + "Zbigniew Chyla\n" + "Alexander Clausen\n" + "John Cliff\n" + "Kees Cook\n" + "Ben Cromwell\n" + "Robert Crosbie\n" + "Jon Cruz\n" + "Aurélie De-Cooman\n" + "Milosz Derezynski\n" + "Daniel Díaz\n" + "Bruno Dilly\n" + "Larry Doolittle\n" + "Tim Dwyer\n" + "Maxim V. Dziumanenko\n" + "Johan Engelen\n" + "Miklos Erdelyi\n" + "Ulf Erikson\n" + "Noé Falzon\n" + "Frank Felfe\n" + "Andrew Fitzsimon\n" + "Edward Flick\n" + "Marcin Floryan\n" + "Ben Fowler\n" + "Fred\n" + "Cedric Gemy\n" + "Steren Giannini\n" + "Olivier Gondouin\n" + "Ted Gould\n" + "Toine de Greef\n" + "Michael Grosberg\n" + "Bryce Harrington\n" + "Dale Harvey\n" + "Aurélio A. Heckert\n" + "Carl Hetherington\n" + "Jos Hirth\n" + "Hannes Hochreiner\n" + "Thomas Holder\n" + "Joel Holdsworth\n" + "Alan Horkan\n" + "Karl Ove Hufthammer\n" + "Richard Hughes\n" + "Nathan Hurst\n" + "inductiveload\n" + "Thomas Ingham\n" + "Jean-Olivier Irisson\n" + "Bob Jamison\n" + "jEsuSdA\n" + "Lauris Kaplinski\n" + "Lynn Kerby\n" + "Niko Kiirala\n" + "James Kilfiger\n" + "Jason Kivlighn\n" + "Adrian Knoth\n" + "Krzysztof Kosiński\n" + "Petr Kovar\n" + "Benoît Lavorata\n" + "Alex Leone\n" + "Julien Leray\n" + "Raph Levien\n" + "Diederik van Lierop\n" + "Nicklas Lindgren\n" + "Vitaly Lipatov\n" + "Ivan Louette\n" + "Pierre-Antoine Marc\n" + "Aurel-Aimé Marmion\n" + "Colin Marquardt\n" + "Dmitry G. Mastrukov\n" + "Matiphas\n" + "Michael Meeks\n" + "Federico Mena\n" + "MenTaLguY\n" + "Aubanel Monnier\n" + "Vincent Montagne\n" + "Tim Mooney\n" + "Derek P. Moore\n" + "Peter Moulder\n" + "Jörg Müller\n" + "Yukihiro Nakai\n" + "Victor Navez\n" + "Christian Neumair\n" + "Andreas Nilsson\n" + "Mitsuru Oka\n" + "Marten Owens\n" + "Alvin Penner\n" + "Jon Phillips\n" + "Zdenko Podobny\n" + "Alexandre Prokoudine\n" + "Jean-René Reinhard\n" + "Alexey Remizov\n" + "Frederic Rodrigo\n" + "Hugo Rodrigues\n" + "Juarez Rudsatz\n" + "Xavier Conde Rueda\n" + "Felipe Corrêa da Silva Sanches\n" + "Christian Schaller\n" + "Marco Scholten\n" + "Tom von Schwerdtner\n" + "Danilo Šegan\n" + "Shivaken\n" + "Michael Sloan\n" + "Boštjan Špetič\n" + "Aaron Spike\n" + "Kaushik Sridharan\n" + "Ralf Stephan\n" + "Dariusz Stojek\n" + "Martin Sucha\n" + "Pat Suwalski\n" + "Adib Taraben\n" + "Hugh Tebby\n" + "Jonas Termeau\n" + "David Turner\n" + "Andre Twupack\n" + "Aleksandar Urošević\n" + "Lucas Vieites\n" + "Michael Wybrow\n" + "Daniel Yacob\n" + "Masatake Yamato\n" + "David Yip"; //############################## //# T R A N S L A T O R S @@ -385,19 +397,27 @@ void AboutBox::initStrings() { translators_text.append("\n\n\n"); } - /** - * This list is copied from the TRANSLATORS file. It should - * be periodically updated. - */ + /* This text is copied from the TRANSLATORS file. + * To update it, execute this snippet of sed magic in the toplevel + * source directory: + * + * sed -e 's/^\(.*\) \([^ ]*\)*$/\2_ \1/' TRANSLATORS + | sed -e 's/^\([^_]*\)_ \(.*\)$/\2 \1/;s/^.*$/"\0\\n"/;$s/\\n//' + | zenity --text-info + * + * and paste the result from the combo box here. + */ gchar const *allTranslators = "3ARRANO.com <3arrano@3arrano.com>, 2005.\n" - "Adib Taraben <theadib@yahoo.com>, 2004.\n" + "Adib Taraben <theadib@googlemail.com>, 2004.\n" + "Alan Monfort <alan.monfort@free.fr>, 2009-2010.\n" "Alastair McKinstry <mckinstry@computer.org>, 2000.\n" "Aleksandar Urošević <urke@users.sourceforge.net>, 2004, 2005, 2006.\n" "Alessio Frusciante <algol@firenze.linux.it>, 2002, 2003.\n" "Alexander Shopov <ash@contact.bg>, 2006.\n" "Alexandre Prokoudine <alexandre.prokoudine@gmail.com>, 2005.\n" "Alexey Remizov <alexey@remizov.pp.ru>, 2004.\n" + "Ali Ghanavatian <ghanvatian.ali@gmail.com>, 2010.\n" "Álvaro Lopes <alvieboy@alvie.com>, 2001, 2002.\n" "Andreas Hyden <a.hyden@cyberpoint.se>, 2000.\n" "Andrius Ramanauskas <knutux@gmail.com>, 2006.\n" @@ -407,6 +427,7 @@ void AboutBox::initStrings() { "Arman Aksoy <armish@linux-sevenler.de>, 2003.\n" "Arpad Biro <biro_arpad@yahoo.com>, 2004, 2005.\n" "Benedikt Roth <Benedikt.Roth@gmx.net>, 2000.\n" + "Benno Schulenberg <benno@vertaalt.nl>, 2008.\n" "Boštjan Špetič <igzebedze@cyberpipe.org>, 2004, 2005.\n" "Brisa Francesco <fbrisa@yahoo.it>, 2000.\n" "bulia byak <buliabyak@users.sf.net>, 2004.\n" @@ -414,25 +435,33 @@ void AboutBox::initStrings() { "Christian Meyer <chrisime@gnome.org>, 2000-2002.\n" "Christian Neumair <chris@gnome-de.org>, 2002, 2003.\n" "Christian Rose <menthos@menthos.com>, 2000, 2001, 2002, 2003.\n" + "Cristian Secară <cristi@secarica.ro>, 2010.\n" "Christophe Merlet (RedFox) <redfox@redfoxcenter.org>, 2000-2002.\n" + "Clytie Siddall <clytie@riverland.net.au>, 2004-2008.\n" "Colin Marquardt <colin@marquardt-home.de>, 2004-2006.\n" "Cédric Gemy <radar.map35@free.fr>, 2006.\n" "Daniel Díaz <yosoy@danieldiaz.org>, 2004.\n" "Didier Conchaudron <conchaudron@free.fr>, 2003.\n" "Dorji Tashi <dorjee_doss@hotmail.com>, 2006.\n" "Duarte Loreto <happyguy_pt@hotmail.com> 2002, 2003 (Maintainer).\n" + "Equipe de Tradução Inkscape Brasil <www.inkscapebrasil.org>, 2007.\n" "Fatih Demir <kabalak@gtranslator.org>, 2000.\n" + "Foppe Benedictus <foppe.benedictus@gmail.com>, 2007-2009.\n" "Francesc Dorca <f.dorca@filnet.es>, 2003. Traducció sodipodi.\n" "Francisco Javier F. Serrador <serrador@arrakis.es>, 2003.\n" "Francisco Xosé Vázquez Grandal <fxvazquez@arrakis.es>, 2001.\n" "Frederic Rodrigo <f.rodrigo free.fr>, 2004-2005.\n" "Ge'ez Frontier Foundation <locales@geez.org>, 2002.\n" + "Hleb Valoshka <375gnu@gmail.com>, 2008-2009.\n" "Hizkuntza Politikarako Sailburuordetza <hizkpol@ej-gv.es>, 2005.\n" "Ilia Penev <lichopicho@gmail.com>, 2006.\n" + "Ivan Masár <helix84@centrum.sk>, 2006, 2007, 2008, 2009, 2010. \n" "Iñaki Larrañaga <dooteo@euskalgnu.org>, 2006.\n" - "Jin-Hwan Jeong <yongdoria@gmail.com>, 2009.\n" + "Jeffrey Steve Borbón Sanabria <jeff_kerokid@yahoo.com>, 2005.\n" + "Joaquim Perez i Noguer <noguer@gmail.com>, 2008-2009.\n" "Jörg Müller <jfm@ram-brand.de>, 2005.\n" - "Jeroen van der Vegt <ajvdvegt (at) 123mail.org>, 2003, 2005.\n" + "Jeroen van der Vegt <jvdvegt@gmail.com>, 2003, 2005, 2008.\n" + "Jin-Hwan Jeong <yongdoria@gmail.com>, 2009.\n" "Jonathan Ernst <jernst@users.sourceforge.net>, 2006.\n" "Jose Antonio Salgueiro Aquino <developer@telefonica.net>, 2003.\n" "Josef Vybiral <josef.vybiral@gmail.com>, 2005-2006.\n" @@ -441,29 +470,40 @@ void AboutBox::initStrings() { "Jurmey Rabgay <jur_gay@yahoo.com>, 2006.\n" "Kai Lahmann <kailahmann@01019freenet.de>, 2000.\n" "Karl Ove Hufthammer <karl@huftis.org>, 2004, 2005.\n" - "Keld Simonsen <keld@dkuug.dk>, 2000-2001.\n" + "KATSURAGAWA Naoki <naopon@private.email.ne.jp>, 2006.\n" + "Keld Simonsen <keld@dkuug.dk>, 2000, 2001.\n" + "Kenji Inoue <kenz@oct.zaq.ne.jp>, 2006-2007.\n" + "Khandakar Mujahidul Islam <suzan@bengalinux.org>, 2006.\n" "Kitae <bluetux@gmail.com>, 2006.\n" "Kjartan Maraas <kmaraas@gnome.org>, 2000-2002.\n" + "Kris De Gussem <kris.DeGussem@gmail.com>, 2008-2010.\n" "Lauris Kaplinski <lauris@ariman.ee>, 2000.\n" + "Leandro Regueiro <leandro.regueiro@gmail.com>, 2006-2008,2010.\n" + "Liu Xiaoqin <liuxqsmile@gmail.com>, 2008.\n" "Luca Bruno <luca.br@uno.it>, 2005.\n" - "Lucas Vieites Fariña<lucas@asixinformatica.com>, 2003-2005.\n" + "Lucas Vieites Fariña<lucas@codexion.com>, 2003-2010.\n" "Mahesh subedi <submanesh@hotmail.com>, 2006.\n" - "Marcin Floryan <marcin.floryan@gmail.com>, 2008.\n" - "Martin Srebotnjak, <miles@filmsi.net>, 2005.\n" + "Martin Srebotnjak, <miles@filmsi.net>, 2005, 2010.\n" "Masatake YAMATO <jet@gyve.org>, 2002.\n" + "Masato Hashimoto <cabezon.hashimoto@gmail.com>, 2009-2010.\n" "Matiphas <matiphas _a_ free _point_ fr>, 2004-2006.\n" "Mattias Hultgren <mattias_hultgren@tele2.se>, 2005.\n" "Maxim Dziumanenko <mvd@mylinux.com.ua>, 2004.\n" + "Mətin Əmirov <metin@karegen.com>, 2003.\n" "Mitsuru Oka <oka326@parkcity.ne.jp>, 2002.\n" "Morphix User <pchitrakar@gmail.com>, 2006.\n" "Mufit Eribol <meribol@ere.com.tr>, 2000.\n" - "Nicolas Dufour <nicoduf@yahoo.fr>, 2008-2009.\n" + "Muhammad Bashir Al-Noimi <mhdbnoimi@gmail.com>, 2008.\n" + "Myckel Habets <myckel@sdf.lonestar.org>, 2008.\n" + "Nguyen Dinh Trung <nguyendinhtrung141@gmail.com>, 2007, 2008.\n" + "Nicolas Dufour <nicoduf@yahoo.fr>, 2008-2010.\n" "Pawan Chitrakar <pchitrakar@gmail.com>, 2006.\n" "Przemysław Loesch <p_loesch@poczta.onet.pl>, 2005.\n" "Quico Llach <quico@softcatala.org>, 2000. Traducció sodipodi.\n" - "Raymond Ostertag <raymond@linuxgraphic.org>, 2002-2003.\n" + "Raymond Ostertag <raymond@linuxgraphic.org>, 2002, 2003.\n" "Riku Leino <tsoots@gmail.com>, 2006.\n" "Rune Rønde Laursen <runerl@skjoldhoej.dk>, 2006.\n" + "Ruud Steltenpool <svg@steltenpower.com>, 2006.\n" "Serdar Soytetir <sendirom@gmail.com>, 2005.\n" "shivaken <shivaken@owls-nest.net>, 2004.\n" "Shyam Krishna Bal <shyamkrishna_bal@yahoo.com>, 2006.\n" @@ -471,10 +511,13 @@ void AboutBox::initStrings() { "Spyros Blanas <cid_e@users.sourceforge.net>, 2006.\n" "Stefan Graubner <pflaumenmus92@gmx.net>, 2005.\n" "Supranee Thirawatthanasuk <supranee@opentle.org>, 2006.\n" - "Takeshi Aihana <aihana@muc.biglobe.ne.jp>, 2000-2001.\n" + "Takeshi Aihana <aihana@muc.biglobe.ne.jp>, 2000, 2001.\n" + "Tim Sheridan <tim.sheridan@gmail.com>, 2007-2010.\n" "Theppitak Karoonboonyanan <thep@linux.thai.net>, 2006.\n" + "Thiago Pimentel <thiago.merces@gmail.com>, 2006.\n" + "Toshifumi Sato <sato@centrosystem.com>, 2005.\n" "Jon South <striker@lunar-linux.org>, 2006. \n" - "Uwe Schöler <uschoeler@yahoo.de>, 2006.\n" + "Uwe Schöler <oss@oss-marketplace.com>, 2006.\n" "Valek Filippov <frob@df.ru>, 2000, 2003.\n" "Victor Dachev <vdachev@gmail.com>, 2006.\n" "Vincent van Adrighem <V.vanAdrighem@dirck.mine.nu>, 2003.\n" @@ -484,12 +527,14 @@ void AboutBox::initStrings() { "Wang Li <charlesw1234@163.com>, 2002.\n" "Wei-Lun Chao <william.chao@ossii.com.tw>, 2006.\n" "Wolfram Strempfer <wolfram@strempfer.de>, 2006.\n" - "Xavier Conde Rueda <xavi.conde@gmail.com>, 2004, 2005.\n" + "Xavier Conde Rueda <xavi.conde@gmail.com>, 2004-2008.\n" + "Yaron Shahrabani <sh.yaron@gmail.com>, 2009.\n" "Yukihiro Nakai <nakai@gnome.gr.jp>, 2000, 2003.\n" "Yuri Beznos <zhiz0id@gmail.com>, 2006.\n" + "Yuri Chornoivan <yurchor@ukr.net>, 2007-2010.\n" "Yuri Syrota <rasta@renome.rovno.ua>, 2000.\n" "Yves Guillou <yvesguillou@users.sourceforge.net>, 2004.\n" - "Zdenko Podobný <zdpo@mailbox.sk>, 2003, 2004.\n" + "Zdenko Podobný <zdpo@mailbox.sk>, 2003, 2004." ; translators_text.append(allTranslators); diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index 6d3bc817e..aab9d89d7 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -41,7 +41,7 @@ #include "ui/dialog/icon-preview.h" #include "ui/dialog/floating-behavior.h" #include "ui/dialog/dock-behavior.h" -#include "ui/dialog/print-colors-preview-dialog.h" +//#include "ui/dialog/print-colors-preview-dialog.h" #include "preferences.h" #ifdef ENABLE_SVG_FONTS @@ -104,7 +104,7 @@ DialogManager::DialogManager() { registerFactory("LivePathEffect", &create<LivePathEffectEditor, FloatingBehavior>); registerFactory("Memory", &create<Memory, FloatingBehavior>); registerFactory("Messages", &create<Messages, FloatingBehavior>); - registerFactory("PrintColorsPreviewDialog", &create<PrintColorsPreviewDialog, FloatingBehavior>); +// registerFactory("PrintColorsPreviewDialog", &create<PrintColorsPreviewDialog, FloatingBehavior>); registerFactory("Script", &create<ScriptDialog, FloatingBehavior>); #ifdef ENABLE_SVG_FONTS registerFactory("SvgFontsDialog", &create<SvgFontsDialog, FloatingBehavior>); @@ -132,7 +132,7 @@ DialogManager::DialogManager() { registerFactory("LivePathEffect", &create<LivePathEffectEditor, DockBehavior>); registerFactory("Memory", &create<Memory, DockBehavior>); registerFactory("Messages", &create<Messages, DockBehavior>); - registerFactory("PrintColorsPreviewDialog", &create<PrintColorsPreviewDialog, DockBehavior>); +// registerFactory("PrintColorsPreviewDialog", &create<PrintColorsPreviewDialog, DockBehavior>); registerFactory("Script", &create<ScriptDialog, DockBehavior>); #ifdef ENABLE_SVG_FONTS registerFactory("SvgFontsDialog", &create<SvgFontsDialog, DockBehavior>); diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 86baa85cd..33fdf8327 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -825,6 +825,7 @@ DocumentProperties::update() double const doc_w_px = sp_document_width(sp_desktop_document(dt)); double const doc_h_px = sp_document_height(sp_desktop_document(dt)); _page_sizer.setDim (doc_w_px, doc_h_px); + _page_sizer.updateFitMarginsUI(SP_OBJECT_REPR(nv)); //-----------------------------------------------------------guide page diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 3c48a7972..8f5194eda 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -540,8 +540,9 @@ void InkscapePreferences::initPageTools() this->AddNewObjectsStyle(_page_eraser, "/tools/eraser"); //LPETool - this->AddPage(_page_lpetool, _("LPE Tool"), iter_tools, PREFS_PAGE_TOOLS_LPETOOL); - this->AddNewObjectsStyle(_page_lpetool, "/tools/lpetool"); + // commented out, because the LPETool is not finished yet. + //this->AddPage(_page_lpetool, _("LPE Tool"), iter_tools, PREFS_PAGE_TOOLS_LPETOOL); + //this->AddNewObjectsStyle(_page_lpetool, "/tools/lpetool"); //Text this->AddPage(_page_text, _("Text"), iter_tools, PREFS_PAGE_TOOLS_TEXT); @@ -1116,11 +1117,11 @@ void InkscapePreferences::initPageUI() _("Mongolian (mn)"), _("Nepali (ne)"), _("Norwegian Bokmål (nb)"), _("Norwegian Nynorsk (nn)"), _("Panjabi (pa)"), _("Polish (pl)"), _("Portuguese (pt)"), _("Portuguese/Brazil (pt_BR)"), _("Romanian (ro)"), _("Russian (ru)"), _("Serbian (sr)"), _("Serbian in Latin script (sr@latin)"), _("Slovak (sk)"), _("Slovenian (sl)"), _("Spanish (es)"), _("Spanish/Mexico (es_MX)"), - _("Swedish (sv)"), _("Thai (th)"), _("Turkish (tr)"), _("Ukrainian (uk)"), _("Vietnamese (vi)")}; + _("Swedish (sv)"),_("Telugu (te_IN)"), _("Thai (th)"), _("Turkish (tr)"), _("Ukrainian (uk)"), _("Vietnamese (vi)")}; Glib::ustring langValues[] = {"", "sq", "am", "ar", "hy", "az", "eu", "be", "bg", "bn", "br", "ca", "ca@valencia", "zh_CN", "zh_TW", "hr", "cs", "da", "nl", "dz", "de", "el", "en", "en_AU", "en_CA", "en_GB", "en_US@piglatin", "eo", "et", "fa", "fi", "fr", "ga", "gl", "he", "hu", "id", "it", "ja", "km", "rw", "ko", "lt", "mk", "mn", "ne", "nb", "nn", "pa", - "pl", "pt", "pt_BR", "ro", "ru", "sr", "sr@latin", "sk", "sl", "es", "es_MX", "sv", "th", "tr", "uk", "vi" }; + "pl", "pt", "pt_BR", "ro", "ru", "sr", "sr@latin", "sk", "sl", "es", "es_MX", "sv", "te_IN", "th", "tr", "uk", "vi" }; _ui_languages.init( "/ui/language", languages, langValues, G_N_ELEMENTS(languages), languages[0]); _page_ui.add_line( false, _("Language (requires restart):"), _ui_languages, "", diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index dec437be9..62ed4e639 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -51,9 +51,10 @@ namespace Dialog { /*#################### * Callback functions */ -static void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data) +void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data) { LivePathEffectEditor *lpeeditor = static_cast<LivePathEffectEditor *>(data); + lpeeditor->lpe_list_locked = false; lpeeditor->onSelectionChanged(selection); } @@ -327,6 +328,7 @@ LivePathEffectEditor::setDesktop(SPDesktop *desktop) selection_modified_connection.disconnect(); } + lpe_list_locked = false; current_desktop = desktop; if (desktop) { Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -373,6 +375,7 @@ LivePathEffectEditor::onApply() sp_document_done(doc, SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Create and apply path effect")); + lpe_list_locked = false; onSelectionChanged(sel); } } diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h index 1152e8bb8..50e948644 100644 --- a/src/ui/dialog/livepatheffect-editor.h +++ b/src/ui/dialog/livepatheffect-editor.h @@ -123,6 +123,8 @@ private: SPLPEItem * current_lpeitem; + friend void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data); + LivePathEffectEditor(LivePathEffectEditor const &d); LivePathEffectEditor& operator=(LivePathEffectEditor const &d); }; diff --git a/src/ui/dialog/print-colors-preview-dialog.cpp b/src/ui/dialog/print-colors-preview-dialog.cpp index f4d83c271..1f999f692 100644 --- a/src/ui/dialog/print-colors-preview-dialog.cpp +++ b/src/ui/dialog/print-colors-preview-dialog.cpp @@ -7,7 +7,7 @@ * Copyright (C) 2009 Authors * Released under GNU GPLv2 (or later). Read the file 'COPYING' for more information. */ - +/* #include "desktop.h" #include "print-colors-preview-dialog.h" #include "preferences.h" @@ -98,3 +98,4 @@ PrintColorsPreviewDialog::~PrintColorsPreviewDialog(){} } // namespace Dialog } // namespace UI } // namespace Inkscape +*/ diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 6f013f4f3..29e480e24 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -14,6 +14,7 @@ #include <errno.h> #include <map> +#include <algorithm> #include <gtk/gtkdialog.h> //for GTK_RESPONSE* types #include <gtk/gtkdnd.h> @@ -44,11 +45,12 @@ #include "swatches.h" #include "style.h" #include "ui/previewholder.h" +#include "widgets/desktop-widget.h" #include "widgets/gradient-vector.h" #include "widgets/eek-preview.h" #include "display/nr-plain-stuff.h" #include "sp-gradient-reference.h" - +#include "dialog-manager.h" namespace Inkscape { namespace UI { @@ -68,6 +70,12 @@ static std::vector<DocTrack*> docTrackings; static std::map<SwatchesPanel*, SPDocument*> docPerPanel; +class SwatchesPanelHook : public SwatchesPanel +{ +public: + static void convertGradient( GtkMenuItem *menuitem, gpointer userData ); + static void deleteGradient( GtkMenuItem *menuitem, gpointer userData ); +}; static void handleClick( GtkWidget* /*widget*/, gpointer callback_data ) { ColorItem* item = reinterpret_cast<ColorItem*>(callback_data); @@ -84,6 +92,9 @@ static void handleSecondaryClick( GtkWidget* /*widget*/, gint /*arg1*/, gpointer } static GtkWidget* popupMenu = 0; +static GtkWidget *popupSubHolder = 0; +static GtkWidget *popupSub = 0; +static std::vector<Glib::ustring> popupItems; static std::vector<GtkWidget*> popupExtras; static ColorItem* bounceTarget = 0; static SwatchesPanel* bouncePanel = 0; @@ -102,11 +113,37 @@ static void redirSecondaryClick( GtkMenuItem *menuitem, gpointer /*user_data*/ ) } } -static void editGradientImpl( SPGradient* gr ) +static void editGradientImpl( SPDesktop* desktop, SPGradient* gr ) { if ( gr ) { - GtkWidget *dialog = sp_gradient_vector_editor_new( gr ); - gtk_widget_show( dialog ); + bool shown = false; + if ( desktop && desktop->doc() ) { + Inkscape::Selection *selection = sp_desktop_selection( desktop ); + GSList const *items = selection->itemList(); + if (items) { + SPStyle *query = sp_style_new( desktop->doc() ); + int result = objects_query_fillstroke(const_cast<GSList *>(items), query, true); + if ( (result == QUERY_STYLE_MULTIPLE_SAME) || (result == QUERY_STYLE_SINGLE) ) { + // could be pertinent + if (query->fill.isPaintserver()) { + SPPaintServer* server = query->getFillPaintServer(); + if ( SP_IS_GRADIENT(server) ) { + SPGradient* grad = SP_GRADIENT(server); + if ( grad->isSwatch() && grad->getId() == gr->getId()) { + desktop->_dlg_mgr->showDialog("FillAndStroke"); + shown = true; + } + } + } + } + sp_style_unref(query); + } + } + + if (!shown) { + GtkWidget *dialog = sp_gradient_vector_editor_new( gr ); + gtk_widget_show( dialog ); + } } } @@ -122,7 +159,7 @@ static void editGradient( GtkMenuItem */*menuitem*/, gpointer /*user_data*/ ) for (const GSList *item = gradients; item; item = item->next) { SPGradient* grad = SP_GRADIENT(item->data); if ( targetName == grad->getId() ) { - editGradientImpl( grad ); + editGradientImpl( desktop, grad ); break; } } @@ -130,31 +167,48 @@ static void editGradient( GtkMenuItem */*menuitem*/, gpointer /*user_data*/ ) } } -static void addNewGradient( GtkMenuItem */*menuitem*/, gpointer /*user_data*/ ) +void SwatchesPanelHook::convertGradient( GtkMenuItem * /*menuitem*/, gpointer userData ) { if ( bounceTarget ) { SwatchesPanel* swp = bouncePanel; SPDesktop* desktop = swp ? swp->getDesktop() : 0; SPDocument *doc = desktop ? desktop->doc() : 0; - if (doc) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); - - Inkscape::XML::Node *repr = xml_doc->createElement("svg:linearGradient"); - repr->setAttribute("osb:paint", "solid"); - Inkscape::XML::Node *stop = xml_doc->createElement("svg:stop"); - stop->setAttribute("offset", "0"); - stop->setAttribute("style", "stop-color:#000;stop-opacity:1;"); - repr->appendChild(stop); - Inkscape::GC::release(stop); - - SP_OBJECT_REPR( SP_DOCUMENT_DEFS(doc) )->addChild(repr, NULL); - - SPGradient * gr = static_cast<SPGradient *>(doc->getObjectByRepr(repr)); - - Inkscape::GC::release(repr); + gint index = GPOINTER_TO_INT(userData); + if ( doc && (index >= 0) && (static_cast<guint>(index) < popupItems.size()) ) { + Glib::ustring targetName = popupItems[index]; + const GSList *gradients = sp_document_get_resource_list(doc, "gradient"); + for (const GSList *item = gradients; item; item = item->next) { + SPGradient* grad = SP_GRADIENT(item->data); + if ( targetName == grad->getId() ) { + grad->setSwatch(); + sp_document_done(doc, SP_VERB_CONTEXT_GRADIENT, + _("Add gradient stop")); + break; + } + } + } + } +} - editGradientImpl( gr ); +void SwatchesPanelHook::deleteGradient( GtkMenuItem */*menuitem*/, gpointer /*userData*/ ) +{ + if ( bounceTarget ) { + SwatchesPanel* swp = bouncePanel; + SPDesktop* desktop = swp ? swp->getDesktop() : 0; + SPDocument *doc = desktop ? desktop->doc() : 0; + if (doc) { + std::string targetName(bounceTarget->def.descr); + const GSList *gradients = sp_document_get_resource_list(doc, "gradient"); + for (const GSList *item = gradients; item; item = item->next) { + SPGradient* grad = SP_GRADIENT(item->data); + if ( targetName == grad->getId() ) { + grad->setSwatch(false); + sp_document_done(doc, SP_VERB_CONTEXT_GRADIENT, + _("Delete")); + break; + } + } } } } @@ -177,7 +231,12 @@ static SwatchesPanel* findContainingPanel( GtkWidget *widget ) return swp; } -gboolean colorItemHandleButtonPress( GtkWidget* widget, GdkEventButton* event, gpointer user_data) +static void removeit( GtkWidget *widget, gpointer data ) +{ + gtk_container_remove( GTK_CONTAINER(data), widget ); +} + +gboolean colorItemHandleButtonPress( GtkWidget* widget, GdkEventButton* event, gpointer user_data ) { gboolean handled = FALSE; @@ -209,17 +268,13 @@ gboolean colorItemHandleButtonPress( GtkWidget* widget, GdkEventButton* event, g gtk_menu_shell_append(GTK_MENU_SHELL(popupMenu), child); popupExtras.push_back(child); - child = gtk_menu_item_new_with_label(_("Add")); + child = gtk_menu_item_new_with_label(_("Delete")); g_signal_connect( G_OBJECT(child), "activate", - G_CALLBACK(addNewGradient), + G_CALLBACK(SwatchesPanelHook::deleteGradient), user_data ); gtk_menu_shell_append(GTK_MENU_SHELL(popupMenu), child); popupExtras.push_back(child); - - child = gtk_menu_item_new_with_label(_("Delete")); - gtk_menu_shell_append(GTK_MENU_SHELL(popupMenu), child); - //popupExtras.push_back(child); gtk_widget_set_sensitive( child, FALSE ); child = gtk_menu_item_new_with_label(_("Edit...")); @@ -237,7 +292,12 @@ gboolean colorItemHandleButtonPress( GtkWidget* widget, GdkEventButton* event, g child = gtk_menu_item_new_with_label(_("Convert")); gtk_menu_shell_append(GTK_MENU_SHELL(popupMenu), child); //popupExtras.push_back(child); - gtk_widget_set_sensitive( child, FALSE ); + //gtk_widget_set_sensitive( child, FALSE ); + { + popupSubHolder = child; + popupSub = gtk_menu_new(); + gtk_menu_item_set_submenu( GTK_MENU_ITEM(child), popupSub ); + } gtk_widget_show_all(popupMenu); } @@ -251,7 +311,39 @@ gboolean colorItemHandleButtonPress( GtkWidget* widget, GdkEventButton* event, g bounceTarget = item; bouncePanel = swp; + popupItems.clear(); if ( popupMenu ) { + gtk_container_foreach(GTK_CONTAINER(popupSub), removeit, popupSub); + bool processed = false; + GtkWidget *wdgt = gtk_widget_get_ancestor(widget, SP_TYPE_DESKTOP_WIDGET); + if ( wdgt ) { + SPDesktopWidget *dtw = SP_DESKTOP_WIDGET(wdgt); + if ( dtw && dtw->desktop ) { + // Pick up all gradients with vectors + const GSList *gradients = sp_document_get_resource_list(dtw->desktop->doc(), "gradient"); + gint index = 0; + for (const GSList *curr = gradients; curr; curr = curr->next) { + SPGradient* grad = SP_GRADIENT(curr->data); + if ( grad->hasStops() && !grad->isSwatch() ) { + //gl = g_slist_prepend(gl, curr->data); + processed = true; + GtkWidget *child = gtk_menu_item_new_with_label(grad->getId()); + gtk_menu_shell_append(GTK_MENU_SHELL(popupSub), child); + + popupItems.push_back(grad->getId()); + g_signal_connect( G_OBJECT(child), + "activate", + G_CALLBACK(SwatchesPanelHook::convertGradient), + GINT_TO_POINTER(index) ); + index++; + } + } + + gtk_widget_show_all(popupSub); + } + } + gtk_widget_set_sensitive( popupSubHolder, processed ); + gtk_menu_popup(GTK_MENU(popupMenu), NULL, NULL, NULL, NULL, event->button, event->time); handled = TRUE; } @@ -728,10 +820,11 @@ static void recalcSwatchContents(SPDocument* doc, } if ( !newList.empty() ) { + std::reverse(newList.begin(), newList.end()); for ( std::vector<SPGradient*>::iterator it = newList.begin(); it != newList.end(); ++it ) { SPGradient* grad = *it; - sp_gradient_ensure_vector( grad ); + grad->ensureVector(); SPGradientStop first = grad->vector.stops[0]; SPColor color = first.color; guint32 together = color.toRGBA32(first.opacity); @@ -809,21 +902,25 @@ void SwatchesPanel::handleDefsModified(SPDocument *document) std::map<ColorItem*, SPGradient*> tmpGrads; recalcSwatchContents(document, tmpColors, tmpPrevs, tmpGrads); - int cap = std::min(docPalette->_colors.size(), tmpColors.size()); - for (int i = 0; i < cap; i++) { - ColorItem* newColor = tmpColors[i]; - ColorItem* oldColor = docPalette->_colors[i]; - if ( (newColor->def.getType() != oldColor->def.getType()) || - (newColor->def.getR() != oldColor->def.getR()) || - (newColor->def.getG() != oldColor->def.getG()) || - (newColor->def.getB() != oldColor->def.getB()) ) { - oldColor->def.setRGB(newColor->def.getR(), newColor->def.getG(), newColor->def.getB()); - } - if (tmpGrads.find(newColor) != tmpGrads.end()) { - oldColor->setGradient(tmpGrads[newColor]); - } - if ( tmpPrevs.find(newColor) != tmpPrevs.end() ) { - oldColor->setPixData(tmpPrevs[newColor], PREVIEW_PIXBUF_WIDTH, VBLOCK); + if ( tmpColors.size() != docPalette->_colors.size() ) { + handleGradientsChange(document); + } else { + int cap = std::min(docPalette->_colors.size(), tmpColors.size()); + for (int i = 0; i < cap; i++) { + ColorItem* newColor = tmpColors[i]; + ColorItem* oldColor = docPalette->_colors[i]; + if ( (newColor->def.getType() != oldColor->def.getType()) || + (newColor->def.getR() != oldColor->def.getR()) || + (newColor->def.getG() != oldColor->def.getG()) || + (newColor->def.getB() != oldColor->def.getB()) ) { + oldColor->def.setRGB(newColor->def.getR(), newColor->def.getG(), newColor->def.getB()); + } + if (tmpGrads.find(newColor) != tmpGrads.end()) { + oldColor->setGradient(tmpGrads[newColor]); + } + if ( tmpPrevs.find(newColor) != tmpPrevs.end() ) { + oldColor->setPixData(tmpPrevs[newColor], PREVIEW_PIXBUF_WIDTH, VBLOCK); + } } } } @@ -860,11 +957,12 @@ void SwatchesPanel::_updateFromSelection() if ( SP_IS_GRADIENT(server) ) { SPGradient* target = 0; SPGradient* grad = SP_GRADIENT(server); - if (grad->repr->attribute("osb:paint")) { + + if ( grad->isSwatch() ) { target = grad; } else if ( grad->ref ) { SPGradient *tmp = grad->ref->getObject(); - if ( tmp && tmp->repr->attribute("osb:paint") ) { + if ( tmp && tmp->isSwatch() ) { target = tmp; } } @@ -891,11 +989,11 @@ void SwatchesPanel::_updateFromSelection() if ( SP_IS_GRADIENT(server) ) { SPGradient* target = 0; SPGradient* grad = SP_GRADIENT(server); - if (grad->repr->attribute("osb:paint")) { + if ( grad->isSwatch() ) { target = grad; } else if ( grad->ref ) { SPGradient *tmp = grad->ref->getObject(); - if ( tmp && tmp->repr->attribute("osb:paint") ) { + if ( tmp && tmp->isSwatch() ) { target = tmp; } } diff --git a/src/ui/dialog/swatches.h b/src/ui/dialog/swatches.h index b18fd6cad..93bbe81d8 100644 --- a/src/ui/dialog/swatches.h +++ b/src/ui/dialog/swatches.h @@ -43,6 +43,8 @@ public: virtual int getSelectedIndex() {return _currentIndex;} // temporary protected: + static void handleGradientsChange(SPDocument *document); + virtual void _updateFromSelection(); virtual void _handleAction( int setId, int itemId ); virtual void _setDocument( SPDocument *document ); @@ -55,7 +57,6 @@ private: SwatchesPanel &operator=(SwatchesPanel const &); // no assign static void _trackDocument( SwatchesPanel *panel, SPDocument *document ); - static void handleGradientsChange(SPDocument *document); static void handleDefsModified(SPDocument *document); PreviewHolder* _holder; diff --git a/src/ui/tool/curve-drag-point.cpp b/src/ui/tool/curve-drag-point.cpp index e761daf20..0e5805dda 100644 --- a/src/ui/tool/curve-drag-point.cpp +++ b/src/ui/tool/curve-drag-point.cpp @@ -164,19 +164,19 @@ Glib::ustring CurveDragPoint::_getTip(unsigned state) bool linear = first->front()->isDegenerate() && first.next()->back()->isDegenerate(); if (state_held_shift(state)) { return C_("Path segment tip", - "<b>Shift:</b> click to toggle segment selection"); + "<b>Shift</b>: click to toggle segment selection"); } if (state_held_control(state) && state_held_alt(state)) { return C_("Path segment tip", - "<b>Ctrl+Alt:</b> click to insert a node"); + "<b>Ctrl+Alt</b>: click to insert a node"); } if (linear) { return C_("Path segment tip", - "<b>Linear segment:</b> drag to convert to a Bezier segment, " + "<b>Linear segment</b>: drag to convert to a Bezier segment, " "doubleclick to insert node, click to select (more: Shift, Ctrl+Alt)"); } else { return C_("Path segment tip", - "<b>Bezier segment:</b> drag to shape the segment, doubleclick to insert node, " + "<b>Bezier segment</b>: drag to shape the segment, doubleclick to insert node, " "click to select (more: Shift, Ctrl+Alt)"); } } diff --git a/src/ui/tool/node-tool.cpp b/src/ui/tool/node-tool.cpp index b5f420597..450ca96f0 100644 --- a/src/ui/tool/node-tool.cpp +++ b/src/ui/tool/node-tool.cpp @@ -534,11 +534,11 @@ void ink_node_tool_update_tip(InkNodeTool *nt, GdkEvent *event) if (state_held_shift(new_state)) { if (nt->_last_over) { nt->_node_message_context->set(Inkscape::NORMAL_MESSAGE, - C_("Node tool tip", "<b>Shift:</b> drag to add nodes to the selection, " + C_("Node tool tip", "<b>Shift</b>: drag to add nodes to the selection, " "click to toggle object selection")); } else { nt->_node_message_context->set(Inkscape::NORMAL_MESSAGE, - C_("Node tool tip", "<b>Shift:</b> drag to add nodes to the selection")); + C_("Node tool tip", "<b>Shift</b>: drag to add nodes to the selection")); } return; } diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index e9fa79fb3..886ddd1be 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -266,7 +266,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) Node *node_away = (this == &_parent->_front ? _parent->_prev() : _parent->_next()); if (_parent->type() == NODE_SMOOTH && Node::_is_line_segment(_parent, node_away)) { - Inkscape::Snapper::ConstraintLine cl(_parent->position(), + Inkscape::Snapper::SnapConstraint cl(_parent->position(), _parent->position() - node_away->position()); Inkscape::SnappedPoint p; p = sm.constrainedSnap(Inkscape::SnapCandidatePoint(new_pos, SNAPSOURCE_NODE_HANDLE), cl); @@ -357,21 +357,21 @@ Glib::ustring Handle::_getTip(unsigned state) } else { if (state_held_shift(state) && can_shift_rotate) { return C_("Path handle tip", - "<b>Shift+Alt:</b> preserve handle length and rotate both handles"); + "<b>Shift+Alt</b>: preserve handle length and rotate both handles"); } else { return C_("Path handle tip", - "<b>Alt:</b> preserve handle length while dragging"); + "<b>Alt</b>: preserve handle length while dragging"); } } } else { if (state_held_control(state)) { if (state_held_shift(state) && can_shift_rotate) { return format_tip(C_("Path handle tip", - "<b>Shift+Ctrl:</b> snap rotation angle to %g° increments and rotate both handles"), + "<b>Shift+Ctrl</b>: snap rotation angle to %g° increments and rotate both handles"), snap_increment_degrees()); } else { return format_tip(C_("Path handle tip", - "<b>Ctrl:</b> snap rotation angle to %g° increments, click to retract"), + "<b>Ctrl</b>: snap rotation angle to %g° increments, click to retract"), snap_increment_degrees()); } } else if (state_held_shift(state) && can_shift_rotate) { @@ -383,10 +383,10 @@ Glib::ustring Handle::_getTip(unsigned state) switch (_parent->type()) { case NODE_AUTO: return format_tip(C_("Path handle tip", - "<b>Auto node handle:</b> drag to convert to smooth node (%s)"), more); + "<b>Auto node handle</b>: drag to convert to smooth node (%s)"), more); default: return format_tip(C_("Path handle tip", - "<b>%s:</b> drag to shape the segment (%s)"), + "<b>%s</b>: drag to shape the segment (%s)"), handle_type_to_localized_string(_parent->type()), more); } } @@ -974,7 +974,7 @@ void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) // with Ctrl+Alt, constrain to handle lines // project the new position onto a handle line that is closer boost::optional<Geom::Point> front_point, back_point; - boost::optional<Inkscape::Snapper::ConstraintLine> line_front, line_back; + boost::optional<Inkscape::Snapper::SnapConstraint> line_front, line_back; if (_front.isDegenerate()) { if (_is_line_segment(this, _next())) front_point = _next()->position() - origin; @@ -988,9 +988,9 @@ void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) back_point = _back.relativePos(); } if (front_point) - line_front = Inkscape::Snapper::ConstraintLine(origin, *front_point); + line_front = Inkscape::Snapper::SnapConstraint(origin, *front_point); if (back_point) - line_back = Inkscape::Snapper::ConstraintLine(origin, *back_point); + line_back = Inkscape::Snapper::SnapConstraint(origin, *back_point); // TODO: combine the snap and non-snap branches by modifying snap.h / snap.cpp if (snap) { @@ -1029,8 +1029,8 @@ void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) // with Ctrl, constrain to axes // TODO combine the two branches if (snap) { - Inkscape::Snapper::ConstraintLine line_x(origin, Geom::Point(1, 0)); - Inkscape::Snapper::ConstraintLine line_y(origin, Geom::Point(0, 1)); + Inkscape::Snapper::SnapConstraint line_x(origin, Geom::Point(1, 0)); + Inkscape::Snapper::SnapConstraint line_y(origin, Geom::Point(0, 1)); fp = sm.constrainedSnap(Inkscape::SnapCandidatePoint(new_pos, _snapSourceType()), line_x); bp = sm.constrainedSnap(Inkscape::SnapCandidatePoint(new_pos, _snapSourceType()), line_y); } @@ -1039,9 +1039,7 @@ void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) fp = bp; } fp.getPoint(new_pos); - if (fp.getTarget() != SNAPTARGET_CONSTRAINT) { - _desktop->snapindicator->set_new_snaptarget(fp); - } + _desktop->snapindicator->set_new_snaptarget(fp); } else { Geom::Point origin = _last_drag_origin(); Geom::Point delta = new_pos - origin; @@ -1143,21 +1141,21 @@ Glib::ustring Node::_getTip(unsigned state) "to %f° increments"), snap_increment_degrees()); }*/ return C_("Path node tip", - "<b>Shift:</b> drag out a handle, click to toggle selection"); + "<b>Shift</b>: drag out a handle, click to toggle selection"); } - return C_("Path node tip", "<b>Shift:</b> click to toggle selection"); + return C_("Path node tip", "<b>Shift</b>: click to toggle selection"); } if (state_held_control(state)) { if (state_held_alt(state)) { - return C_("Path node tip", "<b>Ctrl+Alt:</b> move along handle lines, click to delete node"); + return C_("Path node tip", "<b>Ctrl+Alt</b>: move along handle lines, click to delete node"); } return C_("Path node tip", - "<b>Ctrl:</b> move along axes, click to change node type"); + "<b>Ctrl</b>: move along axes, click to change node type"); } if (state_held_alt(state)) { - return C_("Path node tip", "<b>Alt:</b> sculpt nodes"); + return C_("Path node tip", "<b>Alt</b>: sculpt nodes"); } // No modifiers: assemble tip from node type @@ -1165,13 +1163,13 @@ Glib::ustring Node::_getTip(unsigned state) if (_selection.transformHandlesEnabled() && selected()) { if (_selection.size() == 1) { return format_tip(C_("Path node tip", - "<b>%s:</b> drag to shape the path (more: Shift, Ctrl, Alt)"), nodetype); + "<b>%s</b>: drag to shape the path (more: Shift, Ctrl, Alt)"), nodetype); } return format_tip(C_("Path node tip", - "<b>%s:</b> drag to shape the path, click to toggle scale/rotation handles (more: Shift, Ctrl, Alt)"), nodetype); + "<b>%s</b>: drag to shape the path, click to toggle scale/rotation handles (more: Shift, Ctrl, Alt)"), nodetype); } return format_tip(C_("Path node tip", - "<b>%s:</b> drag to shape the path, click to select only this node (more: Shift, Ctrl, Alt)"), nodetype); + "<b>%s</b>: drag to shape the path, click to select only this node (more: Shift, Ctrl, Alt)"), nodetype); } Glib::ustring Node::_getDragTip(GdkEventMotion */*event*/) diff --git a/src/ui/tool/transform-handle-set.cpp b/src/ui/tool/transform-handle-set.cpp index 1af848b96..6b8fb4c11 100644 --- a/src/ui/tool/transform-handle-set.cpp +++ b/src/ui/tool/transform-handle-set.cpp @@ -134,21 +134,21 @@ protected: if (state_held_control(state)) { if (state_held_shift(state)) { return C_("Transform handle tip", - "<b>Shift+Ctrl:</b> scale uniformly about the rotation center"); + "<b>Shift+Ctrl</b>: scale uniformly about the rotation center"); } return C_("Transform handle tip", "<b>Ctrl:</b> scale uniformly"); } if (state_held_shift(state)) { if (state_held_alt(state)) { return C_("Transform handle tip", - "<b>Shift+Alt:</b> scale using an integer ratio about the rotation center"); + "<b>Shift+Alt</b>: scale using an integer ratio about the rotation center"); } - return C_("Transform handle tip", "<b>Shift:</b> scale from the rotation center"); + return C_("Transform handle tip", "<b>Shift</b>: scale from the rotation center"); } if (state_held_alt(state)) { - return C_("Transform handle tip", "<b>Alt:</b> scale using an integer ratio"); + return C_("Transform handle tip", "<b>Alt</b>: scale using an integer ratio"); } - return C_("Transform handle tip", "<b>Scale handle:</b> drag to scale the selection"); + return C_("Transform handle tip", "<b>Scale handle</b>: drag to scale the selection"); } virtual Glib::ustring _getDragTip(GdkEventMotion */*event*/) { @@ -308,16 +308,16 @@ protected: if (state_held_shift(state)) { if (state_held_control(state)) { return format_tip(C_("Transform handle tip", - "<b>Shift+Ctrl:</b> rotate around the opposite corner and snap " + "<b>Shift+Ctrl</b>: rotate around the opposite corner and snap " "angle to %f° increments"), snap_increment_degrees()); } - return C_("Transform handle tip", "<b>Shift:</b> rotate around the opposite corner"); + return C_("Transform handle tip", "<b>Shift</b>: rotate around the opposite corner"); } if (state_held_control(state)) { return format_tip(C_("Transform handle tip", - "<b>Ctrl:</b> snap angle to %f° increments"), snap_increment_degrees()); + "<b>Ctrl</b>: snap angle to %f° increments"), snap_increment_degrees()); } - return C_("Transform handle tip", "<b>Rotation handle:</b> drag to rotate " + return C_("Transform handle tip", "<b>Rotation handle</b>: drag to rotate " "the selection around the rotation center"); } @@ -416,17 +416,17 @@ protected: if (state_held_shift(state)) { if (state_held_control(state)) { return format_tip(C_("Transform handle tip", - "<b>Shift+Ctrl:</b> skew about the rotation center with snapping " + "<b>Shift+Ctrl</b>: skew about the rotation center with snapping " "to %f° increments"), snap_increment_degrees()); } - return C_("Transform handle tip", "<b>Shift:</b> skew about the rotation center"); + return C_("Transform handle tip", "<b>Shift</b>: skew about the rotation center"); } if (state_held_control(state)) { return format_tip(C_("Transform handle tip", - "<b>Ctrl:</b> snap skew angle to %f° increments"), snap_increment_degrees()); + "<b>Ctrl</b>: snap skew angle to %f° increments"), snap_increment_degrees()); } return C_("Transform handle tip", - "<b>Skew handle:</b> drag to skew (shear) selection about " + "<b>Skew handle</b>: drag to skew (shear) selection about " "the opposite handle"); } @@ -476,7 +476,7 @@ protected: virtual Glib::ustring _getTip(unsigned /*state*/) { return C_("Transform handle tip", - "<b>Rotation center:</b> drag to change the origin of transforms"); + "<b>Rotation center</b>: drag to change the origin of transforms"); } private: diff --git a/src/ui/uxmanager.cpp b/src/ui/uxmanager.cpp index 3c6f85b91..a3ccb3471 100644 --- a/src/ui/uxmanager.cpp +++ b/src/ui/uxmanager.cpp @@ -16,10 +16,12 @@ #include <algorithm> #include "uxmanager.h" +#include "desktop.h" #include "util/ege-tags.h" #include "widgets/toolbox.h" #include "widgets/desktop-widget.h" #include "preferences.h" +#include "gdkmm/screen.h" #ifdef GDK_WINDOWING_X11 #include <gdk/gdkx.h> @@ -38,23 +40,72 @@ static vector<SPDesktopWidget*> dtws; static map<SPDesktop*, vector<GtkWidget*> > trackedBoxes; +namespace { +// TODO unify this later: +static Glib::ustring getLayoutPrefPath( Inkscape::UI::View::View *view ) +{ + Glib::ustring prefPath; + + if (reinterpret_cast<SPDesktop*>(view)->is_focusMode()) { + prefPath = "/focus/"; + } else if (reinterpret_cast<SPDesktop*>(view)->is_fullscreen()) { + prefPath = "/fullscreen/"; + } else { + prefPath = "/window/"; + } + + return prefPath; +} + +} namespace Inkscape { namespace UI { UXManager* instance = 0; +class UXManagerImpl : public UXManager +{ +public: + UXManagerImpl(); + virtual ~UXManagerImpl(); + + virtual void addTrack( SPDesktopWidget* dtw ); + virtual void delTrack( SPDesktopWidget* dtw ); + + virtual void connectToDesktop( vector<GtkWidget *> const & toolboxes, SPDesktop *desktop ); + + virtual gint getDefaultTask( SPDesktop *desktop ); + virtual void setTask(SPDesktop* dt, gint val); + + virtual bool isFloatWindowProblem() const; + virtual bool isWidescreen() const; + +private: + bool _floatwindowIssues; + bool _widescreen; +}; + UXManager* UXManager::getInstance() { if (!instance) { - instance = new UXManager(); + instance = new UXManagerImpl(); } return instance; } -UXManager::UXManager() : - floatwindowIssues(false) +UXManager::UXManager() +{ +} + +UXManager::~UXManager() +{ +} + +UXManagerImpl::UXManagerImpl() : + _floatwindowIssues(false), + _widescreen(false) { ege::TagSet tags; tags.setLang("en"); @@ -68,24 +119,50 @@ UXManager::UXManager() : //if (g_ascii_strcasecmp( wmName, UNKOWN_WINDOW_MANAGER_NAME ) == 0) { if (g_ascii_strcasecmp( wmName, KDE_WINDOW_MANAGER_NAME ) == 0) { - floatwindowIssues = true; + _floatwindowIssues = true; } #elif defined(GDK_WINDOWING_WIN32) - floatwindowIssues = true; + _floatwindowIssues = true; #endif // GDK_WINDOWING_WIN32 + + + Glib::RefPtr<Gdk::Screen> defaultScreen = Gdk::Screen::get_default(); + if (defaultScreen) { + int width = defaultScreen->get_width(); + int height = defaultScreen->get_height(); + gdouble aspect = static_cast<gdouble>(width) / static_cast<gdouble>(height); + if (aspect > 1.65) { + _widescreen = true; + } + } } -UXManager::~UXManager() +UXManagerImpl::~UXManagerImpl() { } +bool UXManagerImpl::isFloatWindowProblem() const +{ + return _floatwindowIssues; +} + +bool UXManagerImpl::isWidescreen() const +{ + return _widescreen; +} -bool UXManager::isFloatWindowProblem() const +gint UXManagerImpl::getDefaultTask( SPDesktop *desktop ) { - return floatwindowIssues; + gint taskNum = isWidescreen() ? 2 : 0; + + Glib::ustring prefPath = getLayoutPrefPath( desktop ); + taskNum = Inkscape::Preferences::get()->getInt( prefPath + "task/taskset", taskNum ); + taskNum = (taskNum < 0) ? 0 : (taskNum > 2) ? 2 : taskNum; + + return taskNum; } -void UXManager::setTask(SPDesktop* dt, gint val) +void UXManagerImpl::setTask(SPDesktop* dt, gint val) { for (vector<SPDesktopWidget*>::iterator it = dtws.begin(); it != dtws.end(); ++it) { SPDesktopWidget* dtw = *it; @@ -93,6 +170,7 @@ void UXManager::setTask(SPDesktop* dt, gint val) gboolean notDone = Inkscape::Preferences::get()->getBool("/options/workarounds/dynamicnotdone", false); if (dtw->desktop == dt) { + int taskNum = val; switch (val) { default: case 0: @@ -101,15 +179,16 @@ void UXManager::setTask(SPDesktop* dt, gint val) if (notDone) { dtw->setToolboxPosition("AuxToolbar", GTK_POS_TOP); } - dtw->setToolboxPosition("SnapToolbar", GTK_POS_TOP); + dtw->setToolboxPosition("SnapToolbar", GTK_POS_RIGHT); + taskNum = val; // in case it was out of range break; case 1: - dtw->setToolboxPosition("ToolToolbar", GTK_POS_TOP); - dtw->setToolboxPosition("CommandsToolbar", GTK_POS_LEFT); + dtw->setToolboxPosition("ToolToolbar", GTK_POS_LEFT); + dtw->setToolboxPosition("CommandsToolbar", GTK_POS_TOP); if (notDone) { dtw->setToolboxPosition("AuxToolbar", GTK_POS_TOP); } - dtw->setToolboxPosition("SnapToolbar", GTK_POS_RIGHT); + dtw->setToolboxPosition("SnapToolbar", GTK_POS_TOP); break; case 2: dtw->setToolboxPosition("ToolToolbar", GTK_POS_LEFT); @@ -119,19 +198,21 @@ void UXManager::setTask(SPDesktop* dt, gint val) dtw->setToolboxPosition("AuxToolbar", GTK_POS_RIGHT); } } + Glib::ustring prefPath = getLayoutPrefPath( dtw->desktop ); + Inkscape::Preferences::get()->setInt( prefPath + "task/taskset", taskNum ); } } } -void UXManager::addTrack( SPDesktopWidget* dtw ) +void UXManagerImpl::addTrack( SPDesktopWidget* dtw ) { if (std::find(dtws.begin(), dtws.end(), dtw) == dtws.end()) { dtws.push_back(dtw); } } -void UXManager::delTrack( SPDesktopWidget* dtw ) +void UXManagerImpl::delTrack( SPDesktopWidget* dtw ) { vector<SPDesktopWidget*>::iterator iter = std::find(dtws.begin(), dtws.end(), dtw); if (iter != dtws.end()) { @@ -139,9 +220,9 @@ void UXManager::delTrack( SPDesktopWidget* dtw ) } } -void UXManager::connectToDesktop( vector<GtkWidget *> const & toolboxes, SPDesktop *desktop ) +void UXManagerImpl::connectToDesktop( vector<GtkWidget *> const & toolboxes, SPDesktop *desktop ) { -//static map<SPDesktop*, vector<GtkWidget*> > trackedBoxes; + //static map<SPDesktop*, vector<GtkWidget*> > trackedBoxes; for (vector<GtkWidget*>::const_iterator it = toolboxes.begin(); it != toolboxes.end(); ++it ) { GtkWidget* toolbox = *it; @@ -156,6 +237,11 @@ void UXManager::connectToDesktop( vector<GtkWidget *> const & toolboxes, SPDeskt if (std::find(desktops.begin(), desktops.end(), desktop) == desktops.end()) { desktops.push_back(desktop); } + + gint taskNum = getDefaultTask( desktop ); + + // note: this will change once more options are in the task set support: + Inkscape::UI::UXManager::getInstance()->setTask( desktop, taskNum ); } diff --git a/src/ui/uxmanager.h b/src/ui/uxmanager.h index aecda2b5e..5fef08f11 100644 --- a/src/ui/uxmanager.h +++ b/src/ui/uxmanager.h @@ -34,19 +34,23 @@ public: static UXManager* getInstance(); virtual ~UXManager(); - void addTrack( SPDesktopWidget* dtw ); - void delTrack( SPDesktopWidget* dtw ); + virtual void addTrack( SPDesktopWidget* dtw ) = 0; + virtual void delTrack( SPDesktopWidget* dtw ) = 0; - void connectToDesktop( std::vector<GtkWidget *> const & toolboxes, SPDesktop *desktop ); + virtual void connectToDesktop( std::vector<GtkWidget *> const & toolboxes, SPDesktop *desktop ) = 0; - void setTask(SPDesktop* dt, gint val); + virtual gint getDefaultTask( SPDesktop *desktop ) = 0; + virtual void setTask( SPDesktop* dt, gint val ) = 0; - bool isFloatWindowProblem() const; + virtual bool isFloatWindowProblem() const = 0; + virtual bool isWidescreen() const = 0; -private: +protected: UXManager(); - bool floatwindowIssues; +private: + UXManager( UXManager const & ); + UXManager & operator=( UXManager const & ); }; } // namespace UI diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index e604a24ec..26763cc77 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -18,25 +18,26 @@ # include <config.h> #endif -#include <string.h> -#include <vector> -#include <string> - #include <cmath> #include <gtkmm.h> -#include "ui/widget/button.h" - -#include "ui/widget/scalar-unit.h" +#include <string> +#include <string.h> +#include <vector> -#include "helper/units.h" -#include "inkscape.h" -#include "verbs.h" #include "desktop-handles.h" #include "document.h" #include "desktop.h" -#include "page-sizer.h" #include "helper/action.h" +#include "helper/units.h" +#include "inkscape.h" +#include "page-sizer.h" +#include "sp-namedview.h" #include "sp-root.h" +#include "ui/widget/button.h" +#include "ui/widget/scalar-unit.h" +#include "verbs.h" +#include "xml/node.h" +#include "xml/repr.h" using std::pair; @@ -310,9 +311,17 @@ PageSizer::PageSizer(Registry & _wr) _customDimTable.attach(_dimensionHeight, 0,1, 1,2); _customDimTable.attach(_fitPageMarginExpander, 0,2, 2,3); + _dimTabOrderGList = NULL; + _dimTabOrderGList = g_list_append(_dimTabOrderGList, _dimensionWidth.gobj()); + _dimTabOrderGList = g_list_append(_dimTabOrderGList, _dimensionHeight.gobj()); + _dimTabOrderGList = g_list_append(_dimTabOrderGList, _dimensionUnits.gobj()); + _dimTabOrderGList = g_list_append(_dimTabOrderGList, _fitPageMarginExpander.gobj()); + Glib::ListHandle<Widget *> dimFocusChain(_dimTabOrderGList, Glib::OWNERSHIP_NONE); + _customDimTable.set_focus_chain(dimFocusChain); + //## Set up fit page expander - _fitPageMarginExpander.set_label(_("Resi_ze page to content...")); _fitPageMarginExpander.set_use_underline(); + _fitPageMarginExpander.set_label(_("Resi_ze page to content...")); _fitPageMarginExpander.add(_marginTable); //## Set up margin settings @@ -320,11 +329,11 @@ PageSizer::PageSizer(Registry & _wr) _marginTable.set_border_width(4); _marginTable.set_row_spacings(4); _marginTable.set_col_spacings(4); - _marginTable.attach(_fitPageButtonAlign, 0,2, 0,1); - _marginTable.attach(_marginTopAlign, 0,2, 1,2); - _marginTable.attach(_marginLeftAlign, 0,1, 2,3); - _marginTable.attach(_marginRightAlign, 1,2, 2,3); - _marginTable.attach(_marginBottomAlign, 0,2, 3,4); + _marginTable.attach(_marginTopAlign, 0,2, 0,1); + _marginTable.attach(_marginLeftAlign, 0,1, 1,2); + _marginTable.attach(_marginRightAlign, 1,2, 1,2); + _marginTable.attach(_marginBottomAlign, 0,2, 2,3); + _marginTable.attach(_fitPageButtonAlign, 0,2, 3,4); _marginTopAlign.set(0.5, 0.5, 0.0, 1.0); _marginTopAlign.add(_marginTop); @@ -349,6 +358,7 @@ PageSizer::PageSizer(Registry & _wr) */ PageSizer::~PageSizer() { + g_list_free(_dimTabOrderGList); } @@ -437,6 +447,28 @@ PageSizer::setDim (double w, double h, bool changeList) _called = false; } +/** + * Updates the scalar widgets for the fit margins. (Just changes the value + * of the ui widgets to match the xml). + */ +void +PageSizer::updateFitMarginsUI(Inkscape::XML::Node *nv_repr) +{ + double value = 0.0; + if (sp_repr_get_double(nv_repr, "fit-margin-top", &value)) { + _marginTop.setValue(value); + } + if (sp_repr_get_double(nv_repr, "fit-margin-left", &value)) { + _marginLeft.setValue(value); + } + if (sp_repr_get_double(nv_repr, "fit-margin-right", &value)) { + _marginRight.setValue(value); + } + if (sp_repr_get_double(nv_repr, "fit-margin-bottom", &value)) { + _marginBottom.setValue(value); + } +} + /** * Returns an iterator pointing to a row in paperSizeListStore which @@ -492,11 +524,23 @@ PageSizer::fire_fit_canvas_to_selection_or_drawing() if (!dt) { return; } + SPDocument *doc; + SPNamedView *nv; + Inkscape::XML::Node *nv_repr; + if ((doc = sp_desktop_document(SP_ACTIVE_DESKTOP)) + && (nv = sp_document_namedview(doc, 0)) + && (nv_repr = SP_OBJECT_REPR(nv))) { + sp_repr_set_svg_double(nv_repr, "fit-margin-top", _marginTop.getValue()); + sp_repr_set_svg_double(nv_repr, "fit-margin-left", _marginLeft.getValue()); + sp_repr_set_svg_double(nv_repr, "fit-margin-right", _marginRight.getValue()); + sp_repr_set_svg_double(nv_repr, "fit-margin-bottom", _marginBottom.getValue()); + } Verb *verb = Verb::get( SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING ); if (verb) { SPAction *action = verb->get_action(dt); - if (action) + if (action) { sp_action_perform(action, NULL); + } } } diff --git a/src/ui/widget/page-sizer.h b/src/ui/widget/page-sizer.h index 718eb95b5..ba6c8dd13 100644 --- a/src/ui/widget/page-sizer.h +++ b/src/ui/widget/page-sizer.h @@ -14,10 +14,11 @@ #include <gtkmm.h> #include <sigc++/sigc++.h> + +#include "helper/units.h" #include "ui/widget/registry.h" #include "ui/widget/registered-widget.h" -#include "helper/units.h" - +#include "xml/node.h" namespace Inkscape { namespace UI { @@ -141,6 +142,12 @@ public: * true, then reset the paper size list to the closest match */ void setDim (double w, double h, bool changeList=true); + + /** + * Updates the scalar widgets for the fit margins. (Just changes the value + * of the ui widgets to match the xml). + */ + void updateFitMarginsUI(Inkscape::XML::Node *nv_repr); protected: @@ -196,6 +203,7 @@ protected: RegisteredUnitMenu _dimensionUnits; RegisteredScalarUnit _dimensionWidth; RegisteredScalarUnit _dimensionHeight; + GList * _dimTabOrderGList; //### Fit Page options Gtk::Expander _fitPageMarginExpander; |
