/* Klat - A LaTeX editor for KDE Copyright (C) 2002-2004 Jori Liesenborgs (jori@lumumba.luc.ac.be) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "klateditwidget.h" #include "klateditwidget.moc" #include "klateditwidgetmanager.h" #include "klattooltab.h" #include #include #include #include KlatEditWidget::KlatEditWidget(QWidget *parent) : QFrame(parent) { KlatEditWidgetManager *mgr; mgr = KlatEditWidgetManager::instance(); doc = mgr->createDocument(); view = (Kate::View *)doc->createView(this); selectLaTeXHighlighting(); QObject::connect(view,SIGNAL(cursorPositionChanged()),this,SLOT(slotCursorPositionChanged())); } KlatEditWidget::~KlatEditWidget() { KlatEditWidgetManager *mgr; mgr = KlatEditWidgetManager::instance(); delete view; mgr->destroyDocument(doc); } void KlatEditWidget::selectLaTeXHighlighting() { QString strlatex("LaTeX"); int num,i,latexnum; num = doc->hlModeCount(); for (i = 0,latexnum = -1 ; i < num ; i++) { if (strlatex == doc->hlModeName(i)) latexnum = i; } if (latexnum >= 0) doc->setHlMode(latexnum); } void KlatEditWidget::slotCursorPositionChanged() { emit cursorPositionChanged(); } bool KlatEditWidget::openURL(const KURL &url) { if (doc->openURL(url)) { selectLaTeXHighlighting(); return true; } return false; } void KlatEditWidget::configDialog() { KlatEditWidgetManager *mgr; Kate::Document *doc; Kate::View *view; mgr = KlatEditWidgetManager::instance(); doc = mgr->createDocument(); view = (Kate::View *)doc->createView(0); doc->configDialog(); mgr->destroyDocument(doc); } void KlatEditWidget::resizeEvent(QResizeEvent *e) { view->resize(e->size()); }