#include <codeeditor.h>
|
void | insertText (const QString &text, TextBlock *parent, bool isEditable=false, const QColor &fgcolor=QColor("black"), const QColor &bgcolor=QColor("white"), UMLObject *umlobj=0, const QString &displayName=QString(), int startLine=-1) |
|
void | editTextBlock (TextBlock *tBlock, int para) |
|
void | clearText () |
|
QLabel * | componentLabel () |
|
bool | paraIsNotSingleLine (int para) |
|
void | expandSelectedParagraph (int where) |
|
void | contractSelectedParagraph (int where) |
|
void | updateTextBlockFromText (TextBlock *block) |
|
void | initText (CodeDocument *doc) |
|
void | init (CodeViewerDialog *parentDialog, CodeDocument *parentDoc) |
|
void | changeTextBlockHighlighting (TextBlock *tb, bool selected) |
|
void | setParagraphBackgroundColor (int position, const QColor &color) |
|
bool | isParaEditable (int para) |
|
bool | textBlockIsClickable (UMLObject *obj) |
|
TextBlock * | findTextBlockAt (int characterPos) |
|
void | clicked (int para, int pos) |
|
CodeEditor::~CodeEditor |
( |
| ) |
|
void CodeEditor::appendText |
( |
TextBlock * |
tb | ) |
|
|
protected |
Appends a TextBlock to the widget.
- Parameters
-
Appends a CodeMethodBlock to the widget.
- Parameters
-
mb | the code method block to add |
Appends a CodeComment to the widget.
- Parameters
-
comment | the code comment to add |
parent | the parent text block |
umlObj | the UML object |
componentName | the name of the component |
void CodeEditor::changeHighlighting |
( |
int |
signal | ) |
|
|
slot |
Colorizes/uncolorizes type for ALL paragraphs.
void CodeEditor::changeShowHidden |
( |
int |
signal | ) |
|
|
slot |
void CodeEditor::changeTextBlockHighlighting |
( |
TextBlock * |
tBlock, |
|
|
bool |
selected |
|
) |
| |
|
private |
void CodeEditor::clearText |
( |
| ) |
|
|
private |
Clear the display of all text.
void CodeEditor::clicked |
( |
int |
para, |
|
|
int |
pos |
|
) |
| |
|
private |
TODO: Used only for debugging right now. int para = tc.position(); –> is the character in the editor int pos = tc.blockNumber(); –> is the row in the editor
bool CodeEditor::close |
( |
| ) |
|
|
protected |
Slot which closes this widget. Returns true if the widget was closed; otherwise returns false. Reimplemented from QWidget.
- Returns
- state of close action
QLabel * CodeEditor::componentLabel |
( |
| ) |
|
|
private |
Return the label on the dialog window. Some info can be shown.
- Returns
- label widget of dialog
void CodeEditor::contentsMouseMoveEvent |
( |
QMouseEvent * |
e | ) |
|
|
protected |
Override the QT event so we can do appropriate things.
void CodeEditor::contextMenuEvent |
( |
QContextMenuEvent * |
event | ) |
|
|
protected |
Shows the context menu. Reimplemented from QWidget::contextMenuEvent().
void CodeEditor::contractSelectedParagraph |
( |
int |
paraToRemove | ) |
|
|
private |
KMenu * CodeEditor::createPopup |
( |
| ) |
|
|
protected |
Create the popup menu.
- Returns
- the popup menu
void CodeEditor::editTextBlock |
( |
TextBlock * |
tBlock, |
|
|
int |
para |
|
) |
| |
|
private |
Allow us to edit, as appropriate, the parent UMLObject of the given text block.
void CodeEditor::expandSelectedParagraph |
( |
int |
priorPara | ) |
|
|
private |
Find the text block in which the character position is located.
- Parameters
-
characterPos | the given character position |
- Returns
- the text block in which the character position is found
Initialization routine which is used in the constructors.
- Parameters
-
void CodeEditor::insertParagraph |
( |
const QString & |
text, |
|
|
int |
para |
|
) |
| |
|
slot |
Insert a paragraph at a given position.
- Parameters
-
text | the paragraph text |
para | the position where to add the text |
void CodeEditor::insertText |
( |
const QString & |
text, |
|
|
TextBlock * |
parent, |
|
|
bool |
editable = false , |
|
|
const QColor & |
fgcolor = QColor("black") , |
|
|
const QColor & |
bgcolor = QColor("white") , |
|
|
UMLObject * |
umlobj = 0 , |
|
|
const QString & |
displayName = QString() , |
|
|
int |
startLine = -1 |
|
) |
| |
|
private |
Main insert routine. Will append if startLine is not supplied or -1.
- Parameters
-
text | the text which has to be inserted |
parent | the parent TextBlock |
editable | flag if editable |
fgcolor | foreground color |
bgcolor | background color |
umlobj | the UML object |
displayName | the name which can be displayed |
startLine | the starting line |
bool CodeEditor::isNonBlank |
( |
const QString & |
str | ) |
|
|
staticprivate |
Return whether or not the passed string is empty or contains nothing but whitespace. Note: The logic is the other way round. In this way we do not need all the "!" in if statements.
bool CodeEditor::isParaEditable |
( |
int |
para | ) |
|
|
private |
Checks if paragraph is editable or not. Method is used only in slotCursorPositionChanged.
- Parameters
-
para | the desired paragraph (character number) |
- Returns
- flag if paragraph is editable or not
void CodeEditor::keyPressEvent |
( |
QKeyEvent * |
e | ) |
|
|
protected |
Implemented so we may capture certain key presses, namely backspace and 'return' events.
void CodeEditor::loadFromDocument |
( |
| ) |
|
|
protected |
(Re) Load the parent code document into the editor.
void CodeEditor::mouseDoubleClickEvent |
( |
QMouseEvent * |
e | ) |
|
|
protected |
Override the QT event so we can do appropriate things.
bool CodeEditor::paraIsNotSingleLine |
( |
int |
para | ) |
|
|
private |
Check whether a block at a given position is on a single line.
- Parameters
-
para | the index of the block in the list |
- Returns
- flag whether block is on a single line
void CodeEditor::rebuildView |
( |
int |
startCursorPos | ) |
|
|
protected |
Rebuild our view of the document. Happens whenever we change some field/aspect of an underlying UML object used to create the view. If connections are right, then the UMLObject will send out the modified() signal which will trigger a call to re-generate the appropriate code within the code document. Our burden is to appropriately prepare the tool: we clear out ALL the textblocks in the KTextEdit widget and then re-show them after the dialog disappears.
void CodeEditor::removeParagraph |
( |
int |
para | ) |
|
|
slot |
Remove a paragraph from a given position.
- Parameters
-
para | the position from where to remove the text |
void CodeEditor::setParagraphBackgroundColor |
( |
int |
position, |
|
|
const QColor & |
color |
|
) |
| |
|
private |
Set the background color at the cursor position.
- Parameters
-
position | the character position |
color | the desired color |
void CodeEditor::slotChangeSelectedBlockCommentView |
( |
| ) |
|
|
protectedslot |
Change the status of the comment writeOutText value to opposite of current value.
void CodeEditor::slotChangeSelectedBlockView |
( |
| ) |
|
|
protectedslot |
Slot to change the view of the selected block. This is called from a popup menu item.
void CodeEditor::slotCopyTextBlock |
( |
| ) |
|
|
protectedslot |
Slot to copy a text block.
void CodeEditor::slotCursorPositionChanged |
( |
| ) |
|
|
protectedslot |
Slot for cursor position changed signal.
void CodeEditor::slotCutTextBlock |
( |
| ) |
|
|
protectedslot |
Slot to cut a text block.
void CodeEditor::slotInsertCodeBlockAfterSelected |
( |
| ) |
|
|
protectedslot |
Slot to insert a code block after the selection.
void CodeEditor::slotInsertCodeBlockBeforeSelected |
( |
| ) |
|
|
protectedslot |
Slot to insert a code block before the selection.
void CodeEditor::slotPasteTextBlock |
( |
| ) |
|
|
protectedslot |
Slot to paste a text block.
void CodeEditor::slotRedrawText |
( |
| ) |
|
|
slot |
Return code viewer state.
- Returns
- state of the code viewer
bool CodeEditor::textBlockIsClickable |
( |
UMLObject * |
obj | ) |
|
|
private |
All umlobjects which may have pop-up boxes should return true here. Yes, a CRAPPY way of doing this. Im not proud. =b.t.
void CodeEditor::updateTextBlockFromText |
( |
TextBlock * |
block | ) |
|
|
private |
Read the text under the cursor and add it to the text block.
- Parameters
-
block | the text block to which the text is added |
bool CodeEditor::m_backspacePressed |
|
private |
bool CodeEditor::m_isHighlighted |
|
private |
int CodeEditor::m_lastPara |
|
private |
int CodeEditor::m_lastPos |
|
private |
TextBlock* CodeEditor::m_lastTextBlockToBeEdited |
|
private |
bool CodeEditor::m_newLinePressed |
|
private |
QString CodeEditor::m_parentDocName |
|
private |
bool CodeEditor::m_showHiddenBlocks |
|
private |
The documentation for this class was generated from the following files: