Autor Beitrag
Harry M.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: So 29.05.05 23:08 
Wie kann ich in Synedit einen neuen Key definieren, so das er dann Ge-Highlightet wird. Ich habe zwar schon in den Units von SynEdit "rumgespielt" kam aber leider nicht zum gewünschten Ergebis. Brauchen tue ich dies für den Bat- und Pas-Highlighter.

_________________
Gruß Harry
Et spes me per dies sine te ducat et amor me ferat, si dolor spem tollit.
TimonWorld
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 397



BeitragVerfasst: Mi 03.08.05 13:52 
Wenn du mir vielleicht noch sagen könntest, was du unter Key verstehst?! :roll:
en!gma
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 378

win xp
delphi 7.0
BeitragVerfasst: Mi 03.08.05 15:04 
ich denke er meint keyword.

also zB
irgendeinewichtigevariable = bold

dass er die grundsätzlich im bold style macht
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Mi 03.08.05 15:45 
wenns diese komponente von torry ist, dann guckst du mal in die readme, da steht wie man sich ein highlighting selbst schreibt :wink:
Harry M. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Mi 03.08.05 22:48 
Mit Key meine ich das Hervorgehobene. ZB bei Pascal-Highlighting wird doch doch procedure hervorgehoben. Ich möchte jetzt aber, das ich sagen kann DasWort soll hervorgehoben werden. Im Editfeld soll dann DasWort zu DasWort werden.

Alles Klar?? :lol:
Ich habe übrigens SynEdit von synedit.sourceforge.net und wie dort die Keys gehighlighted werden im Source, blick ich nicht durch.

_________________
Gruß Harry
Et spes me per dies sine te ducat et amor me ferat, si dolor spem tollit.
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Mi 03.08.05 23:29 
schau dir mal den UniHighlighter für SynEdit an

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
Harry M. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Mi 03.08.05 23:52 
Jo. Der tut was ich such. Danke :lol:

_________________
Gruß Harry
Et spes me per dies sine te ducat et amor me ferat, si dolor spem tollit.
TimonWorld
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 397



BeitragVerfasst: Do 04.08.05 08:03 
Gibt es eigentlich irgendwo ein Tut, wo steht wie man so ein Highlighter programmiert? Da ich Delphi 3 benutze, kann ich auf UniHighlighter nicht zurückgreifen :cry:

Gruß,
Timon.
en!gma
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 378

win xp
delphi 7.0
BeitragVerfasst: Do 04.08.05 09:59 
hmm weiss nicht,
hab noch keins gesehen, aber villeicht solltest du dir die beigelegten demos einfach mal anschauen
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Do 04.08.05 10:10 
kommt drauf an, ob du es live highlighten willst oder per button klick, du musst halt immer nur suchen, ich hatte mal angefangen einen highlighter zu schreiben, der alles highlightet (also nicht live machbar) die einzelnen highlights funzen schon, aber zusammen noch nicht und einige fehler sind noch drin, aber nur um mal so eine idee zu bekommen:
ausblenden volle Höhe Delphi-Quelltext
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:
var
  ReservedWords: array[0..75] of string =
    ('and', 'array', 'as', 'asm', 'at', 'begin', 'case', 'class', 'const',
     'constructor', 'default', 'destructor', 'dispinterface', 'div', 'do',
     'downto', 'else', 'end', 'except', 'exports', 'file', 'finalization',
     'finally', 'for', 'function', 'goto', 'if', 'implementation', 'in',
     'inherited', 'initialization', 'inline', 'interface', 'is', 'label',
     'library', 'message', 'mod', 'nil', 'not', 'object', 'of', 'on', 'or',
     'out', 'packed', 'procedure', 'program', 'property', 'raise', 'read',
     'record', 'repeat', 'resourcestring', 'set', 'shl', 'shr', 'string',
     'stored', 'then', 'threadvar', 'to', 'try', 'type', 'unit', 'until',
     'uses', 'var', 'while', 'with', 'write', 'xor', 'private', 'protected',
     'public', 'published');
  AllowedChars: array[0..5] of string =
    ('(', ')', '[', ']', ' ', '');
  t, t1, t2, t3: boolean;

implementation

{$R *.dfm}

procedure HighlightReservedWords(re: Trichedit);
var
  i, j, k: integer;
  rword, str: string;
begin
  for i:= 1 to length(re.Text) do
    for j:= 0 to High(ReservedWords) do
      begin
        application.processmessages;
        rword:= ReservedWords[j];
        str:= Copy(re.text, i, Length(rword));
        if (str = rword) then
          begin
            re.SelStart:= i - 1;
            re.Sellength:= length(rword);
            re.SelAttributes.Color:= clnavy;
            re.SelAttributes.style:= [fsbold];
          end;
      end;
end;

procedure HighlightStrings(re: TRichedit);
var
  i: integer;
begin
  t:= false;
  for i:= 1 to length(re.text) do
    begin
      application.processmessages;
      if not (t) then
        begin
          if re.text[i] = '''' then
            begin
              t:= true;
              re.selstart:= i - 1;
            end;
        end else
          if (t) and (re.Text[i] = '''') then
            begin
              t:= false;
              re.SelLength:= i - re.selstart;
              re.SelAttributes.Color:= clblue;
              re.SelAttributes.Style:= [];
            end;
    end;
end;

procedure HighLightComments(re: TRichedit);
var
  i: integer;
  str: string;
begin
  t1:= false;
  t2:= false;
  t3:= false;
  for i:= 1 to length(re.text) do
    begin
      application.processmessages;
      str:= copy(re.text, i, 2);
      if not ((t1) or (t2) or (t3)) then
        begin
          if str = '//' then
            t1:= true;
          if str = '(*' then
            t2:= true;
          if str[1] = '{' then
            t3:= true;
          if ((t1) or (t2) or (t3)) then
            re.SelStart:= i - 1;
        end else
          begin
            if (t1) and (str = #13#10) then
              begin
                t1:= false;
                re.SelLength:= i - re.selstart + 1;
                re.SelAttributes.Color:= clgreen;
                re.SelAttributes.Style:= [];
              end;
            if (t2) and (str = '*)') then
              begin
                t2:= false;
                re.SelLength:= i - re.SelStart + 1;
                re.SelAttributes.Color:= clgreen;
                re.SelAttributes.Style:= [];
              end;
            if (t3) and (str[1] = '}') then
              begin
                t3:= false;
                re.SelLength:= i - re.SelStart;
                re.SelAttributes.Color:= clgreen;
                re.SelAttributes.Style:= [];
              end;
          end;
    end;
end;

procedure SyntaxHighLighting(re: TRichEdit);
begin
  re.Font.Name:= 'arial';
  re.Font.Color:= clblack;
  HighlightReservedWords(re);
  HighlightStrings(re);
  HighlightComments(re);
  HighlightStrings(re); //Nur zu testzwecken !
end;
en!gma
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 378

win xp
delphi 7.0
BeitragVerfasst: Do 04.08.05 10:12 
kann man es dann nicht einfach ins onchange setzten?
dann isses doch "live" oder?
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Do 04.08.05 10:19 
dauert aber ewig, deshalb würde ich dann immer nur das zuletzt geschriebene wort testen, sonst schmiert das programm ab :roll:
Harry M. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Do 04.08.05 15:35 
Der Code von F34r0fTh3D4rk siehst schonmal echt gut aus. Ich werde das heute abend mal testen.

_________________
Gruß Harry
Et spes me per dies sine te ducat et amor me ferat, si dolor spem tollit.
TimonWorld
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 397



BeitragVerfasst: Fr 05.08.05 12:42 
RichEdit?

Sieht wirklich nicht schlecht aus, wenn es noch ein TCustomHighlighter-Port gäbe. Was ich an den SynEdit-Highlightern so nicht mag, ist das, dass jedes hervorgehobene Wort eine eigene Funktion hat.

Gruß,
Timon.
Vitalik
Hält's aus hier
Beiträge: 2



BeitragVerfasst: Di 25.10.05 18:36 
user profile iconGSE hat folgendes geschrieben:
schau dir mal den UniHighlighter für SynEdit an

I'm really sorry, but I don't know Dutch :(
But I found link on old UniHighlighter site here. And want to say you that it was created new site for component UniHighlighter: www.unihighlighter.com
And, by the way, it was published new alpha-version of UniHighlighter 2.0 recently :)
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Di 25.10.05 18:46 
thx
Zitat:
I'm really sorry, but I don't know Dutch
me either. only german :wink:
I'll check this out (I'm using it in some of my apps).

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)


Zuletzt bearbeitet von GSE am Mi 26.10.05 22:18, insgesamt 1-mal bearbeitet
Vitalik
Hält's aus hier
Beiträge: 2



BeitragVerfasst: Mi 26.10.05 15:26 
user profile iconGSE hat folgendes geschrieben:
thx
I'll check this out (I#m using it in some of my apps).

If you have questions about usage of new versions of UniHighlighter (I think you will have them) then ask them in official English forum: www.delphist.com/for....php?act=SF&f=13 or in Russian one: forum.vingrad.ru/index.php?showforum=170 ;)