double aX = 0, aY = 0, aZ = 0;
QString aStrId = QString("LIGHTGUI_%1").arg(aPosition);
- Handle(LIGHTGUI_TextPrs) aPrs = new LIGHTGUI_TextPrs( aLine, gp_Pnt( aX, aY, aZ ) );
+ Handle(LIGHTGUI_TextPrs) aPrs = new LIGHTGUI_TextPrs( aLine.isNull() ? "" : aLine, gp_Pnt( aX, aY, aZ ) );
aPrs->SetOwner(new SALOME_InteractiveObject( aStrId, "" ) );
SOCC_Prs* prs = dynamic_cast<SOCC_Prs*>( aViewer->CreatePrs() ); // aStringID is an "entry"
if ( prs ) {
// Insert new line before the item at thePosition in the list,
// or at the end() if thePosition is out of range
LIGHTGUI_ModuleObject* modelRoot = dynamic_cast<LIGHTGUI_ModuleObject*>( root() );
- if ( !modelRoot )
- return false;
+ LightApp_Study* study = dynamic_cast<LightApp_Study*>( module()->application()->activeStudy() );
if ( thePosition > 0 ) {
+ if ( !modelRoot )
+ return false;
LIGHTGUI_DataObject* obj = findObject( thePosition );
if ( !obj || !obj->parent() )
return false;
}
else {
// append new paragraph/line
- theText.stripWhiteSpace().isEmpty() ? new LIGHTGUI_DataObject( theText, modelRoot ) :
- new LIGHTGUI_DataObject( theText, modelRoot->lastChild() );
+ if ( modelRoot )
+ theText.stripWhiteSpace().isEmpty() ? new LIGHTGUI_DataObject( theText, modelRoot ) :
+ new LIGHTGUI_DataObject( theText, modelRoot->lastChild() );
+ else {
+ QStringList lines;
+ if ( !theText.stripWhiteSpace().isEmpty() )
+ lines.append( theText );
+ buildTree( study->root(), lines );
+ }
+
}
return true;
}
msgid "WRN_EDIT_FAILED"
msgstr "Can't edit line!"
+msgid "WRN_ADD_FAILED"
+msgstr "Can't insert line!"
+
msgid "WRN_UNKNOWN_COMMAND"
msgstr "Unrecognized command!"
msgstr "Line"
msgid "LIGHT_ROOT_TOOLTIP"
-msgstr "LIGHT module root object"
\ No newline at end of file
+msgstr "LIGHT module root object"