21 #include "kateviewhelpers.h"
22 #include "kateviewhelpers.moc"
24 #include "../interfaces/document.h"
25 #include "../interfaces/katecmd.h"
26 #include "kateattribute.h"
27 #include "katecodefoldinghelpers.h"
28 #include "kateconfig.h"
29 #include "katedocument.h"
30 #include "katefactory.h"
31 #include "katerenderer.h"
33 #include "kateviewinternal.h"
35 #include <tdeapplication.h>
36 #include <tdeglobalsettings.h>
38 #include <knotifyclient.h>
39 #include <tdeglobal.h>
40 #include <kcharsets.h>
41 #include <tdepopupmenu.h>
44 #include <tqpainter.h>
45 #include <tqpopupmenu.h>
48 #include <tqwhatsthis.h>
50 #include <tqtextcodec.h>
57 KateScrollBar::KateScrollBar (Orientation orientation, KateViewInternal* parent,
const char* name)
58 : TQScrollBar (orientation, parent->m_view,
name)
59 , m_middleMouseDown (false)
60 , m_view(parent->m_view)
61 , m_doc(parent->m_doc)
62 , m_viewInternal(parent)
65 , m_savVisibleLines(0)
68 connect(
this, TQ_SIGNAL(valueChanged(
int)), TQ_SLOT(sliderMaybeMoved(
int)));
69 connect(m_doc, TQ_SIGNAL(marksChanged()),
this, TQ_SLOT(marksChanged()));
71 m_lines.setAutoDelete(
true);
74 void KateScrollBar::mousePressEvent(TQMouseEvent* e)
76 if (e->button() == TQt::MidButton)
77 m_middleMouseDown =
true;
79 TQScrollBar::mousePressEvent(e);
84 void KateScrollBar::mouseReleaseEvent(TQMouseEvent* e)
86 TQScrollBar::mouseReleaseEvent(e);
88 m_middleMouseDown =
false;
93 void KateScrollBar::mouseMoveEvent(TQMouseEvent* e)
95 TQScrollBar::mouseMoveEvent(e);
97 if (e->state() | TQt::LeftButton)
101 void KateScrollBar::paintEvent(TQPaintEvent *e)
103 TQScrollBar::paintEvent(e);
107 void KateScrollBar::resizeEvent(TQResizeEvent *e)
109 TQScrollBar::resizeEvent(e);
110 recomputeMarksPositions();
113 void KateScrollBar::styleChange(TQStyle &s)
115 TQScrollBar::styleChange(s);
117 recomputeMarksPositions();
120 void KateScrollBar::valueChange()
122 TQScrollBar::valueChange();
126 void KateScrollBar::rangeChange()
128 TQScrollBar::rangeChange();
129 recomputeMarksPositions();
132 void KateScrollBar::marksChanged()
134 recomputeMarksPositions(
true);
137 void KateScrollBar::redrawMarks()
142 TQPainter painter(
this);
143 TQRect rect = sliderRect();
144 for (TQIntDictIterator<TQColor> it(m_lines); it.current(); ++it)
146 if (it.currentKey() < rect.top() || it.currentKey() > rect.bottom())
148 painter.setPen(*it.current());
149 painter.drawLine(0, it.currentKey(), width(), it.currentKey());
154 void KateScrollBar::recomputeMarksPositions(
bool forceFullUpdate)
156 if (m_topMargin == -1)
157 watchScrollBarSize();
160 m_savVisibleLines = m_doc->visibleLines();
162 int realHeight = frameGeometry().height() - m_topMargin - m_bottomMargin;
164 TQPtrList<KTextEditor::Mark> marks = m_doc->marks();
165 KateCodeFoldingTree *tree = m_doc->foldingTree();
167 for (KTextEditor::Mark *mark = marks.first(); mark; mark = marks.next())
169 uint line = mark->line;
173 KateCodeFoldingNode *node = tree->findNodeForLine(line);
177 if (!node->isVisible())
178 line = tree->getStartLine(node);
179 node = node->getParentNode();
183 line = m_doc->getVirtualLine(line);
185 double d = (double)line / (m_savVisibleLines - 1);
186 m_lines.insert(m_topMargin + (
int)(d * realHeight),
187 new TQColor(KateRendererConfig::global()->lineMarkerColor((KTextEditor::MarkInterface::MarkTypes)mark->type)));
196 void KateScrollBar::watchScrollBarSize()
198 int savMax = maxValue();
200 TQRect rect = sliderRect();
203 m_topMargin = rect.top();
204 m_bottomMargin = frameGeometry().height() - rect.bottom();
207 void KateScrollBar::sliderMaybeMoved(
int value)
209 if (m_middleMouseDown)
210 emit sliderMMBMoved(value);
215 class KateCmdLnWhatsThis :
public TQWhatsThis
218 KateCmdLnWhatsThis( KateCmdLine *parent )
219 : TQWhatsThis( parent )
220 , m_parent( parent ) {;}
222 TQString text(
const TQPoint & )
224 TQString beg =
"<qt background=\"white\"><div><table width=\"100%\"><tr><td bgcolor=\"brown\"><font color=\"white\"><b>Help: <big>";
225 TQString mid =
"</big></b></font></td></tr><tr><td>";
226 TQString
end =
"</td></tr></table></div><qt>";
228 TQString t = m_parent->text();
229 TQRegExp re(
"\\s*help\\s+(.*)" );
230 if ( re.search( t ) > -1 )
234 TQString
name = re.cap( 1 );
235 if ( name ==
"list" )
237 return beg + i18n(
"Available Commands") + mid
238 + KateCmd::self()->cmds().join(
" ")
239 + i18n(
"<p>For help on individual commands, do <code>'help <command>'</code></p>")
242 else if ( !
name.isEmpty() )
247 if ( cmd->
help( (
Kate::View*)m_parent->parentWidget(), name, s ) )
248 return beg +
name + mid + s +
end;
250 return beg +
name + mid + i18n(
"No help for '%1'").arg( name ) +
end;
253 return beg + mid + i18n(
"No such command <b>%1</b>").arg(name) +
end;
257 return beg + mid + i18n(
258 "<p>This is the Katepart <b>command line</b>.<br>"
259 "Syntax: <code><b>command [ arguments ]</b></code><br>"
260 "For a list of available commands, enter <code><b>help list</b></code><br>"
261 "For help for individual commands, enter <code><b>help <command></b></code></p>")
266 KateCmdLine *m_parent;
278 KateCmdLineFlagCompletion() {;}
282 return TQString::null;
289 KateCmdLine::KateCmdLine (KateView *view)
296 , m_oldCompletionObject( 0L )
298 connect (
this, TQ_SIGNAL(returnPressed(
const TQString &)),
299 this, TQ_SLOT(slotReturnPressed(
const TQString &)));
301 completionObject()->insertItems (KateCmd::self()->cmds());
302 setAutoDeleteCompletionObject(
false );
303 m_help =
new KateCmdLnWhatsThis(
this );
306 void KateCmdLine::slotReturnPressed (
const TQString& text )
311 while( text[n].isSpace() )
314 TQString cmd = text.mid( n );
317 if ( cmd.startsWith(
"help" ) )
319 m_help->display( m_help->text( TQPoint() ), mapToGlobal(TQPoint(0,0)) );
321 KateCmd::self()->appendHistory( cmd );
322 m_histpos = KateCmd::self()->historyLength();
323 m_oldText = TQString ();
327 if (cmd.length () > 0)
338 if (p->
exec (m_view, cmd, msg))
340 KateCmd::self()->appendHistory( cmd );
341 m_histpos = KateCmd::self()->historyLength();
342 m_oldText = TQString ();
344 if (msg.length() > 0)
345 setText (i18n (
"Success: ") + msg);
347 setText (i18n (
"Success"));
351 if (msg.length() > 0)
352 setText (i18n (
"Error: ") + msg);
354 setText (i18n (
"Command \"%1\" failed.").arg (cmd));
360 setText (i18n (
"No such command: \"%1\"").arg (cmd));
366 if ( m_oldCompletionObject )
369 setCompletionObject( m_oldCompletionObject );
370 m_oldCompletionObject = 0;
378 TQTimer::singleShot( 4000,
this, TQ_SLOT(hideMe()) );
381 void KateCmdLine::hideMe ()
383 if ( isVisibleTo(parentWidget()) && ! hasFocus() ) {
384 m_view->toggleCmdLine ();
388 void KateCmdLine::focusInEvent ( TQFocusEvent *ev )
400 void KateCmdLine::keyPressEvent( TQKeyEvent *ev )
402 if (ev->key() == Key_Escape)
407 else if ( ev->key() == Key_Up )
409 else if ( ev->key() == Key_Down )
410 fromHistory(
false );
412 uint cursorpos = cursorPosition();
416 if ( ! m_cmdend || cursorpos <= m_cmdend )
419 if ( ! ev->text().isEmpty() )
422 if ( ! m_cmdend && ! c.isNull() )
424 if ( ! c.isLetterOrNumber() && c !=
'-' && c !=
'_' )
426 m_command = KateCmd::self()->queryCommand( text().stripWhiteSpace() );
432 m_cmdend = cursorpos;
441 kdDebug(13025)<<
"keypress in commandline: \\W -- text is "<<text()<<
endl;
442 m_command = KateCmd::self()->queryCommand( text().stripWhiteSpace() );
449 for ( ; m_cmdend < t.length(); m_cmdend++ )
451 if ( t[m_cmdend].isLetter() )
453 if ( b && ( ! t[m_cmdend].isLetterOrNumber() && t[m_cmdend] !=
'-' && t[m_cmdend] !=
'_' ) )
457 if ( c ==
':' && cursorpos == m_cmdend )
466 if ( m_oldCompletionObject )
469 setCompletionObject( m_oldCompletionObject );
470 m_oldCompletionObject = 0;
493 if ( ! m_oldCompletionObject )
494 m_oldCompletionObject = completionObject();
496 setCompletionObject( cmpl );
501 else if ( m_command )
505 && ! ( ev->text().isNull() || ev->text().isEmpty() ) )
510 void KateCmdLine::fromHistory(
bool up )
512 if ( ! KateCmd::self()->historyLength() )
522 s = KateCmd::self()->fromHistory( m_histpos );
527 if ( m_histpos < ( KateCmd::self()->historyLength() - 1 ) )
530 s = KateCmd::self()->fromHistory( m_histpos );
534 m_histpos = KateCmd::self()->historyLength();
535 setText( m_oldText );
542 static TQRegExp reCmd = TQRegExp(
".*[\\w\\-]+(?:[^a-zA-Z0-9_-]|:\\w+)(.*)");
543 if ( reCmd.search( text() ) == 0 )
544 setSelection( text().length() - reCmd.cap(1).length(), reCmd.cap(1).length() );
550 using namespace KTextEditor;
552 static const char*
const plus_xpm[] = {
569 static const char*
const minus_xpm[] = {
586 static const char *
const bookmark_xpm[] = {
684 const int iconPaneWidth = 16;
685 const int halfIPW = 8;
687 KateIconBorder::KateIconBorder ( KateViewInternal* internalView, TQWidget *parent )
688 : TQWidget(parent,
"", (WFlags)(WStaticContents | WRepaintNoErase | WResizeNoErase) )
689 , m_view( internalView->m_view )
690 , m_doc( internalView->m_doc )
691 , m_viewInternal( internalView )
692 , m_iconBorderOn( false )
693 , m_lineNumbersOn( false )
694 , m_foldingMarkersOn( false )
695 , m_dynWrapIndicatorsOn( false )
696 , m_dynWrapIndicators( 0 )
697 , m_cachedLNWidth( 0 )
698 , m_maxCharWidth( 0 )
700 setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Minimum ) );
702 setBackgroundMode( NoBackground );
704 m_doc->setDescription( MarkInterface::markType01, i18n(
"Bookmark") );
705 m_doc->setPixmap( MarkInterface::markType01, TQPixmap((
const char**)bookmark_xpm) );
710 void KateIconBorder::setIconBorderOn(
bool enable )
712 if( enable == m_iconBorderOn )
715 m_iconBorderOn = enable;
719 TQTimer::singleShot( 0,
this, TQ_SLOT(update()) );
722 void KateIconBorder::setLineNumbersOn(
bool enable )
724 if( enable == m_lineNumbersOn )
727 m_lineNumbersOn = enable;
728 m_dynWrapIndicatorsOn = (m_dynWrapIndicators == 1) ? enable : m_dynWrapIndicators;
732 TQTimer::singleShot( 0,
this, TQ_SLOT(update()) );
735 void KateIconBorder::setDynWrapIndicators(
int state )
737 if (state == m_dynWrapIndicators )
740 m_dynWrapIndicators = state;
741 m_dynWrapIndicatorsOn = (state == 1) ? m_lineNumbersOn : state;
745 TQTimer::singleShot( 0,
this, TQ_SLOT(update()) );
748 void KateIconBorder::setFoldingMarkersOn(
bool enable )
750 if( enable == m_foldingMarkersOn )
753 m_foldingMarkersOn = enable;
757 TQTimer::singleShot( 0,
this, TQ_SLOT(update()) );
760 TQSize KateIconBorder::sizeHint()
const
765 w += iconPaneWidth + 1;
767 if (m_lineNumbersOn || (m_view->dynWordWrap() && m_dynWrapIndicatorsOn)) {
768 w += lineNumberWidth();
771 if (m_foldingMarkersOn)
776 return TQSize( w, 0 );
781 void KateIconBorder::updateFont()
783 const TQFontMetrics *fm = m_view->renderer()->config()->fontMetrics();
787 for (
int i = 48; i < 58; i++) {
788 int charWidth = fm->width( TQChar(i) );
789 m_maxCharWidth = kMax(m_maxCharWidth, charWidth);
793 int KateIconBorder::lineNumberWidth()
const
795 int width = m_lineNumbersOn ? ((int)log10((
double)(m_view->doc()->numLines())) + 1) * m_maxCharWidth + 4 : 0;
797 if (m_view->dynWordWrap() && m_dynWrapIndicatorsOn) {
798 width = kMax(style().scrollBarExtent().width() + 4, width);
800 if (m_cachedLNWidth != width || m_oldBackgroundColor != m_view->renderer()->config()->iconBarColor()) {
801 int w = style().scrollBarExtent().width();
802 int h = m_view->renderer()->config()->fontMetrics()->height();
804 TQSize newSize(w, h);
805 if ((m_arrow.size() != newSize || m_oldBackgroundColor != m_view->renderer()->config()->iconBarColor()) && !newSize.isEmpty()) {
806 m_arrow.resize(newSize);
808 TQPainter p(&m_arrow);
809 p.fillRect( 0, 0, w, h, m_view->renderer()->config()->iconBarColor() );
811 h = m_view->renderer()->config()->fontMetrics()->ascent();
813 p.setPen(m_view->renderer()->attribute(0)->textColor());
814 p.drawLine(w/2, h/2, w/2, 0);
820 p.lineTo(w*3/4, h-1);
821 p.lineTo(w-1, h*3/4);
822 p.lineTo(w*3/4, h/2);
825 p.lineTo(w*3/4, h/4);
841 void KateIconBorder::paintEvent(TQPaintEvent* e)
843 paintBorder(e->rect().x(), e->rect().y(), e->rect().width(), e->rect().height());
846 void KateIconBorder::paintBorder (
int ,
int y,
int ,
int height)
848 static TQPixmap minus_px ((
const char**)minus_xpm);
849 static TQPixmap plus_px ((
const char**)plus_xpm);
851 uint h = m_view->renderer()->config()->fontStruct()->fontHeight;
852 uint startz = (y / h);
853 uint endz = startz + 1 + (height / h);
854 uint lineRangesSize = m_viewInternal->lineRanges.size();
857 int m_px = (h - 11) / 2;
862 if ( m_lineNumbersOn || (m_view->dynWordWrap() && m_dynWrapIndicatorsOn) )
864 lnWidth = lineNumberWidth();
865 if ( lnWidth != m_cachedLNWidth || m_oldBackgroundColor != m_view->renderer()->config()->iconBarColor() )
871 m_cachedLNWidth = lnWidth;
872 m_oldBackgroundColor = m_view->renderer()->config()->iconBarColor();
879 int w( this->width() );
881 TQPainter p (
this );
882 p.setFont ( *m_view->renderer()->config()->font() );
885 p.setPen ( m_view->renderer()->config()->lineNumberColor() );
887 KateLineInfo oldInfo;
888 if (startz < lineRangesSize)
890 if ((m_viewInternal->lineRanges[startz].line-1) < 0)
891 oldInfo.topLevel =
true;
893 m_doc->lineInfo(&oldInfo,m_viewInternal->lineRanges[startz].line-1);
896 for (uint z=startz; z <= endz; z++)
901 if (z < lineRangesSize)
902 realLine = m_viewInternal->lineRanges[z].line;
906 p.fillRect( 0, y, w-4, h, m_view->renderer()->config()->iconBarColor() );
907 p.fillRect( w-4, y, 4, h, m_view->renderer()->config()->backgroundColor() );
912 p.drawLine(lnX+iconPaneWidth, y, lnX+iconPaneWidth, y+h);
914 if( (realLine > -1) && (m_viewInternal->lineRanges[z].startCol == 0) )
916 uint mrk ( m_doc->mark( realLine ) );
920 for( uint bit = 0; bit < 32; bit++ )
922 MarkInterface::MarkTypes markType = (MarkInterface::MarkTypes)(1<<bit);
925 TQPixmap *px_mark (m_doc->markPixmap( markType ));
930 int x_px = (iconPaneWidth - px_mark->width()) / 2;
934 int y_px = (h - px_mark->height()) / 2;
938 p.drawPixmap( lnX+x_px, y+y_px, *px_mark);
945 lnX += iconPaneWidth + 1;
949 if( m_lineNumbersOn || (m_view->dynWordWrap() && m_dynWrapIndicatorsOn) )
954 if (m_viewInternal->lineRanges[z].startCol == 0) {
956 p.drawText( lnX + 1, y, lnWidth-4, h, TQt::AlignRight|TQt::AlignVCenter, TQString(
"%1").arg( realLine + 1 ) );
957 }
else if (m_view->dynWordWrap() && m_dynWrapIndicatorsOn) {
958 p.drawPixmap(lnX + lnWidth - m_arrow.width() - 4, y, m_arrow);
965 if( m_foldingMarkersOn )
970 m_doc->lineInfo(&info,realLine);
974 if (info.startsVisibleBlock && (m_viewInternal->lineRanges[z].startCol == 0))
976 if (oldInfo.topLevel)
977 p.drawLine(lnX+halfIPW,y+m_px,lnX+halfIPW,y+h-1);
979 p.drawLine(lnX+halfIPW,y,lnX+halfIPW,y+h-1);
981 p.drawPixmap(lnX+3,y+m_px,minus_px);
983 else if (info.startsInVisibleBlock)
985 if (m_viewInternal->lineRanges[z].startCol == 0)
987 if (oldInfo.topLevel)
988 p.drawLine(lnX+halfIPW,y+m_px,lnX+halfIPW,y+h-1);
990 p.drawLine(lnX+halfIPW,y,lnX+halfIPW,y+h-1);
992 p.drawPixmap(lnX+3,y+m_px,plus_px);
996 p.drawLine(lnX+halfIPW,y,lnX+halfIPW,y+h-1);
999 if (!m_viewInternal->lineRanges[z].wrap)
1000 p.drawLine(lnX+halfIPW,y+h-1,lnX+iconPaneWidth-2,y+h-1);
1004 p.drawLine(lnX+halfIPW,y,lnX+halfIPW,y+h-1);
1006 if (info.endsBlock && !m_viewInternal->lineRanges[z].wrap)
1007 p.drawLine(lnX+halfIPW,y+h-1,lnX+iconPaneWidth-2,y+h-1);
1014 lnX += iconPaneWidth;
1019 KateIconBorder::BorderArea KateIconBorder::positionToArea(
const TQPoint& p )
const
1022 if( m_iconBorderOn ) {
1027 if( m_lineNumbersOn || m_dynWrapIndicators ) {
1028 x += lineNumberWidth();
1032 if( m_foldingMarkersOn ) {
1035 return FoldingMarkers;
1040 void KateIconBorder::mousePressEvent( TQMouseEvent* e )
1042 m_lastClickedLine = m_viewInternal->yToKateLineRange(e->y()).line;
1044 if ( positionToArea( e->pos() ) != IconBorder )
1046 TQMouseEvent
forward( TQEvent::MouseButtonPress,
1047 TQPoint( 0, e->y() ), e->button(), e->state() );
1048 m_viewInternal->mousePressEvent( &forward );
1053 void KateIconBorder::mouseMoveEvent( TQMouseEvent* e )
1055 if ( positionToArea( e->pos() ) != IconBorder )
1057 TQMouseEvent
forward( TQEvent::MouseMove,
1058 TQPoint( 0, e->y() ), e->button(), e->state() );
1059 m_viewInternal->mouseMoveEvent( &forward );
1063 void KateIconBorder::mouseReleaseEvent( TQMouseEvent* e )
1065 uint cursorOnLine = m_viewInternal->yToKateLineRange(e->y()).line;
1067 if (cursorOnLine == m_lastClickedLine &&
1068 cursorOnLine <= m_doc->lastLine() )
1070 BorderArea area = positionToArea( e->pos() );
1071 if( area == IconBorder) {
1072 if (e->button() == TQt::LeftButton) {
1073 if( m_doc->editableMarks() & KateViewConfig::global()->defaultMarkType() ) {
1074 if( m_doc->mark( cursorOnLine ) & KateViewConfig::global()->defaultMarkType() )
1075 m_doc->removeMark( cursorOnLine, KateViewConfig::global()->defaultMarkType() );
1077 m_doc->addMark( cursorOnLine, KateViewConfig::global()->defaultMarkType() );
1079 showMarkMenu( cursorOnLine, TQCursor::pos() );
1083 if (e->button() == TQt::RightButton) {
1084 showMarkMenu( cursorOnLine, TQCursor::pos() );
1088 if ( area == FoldingMarkers) {
1090 m_doc->lineInfo(&info,cursorOnLine);
1091 if ((info.startsVisibleBlock) || (info.startsInVisibleBlock)) {
1092 emit toggleRegionVisibility(cursorOnLine);
1097 TQMouseEvent
forward( TQEvent::MouseButtonRelease,
1098 TQPoint( 0, e->y() ), e->button(), e->state() );
1099 m_viewInternal->mouseReleaseEvent( &forward );
1102 void KateIconBorder::mouseDoubleClickEvent( TQMouseEvent* e )
1104 TQMouseEvent
forward( TQEvent::MouseButtonDblClick,
1105 TQPoint( 0, e->y() ), e->button(), e->state() );
1106 m_viewInternal->mouseDoubleClickEvent( &forward );
1109 void KateIconBorder::showMarkMenu( uint line,
const TQPoint& pos )
1111 TQPopupMenu markMenu;
1112 TQPopupMenu selectDefaultMark;
1114 typedef TQValueVector<int> MarkTypeVector;
1115 MarkTypeVector vec( 33 );
1118 for( uint bit = 0; bit < 32; bit++ ) {
1119 MarkInterface::MarkTypes markType = (MarkInterface::MarkTypes)(1<<bit);
1120 if( !(m_doc->editableMarks() & markType) )
1123 if( !m_doc->markDescription( markType ).isEmpty() ) {
1124 markMenu.insertItem( m_doc->markDescription( markType ), i );
1125 selectDefaultMark.insertItem( m_doc->markDescription( markType ), i+100);
1127 markMenu.insertItem( i18n(
"Mark Type %1").arg( bit + 1 ), i );
1128 selectDefaultMark.insertItem( i18n(
"Mark Type %1").arg( bit + 1 ), i+100);
1131 if( m_doc->mark( line ) & markType )
1132 markMenu.setItemChecked( i,
true );
1134 if( markType & KateViewConfig::global()->defaultMarkType() )
1135 selectDefaultMark.setItemChecked( i+100,
true );
1137 vec[i++] = markType;
1140 if( markMenu.count() == 0 )
1143 if( markMenu.count() > 1 )
1144 markMenu.insertItem( i18n(
"Set Default Mark Type" ), &selectDefaultMark);
1146 int result = markMenu.exec( pos );
1152 KateViewConfig::global()->setDefaultMarkType (vec[result-100]);
1155 config->
setGroup(
"Kate View Defaults");
1156 KateViewConfig::global()->writeConfig( config );
1160 MarkInterface::MarkTypes markType = (MarkInterface::MarkTypes) vec[result];
1161 if( m_doc->mark( line ) & markType ) {
1162 m_doc->removeMark( line, markType );
1164 m_doc->addMark( line, markType );
1170 KateViewEncodingAction::KateViewEncodingAction(KateDocument *_doc, KateView *_view,
const TQString& text, TQObject* parent,
const char* name)
1173 connect(popupMenu(),TQ_SIGNAL(aboutToShow()),
this,TQ_SLOT(slotAboutToShow()));
1176 void KateViewEncodingAction::slotAboutToShow()
1180 popupMenu()->clear ();
1181 for (uint z=0; z<modes.size(); ++z)
1183 popupMenu()->insertItem ( modes[z],
this, TQ_SLOT(setMode(
int)), 0, z);
1188 if (found && codecForEnc)
1190 if (codecForEnc->name() == doc->config()->codec()->name())
1191 popupMenu()->setItemChecked (z,
true);
1196 void KateViewEncodingAction::setMode (
int mode)
1201 doc->setEncodingSticky(
true );
TQTextCodec * codecForName(const TQString &name) const
virtual void focusInEvent(TQFocusEvent *)
virtual void keyPressEvent(TQKeyEvent *)
Extension to the Command interface, allowing to interact with commands during typing.
virtual bool wantsToProcessText(const TQString &cmdname)
virtual void processText(Kate::View *view, const TQString &text)
This is called by the commandline each time the argument text for the command changes,...
virtual TDECompletion * completionObject(const TQString &cmdname, Kate::View *)
virtual bool help(View *view, const TQString &cmd, TQString &msg)=0
Shows help for the given view and cmd string, return a bool about success, msg for status.
virtual bool exec(View *view, const TQString &cmd, TQString &msg)=0
Execute this command for the given view and cmd string, return a bool about success,...
The Kate::View text editor interface.
virtual TQString makeCompletion(const TQString &string)
void setGroup(const TQString &group)
static KCharsets * charsets()
kndbgstream & endl(kndbgstream &s)
kdbgstream kdDebug(int area=0)
void beep(const TQString &reason=TQString::null)
TDEAction * clear(const TQObject *recvr, const char *slot, TDEActionCollection *parent, const char *name=0)
const TDEShortcut & forward()
TQString name(StdAccel id)
const TDEShortcut & end()
const TDEShortcut & selectAll()