コード例 #1
0
ファイル: input.cpp プロジェクト: ruifig/nutcracker
void InteractiveInputTestCase::TestSingleIstance()
{
#ifdef TEST_SNGLINST
    wxPuts(wxT("\n*** Testing wxSingleInstanceChecker ***"));

    wxSingleInstanceChecker checker;
    if ( checker.Create(wxT(".wxconsole.lock")) )
    {
        if ( checker.IsAnotherRunning() )
        {
            wxPrintf(wxT("Another instance of the program is running, exiting.\n"));
            return;
        }

        // wait some time to give time to launch another instance
        wxPuts(wxT("If you try to run another instance of this program now, it won't start."));
        wxPrintf(wxT("Press \"Enter\" to exit wxSingleInstanceChecker test and proceed..."));
        wxFgetc(stdin);
    }
    else // failed to create
    {
        wxPrintf(wxT("Failed to init wxSingleInstanceChecker.\n"));
    }
    
    wxPuts("\n");
#endif // defined(TEST_SNGLINST)
}
コード例 #2
0
ファイル: output.cpp プロジェクト: euler0/Helium
void InteractiveOutputTestCase::TestMimeAssociate()
{
#ifdef TEST_MIME
    wxPuts(wxT("*** Testing creation of filetype association ***\n"));

    wxFileTypeInfo ftInfo(
                            wxT("application/x-xyz"),
                            wxT("xyzview '%s'"), // open cmd
                            wxT(""),             // print cmd
                            wxT("XYZ File"),     // description
                            wxT(".xyz"),         // extensions
                            wxNullPtr           // end of extensions
                         );
    ftInfo.SetShortDesc(wxT("XYZFile")); // used under Win32 only

    wxFileType *ft = wxTheMimeTypesManager->Associate(ftInfo);
    if ( !ft )
    {
        wxPuts(wxT("ERROR: failed to create association!"));
    }
    else
    {
        // TODO: read it back
        delete ft;
    }

    wxPuts(wxEmptyString);
#endif // TEST_MIME
}
コード例 #3
0
ファイル: output.cpp プロジェクト: euler0/Helium
void InteractiveOutputTestCase::TestStandardPaths()
{
#ifdef TEST_STDPATHS
    wxPuts(wxT("*** Testing wxStandardPaths ***"));

    wxTheApp->SetAppName(wxT("console"));

    wxStandardPathsBase& stdp = wxStandardPaths::Get();
    wxPrintf(wxT("Config dir (sys):\t%s\n"), stdp.GetConfigDir().c_str());
    wxPrintf(wxT("Config dir (user):\t%s\n"), stdp.GetUserConfigDir().c_str());
    wxPrintf(wxT("Data dir (sys):\t\t%s\n"), stdp.GetDataDir().c_str());
    wxPrintf(wxT("Data dir (sys local):\t%s\n"), stdp.GetLocalDataDir().c_str());
    wxPrintf(wxT("Data dir (user):\t%s\n"), stdp.GetUserDataDir().c_str());
    wxPrintf(wxT("Data dir (user local):\t%s\n"), stdp.GetUserLocalDataDir().c_str());
    wxPrintf(wxT("Documents dir:\t\t%s\n"), stdp.GetDocumentsDir().c_str());
    wxPrintf(wxT("Executable path:\t%s\n"), stdp.GetExecutablePath().c_str());
    wxPrintf(wxT("Plugins dir:\t\t%s\n"), stdp.GetPluginsDir().c_str());
    wxPrintf(wxT("Resources dir:\t\t%s\n"), stdp.GetResourcesDir().c_str());
    wxPrintf(wxT("Localized res. dir:\t%s\n"),
             stdp.GetLocalizedResourcesDir(wxT("fr")).c_str());
    wxPrintf(wxT("Message catalogs dir:\t%s\n"),
             stdp.GetLocalizedResourcesDir
                  (
                    wxT("fr"),
                    wxStandardPaths::ResourceCat_Messages
                  ).c_str());

    wxPuts("\n");
#endif // TEST_STDPATHS
}
コード例 #4
0
ファイル: input.cpp プロジェクト: ruifig/nutcracker
void InteractiveInputTestCase::TestRegExInteractive()
{
#ifdef TEST_REGEX 
    wxPuts(wxT("*** Testing RE interactively ***"));

    for ( ;; )
    {
        wxChar pattern[128];
        wxPrintf(wxT("Enter a pattern (press ENTER or type 'quit' to escape): "));
        if ( !wxFgets(pattern, WXSIZEOF(pattern), stdin) )
            break;

        // kill the last '\n'
        pattern[wxStrlen(pattern) - 1] = 0;

        if (pattern[0] == '\0' || wxStrcmp(pattern, "quit") == 0)
            break;
            
        wxRegEx re;
        if ( !re.Compile(pattern) )
        {
            continue;
        }

        wxChar text[128];
        for ( ;; )
        {
            wxPrintf(wxT("Enter text to match: "));
            if ( !wxFgets(text, WXSIZEOF(text), stdin) )
                break;

            // kill the last '\n'
            text[wxStrlen(text) - 1] = 0;

            if ( !re.Matches(text) )
            {
                wxPrintf(wxT("No match.\n"));
            }
            else
            {
                wxPrintf(wxT("Pattern matches at '%s'\n"), re.GetMatch(text).c_str());

                size_t start, len;
                for ( size_t n = 1; ; n++ )
                {
                    if ( !re.GetMatch(&start, &len, n) )
                    {
                        break;
                    }

                    wxPrintf(wxT("Subexpr %u matched '%s'\n"),
                             n, wxString(text + start, len).c_str());
                }
            }
        }
        
        wxPuts("\n");
    }
#endif // TEST_REGEX
}
コード例 #5
0
ファイル: output.cpp プロジェクト: euler0/Helium
void InteractiveOutputTestCase::TestDllListLoaded()
{
#ifdef TEST_DYNLIB
    wxPuts(wxT("*** testing wxDynamicLibrary::ListLoaded() ***\n"));

    wxPuts("Loaded modules:");
    wxDynamicLibraryDetailsArray dlls = wxDynamicLibrary::ListLoaded();
    const size_t count = dlls.GetCount();
    for ( size_t n = 0; n < count; ++n )
    {
        const wxDynamicLibraryDetails& details = dlls[n];
        printf("%-45s", (const char *)details.GetPath().mb_str());

        void *addr wxDUMMY_INITIALIZE(NULL);
        size_t len wxDUMMY_INITIALIZE(0);
        if ( details.GetAddress(&addr, &len) )
        {
            printf(" %08lx:%08lx",
                   (unsigned long)addr, (unsigned long)((char *)addr + len));
        }

        printf(" %s\n", (const char *)details.GetVersion().mb_str());
    }

    wxPuts(wxEmptyString);
#endif // TEST_DYNLIB
}
コード例 #6
0
ファイル: language.cpp プロジェクト: sermelo/kiku
bool Language::gunzip(wxString file_target, wxString file_source)
{
	#ifdef DEBUG
		wxPuts("Start GUNZIP");
	#endif
	
	char buffer[1024];
	wxTempFile target(file_target);
	bool write = false;
	wxFileInputStream source(file_source);
	wxZlibInputStream inputStream(source);

	while (!inputStream.Eof()) {
			inputStream.Read(buffer, sizeof(buffer));
			if (inputStream.LastRead()) {
					target.Write(buffer, inputStream.LastRead());
			} else {
					break;
			}
	};
	write = inputStream.IsOk() || inputStream.Eof();

	if (write) {
			target.Commit();
	}
	#ifdef DEBUG
		wxPuts("Done GUNZIP");
	#endif
	
	return 1;
}
コード例 #7
0
int main(int argc, char **argv)
{
    wxString str = "The history of my life";

    wxPuts(str.MakeLower());
    wxPuts(str.MakeUpper());
}
コード例 #8
0
ファイル: postgres.cpp プロジェクト: iwbnwif/wxDatabase
int wxDatabaseApp::OnRun()
{ 
    try
    { 
        //Create table 
        wxString createSqlTB = "CREATE TABLE Names (ID INT PRIMARY KEY NOT NULL, Name VARCHAR(50) NOT NULL);";
		wxString strServer = "127.0.0.1";
		wxString strDatabase = "test"; 
		wxString strUser = "******"; 
		wxString  strPassword = "******"; 
        wxDatabase *pDatabase = new wxPostgresDatabase(strServer, strDatabase, strUser, strPassword); 
        pDatabase->RunQuery(createSqlTB);
        
        //insert into table
        wxString sqlStefano = "INSERT INTO Names VALUES(1, 'Stefano Mtangoo');";
        wxString sqlAndrew = "INSERT INTO Names VALUES(2, 'Andrew aka Many Leaves');";
        wxString sqlUpendo = "INSERT INTO Names VALUES(3, 'Upendo Stefano');";
        
        pDatabase->RunQuery(sqlStefano);
        pDatabase->RunQuery(sqlAndrew);
        pDatabase->RunQuery(sqlUpendo);
        
        //Prepared statement
        wxPreparedStatement* pStatement = pDatabase->PrepareStatement("INSERT INTO Names (ID, Name) VALUES(?, ?);");
        if (pStatement)
        {
            pStatement->SetParamInt(1, 4);
            pStatement->SetParamString(2, "Polyasi Dickson");
            pStatement->RunQuery();
            pDatabase->CloseStatement(pStatement);
        }
        
        //Select from table
        wxDatabaseResultSet *pResults = pDatabase->RunQueryWithResults("SELECT * FROM Names;");
        if (pResults)
        {
            while (pResults->Next())
            {
                wxString id = pResults->GetResultString("ID");
                wxString name = pResults->GetResultString("Name");
                wxString info = wxString::Format("ID: %s \nName: %s\n===============", id.mb_str(), name.mb_str());
                wxPuts(info);
            }
            pDatabase->CloseResultSet(pResults);
        }
        
    }
    catch (wxDatabaseException& e)
    {
      wxString error = wxString::Format("Error (%d): %s", e.GetErrorCode(), e.GetErrorMessage().c_str());
      wxPuts(error);
      
      return e.GetErrorCode();
    }
    
   return 0;
}
コード例 #9
0
ファイル: language.cpp プロジェクト: sermelo/kiku
bool Language::download(wxString server, wxString tgz)
{
	#ifdef DEBUG
		wxPuts("Start LanguageDownload");
	#endif

	// not in thread because: http://groups.google.com/group/wx-users/browse_thread/thread/a2ac8b947b657f78
	wxHTTP get;
	get.SetHeader(_T("Content-type"), _T("text/html; charset=utf-8"));
	get.SetTimeout(10); 
	
	int tried = 0;
	while (!get.Connect(server)) {
		if(tried > 2) {
			return 0;
		}
		wxSleep(2);
		tried++;
	}
	
	wxInputStream *httpStream = get.GetInputStream(tgz);
	
	if (get.GetError() == wxPROTO_NOERR)
	{
		// standard path
		wxStandardPaths stdpath;
		stdpath = wxStandardPaths::Get();
		wxFileOutputStream outStream(stdpath.GetTempDir()+"/model.tar.gz");
		int ts = httpStream->GetSize();
		const int DLBUFSIZE = 4096;
		unsigned char buffer[DLBUFSIZE+1];
		do {
			static int bs = 0;
			httpStream->Read(buffer, DLBUFSIZE);
			size_t bytes_read = httpStream->LastRead();
			if (bytes_read > 0) {
				buffer[bytes_read] = 0;
				outStream.Write(buffer, bytes_read);
			}
			bs += bytes_read;
			mf_pHandler->OnLanguageProgess(bs, ts);
		} while ( !httpStream->Eof() );
		
		outStream.Close();
		
	} else {
		return 0;
	}
	#ifdef DEBUG
		wxPuts("Done LanguageDownload");
	#endif
	wxDELETE(httpStream);
	get.Close();
	
	return 1;
}
コード例 #10
0
int main(int argc,char **argv)
{
	wxPuts(wxGetHomeDir());
	wxPuts(wxGetOsDescription());
	wxPuts(wxGetUserName());
	wxPuts(wxGetFullHostName());

	long mem = wxGetFreeMemory().ToLong();
	wxPrintf(wxT("Memory: %d\n"),mem);
	return 0;
}
コード例 #11
0
ファイル: t04.cpp プロジェクト: osom8979/example
int t04()
{
    wxPuts(wxGetHomeDir());
    wxPuts(wxGetOsDescription());
    wxPuts(wxGetUserName());
    wxPuts(wxGetFullHostName());

    wxMemorySize mem = wxGetFreeMemory();

    wxPrintf(wxT("Memory: %s\n"), mem.ToString());
    return EXIT_SUCCESS;
}
コード例 #12
0
ファイル: output.cpp プロジェクト: euler0/Helium
void InteractiveOutputTestCase::TestUserInfo()
{
#ifdef TEST_INFO_FUNCTIONS
    wxPuts(wxT("*** Testing user info functions ***\n"));

    wxPrintf(wxT("User id is:\t%s\n"), wxGetUserId().c_str());
    wxPrintf(wxT("User name is:\t%s\n"), wxGetUserName().c_str());
    wxPrintf(wxT("Home dir is:\t%s\n"), wxGetHomeDir().c_str());
    wxPrintf(wxT("Email address:\t%s\n"), wxGetEmailAddress().c_str());

    wxPuts(wxEmptyString);
#endif // TEST_INFO_FUNCTIONS
}
コード例 #13
0
ファイル: wxrc.cpp プロジェクト: futurepr0n/wxWidgets
bool XmlResApp::Validate()
{
    if ( flagVerbose )
        wxPuts("validating XRC files...");

    wxString schemaURI;

    if ( !parSchemaFile.empty() )
    {
        schemaURI = parSchemaFile;
    }
    else
    {
        schemaURI = "http://www.wxwidgets.org/wxxrc";

        // Normally, we'd use an OASIS XML catalog to map the URI to a local copy,
        // but Jing's catalog support (-C catalogFile) requires additional
        // dependency, resolver.jar, that is not commonly installed alongside Jing
        // by systems that package Jing. So do the (trivial) mapping manually here:
        wxString wxWinRoot;
        if ( wxGetEnv("WXWIN", &wxWinRoot) )
        {
            wxString schemaFile(wxWinRoot + "/misc/schema/xrc_schema.rnc");
            if ( wxFileExists(schemaFile) )
                schemaURI = schemaFile;
        }
    }

    wxString cmdline = wxString::Format("jing -c \"%s\"", schemaURI);
    for ( size_t i = 0; i < parFiles.GetCount(); i++ )
        cmdline << wxString::Format(" \"%s\"", parFiles[i]);

    int res = wxExecute(cmdline, wxEXEC_BLOCK);
    if (res == -1)
    {
        wxLogError("Running RELAX NG validator failed.");
        wxLogError("Please install Jing (http://www.thaiopensource.com/relaxng/jing.html).");
        wxLogError("See http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk/misc/schema/README for more information.");
        return false;
    }

    if ( flagVerbose )
    {
        if ( res == 0 )
            wxPuts("XRC validation passed without errors.");
        else
            wxPuts("XRC validation failed, there are errors.");
    }

    return res == 0;
}
コード例 #14
0
ファイル: output.cpp プロジェクト: euler0/Helium
void InteractiveOutputTestCase::TestStackWalk()
{
#ifdef TEST_STACKWALKER
#if wxUSE_STACKWALKER
    wxPuts(wxT("*** Testing wxStackWalker ***"));

    wxString progname(wxTheApp->argv[0]);
    StackDump dump(progname.utf8_str());
    dump.Walk();

    wxPuts("\n");
#endif
#endif // TEST_STACKWALKER
}
コード例 #15
0
ファイル: Constraint.cpp プロジェクト: DavidNicholls/heekscad
void Constraint::AuditHeeksObjTree4Constraints(HeeksObj * SketchPtr ,HeeksObj * mom,int level,bool ShowMsgInConsole,bool * ConstraintsAreOk)
{
    wxString message=wxT("");
    message.Pad(level*3,' ',true);
    message +=wxString::Format(wxT("%s ID=%d \n  ") ,GetTypeString(),m_id);
    message.Pad(level*3,' ',true);

    wxString wxstr_m_type(ConstraintTypes[m_type].c_str(), wxConvUTF8);
    message += wxstr_m_type;
    message += wxT(" consists of:\n");
    message.Pad(level*3+3,' ',true);
    if (!m_obj1 ==0)
    {
        message += wxString::Format(wxT("%s id=%d(%s) -"),m_obj1->GetTypeString(),m_obj1->m_id,((m_obj1==mom)?wxT("KNOWN"):wxT("UNKNOWN")));
    }
    else
    {
        message += wxString (wxT("!!!!! m_obj1 Should Always be specified!!!!! \n"));
        *ConstraintsAreOk=false;
    }

    if (m_obj2 ==0)
    {

        if (ReturnStdObjectCtForConstraint(m_type)==2)
            {    // We have a problem where
                message += wxString (wxT("!!!!! m_obj2 not specified in two object constraint!!!!! \n"));
                *ConstraintsAreOk=false;
            }
    }
    else
    {
        message += wxString::Format(wxT("  %s id=%d(%s)\n"),m_obj2->GetTypeString(),m_obj2->m_id,((m_obj2==mom)?wxT("KNOWN"):wxT("UNKNOWN")));
        message.Pad(level*3+3,' ',true);
    }
    if (ShowMsgInConsole)
    {
        wxPuts(message);
    }
    if (*ConstraintsAreOk==true)
    {
        message = wxT("Searching:");
        *ConstraintsAreOk =ValidateConstraint2Objects(SketchPtr,mom,this,level, ShowMsgInConsole);
        if (ShowMsgInConsole)
        {
            wxPuts(message);
        }
    }
}
コード例 #16
0
void NmeaConverter_pi::ShowPreferencesDialog( wxWindow* parent )
{
    LoadConfig();
    if ( prefDlg == NULL )
    {        
        prefDlg = new PreferenceDlg(this, parent);
    }
    
    if ( prefDlg->ShowModal() == wxID_OK )
    {
        SaveConfig();        
    }
    //DialogWindows are deleted after closing?? So we do it here and set pointers to NULL
    try
    {
        prefDlg->Destroy();
        prefDlg = NULL;
 //       p_nmeaSendObjectDlg->Destroy();
    }
    catch(...)
    { wxPuts(_("Dlg already deleted:_)"));}
    
    prefDlg = NULL;
//    p_nmeaSendObjectDlg=NULL;    
}
コード例 #17
0
ファイル: ObjList.cpp プロジェクト: DavidNicholls/heekscad
void ObjList::FindConstrainedObj(HeeksObj * CurrentObject,HeeksObj * ObjectToFind,int * occurrences,int FromLevel,int Level,bool ShowMsgInConsole)
{
    //if we hit this it's the end of the line
    wxString searchmessage;


    //Moving the next two line inside the if,but it will reduce the output to view on big projectes
       searchmessage.Pad((FromLevel+1)*3+9+Level,' ');
    searchmessage += wxString::Format(wxT("%s  ID=%d  ") ,GetTypeString(),m_id);//I

    if (this == ObjectToFind)
    {
       //Originally had the next two lines outside the if,but it generated too much output to view on big projectes
       (*occurrences)++;
        searchmessage += wxT(" $$$ MATCH $$$");

    }
        if (ShowMsgInConsole)wxPuts(searchmessage);

    if (GetNumChildren() > 0)
    {
        std::list<HeeksObj*>::iterator It;
        for(It=m_objects.begin(); It!=m_objects.end() ;It++)
        {
            (*It)->FindConstrainedObj((*It),ObjectToFind, occurrences,FromLevel,Level+1,ShowMsgInConsole);
        }

    }


}
コード例 #18
0
ファイル: ObjList.cpp プロジェクト: DavidNicholls/heekscad
//JT
void ObjList::AuditHeeksObjTree4Constraints(HeeksObj * SketchPtr ,HeeksObj * mom, int level,bool ShowMsgInConsole,bool *ConstraintsAreOk  )
{
    wxString message=wxT("");
    message.Pad(level*3,' ',true);
    message+=wxString::Format(wxT("%s ID=%d  ") ,GetTypeString(),m_id);

    if (GetNumChildren() > 0)message+=wxString::Format(wxT("  (Kids:%d)") ,GetNumChildren());
        if (ShowMsgInConsole)wxPuts(message);

//At this point need to get some info about mom whether or not shee has kids
//What's you lastman

//How about your first name_id
//Where to you really reside in memory


    if (GetNumChildren() > 0)
    {
        std::list<HeeksObj*>::iterator It;
        for(It=m_objects.begin(); It!=m_objects.end() ;It++)
        {
            if(((*It)==NULL)||((*It)==0))
            wxMessageBox(wxT("this is a problem 201011260146"));
            (*It)->AuditHeeksObjTree4Constraints(SketchPtr ,this,level+1,ShowMsgInConsole,ConstraintsAreOk);
        }

    }
}
コード例 #19
0
ファイル: output.cpp プロジェクト: euler0/Helium
void InteractiveOutputTestCase::TestMimeFilename()
{
#ifdef TEST_MIME
    wxPuts(wxT("*** Testing MIME type from filename query ***\n"));

    static const wxChar *filenames[] =
    {
        wxT("readme.txt"),
        wxT("document.pdf"),
        wxT("image.gif"),
        wxT("picture.jpeg"),
    };

    for ( size_t n = 0; n < WXSIZEOF(filenames); n++ )
    {
        const wxString fname = filenames[n];
        wxString ext = fname.AfterLast(wxT('.'));
        wxFileType *ft = wxTheMimeTypesManager->GetFileTypeFromExtension(ext);
        if ( !ft )
        {
            wxPrintf(wxT("WARNING: extension '%s' is unknown.\n"), ext.c_str());
        }
        else
        {
            wxString desc;
            if ( !ft->GetDescription(&desc) )
                desc = wxT("<no description>");

            wxString cmd;
            if ( !ft->GetOpenCommand(&cmd,
                                     wxFileType::MessageParameters(fname, wxEmptyString)) )
                cmd = wxT("<no command available>");
            else
                cmd = wxString(wxT('"')) + cmd + wxT('"');

            wxPrintf(wxT("To open %s (%s) run:\n   %s\n"),
                     fname.c_str(), desc.c_str(), cmd.c_str());

            delete ft;
        }
    }

    wxPuts(wxEmptyString);
#endif // TEST_MIME
}
コード例 #20
0
ファイル: output.cpp プロジェクト: euler0/Helium
void InteractiveOutputTestCase::TestMimeEnum()
{
#ifdef TEST_MIME
    wxPuts(wxT("*** Testing wxMimeTypesManager::EnumAllFileTypes() ***\n"));

    wxArrayString mimetypes;

    size_t count = wxTheMimeTypesManager->EnumAllFileTypes(mimetypes);

    wxPrintf(wxT("*** All %u known filetypes: ***\n"), count);

    wxArrayString exts;
    wxString desc;

    for ( size_t n = 0; n < count; n++ )
    {
        wxFileType *filetype =
            wxTheMimeTypesManager->GetFileTypeFromMimeType(mimetypes[n]);
        if ( !filetype )
        {
            wxPrintf(wxT("   nothing known about the filetype '%s'!\n"),
                   mimetypes[n].c_str());
            continue;
        }

        filetype->GetDescription(&desc);
        filetype->GetExtensions(exts);

        filetype->GetIcon(NULL);

        wxString extsAll;
        for ( size_t e = 0; e < exts.GetCount(); e++ )
        {
            if ( e > 0 )
                extsAll << wxT(", ");
            extsAll += exts[e];
        }

        wxPrintf(wxT("   %s: %s (%s)\n"),
               mimetypes[n].c_str(), desc.c_str(), extsAll.c_str());
    }

    wxPuts(wxEmptyString);
#endif // TEST_MIME
}
コード例 #21
0
ファイル: output.cpp プロジェクト: euler0/Helium
void InteractiveOutputTestCase::TestOsInfo()
{
#ifdef TEST_INFO_FUNCTIONS
    wxPuts(wxT("*** Testing OS info functions ***\n"));

    int major, minor;
    wxGetOsVersion(&major, &minor);
    wxPrintf(wxT("Running under: %s, version %d.%d\n"),
            wxGetOsDescription().c_str(), major, minor);

    wxPrintf(wxT("%ld free bytes of memory left.\n"), wxGetFreeMemory().ToLong());

    wxPrintf(wxT("Host name is %s (%s).\n"),
           wxGetHostName().c_str(), wxGetFullHostName().c_str());

    wxPuts(wxEmptyString);
#endif // TEST_INFO_FUNCTIONS
}
コード例 #22
0
ファイル: Constraint.cpp プロジェクト: DavidNicholls/heekscad
bool Constraint::ValidateConstraint2Objects(HeeksObj * Sketch,HeeksObj * ConstrainedObject,HeeksObj * Constraint,int FromLevel,bool ShowMsgInConsole)
{

    bool TestsareOK =true; // assume all is well unless we run into a problem

    int StdNumberOfObjectsInConstraint = ReturnStdObjectCtForConstraint(m_type);
    wxString message = wxString::Format(wxT(" Objs:(%i)"),StdNumberOfObjectsInConstraint); //Need to determine if the constraint is one or two objects
    message +=_("");
    if (StdNumberOfObjectsInConstraint==1)
    {
        //this is a single object constraint which means
        if((m_obj1 ==ConstrainedObject)&&(m_obj2 ==NULL))
        {
            //at some point may want to check the object type against the contraint type to see if it makes sense
            //we wouldn't want a point called out with a horizontal constraint as an example
        }
        else
        {
            message += _("Object error in a single object constraint");
            TestsareOK =false;
        }
    }
    else if (StdNumberOfObjectsInConstraint==2)
    {
        if((m_obj1 ==ConstrainedObject)&&(m_obj2 !=NULL))
        {
            TestsareOK =Validate2ndObjectInConstraint(Sketch,m_obj2,this,FromLevel, ShowMsgInConsole);

        }

        else if ((m_obj1 !=NULL)&&(m_obj2 ==ConstrainedObject))
        {
            TestsareOK =Validate2ndObjectInConstraint(Sketch,m_obj1,this,FromLevel, ShowMsgInConsole);
        }
        else
        {
            message += _("Object error in a two object constraint");
            TestsareOK =false;
        }

    }
    else if (StdNumberOfObjectsInConstraint==0)
    {
        message += _("Undefined Constraint?");
        TestsareOK =false;
    }
    else
    {


    }
    if (!TestsareOK)
        if (ShowMsgInConsole)wxPuts(message);//just need to here about a problem if there is one

    return TestsareOK ;

}
コード例 #23
0
ファイル: output.cpp プロジェクト: euler0/Helium
void InteractiveOutputTestCase::TestPlatformInfo()
{
#ifdef TEST_INFO_FUNCTIONS
    wxPuts(wxT("*** Testing wxPlatformInfo functions ***\n"));

    // get this platform
    wxPlatformInfo plat;

    wxPrintf(wxT("Operating system family name is: %s\n"), plat.GetOperatingSystemFamilyName().c_str());
    wxPrintf(wxT("Operating system name is: %s\n"), plat.GetOperatingSystemIdName().c_str());
    wxPrintf(wxT("Port ID name is: %s\n"), plat.GetPortIdName().c_str());
    wxPrintf(wxT("Port ID short name is: %s\n"), plat.GetPortIdShortName().c_str());
    wxPrintf(wxT("Architecture is: %s\n"), plat.GetArchName().c_str());
    wxPrintf(wxT("Endianness is: %s\n"), plat.GetEndiannessName().c_str());

    wxPuts(wxEmptyString);
#endif // TEST_INFO_FUNCTIONS
}
コード例 #24
0
ファイル: main.cpp プロジェクト: RVictor/EmbeddedLite
int main( int argc, char** argv )
{
    // initialize wxWidgets
    wxInitializer init;

    wxPrintf( wxT("Hello in wxWidgets World!\n\n") );

    // print some system info...
    wxPuts(wxGetHomeDir());
    wxPuts(wxGetOsDescription());
    wxPuts(wxGetUserName());
    wxPuts(wxGetFullHostName());

    long mem = wxGetFreeMemory().ToLong();
    wxPrintf(wxT("Memory: %ld\n"), mem);

    return 0;
}
コード例 #25
0
ファイル: input.cpp プロジェクト: ruifig/nutcracker
void InteractiveInputTestCase::TestDateTimeInteractive()
{
#ifdef TEST_DATETIME
    wxPuts(wxT("\n*** interactive wxDateTime tests ***"));

    wxChar buf[128];

    for ( ;; )
    {
        wxPrintf(wxT("Enter a date (press ENTER or type 'quit' to escape): "));
        if ( !wxFgets(buf, WXSIZEOF(buf), stdin) )
            break;

        // kill the last '\n'
        buf[wxStrlen(buf) - 1] = 0;
        
        if ( buf[0] == '\0' || wxStrcmp(buf, "quit") == 0 )
            break;

        wxDateTime dt;
        const wxChar *p = dt.ParseDate(buf);
        if ( !p )
        {
            wxPrintf(wxT("ERROR: failed to parse the date '%s'.\n"), buf);

            continue;
        }
        else if ( *p )
        {
            wxPrintf(wxT("WARNING: parsed only first %u characters.\n"), p - buf);
        }

        wxPrintf(wxT("%s: day %u, week of month %u/%u, week of year %u\n"),
                 dt.Format(wxT("%b %d, %Y")).c_str(),
                 dt.GetDayOfYear(),
                 dt.GetWeekOfMonth(wxDateTime::Monday_First),
                 dt.GetWeekOfMonth(wxDateTime::Sunday_First),
                 dt.GetWeekOfYear(wxDateTime::Monday_First));
    }
    
    wxPuts("\n");
#endif // TEST_DATETIME
}
コード例 #26
0
ファイル: HeeksObj.cpp プロジェクト: DavidNicholls/heekscad
//JT
void HeeksObj::AuditHeeksObjTree4Constraints( HeeksObj * SketchPtr ,HeeksObj * mom, int level,bool ShowMsgInConsole,bool * constraintError)
{

    //If this routine is firing it probably means that either this has nothing to do with constraints or
    //a virtual function was not implemented in a function.
    //Most of the information needed can be fulled from ConstrainedObject::AuditHeeksObjTree4Constraints

    wxString message=wxString::Format(wxT("Level:%d  %s ID=%d (From HeekObj::AuditHeeksObjTree4Constraints") ,level,GetTypeString(),m_id);
    if (ShowMsgInConsole)wxPuts(message);

}
コード例 #27
0
ファイル: mainwindow.cpp プロジェクト: benreh/pdfbeamer
void Mainwindow::OnOpen(wxCommandEvent& WXUNUSED(event)) {
	wxFileDialog * openFileDialog = new wxFileDialog(this, wxT("Select presentation"), wxT(""), wxT(""), wxT("PDF files |*.pdf;*.PDF"));
	
	if (openFileDialog->ShowModal() == wxID_OK){
		wxString filename = openFileDialog->GetPath();
		wxPuts(filename);
		pdf.load(filename.mb_str());
 	}
 	show(1);
	update();
	
}
コード例 #28
0
ファイル: output.cpp プロジェクト: euler0/Helium
void InteractiveOutputTestCase::TestFSVolume()
{
#ifdef TEST_VOLUME
    wxPuts(wxT("*** Testing wxFSVolume class ***"));

    wxArrayString volumes = wxFSVolume::GetVolumes();
    size_t count = volumes.GetCount();

    if ( !count )
    {
        wxPuts(wxT("ERROR: no mounted volumes?"));
        return;
    }

    wxPrintf(wxT("%u mounted volumes found:\n"), count);

    for ( size_t n = 0; n < count; n++ )
    {
        wxFSVolume vol(volumes[n]);
        if ( !vol.IsOk() )
        {
            wxPuts(wxT("ERROR: couldn't create volume"));
            continue;
        }

        wxPrintf(wxT("%u: %s (%s), %s, %s, %s\n"),
                 n + 1,
                 vol.GetDisplayName().c_str(),
                 vol.GetName().c_str(),
                 volumeKinds[vol.GetKind()],
                 vol.IsWritable() ? wxT("rw") : wxT("ro"),
                 vol.GetFlags() & wxFS_VOL_REMOVABLE ? wxT("removable")
                                                     : wxT("fixed"));
    }

    wxPuts("\n");
#endif // TEST_VOLUME
}
コード例 #29
0
ファイル: input.cpp プロジェクト: ruifig/nutcracker
void InteractiveInputTestCase::TestDiskInfo()
{
#ifdef TEST_INFO_FUNCTIONS
    wxPuts(wxT("*** Testing wxGetDiskSpace() ***"));

    for ( ;; )
    {
        wxChar pathname[128];
        wxPrintf(wxT("Enter a directory name (press ENTER or type 'quit' to escape): "));
        if ( !wxFgets(pathname, WXSIZEOF(pathname), stdin) )
            break;

        // kill the last '\n'
        pathname[wxStrlen(pathname) - 1] = 0;
        
        if (pathname[0] == '\0' || wxStrcmp(pathname, "quit") == 0)
            break;

        wxLongLong total, free;
        if ( !wxGetDiskSpace(pathname, &total, &free) )
        {
            wxPuts(wxT("ERROR: wxGetDiskSpace failed."));
        }
        else
        {
            wxPrintf(wxT("%sKb total, %sKb free on '%s'.\n"),
                    (total / 1024).ToString().c_str(),
                    (free / 1024).ToString().c_str(),
                    pathname);
        }
        
        wxPuts("\n");
    }

    wxPuts("\n");
#endif // TEST_INFO_FUNCTIONS
}
コード例 #30
0
int main(int argc,char **argv)
{
    wxDir dir(wxGetCwd());
    wxString file;

    bool cont = dir.GetFirst(&file,wxEmptyString,wxDIR_FILES | wxDIR_DIRS);

    while(cont) {
        wxPuts(file);
        cont = dir.GetNext(&file);
    }


    return 0;
}