示例#1
0
// ============================================================================
// GLOctree::update()                                                          
// update tree according store_options conditions                              
void GLOctree::update()
{
  //if (!first) return;
  setActivate(store_options->octree_display);
  // restore default object particles index
  for (int obj=0; obj< (int ) psv->size(); obj++ ) { 
    if ((*psv)[obj].vps->is_visible) {
      (*psv)[obj].vps->defaultIndexTab();
    }
  }
  if ( psv && ! store_options->octree_enable) {
    setActivate(false); // do not display tree
  } else {
    buildDisplayList();
  }
}
示例#2
0
// ============================================================================
// Constructor                                                                 
GLOctree::GLOctree(GlobalOptions * _options):GLObject()
{
  // copy global options
  store_options = _options;
  root=NULL;
  psv=NULL;
  dplist_index = glGenLists( 1 );    // get a new display list index
  setColor(green);
  setActivate(store_options->octree_display);
  init();
  first=false;
}
示例#3
0
GopathBrowser::GopathBrowser(LiteApi::IApplication *app, QObject *parent) :
    QObject(parent),
    m_liteApp(app)
{
    m_widget = new QWidget;

    m_toolBar = new QToolBar;
    m_toolBar->setIconSize(QSize(16,16));

    m_syncEditor = new QAction(QIcon(":/images/synceditor.png"),tr("Sync Editor"),this);
    m_syncEditor->setCheckable(true);
    m_syncProject = new QAction(QIcon(":/images/syncproject.png"),tr("Sync Project"),this);
    m_syncProject->setCheckable(true);

    m_startPathLabel = new QLabel;

    m_toolBar->addAction(m_syncEditor);
    m_toolBar->addAction(m_syncProject);
    m_toolBar->addSeparator();
    m_toolBar->addWidget(m_startPathLabel);

    m_pathTree = new QTreeView;
    m_pathTree->setHeaderHidden(true);
    m_model = new GopathModel(this);
    m_pathTree->setContextMenuPolicy(Qt::CustomContextMenu);
    m_pathTree->setModel(m_model);

    QVBoxLayout *layout = new QVBoxLayout;
    layout->setMargin(0);
    layout->addWidget(m_toolBar);
    layout->addWidget(m_pathTree);
    m_widget->setLayout(layout);

    m_pathList = m_liteApp->settings()->value("golangtool/gopath").toStringList();

    //connect(m_pathTree->selectionModel(),SIGNAL(currentChanged(QModelIndex,QModelIndex)),this,SLOT(pathIndexChanged(QModelIndex)));
    connect(m_pathTree,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(openPathIndex(QModelIndex)));
    LiteApi::IEnvManager* envManager = LiteApi::findExtensionObject<LiteApi::IEnvManager*>(m_liteApp,"LiteApi.IEnvManager");
    connect(envManager,SIGNAL(currentEnvChanged(LiteApi::IEnv*)),this,SLOT(reloadEnv()));
    connect(m_liteApp->editorManager(),SIGNAL(currentEditorChanged(LiteApi::IEditor*)),this,SLOT(currentEditorChanged(LiteApi::IEditor*)));

    m_fileMenu = new QMenu(m_widget);
    m_folderMenu = new QMenu(m_widget);

    m_setStartAct = new QAction(tr("Set Activate Project"),this);
    m_openEditorAct = new QAction(tr("Open Editor"),this);
    m_newFileAct = new QAction(tr("New File"),this);
    m_newFileWizardAct = new QAction(tr("New File Wizard"),this);
    m_renameFileAct = new QAction(tr("Rename File"),this);
    m_removeFileAct = new QAction(tr("Remove File"),this);

    m_newFolderAct = new QAction(tr("New Folder"),this);
    m_renameFolderAct = new QAction(tr("Rename Folder"),this);
    m_removeFolderAct = new QAction(tr("Remove Folder"),this);

    m_openShellAct = new QAction(tr("Open Terminal Here"),this);
    m_openExplorerAct = new QAction(tr("Open Explorer Here"),this);

    m_fileMenu->addAction(m_openEditorAct);
    m_fileMenu->addSeparator();
    m_fileMenu->addAction(m_newFileAct);
    m_fileMenu->addAction(m_newFileWizardAct);
    m_fileMenu->addAction(m_renameFileAct);
    m_fileMenu->addAction(m_removeFileAct);
    m_fileMenu->addSeparator();
    m_fileMenu->addAction(m_openShellAct);
    m_fileMenu->addAction(m_openExplorerAct);

    m_folderMenu->addAction(m_setStartAct);
    m_folderMenu->addSeparator();
    m_folderMenu->addAction(m_newFileAct);
    m_folderMenu->addAction(m_newFileWizardAct);
    m_folderMenu->addAction(m_newFolderAct);
    m_folderMenu->addAction(m_renameFolderAct);
    m_folderMenu->addAction(m_removeFolderAct);
    m_folderMenu->addSeparator();
    m_folderMenu->addAction(m_openShellAct);
    m_folderMenu->addAction(m_openExplorerAct);

    connect(m_startPathLabel,SIGNAL(linkActivated(QString)),this,SLOT(expandStartPath(QString)));
    connect(m_syncEditor,SIGNAL(triggered(bool)),this,SLOT(syncEditor(bool)));
    connect(m_syncProject,SIGNAL(triggered(bool)),this,SLOT(syncProject(bool)));
    connect(m_setStartAct,SIGNAL(triggered()),this,SLOT(setActivate()));
    connect(m_openEditorAct,SIGNAL(triggered()),this,SLOT(openEditor()));
    connect(m_newFileAct,SIGNAL(triggered()),this,SLOT(newFile()));
    connect(m_newFileWizardAct,SIGNAL(triggered()),this,SLOT(newFileWizard()));
    connect(m_renameFileAct,SIGNAL(triggered()),this,SLOT(renameFile()));
    connect(m_removeFileAct,SIGNAL(triggered()),this,SLOT(removeFile()));
    connect(m_newFolderAct,SIGNAL(triggered()),this,SLOT(newFolder()));
    connect(m_renameFolderAct,SIGNAL(triggered()),this,SLOT(renameFolder()));
    connect(m_removeFolderAct,SIGNAL(triggered()),this,SLOT(removeFolder()));
    connect(m_openShellAct,SIGNAL(triggered()),this,SLOT(openShell()));
    connect(m_openExplorerAct,SIGNAL(triggered()),this,SLOT(openExplorer()));

    connect(m_pathTree,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(treeViewContextMenuRequested(QPoint)));

    bool b = m_liteApp->settings()->value("GolangTool/synceditor",true).toBool();
    if (b) {
        m_syncEditor->toggle();
    }
    b = m_liteApp->settings()->value("GolangTool/syncproject",false).toBool();
    if (b) {
        m_syncProject->toggle();
    }
    m_startPathLabel->setText("null project");
}