Browse Source

Add functions to fix KI Chat scrolling issue.

These two Python/Plasma functions are used in the moul-scripts fix for the scrolling KI Chat issue.
scroll-position
Lyrositor 12 years ago
parent
commit
c6016223f2
  1. 9
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp
  2. 1
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.h
  3. 26
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlMultiLineEdit.cpp
  4. 2
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlMultiLineEdit.h
  5. 12
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlMultiLineEditGlue.cpp

9
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp

@ -308,6 +308,13 @@ void pfGUIMultiLineEditCtrl::SetScrollPosition( Int32 topLine )
fDialog->GetHandler()->DoSomething(this);
}
//// GetScrollPosition ///////////////////////////////////////////////////////
Int32 pfGUIMultiLineEditCtrl::GetScrollPosition()
{
return fScrollPos;
}
//// MoveCursor - by direction command////////////////////////////////////////////////
void pfGUIMultiLineEditCtrl::MoveCursor( Direction dir )
{
@ -2064,4 +2071,4 @@ void pfGUIMultiLineEditCtrl::DeleteLinesFromTop(int numLines)
SetBuffer(buffer, bufferLen);
delete [] buffer;
return;
}
}

1
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.h

@ -225,6 +225,7 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod
};
void SetScrollPosition( Int32 topLine );
Int32 GetScrollPosition();
void MoveCursor( Direction dir );
void InsertChar( char c );

26
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlMultiLineEdit.cpp

@ -80,6 +80,30 @@ void pyGUIControlMultiLineEdit::SetScrollPosition( Int32 topLine )
}
}
Int32 pyGUIControlMultiLineEdit::GetScrollPosition()
{
if ( fGCkey )
{
// get the pointer to the modifier
pfGUIMultiLineEditCtrl* pbmod = pfGUIMultiLineEditCtrl::ConvertNoRef(fGCkey->ObjectIsLoaded());
if ( pbmod )
return pbmod->GetScrollPosition();
}
return 0;
}
hsBool pyGUIControlMultiLineEdit::IsAtEnd()
{
if ( fGCkey )
{
// get the pointer to the modifier
pfGUIMultiLineEditCtrl* pbmod = pfGUIMultiLineEditCtrl::ConvertNoRef(fGCkey->ObjectIsLoaded());
if ( pbmod )
return pbmod->ShowingEndOfBuffer();
}
return false;
}
void pyGUIControlMultiLineEdit::MoveCursor( Int32 dir)
{
if ( fGCkey )
@ -557,4 +581,4 @@ void pyGUIControlMultiLineEdit::SetFontSize( UInt32 fontsize )
if ( pbmod )
pbmod->SetFontSize((UInt8)fontsize);
}
}
}

2
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlMultiLineEdit.h

@ -80,6 +80,8 @@ public:
virtual void Clickable( void );
virtual void Unclickable( void );
virtual void SetScrollPosition( Int32 topLine );
virtual Int32 GetScrollPosition();
virtual hsBool IsAtEnd();
virtual void MoveCursor( Int32 dir );
virtual void ClearBuffer( void );
virtual void SetText( const char *asciiText );

12
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/pyGUIControlMultiLineEditGlue.cpp

@ -87,6 +87,16 @@ PYTHON_METHOD_DEFINITION(ptGUIControlMultiLineEdit, setScrollPosition, args)
PYTHON_RETURN_NONE;
}
PYTHON_METHOD_DEFINITION_NOARGS(ptGUIControlMultiLineEdit, getScrollPosition)
{
return PyLong_FromLong(self->fThis->GetScrollPosition());
}
PYTHON_METHOD_DEFINITION_NOARGS(ptGUIControlMultiLineEdit, isAtEnd)
{
PYTHON_RETURN_BOOL(self->fThis->IsAtEnd());
}
PYTHON_METHOD_DEFINITION(ptGUIControlMultiLineEdit, moveCursor, args)
{
long dir;
@ -394,6 +404,8 @@ PYTHON_START_METHODS_TABLE(ptGUIControlMultiLineEdit)
PYTHON_BASIC_METHOD(ptGUIControlMultiLineEdit, unclickable, "Makes this listbox not clickable by the user.\n"
"Useful when just displaying a list that is not really selectable."),
PYTHON_METHOD(ptGUIControlMultiLineEdit, setScrollPosition, "Params: topLine\nSets the what line is the top line."),
PYTHON_METHOD_NOARGS(ptGUIControlMultiLineEdit, getScrollPosition, "Gets what line is the top line."),
PYTHON_METHOD_NOARGS(ptGUIControlMultiLineEdit, isAtEnd, "Returns true if the end of the buffer has been reached."),
PYTHON_METHOD(ptGUIControlMultiLineEdit, moveCursor, "Params: direction\nMove the cursor in the specified direction (see PtGUIMultiLineDirection)"),
PYTHON_BASIC_METHOD(ptGUIControlMultiLineEdit, clearBuffer, "Clears all text from the multi-line edit control."),
PYTHON_METHOD(ptGUIControlMultiLineEdit, setString, "Params: asciiText\nSets the multi-line edit control string."),

Loading…
Cancel
Save