#ifndef KBEDITOR_H
#define KBEDITOR_H

#include <qvbox.h>
#include <qsplitter.h>
#include <qlabel.h>
#include <qevent.h>
//my addition
#include <qstringlist.h>


#include <kparts/mainwindow.h>
#include <kparts/event.h>
#include <kate/view.h>
#include <kate/document.h>
#include <klibloader.h>
#include <kstdaction.h>     
#include <kpopupmenu.h>

//
// KBEditor , a Kate Based Editor Widget
//
class KBEditor : public QVBox
{
    Q_OBJECT
private:
    Kate::Document *doc ;
    QSplitter *split ;
    Kate::View *view ;
    QStringList descript;
    // void populateList();
    QLabel *lab_linenum, *lab_colnum, *lab_URL , *lab_status ; // , *lab_curword ;
    bool old_read_write_state  ;
    int selected_line ;
    /** HL scheme number for XPicAsm sources */
    uint picHLNumber ;

    Kate::View *currentView();
public:
    KBEditor(QWidget *parent) ;
    int viewCount() ;
    int undoCount() ;
    int redoCount() ;
    int selectionCount() ;
    bool textIsModified() ;
    bool lineNumbersOn();
    bool borderOn();
    bool wrapOn() ;
    bool dosEOLOn() ;

    bool isReadWrite() ;

    KURL fileURL();
    QString fileName() ;
    QString filePathName() ;
    void updateBookmarksMenu(KPopupMenu *pop)     ;
    /** Extract the path from the URL of the the file */
    QString pathName();
    /** Set the line to be highlighted
    \return true if OK, false if already selected
    */
    bool selectLine(int line);
  /** Scan a file and detect DOS  (ie: CR-LF) end of lines
  \return true if the file is detect as a DOS file
  */
  bool isDosFile(const QString &);
  /** No descriptions */
  virtual bool eventFilter(QObject *target, QEvent *event);
  /** No descriptions */
  virtual  ~KBEditor();

public slots:
    void slotAddView() ;
    void slotRemoveCurrentView() ;
    void slotUndo();
    void slotRedo();
    void slotCut();
    void slotCopy();
    void slotPaste();
    void slotSearch();
    void slotReplace();
    void slotGotoLine();
    void slotSave();
    void slotSaveAs() ;
    void slotOpen() ;
    void slotOpen(const KURL&) ;
    void slotToggleDosEOLOn() ;
    void slotToggleLineNumbersOn() ;
    void slotToggleBorderOn() ;
    void slotToggleWrapOn() ;
    void slotCursorPositionChanged() ;
    void slotGotFocus(Kate::View*);
    void slotFileNameChanged() ;
    void slotSetReadWrite(bool) ;
    void slotStatusChanged() ;

    void slotSelectLine() ;
    void slotUnSelectLine();

    void slotGotoBookmark(int num) ;
    /** Uncomment current selection */
    void slotUncomment();
    /** Comment out current selecrion */
    void slotComment();
    // void slotChangedText();
    void slotFindNext();
    void slotFindPrevious();
  /** No descriptions */
  void slotPrintDialog();
  /** No descriptions */
  void slotHlChanged();
  /** No descriptions */
  void slotConfigEditor();
  /** Indent C files thru "astyle" utility */
  void slotIndent();
signals:
    void viewsStateChanged() ;
    void undoRedoStateChanged() ;
    void selectionStateChanged() ;
    void textChanged() ;
    void fileNameChanged() ;
    void gotFocus() ;
    void dropEventPass(QDropEvent *);
    void eolChanged();
} ;

#endif

