diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2013-08-18 21:05:56 +0000 |
|---|---|---|
| committer | Javiertxo <jtx@jtx.marker.es> | 2013-08-18 21:05:56 +0000 |
| commit | ac014eea08f219ba91c6c31240e140c0b7e67ad5 (patch) | |
| tree | 76ca4df51a837392a25c701a5c1c8810d7364b98 | |
| parent | update to trunk (diff) | |
| parent | Prevent writing out empty style strings. (diff) | |
| download | inkscape-ac014eea08f219ba91c6c31240e140c0b7e67ad5.tar.gz inkscape-ac014eea08f219ba91c6c31240e140c0b7e67ad5.zip | |
update to trunk
(bzr r11950.1.128)
60 files changed, 1145 insertions, 167 deletions
diff --git a/Makefile.am b/Makefile.am index 66035791a..b477c84d2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -178,6 +178,7 @@ EXTRA_DIST = \ packaging/win32/languages/French.nsh \ packaging/win32/languages/Galician.nsh \ packaging/win32/languages/German.nsh \ + packaging/win32/languages/Hebrew.nsh \ packaging/win32/languages/Indonesian.nsh \ packaging/win32/languages/Italian.nsh \ packaging/win32/languages/Japanese.nsh \ diff --git a/packaging/win32/languages/Hebrew.nsh b/packaging/win32/languages/Hebrew.nsh new file mode 100644 index 000000000..b21263c75 --- /dev/null +++ b/packaging/win32/languages/Hebrew.nsh @@ -0,0 +1,113 @@ +;Language: Hebrew (1037, CP1255) +;By Yaron Shahrabani <sh.yaron@gmail.com> +${LangFileString} CaptionDescription "עורך גרפיקת וקטורים נמתחת בקוד פתוח" +${LangFileString} LICENSE_BOTTOM_TEXT "$(^Name) מופצת תחת תנאי הרישיון הציבורי הכללי של GNU (GPL). הרישיון מסופק כאן לצורכי מידע בלבד. $_CLICK" +${LangFileString} DIFFERENT_USER "אינקסקייפ הותקנה על־ידי המשתמש $0.$\r$\nאם ההתקנה תימשך יתכן שלא תושלם כראוי!$\r$\nנא להיכנס בתור $0 ולנסות שוב." +${LangFileString} WANT_UNINSTALL_BEFORE "התכנית $R1 כבר הותקנה. $\nהאם להסיר את הגרסה הקודמת בטרם התקנת $(^Name)?" +${LangFileString} OK_CANCEL_DESC "$\n$\nיש ללחוץ על אישור כדי להמשיך או על ביטול כדי לצאת." +${LangFileString} NO_ADMIN "אין לך הרשאות ניהוליות.$\r$\nהתקנת אינקסקייפ לכל המשתמשים לא תושלם כראוי.$\r$\nיש לבטל את הסימון שליד האפשרות 'התקנה לכל המשתמשים'." +${LangFileString} NOT_SUPPORTED "ידוע כי לאינקסקייפ יש אפשרות לפעול על גבי Windows 95/98/ME!$\r$\nנא להסתכל באתר הרשמי לקבלת פרטים נוספים." +${LangFileString} Full "מלאה" +${LangFileString} Optimal "מיטבית" +${LangFileString} Minimal "מינימלית" +${LangFileString} Core "עורך ה־SVN אינקסקייפ (נדרש)" +${LangFileString} CoreDesc "קובצי ליבה ו־dlls של אינקסקייפ" +${LangFileString} GTKFiles "סביבת ההפעלה GTK+ (נדרשת)" +${LangFileString} GTKFilesDesc "ערכת מנשק גרפי למגוון פלטפורמות, בשימוש אינקסקייפ" +${LangFileString} Shortcuts "קיצורי דרך" +${LangFileString} ShortcutsDesc "קיצורי דרך להפעלת אינקסקייפ" +${LangFileString} Alluser "התקנה עבור כל המשתמשים" +${LangFileString} AlluserDesc "התקנת יישום זה לטובת כל מי שמשתמש במחשב (כל המשתמשים)" +${LangFileString} Desktop "שולחן עבודה" +${LangFileString} DesktopDesc "יצירת קיצור דרך לאינקסקייפ על שולחן העבודה" +${LangFileString} Startmenu "תפריט התחלה" +${LangFileString} StartmenuDesc "יצירת רשומה לאינקסקייפ בתפריט ההתחלה" +${LangFileString} Quicklaunch "הפעלה מהירה" +${LangFileString} QuicklaunchDesc "יצירת קיצור דרך לאינקסקייפ בסרגל ההפעלה המהירה" +${LangFileString} SVGWriter "פתיחת קובצי SVG עם אינקסקייפ" +${LangFileString} SVGWriterDesc "בחירת אינקסקייפ כעורך בררת המחדל לקובצי SVG" +${LangFileString} ContextMenu "תפריט הקשר" +${LangFileString} ContextMenuDesc "הוספת אינקסקייפ לתפריט ההקשר של קובצי SVG" +${LangFileString} DeletePrefs "מחיקת העדפות אישיות" +${LangFileString} DeletePrefsDesc "מחיקת שיירי העדפות אישיות מהתקנות קודמות" +${LangFileString} Addfiles "קבצים נוספים" +${LangFileString} AddfilesDesc "קבצים נוספים" +${LangFileString} Examples "דוגמאות" +${LangFileString} ExamplesDesc "דוגמאות לשימוש באינקסקייפ" +${LangFileString} Tutorials "מדריכים" +${LangFileString} TutorialsDesc "מדריכים לשימוש באינקסקייפ" +${LangFileString} Languages "תרגומים" +${LangFileString} LanguagesDesc "התקנת מגוון תרגומים לאינקסקייפ" +${LangFileString} lng_am "אמהרית" +${LangFileString} lng_ar "ערבית" +${LangFileString} lng_az "אזרית" +${LangFileString} lng_be "בלרוסית" +${LangFileString} lng_bg "בולגרית" +${LangFileString} lng_bn "בנגלית" +${LangFileString} lng_br "ברטונית" +${LangFileString} lng_ca "קטלאנית" +${LangFileString} lng_ca@valencia "קטלאנית ולנסית" +${LangFileString} lng_cs "צ׳כית" +${LangFileString} lng_da "דנית" +${LangFileString} lng_de "גרמנית" +${LangFileString} lng_dz "דזונגקה" +${LangFileString} lng_el "יוונית" +${LangFileString} lng_en "אנגלית" +${LangFileString} lng_en_AU "אנגלית אוסטרלית" +${LangFileString} lng_en_CA "אנגלית קנדית" +${LangFileString} lng_en_GB "אנגלית בריטית" +${LangFileString} lng_en_US@piglatin "לטינית חזירית" +${LangFileString} lng_eo "אספרנטו" +${LangFileString} lng_es "ספרדית" +${LangFileString} lng_es_MX "ספרדית מקסיקנית" +${LangFileString} lng_et "אסטונית" +${LangFileString} lng_eu "בסקית" +${LangFileString} lng_fa "פרסית" +${LangFileString} lng_fi "פינית" +${LangFileString} lng_fr "צרפתית" +${LangFileString} lng_ga "אירית" +${LangFileString} lng_gl "גליסית" +${LangFileString} lng_he "עברית" +${LangFileString} lng_hr "קרואטית" +${LangFileString} lng_hu "הונגרית" +${LangFileString} lng_id "אינדונזית" +${LangFileString} lng_it "איטלקית" +${LangFileString} lng_ja "יפנית" +${LangFileString} lng_km "קמרית" +${LangFileString} lng_ko "קוריאנית" +${LangFileString} lng_lt "ליטאית" +${LangFileString} lng_mk "מקדונית" +${LangFileString} lng_mn "מונגולית" +${LangFileString} lng_ne "נפאלית" +${LangFileString} lng_nb "נורבגית בוקמולית" +${LangFileString} lng_nl "Dutch" +${LangFileString} lng_nn "נורבגית נינורשקית" +${LangFileString} lng_pa "פנג׳אבי" +${LangFileString} lng_pl "פולנית" +${LangFileString} lng_pt "פורטוגלית" +${LangFileString} lng_pt_BR "פורטוגלית בריזלאית" +${LangFileString} lng_ro "רומנית" +${LangFileString} lng_ru "רוסית" +${LangFileString} lng_rw "קיניַרואנדה" +${LangFileString} lng_sk "סלובקית" +${LangFileString} lng_sl "סלובנית" +${LangFileString} lng_sq "אלבנית" +${LangFileString} lng_sr "סרבית" +${LangFileString} lng_sr@latin "סרבית בכתב לטיני" +${LangFileString} lng_sv "שבדית" +${LangFileString} lng_te_IN "טלוגו" +${LangFileString} lng_th "תאי" +${LangFileString} lng_tr "טורקית" +${LangFileString} lng_uk "אוקראינית" +${LangFileString} lng_vi "וייטנאמית" +${LangFileString} lng_zh_CN "סינית מפושטת" +${LangFileString} lng_zh_TW "סינית מסורתית" +${LangFileString} UInstOpt "אפשרויות הסרה" +${LangFileString} UInstOpt1 "נא לבחור מהרשימה כדי להשתמש באפשרויות נוספות" +${LangFileString} PurgePrefs "שמירת ההעדפות האישיות" +${LangFileString} UninstallLogNotFound "הקובץ $INSTDIR\uninstall.log לא נמצא!$\r$\nנא להסיר על ידי פינוי התיקייה $INSTDIR בעצמך!" +${LangFileString} FileChanged "הקובץ $filename השתנה לאחר ההתקנה.$\r$\nהאם למחוק את הקובץ בכל זאת?" +${LangFileString} Yes "כן" +${LangFileString} AlwaysYes "תמיד לענות כן" +${LangFileString} No "לא" +${LangFileString} AlwaysNo "תמיד לענות לא" diff --git a/po/POTFILES.in b/po/POTFILES.in index ae38448ce..6994958e4 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -258,6 +258,9 @@ src/ui/dialog/livepatheffect-editor.cpp src/ui/dialog/livepatheffect-add.cpp src/ui/dialog/memory.cpp src/ui/dialog/messages.cpp +src/ui/dialog/new-from-template.cpp +src/ui/dialog/template-load-tab.cpp +src/ui/dialog/template-widget.cpp src/ui/dialog/object-attributes.cpp src/ui/dialog/object-properties.cpp src/ui/dialog/ocaldialogs.cpp diff --git a/share/templates/A4.svg b/share/templates/A4.svg index 63991a8f9..34df9310a 100644 --- a/share/templates/A4.svg +++ b/share/templates/A4.svg @@ -35,5 +35,10 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>A4 Page</inkscape:_name> + <inkscape:_short>Empty A4 sheet</inkscape:_short> + <inkscape:_keywords>A4 paper sheet empty</inkscape:_keywords> + </inkscape:_templateinfo> <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" /> </svg> diff --git a/share/templates/A4_landscape.svg b/share/templates/A4_landscape.svg index 934c99f6d..c95cf1642 100644 --- a/share/templates/A4_landscape.svg +++ b/share/templates/A4_landscape.svg @@ -32,5 +32,10 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>A4 Landscape Page</inkscape:_name> + <inkscape:_short>Empty A4 landscape sheet</inkscape:_short> + <inkscape:_keywords>A4 paper sheet empty landscape</inkscape:_keywords> + </inkscape:_templateinfo> <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" /> </svg> diff --git a/share/templates/CD_cover_300dpi.svg b/share/templates/CD_cover_300dpi.svg index 330ccf2dc..9030aae8b 100644 --- a/share/templates/CD_cover_300dpi.svg +++ b/share/templates/CD_cover_300dpi.svg @@ -32,5 +32,10 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>CD Cover 300dpi</inkscape:_name> + <inkscape:_short>Empty CD box cover.</inkscape:_short> + <inkscape:_keywords>CD cover disc disk 300dpi box</inkscape:_keywords> + </inkscape:_templateinfo> <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" /> </svg> diff --git a/share/templates/CD_label_120x120.svg b/share/templates/CD_label_120x120.svg index c5c74a656..cc0029e15 100644 --- a/share/templates/CD_label_120x120.svg +++ b/share/templates/CD_label_120x120.svg @@ -78,6 +78,13 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>CD Label 120x120 </inkscape:_name> + <inkscape:author>JazzyNico</inkscape:author> + <inkscape:_short>Simple CD Label template with disc's pattern.</inkscape:_short> + <inkscape:date>2010-11-15</inkscape:date> + <inkscape:_keywords>CD label 120x120 disc disk</inkscape:_keywords> + </inkscape:_templateinfo> <g inkscape:label="Layer 1" inkscape:groupmode="layer" diff --git a/share/templates/DVD_cover_regular_300dpi.svg b/share/templates/DVD_cover_regular_300dpi.svg index 8b1b854e4..66465b8ae 100644 --- a/share/templates/DVD_cover_regular_300dpi.svg +++ b/share/templates/DVD_cover_regular_300dpi.svg @@ -75,6 +75,13 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>DVD Cover Regular 300dpi </inkscape:_name> + <inkscape:author>cmarqu</inkscape:author> + <inkscape:_short>Template for both-sides DVD covers.</inkscape:_short> + <inkscape:date>2006-06-21</inkscape:date> + <inkscape:_keywords>DVD cover regular 300dpi</inkscape:_keywords> + </inkscape:_templateinfo> <g inkscape:label="Layer 1" inkscape:groupmode="layer" diff --git a/share/templates/DVD_cover_slim_300dpi.svg b/share/templates/DVD_cover_slim_300dpi.svg index 517c095d0..e9402b39a 100644 --- a/share/templates/DVD_cover_slim_300dpi.svg +++ b/share/templates/DVD_cover_slim_300dpi.svg @@ -75,6 +75,13 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>DVD Cover Slim 300dpi </inkscape:_name> + <inkscape:author>cmarqu</inkscape:author> + <inkscape:_short>Template for both-sides DVD slim covers.</inkscape:_short> + <inkscape:date>2006-06-21</inkscape:date> + <inkscape:_keywords>DVD cover slim 300dpi</inkscape:_keywords> + </inkscape:_templateinfo> <g inkscape:label="Layer 1" inkscape:groupmode="layer" diff --git a/share/templates/DVD_cover_superslim_300dpi.svg b/share/templates/DVD_cover_superslim_300dpi.svg index eed521534..842b951c1 100644 --- a/share/templates/DVD_cover_superslim_300dpi.svg +++ b/share/templates/DVD_cover_superslim_300dpi.svg @@ -75,6 +75,13 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>DVD Cover Superslim 300dpi </inkscape:_name> + <inkscape:author>cmarqu</inkscape:author> + <inkscape:_short>Template for both-sides DVD superslim covers.</inkscape:_short> + <inkscape:date>2006-06-21</inkscape:date> + <inkscape:_keywords>DVD cover superslim 300dpi</inkscape:_keywords> + </inkscape:_templateinfo> <g inkscape:label="Layer 1" inkscape:groupmode="layer" diff --git a/share/templates/DVD_cover_ultraslim_300dpi.svg b/share/templates/DVD_cover_ultraslim_300dpi.svg index 0f2a2ccdd..0f0ead540 100644 --- a/share/templates/DVD_cover_ultraslim_300dpi.svg +++ b/share/templates/DVD_cover_ultraslim_300dpi.svg @@ -75,6 +75,13 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>DVD Cover Ultraslim 300dpi </inkscape:_name> + <inkscape:author>cmarqu</inkscape:author> + <inkscape:_short>Template for both-sides DVD ultraslim covers.</inkscape:_short> + <inkscape:date>2006-06-21</inkscape:date> + <inkscape:_keywords>DVD cover ultraslim 300dpi</inkscape:_keywords> + </inkscape:_templateinfo> <g inkscape:label="Layer 1" inkscape:groupmode="layer" diff --git a/share/templates/LaTeX_Beamer.svg b/share/templates/LaTeX_Beamer.svg index 43e49ea29..50e50143f 100644 --- a/share/templates/LaTeX_Beamer.svg +++ b/share/templates/LaTeX_Beamer.svg @@ -79,6 +79,13 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>LaTeX Beamer</inkscape:_name> + <inkscape:author>jiho-sf</inkscape:author> + <inkscape:_short>LaTeX beamer template with helping grid.</inkscape:_short> + <inkscape:date>2007-05-20</inkscape:date> + <inkscape:_keywords>LaTex LaTeX latex grid beamer</inkscape:_keywords> + </inkscape:_templateinfo> <g inkscape:label="Layer 1" inkscape:groupmode="layer" diff --git a/share/templates/Letter.svg b/share/templates/Letter.svg index 9f14fdcd5..76333107d 100644 --- a/share/templates/Letter.svg +++ b/share/templates/Letter.svg @@ -32,5 +32,10 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Letter</inkscape:_name> + <inkscape:_short>Standard letter sheet - 612x792</inkscape:_short> + <inkscape:_keywords>letter 612x792 empty</inkscape:_keywords> + </inkscape:_templateinfo> <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" /> </svg> diff --git a/share/templates/Letter_landscape.svg b/share/templates/Letter_landscape.svg index 564f4bcf6..76f434d20 100644 --- a/share/templates/Letter_landscape.svg +++ b/share/templates/Letter_landscape.svg @@ -32,5 +32,10 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Letter Landscape</inkscape:_name> + <inkscape:_short>Standard letter landscape sheet - 792x612</inkscape:_short> + <inkscape:_keywords>letter landscape 792x612 empty</inkscape:_keywords> + </inkscape:_templateinfo> <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" /> </svg> diff --git a/share/templates/Typography_Canvas.svg b/share/templates/Typography_Canvas.svg index 76dd48e6f..2b9773807 100644 --- a/share/templates/Typography_Canvas.svg +++ b/share/templates/Typography_Canvas.svg @@ -75,6 +75,13 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Typography Canvas</inkscape:_name> + <inkscape:author>Felipe C. da S. Sanc...</inkscape:author> + <inkscape:_short>Empty typography canvas with helping guidelines.</inkscape:_short> + <inkscape:date>2011-05-26</inkscape:date> + <inkscape:_keywords>guidelines typography canvas</inkscape:_keywords> + </inkscape:_templateinfo> <g id="layer1" inkscape:groupmode="layer" diff --git a/share/templates/black_opaque.svg b/share/templates/black_opaque.svg index 065494f90..1b6cbbc69 100644 --- a/share/templates/black_opaque.svg +++ b/share/templates/black_opaque.svg @@ -32,5 +32,10 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Black Opaque</inkscape:_name> + <inkscape:_short>Empty black page</inkscape:_short> + <inkscape:_keywords>black opaque empty</inkscape:_keywords> + </inkscape:_templateinfo> <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" /> </svg> diff --git a/share/templates/business_card_85x54mm.svg b/share/templates/business_card_85x54mm.svg index 5febfd884..8afd13a10 100644 --- a/share/templates/business_card_85x54mm.svg +++ b/share/templates/business_card_85x54mm.svg @@ -34,5 +34,10 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Business Card 85x54mm</inkscape:_name> + <inkscape:_short>Empty business card template.</inkscape:_short> + <inkscape:_keywords>business card empty 85x54</inkscape:_keywords> + </inkscape:_templateinfo> <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" /> </svg> diff --git a/share/templates/business_card_90x50mm.svg b/share/templates/business_card_90x50mm.svg index 14e3d20d0..7b9de3640 100644 --- a/share/templates/business_card_90x50mm.svg +++ b/share/templates/business_card_90x50mm.svg @@ -34,5 +34,10 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Business Card 90x50mm</inkscape:_name> + <inkscape:_short>Empty business card template.</inkscape:_short> + <inkscape:_keywords>business card empty 90x50</inkscape:_keywords> + </inkscape:_templateinfo> <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" /> </svg> diff --git a/share/templates/desktop_1024x768.svg b/share/templates/desktop_1024x768.svg index bda4f7ae7..84d0bd097 100644 --- a/share/templates/desktop_1024x768.svg +++ b/share/templates/desktop_1024x768.svg @@ -33,5 +33,10 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Desktop 1024x768</inkscape:_name> + <inkscape:_short>Empty desktop size sheet</inkscape:_short> + <inkscape:_keywords>desktop 1024x768 wallpaper</inkscape:_keywords> + </inkscape:_templateinfo> <g id="layer1" inkscape:label="Layer 1" inkscape:groupmode="layer" /> </svg> diff --git a/share/templates/desktop_1600x1200.svg b/share/templates/desktop_1600x1200.svg index 6e98ce580..77fa49379 100644 --- a/share/templates/desktop_1600x1200.svg +++ b/share/templates/desktop_1600x1200.svg @@ -33,5 +33,10 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Desktop 1600x1200</inkscape:_name> + <inkscape:_short>Empty desktop size sheet</inkscape:_short> + <inkscape:_keywords>desktop 1600x1200 wallpaper</inkscape:_keywords> + </inkscape:_templateinfo> <g id="layer1" inkscape:label="Layer 1" inkscape:groupmode="layer" /> </svg> diff --git a/share/templates/desktop_640x480.svg b/share/templates/desktop_640x480.svg index f6f338015..9fee0812c 100644 --- a/share/templates/desktop_640x480.svg +++ b/share/templates/desktop_640x480.svg @@ -33,5 +33,10 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Desktop 640x480</inkscape:_name> + <inkscape:_short>Empty desktop size sheet</inkscape:_short> + <inkscape:_keywords>desktop 640x480 wallpaper</inkscape:_keywords> + </inkscape:_templateinfo> <g id="layer1" inkscape:label="Layer 1" inkscape:groupmode="layer" /> </svg> diff --git a/share/templates/desktop_800x600.svg b/share/templates/desktop_800x600.svg index b06632cf5..61b250b4b 100644 --- a/share/templates/desktop_800x600.svg +++ b/share/templates/desktop_800x600.svg @@ -34,5 +34,10 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Desktop 800x600</inkscape:_name> + <inkscape:_short>Empty desktop size sheet</inkscape:_short> + <inkscape:_keywords>desktop 800x600 wallpaper</inkscape:_keywords> + </inkscape:_templateinfo> <g id="layer1" inkscape:label="Layer 1" inkscape:groupmode="layer" /> </svg> diff --git a/share/templates/fontforge_glyph.svg b/share/templates/fontforge_glyph.svg index 6d007f0d0..84ea05753 100644 --- a/share/templates/fontforge_glyph.svg +++ b/share/templates/fontforge_glyph.svg @@ -46,6 +46,12 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Fontforge Glyph</inkscape:_name> + <inkscape:author>prokoudine</inkscape:author> + <inkscape:date>2007-11-11</inkscape:date> + <inkscape:_keywords>font fontforge glyph 1000x1000</inkscape:_keywords> + </inkscape:_templateinfo> <g inkscape:label="Layer 1" inkscape:groupmode="layer" diff --git a/share/templates/icon_16x16.svg b/share/templates/icon_16x16.svg index f90bc0a5b..c21c5c1a1 100644 --- a/share/templates/icon_16x16.svg +++ b/share/templates/icon_16x16.svg @@ -35,6 +35,11 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Icon 16x16</inkscape:_name> + <inkscape:_short>Small 16x16 icon template.</inkscape:_short> + <inkscape:_keywords>icon 16x16 empty</inkscape:_keywords> + </inkscape:_templateinfo> <g id="layer1" inkscape:label="Layer 1" diff --git a/share/templates/icon_32x32.svg b/share/templates/icon_32x32.svg index d332dbe5d..1ad51df05 100644 --- a/share/templates/icon_32x32.svg +++ b/share/templates/icon_32x32.svg @@ -35,6 +35,11 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Icon 32x32</inkscape:_name> + <inkscape:_short>32x32 icon template.</inkscape:_short> + <inkscape:_keywords>icon 32x32 empty</inkscape:_keywords> + </inkscape:_templateinfo> <g id="layer1" inkscape:label="Layer 1" diff --git a/share/templates/icon_48x48.svg b/share/templates/icon_48x48.svg index d3946ff2d..ff4c0fb76 100644 --- a/share/templates/icon_48x48.svg +++ b/share/templates/icon_48x48.svg @@ -35,6 +35,11 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Icon 48x48</inkscape:_name> + <inkscape:_short>48x48 icon template.</inkscape:_short> + <inkscape:_keywords>icon 48x48 empty</inkscape:_keywords> + </inkscape:_templateinfo> <g id="layer1" inkscape:label="Layer 1" diff --git a/share/templates/icon_64x64.svg b/share/templates/icon_64x64.svg index e777e9dde..aac328323 100644 --- a/share/templates/icon_64x64.svg +++ b/share/templates/icon_64x64.svg @@ -36,6 +36,11 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Icon 64x64</inkscape:_name> + <inkscape:_short>64x64 icon template.</inkscape:_short> + <inkscape:_keywords>icon 64x64 empty</inkscape:_keywords> + </inkscape:_templateinfo> <g id="layer1" inkscape:label="Layer 1" diff --git a/share/templates/no_borders.svg b/share/templates/no_borders.svg index 874b21c11..70b5e4b32 100644 --- a/share/templates/no_borders.svg +++ b/share/templates/no_borders.svg @@ -33,5 +33,10 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>No Borders</inkscape:_name> + <inkscape:_short>Empty sheet with no borders</inkscape:_short> + <inkscape:_keywords>no borders empty</inkscape:_keywords> + </inkscape:_templateinfo> <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" /> </svg> diff --git a/share/templates/no_layers.svg b/share/templates/no_layers.svg index adb50f8e8..e887ad508 100644 --- a/share/templates/no_layers.svg +++ b/share/templates/no_layers.svg @@ -32,4 +32,9 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>No Layers</inkscape:_name> + <inkscape:_short>Empty sheet with no layers</inkscape:_short> + <inkscape:_keywords>no layers empty</inkscape:_keywords> + </inkscape:_templateinfo> </svg> diff --git a/share/templates/video_HDTV_1920x1080.svg b/share/templates/video_HDTV_1920x1080.svg index 050679aa7..c28082139 100644 --- a/share/templates/video_HDTV_1920x1080.svg +++ b/share/templates/video_HDTV_1920x1080.svg @@ -33,5 +33,12 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Video HDTV 1920x1080</inkscape:_name> + <inkscape:author>popolon2</inkscape:author> + <inkscape:_short>HDTV video template for 1920x1080 resolution.</inkscape:_short> + <inkscape:date>2006-10-14</inkscape:date> + <inkscape:_keywords>HDTV video empty 1920x1080</inkscape:_keywords> + </inkscape:_templateinfo> <g id="layer1" inkscape:label="Layer 1" inkscape:groupmode="layer" /> </svg> diff --git a/share/templates/video_NTSC_720x486.svg b/share/templates/video_NTSC_720x486.svg index f3ebe670b..22ee28205 100644 --- a/share/templates/video_NTSC_720x486.svg +++ b/share/templates/video_NTSC_720x486.svg @@ -33,5 +33,12 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Video NTSC 720x486</inkscape:_name> + <inkscape:author>popolon2</inkscape:author> + <inkscape:_short>NTSC video template for 720x486 resolution.</inkscape:_short> + <inkscape:date>2006-10-14</inkscape:date> + <inkscape:_keywords>NTSC video empty 720x486</inkscape:_keywords> + </inkscape:_templateinfo> <g id="layer1" inkscape:label="Layer 1" inkscape:groupmode="layer" /> </svg> diff --git a/share/templates/video_PAL_720x576.svg b/share/templates/video_PAL_720x576.svg index ee861b2fb..548176adf 100644 --- a/share/templates/video_PAL_720x576.svg +++ b/share/templates/video_PAL_720x576.svg @@ -33,5 +33,12 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Video PAL 728x576</inkscape:_name> + <inkscape:author>popolon2</inkscape:author> + <inkscape:_short>PAL video template for 728x576 resolution.</inkscape:_short> + <inkscape:date>2006-10-14</inkscape:date> + <inkscape:_keywords>PAL video empty 728x576</inkscape:_keywords> + </inkscape:_templateinfo> <g id="layer1" inkscape:label="Layer 1" inkscape:groupmode="layer" /> </svg> diff --git a/share/templates/web_banner_468x60.svg b/share/templates/web_banner_468x60.svg index 90fceb7de..9ca37f075 100644 --- a/share/templates/web_banner_468x60.svg +++ b/share/templates/web_banner_468x60.svg @@ -33,5 +33,10 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Web Banner 468x60</inkscape:_name> + <inkscape:_short>Empty 468x60 web banner template.</inkscape:_short> + <inkscape:_keywords>web banner 468x60 empty</inkscape:_keywords> + </inkscape:_templateinfo> <g id="layer1" inkscape:label="Layer 1" inkscape:groupmode="layer" /> </svg> diff --git a/share/templates/web_banner_728x90.svg b/share/templates/web_banner_728x90.svg index dc35b21bf..48f7237a4 100644 --- a/share/templates/web_banner_728x90.svg +++ b/share/templates/web_banner_728x90.svg @@ -33,5 +33,10 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Web Banner 728x90</inkscape:_name> + <inkscape:_short>Empty 728x90 web banner template.</inkscape:_short> + <inkscape:_keywords>web banner 728x90 empty</inkscape:_keywords> + </inkscape:_templateinfo> <g id="layer1" inkscape:label="Layer 1" inkscape:groupmode="layer" /> </svg> diff --git a/share/templates/web_banners.svg b/share/templates/web_banners.svg index 20fd9c41d..b074ac597 100644 --- a/share/templates/web_banners.svg +++ b/share/templates/web_banners.svg @@ -57,6 +57,13 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>Web Banners Collection</inkscape:_name> + <inkscape:author>Aurֳ©lio A. Heckert</inkscape:author> + <inkscape:_short>A collection of standard web banners</inkscape:_short> + <inkscape:date>2010-05-27</inkscape:date> + <inkscape:_keywords>web banners collection</inkscape:_keywords> + </inkscape:_templateinfo> <g inkscape:label="Camada 1" inkscape:groupmode="layer" diff --git a/share/templates/white_opaque.svg b/share/templates/white_opaque.svg index 8f2022b0b..d9f99d1ab 100644 --- a/share/templates/white_opaque.svg +++ b/share/templates/white_opaque.svg @@ -33,5 +33,10 @@ </cc:Work> </rdf:RDF> </metadata> + <inkscape:_templateinfo> + <inkscape:_name>White Opaque</inkscape:_name> + <inkscape:_short>Empty white page</inkscape:_short> + <inkscape:_keywords>white opaque empty</inkscape:_keywords> + </inkscape:_templateinfo> <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" /> </svg> diff --git a/src/attribute-rel-util.cpp b/src/attribute-rel-util.cpp index 933339632..15c71daa7 100644 --- a/src/attribute-rel-util.cpp +++ b/src/attribute-rel-util.cpp @@ -141,7 +141,11 @@ void sp_attribute_clean_style(Node *repr, unsigned int flags) { // sp_repr_css_set( repr, css, "style"); // Don't use as it will cause loop. Glib::ustring value; sp_repr_css_write_string(css, value); - repr->setAttribute("style", value.c_str()); + if( value.empty() ) { + repr->setAttribute("style", NULL ); + } else { + repr->setAttribute("style", value.c_str()); + } sp_repr_css_attr_unref( css ); } diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index a3d2fd6e5..3ce537d9f 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -94,7 +94,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View new_group->appendChild(new_items[i]); selection->add(new_items[i]); - sp_selected_path_to_curves(static_cast<SPDesktop *>(desktop)); + sp_selected_path_to_curves(selection, static_cast<SPDesktop *>(desktop)); if (offset < 0.0) { /* Doing an inset here folks */ diff --git a/src/file.cpp b/src/file.cpp index 5007cd901..68e229e62 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -128,21 +128,46 @@ SPDesktop *sp_file_new(const Glib::ustring &templ) { SPDocument *doc = SPDocument::createNewDoc( !templ.empty() ? templ.c_str() : 0 , TRUE, true ); g_return_val_if_fail(doc != NULL, NULL); + + // Remove all the template info from xml tree + Inkscape::XML::Node *myRoot = doc->getReprRoot(); + Inkscape::XML::Node *nodeToRemove = sp_repr_lookup_name(myRoot, "inkscape:_templateinfo"); + if (nodeToRemove != NULL){ + sp_repr_unparent(nodeToRemove); + delete nodeToRemove; + DocumentUndo::clearUndo(doc); + } + + SPDesktop *desktop = SP_ACTIVE_DESKTOP; + if (desktop) { + desktop->setWaitingCursor(); + } + + SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL; + + if (existing && existing->virgin) { + // If the current desktop is empty, open the document there + doc->ensureUpToDate(); // TODO this will trigger broken link warnings, etc. + desktop->change_document(doc); + doc->emitResizedSignal(doc->getWidth(), doc->getHeight()); + } else { + // create a whole new desktop and window + SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); // TODO this will trigger broken link warnings, etc. + g_return_val_if_fail(dtw != NULL, NULL); + sp_create_window(dtw, TRUE); + desktop = static_cast<SPDesktop *>(dtw->view); + } - SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); - g_return_val_if_fail(dtw != NULL, NULL); doc->doUnref(); - sp_create_window(dtw, TRUE); - SPDesktop *dt = static_cast<SPDesktop *>(dtw->view); - sp_namedview_window_from_document(dt); - sp_namedview_update_layers_from_document(dt); + sp_namedview_window_from_document(desktop); + sp_namedview_update_layers_from_document(desktop); #ifdef WITH_DBUS - Inkscape::Extension::Dbus::dbus_init_desktop_interface(dt); + Inkscape::Extension::Dbus::dbus_init_desktop_interface(desktop); #endif - return dt; + return desktop; } Glib::ustring sp_file_default_template_uri() @@ -200,6 +225,7 @@ SPDesktop* sp_file_new_default() return desk; } + /*###################### ## D E L E T E ######################*/ @@ -232,7 +258,8 @@ sp_file_exit() */ bool sp_file_open(const Glib::ustring &uri, Inkscape::Extension::Extension *key, - bool add_to_recent, bool replace_empty) + bool add_to_recent, + bool replace_empty) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; if (desktop) { @@ -257,6 +284,7 @@ bool sp_file_open(const Glib::ustring &uri, } if (doc) { + SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL; if (existing && existing->virgin && replace_empty) { @@ -273,7 +301,7 @@ bool sp_file_open(const Glib::ustring &uri, doc->virgin = FALSE; - // everyone who cares now has a reference, get rid of ours + // everyone who cares now has a reference, get rid of our`s doc->doUnref(); // resize the window to match the document properties diff --git a/src/file.h b/src/file.h index eeb4c6fc5..682ca422e 100644 --- a/src/file.h +++ b/src/file.h @@ -62,6 +62,7 @@ void sp_file_exit (void); /** * Opens a new file and window from the given URI */ + bool sp_file_open( const Glib::ustring &uri, Inkscape::Extension::Extension *key, diff --git a/src/interface.cpp b/src/interface.cpp index 98c30bf3c..026890c67 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -717,13 +717,6 @@ sp_recent_open(GtkRecentChooser *recent_menu, gpointer /*user_data*/) g_free(uri); } -static void -sp_file_new_from_template(GtkWidget */*widget*/, gchar const *uri) -{ - sp_file_new(uri); -} - - static bool compare_file_basenames(gchar const *a, gchar const *b) { bool rc; @@ -752,91 +745,6 @@ compare_file_basenames(gchar const *a, gchar const *b) { } static void -sp_menu_get_svg_filenames_from_dir(gchar const *dirname, std::list<gchar const*> *files) -{ - if ( Inkscape::IO::file_test( dirname, (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) ) ) { - GError *err = 0; - GDir *dir = g_dir_open(dirname, 0, &err); - - if (dir) { - for (gchar const *file = g_dir_read_name(dir); file != NULL; file = g_dir_read_name(dir)) { - if (!g_str_has_suffix(file, ".svg") && !g_str_has_suffix(file, ".svgz")) { - continue; // skip non-svg files - } - - { - gchar *basename = g_path_get_basename(file); - if (g_str_has_suffix(basename, ".svg") && g_str_has_prefix(basename, "default.")) { - g_free(basename); - basename = 0; - continue; // skip default.*.svg (i.e. default.svg and translations) - it's in the menu already - } - g_free(basename); - basename = 0; - } - - gchar const *filepath = g_build_filename(dirname, file, NULL); - files->push_front(filepath); - } - g_dir_close(dir); - } - } - - files->sort(compare_file_basenames); -} - -static void -sp_menu_add_filenames_to_menu(GtkWidget *menu, Inkscape::UI::View::View *view, std::list<gchar const*> *files) -{ - if (!files->empty()) { - GtkWidget *sep = gtk_separator_menu_item_new(); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), sep); - } - - for(std::list<gchar const*>::iterator it=files->begin(); it != files->end(); ++it) { - gchar const *filepath = *it; - gchar const *file = g_path_get_basename(filepath); - gchar *dupfile = g_strndup(file, strlen(file) - 4); - gchar *filename = g_filename_to_utf8(dupfile, -1, NULL, NULL, NULL); - g_free(dupfile); - - GtkWidget *item = gtk_menu_item_new_with_label(filename); - g_free(filename); - - gtk_widget_show(item); - // how does "filepath" ever get freed? - g_signal_connect(G_OBJECT(item), - "activate", - G_CALLBACK(sp_file_new_from_template), - (gpointer) filepath); - - if (view) { - // set null tip for now; later use a description from the template file - g_object_set_data(G_OBJECT(item), "view", (gpointer) view); - g_signal_connect( G_OBJECT(item), "select", G_CALLBACK(sp_ui_menu_select), (gpointer) NULL ); - g_signal_connect( G_OBJECT(item), "deselect", G_CALLBACK(sp_ui_menu_deselect), NULL); - } - - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - } - -} -static void -sp_menu_append_new_templates(GtkWidget *menu, Inkscape::UI::View::View *view) -{ - // user's local dir - std::list<gchar const*> userfiles; - sp_menu_get_svg_filenames_from_dir(profile_path("templates"), &userfiles); - sp_menu_add_filenames_to_menu(menu, view, &userfiles); - - // system templates dir - std::list<gchar const*> templatefiles; - sp_menu_get_svg_filenames_from_dir(INKSCAPE_TEMPLATESDIR, &templatefiles); - sp_menu_add_filenames_to_menu(menu, view, &templatefiles); - -} - -static void sp_ui_checkboxes_menus(GtkMenu *m, Inkscape::UI::View::View *view) { //sp_ui_menu_append_check_item_from_verb(m, view, _("_Menu"), _("Show or hide the menu bar"), "menu", @@ -996,10 +904,7 @@ static void sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, I gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); continue; } - if (!strcmp(menu_pntr->name(), "template-list")) { - sp_menu_append_new_templates(menu, view); - continue; - } + if (!strcmp(menu_pntr->name(), "recent-file-list")) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); diff --git a/src/menus-skeleton.h b/src/menus-skeleton.h index d01e3e38c..5b141902b 100644 --- a/src/menus-skeleton.h +++ b/src/menus-skeleton.h @@ -16,7 +16,7 @@ static char const menus_skeleton[] = " <submenu name=\"" N_("_File") "\">\n" " <submenu name=\"" N_("_New") "\">\n" " <verb verb-id=\"FileNew\" />\n" -" <template-list/>\n" +" <verb verb-id=\"FileTemplates\" />\n" " </submenu>\n" " <verb verb-id=\"FileOpen\" />\n" " <recent-file-list/>\n" diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index b192904ce..e1924664b 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -294,18 +294,16 @@ sp_selected_path_break_apart(SPDesktop *desktop) /* This function is an entry point from GUI */ void -sp_selected_path_to_curves(SPDesktop *desktop, bool interactive) +sp_selected_path_to_curves(Inkscape::Selection *selection, SPDesktop *desktop, bool interactive) { - Inkscape::Selection *selection = sp_desktop_selection(desktop); - if (selection->isEmpty()) { - if (interactive) + if (interactive && desktop) sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to convert to path.")); return; } bool did = false; - if (interactive) { + if (interactive && desktop) { desktop->messageStack()->flash(Inkscape::IMMEDIATE_MESSAGE, _("Converting objects to paths...")); // set "busy" cursor desktop->setWaitingCursor(); @@ -324,7 +322,7 @@ sp_selected_path_to_curves(SPDesktop *desktop, bool interactive) g_slist_free (to_select); g_slist_free (selected); - if (interactive) { + if (interactive && desktop) { desktop->clearWaitingCursor(); if (did) { DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_TO_CURVE, diff --git a/src/path-chemistry.h b/src/path-chemistry.h index b88b84087..efc687b44 100644 --- a/src/path-chemistry.h +++ b/src/path-chemistry.h @@ -19,6 +19,7 @@ class SPDesktop; class SPItem; namespace Inkscape { +class Selection; namespace XML { class Node; } // namespace XML @@ -26,7 +27,8 @@ class Node; void sp_selected_path_combine (SPDesktop *desktop); void sp_selected_path_break_apart (SPDesktop *desktop); -void sp_selected_path_to_curves (SPDesktop *desktop, bool interactive = true); +// interactive=true only has an effect if desktop != NULL, i.e. if a GUI is available +void sp_selected_path_to_curves (Inkscape::Selection *selection, SPDesktop *desktop, bool interactive = true); void sp_selected_to_lpeitems(SPDesktop *desktop); Inkscape::XML::Node *sp_selected_item_to_curved_repr(SPItem *item, guint32 text_grouping_policy); void sp_selected_path_reverse (SPDesktop *desktop); diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index c5d972966..17b912d33 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -326,7 +326,7 @@ static char const preferences_skeleton[] = " minimumexponent=\"-8\" " " inlineattrs=\"0\" " " indent=\"2\" " -" allowrelativecoordinates=\"1\" " +" pathstring_format=\"2\" " " forcerepeatcommands=\"0\" " " incorrect_attributes_warn=\"1\" " " incorrect_attributes_remove=\"0\" " diff --git a/src/splivarot.cpp b/src/splivarot.cpp index 356cf0161..d6fef3a17 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -277,11 +277,38 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool theShapeB->ConvertToShape(theShape, origWind[curOrig]); - if (theShapeA->numberOfEdges() == 0) { - Shape *swap = theShapeB; - theShapeB = theShapeA; - theShapeA = swap; - } else if (theShapeB->numberOfEdges() > 0) { + /* Due to quantization of the input shape coordinates, we may end up with A or B being empty. + * If this is a union or symdiff operation, we just use the non-empty shape as the result: + * A=0 => (0 or B) == B + * B=0 => (A or 0) == A + * A=0 => (0 xor B) == B + * B=0 => (A xor 0) == A + * If this is an intersection operation, we just use the empty shape as the result: + * A=0 => (0 and B) == 0 == A + * B=0 => (A and 0) == 0 == B + * If this a difference operation, and the upper shape (A) is empty, we keep B. + * If the lower shape (B) is empty, we still keep B, as it's empty: + * A=0 => (B - 0) == B + * B=0 => (0 - A) == 0 == B + * + * In any case, the output from this operation is stored in shape A, so we may apply + * the above rules simply by judicious use of swapping A and B where necessary. + */ + bool zeroA = theShapeA->numberOfEdges() == 0; + bool zeroB = theShapeB->numberOfEdges() == 0; + if (zeroA || zeroB) { + // We might need to do a swap. Apply the above rules depending on operation type. + bool resultIsB = ((bop == bool_op_union || bop == bool_op_symdiff) && zeroA) + || ((bop == bool_op_inters) && zeroB) + || (bop == bool_op_diff); + if (resultIsB) { + // Swap A and B to use B as the result + Shape *swap = theShapeB; + theShapeB = theShapeA; + theShapeA = swap; + } + } else { + // Just do the Boolean operation as usual // les elements arrivent en ordre inverse dans la liste theShape->Booleen(theShapeB, theShapeA, bop); Shape *swap = theShape; @@ -1574,12 +1601,12 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) float o_width = 0; float o_miter = 0; JoinType o_join = join_straight; - ButtType o_butt = butt_straight; + //ButtType o_butt = butt_straight; { SPStyle *i_style = item->style; int jointype = i_style->stroke_linejoin.value; - int captype = i_style->stroke_linecap.value; + //int captype = i_style->stroke_linecap.value; o_width = i_style->stroke_width.computed; @@ -1595,7 +1622,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) break; } - switch (captype) { + /*switch (captype) { case SP_STROKE_LINECAP_SQUARE: o_butt = butt_square; break; @@ -1605,7 +1632,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) default: o_butt = butt_straight; break; - } + }*/ o_width = prefOffset; diff --git a/src/svg/path-string.cpp b/src/svg/path-string.cpp index 61e9c90a2..6dddeadff 100644 --- a/src/svg/path-string.cpp +++ b/src/svg/path-string.cpp @@ -2,6 +2,7 @@ * Inkscape::SVG::PathString - builder for SVG path strings * * Copyright 2008 Jasper van de Gronde <th.v.d.gronde@hccnet.nl> + * Copyright 2013 Tavmjong Bah <tavmjong@free.fr> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,44 +26,65 @@ static int const maxprec = 16; int Inkscape::SVG::PathString::numericprecision; int Inkscape::SVG::PathString::minimumexponent; +Inkscape::SVG::PATHSTRING_FORMAT Inkscape::SVG::PathString::format; Inkscape::SVG::PathString::PathString() : - allow_relative_coordinates(Inkscape::Preferences::get()->getBool("/options/svgoutput/allowrelativecoordinates", true)), force_repeat_commands(Inkscape::Preferences::get()->getBool("/options/svgoutput/forcerepeatcommands")) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + format = (PATHSTRING_FORMAT)prefs->getIntLimited("/options/svgoutput/pathstring_format", 1, 0, PATHSTRING_FORMAT_SIZE - 1 ); numericprecision = std::max<int>(minprec,std::min<int>(maxprec, prefs->getInt("/options/svgoutput/numericprecision", 8))); minimumexponent = prefs->getInt("/options/svgoutput/minimumexponent", -8); } +// For absolute and relative paths... the entire path is kept in the "tail". +// For optimized path, at a switch between absolute and relative, add tail to commonbase. void Inkscape::SVG::PathString::_appendOp(char abs_op, char rel_op) { bool abs_op_repeated = _abs_state.prevop == abs_op && !force_repeat_commands; bool rel_op_repeated = _rel_state.prevop == rel_op && !force_repeat_commands; - unsigned int const abs_added_size = abs_op_repeated ? 0 : 2; - unsigned int const rel_added_size = rel_op_repeated ? 0 : 2; - if ( _rel_state.str.size()+2 < _abs_state.str.size()+abs_added_size && allow_relative_coordinates ) { - // Store common prefix - commonbase += _rel_state.str; - _rel_state.str.clear(); - // Copy rel to abs - _abs_state = _rel_state; - _abs_state.switches++; - abs_op_repeated = false; - // We do not have to copy abs to rel: - // _rel_state.str.size()+2 < _abs_state.str.size()+abs_added_size - // _rel_state.str.size()+rel_added_size < _abs_state.str.size()+2 - // _abs_state.str.size()+2 > _rel_state.str.size()+rel_added_size - } else if ( _abs_state.str.size()+2 < _rel_state.str.size()+rel_added_size ) { - // Store common prefix - commonbase += _abs_state.str; - _abs_state.str.clear(); - // Copy abs to rel - _rel_state = _abs_state; - _abs_state.switches++; - rel_op_repeated = false; + + // For absolute and relative paths... do nothing. + switch (format) { + case PATHSTRING_ABSOLUTE: + if ( !abs_op_repeated ) _abs_state.appendOp(abs_op); + break; + case PATHSTRING_RELATIVE: + if ( !rel_op_repeated ) _rel_state.appendOp(rel_op); + break; + case PATHSTRING_OPTIMIZE: + { + unsigned int const abs_added_size = abs_op_repeated ? 0 : 2; + unsigned int const rel_added_size = rel_op_repeated ? 0 : 2; + if ( _rel_state.str.size()+2 < _abs_state.str.size()+abs_added_size ) { + + // Store common prefix + commonbase += _rel_state.str; + _rel_state.str.clear(); + // Copy rel to abs + _abs_state = _rel_state; + _abs_state.switches++; + abs_op_repeated = false; + // We do not have to copy abs to rel: + // _rel_state.str.size()+2 < _abs_state.str.size()+abs_added_size + // _rel_state.str.size()+rel_added_size < _abs_state.str.size()+2 + // _abs_state.str.size()+2 > _rel_state.str.size()+rel_added_size + } else if ( _abs_state.str.size()+2 < _rel_state.str.size()+rel_added_size ) { + + // Store common prefix + commonbase += _abs_state.str; + _abs_state.str.clear(); + // Copy abs to rel + _rel_state = _abs_state; + _abs_state.switches++; + rel_op_repeated = false; + } + if ( !abs_op_repeated ) _abs_state.appendOp(abs_op); + if ( !rel_op_repeated ) _rel_state.appendOp(rel_op); + } + break; + default: + std::cout << "Better not be here!" << std::endl; } - if ( !abs_op_repeated ) _abs_state.appendOp(abs_op); - if ( !rel_op_repeated ) _rel_state.appendOp(rel_op); } void Inkscape::SVG::PathString::State::append(Geom::Coord v) { diff --git a/src/svg/path-string.h b/src/svg/path-string.h index 11018e65c..3a891873d 100644 --- a/src/svg/path-string.h +++ b/src/svg/path-string.h @@ -1,6 +1,7 @@ /* * Copyright 2007 MenTaLguY <mental@rydia.net> * Copyright 2008 Jasper van de Gronde <th.v.d.gronde@hccnet.nl> + * Copyright 2013 Tavmjong Bah <tavmjong@free.fr> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -23,6 +24,14 @@ namespace Inkscape { namespace SVG { +// Relative vs. absolute coordinates +enum PATHSTRING_FORMAT { + PATHSTRING_ABSOLUTE, // Use only absolute coordinates + PATHSTRING_RELATIVE, // Use only relative coordinates + PATHSTRING_OPTIMIZE, // Optimize for path string length + PATHSTRING_FORMAT_SIZE +}; + /** * Builder for SVG path strings. */ @@ -38,6 +47,7 @@ public: final.reserve(commonbase.size()+t.size()); final = commonbase; final += tail(); + // std::cout << " final: " << final << std::endl; return final; } @@ -130,12 +140,10 @@ public: } PathString &closePath() { - commonbase += _abs_state.str; - _abs_state.str.clear(); - _rel_state = _abs_state; + _abs_state.appendOp('Z'); _rel_state.appendOp('z'); - _rel_state.switches++; + _current_point = _initial_point; return *this; } @@ -229,9 +237,13 @@ private: // to cause a quadratic time complexity (in the number of characters/operators) std::string commonbase; std::string final; - std::string const &tail() const { return ((_abs_state <= _rel_state || !allow_relative_coordinates) ? _abs_state.str : _rel_state.str); } + std::string const &tail() const { + return ( (format == PATHSTRING_ABSOLUTE) || + (format == PATHSTRING_OPTIMIZE && _abs_state <= _rel_state ) ? + _abs_state.str : _rel_state.str ); + } - bool const allow_relative_coordinates; + static PATHSTRING_FORMAT format; bool const force_repeat_commands; static int numericprecision; static int minimumexponent; diff --git a/src/ui/dialog/Makefile_insert b/src/ui/dialog/Makefile_insert index bbede9df1..09a7ef573 100644 --- a/src/ui/dialog/Makefile_insert +++ b/src/ui/dialog/Makefile_insert @@ -70,6 +70,8 @@ ink_common_sources += \ ui/dialog/memory.h \ ui/dialog/messages.cpp \ ui/dialog/messages.h \ + ui/dialog/new-from-template.cpp \ + ui/dialog/new-from-template.h \ ui/dialog/ocaldialogs.cpp \ ui/dialog/ocaldialogs.h \ ui/dialog/object-attributes.cpp \ @@ -89,6 +91,10 @@ ink_common_sources += \ ui/dialog/swatches.h \ ui/dialog/symbols.cpp \ ui/dialog/symbols.h \ + ui/dialog/template-load-tab.cpp \ + ui/dialog/template-load-tab.h \ + ui/dialog/template-widget.cpp \ + ui/dialog/template-widget.h \ ui/dialog/text-edit.cpp \ ui/dialog/text-edit.h \ ui/dialog/tile.cpp \ diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 7890b0b4c..b06c1fd1f 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -879,8 +879,12 @@ void InkscapePreferences::initPageIO() _page_svgoutput.add_group_header( _("Path data")); - _svgoutput_allowrelativecoordinates.init( _("Allow relative coordinates"), "/options/svgoutput/allowrelativecoordinates", true); - _page_svgoutput.add_line( true, "", _svgoutput_allowrelativecoordinates, "", _("If set, relative coordinates may be used in path data"), false); + int const numPathstringFormat = 3; + Glib::ustring pathstringFormatLabels[numPathstringFormat] = {_("Absolute"), _("Relative"), _("Optimized")}; + int pathstringFormatValues[numPathstringFormat] = {0, 1, 2}; + + _svgoutput_pathformat.init("/options/svgoutput/pathstring_format", pathstringFormatLabels, pathstringFormatValues, numPathstringFormat, 2); + _page_svgoutput.add_line( true, _("Path string format"), _svgoutput_pathformat, "", _("Path data should be written: only with absolute coordinates, only with relative coordinates, or optimized for string length (mixed absolute and relative coordinates)"), false); _svgoutput_forcerepeatcommands.init( _("Force repeat commands"), "/options/svgoutput/forcerepeatcommands", false); _page_svgoutput.add_line( true, "", _svgoutput_forcerepeatcommands, "", _("Force repeating of the same path command (for example, 'L 1,2 L 3,4' instead of 'L 1,2 3,4')"), false); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 37c05df05..56222fb22 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -426,7 +426,7 @@ protected: UI::Widget::PrefSpinButton _svgoutput_minimumexponent; UI::Widget::PrefCheckButton _svgoutput_inlineattrs; UI::Widget::PrefSpinButton _svgoutput_indent; - UI::Widget::PrefCheckButton _svgoutput_allowrelativecoordinates; + UI::Widget::PrefCombo _svgoutput_pathformat; UI::Widget::PrefCheckButton _svgoutput_forcerepeatcommands; // Attribute Checking controls for SVG Output page: diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 6c6f3a582..6dc9c1ee3 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -416,7 +416,7 @@ LivePathEffectEditor::onAdd() // If item is a SPRect, convert it to path first: if ( SP_IS_RECT(item) ) { - sp_selected_path_to_curves(current_desktop, false); + sp_selected_path_to_curves(sel, current_desktop, false); item = sel->singleItem(); // get new item } diff --git a/src/ui/dialog/new-from-template.cpp b/src/ui/dialog/new-from-template.cpp new file mode 100644 index 000000000..2595e2cf5 --- /dev/null +++ b/src/ui/dialog/new-from-template.cpp @@ -0,0 +1,59 @@ +/** @file + * @brief New From Template main dialog - implementation + */ +/* Authors: + * Jan Darowski <jan.darowski@gmail.com>, supervised by Krzysztof Kosiֵ„ski + * + * Copyright (C) 2013 Authors + * Released under GNU GPL, read the file 'COPYING' for more information + */ + + +#include "new-from-template.h" +#include "file.h" + +#include <gtkmm/alignment.h> +#include <glibmm/i18n.h> + + +namespace Inkscape { +namespace UI { + + +NewFromTemplate::NewFromTemplate() + : _create_template_button(_("Create from template")) +{ + set_title(_("New From Template")); + resize(400, 400); + + get_vbox()->pack_start(_main_widget); + + Gtk::Alignment *align; + align = manage(new Gtk::Alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER, 0.0, 0.0)); + get_vbox()->pack_end(*align, Gtk::PACK_SHRINK); + align->set_padding(0, 0, 0, 15); + align->add(_create_template_button); + + _create_template_button.signal_pressed().connect( + sigc::mem_fun(*this, &NewFromTemplate::_createFromTemplate)); + + show_all(); +} + + +void NewFromTemplate::_createFromTemplate() +{ + _main_widget.createTemplate(); + + response(0); +} + + +void NewFromTemplate::load_new_from_template() +{ + NewFromTemplate dl; + dl.run(); +} + +} +} diff --git a/src/ui/dialog/new-from-template.h b/src/ui/dialog/new-from-template.h new file mode 100644 index 000000000..8ebcb2863 --- /dev/null +++ b/src/ui/dialog/new-from-template.h @@ -0,0 +1,39 @@ +/** @file + * @brief New From Template main dialog + */ +/* Authors: + * Jan Darowski <jan.darowski@gmail.com>, supervised by Krzysztof Kosiֵ„ski + * + * Copyright (C) 2013 Authors + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifndef INKSCAPE_SEEN_UI_DIALOG_NEW_FROM_TEMPLATE_H +#define INKSCAPE_SEEN_UI_DIALOG_NEW_FROM_TEMPLATE_H + +#include <gtkmm/dialog.h> +#include <gtkmm/button.h> + +#include "template-load-tab.h" + + +namespace Inkscape { +namespace UI { + + +class NewFromTemplate : public Gtk::Dialog +{ +public: + static void load_new_from_template(); + +private: + NewFromTemplate(); + Gtk::Button _create_template_button; + TemplateLoadTab _main_widget; + + void _createFromTemplate(); +}; + +} +} +#endif diff --git a/src/ui/dialog/template-load-tab.cpp b/src/ui/dialog/template-load-tab.cpp new file mode 100644 index 000000000..265ee8026 --- /dev/null +++ b/src/ui/dialog/template-load-tab.cpp @@ -0,0 +1,281 @@ +/** @file + * @brief New From Template abstract tab implementation + */ +/* Authors: + * Jan Darowski <jan.darowski@gmail.com>, supervised by Krzysztof Kosiֵ„ski + * + * Copyright (C) 2013 Authors + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "template-widget.h" + +#include "template-load-tab.h" + +#include <gtkmm/messagedialog.h> +#include <gtkmm/scrolledwindow.h> +#include <glibmm/i18n.h> +#include <glibmm/fileutils.h> +#include <glibmm/miscutils.h> +#include <glibmm/stringutils.h> + +#include "interface.h" +#include "file.h" +#include "path-prefix.h" +#include "preferences.h" +#include "inkscape.h" +#include "xml/repr.h" +#include "xml/document.h" +#include "xml/node.h" + + +namespace Inkscape { +namespace UI { + + +TemplateLoadTab::TemplateLoadTab() + : _current_keyword("") + , _keywords_combo(true) + , _current_search_type(ALL) +{ + set_border_width(10); + + _info_widget = manage(new TemplateWidget()); + + Gtk::Label *title; + title = manage(new Gtk::Label(_("Search:"))); + _search_box.pack_start(*title, Gtk::PACK_SHRINK); + _search_box.pack_start(_keywords_combo, Gtk::PACK_SHRINK, 5); + + _tlist_box.pack_start(_search_box, Gtk::PACK_SHRINK, 10); + + pack_start(_tlist_box, Gtk::PACK_SHRINK); + pack_start(*_info_widget, Gtk::PACK_EXPAND_WIDGET, 5); + + Gtk::ScrolledWindow *scrolled; + scrolled = manage(new Gtk::ScrolledWindow()); + scrolled->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); + scrolled->add(_tlist_view); + _tlist_box.pack_start(*scrolled, Gtk::PACK_EXPAND_WIDGET, 5); + + _keywords_combo.signal_changed().connect( + sigc::mem_fun(*this, &TemplateLoadTab::_keywordSelected)); + this->show_all(); + + _loading_path = ""; + _loadTemplates(); + _initLists(); +} + + +TemplateLoadTab::~TemplateLoadTab() +{ +} + + +void TemplateLoadTab::createTemplate() +{ + _info_widget->create(); +} + + +void TemplateLoadTab::_displayTemplateInfo() +{ + Glib::RefPtr<Gtk::TreeSelection> templateSelectionRef = _tlist_view.get_selection(); + if (templateSelectionRef->get_selected()) { + _current_template = (*templateSelectionRef->get_selected())[_columns.textValue]; + + _info_widget->display(_tdata[_current_template]); + } + +} + + +void TemplateLoadTab::_initKeywordsList() +{ + _keywords_combo.append(_("All")); + + for (std::set<Glib::ustring>::iterator it = _keywords.begin() ; it != _keywords.end() ; ++it){ + _keywords_combo.append(*it); + } +} + + +void TemplateLoadTab::_initLists() +{ + _tlist_store = Gtk::ListStore::create(_columns); + _tlist_view.set_model(_tlist_store); + _tlist_view.append_column("", _columns.textValue); + _tlist_view.set_headers_visible(false); + + _initKeywordsList(); + _refreshTemplatesList(); + + Glib::RefPtr<Gtk::TreeSelection> templateSelectionRef = + _tlist_view.get_selection(); + templateSelectionRef->signal_changed().connect( + sigc::mem_fun(*this, &TemplateLoadTab::_displayTemplateInfo)); +} + + +void TemplateLoadTab::_keywordSelected() +{ + _current_keyword = _keywords_combo.get_active_text(); + if (_current_keyword == ""){ + _current_keyword = _keywords_combo.get_entry_text(); + _current_search_type = USER_SPECIFIED; + } + else + _current_search_type = LIST_KEYWORD; + + if (_current_keyword == "" || _current_keyword == _("All")) + _current_search_type = ALL; + + _refreshTemplatesList(); +} + + +void TemplateLoadTab::_refreshTemplatesList() +{ + _tlist_store->clear(); + + switch (_current_search_type){ + case ALL :{ + + for (std::map<Glib::ustring, TemplateData>::iterator it = _tdata.begin() ; it != _tdata.end() ; ++it) { + Gtk::TreeModel::iterator iter = _tlist_store->append(); + Gtk::TreeModel::Row row = *iter; + row[_columns.textValue] = it->first; + } + break; + } + + case LIST_KEYWORD: { + for (std::map<Glib::ustring, TemplateData>::iterator it = _tdata.begin() ; it != _tdata.end() ; ++it) { + if (it->second.keywords.count(_current_keyword) != 0){ + Gtk::TreeModel::iterator iter = _tlist_store->append(); + Gtk::TreeModel::Row row = *iter; + row[_columns.textValue] = it->first; + } + } + break; + } + + case USER_SPECIFIED : { + for (std::map<Glib::ustring, TemplateData>::iterator it = _tdata.begin() ; it != _tdata.end() ; ++it) { + if (it->second.keywords.count(_current_keyword) != 0 || + it->second.display_name.find(_current_keyword) != Glib::ustring::npos || + it->second.author.find(_current_keyword) != Glib::ustring::npos || + it->second.short_description.find(_current_keyword) != Glib::ustring::npos || + it->second.long_description.find(_current_keyword) != Glib::ustring::npos ) + { + Gtk::TreeModel::iterator iter = _tlist_store->append(); + Gtk::TreeModel::Row row = *iter; + row[_columns.textValue] = it->first; + } + } + break; + } + } +} + + +void TemplateLoadTab::_loadTemplates() +{ + // user's local dir + _getTemplatesFromDir(profile_path("templates") + _loading_path); + + // system templates dir + _getTemplatesFromDir(INKSCAPE_TEMPLATESDIR + _loading_path); +} + + +TemplateLoadTab::TemplateData TemplateLoadTab::_processTemplateFile(const Glib::ustring &path) +{ + TemplateData result; + result.path = path; + result.is_procedural = false; + result.preview_name = ""; + + // convert path into valid template name + result.display_name = Glib::path_get_basename(path); + gsize n = 0; + while ((n = result.display_name.find_first_of("_", 0)) < Glib::ustring::npos){ + result.display_name.replace(n, 1, 1, ' '); + } + n = result.display_name.rfind(".svg"); + result.display_name.replace(n, 4, 1, ' '); + + Inkscape::XML::Document *rdoc; + rdoc = sp_repr_read_file(path.data(), SP_SVG_NS_URI); + Inkscape::XML::Node *myRoot; + Inkscape::XML::Node *dataNode; + + if (rdoc){ + myRoot = rdoc->root(); + if (strcmp(myRoot->name(), "svg:svg") != 0){ // Wrong file format + return result; + } + + myRoot = sp_repr_lookup_name(myRoot, "inkscape:_templateinfo"); + + if (myRoot == NULL) // No template info + return result; + + if ((dataNode = sp_repr_lookup_name(myRoot, "inkscape:_name")) != NULL) + result.display_name = dgettext("Document template name", dataNode->firstChild()->content()); + if ((dataNode = sp_repr_lookup_name(myRoot, "inkscape:author")) != NULL) + result.author = dataNode->firstChild()->content(); + if ((dataNode = sp_repr_lookup_name(myRoot, "inkscape:_short")) != NULL) + result.short_description = dgettext("Document template short description", dataNode->firstChild()->content()); + if ((dataNode = sp_repr_lookup_name(myRoot, "inkscape:_long") )!= NULL) + result.long_description = dgettext("Document template long description", dataNode->firstChild()->content()); + if ((dataNode = sp_repr_lookup_name(myRoot, "inkscape:preview")) != NULL) + result.preview_name = dataNode->firstChild()->content(); + if ((dataNode = sp_repr_lookup_name(myRoot, "inkscape:date")) != NULL){ + result.creation_date = dataNode->firstChild()->content(); + } + + if ((dataNode = sp_repr_lookup_name(myRoot, "inkscape:_keywords")) != NULL){ + Glib::ustring data = dataNode->firstChild()->content(); + while (!data.empty()){ + std::size_t pos = data.find_first_of(" "); + if (pos == Glib::ustring::npos) + pos = data.size(); + + Glib::ustring keyword = dgettext("Document template keyword", data.substr(0, pos).data()); + result.keywords.insert(keyword); + _keywords.insert(keyword); + + if (pos == data.size()) + break; + data.erase(0, pos+1); + } + } + } + + return result; +} + + +void TemplateLoadTab::_getTemplatesFromDir(const Glib::ustring &path) +{ + if ( !Glib::file_test(path, Glib::FILE_TEST_EXISTS) || + !Glib::file_test(path, Glib::FILE_TEST_IS_DIR)) + return; + + Glib::Dir dir(path); + + Glib::ustring file = Glib::build_filename(path, dir.read_name()); + while (file != path){ + if (Glib::str_has_suffix(file, ".svg") && !Glib::str_has_prefix(Glib::path_get_basename(file), "default")){ + TemplateData tmp = _processTemplateFile(file); + if (tmp.display_name != "") + _tdata[tmp.display_name] = tmp; + } + file = Glib::build_filename(path, dir.read_name()); + } +} + +} +} diff --git a/src/ui/dialog/template-load-tab.h b/src/ui/dialog/template-load-tab.h new file mode 100644 index 000000000..50f3e0be2 --- /dev/null +++ b/src/ui/dialog/template-load-tab.h @@ -0,0 +1,102 @@ +/** @file + * @brief New From Template abstract tab class + */ +/* Authors: + * Jan Darowski <jan.darowski@gmail.com>, supervised by Krzysztof Kosiֵ„ski + * + * Copyright (C) 2013 Authors + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifndef INKSCAPE_SEEN_UI_DIALOG_TEMPLATE_LOAD_TAB_H +#define INKSCAPE_SEEN_UI_DIALOG_TEMPLATE_LOAD_TAB_H + +#include <gtkmm/box.h> +#include <gtkmm/comboboxtext.h> +#include <gtkmm/frame.h> +#include <gtkmm/liststore.h> +#include <gtkmm/treeview.h> +#include <map> +#include <set> + + +namespace Inkscape { +namespace UI { + +class TemplateWidget; + +class TemplateLoadTab : public Gtk::HBox +{ + +public: + struct TemplateData + { + bool is_procedural; + Glib::ustring path; + Glib::ustring display_name; + Glib::ustring author; + Glib::ustring short_description; + Glib::ustring long_description; + Glib::ustring preview_name; + Glib::ustring creation_date; + std::set<Glib::ustring> keywords; + }; + + TemplateLoadTab(); + virtual ~TemplateLoadTab(); + virtual void createTemplate(); + +protected: + class StringModelColumns : public Gtk::TreeModelColumnRecord + { + public: + StringModelColumns() + { + add(textValue); + } + + Gtk::TreeModelColumn<Glib::ustring> textValue; + }; + + Glib::ustring _current_keyword; + Glib::ustring _current_template; + Glib::ustring _loading_path; + std::map<Glib::ustring, TemplateData> _tdata; + std::set<Glib::ustring> _keywords; + + + virtual void _displayTemplateInfo(); + virtual void _initKeywordsList(); + virtual void _refreshTemplatesList(); + void _loadTemplates(); + void _initLists(); + + Gtk::VBox _tlist_box; + Gtk::HBox _search_box; + TemplateWidget *_info_widget; + + Gtk::ComboBoxText _keywords_combo; + + Gtk::TreeView _tlist_view; + Glib::RefPtr<Gtk::ListStore> _tlist_store; + StringModelColumns _columns; + +private: + enum SearchType + { + LIST_KEYWORD, + USER_SPECIFIED, + ALL + }; + + SearchType _current_search_type; + + void _getTemplatesFromDir(const Glib::ustring &); + void _keywordSelected(); + TemplateData _processTemplateFile(const Glib::ustring &); +}; + +} +} + +#endif diff --git a/src/ui/dialog/template-widget.cpp b/src/ui/dialog/template-widget.cpp new file mode 100644 index 000000000..be7e2b515 --- /dev/null +++ b/src/ui/dialog/template-widget.cpp @@ -0,0 +1,117 @@ +/** @file + * @brief New From Template - templates widget - implementation + */ +/* Authors: + * Jan Darowski <jan.darowski@gmail.com>, supervised by Krzysztof Kosiֵ„ski + * + * Copyright (C) 2013 Authors + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "template-widget.h" + +#include <gtkmm/alignment.h> +#include <gtkmm/button.h> +#include <gtkmm/label.h> +#include <gtkmm/messagedialog.h> + +#include <glibmm/i18n.h> +#include <glibmm/miscutils.h> + +#include "template-load-tab.h" +#include "file.h" + +namespace Inkscape { +namespace UI { + + +TemplateWidget::TemplateWidget() + : _more_info_button(_("More info")) + , _short_description_label(_(" ")) + , _template_author_label(_(" ")) + , _template_name_label(_("no template selected")) +{ + pack_start(_template_name_label, Gtk::PACK_SHRINK, 10); + pack_start(_template_author_label, Gtk::PACK_SHRINK, 0); + pack_start(_preview_box, Gtk::PACK_SHRINK, 0); + + _preview_box.pack_start(_preview_image, Gtk::PACK_EXPAND_PADDING, 15); + _preview_box.pack_start(_preview_render, Gtk::PACK_EXPAND_PADDING, 10); + + _short_description_label.set_line_wrap(true); + //_short_description_label.set_size_request(200); + + Gtk::Alignment *align; + align = manage(new Gtk::Alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER, 0.0, 0.0)); + pack_end(*align, Gtk::PACK_SHRINK); + align->add(_more_info_button); + + pack_end(_short_description_label, Gtk::PACK_SHRINK, 5); + + _more_info_button.signal_pressed().connect( + sigc::mem_fun(*this, &TemplateWidget::_displayTemplateDetails)); +} + + +void TemplateWidget::create() +{ + if (_current_template.path == "") + return; + + if (_current_template.is_procedural) {} + else { + sp_file_new(_current_template.path); + } +} + + +void TemplateWidget::display(TemplateLoadTab::TemplateData data) +{ + _current_template = data; + if (data.is_procedural){} + else{ + _template_name_label.set_text(_current_template.display_name); + _template_author_label.set_text(_current_template.author); + _short_description_label.set_text(_current_template.short_description); + + Glib::ustring imagePath = Glib::build_filename(Glib::path_get_dirname(_current_template.path), _current_template.preview_name); + if (data.preview_name != ""){ + _preview_image.set(imagePath); + _preview_image.show(); + _preview_render.hide(); + } + else{ + _preview_render.showImage(data.path); + _preview_render.show(); + _preview_image.hide(); + } + } +} + + +void TemplateWidget::_displayTemplateDetails() +{ + if (_current_template.path == "") + return; + + Glib::ustring message = _current_template.display_name + "\n\n" + + _("Path: ") + _current_template.path + "\n\n"; + + if (_current_template.long_description != "") + message += _("Description: ") + _current_template.long_description + "\n\n"; + if (_current_template.keywords.size() > 0){ + message += _("Keywords: "); + for (std::set<Glib::ustring>::iterator it = _current_template.keywords.begin(); it != _current_template.keywords.end(); ++it) + message += *it + " "; + message += "\n\n"; + } + + if (_current_template.author != "") + message += _("By: ") + _current_template.author + " " + _current_template.creation_date + "\n\n"; + + Gtk::MessageDialog dl(message, false, Gtk::MESSAGE_OTHER); + dl.run(); +} + +} +} diff --git a/src/ui/dialog/template-widget.h b/src/ui/dialog/template-widget.h new file mode 100644 index 000000000..f7e1267ce --- /dev/null +++ b/src/ui/dialog/template-widget.h @@ -0,0 +1,48 @@ +/** @file + * @brief New From Template - template widget + */ +/* Authors: + * Jan Darowski <jan.darowski@gmail.com>, supervised by Krzysztof Kosiֵ„ski + * + * Copyright (C) 2013 Authors + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifndef INKSCAPE_SEEN_UI_DIALOG_TEMPLATE_WIDGET_H +#define INKSCAPE_SEEN_UI_DIALOG_TEMPLATE_WIDGET_H + +#include "filedialogimpl-gtkmm.h" + +#include <gtkmm/box.h> + +#include "template-load-tab.h" + +namespace Inkscape { +namespace UI { + + +class TemplateWidget : public Gtk::VBox +{ +public: + TemplateWidget (); + void create(); + void display(TemplateLoadTab::TemplateData); + +private: + TemplateLoadTab::TemplateData _current_template; + + Gtk::Button _more_info_button; + Gtk::HBox _preview_box; + Gtk::Image _preview_image; + Dialog::SVGPreview _preview_render; + Gtk::Label _short_description_label; + Gtk::Label _template_author_label; + Gtk::Label _template_name_label; + + void _displayTemplateDetails(); +}; + +} +} + +#endif diff --git a/src/verbs.cpp b/src/verbs.cpp index 06e59be38..737d9e150 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -80,6 +80,7 @@ #include "ui/dialog/inkscape-preferences.h" #include "ui/dialog/layer-properties.h" #include "ui/dialog/layers.h" +#include "ui/dialog/new-from-template.h" #include "ui/dialog/object-properties.h" #include "ui/dialog/swatches.h" #include "ui/dialog/symbols.h" @@ -880,6 +881,9 @@ void FileVerb::perform(SPAction *action, void *data) case SP_VERB_FILE_CLOSE_VIEW: sp_ui_close_view(NULL); break; + case SP_VERB_FILE_TEMPLATES: + Inkscape::UI::NewFromTemplate::load_new_from_template(); + break; default: break; } @@ -1446,12 +1450,26 @@ void LayerVerb::perform(SPAction *action, void *data) */ void ObjectVerb::perform( SPAction *action, void *data) { - g_return_if_fail(ensure_desktop_valid(action)); SPDesktop *dt = sp_action_get_desktop(action); + Inkscape::Selection *sel = sp_action_get_selection(action); - SPEventContext *ec = dt->event_context; + // We can perform some actions without a desktop + bool handled = true; + switch (reinterpret_cast<std::size_t>(data)) { + case SP_VERB_OBJECT_TO_CURVE: + sp_selected_path_to_curves(sel, dt); + break; + default: + handled = false; + break; + } + if (handled) { + return; + } - Inkscape::Selection *sel = sp_desktop_selection(dt); + g_return_if_fail(ensure_desktop_valid(action)); + + SPEventContext *ec = dt->event_context; if (sel->isEmpty()) return; @@ -1478,9 +1496,6 @@ void ObjectVerb::perform( SPAction *action, void *data) case SP_VERB_OBJECT_FLATTEN: sp_selection_remove_transform(dt); break; - case SP_VERB_OBJECT_TO_CURVE: - sp_selected_path_to_curves(dt); - break; case SP_VERB_OBJECT_FLOW_TEXT: text_flow_into_shape(); break; @@ -2361,6 +2376,8 @@ Verb *Verb::_base_verbs[] = { new FileVerb(SP_VERB_FILE_CLOSE_VIEW, "FileClose", N_("_Close"), N_("Close this document window"), GTK_STOCK_CLOSE), new FileVerb(SP_VERB_FILE_QUIT, "FileQuit", N_("_Quit"), N_("Quit Inkscape"), GTK_STOCK_QUIT), + new FileVerb(SP_VERB_FILE_TEMPLATES, "FileTemplates", N_("_Templates..."), + N_("Create new project from template"), INKSCAPE_ICON("dialog-templates")), // Edit new EditVerb(SP_VERB_EDIT_UNDO, "EditUndo", N_("_Undo"), N_("Undo last action"), diff --git a/src/verbs.h b/src/verbs.h index 5cc2ad12e..c4b01dfbf 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -59,6 +59,7 @@ enum { SP_VERB_FILE_PREV_DESKTOP, SP_VERB_FILE_CLOSE_VIEW, SP_VERB_FILE_QUIT, + SP_VERB_FILE_TEMPLATES, /* Edit */ SP_VERB_EDIT_UNDO, SP_VERB_EDIT_REDO, |
