00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __KATE_SCHEMA_H__
00021 #define __KATE_SCHEMA_H__
00022
00023 #include "katehighlight.h"
00024 #include "katedialogs.h"
00025
00026 #include <tqstringlist.h>
00027 #include <tqintdict.h>
00028 #include <tqmap.h>
00029 #include <tqlistview.h>
00030 #include <tqfont.h>
00031
00032 #include <tdeconfig.h>
00033 #include <tdeaction.h>
00034
00035 class KateView;
00036 class KateStyleListItem;
00037 class KateStyleListCaption;
00038
00039 class KColorButton;
00040
00041 class TQPopupMenu;
00042 class KComboBox;
00043
00044 class KateSchemaManager
00045 {
00046 public:
00047 KateSchemaManager ();
00048 ~KateSchemaManager ();
00049
00053 void update (bool readfromfile = true);
00054
00058 TDEConfig *schema (uint number);
00059
00060 void addSchema (const TQString &t);
00061
00062 void removeSchema (uint number);
00063
00067 bool validSchema (uint number);
00068
00072 uint number (const TQString &name);
00073
00077 TQString name (uint number);
00078
00082 const TQStringList &list () { return m_schemas; }
00083
00084 static TQString normalSchema ();
00085 static TQString printingSchema ();
00086
00087 private:
00088 TDEConfig m_config;
00089 TQStringList m_schemas;
00090 };
00091
00092
00093 class KateViewSchemaAction : public TDEActionMenu
00094 {
00095 Q_OBJECT
00096
00097 public:
00098 KateViewSchemaAction(const TQString& text, TQObject* parent = 0, const char* name = 0)
00099 : TDEActionMenu(text, parent, name) { init(); };
00100
00101 ~KateViewSchemaAction(){;};
00102
00103 void updateMenu (KateView *view);
00104
00105 private:
00106 void init();
00107
00108 TQGuardedPtr<KateView> m_view;
00109 TQStringList names;
00110 int last;
00111
00112 public slots:
00113 void slotAboutToShow();
00114
00115 private slots:
00116 void setSchema (int mode);
00117 };
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128 class KateStyleListView : public TQListView
00129 {
00130 Q_OBJECT
00131
00132 friend class KateStyleListItem;
00133
00134 public:
00135 KateStyleListView( TQWidget *parent=0, bool showUseDefaults=false);
00136 ~KateStyleListView() {};
00137
00138
00139 void showPopupMenu( KateStyleListItem *i, const TQPoint &globalPos, bool showtitle=false );
00140 void emitChanged() { emit changed(); };
00141
00142 void setBgCol( const TQColor &c ) { bgcol = c; }
00143 void setSelCol( const TQColor &c ) { selcol = c; }
00144 void setNormalCol( const TQColor &c ) { normalcol = c; }
00145
00146 private slots:
00147
00148 void showPopupMenu( TQListViewItem *i, const TQPoint &globalPos );
00149
00150 void slotMousePressed( int, TQListViewItem*, const TQPoint&, int );
00151
00152 void mSlotPopupHandler( int z );
00153 void unsetColor( int );
00154
00155 signals:
00156 void changed();
00157
00158 private:
00159 TQColor bgcol, selcol, normalcol;
00160 TQFont docfont;
00161 };
00162
00163 class KateSchemaConfigColorTab : public TQWidget
00164 {
00165 Q_OBJECT
00166
00167 public:
00168 KateSchemaConfigColorTab( TQWidget *parent = 0, const char *name = 0 );
00169 ~KateSchemaConfigColorTab();
00170
00171 private:
00172 KColorButton *m_back;
00173 KColorButton *m_selected;
00174 KColorButton *m_current;
00175 KColorButton *m_bracket;
00176 KColorButton *m_wwmarker;
00177 KColorButton *m_iconborder;
00178 KColorButton *m_tmarker;
00179 KColorButton *m_linenumber;
00180
00181 KColorButton *m_markers;
00182 KComboBox* m_combobox;
00183
00184
00185 class SchemaColors {
00186 public:
00187 TQColor back, selected, current, bracket, wwmarker, iconborder, tmarker, linenumber;
00188 TQMap<int, TQColor> markerColors;
00189 };
00190
00191
00192 TQMap<int,SchemaColors> m_schemas;
00193
00194 int m_schema;
00195
00196 public slots:
00197 void apply();
00198 void schemaChanged( int newSchema );
00199
00200 signals:
00201 void changed();
00202
00203 protected slots:
00204 void slotMarkerColorChanged(const TQColor&);
00205 void slotComboBoxChanged(int index);
00206 };
00207
00208 typedef TQMap<int,TQFont> FontMap;
00209
00210 class KateSchemaConfigFontTab : public TQWidget
00211 {
00212 Q_OBJECT
00213
00214 public:
00215 KateSchemaConfigFontTab( TQWidget *parent = 0, const char *name = 0 );
00216 ~KateSchemaConfigFontTab();
00217
00218 public:
00219 void readConfig (TDEConfig *config);
00220
00221 public slots:
00222 void apply();
00223 void schemaChanged( int newSchema );
00224
00225 signals:
00226 void changed();
00227
00228 private:
00229 class TDEFontChooser *m_fontchooser;
00230 FontMap m_fonts;
00231 int m_schema;
00232
00233 private slots:
00234 void slotFontSelected( const TQFont &font );
00235 };
00236
00237 class KateSchemaConfigFontColorTab : public TQWidget
00238 {
00239 Q_OBJECT
00240
00241 public:
00242 KateSchemaConfigFontColorTab( TQWidget *parent = 0, const char *name = 0 );
00243 ~KateSchemaConfigFontColorTab();
00244
00245 public:
00246 void schemaChanged (uint schema);
00247 void reload ();
00248 void apply ();
00249
00250 KateAttributeList *attributeList (uint schema);
00251
00252 private:
00253 KateStyleListView *m_defaultStyles;
00254 TQIntDict<KateAttributeList> m_defaultStyleLists;
00255 };
00256
00257 class KateSchemaConfigHighlightTab : public TQWidget
00258 {
00259 Q_OBJECT
00260
00261 public:
00262 KateSchemaConfigHighlightTab( TQWidget *parent = 0, const char *name = 0, KateSchemaConfigFontColorTab *page = 0, uint hl = 0 );
00263 ~KateSchemaConfigHighlightTab();
00264
00265 public:
00266 void schemaChanged (uint schema);
00267 void reload ();
00268 void apply ();
00269
00270 protected slots:
00271 void hlChanged(int z);
00272
00273 private:
00274 KateSchemaConfigFontColorTab *m_defaults;
00275
00276 TQComboBox *hlCombo;
00277 KateStyleListView *m_styles;
00278
00279 uint m_schema;
00280 int m_hl;
00281
00282 TQIntDict< TQIntDict<KateHlItemDataList> > m_hlDict;
00283 };
00284
00285 class KateSchemaConfigPage : public KateConfigPage
00286 {
00287 Q_OBJECT
00288
00289 public:
00290 KateSchemaConfigPage ( TQWidget *parent, class KateDocument *doc=0 );
00291 ~KateSchemaConfigPage ();
00292
00293 public slots:
00294 void apply();
00295 void reload();
00296 void reset();
00297 void defaults();
00298
00299 private slots:
00300 void update ();
00301 void deleteSchema ();
00302 void newSchema ();
00303 void schemaChanged (int schema);
00304
00305 void newCurrentPage (TQWidget *w);
00306
00307 private:
00308 int m_lastSchema;
00309 int m_defaultSchema;
00310
00311 class TQTabWidget *m_tabWidget;
00312 class TQPushButton *btndel;
00313 class TQComboBox *defaultSchemaCombo;
00314 class TQComboBox *schemaCombo;
00315 KateSchemaConfigColorTab *m_colorTab;
00316 KateSchemaConfigFontTab *m_fontTab;
00317 KateSchemaConfigFontColorTab *m_fontColorTab;
00318 KateSchemaConfigHighlightTab *m_highlightTab;
00319 };
00320
00321 #endif
00322
00323