forked from qunying/rhide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
idecolor.cc
143 lines (128 loc) · 3.95 KB
/
idecolor.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/* Copyright (C) 1996-2000 Robert H”hne, see COPYING.RH for details */
/* This file is part of RHIDE. */
#include <string.h>
#define Uses_TRect
#define Uses_TColorDialog
#define Uses_TColorGroup
#define Uses_TColorItem
#define Uses_TPalette
#define Uses_TProgram
#define Uses_TDeskTop
#define Uses_TIDEFileEditor
#include <libide.h>
#include "rhide.h"
static TPalette *temp_pal = NULL;
#if 0
class _TColorItem:public TColorItem
{
public:
_TColorItem(const char *nm, uchar idx);
};
_TColorItem::_TColorItem(const char *nm, uchar idx):
TColorItem(_(nm), idx)
{
}
static TColorGroup &
windows_colors(char *name, int base)
{
return
*new TColorGroup(name)
+ *new _TColorItem(__("Frame disabled"), base)
+ *new _TColorItem(__("Frame"), base + 0x01)
+ *new _TColorItem(__("Frame icons"), base + 0x02)
+ *new _TColorItem(__("Scroll bar page"), base + 0x03)
+ *new _TColorItem(__("Scroll bar icons"), base + 0x04)
+ *new _TColorItem(__("Static text"), base + 0x05)
+ *new _TColorItem(__("Selected text"), base + 0x06)
#if 0
+ *new _TColorItem(__("reserved"), base + 0x07)
#endif
;
}
static TColorGroup &
editor_colors(char *name, int base)
{
return
*new TColorGroup(name)
+ *new _TColorItem(__("Frame disabled"), base)
+ *new _TColorItem(__("Frame/background"), base + 0x01)
+ *new _TColorItem(__("Frame icons"), base + 0x02)
+ *new _TColorItem(__("Scroll bar page"), base + 0x03)
+ *new _TColorItem(__("Scroll bar icons"), base + 0x04)
+ *new _TColorItem(__("normal text"), base + 0x05)
+ *new _TColorItem(__("marked text"), base + 0x06)
+ *new _TColorItem(__("comment"), base + 0x07)
+ *new _TColorItem(__("reserved word"), base + 0x08)
+ *new _TColorItem(__("identifier"), base + 0x09)
+ *new _TColorItem(__("symbol"), base + 0x0A)
+ *new _TColorItem(__("string"), base + 0x0B)
+ *new _TColorItem(__("integer"), base + 0x0C)
+ *new _TColorItem(__("float"), base + 0x0D)
+ *new _TColorItem(__("octal"), base + 0x0E)
+ *new _TColorItem(__("hex"), base + 0x0F)
+ *new _TColorItem(__("character"), base + 0x10)
+ *new _TColorItem(__("preprocessor"), base + 0x11)
+ *new _TColorItem(__("illegal char"), base + 0x12)
+ *new _TColorItem(__("user defined words"), base + 0x13)
+ *new _TColorItem(__("CPU line"), base + 0x14)
+ *new _TColorItem(__("Breakpoint"), base + 0x15)
+ *new _TColorItem(__("symbol2"), base + 0x16)
+ *new _TColorItem(__("Cross cursor"), base + 0x17)
+ *new _TColorItem(__("editor statusline"), base + 0x18)
+ *new _TColorItem(__("parens matching"), base + 0x19)
+ *new _TColorItem(__("rectangle block"), base + 0x1A);
}
#else
static void
addItem(TColorGroup * &group, int index, const char *name,
const char *group_name)
{
if (strcmp(name, "reserved") == 0)
return;
if (*group_name)
{
if (!group)
group = new TColorGroup(_(group_name));
else
*group = *group + *new TColorGroup(_(group_name));
}
*group = *group + *new TColorItem(_(name), index);
}
#include <pal.h>
#undef S
#undef S_
#define S(index,foreground,background,name,comment...) \
addItem(group,0x##index,#name,"");
#define S_(index,foreground,background,name,_group,comment...) \
addItem(group,0x##index,#name,#_group);
#endif
static TColorDialog *
GetColorDialog()
{
TColorDialog *c;
TColorGroup *group = NULL;
cpIDEColor
c = new TColorDialog(&TProgram::application->getPalette(), group);
if (temp_pal)
delete temp_pal;
temp_pal = new TPalette(TProgram::application->getPalette());
c->setData(&TProgram::application->getPalette());
return c;
}
void
Colors()
{
TColorDialog *c = GetColorDialog();
if (TProgram::application->validView(c) != 0)
{
if (TProgram::deskTop->execView(c) == cmCancel)
{
// restore the old palette
TProgram::application->getPalette() = *temp_pal;
}
// force to reread the chached colors for the editor
TIDEFileEditor::colorsCached = 0;
Repaint();
destroy(c);
}
}