Merged mainline changes..
This commit is contained in:
commit
2eb7a6648a
27 changed files with 721 additions and 166 deletions
|
@ -55,9 +55,7 @@ namespace NLGUI
|
||||||
static void forceLink();
|
static void forceLink();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
sint64 getVal();
|
||||||
sint64 getVal() { if (_Modulo == 0) return (_Number.getSInt64() / _Divisor);
|
|
||||||
else return (_Number.getSInt64() / _Divisor)%_Modulo; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -283,6 +283,10 @@ namespace NLGUI
|
||||||
|
|
||||||
sint32 _ViewTextDeltaX;
|
sint32 _ViewTextDeltaX;
|
||||||
|
|
||||||
|
CViewText* getVT() const{ return _ViewText; }
|
||||||
|
|
||||||
|
void createViewText();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupDisplayText();
|
void setupDisplayText();
|
||||||
void makeTopWindow();
|
void makeTopWindow();
|
||||||
|
|
53
code/nel/include/nel/gui/group_editbox_decor.h
Normal file
53
code/nel/include/nel/gui/group_editbox_decor.h
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2014 Laszlo Kis-Adam
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef GROUP_EDITBOX_DECOR
|
||||||
|
#define GROUP_EDITBOX_DECOR
|
||||||
|
|
||||||
|
#include "nel/gui/group_editbox.h"
|
||||||
|
|
||||||
|
namespace NLGUI
|
||||||
|
{
|
||||||
|
/// Decorated CGroupEditBox
|
||||||
|
class CGroupEditBoxDecor : public CGroupEditBox
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_UI_CLASS( CGroupEditBoxDecor )
|
||||||
|
|
||||||
|
CGroupEditBoxDecor( const TCtorParam ¶m );
|
||||||
|
~CGroupEditBoxDecor();
|
||||||
|
|
||||||
|
void moveBy( sint32 x, sint32 y );
|
||||||
|
|
||||||
|
void setIdRecurse( const std::string &newID );
|
||||||
|
|
||||||
|
std::string getProperty( const std::string &name ) const;
|
||||||
|
void setProperty( const std::string &name, const std::string &value );
|
||||||
|
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
|
||||||
|
bool parse( xmlNodePtr cur, CInterfaceGroup *parent );
|
||||||
|
void draw();
|
||||||
|
void updateCoords();
|
||||||
|
|
||||||
|
static void forceLink();
|
||||||
|
|
||||||
|
private:
|
||||||
|
class EBDPrivate *_Pvt;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -117,6 +117,7 @@ namespace NLGUI
|
||||||
editorSelected = false;
|
editorSelected = false;
|
||||||
|
|
||||||
serializable = true;
|
serializable = true;
|
||||||
|
_EditorSelectable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// dtor
|
// dtor
|
||||||
|
@ -531,9 +532,16 @@ namespace NLGUI
|
||||||
/// Aligns the element to the other element specified
|
/// Aligns the element to the other element specified
|
||||||
void alignTo( CInterfaceElement *other );
|
void alignTo( CInterfaceElement *other );
|
||||||
|
|
||||||
|
/// Specifies if the widget can be selected in the editor
|
||||||
|
void setEditorSelectable( bool b ){ _EditorSelectable = b; }
|
||||||
|
|
||||||
|
/// Tells if the widget can be selected in the editor
|
||||||
|
bool isEditorSelectable() const{ return _EditorSelectable; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
bool editorSelected;
|
bool editorSelected;
|
||||||
|
bool _EditorSelectable;
|
||||||
|
|
||||||
static bool editorMode;
|
static bool editorMode;
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,15 @@ namespace NLGUI
|
||||||
_VolatileValue = NULL;
|
_VolatileValue = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Tells if this property has a value
|
||||||
|
bool hasValue() const
|
||||||
|
{
|
||||||
|
if( _VolatileValue != NULL )
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
NLMISC::CCDBNodeLeaf* getNodePtr() const
|
NLMISC::CCDBNodeLeaf* getNodePtr() const
|
||||||
{
|
{
|
||||||
return _VolatileValue;
|
return _VolatileValue;
|
||||||
|
|
|
@ -350,8 +350,10 @@ void setCrashAlreadyReported(bool state);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// removed because we always check assert (even in release mode) #if defined (NL_OS_WINDOWS) && defined (NL_DEBUG)
|
// removed because we always check assert (even in release mode) #if defined (NL_OS_WINDOWS) && defined (NL_DEBUG)
|
||||||
#if defined (NL_OS_WINDOWS)
|
#if defined(NL_OS_WINDOWS)
|
||||||
#define NLMISC_BREAKPOINT __debugbreak();
|
#define NLMISC_BREAKPOINT __debugbreak()
|
||||||
|
#elif defined(NL_OS_UNIX) && defined(NL_COMP_GCC)
|
||||||
|
#define NLMISC_BREAKPOINT __builtin_trap()
|
||||||
#else
|
#else
|
||||||
#define NLMISC_BREAKPOINT abort()
|
#define NLMISC_BREAKPOINT abort()
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -21,9 +21,11 @@
|
||||||
|
|
||||||
namespace NLMISC {
|
namespace NLMISC {
|
||||||
|
|
||||||
|
enum TReportResult { ReportDebug, ReportIgnore, ReportQuit, ReportError };
|
||||||
|
|
||||||
/** Display a custom message box.
|
/** Display a custom message box.
|
||||||
*
|
*
|
||||||
* \param title set the title of the report. If empty, it'll display "NeL report".
|
* \param title set the title of the report. If empty, it'll display "NeL Crash Report" or the default title set by setReportWindowTitle.
|
||||||
* \param header message displayed before the edit text box. If empty, it displays the default message.
|
* \param header message displayed before the edit text box. If empty, it displays the default message.
|
||||||
* \param body message displayed in the edit text box. This string will be sent by email.
|
* \param body message displayed in the edit text box. This string will be sent by email.
|
||||||
* \param debugButton 0 for disabling it, 1 for enable with default behaviors (generate a breakpoint), 2 for enable with no behavior
|
* \param debugButton 0 for disabling it, 1 for enable with default behaviors (generate a breakpoint), 2 for enable with no behavior
|
||||||
|
@ -32,14 +34,15 @@ namespace NLMISC {
|
||||||
*
|
*
|
||||||
* \return the button clicked or error
|
* \return the button clicked or error
|
||||||
*/
|
*/
|
||||||
|
TReportResult report(const std::string &title, const std::string &header, const std::string &subject, const std::string &body, bool enableCheckIgnore, uint debugButton, bool ignoreButton, sint quitButton, bool sendReportButton, bool &ignoreNextTime, const std::string &attachedFile = "");
|
||||||
|
|
||||||
enum TReportResult { ReportDebug, ReportIgnore, ReportQuit, ReportError };
|
/// Set the Url of the web service used to post crash reports to
|
||||||
|
void setReportPostUrl(const std::string &postUrl);
|
||||||
TReportResult report (const std::string &title, const std::string &header, const std::string &subject, const std::string &body, bool enableCheckIgnore, uint debugButton, bool ignoreButton, sint quitButton, bool sendReportButton, bool &ignoreNextTime, const std::string &attachedFile = "");
|
|
||||||
|
|
||||||
|
/// DEPRECATED
|
||||||
/** call this in the main of your appli to enable email: setReportEmailFunction (sendEmail);
|
/** call this in the main of your appli to enable email: setReportEmailFunction (sendEmail);
|
||||||
*/
|
*/
|
||||||
void setReportEmailFunction (void *emailFunction);
|
void setReportEmailFunction(void *emailFunction);
|
||||||
|
|
||||||
} // NLMISC
|
} // NLMISC
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
sint64 i;
|
sint64 i;
|
||||||
if( fromString( value, i ) )
|
if( fromString( value, i ) )
|
||||||
_Divisor = i;
|
_Modulo = i;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -249,5 +249,16 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sint64 CDBViewNumber::getVal()
|
||||||
|
{
|
||||||
|
if( !_Number.hasValue() )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if( _Modulo == 0 )
|
||||||
|
return _Number.getSInt64() / _Divisor;
|
||||||
|
else
|
||||||
|
return ( _Number.getSInt64() / _Divisor ) % _Modulo;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,14 +157,17 @@ namespace NLGUI
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void CDBViewQuantity::draw ()
|
void CDBViewQuantity::draw ()
|
||||||
{
|
{
|
||||||
// change text
|
if( _Number.hasValue() && _NumberMax.hasValue() )
|
||||||
sint32 val= _Number.getSInt32();
|
|
||||||
sint32 valMax= _NumberMax.getSInt32();
|
|
||||||
if(_Cache!=val || _CacheMax!=valMax)
|
|
||||||
{
|
{
|
||||||
_Cache= val;
|
// change text
|
||||||
_CacheMax=valMax;
|
sint32 val= _Number.getSInt32();
|
||||||
buildTextFromCache();
|
sint32 valMax= _NumberMax.getSInt32();
|
||||||
|
if(_Cache!=val || _CacheMax!=valMax)
|
||||||
|
{
|
||||||
|
_Cache= val;
|
||||||
|
_CacheMax=valMax;
|
||||||
|
buildTextFromCache();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// parent call
|
// parent call
|
||||||
|
|
|
@ -1336,6 +1336,11 @@ namespace NLGUI
|
||||||
// if click, and not frozen, then get the focus
|
// if click, and not frozen, then get the focus
|
||||||
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftdown && !_Frozen)
|
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftdown && !_Frozen)
|
||||||
{
|
{
|
||||||
|
if( getEditorMode() )
|
||||||
|
{
|
||||||
|
return CViewBase::handleEvent( event );
|
||||||
|
}
|
||||||
|
|
||||||
_SelectingText = true;
|
_SelectingText = true;
|
||||||
stopParentBlink();
|
stopParentBlink();
|
||||||
CWidgetManager::getInstance()->setCaptureKeyboard (this);
|
CWidgetManager::getInstance()->setCaptureKeyboard (this);
|
||||||
|
@ -1531,36 +1536,45 @@ namespace NLGUI
|
||||||
CInterfaceGroup::clearViews();
|
CInterfaceGroup::clearViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void CGroupEditBox::createViewText()
|
||||||
|
{
|
||||||
|
nlwarning("Interface: CGroupEditBox: text 'edit_text' missing or bad type");
|
||||||
|
nlwarning( "Trying to create a new 'edit_text' for %s", getId().c_str() );
|
||||||
|
_ViewText = dynamic_cast< CViewText* >( CInterfaceFactory::createClass( "text" ) );
|
||||||
|
if( _ViewText == NULL )
|
||||||
|
{
|
||||||
|
nlwarning( "Failed to create new 'edit_text' for %s", getId().c_str() );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_ViewText->setParent( this );
|
||||||
|
_ViewText->setIdRecurse( "edit_text" );
|
||||||
|
_ViewText->setHardText( "" );
|
||||||
|
_ViewText->setPosRef( Hotspot_ML );
|
||||||
|
_ViewText->setParentPosRef( Hotspot_ML );
|
||||||
|
addView( _ViewText );
|
||||||
|
|
||||||
|
sint32 w,h;
|
||||||
|
w = std::max( sint32( _ViewText->getFontWidth() * _ViewText->getText().size() ), getW() );
|
||||||
|
h = std::max( sint32( _ViewText->getFontHeight() ), getH() );
|
||||||
|
|
||||||
|
setH( h );
|
||||||
|
setW( w );
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void CGroupEditBox::setup()
|
void CGroupEditBox::setup()
|
||||||
{
|
{
|
||||||
// bind to the controls
|
// bind to the controls
|
||||||
_ViewText = dynamic_cast<CViewText *>(CInterfaceGroup::getView("edit_text"));
|
if( _ViewText == NULL )
|
||||||
|
_ViewText = dynamic_cast<CViewText *>(CInterfaceGroup::getView("edit_text"));
|
||||||
|
|
||||||
if(_ViewText == NULL)
|
if(_ViewText == NULL)
|
||||||
{
|
createViewText();
|
||||||
nlwarning("Interface: CGroupEditBox: text 'edit_text' missing or bad type");
|
|
||||||
if( editorMode )
|
_ViewText->setEditorSelectable( false );
|
||||||
{
|
|
||||||
nlwarning( "Trying to create a new 'edit_text' for %s", getId().c_str() );
|
|
||||||
_ViewText = dynamic_cast< CViewText* >( CInterfaceFactory::createClass( "text" ) );
|
|
||||||
if( _ViewText != NULL )
|
|
||||||
{
|
|
||||||
_ViewText->setParent( this );
|
|
||||||
_ViewText->setIdRecurse( "edit_text" );
|
|
||||||
_ViewText->setHardText( "sometext" );
|
|
||||||
_ViewText->setPosRef( Hotspot_TL );
|
|
||||||
_ViewText->setParentPosRef( Hotspot_TL );
|
|
||||||
addView( _ViewText );
|
|
||||||
|
|
||||||
setH( _ViewText->getFontHeight() );
|
|
||||||
setW( _ViewText->getFontWidth() * _ViewText->getText().size() );
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
nlwarning( "Failed to create new 'edit_text' for %s", getId().c_str() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// For MultiLine editbox, clip the end space, else weird when edit space at end of line (nothing happens)
|
// For MultiLine editbox, clip the end space, else weird when edit space at end of line (nothing happens)
|
||||||
if(_ViewText)
|
if(_ViewText)
|
||||||
|
|
380
code/nel/src/gui/group_editbox_decor.cpp
Normal file
380
code/nel/src/gui/group_editbox_decor.cpp
Normal file
|
@ -0,0 +1,380 @@
|
||||||
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2014 Laszlo Kis-Adam
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "stdpch.h"
|
||||||
|
#include "nel/gui/group_editbox_decor.h"
|
||||||
|
#include "nel/gui/view_bitmap.h"
|
||||||
|
#include "nel/gui/view_text.h"
|
||||||
|
|
||||||
|
namespace NLGUI
|
||||||
|
{
|
||||||
|
class EBDPrivate
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Textures
|
||||||
|
{
|
||||||
|
BG,
|
||||||
|
L,
|
||||||
|
R,
|
||||||
|
TM,
|
||||||
|
BM,
|
||||||
|
TL,
|
||||||
|
TR,
|
||||||
|
BL,
|
||||||
|
BR,
|
||||||
|
TCOUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
EBDPrivate()
|
||||||
|
{
|
||||||
|
for( int i = 0; i < TCOUNT; i++ )
|
||||||
|
{
|
||||||
|
_Textures.push_back( new CViewBitmap( CViewBase::TCtorParam() ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
~EBDPrivate()
|
||||||
|
{
|
||||||
|
for( int i = 0; i < _Textures.size(); i++ )
|
||||||
|
delete _Textures[ i ];
|
||||||
|
_Textures.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw()
|
||||||
|
{
|
||||||
|
for( int i = 0; i < _Textures.size(); i++ )
|
||||||
|
{
|
||||||
|
CViewBitmap *bm = _Textures[ i ];
|
||||||
|
bm->draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateCoords()
|
||||||
|
{
|
||||||
|
for( int i = 0; i < _Textures.size(); i++ )
|
||||||
|
{
|
||||||
|
CViewBitmap *bm = _Textures[ i ];
|
||||||
|
bm->fitTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
// W and H parameters depend on the sizes of the other textures
|
||||||
|
// Negative sizes mean that the sizes are that much smaller than the parent
|
||||||
|
sint32 w,h;
|
||||||
|
h = _Textures[ TL ]->getHReal() + _Textures[ BL ]->getHReal();
|
||||||
|
h *= -1;
|
||||||
|
_Textures[ L ]->setH( h );
|
||||||
|
|
||||||
|
h = _Textures[ TR ]->getHReal() + _Textures[ BR ]->getHReal();
|
||||||
|
h *= -1;
|
||||||
|
_Textures[ R ]->setH( h );
|
||||||
|
|
||||||
|
w = _Textures[ TL ]->getWReal() + _Textures[ TR ]->getWReal();
|
||||||
|
w *= -1;
|
||||||
|
_Textures[ TM ]->setW( w );
|
||||||
|
|
||||||
|
w = _Textures[ BL ]->getWReal() + _Textures[ BR ]->getWReal();
|
||||||
|
w *= -1;
|
||||||
|
_Textures[ BM ]->setW( w );
|
||||||
|
|
||||||
|
h = _Textures[ TM ]->getHReal() + _Textures[ BM ]->getHReal();
|
||||||
|
h *= -1;
|
||||||
|
w = _Textures[ L ]->getWReal() + _Textures[ R ]->getWReal();
|
||||||
|
w *= -1;
|
||||||
|
_Textures[ BG ]->setW( w );
|
||||||
|
_Textures[ BG ]->setH( h );
|
||||||
|
|
||||||
|
for( int i = 0; i < _Textures.size(); i++ )
|
||||||
|
{
|
||||||
|
CViewBitmap *bm = _Textures[ i ];
|
||||||
|
bm->updateCoords();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup( CInterfaceGroup *parent )
|
||||||
|
{
|
||||||
|
for( int i = 0; i < _Textures.size(); i++ )
|
||||||
|
{
|
||||||
|
CViewBitmap *bm = _Textures[ i ];
|
||||||
|
bm->setParent( parent );
|
||||||
|
bm->setParentPos( parent );
|
||||||
|
bm->setParentSize( parent );
|
||||||
|
bm->setEditorSelectable( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
_Textures[ TL ]->setPosRef( Hotspot_TL );
|
||||||
|
_Textures[ TL ]->setParentPosRef( Hotspot_TL );
|
||||||
|
|
||||||
|
_Textures[ TM ]->setPosRef( Hotspot_TM );
|
||||||
|
_Textures[ TM ]->setParentPosRef( Hotspot_TM );
|
||||||
|
_Textures[ TM ]->setScale( true );
|
||||||
|
_Textures[ TM ]->setSizeRef( "w" );
|
||||||
|
|
||||||
|
_Textures[ TR ]->setPosRef( Hotspot_TR );
|
||||||
|
_Textures[ TR ]->setParentPosRef( Hotspot_TR );
|
||||||
|
|
||||||
|
_Textures[ BL ]->setPosRef( Hotspot_BL );
|
||||||
|
_Textures[ BL ]->setParentPosRef( Hotspot_BL );
|
||||||
|
|
||||||
|
_Textures[ BM ]->setPosRef( Hotspot_BM );
|
||||||
|
_Textures[ BM ]->setParentPosRef( Hotspot_BM );
|
||||||
|
_Textures[ BM ]->setScale( true );
|
||||||
|
_Textures[ BM ]->setSizeRef( "w" );
|
||||||
|
|
||||||
|
_Textures[ BR ]->setPosRef( Hotspot_BR );
|
||||||
|
_Textures[ BR ]->setParentPosRef( Hotspot_BR );
|
||||||
|
|
||||||
|
_Textures[ L ]->setPosRef( Hotspot_ML );
|
||||||
|
_Textures[ L ]->setParentPosRef( Hotspot_ML );
|
||||||
|
_Textures[ L ]->setScale( true );
|
||||||
|
_Textures[ L ]->setSizeRef( "h" );
|
||||||
|
|
||||||
|
_Textures[ R ]->setPosRef( Hotspot_MR );
|
||||||
|
_Textures[ R ]->setParentPosRef( Hotspot_MR );
|
||||||
|
_Textures[ R ]->setScale( true );
|
||||||
|
_Textures[ R ]->setSizeRef( "h" );
|
||||||
|
|
||||||
|
_Textures[ BG ]->setPosRef( Hotspot_MM );
|
||||||
|
_Textures[ BG ]->setParentPosRef( Hotspot_MM );
|
||||||
|
_Textures[ BG ]->setScale( true );
|
||||||
|
_Textures[ BG ]->setSizeRef( "wh" );
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector< CViewBitmap* > _Textures;
|
||||||
|
};
|
||||||
|
|
||||||
|
NLMISC_REGISTER_OBJECT( CViewBase, CGroupEditBoxDecor, std::string, "edit_box_decor" );
|
||||||
|
|
||||||
|
CGroupEditBoxDecor::CGroupEditBoxDecor( const TCtorParam ¶m ) :
|
||||||
|
CGroupEditBox( param )
|
||||||
|
{
|
||||||
|
_Pvt = new EBDPrivate();
|
||||||
|
_Pvt->setup( this );
|
||||||
|
|
||||||
|
createViewText();
|
||||||
|
getVT()->setSerializable( false );
|
||||||
|
getVT()->setEditorSelectable( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
CGroupEditBoxDecor::~CGroupEditBoxDecor()
|
||||||
|
{
|
||||||
|
delete _Pvt;
|
||||||
|
_Pvt = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGroupEditBoxDecor::moveBy( sint32 x, sint32 y )
|
||||||
|
{
|
||||||
|
CInterfaceElement::moveBy( x, y );
|
||||||
|
|
||||||
|
_Pvt->updateCoords();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGroupEditBoxDecor::setIdRecurse( const std::string &newID )
|
||||||
|
{
|
||||||
|
CInterfaceElement::setIdRecurse( newID );
|
||||||
|
_ViewText->setIdRecurse( _ViewText->getShortId() );
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CGroupEditBoxDecor::getProperty( const std::string &name ) const
|
||||||
|
{
|
||||||
|
if( name == "tx_tl" )
|
||||||
|
{
|
||||||
|
return _Pvt->_Textures[ EBDPrivate::TL ]->getTexture();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "tx_tm" )
|
||||||
|
{
|
||||||
|
return _Pvt->_Textures[ EBDPrivate::TM ]->getTexture();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "tx_tr" )
|
||||||
|
{
|
||||||
|
return _Pvt->_Textures[ EBDPrivate::TR ]->getTexture();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "tx_bl" )
|
||||||
|
{
|
||||||
|
return _Pvt->_Textures[ EBDPrivate::BL ]->getTexture();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "tx_bm" )
|
||||||
|
{
|
||||||
|
return _Pvt->_Textures[ EBDPrivate::BM ]->getTexture();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "tx_br" )
|
||||||
|
{
|
||||||
|
return _Pvt->_Textures[ EBDPrivate::BR ]->getTexture();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "tx_l" )
|
||||||
|
{
|
||||||
|
return _Pvt->_Textures[ EBDPrivate::L ]->getTexture();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "tx_r" )
|
||||||
|
{
|
||||||
|
return _Pvt->_Textures[ EBDPrivate::R ]->getTexture();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "tx_bg" )
|
||||||
|
{
|
||||||
|
return _Pvt->_Textures[ EBDPrivate::BG ]->getTexture();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return CGroupEditBox::getProperty( name );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGroupEditBoxDecor::setProperty( const std::string &name, const std::string &value )
|
||||||
|
{
|
||||||
|
if( name == "tx_tl" )
|
||||||
|
{
|
||||||
|
_Pvt->_Textures[ EBDPrivate::TL ]->setTexture( value );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "tx_tm" )
|
||||||
|
{
|
||||||
|
_Pvt->_Textures[ EBDPrivate::TM ]->setTexture( value );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "tx_tr" )
|
||||||
|
{
|
||||||
|
_Pvt->_Textures[ EBDPrivate::TR ]->setTexture( value );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "tx_bl" )
|
||||||
|
{
|
||||||
|
_Pvt->_Textures[ EBDPrivate::BL ]->setTexture( value );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "tx_bm" )
|
||||||
|
{
|
||||||
|
_Pvt->_Textures[ EBDPrivate::BM ]->setTexture( value );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "tx_br" )
|
||||||
|
{
|
||||||
|
_Pvt->_Textures[ EBDPrivate::BR ]->setTexture( value );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "tx_l" )
|
||||||
|
{
|
||||||
|
_Pvt->_Textures[ EBDPrivate::L ]->setTexture( value );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "tx_r" )
|
||||||
|
{
|
||||||
|
_Pvt->_Textures[ EBDPrivate::R ]->setTexture( value );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "tx_bg" )
|
||||||
|
{
|
||||||
|
_Pvt->_Textures[ EBDPrivate::BG ]->setTexture( value );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
CGroupEditBox::setProperty( name, value );
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlNodePtr CGroupEditBoxDecor::serialize( xmlNodePtr parentNode, const char *type ) const
|
||||||
|
{
|
||||||
|
xmlNodePtr node = CGroupEditBox::serialize( parentNode, type );
|
||||||
|
if( node == NULL )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
xmlSetProp( node, BAD_CAST "type", BAD_CAST "edit_box_decor" );
|
||||||
|
xmlSetProp( node, BAD_CAST "tx_tl", BAD_CAST _Pvt->_Textures[ EBDPrivate::TL ]->getTexture().c_str() );
|
||||||
|
xmlSetProp( node, BAD_CAST "tx_tr", BAD_CAST _Pvt->_Textures[ EBDPrivate::TR ]->getTexture().c_str() );
|
||||||
|
xmlSetProp( node, BAD_CAST "tx_tm", BAD_CAST _Pvt->_Textures[ EBDPrivate::TM ]->getTexture().c_str() );
|
||||||
|
xmlSetProp( node, BAD_CAST "tx_bl", BAD_CAST _Pvt->_Textures[ EBDPrivate::BL ]->getTexture().c_str() );
|
||||||
|
xmlSetProp( node, BAD_CAST "tx_bm", BAD_CAST _Pvt->_Textures[ EBDPrivate::BM ]->getTexture().c_str() );
|
||||||
|
xmlSetProp( node, BAD_CAST "tx_br", BAD_CAST _Pvt->_Textures[ EBDPrivate::BR ]->getTexture().c_str() );
|
||||||
|
xmlSetProp( node, BAD_CAST "tx_l", BAD_CAST _Pvt->_Textures[ EBDPrivate::L ]->getTexture().c_str() );
|
||||||
|
xmlSetProp( node, BAD_CAST "tx_r", BAD_CAST _Pvt->_Textures[ EBDPrivate::R ]->getTexture().c_str() );
|
||||||
|
xmlSetProp( node, BAD_CAST "tx_bg", BAD_CAST _Pvt->_Textures[ EBDPrivate::BG ]->getTexture().c_str() );
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CGroupEditBoxDecor::parse( xmlNodePtr cur, CInterfaceGroup *parent )
|
||||||
|
{
|
||||||
|
if( !CGroupEditBox::parse( cur, parent ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
CXMLAutoPtr prop;
|
||||||
|
|
||||||
|
prop = ( char* ) xmlGetProp( cur, BAD_CAST "tx_tl" );
|
||||||
|
if( prop )
|
||||||
|
_Pvt->_Textures[ EBDPrivate::TL ]->setTexture( ( const char* )prop );
|
||||||
|
|
||||||
|
prop = ( char* ) xmlGetProp( cur, BAD_CAST "tx_tm" );
|
||||||
|
if( prop )
|
||||||
|
_Pvt->_Textures[ EBDPrivate::TM ]->setTexture( ( const char* )prop );
|
||||||
|
|
||||||
|
prop = ( char* ) xmlGetProp( cur, BAD_CAST "tx_tr" );
|
||||||
|
if( prop )
|
||||||
|
_Pvt->_Textures[ EBDPrivate::TR ]->setTexture( ( const char* )prop );
|
||||||
|
|
||||||
|
prop = ( char* ) xmlGetProp( cur, BAD_CAST "tx_bl" );
|
||||||
|
if( prop )
|
||||||
|
_Pvt->_Textures[ EBDPrivate::BL ]->setTexture( ( const char* )prop );
|
||||||
|
|
||||||
|
prop = ( char* ) xmlGetProp( cur, BAD_CAST "tx_bm" );
|
||||||
|
if( prop )
|
||||||
|
_Pvt->_Textures[ EBDPrivate::BM ]->setTexture( ( const char* )prop );
|
||||||
|
|
||||||
|
prop = ( char* ) xmlGetProp( cur, BAD_CAST "tx_br" );
|
||||||
|
if( prop )
|
||||||
|
_Pvt->_Textures[ EBDPrivate::BR ]->setTexture( ( const char* )prop );
|
||||||
|
|
||||||
|
prop = ( char* ) xmlGetProp( cur, BAD_CAST "tx_l" );
|
||||||
|
if( prop )
|
||||||
|
_Pvt->_Textures[ EBDPrivate::L ]->setTexture( ( const char* )prop );
|
||||||
|
|
||||||
|
prop = ( char* ) xmlGetProp( cur, BAD_CAST "tx_r" );
|
||||||
|
if( prop )
|
||||||
|
_Pvt->_Textures[ EBDPrivate::R ]->setTexture( ( const char* )prop );
|
||||||
|
|
||||||
|
prop = ( char* ) xmlGetProp( cur, BAD_CAST "tx_bg" );
|
||||||
|
if( prop )
|
||||||
|
_Pvt->_Textures[ EBDPrivate::BG ]->setTexture( ( const char* )prop );
|
||||||
|
|
||||||
|
getVT()->setIdRecurse( "edit_text" );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGroupEditBoxDecor::draw()
|
||||||
|
{
|
||||||
|
CGroupEditBox::draw();
|
||||||
|
|
||||||
|
_Pvt->draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGroupEditBoxDecor::updateCoords()
|
||||||
|
{
|
||||||
|
sint32 tw = _Pvt->_Textures[ EBDPrivate::L ]->getWReal();
|
||||||
|
getVT()->setX( tw + 1 );
|
||||||
|
|
||||||
|
CGroupEditBox::updateCoords();
|
||||||
|
_Pvt->updateCoords();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGroupEditBoxDecor::forceLink()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "nel/gui/dbview_number.h"
|
#include "nel/gui/dbview_number.h"
|
||||||
#include "nel/gui/dbview_quantity.h"
|
#include "nel/gui/dbview_quantity.h"
|
||||||
#include "nel/gui/view_pointer.h"
|
#include "nel/gui/view_pointer.h"
|
||||||
|
#include "nel/gui/group_editbox_decor.h"
|
||||||
|
|
||||||
namespace NLGUI
|
namespace NLGUI
|
||||||
{
|
{
|
||||||
|
@ -39,5 +40,6 @@ namespace NLGUI
|
||||||
force_link_dbgroup_select_number_cpp();
|
force_link_dbgroup_select_number_cpp();
|
||||||
force_link_dbgroup_combo_box_cpp();
|
force_link_dbgroup_combo_box_cpp();
|
||||||
force_link_group_wheel_cpp();
|
force_link_group_wheel_cpp();
|
||||||
|
CGroupEditBoxDecor::forceLink();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2436,6 +2436,9 @@ namespace NLGUI
|
||||||
CCtrlBase *ctrl= _CtrlsUnderPointer[i];
|
CCtrlBase *ctrl= _CtrlsUnderPointer[i];
|
||||||
if (ctrl && ctrl->isCapturable() && ctrl->isInGroup( pNewCurrentWnd ) )
|
if (ctrl && ctrl->isCapturable() && ctrl->isInGroup( pNewCurrentWnd ) )
|
||||||
{
|
{
|
||||||
|
if( CInterfaceElement::getEditorMode() && !ctrl->isEditorSelectable() )
|
||||||
|
continue;
|
||||||
|
|
||||||
uint d = ctrl->getDepth( pNewCurrentWnd );
|
uint d = ctrl->getDepth( pNewCurrentWnd );
|
||||||
if (d > nMaxDepth)
|
if (d > nMaxDepth)
|
||||||
{
|
{
|
||||||
|
@ -2454,6 +2457,9 @@ namespace NLGUI
|
||||||
CViewBase *v = _ViewsUnderPointer[i];
|
CViewBase *v = _ViewsUnderPointer[i];
|
||||||
if( ( v != NULL ) && v->isInGroup( pNewCurrentWnd ) )
|
if( ( v != NULL ) && v->isInGroup( pNewCurrentWnd ) )
|
||||||
{
|
{
|
||||||
|
if( CInterfaceElement::getEditorMode() && !v->isEditorSelectable() )
|
||||||
|
continue;
|
||||||
|
|
||||||
_CapturedView = v;
|
_CapturedView = v;
|
||||||
captured = true;
|
captured = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
#include "stdmisc.h"
|
#include "stdmisc.h"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#include "nel/misc/common.h"
|
#include "nel/misc/common.h"
|
||||||
#include "nel/misc/ucstring.h"
|
#include "nel/misc/ucstring.h"
|
||||||
|
|
||||||
|
@ -42,125 +44,126 @@ using namespace std;
|
||||||
namespace NLMISC
|
namespace NLMISC
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
void setReportEmailFunction(void *emailFunction)
|
||||||
static HWND sendReport=NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//old doesn't work on visual c++ 7.1 due to default parameter typedef bool (*TEmailFunction) (const std::string &smtpServer, const std::string &from, const std::string &to, const std::string &subject, const std::string &body, const std::string &attachedFile = "", bool onlyCheck = false);
|
|
||||||
typedef bool (*TEmailFunction) (const std::string &smtpServer, const std::string &from, const std::string &to, const std::string &subject, const std::string &body, const std::string &attachedFile, bool onlyCheck);
|
|
||||||
|
|
||||||
#define DELETE_OBJECT(a) if((a)!=NULL) { DeleteObject (a); a = NULL; }
|
|
||||||
|
|
||||||
static TEmailFunction EmailFunction = NULL;
|
|
||||||
|
|
||||||
void setReportEmailFunction (void *emailFunction)
|
|
||||||
{
|
{
|
||||||
EmailFunction = (TEmailFunction)emailFunction;
|
// DEPRECATED
|
||||||
|
// no-op
|
||||||
#ifdef NL_OS_WINDOWS
|
|
||||||
if (sendReport)
|
|
||||||
EnableWindow(sendReport, FALSE);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static string Body;
|
// Contents of crash report
|
||||||
static std::string URL = "FILL_IN_CRASH_REPORT_HOSTNAME_HERE";
|
static string ReportBody;
|
||||||
|
// Host url for crash report
|
||||||
|
static std::string ReportPostUrl = "";
|
||||||
|
// Title for the crash report window
|
||||||
|
static std::string ReportWindowTitle = "";
|
||||||
|
|
||||||
|
void setReportPostUrl(const std::string &postUrl)
|
||||||
|
{
|
||||||
|
ReportPostUrl = postUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Launch the crash report application
|
||||||
static void doSendReport()
|
static void doSendReport()
|
||||||
{
|
{
|
||||||
std::string filename;
|
std::string filename;
|
||||||
|
|
||||||
filename = "report_";
|
filename = /*getLogDirectory() + */ "report_"; // FIXME: Should use log directory
|
||||||
filename += NLMISC::toString( int( time( NULL ) ) );
|
filename += NLMISC::toString( int( time( NULL ) ) );
|
||||||
filename += ".txt";
|
filename += ".txt";
|
||||||
|
|
||||||
std::string params;
|
std::stringstream params;
|
||||||
params = "-log ";
|
params << "-log ";
|
||||||
params += filename;
|
params << filename; // FIXME: Escape the filepath with quotes
|
||||||
params += " -host ";
|
if (!ReportPostUrl.empty())
|
||||||
params += URL;
|
{
|
||||||
|
params << " -host ";
|
||||||
|
params << ReportPostUrl;
|
||||||
|
}
|
||||||
|
if (!ReportWindowTitle.empty())
|
||||||
|
{
|
||||||
|
params << " -title ";
|
||||||
|
params << ReportWindowTitle; // FIXME: Escape the title with quotes and test
|
||||||
|
}
|
||||||
|
|
||||||
std::ofstream f;
|
std::ofstream f;
|
||||||
f.open( filename.c_str() );
|
f.open( filename.c_str() );
|
||||||
if( !f.good() )
|
if( !f.good() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
f << Body;
|
f << ReportBody;
|
||||||
|
|
||||||
f.close();
|
f.close();
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
NLMISC::launchProgram( "crash_report.exe", params );
|
NLMISC::launchProgram( "crash_report.exe", params.str() );
|
||||||
#else
|
#else
|
||||||
NLMISC::launchProgram( "crash_report", params );
|
NLMISC::launchProgram( "crash_report", params.str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Added because NLSMIC::launcProgram needs time to launch
|
// Added because NLSMIC::launcProgram needs time to launch
|
||||||
nlSleep( 2 * 1000 );
|
nlSleep( 2 * 1000 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NL_OS_WINDOWS
|
#if defined(FINAL_VERSION) || !defined(NL_OS_WINDOWS)
|
||||||
|
|
||||||
// GNU/Linux, do nothing
|
// For FINAL_VERSION, simply launch the crash report and exit the application
|
||||||
|
TReportResult report(const std::string &title, const std::string &header, const std::string &subject, const std::string &body, bool enableCheckIgnore, uint debugButton, bool ignoreButton, sint quitButton, bool sendReportButton, bool &ignoreNextTime, const string &attachedFile)
|
||||||
TReportResult report (const std::string &title, const std::string &header, const std::string &subject, const std::string &body, bool enableCheckIgnore, uint debugButton, bool ignoreButton, sint quitButton, bool sendReportButton, bool &ignoreNextTime, const string &attachedFile)
|
|
||||||
{
|
{
|
||||||
Body = addSlashR( body );
|
ReportWindowTitle = title.empty() ? "Nel Crash Report" : title;
|
||||||
|
ReportBody = addSlashR(body);
|
||||||
|
|
||||||
doSendReport();
|
doSendReport();
|
||||||
|
|
||||||
return ReportQuit;
|
# if defined(FINAL_VERSION) // TODO: This behaviour is used in the old report code when Quitting the application is the default crash report behaviour. Needs testing.
|
||||||
|
# ifdef NL_OS_WINDOWS
|
||||||
|
# ifndef NL_COMP_MINGW
|
||||||
|
// disable the Windows popup telling that the application aborted and disable the dr watson report.
|
||||||
|
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
// quit without calling atexit or static object dtors.
|
||||||
|
abort();
|
||||||
|
# endif
|
||||||
|
|
||||||
|
return ReportQuit;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// Windows specific version
|
// Windows specific version for DEV builds, first shows a dialog box for debugging
|
||||||
|
|
||||||
static string Subject;
|
static HWND sendReport=NULL;
|
||||||
static string AttachedFile;
|
#define DELETE_OBJECT(a) if((a)!=NULL) { DeleteObject (a); a = NULL; }
|
||||||
|
|
||||||
static HWND checkIgnore=NULL;
|
static HWND checkIgnore = NULL;
|
||||||
static HWND debug=NULL;
|
static HWND debug = NULL;
|
||||||
static HWND ignore=NULL;
|
static HWND ignore = NULL;
|
||||||
static HWND quit=NULL;
|
static HWND quit = NULL;
|
||||||
static HWND dialog=NULL;
|
static HWND dialog = NULL;
|
||||||
|
|
||||||
static bool NeedExit;
|
static bool NeedExit;
|
||||||
static TReportResult Result;
|
static TReportResult Result;
|
||||||
static bool IgnoreNextTime;
|
static bool IgnoreNextTime;
|
||||||
static bool CanSendMailReport= false;
|
static bool CanSendMailReport = false;
|
||||||
|
|
||||||
static bool DebugDefaultBehavior, QuitDefaultBehavior;
|
static bool DebugDefaultBehavior, QuitDefaultBehavior;
|
||||||
|
|
||||||
static void sendEmail()
|
static void maybeSendReport()
|
||||||
{
|
{
|
||||||
if (CanSendMailReport && SendMessage(sendReport, BM_GETCHECK, 0, 0) != BST_CHECKED)
|
if (CanSendMailReport && SendMessage(sendReport, BM_GETCHECK, 0, 0) != BST_CHECKED)
|
||||||
{
|
{
|
||||||
bool res = EmailFunction ("", "", "", Subject, Body, AttachedFile, false);
|
doSendReport();
|
||||||
if (res)
|
|
||||||
{
|
|
||||||
// EnableWindow(sendReport, FALSE);
|
|
||||||
// MessageBox (dialog, "The email was successfully sent", "email", MB_OK);
|
|
||||||
#ifndef NL_NO_DEBUG_FILES
|
#ifndef NL_NO_DEBUG_FILES
|
||||||
CFile::createEmptyFile(getLogDirectory() + "report_sent");
|
CFile::createEmptyFile(getLogDirectory() + "report_sent");
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifndef NL_NO_DEBUG_FILES
|
|
||||||
CFile::createEmptyFile(getLogDirectory() + "report_failed");
|
|
||||||
#endif
|
|
||||||
// MessageBox (dialog, "Failed to send the email", "email", MB_OK | MB_ICONERROR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifndef NL_NO_DEBUG_FILES
|
#ifndef NL_NO_DEBUG_FILES
|
||||||
CFile::createEmptyFile(getLogDirectory() + "report_refused");
|
CFile::createEmptyFile(getLogDirectory() + "report_refused");
|
||||||
#endif
|
#endif
|
||||||
}
|
- }
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
static LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
@ -175,7 +178,7 @@ static LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM
|
||||||
}
|
}
|
||||||
else if ((HWND) lParam == debug)
|
else if ((HWND) lParam == debug)
|
||||||
{
|
{
|
||||||
doSendReport();
|
maybeSendReport();
|
||||||
NeedExit = true;
|
NeedExit = true;
|
||||||
Result = ReportDebug;
|
Result = ReportDebug;
|
||||||
if (DebugDefaultBehavior)
|
if (DebugDefaultBehavior)
|
||||||
|
@ -185,13 +188,13 @@ static LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM
|
||||||
}
|
}
|
||||||
else if ((HWND) lParam == ignore)
|
else if ((HWND) lParam == ignore)
|
||||||
{
|
{
|
||||||
doSendReport();
|
maybeSendReport();
|
||||||
NeedExit = true;
|
NeedExit = true;
|
||||||
Result = ReportIgnore;
|
Result = ReportIgnore;
|
||||||
}
|
}
|
||||||
else if ((HWND) lParam == quit)
|
else if ((HWND) lParam == quit)
|
||||||
{
|
{
|
||||||
doSendReport();
|
maybeSendReport();
|
||||||
NeedExit = true;
|
NeedExit = true;
|
||||||
Result = ReportQuit;
|
Result = ReportQuit;
|
||||||
|
|
||||||
|
@ -210,43 +213,26 @@ static LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*else if ((HWND) lParam == sendReport)
|
|
||||||
{
|
|
||||||
if (EmailFunction != NULL)
|
|
||||||
{
|
|
||||||
bool res = EmailFunction ("", "", "", Subject, Body, AttachedFile, false);
|
|
||||||
if (res)
|
|
||||||
{
|
|
||||||
EnableWindow(sendReport, FALSE);
|
|
||||||
MessageBox (dialog, "The email was successfully sent", "email", MB_OK);
|
|
||||||
CFile::createEmptyFile(getLogDirectory() + "report_sent");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox (dialog, "Failed to send the email", "email", MB_OK | MB_ICONERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
else if (message == WM_CHAR)
|
else if (message == WM_CHAR)
|
||||||
{
|
{
|
||||||
if (wParam == 27)
|
if (wParam == 27)
|
||||||
{
|
{
|
||||||
// ESC -> ignore
|
// ESC -> ignore
|
||||||
doSendReport();
|
maybeSendReport();
|
||||||
NeedExit = true;
|
NeedExit = true;
|
||||||
Result = ReportIgnore;
|
Result = ReportIgnore;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc (hWnd, message, wParam, lParam);
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
TReportResult report (const std::string &title, const std::string &header, const std::string &subject, const std::string &body, bool enableCheckIgnore, uint debugButton, bool ignoreButton, sint quitButton, bool sendReportButton, bool &ignoreNextTime, const string &attachedFile)
|
TReportResult report(const std::string &title, const std::string &header, const std::string &subject, const std::string &body, bool enableCheckIgnore, uint debugButton, bool ignoreButton, sint quitButton, bool sendReportButton, bool &ignoreNextTime, const string &attachedFile)
|
||||||
{
|
{
|
||||||
// register the window
|
// register the window
|
||||||
static bool AlreadyRegister = false;
|
static bool AlreadyRegister = false;
|
||||||
if(!AlreadyRegister)
|
if (!AlreadyRegister)
|
||||||
{
|
{
|
||||||
WNDCLASSW wc;
|
WNDCLASSW wc;
|
||||||
memset (&wc,0,sizeof(wc));
|
memset (&wc,0,sizeof(wc));
|
||||||
|
@ -264,8 +250,8 @@ TReportResult report (const std::string &title, const std::string &header, const
|
||||||
AlreadyRegister = true;
|
AlreadyRegister = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ucstring formatedTitle = title.empty() ? ucstring("NeL report") : ucstring(title);
|
ReportWindowTitle = title.empty() ? "Nel Crash Report" : title;
|
||||||
|
ucstring formatedTitle = ucstring::makeFromUtf8(ReportWindowTitle);
|
||||||
|
|
||||||
// create the window
|
// create the window
|
||||||
dialog = CreateWindowW (L"NLReportWindow", (LPCWSTR)formatedTitle.c_str(), WS_DLGFRAME | WS_CAPTION /*| WS_THICKFRAME*/, CW_USEDEFAULT, CW_USEDEFAULT, 456, 400, NULL, NULL, GetModuleHandle(NULL), NULL);
|
dialog = CreateWindowW (L"NLReportWindow", (LPCWSTR)formatedTitle.c_str(), WS_DLGFRAME | WS_CAPTION /*| WS_THICKFRAME*/, CW_USEDEFAULT, CW_USEDEFAULT, 456, 400, NULL, NULL, GetModuleHandle(NULL), NULL);
|
||||||
|
@ -273,9 +259,6 @@ TReportResult report (const std::string &title, const std::string &header, const
|
||||||
// create the font
|
// create the font
|
||||||
HFONT font = CreateFont (-12, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial");
|
HFONT font = CreateFont (-12, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial");
|
||||||
|
|
||||||
Subject = subject;
|
|
||||||
AttachedFile = attachedFile;
|
|
||||||
|
|
||||||
// create the edit control
|
// create the edit control
|
||||||
HWND edit = CreateWindowW (L"EDIT", NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | ES_READONLY | ES_LEFT | ES_MULTILINE, 7, 70, 429, 212, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
|
HWND edit = CreateWindowW (L"EDIT", NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | ES_READONLY | ES_LEFT | ES_MULTILINE, 7, 70, 429, 212, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
|
||||||
SendMessage (edit, WM_SETFONT, (WPARAM) font, TRUE);
|
SendMessage (edit, WM_SETFONT, (WPARAM) font, TRUE);
|
||||||
|
@ -283,10 +266,10 @@ TReportResult report (const std::string &title, const std::string &header, const
|
||||||
// set the edit text limit to lot of :)
|
// set the edit text limit to lot of :)
|
||||||
SendMessage (edit, EM_LIMITTEXT, ~0U, 0);
|
SendMessage (edit, EM_LIMITTEXT, ~0U, 0);
|
||||||
|
|
||||||
Body = addSlashR (body);
|
ReportBody = addSlashR(body);
|
||||||
|
|
||||||
// set the message in the edit text
|
// set the message in the edit text
|
||||||
SendMessage (edit, WM_SETTEXT, (WPARAM)0, (LPARAM)Body.c_str());
|
SendMessage (edit, WM_SETTEXT, (WPARAM)0, (LPARAM)ReportBody.c_str());
|
||||||
|
|
||||||
if (enableCheckIgnore)
|
if (enableCheckIgnore)
|
||||||
{
|
{
|
||||||
|
@ -336,8 +319,7 @@ TReportResult report (const std::string &title, const std::string &header, const
|
||||||
}
|
}
|
||||||
|
|
||||||
// ace don't do that because it s slow to try to send a mail
|
// ace don't do that because it s slow to try to send a mail
|
||||||
//CanSendMailReport = sendReportButton && EmailFunction != NULL && EmailFunction("", "", "", "", "", true);
|
CanSendMailReport = sendReportButton && !ReportPostUrl.empty();
|
||||||
CanSendMailReport = sendReportButton && EmailFunction != NULL;
|
|
||||||
|
|
||||||
if (CanSendMailReport)
|
if (CanSendMailReport)
|
||||||
formatedHeader += " Send report will only email the contents of the box below. Please, send it to help us (it could take few minutes to send the email, be patient).";
|
formatedHeader += " Send report will only email the contents of the box below. Please, send it to help us (it could take few minutes to send the email, be patient).";
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
# include <QUrlQuery>
|
||||||
|
#endif
|
||||||
|
|
||||||
class CCrashReportSocketPvt
|
class CCrashReportSocketPvt
|
||||||
{
|
{
|
||||||
|
@ -43,16 +46,26 @@ CCrashReportSocket::~CCrashReportSocket()
|
||||||
|
|
||||||
void CCrashReportSocket::sendReport( const SCrashReportData &data )
|
void CCrashReportSocket::sendReport( const SCrashReportData &data )
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
QUrlQuery params;
|
||||||
|
#else
|
||||||
QUrl params;
|
QUrl params;
|
||||||
|
#endif
|
||||||
params.addQueryItem( "report", data.report );
|
params.addQueryItem( "report", data.report );
|
||||||
params.addQueryItem( "descr", data.description );
|
params.addQueryItem( "descr", data.description );
|
||||||
params.addQueryItem( "email", data.email );
|
params.addQueryItem("email", data.email);
|
||||||
|
|
||||||
QUrl url( m_url );
|
QUrl url( m_url );
|
||||||
QNetworkRequest request( url );
|
QNetworkRequest request( url );
|
||||||
request.setRawHeader( "Connection", "close" );
|
request.setRawHeader( "Connection", "close" );
|
||||||
|
|
||||||
m_pvt->mgr.post( request, params.encodedQuery() );
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
QByteArray postData = params.query(QUrl::FullyEncoded).toUtf8();
|
||||||
|
#else
|
||||||
|
QByteArray postData = params.encodedQuery();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
m_pvt->mgr.post(request, postData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCrashReportSocket::onFinished( QNetworkReply *reply )
|
void CCrashReportSocket::onFinished( QNetworkReply *reply )
|
||||||
|
|
|
@ -188,7 +188,7 @@ namespace GUIEditor
|
||||||
|
|
||||||
void NelGUICtrl::onGUILoaded()
|
void NelGUICtrl::onGUILoaded()
|
||||||
{
|
{
|
||||||
timerID = startTimer( 200 );
|
timerID = startTimer( 25 );
|
||||||
guiLoaded = true;
|
guiLoaded = true;
|
||||||
Q_EMIT guiLoadComplete();
|
Q_EMIT guiLoadComplete();
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,9 @@ QDialog( parent )
|
||||||
{
|
{
|
||||||
m_ui.setupUi( this );
|
m_ui.setupUi( this );
|
||||||
|
|
||||||
|
// Login texture map - temporaty measure until we add default textures for widgets to use
|
||||||
|
m_ui.mapList->addItem( "texture_interfaces_v3_login.tga" );
|
||||||
|
|
||||||
connect( m_ui.okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOKClicked() ) );
|
connect( m_ui.okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOKClicked() ) );
|
||||||
connect( m_ui.cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) );
|
connect( m_ui.cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) );
|
||||||
connect( m_ui.projectDirTB, SIGNAL( clicked( bool ) ), this, SLOT( onProjectDirTBClicked() ) );
|
connect( m_ui.projectDirTB, SIGNAL( clicked( bool ) ), this, SLOT( onProjectDirTBClicked() ) );
|
||||||
|
|
|
@ -166,6 +166,9 @@ namespace GUIEditor
|
||||||
std::vector< CCtrlBase* >::const_iterator citr;
|
std::vector< CCtrlBase* >::const_iterator citr;
|
||||||
for( citr = controls.begin(); citr != controls.end(); ++citr )
|
for( citr = controls.begin(); citr != controls.end(); ++citr )
|
||||||
{
|
{
|
||||||
|
if( !(*citr)->isEditorSelectable() )
|
||||||
|
continue;
|
||||||
|
|
||||||
QTreeWidgetItem *subItem = new QTreeWidgetItem( item );
|
QTreeWidgetItem *subItem = new QTreeWidgetItem( item );
|
||||||
subItem->setText( 0, makeNodeName( (*citr)->getId() ).c_str() );
|
subItem->setText( 0, makeNodeName( (*citr)->getId() ).c_str() );
|
||||||
widgetHierarchyMap[ (*citr)->getId() ] = subItem;
|
widgetHierarchyMap[ (*citr)->getId() ] = subItem;
|
||||||
|
@ -176,6 +179,9 @@ namespace GUIEditor
|
||||||
std::vector< CViewBase* >::const_iterator vitr;
|
std::vector< CViewBase* >::const_iterator vitr;
|
||||||
for( vitr = views.begin(); vitr != views.end(); ++vitr )
|
for( vitr = views.begin(); vitr != views.end(); ++vitr )
|
||||||
{
|
{
|
||||||
|
if( !(*vitr)->isEditorSelectable() )
|
||||||
|
continue;
|
||||||
|
|
||||||
QTreeWidgetItem *subItem = new QTreeWidgetItem( item );
|
QTreeWidgetItem *subItem = new QTreeWidgetItem( item );
|
||||||
subItem->setText( 0, makeNodeName( (*vitr)->getId() ).c_str() );
|
subItem->setText( 0, makeNodeName( (*vitr)->getId() ).c_str() );
|
||||||
widgetHierarchyMap[ (*vitr)->getId() ] = subItem;
|
widgetHierarchyMap[ (*vitr)->getId() ] = subItem;
|
||||||
|
|
|
@ -75,6 +75,10 @@ namespace GUIEditor
|
||||||
// copy the properties to the child, since they inherit them
|
// copy the properties to the child, since they inherit them
|
||||||
for( std::vector< SPropEntry >::const_iterator itr = this->info.props.begin(); itr != this->info.props.end(); ++itr )
|
for( std::vector< SPropEntry >::const_iterator itr = this->info.props.begin(); itr != this->info.props.end(); ++itr )
|
||||||
{
|
{
|
||||||
|
// Don't add property if already exists, since it's an override.
|
||||||
|
if( node->hasProperty( itr->propName ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
node->addProperty( *itr );
|
node->addProperty( *itr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,18 +11,18 @@
|
||||||
<properties>
|
<properties>
|
||||||
<property>
|
<property>
|
||||||
<name>tx_normal</name>
|
<name>tx_normal</name>
|
||||||
<type>string</type>
|
<type>texture</type>
|
||||||
<default></default>
|
<default>tp_quit.tga</default>
|
||||||
</property>
|
</property>
|
||||||
<property>
|
<property>
|
||||||
<name>tx_pushed</name>
|
<name>tx_pushed</name>
|
||||||
<type>string</type>
|
<type>texture</type>
|
||||||
<default></default>
|
<default>tp_quit.tga</default>
|
||||||
</property>
|
</property>
|
||||||
<property>
|
<property>
|
||||||
<name>tx_over</name>
|
<name>tx_over</name>
|
||||||
<type>string</type>
|
<type>texture</type>
|
||||||
<default></default>
|
<default>tp_quit.tga</default>
|
||||||
</property>
|
</property>
|
||||||
<property>
|
<property>
|
||||||
<name>scale</name>
|
<name>scale</name>
|
||||||
|
|
|
@ -9,6 +9,11 @@
|
||||||
<icon></icon>
|
<icon></icon>
|
||||||
</header>
|
</header>
|
||||||
<properties>
|
<properties>
|
||||||
|
<property>
|
||||||
|
<name>hardtext</name>
|
||||||
|
<type>string</type>
|
||||||
|
<default>0</default>
|
||||||
|
</property>
|
||||||
<property>
|
<property>
|
||||||
<name>value</name>
|
<name>value</name>
|
||||||
<type>string</type>
|
<type>string</type>
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
<widget>
|
||||||
|
<header>
|
||||||
|
<name>GroupEditBoxDecor</name>
|
||||||
|
<guiname>CGroupEditBoxDecor</guiname>
|
||||||
|
<classname>edit_box_decor</classname>
|
||||||
|
<ancestor>GroupEditBox</ancestor>
|
||||||
|
<description></description>
|
||||||
|
<abstract>false</abstract>
|
||||||
|
<icon></icon>
|
||||||
|
</header>
|
||||||
|
<properties>
|
||||||
|
<property>
|
||||||
|
<name>w</name>
|
||||||
|
<type>int</type>
|
||||||
|
<default>150</default>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>h</name>
|
||||||
|
<type>int</type>
|
||||||
|
<default>25</default>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>tx_tl</name>
|
||||||
|
<type>texture</type>
|
||||||
|
<default>log_eb_tl.tga</default>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>tx_tm</name>
|
||||||
|
<type>texture</type>
|
||||||
|
<default>log_eb_t.tga</default>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>tx_tr</name>
|
||||||
|
<type>texture</type>
|
||||||
|
<default>log_eb_tr.tga</default>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>tx_bl</name>
|
||||||
|
<type>texture</type>
|
||||||
|
<default>log_eb_bl.tga</default>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>tx_bm</name>
|
||||||
|
<type>texture</type>
|
||||||
|
<default>log_eb_b.tga</default>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>tx_br</name>
|
||||||
|
<type>texture</type>
|
||||||
|
<default>log_eb_br.tga</default>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>tx_l</name>
|
||||||
|
<type>texture</type>
|
||||||
|
<default>log_eb_l.tga</default>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>tx_r</name>
|
||||||
|
<type>texture</type>
|
||||||
|
<default>log_eb_r.tga</default>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>tx_bg</name>
|
||||||
|
<type>texture</type>
|
||||||
|
<default>log_eb_m.tga</default>
|
||||||
|
</property>
|
||||||
|
</properties>
|
||||||
|
</widget>
|
|
@ -37,7 +37,7 @@
|
||||||
<property>
|
<property>
|
||||||
<name>texture</name>
|
<name>texture</name>
|
||||||
<type>texture</type>
|
<type>texture</type>
|
||||||
<default></default>
|
<default>log_kami.tga</default>
|
||||||
</property>
|
</property>
|
||||||
<property>
|
<property>
|
||||||
<name>scale</name>
|
<name>scale</name>
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
<html>
|
|
||||||
<head><title>Ryzom Core Error Report Web application test harness</title></head>
|
|
||||||
<body>
|
|
||||||
<form action="r.php" method="post">
|
|
||||||
<table border="0">
|
|
||||||
<tr><td>Description</td></tr>
|
|
||||||
<tr><td><textarea name="descr">Something something dark side</textarea></td></tr>
|
|
||||||
<tr><td>Report</td></tr>
|
|
||||||
<tr><td><textarea name="report">Mani bad crashes :(</textarea></td></tr>
|
|
||||||
<tr><td>Email</td></tr>
|
|
||||||
<tr><td>
|
|
||||||
<input type="text" name="email" value="e@ma.il"/>
|
|
||||||
</td></tr>
|
|
||||||
|
|
||||||
<tr><td><input type="submit" value="report"/></td></tr>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Reference in a new issue