473,385 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Borland Builder c++ faster syntax highlighting??

Hi,I have a question about syntax highlighting. I wrote on Borland Builder c++ and The code works correct. But ,when ı write so many codes on RichEdit,The computer gets slow,and The special codes are colored later, and I can not write perfectly on RichEdit anymore. Because,computer gets slow. What can ı do.I share the codes below. Please answer...




Expand|Select|Wrap|Line Numbers
  1. void __fastcall TForm1::Timer1Timer(TObject *Sender){
  2. ::SendMessage(RichEdit1->Handle, WM_SETREDRAW, false, 0);
  3. int sp = RichEdit1->SelStart;
  4.  
  5. RichEdit1->SelectAll();
  6. RichEdit1->SelAttributes->Color=clBlack;
  7. RichEdit1->SelAttributes->Style=first;
  8.  
  9. String dizi[]={"abstract","do","if","package","synchronized",
  10.                "boolean","double","implements","private","this","break","else","import","protected","throw",
  11.                "byte","extends","instanceof","public","throws","case","false","int","return","transient",
  12.                "catch","final","interface","short","true","char","finally","long","static","try",
  13.                "class","float","native","strictfp","void","const","for","new","super","volatile",
  14.                "continue","goto","null","switch","while","default","assert","String"
  15.  
  16.                };
  17. int sonuc,uzunluk;
  18. String x;
  19. TSearchTypes secenek;
  20. uzunluk=RichEdit1->Text.Length();
  21. secenek=secenek<<stWholeWord;
  22. for(int i=0;i<54;i++){
  23. sonuc=0;
  24.  
  25. a:
  26.  
  27.  sonuc=RichEdit1->FindTextA(dizi[i],sonuc,uzunluk,secenek);
  28.  if(sonuc!=-1){//1.
  29.         RichEdit1->SelStart=sonuc;
  30.         RichEdit1->SelLength=dizi[i].Length();
  31.  
  32.                 if(RichEdit1->SelText==dizi[i])  {
  33.                      RichEdit1->SelAttributes->Style=RichEdit1->SelAttributes->Style<<fsBold;
  34.                      RichEdit1->SelAttributes->Color=clMaroon;
  35.                                                  }
  36.                    else RichEdit1->SelAttributes->Color=clBlack;
  37.                      sonuc=RichEdit1->SelStart+RichEdit1->SelLength;
  38.                      goto a;
  39.  
  40.              }//sonuc!=-1 condition end
  41.  
  42.  
  43.                       }//for loop end
  44.  
  45.  
  46.  
  47.  
  48.  RichEdit1->SelStart = sp;
  49.  
  50.  ::SendMessage(RichEdit1->Handle, WM_SETREDRAW, true, 0);
  51.   RichEdit1->Repaint();
  52.  
  53.  
  54.  
  55.  
  56.  ::SendMessage(RichEdit1->Handle, WM_SETREDRAW, false, 0);
  57.  sp = RichEdit1->SelStart;
  58.  
  59.  
  60. ::SendMessage(RichEdit1->Handle, WM_SETREDRAW, false, 0);
  61. String dizi2[]={"//","/*","*/","\"","\"","\'","\'"};
  62.  
  63.  
  64.  
  65. uzunluk=RichEdit1->Text.Length();
  66. secenek=secenek>>stWholeWord;
  67. secenek=secenek<<stMatchCase;
  68. for(int i=0;i<7;i++){
  69. sonuc=0;
  70.  
  71. b:
  72.  
  73.  sonuc=RichEdit1->FindTextA(dizi2[i],sonuc,uzunluk,secenek);
  74.  if(sonuc!=-1){//1.
  75.  
  76.            if(i==0){
  77.  RichEdit1->SelStart=sonuc;
  78.  RichEdit1->SelLength=RichEdit1->Lines->Strings[RichEdit1->CaretPos.y].Length()-RichEdit1->CaretPos.x;
  79.  
  80.  RichEdit1->SelAttributes->Style=RichEdit1->SelAttributes->Style<<fsItalic;
  81.  RichEdit1->SelAttributes->Color=clGreen;
  82.                     }
  83.      else  if(i==1){
  84.  RichEdit1->SelStart=sonuc;
  85.  int temp=RichEdit1->FindTextA("*/",sonuc+2,uzunluk,secenek);
  86.  
  87.  RichEdit1->SelLength=temp-sonuc;
  88. RichEdit1->SelAttributes->Style=RichEdit1->SelAttributes->Style<<fsItalic;
  89.  RichEdit1->SelAttributes->Color=clGreen;
  90.  
  91.                  }
  92.  else if(i==2){
  93.  RichEdit1->SelStart=sonuc;
  94.  RichEdit1->SelLength=dizi2[i].Length();
  95.     RichEdit1->SelAttributes->Style=RichEdit1->SelAttributes->Style<<fsItalic;
  96.  RichEdit1->SelAttributes->Color=clGreen;
  97.              }
  98.  else if(i==3){
  99.  
  100.  RichEdit1->SelStart=sonuc;
  101.  int temp=RichEdit1->FindTextA("\"",sonuc+1,uzunluk,secenek);
  102.  RichEdit1->SelLength=temp-sonuc;
  103.   RichEdit1->SelAttributes->Style=RichEdit1->SelAttributes->Style<<fsBold;
  104.  RichEdit1->SelAttributes->Color=clBlue;
  105.  if(temp!=-1){
  106.   RichEdit1->SelStart=temp+1;
  107.   RichEdit1->SelLength=0;
  108.   RichEdit1->SelAttributes->Color=clBlack;
  109.              }
  110.  
  111.                }
  112.   else if(i==4){
  113.  RichEdit1->SelStart=sonuc;
  114.  RichEdit1->SelLength=dizi2[i].Length();
  115.     RichEdit1->SelAttributes->Style=RichEdit1->SelAttributes->Style<<fsBold;
  116.  RichEdit1->SelAttributes->Color=clBlue;
  117.  
  118.                 }
  119.  else if(i==5) {
  120.     RichEdit1->SelStart=sonuc;
  121.  int temp=RichEdit1->FindTextA("\'",sonuc+1,uzunluk,secenek);
  122.  RichEdit1->SelLength=temp-sonuc;
  123.   RichEdit1->SelAttributes->Style=RichEdit1->SelAttributes->Style<<fsBold;
  124.  RichEdit1->SelAttributes->Color=clBlue;
  125.  if(temp!=-1){
  126.   RichEdit1->SelStart=temp+1;
  127.   RichEdit1->SelLength=0;
  128.   RichEdit1->SelAttributes->Color=clBlack;
  129.                }
  130.  
  131.                    }
  132.      else if(i==6){
  133.  RichEdit1->SelStart=sonuc;
  134.  RichEdit1->SelLength=dizi2[i].Length();
  135.     RichEdit1->SelAttributes->Style=RichEdit1->SelAttributes->Style<<fsBold;
  136.  RichEdit1->SelAttributes->Color=clBlue;
  137.  
  138.                 }
  139.  
  140.  
  141.                   else RichEdit1->SelAttributes->Color=clBlack;
  142.                      sonuc=RichEdit1->SelStart+RichEdit1->SelLength;
  143.                      goto b;
  144.  
  145.              }//sonuc!=-1 condition end
  146.  
  147.  
  148.                       }//for loop end
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.   RichEdit1->SelStart = sp;
  156.  
  157. ::SendMessage(RichEdit1->Handle, WM_SETREDRAW, true, 0);
  158.  RichEdit1->Repaint();
  159.   RichEdit1->SetFocus();
  160.   //finish
  161.  
  162. }
  163.  
Oct 10 '10 #1
0 1509

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Jay Davis | last post by:
I use xemacs and syntax highlighting for my IDE, but I'm not a big fan of the default syntax highlighting colors. For instance, in 'def fun():' both 'def' and 'fun' are the same color. I kind of...
4
by: Bob hotmail.com> | last post by:
Everyone I have been spending weeks looking on the web for a good tutorial on how to use regular expressions and other methods to satisfy my craving for learning how to do FAST c-style syntax...
0
by: duggie | last post by:
Does anyone know of an easy way to convert Borland Builder 4 code to MS Visual C v6? -- Cheers, Duggie
4
by: Patrick Porter | last post by:
Arrrgh! I have tried everything (ok, not EVERYTHING) but i cant get solve the problem of getting syntax highlighting in a rich textbox. in the code below, im attempting to highlight all of the...
0
by: Marco Aschwanden | last post by:
Hi There almost no pages on how to embed Python in Borland Builder C++ (6.0). Any hints in this matter are very welcome... Thanks, Marco
2
by: Jens Hibbeler | last post by:
Hello, I am trying to compile the Boost library with the Borland Builder 6 enviorement. But it seems that it is not possible to use the Thread library which is especealli important for me. Has...
2
by: rockstar_ | last post by:
Hello all- I'm developing a Content Management software for my own site, and possibly package and deploy to other sites (for friends, family, etc.) The content management software is combined...
11
by: Christoph Burschka | last post by:
Are there any free PHP libraries/utility functions that can color the syntax of various programming languages (eg. Java and C++)? I am posting code snippets on my site and would like to know if...
0
by: Scott | last post by:
Hi, I think I may have finally found a IDE/text editor that I like, but, it still haves one problem. Geany haves syntax highlighting, but it is not very good for Python. It only seems to have...
1
by: MArekM | last post by:
Hi all! I'm trying to paint some graphics with the use Borland Builder C++ v.6. Some times ago I used the BGI graphics library and I know the function putpixel(), which draws a pixel in given...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.