Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wx widget new version303 #20

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,17 @@
*.lo
*.o
*.obj
/code/Torsion/.vs/Torsion/v14/.suo
/code/Torsion/Debug/
/code/Torsion/Debug-Dll/
/code/Torsion/temp
/code/wxWidgets/contrib/build/stc/vc_mswd/
/code/wxWidgets/lib/vc_lib/*.lib
/code/wxWidgets/lib/vc_lib/*.pdb
/code/Torsion/Torsion.VC.VC.opendb
/code/Torsion/Torsion.VC.db
/code/tinyxml2/vc_mswd/stc/tinyxml2.tlog
/code/tinyxml2/vc_mswd/stc/tinyxml2.pdb
/code/tinyxml2/vc_mswd/stc/tinyxml2.log
/code/tinyxml2/vc_mswd/stc/tinyxml2.idb
*.exp
4 changes: 3 additions & 1 deletion code/Torsion/AboutDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ void AboutDlg::CreateControls()

////@end AboutDlg content construction

FindWindow( abID_VERSION )->SetTitle( tsGetFullBuildString() );
// FindWindow( abID_VERSION )->SetTitle( tsGetFullBuildString() )

FindWindow(abID_VERSION)->SetName(tsGetFullBuildString());

/*
wxString info;
Expand Down
81 changes: 45 additions & 36 deletions code/Torsion/AppPrefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <wx/file.h>
#include <wx/tokenzr.h>
#include <wx/docview.h>
#include <string>

#include "XmlFile.h"

Expand All @@ -16,7 +17,7 @@
#endif

const wxChar* AppPrefs::s_ReservedWords =
"break case continue datablock package default else false function if for new or package return " \
L"break case continue datablock package default else false function if for new or package return " \
"switch switch$ true %this while singleton local";

IMPLEMENT_CLASS(tsPrefsUpdateHint, wxObject)
Expand Down Expand Up @@ -52,12 +53,12 @@ bool AppPrefs::Load( const wxString& Path )
if ( !File.Open( Path, wxFile::read ) ) {

// This loads defaults.
LoadFromString( "" );
LoadFromString( L"" );
return false;
}

size_t Length = File.Length();
char* Buffer = new char[ Length+1 ];
wchar_t* Buffer = new wchar_t[ Length+1 ];
File.Read( Buffer, Length );
Buffer[ Length ] = 0;
LoadFromString( Buffer );
Expand All @@ -70,8 +71,8 @@ void AppPrefs::LoadFromString( const wxChar* Buffer )
{
XmlFile Xml( Buffer );

Xml.FindElem( "TorsionPrefs" );
Xml.IntoElem();
//Xml.FindElem( "TorsionPrefs" );
//Xml.IntoElem();

wxString fontInfo = Xml.GetStringElem( "DefaultFont", m_DefaultFont.GetNativeFontInfoDesc() );
m_DefaultFont.SetNativeFontInfo( fontInfo );
Expand Down Expand Up @@ -115,17 +116,17 @@ void AppPrefs::LoadFromString( const wxChar* Buffer )

wxRect desktop( wxScreenDC().GetSize() );

Xml.FindElem( "Position" );
m_Position = StringToRect( Xml.GetData().c_str() );
tinyxml2::XMLElement *pPosition = Xml.FirstChildElement( "Position" );
m_Position = StringToRect(pPosition->GetText());
{
if ( !desktop.Inside( m_Position.GetTopLeft() ) )
if ( !desktop.Contains( m_Position.GetTopLeft() ) )
m_Position.SetTopLeft( wxPoint( 0, 0 ) );
if ( m_Position.GetWidth() > desktop.GetWidth() )
m_Position.SetWidth( desktop.GetWidth() );
if ( m_Position.GetHeight() > desktop.GetHeight() )
m_Position.SetHeight( desktop.GetHeight() );
}
Xml.ResetMainPos();
// Xml.ResetMainPos();
m_Maximized = Xml.GetBoolElem( "Maximized", false );

m_ProjectSashWidth = Xml.GetIntElem( "ProjectSashWidth", -1 );
Expand Down Expand Up @@ -153,7 +154,7 @@ void AppPrefs::LoadFromString( const wxChar* Buffer )
m_FindSearchUp = Xml.GetBoolElem( "FindSearchUp", false );

m_FindPos = Xml.GetPointElem( "FindPos", wxDefaultPosition );
if ( !desktop.Inside( m_FindPos ) )
if ( !desktop.Contains( m_FindPos ) )
m_FindPos = wxDefaultPosition;

m_FindSymbols.Empty();
Expand Down Expand Up @@ -230,22 +231,27 @@ void AppPrefs::LoadFromString( const wxChar* Buffer )
m_CheckForUpdates = Xml.GetBoolElem( "CheckForUpdates", true );

m_ToolCommands.Clear();
if ( Xml.FindElem( "ExternalTools" ) )
tinyxml2::XMLElement *pExternalTools = Xml.FirstChildElement("ExternalTools");

if (pExternalTools)
{
Xml.IntoElem();
// Xml.IntoElem();

tinyxml2::XMLElement *pTool = pExternalTools->FirstChildElement("Tool");

while ( Xml.FindElem( "Tool" ) && Xml.IntoElem() )
while (pTool)
{
ToolCommand cmd;
// pTool->FirstChildElement()
cmd.SetTitle( Xml.GetStringElem( "Title", "(Empty)" ) );
cmd.SetCmd( Xml.GetStringElem( "Command", wxEmptyString ) );
cmd.SetArgs( Xml.GetStringElem( "Arguments", wxEmptyString ) );
cmd.SetDir( Xml.GetStringElem( "Directory", wxEmptyString ) );
m_ToolCommands.Add( cmd );
Xml.OutOfElem();
// Xml.OutOfElem();
}

Xml.OutOfElem();
// Xml.OutOfElem();
}
else
{
Expand All @@ -268,15 +274,16 @@ bool AppPrefs::Save( const wxString& Path )
}

XmlFile Xml;
Xml.AddElem( "TorsionPrefs" );
Xml.IntoElem();
tinyxml2::XMLElement * pTorsionPrefs = Xml.AddElem( "TorsionPrefs" );
//Xml.IntoElem();

Xml.AddElem( "DefaultFont", m_DefaultFont.GetNativeFontInfoDesc() );
Xml.AddElem( "DefaultFont", m_DefaultFont.GetNativeFontInfoDesc(), pTorsionPrefs);

Xml.AddElem( "ReservedWords", m_Reserved );
Xml.AddAttrib( "color", Xml.ColorToString( m_ReservedColor ) );
tinyxml2::XMLElement * pReservedWords = Xml.AddElem( "ReservedWords", m_Reserved , pTorsionPrefs);
pReservedWords->Attribute("color", Xml.ColorToString(m_ReservedColor));
//Xml.AddAttrib( "color", Xml.ColorToString( m_ReservedColor ) );

Xml.AddElem( "ExportsColor", Xml.ColorToString( m_ExportsColor ) );
Xml.AddElem( "ExportsColor", Xml.ColorToString( m_ExportsColor ), pTorsionPrefs);

Xml.AddColorElem( "BgColor", m_BgColor );

Expand Down Expand Up @@ -309,7 +316,7 @@ bool AppPrefs::Save( const wxString& Path )

Xml.AddBoolElem( "EnhancedCompletion", m_EnhancedCompletion );

Xml.AddElem( "Position", RectToString( m_Position ) );
Xml.AddElem( "Position", RectToString( m_Position ), pTorsionPrefs);
Xml.AddBoolElem( "Maximized", m_Maximized );

Xml.AddIntElem( "ProjectSashWidth", m_ProjectSashWidth );
Expand Down Expand Up @@ -343,10 +350,10 @@ bool AppPrefs::Save( const wxString& Path )
Xml.AddArrayStringElems( "FindSymbols", "String", m_FindSymbols );

Xml.AddBoolElem( "LoadLastProject", m_LoadLastProject );
Xml.AddElem( "LastProject", m_LastProject );
Xml.AddElem( "LastProject", m_LastProject, pTorsionPrefs);

Xml.AddElem( "ScriptExtensions", GetScriptExtsString() );
Xml.AddElem( "DSOExts", GetDSOExtsString() );
Xml.AddElem( "ScriptExtensions", GetScriptExtsString(), pTorsionPrefs);
Xml.AddElem( "DSOExts", GetDSOExtsString(), pTorsionPrefs);
Xml.AddArrayStringElems( "ExcludedFileNames", "Name", m_ExcludedFiles );
Xml.AddArrayStringElems( "ExcludedFolderNames", "Name", m_ExcludedFolders );
Xml.AddArrayStringElems( "TextExts", "Ext", m_TextExts );
Expand All @@ -357,25 +364,27 @@ bool AppPrefs::Save( const wxString& Path )

Xml.AddBoolElem( "CheckForUpdates", m_CheckForUpdates );

Xml.AddElem( "ExternalTools" );
Xml.IntoElem();
tinyxml2::XMLElement * pExternalTools = Xml.AddElem( "ExternalTools","", pTorsionPrefs);
//Xml.IntoElem();
for ( size_t i=0; i < m_ToolCommands.GetCount(); i++ )
{
const ToolCommand& cmd = m_ToolCommands[i];

Xml.AddElem( "Tool" );
Xml.IntoElem();
tinyxml2::XMLElement * pTool = Xml.AddElem( "Tool" ,"", pExternalTools);
//Xml.IntoElem();

Xml.AddElem( "Title", cmd.GetTitle() );
Xml.AddElem( "Command", cmd.GetCmd() );
Xml.AddElem( "Arguments", cmd.GetArgs() );
Xml.AddElem( "Directory", cmd.GetDir() );
Xml.AddElem( "Title", cmd.GetTitle(),pTool );
Xml.AddElem( "Command", cmd.GetCmd(), pTool);
Xml.AddElem( "Arguments", cmd.GetArgs(), pTool);
Xml.AddElem( "Directory", cmd.GetDir(), pTool);

Xml.OutOfElem();
//Xml.OutOfElem();
}
Xml.OutOfElem();
//Xml.OutOfElem();
tinyxml2::XMLPrinter printer;
Xml.Accept(&printer);

std::string Buffer( Xml.GetDoc() );
std::string Buffer(printer.CStr() );
File.Write( Buffer.c_str(), Buffer.length() );

return true;
Expand Down
4 changes: 2 additions & 2 deletions code/Torsion/AutoCompData.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ class AutoCompData
friend class AutoCompThread;
friend class AutoCompManager;

protected:
public:

AutoCompData();
~AutoCompData();

void Build( const AutoCompPageArray& pages, AutoCompExports* exports );

public:


// These are used to define what icon to use
// for the string list identifier.
Expand Down
Loading