Exemplo n.º 1
0
Arquivo: main.cpp Projeto: krpors/navi
NaviMainFrame::NaviMainFrame() :
        wxFrame((wxFrame*) NULL, wxID_ANY, wxT("Navi")),
        m_noteBook(NULL),
        m_taskBarIcon(NULL) {
    // create our menu here 
    initMenu();

    // navigation up top (play pause buttons)
    wxPanel* panelMain = new wxPanel(this);
    wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
    panelMain->SetSizer(sizer);

    m_navigation = new NavigationContainer(panelMain, this);

    // bottom part:
    wxPanel* p = createBottom(panelMain);

    // Add the components to the sizer. Add a border of 5 px so the widgets aren't
    // 'attached' to the edges of the wxFrame itself (looks neater).
    // add navigation to the sizer
    sizer->Add(m_navigation, wxSizerFlags().Expand().Border(wxALL, 5));
    // add the bottom pieces to the sizer. Note that we user a proportion of 1 here to max
    // it out all the way to the bottom.
    sizer->Add(p, wxSizerFlags(1).Expand().Border(wxALL, 5));
    
    CreateStatusBar();

    // create the track status handler event handling stuff. This thing
    // is created on the heap, without a parent wxWindow. this pointer is
    // given still though, but by destroying this frame, the trackstatushandler
    // instance will not be destroyed automatically. Not that it matters,
    // since after we destroyed this frame, the program should end anyway.
    m_trackStatusHandler = new TrackStatusHandler(this);
    // Push that event handler, otherwise events will not be propagated to
    // this new track status handler.
    PushEventHandler(m_trackStatusHandler);

    // create a systray icon.
    bool trayEnabled;
    wxConfigBase::Get()->Read(Preferences::MINIMIZE_TO_TRAY, &trayEnabled, false);
    if (trayEnabled) {
        m_taskBarIcon = new SystrayIcon(this);
        wxBitmap bm(wxT("./data/icons/navi.png"), wxBITMAP_TYPE_PNG);
        wxIcon icon;
        icon.CopyFromBitmap(bm);
        m_taskBarIcon->SetIcon(icon, wxT("Navi - Hey, listen!"));
    }
}
Exemplo n.º 2
0
/// create negation of given formula
DLTree* createSNFNot ( DLTree* C )
{
    fpp_assert ( C != NULL );	// sanity check
    if ( C->Element() == BOTTOM )
    {   // \not F = T
        deleteTree(C);
        return createTop();
    }
    if ( C->Element() == TOP )
    {   // \not T = F
        deleteTree(C);
        return createBottom();
    }
    if ( C->Element () == NOT )
    {   // \not\not C = C
        DLTree* p = clone(C->Left());
        deleteTree(C);
        return p;
    }

    // general case
    return new DLTree ( TLexeme(NOT), C );
}
Exemplo n.º 3
0
void TBox :: buildDAG ( void )
{
	nNominalReferences = 0;

	// init concept indexing
	nC = 1;	// start with 1 to make index 0 an indicator of "not processed"
	ConceptMap.push_back(NULL);

	// make fresh concept and datatype
	concept2dag(pTemp);
	DLTree* freshDT = DTCenter.getFreshDataType();
	addDataExprToHeap ( static_cast<TDataEntry*>(freshDT->Element().getNE()) );
	deleteTree(freshDT);

	for ( c_const_iterator pc = c_begin(); pc != c_end(); ++pc )
		concept2dag(*pc);
	for ( i_const_iterator pi = i_begin(); pi != i_end(); ++pi )
		concept2dag(*pi);

	// init heads of simple rules
	for ( TSimpleRules::iterator q = SimpleRules.begin(), q_end = SimpleRules.end(); q < q_end; ++q )
		(*q)->bpHead = tree2dag((*q)->tHead);

	// builds Roles range and domain
	initRangeDomain(ORM);
	initRangeDomain(DRM);

	// build all splits
	for ( TSplitVars::iterator s = getSplits()->begin(), s_end = getSplits()->end(); s != s_end; ++s )
		split2dag(*s);

	RoleMaster::iterator p, p_end;

	// build all GCIs
	DLTree* GCI = Axioms.getGCI();

	// add special domains to the GCIs
	if ( likely(useSpecialDomains) )
		for ( p = ORM.begin(), p_end = ORM.end(); p < p_end; ++p )
			if ( !(*p)->isSynonym() && (*p)->hasSpecialDomain() )
				GCI = createSNFAnd ( GCI, clone((*p)->getTSpecialDomain()) );

	// take chains that lead to Bot role into account
	if ( !ORM.getBotRole()->isSimple() )
		GCI = createSNFAnd ( GCI,
				new DLTree ( TLexeme(FORALL), createRole(ORM.getBotRole()), createBottom() ) );

	T_G = tree2dag(GCI);
	deleteTree(GCI);

	// mark GCI flags
	GCIs.setGCI(T_G != bpTOP);
	GCIs.setReflexive(ORM.hasReflexiveRoles());

	// builds functional labels for roles
	for ( p = ORM.begin(), p_end = ORM.end(); p < p_end; ++p )
		if ( !(*p)->isSynonym() && (*p)->isTopFunc() )
			(*p)->setFunctional ( atmost2dag ( 1, *p, bpTOP ) );
	for ( p = DRM.begin(), p_end = DRM.end(); p < p_end; ++p )
		if ( !(*p)->isSynonym() && (*p)->isTopFunc() )
			(*p)->setFunctional ( atmost2dag ( 1, *p, bpTOP ) );

	// check the type of the ontology
	if ( nNominalReferences > 0 )
	{
		unsigned int nInd = i_end() - i_begin();
		if ( nInd > 100 && nNominalReferences > nInd )
			isLikeWINE = true;
	}

	// here DAG is complete; set its final size
	DLHeap.setFinalSize();
}