From: <wel...@us...> - 2009-10-25 10:48:01
|
Revision: 4693 http://planeshift.svn.sourceforge.net/planeshift/?rev=4693&view=rev Author: weltall2 Date: 2009-10-25 10:47:54 +0000 (Sun, 25 Oct 2009) Log Message: ----------- fixed PS#3120 - Text wrapping issue when resizing character description window Modified Paths: -------------- trunk/src/common/paws/pawstextwrap.cpp Modified: trunk/src/common/paws/pawstextwrap.cpp =================================================================== --- trunk/src/common/paws/pawstextwrap.cpp 2009-10-25 09:44:18 UTC (rev 4692) +++ trunk/src/common/paws/pawstextwrap.cpp 2009-10-25 10:47:54 UTC (rev 4693) @@ -220,6 +220,7 @@ void pawsMultilineEditTextBox::OnResize() { canDrawLines = (screenFrame.Height() / lineHeight); + LayoutText(); UpdateScrollBar(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wel...@us...> - 2010-12-26 12:00:20
|
Revision: 6613 http://planeshift.svn.sourceforge.net/planeshift/?rev=6613&view=rev Author: weltall2 Date: 2010-12-26 12:00:14 +0000 (Sun, 26 Dec 2010) Log Message: ----------- added clipboard support to multilinedittextbox Modified Paths: -------------- trunk/src/common/paws/pawstextwrap.cpp Modified: trunk/src/common/paws/pawstextwrap.cpp =================================================================== --- trunk/src/common/paws/pawstextwrap.cpp 2010-12-26 11:24:30 UTC (rev 6612) +++ trunk/src/common/paws/pawstextwrap.cpp 2010-12-26 12:00:14 UTC (rev 6613) @@ -295,9 +295,63 @@ vScrollBar->SetCurrentValue(vScrollBar->GetCurrentValue() + EDIT_TEXTBOX_MOUSE_SCROLL_AMOUNT); return true; } - return pawsWidget::OnMouseDown(button, modifiers, x ,y); + + + +#if defined(CS_PLATFORM_UNIX) && defined(INCLUDE_CLIPBOARD) + if (button == csmbMiddle) + { + // Only included for platforms using Middle button to past. + + // Request Clipboard. Reuslt will be available in OnClipboard + PawsManager::GetSingleton().RequestClipboardContent(); + + return true; + } +#endif + + + return pawsWidget::OnMouseDown( button, modifiers, x ,y); } +bool pawsMultilineEditTextBox::OnClipboard( const csString& content ) +{ + printf("Received from clipboard: %s\n", content.GetDataSafe()); + + size_t position = GetCursorPosition(cursorLine, cursorLoc); + if ( position >= text.Length() ) + { + text.Append( content ); + } + else + { + text.Insert( position, content ); + } + + if(maxLen) + text.Truncate( maxLen ); + position += content.Length(); + + LayoutText(); + + GetCursorLocation(position, cursorLine, cursorLoc); + if(cursorLine >= topLine + canDrawLines) + topLine = cursorLine - canDrawLines + 1; + else if(cursorLine < topLine) + topLine = cursorLine; + SetupScrollBar(); + + + if (subscribedVar) + { + PawsManager::GetSingleton().Publish(subscribedVar, text); + } + + parent->OnChange(this); + + return true; +} + bool pawsMultilineEditTextBox::OnMouseUp(int button, int modifiers, int x, int y) { if(button == csmbLeft) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wel...@us...> - 2011-03-17 06:28:34
|
Revision: 7087 http://planeshift.svn.sourceforge.net/planeshift/?rev=7087&view=rev Author: weltall2 Date: 2011-03-17 06:28:28 +0000 (Thu, 17 Mar 2011) Log Message: ----------- fixed PS#5058 - Deleting Unicode characters in the book interface Modified Paths: -------------- trunk/src/common/paws/pawstextwrap.cpp Modified: trunk/src/common/paws/pawstextwrap.cpp =================================================================== --- trunk/src/common/paws/pawstextwrap.cpp 2011-03-17 06:15:49 UTC (rev 7086) +++ trunk/src/common/paws/pawstextwrap.cpp 2011-03-17 06:28:28 UTC (rev 7087) @@ -102,7 +102,7 @@ position = GetCursorPosition(cursorLine, cursorLoc); if(text.Length() > 0 && position > 0)//&& position <=text.Length()) { - position--; + position -= csUnicodeTransform::UTF8Rewind((const utf8_char*)text.GetData() + position, position); text.DeleteAt(position, csUnicodeTransform::UTF8Skip((const utf8_char*)text.GetData() + position, text.Length() - position)); repositionCursor = true; changed = true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wel...@us...> - 2011-12-01 19:19:45
|
Revision: 7779 http://planeshift.svn.sourceforge.net/planeshift/?rev=7779&view=rev Author: weltall2 Date: 2011-12-01 19:19:39 +0000 (Thu, 01 Dec 2011) Log Message: ----------- fixed possible crash during spell checking patch by AiwendilH Modified Paths: -------------- trunk/src/common/paws/pawstextwrap.cpp Modified: trunk/src/common/paws/pawstextwrap.cpp =================================================================== --- trunk/src/common/paws/pawstextwrap.cpp 2011-12-01 19:18:17 UTC (rev 7778) +++ trunk/src/common/paws/pawstextwrap.cpp 2011-12-01 19:19:39 UTC (rev 7779) @@ -266,13 +266,6 @@ { pawsWidget::OnKeyDown(code, key, modifiers); } - - // if spellchecking is enabled do it at every key-press - if (spellChecked) - { - checkSpelling(); - } - return true; } @@ -491,22 +484,28 @@ void pawsMultilineEditTextBox::LayoutText() { + // we need to font for calculation the pixel length of words csRef<iFont> font = GetFont(); + // and of course we need the size we have available in the widget int screenWidth = screenFrame.Width() - vScrollBarWidth; - int width = 0; - int height = 0; - csString tempString; - csString word; - size_t srcPos = 0; //the first char that hasn't yet been grabbed. + + int width = 0; // will hold the width of the current word + int height = 0; // will hold the height of any examined string...not really needed for anything. + csString tempString; // content of the current line before the currently examined word + csString word; // the word to examine + size_t srcPos = 0; // the first char that hasn't yet been grabbed. + + // we start with an empty array of lines and build it from scratch from the text lineInfo.Empty(); size_t totalCount = 0; - int tailWidth = 0; + int tailWidth = 0; // the length in pixel of everything on the current line before the currenly examined word. + // lets process the whole text while(srcPos < text.Length()) { //try to grab a word. size_t a = text.FindFirst(" \t\n", srcPos); - //if a is '-1', the char wasn't found so we grab to end of the line, + //if a is '-1', the char wasn't found so we grab to end of the text, //else we grab up to and including the found character if(a == (size_t)-1) word = text.Slice(srcPos,text.Length() - srcPos); @@ -519,41 +518,53 @@ //if it'll fit.. if(width + tailWidth <= screenWidth) { - //then attach it + // seems the end of the current line is not reached yet + //so attach the word tempString.Append(word); + // and set tailWidth to the width of everything we have so far font->GetDimensions(tempString, tailWidth, height); + // and of course we don't forget to move foreward in the text srcPos += word.Length(); } - else if(width > screenWidth) + // okay..if we get here we know already the word won't fit in the line anymore + else if(tempString.FindFirst(" ") != (size_t)-1) { - //Wordwrap + // but great...we have a whitespace in the current line already...so let's just put this word in the next line. + //If wordwrap->linebreak on same line, + // push linebreak to next line totalCount += tempString.Length(); + // the line we have so far can be saved PushLineInfo(tempString.Length(), totalCount, 1); - tempString = word; + // and we start a new line + tempString.Clear(); + word = "a"; //set position holder (never actually drawn) (needed for the newline check later) font->GetDimensions(tempString, tailWidth, height); - srcPos += word.Length(); + //Note: srcPos is not set. So next time the currently processed word is either added to the line if it fits + //...or breaken into smaller parts...see next else } - else if(tempString.FindFirst(" ") != (size_t)-1) + /*else if(width > screenWidth) { - //If wordwrap->linebreak on same line, - // push linebreak to next line + printf(" ----test---- word must go on the next line\n"); + //Wordwrap totalCount += tempString.Length(); PushLineInfo(tempString.Length(), totalCount, 1); - tempString.Clear(); - word = "a"; //set position holder (never actually drawn) + tempString = word; font->GetDimensions(tempString, tailWidth, height); - //Note: srcPos is not set. - } + srcPos += word.Length(); + }*/ // seriously...I have not the slightest clue what this should do or did in the past...but at the moment it causes problems else { //breakline - the case where we have a single //unbroken word wider than our page + // how many of the chars of this word will fit in one line? int maxChars = font->GetLength(word, screenWidth); word = word.Slice(0, maxChars); //Get string for the line totalCount += word.Length(); //Get absolute char position in text for line break PushLineInfo(word.Length(), totalCount, 0); //Push the line information to the stack - srcPos += word.Length(); //Set srcPosition for this loop + //Set srcPosition for this loop, please notice this is the length of the cut word...not the whole word anymore + //the rest of the word will be processed in the next while-cyle + srcPos += word.Length(); //Note: Tempstring is not set here. font->GetDimensions(tempString,tailWidth,height); } @@ -946,7 +957,7 @@ curLine.SubString(tmpString, oldSpace, curLine.Length()-oldSpace); // now do the spellchecking tmpWord.correct = spellChecker->correct(tmpString); - tmpWord.endPos = text.Length(); + tmpWord.endPos = curLine.Length(); if (tmpWord.endPos > 0) { // save only if the word contains something This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wel...@us...> - 2011-12-02 21:39:13
|
Revision: 7786 http://planeshift.svn.sourceforge.net/planeshift/?rev=7786&view=rev Author: weltall2 Date: 2011-12-02 21:39:07 +0000 (Fri, 02 Dec 2011) Log Message: ----------- small fix from aiwendilH to textwrap Modified Paths: -------------- trunk/src/common/paws/pawstextwrap.cpp Modified: trunk/src/common/paws/pawstextwrap.cpp =================================================================== --- trunk/src/common/paws/pawstextwrap.cpp 2011-12-02 21:29:22 UTC (rev 7785) +++ trunk/src/common/paws/pawstextwrap.cpp 2011-12-02 21:39:07 UTC (rev 7786) @@ -491,7 +491,7 @@ int width = 0; // will hold the width of the current word int height = 0; // will hold the height of any examined string...not really needed for anything. - csString tempString; // content of the current line before the currently examined word + csString tempString = ""; // content of the current line before the currently examined word csString word; // the word to examine size_t srcPos = 0; // the first char that hasn't yet been grabbed. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |