From 5982aaece693a5e2203eba2ae6470cc27aebea47 Mon Sep 17 00:00:00 2001 From: Programerus Date: Wed, 21 Mar 2012 21:09:59 +0100 Subject: [PATCH] Comments translated from French to English. --- src/edit.cpp | 308 +++++++++++++++++++++++++-------------------------- 1 file changed, 154 insertions(+), 154 deletions(-) diff --git a/src/edit.cpp b/src/edit.cpp index e38af22d..8264dad2 100644 --- a/src/edit.cpp +++ b/src/edit.cpp @@ -12,7 +12,9 @@ // * GNU General Public License for more details. // * // * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/.// edit.cpp +// * along with this program. If not, see http://www.gnu.org/licenses/. + +// edit.cpp #define STRICT #define D3D_OVERLOADS @@ -38,14 +40,14 @@ #define MARGY (5.0f/480.0f) #define MARGYS (4.0f/480.0f) #define MARGY1 (1.0f/480.0f) -#define DELAY_DBCLICK 0.3f // délai pour double-clic -#define DELAY_SCROLL 0.1f // délai pour défilement -#define BIG_FONT 1.6f // agrandissement pour \b; +#define DELAY_DBCLICK 0.3f // time limit for double-click +#define DELAY_SCROLL 0.1f // time limit for scroll +#define BIG_FONT 1.6f // expansion for \b; -// Indique si un caractère est un espace. +// Indicates whether a character is a space. BOOL IsSpace(int character) { @@ -54,7 +56,7 @@ BOOL IsSpace(int character) character == '\n' ); } -// Indique si un caractère fait partie d'un mot. +// Indicates whether a character is part of a word. BOOL IsWord(int character) { @@ -67,7 +69,7 @@ BOOL IsWord(int character) c == '_' ); } -// Indique si un caractère est un séparateur de mot. +// Indicates whether a character is a word separator. BOOL IsSep(int character) { @@ -77,7 +79,7 @@ BOOL IsSep(int character) -// Constructeur de l'objet. +// Object's constructor. CEdit::CEdit(CInstanceManager* iMan) : CControl(iMan) { @@ -116,7 +118,7 @@ CEdit::CEdit(CInstanceManager* iMan) : CControl(iMan) m_undoOper = OPERUNDO_SPEC; } -// Destructeur de l'objet. +// Object's destructor. CEdit::~CEdit() { @@ -136,7 +138,7 @@ CEdit::~CEdit() } -// Crée une nouvelle ligne éditable. +// Creates a new editable line. BOOL CEdit::Create(FPOINT pos, FPOINT dim, int icon, EventMsg eventMsg) { @@ -162,7 +164,7 @@ BOOL CEdit::Create(FPOINT pos, FPOINT dim, int icon, EventMsg eventMsg) else { m_bMulti = TRUE; - MoveAdjust(); // réajuste en mode multi-lignes + MoveAdjust(); // readjusts multi-line mode m_scroll = new CScroll(m_iMan); pc = (CScroll*)m_scroll; pc->Create(pos, dim, -1, EVENT_NULL); @@ -231,7 +233,7 @@ void CEdit::MoveAdjust() } -// Gestion d'un événement. +// Management of an event. BOOL CEdit::EventProcess(const Event &event) { @@ -525,7 +527,7 @@ BOOL CEdit::EventProcess(const Event &event) } if ( m_bCapture ) { - if ( m_timeLastClick+DELAY_DBCLICK > m_time ) // double-clic ? + if ( m_timeLastClick+DELAY_DBCLICK > m_time ) // double-click ? { MouseDoubleClick(event.pos); } @@ -538,7 +540,7 @@ BOOL CEdit::EventProcess(const Event &event) } -// Envoie un événement pour indiquer que le texte a été modifié. +// Sends an event to indicate that the text was modified. void CEdit::SendModifEvent() { @@ -549,7 +551,7 @@ void CEdit::SendModifEvent() } -// Détecte si la souris est sur un caractère lien hypertexte. +// Detects whether the mouse is over a hyperlink character. BOOL CEdit::IsLinkPos(FPOINT pos) { @@ -566,13 +568,13 @@ BOOL CEdit::IsLinkPos(FPOINT pos) } -// Positionne le curseur suite à un double-clic. +// Positions the cursor after a double click. void CEdit::MouseDoubleClick(FPOINT mouse) { int i, character; - if ( m_bMulti ) // multi-lignes ? + if ( m_bMulti ) // Multi-line? { i = MouseDetect(mouse); if ( i == -1 ) return; @@ -593,10 +595,10 @@ void CEdit::MouseDoubleClick(FPOINT mouse) } m_cursor1 = i; } - else // mono-ligne ? + else // single-line? { m_cursor2 = 0; - m_cursor1 = m_len; // sélectionne tout + m_cursor1 = m_len; // selects all } m_bUndoForce = TRUE; @@ -605,7 +607,7 @@ void CEdit::MouseDoubleClick(FPOINT mouse) ColumnFix(); } -// Positionne le curseur suite à un clic. +// Positions the cursor when clicked. void CEdit::MouseClick(FPOINT mouse) { @@ -619,12 +621,12 @@ void CEdit::MouseClick(FPOINT mouse) m_cursor1 = i; m_cursor2 = i; m_bUndoForce = TRUE; - m_timeBlink = 0.0f; // allume le curseur immédiatement + m_timeBlink = 0.0f; // lights the cursor immediately ColumnFix(); } } -// Positionne le curseur suite à un clic relâché. +// Positions the cursor when clicked released. void CEdit::MouseRelease(FPOINT mouse) { @@ -652,7 +654,7 @@ void CEdit::MouseRelease(FPOINT mouse) } } -// Positionne le curseur suite à un déplacement. +// Positions the cursor after movement. void CEdit::MouseMove(FPOINT mouse) { @@ -661,12 +663,12 @@ void CEdit::MouseMove(FPOINT mouse) if ( m_bMulti && m_timeLastScroll+DELAY_SCROLL <= m_time ) { - if ( mouse.y > m_pos.y+m_dim.y ) // plus haut ? + if ( mouse.y > m_pos.y+m_dim.y ) // above? { Scroll(m_lineFirst-1, FALSE); mouse.y = m_pos.y+m_dim.y-MARGY-m_lineHeight/2.0f; } - if ( mouse.y < m_pos.y ) // plus bas ? + if ( mouse.y < m_pos.y ) // lower? { Scroll(m_lineFirst+1, FALSE); mouse.y = m_pos.y+m_dim.y-MARGY-m_lineVisible*m_lineHeight+m_lineHeight/2.0f; @@ -679,12 +681,12 @@ void CEdit::MouseMove(FPOINT mouse) { m_cursor1 = i; m_bUndoForce = TRUE; - m_timeBlink = 0.0f; // allume le curseur immédiatement + m_timeBlink = 0.0f; // lights the cursor immediately ColumnFix(); } } -// Positionne le curseur suite à un clic. +// Positions the cursor when clicked. int CEdit::MouseDetect(FPOINT mouse) { @@ -745,7 +747,7 @@ int CEdit::MouseDetect(FPOINT mouse) } -// Efface tout l'historique. +// Clears all history. void CEdit::HyperFlush() { @@ -753,7 +755,7 @@ void CEdit::HyperFlush() m_historyCurrent = -1; } -// Indique quelle est la page home. +// Indicates which is the home page. void CEdit::HyperHome(char *filename) { @@ -761,7 +763,7 @@ void CEdit::HyperHome(char *filename) HyperAdd(filename, 0); } -// Effectue un hyper saut à travers un lien. +// Performs a hyper jump through a link. void CEdit::HyperJump(char *name, char *marker) { @@ -812,7 +814,7 @@ void CEdit::HyperJump(char *name, char *marker) } } -// Ajoute un texte visité à l'historique. +// Adds text to the history of visited. BOOL CEdit::HyperAdd(char *filename, int firstLine) { @@ -826,7 +828,7 @@ BOOL CEdit::HyperAdd(char *filename, int firstLine) return TRUE; } -// Indique si un bouton EVENT_HYPER_* est actif ou non. +// Indicates whether a button EVENT_HYPER_ * is active or not. BOOL CEdit::HyperTest(EventMsg event) { @@ -848,7 +850,7 @@ BOOL CEdit::HyperTest(EventMsg event) return FALSE; } -// Effectue l'action correspondant à un bouton EVENT_HYPER_*. +// Performs the action corresponding to a button EVENT_HYPER_ *. BOOL CEdit::HyperGo(EventMsg event) { @@ -878,7 +880,7 @@ BOOL CEdit::HyperGo(EventMsg event) } -// Dessine la ligne éditable. +// Draw the editable line. void CEdit::Draw() { @@ -898,12 +900,12 @@ void CEdit::Draw() dim.x = m_dim.x; if ( !m_bInsideScroll ) dim.x -= m_bMulti?SCROLL_WIDTH:0.0f; dim.y = m_dim.y; - DrawBack(pos, dim); // fond + DrawBack(pos, dim); // background - // Affiche toutes les lignes. + // Displays all lines. c1 = m_cursor1; c2 = m_cursor2; - if ( c1 > c2 ) Swap(c1, c2); // toujours c1 <= c2 + if ( c1 > c2 ) Swap(c1, c2); // always c1 <= c2 if ( m_bInsideScroll ) { @@ -922,7 +924,7 @@ void CEdit::Draw() if ( i == m_lineFirst && i < m_lineTotal-1 && m_lineOffset[i] == m_lineOffset[i+1] ) { - pos.y -= m_lineHeight; // saute double ligne \b; + pos.y -= m_lineHeight; // Double jump line \b; i ++; } @@ -933,7 +935,7 @@ void CEdit::Draw() { for ( j=0 ; jRetText()->DrawText(&s, 1, pos, 1.0f, 1, m_fontSize, m_fontStretch, m_fontType, 0); pos.x += indentLength; } @@ -945,7 +947,7 @@ void CEdit::Draw() ppos = pos; size = m_fontSize; - // Grand titre \b; ? + // Headline \b;? if ( beg+len < m_len && m_format != 0 && (m_format[beg]&TITLE_MASK) == TITLE_BIG ) { @@ -953,13 +955,13 @@ void CEdit::Draw() end.x = dim.x-MARGX*2.0f; start.y = ppos.y-(m_bMulti?0.0f:MARGY1)-m_lineHeight*(BIG_FONT-1.0f); end.y = m_lineHeight*BIG_FONT; - DrawPart(start, end, 2); // fond bleu dégradé -> + DrawPart(start, end, 2); // blue gradient background -> size *= BIG_FONT; ppos.y -= m_lineHeight*(BIG_FONT-1.0f); } - // Titre \t; ? + // As \t;? if ( beg+len < m_len && m_format != 0 && (m_format[beg]&TITLE_MASK) == TITLE_NORM ) { @@ -967,10 +969,10 @@ void CEdit::Draw() end.x = dim.x-MARGX*2.0f; start.y = ppos.y-(m_bMulti?0.0f:MARGY1); end.y = m_lineHeight; - DrawPart(start, end, 2); // fond bleu dégradé -> + DrawPart(start, end, 2); // blue gradient background -> } - // Sous-titre \s; ? + // Subtitle \s;? if ( beg+len < m_len && m_format != 0 && (m_format[beg]&TITLE_MASK) == TITLE_LITTLE ) { @@ -978,10 +980,10 @@ void CEdit::Draw() end.x = dim.x-MARGX*2.0f; start.y = ppos.y-(m_bMulti?0.0f:MARGY1); end.y = m_lineHeight; - DrawPart(start, end, 3); // fond jaune dégradé -> + DrawPart(start, end, 3); // yellow background gradient -> } - // Tableau \tab; ? + // Table \tab;? if ( beg+len < m_len && m_format != 0 && (m_format[beg]&COLOR_MASK) == COLOR_TABLE ) { @@ -989,7 +991,7 @@ void CEdit::Draw() end.x = dim.x-MARGX*2.0f; start.y = ppos.y-(m_bMulti?0.0f:MARGY1); end.y = m_lineHeight; - DrawPart(start, end, 11); // fond orange dégradé -> + DrawPart(start, end, 11); // fond orange d�grad� -> } // Image \image; ? @@ -997,7 +999,7 @@ void CEdit::Draw() (m_format[beg]&IMAGE_MASK) != 0 ) { line = 1; - while ( true ) // regroupe les tranches d'image + while ( true ) // includes the image slices { if ( i+line >= m_lineTotal || i+line >= m_lineFirst+m_lineVisible || @@ -1005,7 +1007,7 @@ void CEdit::Draw() line ++; } - iIndex = m_text[beg]; // caractère = index dans m_image + iIndex = m_text[beg]; // character = index in m_image pos.y -= m_lineHeight*(line-1); DrawImage(pos, m_image[iIndex].name, m_image[iIndex].width*(m_fontSize/SMALLFONT), @@ -1017,7 +1019,7 @@ void CEdit::Draw() if ( ((m_bEdit && m_bFocus && m_bHilite) || (!m_bEdit && m_bHilite) ) && - c1 != c2 && beg <= c2 && beg+len >= c1 ) // zone sélectionnée ? + c1 != c2 && beg <= c2 && beg+len >= c1 ) // selected area? { o1 = c1; if ( o1 < beg ) o1 = beg; o2 = c2; if ( o2 > beg+len ) o2 = beg+len; @@ -1036,18 +1038,18 @@ void CEdit::Draw() start.y = ppos.y-(m_bMulti?0.0f:MARGY1); end.y = m_lineHeight; if ( m_format != 0 && (m_format[beg]&TITLE_MASK) == TITLE_BIG ) end.y *= BIG_FONT; - DrawPart(start, end, 1); // fond jaune uni + DrawPart(start, end, 1); // plain yellow background } eol = 16; // > if ( len > 0 && m_text[beg+len-1] == '\n' ) { - len --; // n'affiche pas le '\n' - eol = 0; // rien + len --; // does not display the '\ n' + eol = 0; // nothing } if ( beg+len >= m_len ) { - eol = 2; // carré (eot) + eol = 2; // square (eot) } if ( !m_bMulti || !m_bDisplaySpec ) eol = 0; if ( m_format == 0 ) @@ -1063,13 +1065,13 @@ void CEdit::Draw() if ( i < m_lineTotal-2 && m_lineOffset[i+1] == m_lineOffset[i+2] ) { - pos.y -= m_lineHeight; // saute double ligne \b; + pos.y -= m_lineHeight; // double jump line \b; i ++; } } - // Affiche le curseur. - if ( (m_bEdit && m_bFocus && m_bHilite && Mod(m_timeBlink, 1.0f) <= 0.5f) ) // ça clignotte + // Shows the cursor. + if ( (m_bEdit && m_bFocus && m_bHilite && Mod(m_timeBlink, 1.0f) <= 0.5f) ) // it blinks { pos.y = m_pos.y+m_dim.y-m_lineHeight-(m_bMulti?MARGY:MARGY1*2.0f); for ( i=m_lineFirst ; iLoadTexture(filename); } -// Lit le contenu d'un fichier texte. +// Read from a text file. BOOL CEdit::ReadText(char *filename, int addSize) { @@ -1501,12 +1503,12 @@ BOOL CEdit::ReadText(char *filename, int addSize) j ++; } i ++; - continue; // enlève les tabulateurs + continue; // removes the tabs } bBOL = ( buffer[i] == '\n' || buffer[i] == '\r' ); } - if ( buffer[i] == '\r' ) // supprime les \r + if ( buffer[i] == '\r' ) // removes \ r { i ++; } @@ -1548,7 +1550,7 @@ BOOL CEdit::ReadText(char *filename, int addSize) } i += 3; } - else if ( buffer[i+1] == 's' ) // sbttl ? + else if ( buffer[i+1] == 's' ) // subtitle ? { if ( m_bSoluce || !bInSoluce ) { @@ -1572,7 +1574,7 @@ BOOL CEdit::ReadText(char *filename, int addSize) } } else if ( m_format != 0 && - buffer[i+0] == '\\' && // \u nom marker; ? + buffer[i+0] == '\\' && // \u marker name; ? buffer[i+1] == 'u' && buffer[i+2] == ' ' ) { @@ -1605,7 +1607,7 @@ BOOL CEdit::ReadText(char *filename, int addSize) i += strchr(buffer+i, ';')-(buffer+i)+1; } else if ( m_format != 0 && - buffer[i+0] == '\\' && // \image nom lx ly; ? + buffer[i+0] == '\\' && // \image name lx ly; ? buffer[i+1] == 'i' && buffer[i+2] == 'm' && buffer[i+3] == 'a' && @@ -1626,7 +1628,7 @@ BOOL CEdit::ReadText(char *filename, int addSize) iLines = RetValueParam(buffer+i+7, 2); LoadImage(iName); - // Une tranche d'image par ligne de texte. + // A part of image per line of text. for ( iCount=0 ; iCount= m_lineFirst+m_lineVisible ) { MoveLine(m_lineFirst+m_lineVisible-line-1, FALSE, FALSE); @@ -2204,7 +2206,7 @@ void CEdit::Scroll(int pos, BOOL bAdjustCursor) Justif(); } -// Déplace le curseur au début de la ligne. +// Moves the cursor to the beginning of the line. void CEdit::MoveHome(BOOL bWord, BOOL bSelect) { @@ -2244,7 +2246,7 @@ void CEdit::MoveHome(BOOL bWord, BOOL bSelect) ColumnFix(); } -// Déplace le curseur à la fin de la ligne. +// Moves the cursor to the end of the line. void CEdit::MoveEnd(BOOL bWord, BOOL bSelect) { @@ -2266,13 +2268,13 @@ void CEdit::MoveEnd(BOOL bWord, BOOL bSelect) ColumnFix(); } -// Déplace le curseur par caractères. +// Moves the cursor through characters. void CEdit::MoveChar(int move, BOOL bWord, BOOL bSelect) { int character; - if ( move == -1 ) // recule ? + if ( move == -1 ) // back? { if ( bWord ) { @@ -2322,7 +2324,7 @@ void CEdit::MoveChar(int move, BOOL bWord, BOOL bSelect) } } - if ( move == 1 ) // avance ? + if ( move == 1 ) // advance? { if ( bWord ) { @@ -2379,7 +2381,7 @@ void CEdit::MoveChar(int move, BOOL bWord, BOOL bSelect) ColumnFix(); } -// Déplace le curseur par lignes. +// Moves the cursor lines. void CEdit::MoveLine(int move, BOOL bWord, BOOL bSelect) { @@ -2388,7 +2390,7 @@ void CEdit::MoveLine(int move, BOOL bWord, BOOL bSelect) if ( move == 0 ) return; - for ( i=0 ; i>move ; i-- ) // recule ? + for ( i=0 ; i>move ; i-- ) // back? { while ( m_cursor1 > 0 && m_text[m_cursor1-1] != '\n' ) { @@ -2408,7 +2410,7 @@ void CEdit::MoveLine(int move, BOOL bWord, BOOL bSelect) } } - for ( i=0 ; i c2 ) Swap(c1, c2); // toujours c1 <= c2 + if ( c1 > c2 ) Swap(c1, c2); // always c1 <= c2 if ( c1 == c2 ) { @@ -2563,14 +2565,14 @@ BOOL CEdit::Cut() UndoMemorize(OPERUNDO_SPEC); m_cursor1 = c1; m_cursor2 = c2; - DeleteOne(0); // supprime les caractères sélectionnés + DeleteOne(0); // deletes the selected characters Justif(); ColumnFix(); SendModifEvent(); return TRUE; } -// Copie les caractères sélectionnés, ou toute la ligne. +// Copy the selected characters or entire line. BOOL CEdit::Copy() { @@ -2581,7 +2583,7 @@ BOOL CEdit::Copy() c1 = m_cursor1; c2 = m_cursor2; - if ( c1 > c2 ) Swap(c1, c2); // toujours c1 <= c2 + if ( c1 > c2 ) Swap(c1, c2); // always c1 <= c2 if ( c1 == c2 ) { @@ -2642,7 +2644,7 @@ BOOL CEdit::Copy() return TRUE; } -// Colle le contenu du bloc-notes. +// Paste the contents of the notebook. BOOL CEdit::Paste() { @@ -2689,7 +2691,7 @@ BOOL CEdit::Paste() } -// Annule la dernière action. +// Cancels the last action. BOOL CEdit::Undo() { @@ -2699,7 +2701,7 @@ BOOL CEdit::Undo() } -// Insère un caractère. +// Inserts a character. void CEdit::Insert(char character) { @@ -2707,7 +2709,7 @@ void CEdit::Insert(char character) if ( !m_bEdit ) return; - if ( !m_bMulti ) // mono-ligne ? + if ( !m_bMulti ) // single-line? { if ( character == '\n' || character == '\t' ) return; @@ -2797,7 +2799,7 @@ void CEdit::Insert(char character) ColumnFix(); } -// Insère un caractère brut. +// Inserts a plain character. void CEdit::InsertOne(char character) { @@ -2808,18 +2810,18 @@ void CEdit::InsertOne(char character) if ( m_cursor1 != m_cursor2 ) { - DeleteOne(0); // supprime les caractères sélectionnés + DeleteOne(0); // deletes the selected characters } if ( m_len >= m_maxChar ) return; for ( i=m_len ; i>=m_cursor1 ; i-- ) { - m_text[i] = m_text[i-1]; // pousse + m_text[i] = m_text[i-1]; // shoot if ( m_format != 0 ) { - m_format[i] = m_format[i-1]; // pousse + m_format[i] = m_format[i-1]; // shoot } } @@ -2836,8 +2838,7 @@ void CEdit::InsertOne(char character) m_cursor2 = m_cursor1; } -// Supprime le caractère à gauche du curseur ou tous les -// caractères sélectionnés. +// Deletes the character left of cursor or all selected characters. void CEdit::Delete(int dir) { @@ -2850,8 +2851,7 @@ void CEdit::Delete(int dir) ColumnFix(); } -// Supprime le caractère à gauche du curseur ou tous les -// caractères sélectionnés brut. +// Deletes the character left of cursor or all selected plain characters. void CEdit::DeleteOne(int dir) { @@ -2890,7 +2890,7 @@ void CEdit::DeleteOne(int dir) } -// Calcule le niveau d'indentation des crochets { et }. +// Calculates the indentation level of brackets {and}. int CEdit::IndentCompute() { @@ -2907,8 +2907,8 @@ int CEdit::IndentCompute() return level; } -// Compte le nombre de tabulateurs avant le curseur. -// Retourne -1 s'il y a autre chose. +// Counts the number of tabs before the cursor. +// Returns -1 if there is something else. int CEdit::IndentTabCount() { @@ -2928,25 +2928,25 @@ int CEdit::IndentTabCount() return nb; } -// Ajoute ou supprime qq tabulateurs. +// Adds or removes qq tabs. void CEdit::IndentTabAdjust(int number) { int i; - for ( i=0 ; inumber ; i-- ) // supprime ? + for ( i=0 ; i>number ; i-- ) // delete? { DeleteOne(-1); } } -// Indente à gauche ou à droite toute la sélection. +// Indent the left or right the entire selection. BOOL CEdit::Shift(BOOL bLeft) { @@ -2961,7 +2961,7 @@ BOOL CEdit::Shift(BOOL bLeft) c2 = m_cursor2; if ( c1 > c2 ) { - Swap(c1, c2); // toujours c1 <= c2 + Swap(c1, c2); // always c1 <= c2 bInvert = TRUE; } @@ -2974,7 +2974,7 @@ BOOL CEdit::Shift(BOOL bLeft) if ( m_text[c2-1] != '\n' ) return FALSE; } - if ( bLeft ) // décale à gauche ? + if ( bLeft ) // shifts left? { i = c1; while ( i < c2 ) @@ -2989,7 +2989,7 @@ BOOL CEdit::Shift(BOOL bLeft) while ( i < c2 && m_text[i++] != '\n' ); } } - else // décale à droite ? + else // shifts right? { i = c1; while ( i < c2 ) @@ -3011,7 +3011,7 @@ BOOL CEdit::Shift(BOOL bLeft) return TRUE; } -// Conversion min <-> maj de la sélection. +// Min conversion <-> shift the selection. BOOL CEdit::MinMaj(BOOL bMaj) { @@ -3023,7 +3023,7 @@ BOOL CEdit::MinMaj(BOOL bMaj) c1 = m_cursor1; c2 = m_cursor2; - if ( c1 > c2 ) Swap(c1, c2); // toujours c1 <= c2 + if ( c1 > c2 ) Swap(c1, c2); // alwyas c1 <= c2 for ( i=c1 ; i