ekg2  GIT master
themes.h
Idź do dokumentacji tego pliku.
1 /* $Id$ */
2 
3 /*
4  * (C) Copyright 2001-2003 Wojtek Kaniewski <wojtekka@irc.pl>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License Version 2 as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 #ifndef __EKG_THEMES_H
21 #define __EKG_THEMES_H
22 
23 #include "gettext.h"
24 #define _(a) gettext(a)
25 #define N_(a) gettext_noop(a)
26 
27 #include "dynstuff.h"
28 #include "sessions.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 typedef guint16 fstr_attr_t;
35 
36 typedef struct {
37  gchar *str; /* possibly multibyte string */
38  fstr_attr_t *attr; /* atrybuty, ciąg o długości strlen(str) */
39  time_t ts; /* timestamp */
40 
41  int prompt_len; /* długość promptu, który będzie powtarzany przy
42  przejściu do kolejnej linii. */
43  unsigned int prompt_empty : 1; /* prompt przy przenoszeniu będzie pusty */
44  int margin_left; /* where the margin is set (on what char) */
45  gchar *priv_data; /* can be helpfull */
46 } fstring_t;
47 
48 #define print(x...) print_window_w(NULL, EKG_WINACT_JUNK, x)
49 #define print_status(x...) print_window_w(window_status, EKG_WINACT_JUNK, x)
50 
51 #ifndef EKG2_WIN32_NOFUNCTION
52 
53 void print_window(const char *target, session_t *session, int activity, int separate, const char *theme, ...);
54 
55 void print_info(const char *target, session_t *session, const char *theme, ...);
56 void print_warning(const char *target, session_t *session, const char *theme, ...);
57 
58 void format_add(const char *name, const char *value, int replace);
59 const char *format_find(const char *name);
60 #define format_ok(format_find_result) (format_find_result[0])
61 #define format_exists(format) (format_ok(format_find(format)))
62 char *format_string(const char *format, ...);
63 
64 void theme_init();
65 void theme_plugins_init();
66 void theme_enumerate(int (*enumerator)(const char *theme, const char *value));
67 int theme_read(const char *filename, int replace);
68 int theme_write(const char *filename);
69 void theme_cache_reset();
70 void theme_free();
71 
72 fstring_t *fstring_dup(const fstring_t *str);
73 fstring_t *fstring_new(const char *str);
74 fstring_t *fstring_new_format(const char *format, ...);
75 void fstring_free(fstring_t *str);
76 
77 void fstring_iter(const fstring_t *s, gchar **text, fstr_attr_t **attr, gssize *len);
78 gboolean fstring_next(gchar **text, fstr_attr_t **attr, gssize *len, fstr_attr_t *change);
79 
80 #endif
81 
82 /*
83  * makro udające isalpha() z LC_CTYPE="pl_PL". niestety ncurses coś psuje
84  * i źle wykrywa płeć.
85  */
86 #define isalpha_pl_PL(x) ((x >= 'a' && x <= 'z') || (x >= 'A' && x <= 'Z') || x == 'ą' || x == 'ć' || x == 'ę' || x == 'ł' || x == 'ń' || x == 'ó' || x == 'ś' || x == 'ż' || x == 'ź' || x == 'Ą' || x == 'Ć' || x == 'Ę' || x == 'Ł' || x == 'Ń' || x == 'Ó' || x == 'Ś' || x == 'Ż' || x == 'Ź')
87 
88 typedef enum {
94  FSTR_BACKB = 16,
95  FSTR_BACKC = 32,
97  FSTR_BOLD = 64,
98  FSTR_NORMAL = 128,
99  FSTR_BLINK = 256,
101  FSTR_REVERSE = 1024,
104 } fstr_t;
105 
106 #ifdef __cplusplus
107 }
108 #endif
109 
110 #endif /* __EKG_THEMES_H */
111 
112 /*
113  * Local Variables:
114  * mode: c
115  * c-file-style: "k&r"
116  * c-basic-offset: 8
117  * indent-tabs-mode: t
118  * End:
119  */
void theme_free()
Definition: themes.c:1377
const char * format_find(const char *name)
Definition: ekg_hash_benchmark.c:112
char * format_string(const char *format,...)
Definition: themes.c:842
gchar * str
Definition: themes.h:37
time_t ts
Definition: themes.h:39
void print_info(const char *target, session_t *session, const char *theme,...)
Definition: themes.c:1054
Definition: sessions.h:127
Definition: themes.h:36
int margin_left
Definition: themes.h:44
Definition: ekg_hash_benchmark.c:47
int prompt_len
Definition: themes.h:41
Definition: themes.h:94
fstring_t * fstring_new(const char *str)
Definition: themes.c:636
int theme_read(const char *filename, int replace)
Definition: themes.c:1257
Definition: themes.h:89
Definition: themes.h:90
Definition: themes.h:98
Definition: themes.h:93
fstring_t * fstring_dup(const fstring_t *str)
Definition: themes.c:613
Definition: themes.h:99
void print_window(const char *target, session_t *session, int activity, int separate, const char *theme,...)
Definition: themes.c:1043
Definition: themes.h:91
Definition: themes.h:97
unsigned int prompt_empty
Definition: themes.h:43
Definition: themes.h:95
fstring_t * fstring_new_format(const char *format,...)
Definition: themes.c:801
void print_warning(const char *target, session_t *session, const char *theme,...)
Definition: themes.c:1066
void fstring_iter(const fstring_t *s, gchar **text, fstr_attr_t **attr, gssize *len)
Definition: themes.c:211
void format_add(const char *name, const char *value, int replace)
Definition: ekg_hash_benchmark.c:54
Definition: themes.h:92
gchar * priv_data
Definition: themes.h:45
void theme_init()
Definition: themes.c:1447
Definition: themes.h:100
Definition: themes.h:102
char * name
Definition: stuff.h:68
void fstring_free(fstring_t *str)
Definition: themes.c:824
int theme_write(const char *filename)
Definition: themes.c:1324
guint16 fstr_attr_t
Definition: themes.h:34
void theme_cache_reset()
Definition: themes.c:1116
fstr_attr_t * attr
Definition: themes.h:38
Definition: themes.h:103
void theme_plugins_init()
Definition: themes.c:1388
fstr_t
Definition: themes.h:88
gboolean fstring_next(gchar **text, fstr_attr_t **attr, gssize *len, fstr_attr_t *change)
Definition: themes.c:248
Definition: themes.h:101
#define s
Definition: themes.h:96
void theme_enumerate(int(*enumerator)(const char *theme, const char *value))
Definition: themes.c:1350