diff options
| author | Jabiertxof <jabier.arraiza@marker.es> | 2019-09-16 16:33:50 +0000 |
|---|---|---|
| committer | Jabiertxof <jabier.arraiza@marker.es> | 2019-09-16 16:33:50 +0000 |
| commit | ba1e44ef0524586293f218e208680f7cc1cbe39a (patch) | |
| tree | ad5b7022e8160242e324409dfba5208a13e94363 /src/ui/clipboard.cpp | |
| parent | Avoid crash when clipboard is pastred twice with the all content of the text ... (diff) | |
| download | inkscape-ba1e44ef0524586293f218e208680f7cc1cbe39a.tar.gz inkscape-ba1e44ef0524586293f218e208680f7cc1cbe39a.zip | |
Realy fix crash pasting and speed improvements
Diffstat (limited to 'src/ui/clipboard.cpp')
| -rw-r--r-- | src/ui/clipboard.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 7341b8caf..245bec096 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -1087,16 +1087,20 @@ bool ClipboardManagerImpl::_pasteText(SPDesktop *desktop) if(text.length() == copied_style_length) { Inkscape::UI::Tools::TextTool *tc = SP_TEXT_CONTEXT(desktop->event_context); - Inkscape::Text::Layout const *layout = te_get_layout(tc->text); + // we realy only want to inherit container style (to act as 0.92 and faster performance) + // maybe for 1.0 we can make a special type of clipboard + // that handle layout or maybe we can use the last desktop text style + // so I comment unneded code. + /* Inkscape::Text::Layout const *layout = te_get_layout(tc->text); Inkscape::Text::Layout::iterator it_next; - Inkscape::Text::Layout::iterator it = tc->text_sel_end; + Inkscape::Text::Layout::iterator it = tc->text_sel_end; */ SPText *textitem = dynamic_cast<SPText *>(tc->text); if (textitem) { - textitem->hide_shape_inside(); + textitem->rebuildLayout(); } SPFlowtext *flowtext = dynamic_cast<SPFlowtext *>(tc->text); if (flowtext) { - flowtext->fix_overflow_flowregion(false); + flowtext->rebuildLayout(); } // we realy only want to inherit container style /* SPCSSAttr *css = take_style_from_item(tc->text); @@ -1108,7 +1112,7 @@ bool ClipboardManagerImpl::_pasteText(SPDesktop *desktop) if (w && strcmp(w, "0px") != 0) { sp_repr_css_set_property(te_selected_style[i], "font-size", w); } - } */ + } for (unsigned int i = 0; i < text.length(); ++i) it.prevCharacter(); @@ -1122,25 +1126,22 @@ bool ClipboardManagerImpl::_pasteText(SPDesktop *desktop) // sp_te_apply_style(tc->text, it, it_next, te_selected_style[i]); te_update_layout_now_recursive(tc->text); + tc->text_sel_end = it; for (unsigned int j = te_selected_style_positions[i]; j < te_selected_style_positions[i+1]; ++j) it.nextCharacter(); - } - if (textitem) { - textitem->show_shape_inside(); - } - if (flowtext) { - flowtext->fix_overflow_flowregion(true); - } + } */ } return true; } - - // try to parse the text as a color and, if successful, apply it as the current style - SPCSSAttr *css = sp_repr_css_attr_parse_color_to_fill(_clipboard->wait_for_text()); + // old(try to parse the text as a color and, if successful, apply it as the current style) + // we realy only want to inherit container style + // maybe for 1.0 we can make a special type of clipboard + // that handle layout or maybe we can use the last desktop text style + /* SPCSSAttr *css = sp_repr_css_attr_parse_color_to_fill(_clipboard->wait_for_text()); if (css) { sp_desktop_set_style(desktop, css); return true; - } + } */ return false; } |
