00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef KATEDIALOGS_H
00020 #define KATEDIALOGS_H
00021 #include <kdialog.h>
00022 #include <kdialogbase.h>
00023 #include "katesyntaxdocument.h"
00024 #include "katehighlight.h"
00025 #include <klistview.h>
00026 #include <qtabwidget.h>
00027 #include <kcolorbutton.h>
00028
00029 class QWidgetStack;
00030 class QVBox;
00031 class KListView;
00032 class QListViewItem;
00033 struct syntaxContextData;
00034 class QCheckBox;
00035
00036 #define HlEUnknown 0
00037 #define HlEContext 1
00038 #define HlEItem 2
00039
00040
00041
00042 class StyleChanger : public QWidget {
00043 Q_OBJECT
00044 public:
00045 StyleChanger(QWidget *parent );
00046 void setRef(ItemStyle *);
00047 void setEnabled(bool);
00048 protected slots:
00049 void changed();
00050 protected:
00051 ItemStyle *style;
00052 KColorButton *col;
00053 KColorButton *selCol;
00054 QCheckBox *bold;
00055 QCheckBox *italic;
00056 };
00057
00058 class HighlightDialogPage : public QTabWidget
00059 {
00060 Q_OBJECT
00061 public:
00062 HighlightDialogPage(HlManager *, ItemStyleList *, HlDataList *, int hlNumber,
00063 QWidget *parent=0, const char *name=0);
00064 void saveData();
00065
00066 protected slots:
00067 void defaultChanged(int);
00068
00069 void hlChanged(int);
00070 void itemChanged(int);
00071 void changed();
00072 void hlEdit();
00073 void hlNew();
00074 protected:
00075 StyleChanger *defaultStyleChanger;
00076 ItemStyleList *defaultItemStyleList;
00077
00078 void writeback();
00079 QComboBox *itemCombo, *hlCombo;
00080 QLineEdit *wildcards;
00081 QLineEdit *mimetypes;
00082 QCheckBox *styleDefault;
00083 StyleChanger *styleChanger;
00084
00085 HlDataList *hlDataList;
00086 HlData *hlData;
00087 ItemData *itemData;
00088 };
00089
00090 class ItemInfo
00091 {
00092 public:
00093 ItemInfo():trans_i18n(),length(0){};
00094 ItemInfo(QString _trans,int _length):trans_i18n(_trans),length(_length){};
00095 QString trans_i18n;
00096 int length;
00097 };
00098
00099 class HighlightDialog : public KDialogBase
00100 {
00101 Q_OBJECT
00102 public:
00103 HighlightDialog( HlManager *hlManager, ItemStyleList *styleList,
00104 HlDataList *highlightDataList,
00105 int hlNumber, QWidget *parent,
00106 const char *name=0, bool modal=true );
00107 private:
00108 HighlightDialogPage *content;
00109 protected:
00110 virtual void done(int r);
00111 };
00112
00113 class HlEditDialog : public KDialogBase
00114 {
00115 Q_OBJECT
00116 public:
00117 HlEditDialog(HlManager *,QWidget *parent=0, const char *name=0, bool modal=true, HlData *data=0);
00118 private:
00119 class QWidgetStack *stack;
00120 class QVBox *contextOptions, *itemOptions;
00121 class KListView *contextList;
00122 class QListViewItem *currentItem;
00123 void initContextOptions(class QVBox *co);
00124 void initItemOptions(class QVBox *co);
00125 void loadFromDocument(HlData *hl);
00126 void showContext();
00127 void showItem();
00128
00129 QListViewItem *addContextItem(QListViewItem *_parent,QListViewItem *prev,struct syntaxContextData *data);
00130 void insertTranslationList(QString tag, QString trans,int length);
00131 void newDocument();
00132
00133 class QLineEdit *ContextDescr;
00134 class QComboBox *ContextAttribute;
00135 class QComboBox *ContextLineEnd;
00136
00137 class QComboBox *ItemType;
00138 class QComboBox *ItemContext;
00139 class QLineEdit *ItemParameter;
00140 class QComboBox *ItemAttribute;
00141
00142 class QMap<int,QString> id2tag;
00143 class QMap<int,ItemInfo> id2info;
00144 class QMap<QString,int> tag2id;
00145 int transTableCnt;
00146 protected slots:
00147 void currentSelectionChanged ( QListViewItem * );
00148 void contextDescrChanged(const QString&);
00149 void contextLineEndChanged(int);
00150 void contextAttributeChanged(int);
00151 void contextAddNew();
00152
00153 void ItemTypeChanged(int id);
00154 void ItemParameterChanged(const QString& name);
00155 void ItemAttributeChanged(int attr);
00156 void ItemContextChanged(int cont);
00157 void ItemAddNew();
00158 };
00159
00160 #endif