From: Michal H. <ms...@gm...> - 2008-09-08 17:14:58
|
Thanks this is exactly what I was looking for. On Sun, Sep 07, 2008 at 05:59:16PM +0200, Martin Petricek wrote: > Michal Hocko wrote: > > Martin, > > what is the exact workflow for: > > * text adding > > You select "Add text" tool, which calls onSelectMode_addText() [callback.qs] > Basically, once clicked somewhere, addText(%1,%2,%3,%4,%5,%6) is called > addText(_x1,_y1,_x2,_y2,_glob_left,_glob_top) is declared in dialogs.qs > That function will create editbox inside the page and once you press enter > or lose focus from the editbox, the text is instantiated into document via > _AddTextSlot() function decared also in dialogs.qs > This function calculates detransformation matrix and inserts operators. Just for record code path for operators insertion wrt. text operators: _AddTextSlot -> operatorAddTextLine -> putText -> Base::createOperator("Tj", params) -> new QSPdfOperator(simpleGenericOperator) > > > * modification of existing text > > You select "Select text" tool, which calls onSelectMode_Text() [callback.qs] > This sets the pageview to selection mode and when some text is selected, > all selected text operators appear in the tree as "selection". Then > fillTextFromSelectedOperators() [dialogs.qs] is called, which will extract > the text from the operators (if possible) and put it into text box in > toolbar. If you edit the text there, all the text operators get replaced by > new one, which contains all the new text (which BTW destroys any formatting > that was there). This is done in scripting function changeSelectedText() > [dialogs.qs] > > > I am interested in the part starting from scripting until gui c++ code. > > The script code ends at calling GUI functions for modifying the operators, > which are basically very thin wrappers to core functions to manipulate the > operators. > > Note that for all conversions from GUI text (unicode strings) to PDF text > (std::string), utility functions in util.cc are used: > QString convertToUnicode(const std::string &str, CharsetContext ctx); > std::string convertFromUnicode(const QString &str, CharsetContext ctx); > > CharsetContext is "PDF" for these conversions. Which charset is used is set > by setDefaultCharset() - this is tied with setting "editor/charset" - if > the setting changes, the function is immediately called. > > Martin Petricek Thanks -- Michal Hocko |