View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001606 | Scribus | Scripter | public | 2005-01-31 09:11 | 2006-01-10 14:04 |
Reporter | TomK32 | Assigned To | subik | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.2.2cvs | ||||
Fixed in Version | 1.3.2cvs | ||||
Summary | 0001606: setStyle changes complete frame style despite selection | ||||
Description | If I use selectText() I'd expect setStyle() to work like setFont() and change only the paragraphs selected not the whole text frame. The solution is to move Deselect() a bit down. | ||||
Tags | No tags attached. | ||||
Patch | |||||
|
the Deselect() method does a little bit "other" deselection than you propably know. It erases selection of the object(s) in page - not the selection in text frame. I'm sorry but (if I'm right of course) Scripter isn't currently able to apply style into selection. It's something like boolean - all text is or isn't styled. It depends on the Scribus core ScribusApp::setNewAbStyle(int) which is too hard and dangerous to rewrite in 1.2.x series. But maybe I moronish myself in fron of you ;) I'll study it one more day. |
|
that is my solution, working really fine: if (!found) { // whoops, the user specified an invalid style, complain loudly. PyErr_SetString(NotFoundError, QObject::tr("Style not found","pyth on error")); return NULL; } int Apm = Carrier->doc->AppMode; if (item->HasSel) { Carrier->doc->AppMode = 7; } // Now apply the style. Carrier->doc->ActPage = item->OwnPage; Carrier->doc->ActPage->SelectItemNr(item->ItemNr); Carrier->setNewAbStyle(styleid); Carrier->doc->AppMode = Apm; Carrier->doc->ActPage->Deselect(true); |
|
subik is this fixed in 1.2.2 ? |
|
patched. I'm not sure still If we understand each other - it applies style on the paragraph only - not selected text. |
|
yes it changes the paragraph, also if you append text it will have the same style. for the docs I'd suggest to add a note that setStyle should be used BEFORE actually adding the paragraph and applying fonts or other stuff. |
|
Reopening as I think this is still in 1.3.x (as per ML discussion). The following doesn't seem to work: <create a frame and select it, create a style named "test"> setText("blah\nblah\nblah\n") selectText(5,7) setStyle("test") as it sets the style on the whole frame rather than the selected range. The problem is not with selectText(...), as that works just fine if you (eg) 'setTextColor("Blue")'. |
|
Reminder sent to: TomK32 Adding you to the monitor list after IRC discussion. |
|
Please see also Bug 2770: When having selected multiple frames, the style is only applied to the first one. |
|
Scripter calls Scribus internals methods only. There is no handling of the paragraph styles in text selection. void ScribusApp::setNewAbStyle(int a) void ScribusView::SetAbStyle(int s) void ScribusView::chAbStyle(PageItem *currItem, int s) esp. the last one method is where is everything handled. I'll discuss it with Franz because it should require changes in these methods... stay tuned volks. |
|
Reminder sent to: fschmid Franz, could you provide your oppinion on this RFE, please? |
|
In my opinion setStyle() should a) change only the selected text paragraphs if any b) if now paragraphs are selected it should change the style for all selected textframes. |
|
it's much fast now, but please add this patch too: Index: cmdobj.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp,v retrieving revision 1.11.2.41 diff -u -r1.11.2.41 cmdobj.cpp --- cmdobj.cpp 1 Nov 2005 19:42:17 -0000 1.11.2.41 +++ cmdobj.cpp 2 Nov 2005 09:19:44 -0000 @@ -81,7 +81,7 @@ return NULL; if(!checkHaveDocument()) return NULL; - int i = ScApp->doc->itemAdd(PageItem::TextFrame, PageItem::Unspecified, pageUnitXToDocX(x), pageUnitYToDocY(y), b, h, ScApp->doc->toolSettings.dWidth, "None", ScApp->doc->toolSettings.dPenText, true); + int i = ScApp->doc->itemAdd(PageItem::TextFrame, PageItem::Unspecified, pageUnitXToDocX(x), pageUnitYToDocY(y), ValueToPoint(b), ValueToPoint(h), ScApp->doc->toolSettings.dWidth, "None", ScApp->doc->toolSettings.dPenText, true); if (ItemExists(QString::fromUtf8(Name))) { PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists.","python error")); @@ -512,10 +512,15 @@ PyErr_SetString(NotFoundError, QObject::tr("Style not found.","python error")); return NULL; } + + int Apm = ScApp->doc->appMode; + ScApp->doc->appMode = modeEdit; + // for current item only if (ScApp->view->SelItem.count() == 0 || name != "") { - // quick hack to always apply on the right frame - pv + + // quick hack to always apply on the right frame - pv ScApp->view->Deselect(true); //CB I dont think we need to draw here. Its faster if we dont. ScApp->view->SelectItem(item, false); @@ -527,7 +532,7 @@ for (int i = 0; i < ScApp->view->SelItem.count(); ++i) ScApp->view->chAbStyle(ScApp->view->SelItem.at(i), styleid); } - + ScApp->doc->appMode = Apm; } else { |
|
Is this fixed now? To me (latest 1.3anoncvs) it seems not. This is a pity since you really have _no_ possibilities to set different par-styles in one frame from scripter and no workaround is available. So perhaps a first "dirty hack" could be that the setstyle _only_ applies to selectedParagraphs. If you want to set the style of many frame you have to cycle through them. Or did I something wrong? |
|
I've made some changes into 1.3 devel cvs. It needs a very heavy testing because it affects all style changes - you can change style in selection from scripter and gui too (in edit mode). I've test it but I'm sure I missed some combinations... can you test it, please? |
|
Setting different styles in one frame does work now, also setting one style vor many frames. Thank you for your work! |
Date Modified | Username | Field | Change |
---|---|---|---|
2005-01-31 09:11 | TomK32 | New Issue | |
2005-01-31 15:18 | subik | Status | new => assigned |
2005-01-31 15:18 | subik | Assigned To | => subik |
2005-01-31 19:23 | subik | Note Added: 0003567 | |
2005-02-07 15:52 | TomK32 | Note Added: 0003644 | |
2005-04-08 07:29 |
|
Note Added: 0004157 | |
2005-04-08 07:29 |
|
Product Version | 1.2.1 => 1.2.2cvs |
2005-04-08 07:56 | subik | Note Added: 0004168 | |
2005-04-08 08:15 | TomK32 | Note Added: 0004170 | |
2005-04-08 08:16 | TomK32 | Note Edited: 0004170 | |
2005-04-08 09:17 | subik | Status | assigned => resolved |
2005-04-08 09:17 | subik | Fixed in Version | => 1.2.2cvs |
2005-04-08 09:17 | subik | Resolution | open => fixed |
2005-04-16 09:34 | cbradney | Status | resolved => closed |
2005-10-25 21:28 | cbradney | Relationship added | related to 0002758 |
2005-10-27 11:19 |
|
Note Added: 0007233 | |
2005-10-27 11:19 |
|
Status | closed => acknowledged |
2005-10-27 11:22 |
|
Note Edited: 0007233 | |
2005-10-27 11:26 |
|
Note Edited: 0007233 | |
2005-10-27 11:34 |
|
Note Added: 0007234 | |
2005-10-28 06:16 | rdebel | Note Added: 0007243 | |
2005-10-30 12:06 | subik | Note Added: 0007264 | |
2005-10-31 08:16 | subik | Note Added: 0007277 | |
2005-10-31 09:55 | fschmid | Note Added: 0007280 | |
2005-11-02 09:19 | TomK32 | Note Added: 0007308 | |
2005-11-23 06:38 | rdebel | Note Added: 0007516 | |
2005-12-08 19:51 | subik | Note Added: 0007673 | |
2005-12-08 19:54 | subik | Relationship replaced | has duplicate 0002758 |
2005-12-12 14:04 | rdebel | Note Added: 0007715 | |
2005-12-25 11:02 | subik | Status | acknowledged => resolved |
2005-12-25 11:02 | subik | Fixed in Version | 1.2.2cvs => 1.3.3cvs |
2005-12-26 19:19 |
|
Fixed in Version | 1.3.3cvs => 1.3.2cvs |
2006-01-10 14:04 | cbradney | Status | resolved => closed |
2006-05-13 21:19 | christoph_s | Relationship added | child of 0003813 |