cs_Akil
Messages postés1Date d'inscriptionjeudi 17 janvier 2002StatutMembreDernière intervention17 janvier 2002
-
17 janv. 2002 à 12:45
cs_Mr.X
Messages postés118Date d'inscriptionmercredi 22 octobre 2003StatutMembreDernière intervention 2 novembre 2007
-
24 févr. 2005 à 19:59
Bonjour à tous
Je cherche quelqu'un qui sait bien programmer en langage C++ et Vb.
J'ai un projet d'éditeur de texte Farsi (Righttoleft)
en C++ et je voudrais faire la même chose en Vb
Il y a 50Frs de cadeau pour celui ou celle qui aidra à résoudre mon probleme j'ai joint une partie de code. Si vous sentez capable de faire la même chose en Vb envoyer moi un e-mail à R.kadimi@online.fr pour que je vous envoie le projet de l'éditeur Merci !!!
void CFarsiRichEdit::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
int x = (begin_x - point.x) / W_font;
/*
int y = (begin_x - point.x) - x * W_font;
int z = W_font / 2;
*/
GetWindowText(str);
if (!str.IsEmpty())
if (x < str.GetLength())
pos = str.GetLength() - x - 1;
CRichEditCtrl::OnLButtonDown(nFlags, point);
}
UCHAR CFarsiRichEdit::prev_char()
{
int i = pos ;
while ((str[i] > 0 && str[i] < 8) || str[i] == 22) {//eraab
i++;
if (i == str.GetLength())
break;
}
if (i == str.GetLength())
return(' ');
return (str[i]);
if ((pos > str.GetLength())&&(!isdigit(ch)))
if (str.GetLength() > 0)
next = str[str.GetLength()-1];
else if (pos > 0 && pos <= str.GetLength())
next = str[(int)pos - 1];
else
next = ' ';
int retval = 0;
/* return value:
0 : changing is done compeletly in this function.
1 : we are in R2L direction and prev character(just right the cursor)
is converted to uppercase and must be rewritten.
2 : we are in L2R direction and the character(just left the cursor)
is converted and must be rewritten. */
/****************************************************************/
//2-mapping next char (after inserted char if exists).
UCHAR c = next;
if (join_to_prev((UCHAR)ch)) {
switch (c) {
case 229://ghein!!
c = 230;
break;
case 232://ghein!!
c = 231;
break;
case 228://ein!!
c = 227;
break;
case 225://ein!!
c = 226;
break;
case 251://he!!
c = 250;
break;
case 144://aa!!
c = 145;
break;
}
}
else {
switch (c) {
case 230://ghein!!
c = 229;
break;
case 231://ghein!!
c = 232;
break;
case 227://ein!!
c = 228;
break;
case 226://ein!!
c = 225;
break;
case 250://he!!
c = 251;
break;
case 145://aa!!
c = 144;
break;
}
}
if (next != c) {
if (pos <= str.GetLength() && pos > 0) {
str.SetAt(pos-1, c);
SetWindowText(RemapCharacters(str));
}
}
// returns 1 if ch does not join to prev farsi char
if (not_join_to_prev(ch)) {
//if ch does not join to prev farsi char a convert
//for making prev farsi char upper case is needed
UCHAR c =farsi_upper_case(prev);
if (c == 252) //ie
if (pos + 1 < str.GetLength()) {
if (!joins_to_next(str[pos + 1]))
c = 253;
}else
c = 253;
if (c != prev) {
if (pos >= 0 && pos < str.GetLength()) {
str.SetAt(pos, c);
SetWindowText(RemapCharacters(str));
}
if (c==19 || c==20 || c==12) return 0;
if (c<8 || c==22) return 1;
if (c>=141 && c<=175)
return group_141_to_175[c-141]=='1';
else if (c>=224)
return group_224_to_254[c-224]=='1';
//MEHR strech
if (c==(UCHAR)'‹')
return 1;
//MEHR end
return 0;
}
int CFarsiRichEdit::join_to_prev(UCHAR ch)
{
//if prev char is one of these ,next char will join to previf ((ch 142)||(ch 147)||(ch ==149)||(ch == 151)||(ch==153)||(ch155)||(ch 157)||(ch == 159)||(ch == 161)||(ch ==168)||(ch 170)||(ch 172)|| (ch == 174)|| (ch == 175)||
(ch == 224 )||(ch== 227)||(ch ==228)||(ch ==231)||(ch ==232)||
(ch ==234)||(ch ==236)||(ch ==238)|| (ch ==240)||(ch == 243)|| (ch 245)||(ch247)||(ch ==250)||(ch == 251)||(ch ==254))
return 1;
return 0;
}
int CFarsiRichEdit::not_join_to_prev(UCHAR ch)
{
if ((ch>=' ') && (ch<=(UCHAR)'Š')) // english char or Farsi digit
return 1;
if ((ch>=(UCHAR)'') && (ch<=(UCHAR)'¯'))
return 0;
if ((ch<8) || (ch==22)) // e'raab
return 0;
if ((ch==19) || (ch==20) || (ch==12)) // taa and zaa tanhaa and te gerd
return 0;
if ((ch>=(UCHAR)'à') && (ch<=(UCHAR)'þ'))
return 0;
if (ch==(UCHAR)'‹')
return 0;
if (ch ==(UCHAR)210)/*\*/
return 0;