void CLexiconReadWindow::setupMainWindowToolBars() {
    // Navigation toolbar
    CKeyChooser* keyChooser = CKeyChooser::createInstance(modules(), history(), key(), btMainWindow()->navToolBar() );
    btMainWindow()->navToolBar()->addWidget(keyChooser);
    bool ok = connect(keyChooser, SIGNAL(keyChanged(CSwordKey*)), this, SLOT(lookupSwordKey(CSwordKey*)));
    Q_ASSERT(ok);
    ok = connect(this, SIGNAL(sigKeyChanged(CSwordKey*)), keyChooser, SLOT(updateKey(CSwordKey*)) );
    Q_ASSERT(ok);
    btMainWindow()->navToolBar()->addAction(m_actions.backInHistory); //1st button
    btMainWindow()->navToolBar()->addAction(m_actions.forwardInHistory); //2nd button

    // Works toolbar
    btMainWindow()->worksToolBar()->setModules(getModuleList(), modules().first()->type(), this);

    // Tools toolbar
    QAction* action = actionCollection()->action(
                          CResMgr::displaywindows::general::search::actionName);
    Q_ASSERT( action );
    if (action) {
        btMainWindow()->toolsToolBar()->addAction(action);
    }
    BtDisplaySettingsButton* button = new BtDisplaySettingsButton(buttonsToolBar());
    setDisplaySettingsButton(button);
    btMainWindow()->toolsToolBar()->addWidget(button);
}
void CLexiconReadWindow::initView() {
    qDebug() << "CLexiconReadWindow::initView";

    // Create display widget for this window
    setDisplayWidget( CDisplay::createReadInstance(this) );
    setCentralWidget( displayWidget()->view() );
    setWindowIcon(util::tool::getIconForModule(modules().first()));

    // Create the Navigation toolbar
    setMainToolBar( new QToolBar(this) );
    addToolBar(mainToolBar());

    // Create keychooser
    setKeyChooser( CKeyChooser::createInstance(modules(), history(), key(), mainToolBar()) );

    // Create the Works toolbar
    setModuleChooserBar( new BtModuleChooserBar(this));
    moduleChooserBar()->setModules(getModuleList(), modules().first()->type(), this);
    addToolBar(moduleChooserBar());

    // Create the Tools toolbar
    setButtonsToolBar( new QToolBar(this) );
    addToolBar(buttonsToolBar());

    // Create the Text Header toolbar
    addToolBarBreak();
    setHeaderBar(new QToolBar(this));
    addToolBar(headerBar());
}
/** Starts the search with the set modules and the set search text. */
void CSearchDialog::startSearch() {
    QString originalSearchText(m_searchOptionsArea->searchText());
    QString searchText("");

    // first check the search string for errors
    {
        QString TestString(originalSearchText);
        QRegExp ReservedWords("heading:|footnote:|morph:|strong:");
        if (TestString.replace(ReservedWords, "").simplified().isEmpty()) {
            return;
        }
    }

    searchText = prepareSearchText(originalSearchText);

    // Insert search text into history list of combobox
    m_searchOptionsArea->addToHistory(originalSearchText);

    // check that we have the indices we need for searching
    if (!m_searcher.modulesHaveIndices( modules() ) )	{
        int result = util::showQuestion(this, tr("Missing indices"),
                                        tr("One or more works need indexing before they can be searched.\n"
                                           "This could take a long time. Proceed with indexing?"),
                                        QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
        // In SuSE 10.0 the result is the logical or of the button type, just like it is
        // inputed into the QMessageBox.
        if ( (result == (QMessageBox::Yes | QMessageBox::Default)) ||
                (result == QMessageBox::Yes) || (result == QMessageBox::Default) ) {
            CModuleIndexDialog* dlg = CModuleIndexDialog::getInstance();
            dlg->indexUnindexedModules( modules() );
        }
        else {
            return;
        }
    }

    if (m_searchOptionsArea->hasSearchScope()) {
        m_searcher.setSearchScope( m_searchOptionsArea->searchScope() );
    }
    else {
        m_searcher.resetSearchScope();
    }

    m_searcher.setModules( modules() );
    m_searcher.setSearchedText(searchText);


    //Just to be sure that it can't be clicked again, if the search happens to be a bit slow.
    m_searchOptionsArea->searchButton()->setEnabled(false);
    m_searchOptionsArea->m_searchTextCombo->setEnabled(false);

    m_searcher.startSearch();

    m_searchOptionsArea->searchButton()->setEnabled(true);
    m_searchOptionsArea->m_searchTextCombo->setEnabled(true);
    m_searchOptionsArea->m_searchTextCombo->setFocus();
}
Esempio n. 4
0
void SmilSystem::setRootElement(SmilElement *r)
{
    root = r;
    root->setRect(m_targetWidget->rect());
    QMap<QString, SmilModule *>::ConstIterator it;
    for (it = modules().begin(); it != modules().end(); ++it)
        (*it)->process();
    root->process();
}
Esempio n. 5
0
const WsModule* WsModulesLoader::module(const std::string& moduleName)
{
  for (int iModule = 0; iModule < modules().size(); ++iModule) {
    WsModule* curModule = modules()[iModule]->module;
    if ( curModule->moduleName() != moduleName ) continue;
    return curModule;
  }
  return 0;
}
Esempio n. 6
0
std::string WsModulesLoader::checkPath(const std::string& path)
{
  std::string sRes(path);
  for (int iModule = 0; iModule < modules().size(); ++iModule) {
    WsModule* curModule = modules()[iModule]->module;
    sRes = curModule->checkPath(path);
    if ( sRes != path ) break;
  }
  return sRes;
}
Esempio n. 7
0
void CDisplayWindow::modulesChanged() {
    // this would only set the stringlist again
    //if (moduleChooserBar()) { //necessary for write windows
    //setModules( m_moduleChooserBar->getModuleList() );
    //}
    if (modules().isEmpty()) {
        close();
    }
    else {
        emit sigModulesChanged(modules());
        key()->setModule(modules().first());
        keyChooser()->setModules(modules());
    }
}
Esempio n. 8
0
void
Chain::get_output_ports ( std::list<std::string> &sl)
{
    for ( int i = 0; i < modules(); i++ )
    {
        Module *m = module(i);
        
        for ( unsigned int j = 0; j < m->aux_audio_output.size(); j++ )
        {
            char *s;

            asprintf( &s, "%s/%s", 
                      "*", 
                      m->aux_audio_output[j].jack_port()->name() );

            sl.push_back( s );

            free(s);

            if ( ! strip()->group()->single() )
            {
                asprintf( &s, "%s/%s", 
                          strip()->group()->name(), 
                          m->aux_audio_output[j].jack_port()->name() );

                
                sl.push_back( s );
                
                free(s);
            }
        }
    }
}
Esempio n. 9
0
void DebuggerIPCServer::handleBacktrace(PFPSimDebugger::BacktraceMsg msg) {
  int id;
  if (msg.has_packet_id()) {
    try {
      id = stoi(msg.packet_id());
    } catch (const std::exception& ex) {
      std::cout << ex.what() << std::endl;
      sendRequestFailed();
    }
  } else {
    id = data_manager->whoami();
  }
  DebuggerPacket *pk = data_manager->getPacket(id);
  if (pk != NULL) {
    std::vector<DebuggerPacket::PacketLocation> trace = pk->getTrace();
    const int size = trace.size();
    std::vector<std::string> modules(size);
    std::vector<double> read_times(size);
    std::vector<double> write_times(size);
    for (int i = 0; i < size; i++) {
      modules[i] = trace[i].module;
      read_times[i] = trace[i].read_time;
      write_times[i] = trace[i].write_time;
    }
    BacktraceReplyMessage *message = new BacktraceReplyMessage(id,
          modules.data(), read_times.data(), write_times.data(), size);
    send(message);
    delete message;
  } else {
    sendRequestFailed();
  }
}
void CLexiconReadWindow::initView()
{
	qDebug("CLexiconReadWindow::initView");
	setDisplayWidget( CDisplay::createReadInstance(this) );
	setMainToolBar( new QToolBar(this) );
	addToolBar(mainToolBar());
	setKeyChooser( CKeyChooser::createInstance(modules(), key(), mainToolBar()) );
	mainToolBar()->addWidget(keyChooser());
	setModuleChooserBar( new CModuleChooserBar(modules(), modules().first()->type(), this) );
	moduleChooserBar()->adjustSize();
	addToolBar(moduleChooserBar());
	setButtonsToolBar( new QToolBar(this) );
	addToolBar(buttonsToolBar());
	setWindowIcon(CToolClass::getIconForModule(modules().first()));
	setCentralWidget( displayWidget()->view() );
}
void
CBCI2000Controller::startup_modules( ArgList& ioArgs )
{
  std::vector<com::DualString> modules_ = ioArgs.GetStringArray( 1 );
  std::vector<std::string> modules( modules_.begin(), modules_.end() );
  CALL( StartupModules( modules ) );
}
Esempio n. 12
0
void CPlainWriteWindow::beforeKeyChange() {
    Q_ASSERT(displayWidget());
    Q_ASSERT(keyChooser());
    if (!isReady())
        return;

    // Get current key string for this window
    QString thisWindowsKey;
    CSwordKey* oldKey = key();
    if (oldKey == 0)
        return;
    thisWindowsKey = oldKey->key();

    //If the text changed and we'd do a lookup ask the user if the text should be saved
    if (modules().first() && m_writeDisplay->isModified()) {

        switch (message::showQuestion( this, tr("Save Text?"), tr("Save changed text?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) ) {
            case QMessageBox::Yes: { //save the changes
                saveCurrentText( thisWindowsKey );
                break;
            }
            default: {// set modified to false so it won't ask again
                m_writeDisplay->setModified(false);
                break;
            }
        }
    }
}
Esempio n. 13
0
void VersionInfoInterface::logBuildInfo() const {
    log() << "git version: " << gitVersion();

#if defined(MONGO_CONFIG_SSL) && MONGO_CONFIG_SSL_PROVIDER == MONGO_CONFIG_SSL_PROVIDER_OPENSSL
    log() << openSSLVersion("OpenSSL version: ");
#endif

    log() << "allocator: " << allocator();

    std::stringstream ss;
    ss << "modules: ";
    auto modules_list = modules();
    if (modules_list.size() == 0) {
        ss << "none";
    } else {
        for (const auto& m : modules_list) {
            ss << m << " ";
        }
    }
    log() << ss.str();

    log() << "build environment:";
    for (auto&& envDataEntry : buildInfo()) {
        if (std::get<3>(envDataEntry)) {
            auto val = std::get<1>(envDataEntry);
            if (val.size() == 0)
                continue;
            log() << "    " << std::get<0>(envDataEntry) << ": " << std::get<1>(envDataEntry);
        }
    }
}
Esempio n. 14
0
/*************************************************
* Library Initialization                         *
*************************************************/
void LibraryInitializer::initialize(const std::string& arg_string)
   {
   InitializerOptions args(arg_string);
   Builtin_Modules modules(args);

   initialize(args, modules);
   }
Esempio n. 15
0
/** Saves the chapter as valid HTML page. */
void CBibleReadWindow::saveChapterHTML() {
    //saves the complete chapter to disk
    Q_ASSERT(dynamic_cast<const CSwordBibleModuleInfo*>(modules().first()) != 0);
    const CSwordBibleModuleInfo *bible = static_cast<const CSwordBibleModuleInfo*>(modules().first());

    CSwordVerseKey dummy(*verseKey());
    dummy.setVerse(1);

    CSwordVerseKey vk(*verseKey());
    vk.setLowerBound(dummy);

    dummy.setVerse(bible->verseCount(dummy.book(), dummy.getChapter()));
    vk.setUpperBound(dummy);

    CExportManager mgr(true, tr("Saving"), filterOptions(), displayOptions());
    mgr.saveKey(&vk, CExportManager::HTML, true);
}
Esempio n. 16
0
void
Chain::auto_disconnect_outputs ( void )
{
    for ( int i = 0; i < modules(); i++ )
    {
        module(i)->auto_disconnect_outputs();
    }
}
Esempio n. 17
0
static bool findFlatout2Module( char*& out_begin, std::ptrdiff_t& out_size )
{
  Logger& logger = Logger::getSingleton();

  HANDLE curProcess = GetCurrentProcess();

  DWORD numModules;
  if( !EnumProcessModules( curProcess, nullptr, 0, &numModules ) )
  {
    logger.error( "Failed to retrieve module count! (", GetLastError(), ")" );
    return false;
  }
  numModules /= sizeof( HMODULE );

  std::vector< HMODULE > modules( numModules );
  if( !EnumProcessModules( curProcess, modules.data(), sizeof( modules[ 0 ] ) * modules.size(), &numModules ) )
  {
    logger.error( "Failed to retrieve module list! (", GetLastError(), ")" );
    return false;
  }
  numModules /= sizeof( HMODULE );

  if( numModules < modules.size() )
  {
    modules.resize( numModules );
  }

  for( HMODULE module : modules )
  {
    std::string name;
    {
      std::vector< char > nameBuf( 1024 );
      if( !GetModuleBaseNameA( curProcess, module, nameBuf.data(), nameBuf.size() ) )
      {
        logger.warning( "Failed to retrieve name of module ", module, "! (", GetLastError(), ")" );
        continue;
      }
      name = nameBuf.data();
    }
    std::transform( name.begin(), name.end(), name.begin(), std::tolower );
    if( name != "flatout2.exe" )
    {
      continue;
    }
    MODULEINFO info;
    if( !GetModuleInformation( curProcess, module, &info, sizeof( info ) ) )
    {
      logger.error( "Failed to retrieve information on module ", name, "! (", GetLastError(), ")" );
      return false;
    }
    out_begin = reinterpret_cast< char* >( info.lpBaseOfDll );
    out_size = info.SizeOfImage;
    logger.verbose( "Found FlatOut2.exe module of size 0x", std::hex, out_size, " at 0x", reinterpret_cast< void* >( out_begin ), std::dec );
    return true;
  }
  logger.error( "Failed to find module FlatOut2.exe!" );
  return false;
}
Esempio n. 18
0
void
Chain::thaw_ports ( void )
{
    for ( int i = 0; i < modules(); i++ )
    {
        Module *m = module(i);
        m->thaw_ports();
    }
}
Esempio n. 19
0
void
Chain::freeze_ports ( void )
{
    for ( int i = 0; i < modules(); i++ )
    {
        Module *m = module(i);
        m->freeze_ports();
    }
}
Esempio n. 20
0
    static void update(ContentAccessor* cache, const macho_header<P>* header, V& visitor)
    {
        ArraySection<P, objc_module<P> >
            modules(cache, header, "__OBJC", "__module_info");
        for (uint64_t m = 0; m < modules.count(); m++) {
            objc_symtab<P> *symtab = modules.get(m).getSymtab(cache);
            if (!symtab) continue;

            // Method lists in classes
            for (int c = 0; c < symtab->getClassCount(); c++) {
                objc_class<P> *cls = symtab->getClass(cache, c);
                objc_class<P> *isa = cls->getIsa(cache);
                objc_method_list<P> *mlist;
                if ((mlist = cls->getMethodList(cache))) {
                    visitMethodList(mlist, visitor);
                }
                if ((mlist = isa->getMethodList(cache))) {
                    visitMethodList(mlist, visitor);
                }
            }
            
            // Method lists from categories
            for (int c = 0; c < symtab->getCategoryCount(); c++) {
                objc_category<P> *cat = symtab->getCategory(cache, c);
                objc_method_list<P> *mlist;
                if ((mlist = cat->getInstanceMethods(cache))) {
                    visitMethodList(mlist, visitor);
                }
                if ((mlist = cat->getClassMethods(cache))) {
                    visitMethodList(mlist, visitor);
                }
            }
        }

        // Method description lists from protocols        
        ArraySection<P, objc_protocol<P>>
            protocols(cache, header, "__OBJC", "__protocol");
        for (uint64_t p = 0; p < protocols.count(); p++) {
            objc_protocol<P>& protocol = protocols.get(p);
            objc_method_description_list<P> *mlist;
            if ((mlist = protocol.getInstanceMethodDescriptions(cache))) {
                visitMethodDescriptionList(mlist, visitor);
            }
            if ((mlist = protocol.getClassMethodDescriptions(cache))) {
                visitMethodDescriptionList(mlist, visitor);
            }
        }

        // Message refs
        PointerSection<P, const char *> selrefs(cache, header, "__OBJC", "__message_refs");
        for (pint_t s = 0; s < selrefs.count(); s++) {
            pint_t oldValue = selrefs.getVMAddress(s);
            pint_t newValue = visitor.visit(oldValue);
            selrefs.setVMAddress(s, newValue);
        }
    }
void CLexiconReadWindow::initView() {
    qDebug() << "CLexiconReadWindow::initView";
    setDisplayWidget( CDisplay::createReadInstance(this) );
    setMainToolBar( new QToolBar(this) );
    mainToolBar()->setAllowedAreas(Qt::TopToolBarArea);
    mainToolBar()->setFloatable(false);
    addToolBar(mainToolBar());
    setKeyChooser( CKeyChooser::createInstance(modules(), key(), mainToolBar()) );
    mainToolBar()->addWidget(keyChooser());
    setModuleChooserBar( new CModuleChooserBar(modules(), modules().first()->type(), this) );
    moduleChooserBar()->adjustSize();
    addToolBar(moduleChooserBar());
    setButtonsToolBar( new QToolBar(this) );
    buttonsToolBar()->setAllowedAreas(Qt::TopToolBarArea);
    buttonsToolBar()->setFloatable(false);
    addToolBar(buttonsToolBar());
    setWindowIcon(util::tool::getIconForModule(modules().first()));
    setCentralWidget( displayWidget()->view() );
}
Esempio n. 22
0
void
Chain::draw ( void )
{
    Fl_Group::draw();

/*     if ( 0 == strcmp( "Chain", tabs->value()->label() ) ) */
    if ( chain_tab->visible() )
        for ( int i = 0; i < modules(); ++i )
            draw_connections( module( i ) );
}
void CSearchDialog::searchFinished() {
    if ( m_searcher.foundItems() ) {
        m_searchResultArea->setSearchResult(modules());
    }
    else {
        m_searchResultArea->reset();
    }
    m_staticDialog->raise();
    m_staticDialog->activateWindow();
}
Esempio n. 24
0
/** invoked from the JACK latency callback... We need to update the latency values on this chains ports */
void
Chain::set_latency ( JACK::Port::direction_e dir )
{
    nframes_t tmax = 0;
    nframes_t tmin = 0;
    nframes_t added_min = 0;
    nframes_t added_max = 0;

    for ( int i = 0; i < modules(); i++ )
    {
        Module *m;

        if ( dir == JACK::Port::Input )
            m = module( i );
        else
            m = module( (modules() - 1) - i );
        
        nframes_t min,max;
        min = max = 0;
        
        nframes_t a = m->get_module_latency();
        
        added_min += a;
        added_max += a;
        
        if ( dir == JACK::Port::Input ? m->aux_audio_input.size() : m->aux_audio_output.size() )
        {
            m->get_latency( dir, &min, &max );
            
            tmin = 0;
            added_min = 0;
        }
        
        if ( min > tmin )
            tmin = min;
        if ( max > tmax )
            tmax = max;
        
        m->set_latency( dir, tmin + added_min, tmax + added_max );
        
    }
}
Esempio n. 25
0
int 
Chain::get_module_instance_number ( Module *m )
{
    int n = 0;

    for ( int i = 0; i < modules() && module(i) != m; ++i )
        if ( ! strcmp( module(i)->label(), m->label() ) )
            n++;

    return n;
} 
Esempio n. 26
0
std::pair<double, double> Tracker::computeMinMaxEta() const {
  double min = std::numeric_limits<double>::max(), max = 0;
  for (auto m : modules()) {
    min = MIN(min, m->minEta());
    max = MAX(max, m->maxEta());
  } 

  //return std::make_pair(-1*log(tan(min/2.)), -1*log(tan(max/2.)));
  //return std::make_pair(min, max);
  return std::make_pair(-4.0,4.0); // CUIDADO to make it equal to the extended pixel - make it better ASAP!!
}
Esempio n. 27
0
void
Chain::update_connection_status ( void )
{
    for ( int i = 0; i < modules(); i++ )
    {
        Module *m = module(i);
        
        if ( !strcmp( m->basename(), "JACK" ) )
        {
            ((JACK_Module*)m)->update_connection_status();
        }
    }
}
Esempio n. 28
0
std::string WsModulesLoader::removePrefix(const std::string& path)
{
  // TODO : en attendant de mettre ces éléménts en Modules
  std::string sRes(path);
  std::string searchPath = WsLayoutProperties::instance()->get("global", "search_path", "/Search");
  //  LOG(DEBUG)<<"WsModulesLoader::removePrefix() path = " << path;
  if ( path.compare(0,  searchPath.size(), searchPath ) == 0            ) return "";                                      // Search
  if ( path.compare(0,  5, "/Logo"                    ) == 0            ) return sRes.assign(path,  5, path.size() -  5);
  if ( path.compare(0,  8, "/SiteMap"                 ) == 0            ) return sRes.assign(path,  8, path.size() -  8);
  if ( path.compare(0,  5, "/Edit"                    ) == 0            ) return sRes.assign(path,  5, path.size() -  5);
  if ( path.compare(0, 11, "/FileUpload"              ) == 0            ) return sRes.assign(path, 11, path.size() - 11);
  if ( path.compare(0, 10, "/FolderNew"               ) == 0            ) return sRes.assign(path, 10, path.size() - 10);
  if ( path.compare(0, 13, "/FolderDelete"            ) == 0            ) return sRes.assign(path, 13, path.size() - 13);
  if ( path.compare(0, 11, "/FolderEdit"              ) == 0            ) return sRes.assign(path, 11, path.size() - 11);
  for (int iModule = 0; iModule < modules().size(); ++iModule) {
    WsModule* curModule = modules()[iModule]->module;
    if ( curModule->prefix().size() < 1 ) continue;
    if ( path.compare(0, curModule->prefix().size(), curModule->prefix() ) == 0)
      return curModule->pathWithoutPrefix(path);
  }
  return path;
}
Esempio n. 29
0
int
Chain::sample_rate_change ( nframes_t nframes )
{
    Module::set_sample_rate ( nframes );
    for ( int i = 0; i < modules(); ++i )
    {
        Module *m = module(i);

        m->handle_sample_rate_change( nframes );
    }

    return 0;
}
Esempio n. 30
0
/* called by a module when it wants to alter the number of its
 * outputs. Also used to test for chain validity when inserting /
 * removing modules */
bool
Chain::can_configure_outputs ( Module *m, int n ) const
{
    /* start at the requesting module */

    int outs = n;

    int i = modules_pack->find( m );

    if ( modules() - 1 == i )
        /* last module */
        return true;

    for ( i++ ; i < modules(); ++i )
    {
        outs = module( i )->can_support_inputs( outs );

        if ( outs < 0 )
            return false;
    }

    return true;
}