Example #1
0
void Window::keyboardUpFunc(unsigned char key, int, int) {
    Window& win = currentWindow();
    Key k = asciiToKey(key);

    win.mKeys.erase(k);
    win.keyReleased(k);
}
Example #2
0
void Window::keyboardFunc(unsigned char key, int, int) {
    Window& win = currentWindow();
    Key k = asciiToKey(key);

    win.mKeys.insert(k);
    win.keyPressed(k);
}
QDesignerPropertySheetExtension *QMdiAreaPropertySheet::currentWindowSheet() const
{
    QWidget *cw = currentWindow();
    if (cw == 0)
        return 0;
    return qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), cw);
}
QVariant QMdiAreaPropertySheet::property(int index) const
{
    switch (mdiAreaProperty(propertyName(index))) {
    case MdiAreaSubWindowName:
        if (QWidget *w = currentWindow())
            return w->objectName();
        return QVariant(QString());
    case MdiAreaSubWindowTitle:
        if (QWidget *w = currentWindow())
            return w->windowTitle();
        return QVariant(QString());
    case MdiAreaNone:
        break;
    }
    return QDesignerPropertySheet::property(index);
}
Example #5
0
void OSXStyle::closeWindow()
{
    QWidget *w=currentWindow();
    if (w) {
        w->close();
    }
}
Example #6
0
void OSXStyle::minimizeWindow()
{
    QWidget *w=currentWindow();
    if (w) {
        w->showMinimized();
    }
}
Example #7
0
void Window::passiveMotionFunc(int x, int y) {
    Window& win = currentWindow();
    win.mPreviousMousePos = win.mMousePos;
    win.mMousePos.setX(x);
    win.mMousePos.setY(y);
    win.mMouseMoved = true;
    win.mouseMoved({x, y});
}
Example #8
0
void Mac::OSXStyle::zoomWindow() {
    QWidget *w=currentWindow();
    if (w) {
        if (w->isMaximized()) {
            w->showNormal();
        } else {
            w->showMaximized();
        }
    }
}
bool QMdiAreaPropertySheet::isEnabled(int index) const
{
    switch (mdiAreaProperty(propertyName(index))) {
    case MdiAreaSubWindowName:
    case MdiAreaSubWindowTitle:
        return currentWindow() != 0;
    case MdiAreaNone:
        break;
    }
    return QDesignerPropertySheet::isEnabled(index);
}
Example #10
0
void Window::mouseFunc(int button, int state, int, int) {
    Window& win = currentWindow();
    MouseButton but = glut2MouseButton(button);

    if (state == GLUT_DOWN) {
        win.mMouseButtons.insert(but);
        win.mousePressed(but);
    } else if (state == GLUT_UP) {
        win.mMouseButtons.erase(but);
        win.mouseReleased(but);
    }
}
Example #11
0
void Window::displayFunc() {
    Window& win = currentWindow();

    if (win.mMouseMoved)
        win.mMouseForce = win.mMousePos - win.mPreviousMousePos;
    else
        win.mMouseForce = Vector2i(0, 0);
    win.mMouseMoved = false;



    win.frame();
    glutSwapBuffers();
    glutPostRedisplay();
}
Example #12
0
void LTaskButton::triggerWindow(){
  LWinInfo win = currentWindow();
  //Check which state the window is currently in and flip it to the other
  LX11::WINDOWSTATE state = LX11::GetWindowState(win.windowID());
  if(state == LX11::ACTIVE){
    qDebug() << "Minimize Window:" << this->text();
    LX11::IconifyWindow(win.windowID());
  }else if(state == LX11::VISIBLE){
    qDebug() << "Activate Window:" << this->text();
    LX11::ActivateWindow(win.windowID());
  }else{
    qDebug() << "Restore Window:" << this->text();
    LX11::RestoreWindow(win.windowID());
  }
  cWin = LWinInfo(); //clear the current
}
void QMdiAreaPropertySheet::setProperty(int index, const QVariant &value)
{
    switch (mdiAreaProperty(propertyName(index))) {
    case MdiAreaSubWindowName:
        if (QWidget *w = currentWindow())
            w->setObjectName(value.toString());
        break;
    case MdiAreaSubWindowTitle:        // Forward to window title of subwindow
        if (QDesignerPropertySheetExtension *cws = currentWindowSheet()) {
            const int index = cws->indexOf(m_windowTitleProperty);
            cws->setProperty(index, value);
            cws->setChanged(index, true);
        }
        break;
    default:
        QDesignerPropertySheet::setProperty(index, value);
        break;
    }
}
bool QMdiAreaPropertySheet::isChanged(int index) const
{
    bool rc = false;
    switch (mdiAreaProperty(propertyName(index))) {
    case MdiAreaSubWindowName:
        rc = currentWindow() != 0;
        break;
    case MdiAreaSubWindowTitle:
        if (QDesignerPropertySheetExtension *cws = currentWindowSheet()) {
            const int index = cws->indexOf(m_windowTitleProperty);
            rc = cws->isChanged(index);
        }
        break;
    default:
        rc = QDesignerPropertySheet::isChanged(index);
        break;
    }
    return rc;
}
Example #15
0
static int append_cluster_connections(std::vector<MEI_event>& insertion_events, ControlState& current_state,
                                      UserDefinedSettings* userSettings) {
    
    // Setup maps for base read names of mates we need to collect.  Also setup 'exclude_names' holding
    // the original read names (we don't want those, only their mates, which fall inside the event).
    std::map<std::string, size_t> fwd_name_links, rev_name_links, exclude_names;
    std::string tmp_basename;
    for (size_t i = 0; i < insertion_events.size(); i++) {
        MEI_event event = insertion_events.at(i);
        for (size_t j = 0; j < event.fwd_cluster_bp.associated_reads.size(); j++) {
            tmp_basename = base_read_name(event.fwd_cluster_bp.associated_reads.at(j).name);
            fwd_name_links.insert(std::make_pair(tmp_basename, i));
            exclude_names.insert(std::make_pair(event.fwd_cluster_bp.associated_reads.at(j).name, i));
        }
        for (size_t j = 0; j < event.rev_cluster_bp.associated_reads.size(); j++) {
            tmp_basename = base_read_name(event.rev_cluster_bp.associated_reads.at(j).name);
            rev_name_links.insert(std::make_pair(tmp_basename, i));
            exclude_names.insert(std::make_pair(event.rev_cluster_bp.associated_reads.at(j).name, i));
        }
    }
    
    
    // Loop over whole genome to find mates of discordant reads near DD breakpoints.
    g_genome.reset();
    MEI_data mei_data;
    int result;
    
    // Make dummy BED-records spanning the whole genome.
    std::vector<BED> dummy_beds;
    for (unsigned index = 0; index < g_ChrNameAndSizeAndIndex.size(); index++) {
        BED OneBedRecord;
        OneBedRecord.ChrName = g_ChrNameAndSizeAndIndex[index].ChrName;
        OneBedRecord.Start = 1;
        OneBedRecord.End = g_ChrNameAndSizeAndIndex[index].ChrSize;
        dummy_beds.push_back(OneBedRecord);
    }
    
    // Loop over BED-regions.
	for (unsigned bed_index = 0; bed_index < dummy_beds.size(); bed_index++) {
		std::string Bed_ChrName = dummy_beds[bed_index].ChrName;
		unsigned Bed_start = dummy_beds[bed_index].Start;
		unsigned Bed_end = dummy_beds[bed_index].End;
        
		const Chromosome* currentChromosome = g_genome.getChr(Bed_ChrName);
        
		if (currentChromosome == NULL) {
			return 1;
		}
        
		LOG_INFO(*logStream << time_log() << "Discordant read collection for current window: " << Bed_ChrName <<
                 ", " << Bed_start << "--" << Bed_end << std::endl);
        
		CurrentChrMask.resize(currentChromosome->getCompSize());
		for (unsigned int i = 0; i < currentChromosome->getCompSize(); i++) {
            CurrentChrMask[i] = 'N';
		}
        
		userSettings->getRegion()->SetRegion(Bed_ChrName, Bed_start, Bed_end);
		LoopingSearchWindow currentWindow( userSettings->getRegion(), currentChromosome, WINDOW_SIZE, Bed_start, Bed_end );
        
        // loop over one bed region
        do {
            result = load_discordant_reads(mei_data, current_state.bams_to_parse, currentChromosome->getName(),
                                           currentWindow, userSettings);
            if (result) {
                // something went wrong loading the reads, return error code.
                return result;
            }
            
            std::map<std::string, size_t>::iterator name_match;
            size_t disc_read_count = mei_data.discordant_reads.size();
            for (size_t i = 0; i < disc_read_count; i++) {
                // Determine event and strand for which mate is evidence.
                tmp_basename = base_read_name(mei_data.discordant_reads.at(i)->name);
                int event_idx = -1;
                char strand = Plus;
                name_match = fwd_name_links.find(tmp_basename);
                if (name_match != fwd_name_links.end()) {
                    // Current read referenced by a DD event near bp on fwd strand.
                    event_idx = (*name_match).second;
                } else {
                    name_match = rev_name_links.find(tmp_basename);
                    if (name_match != rev_name_links.end()) {
                        // Current read referenced by a DD event near bp on rev strand.
                        event_idx = (*name_match).second;
                        strand = Minus;
                    }
                }
                
                if (event_idx == -1) {
                    // No match found, this read is not related to an event.
                    continue;
                }
                
                if (exclude_names.find(mei_data.discordant_reads.at(i)->name) != exclude_names.end()) {
                    // read name in exlude list, this is one of the reads we used for calling
                    // the breakpoint, skip it!
                    continue;
                }
                
                if (strand == Plus) {
                    insertion_events.at(event_idx).fwd_mapping_reads.push_back(*(mei_data.discordant_reads.at(i)));
                } else {
                    insertion_events.at(event_idx).rev_mapping_reads.push_back(*(mei_data.discordant_reads.at(i)));
                }
            }
            
            cleanup_reads(mei_data.discordant_reads);
			
            currentWindow.next();
        } while (!currentWindow.finished());
	}
    
    return 0;
}
Example #16
0
void StackedWindow::popWindow() {
    if (StackedWindow *w = currentWindow()) {
        w->close();
    }
}
Example #17
0
void Window::closeFunc() {
    currentWindow().mClosed = true;
}
Example #18
0
void LTaskButton::closeWindow(){
  if(winMenu->isVisible()){ winMenu->hide(); }
  LWinInfo win = currentWindow();
  LX11::CloseWindow(win.windowID());
  cWin = LWinInfo(); //clear the current
}
Example #19
0
// This function is based on Pindel's main function.  Todo: integrate with pindel's main structure.
int searchMEImain(ControlState& current_state, Genome& genome, UserDefinedSettings* userSettings) {
    
    // Reset genome before traversal.
    g_genome.reset();
    
    std::ofstream file_output(userSettings->getMEIOutputFilename().c_str());
    MEI_data mei_data;
    int result;
    
    std::string CurrentChrName;
	std::string PreviousChrName = "";
    
    // Loop over BED-regions defined in control state.
	for (unsigned bed_index = 0; bed_index < current_state.IncludeBed.size(); bed_index++) {
		std::string Bed_ChrName = current_state.IncludeBed[bed_index].ChrName;
		unsigned Bed_start = current_state.IncludeBed[bed_index].Start;
		unsigned Bed_end = current_state.IncludeBed[bed_index].End;
        
		const Chromosome* currentChromosome = g_genome.getChr(Bed_ChrName);
        
		if (currentChromosome == NULL) {
			std::cout << "There is no " << CurrentChrName << " in the reference file." << std::endl;
			return 1;
		}
        
		LOG_INFO(*logStream << time_log() << "Dispersed Duplication detection current window: " << Bed_ChrName <<
                 ", " << Bed_start << "--" << Bed_end << std::endl);
        
		CurrentChrMask.resize(currentChromosome->getCompSize());
		for (unsigned int i = 0; i < currentChromosome->getCompSize(); i++) {
            CurrentChrMask[i] = 'N';
		}
        
		userSettings->getRegion()->SetRegion(Bed_ChrName, Bed_start, Bed_end);
		LoopingSearchWindow currentWindow( userSettings->getRegion(), currentChromosome, WINDOW_SIZE, Bed_start, Bed_end );
        
        // loop over one bed region
        do {
            result = load_discordant_reads(mei_data, current_state.bams_to_parse, currentChromosome->getName(),
                                           currentWindow, userSettings);
            if (result) {
                // something went wrong loading the reads, return error code.
                return result;
            }
            
            searchMEIBreakpoints(mei_data, current_state.bams_to_parse, currentChromosome, userSettings);
            cleanup_reads(mei_data.discordant_reads);
            
			currentWindow.next();
        } while (!currentWindow.finished());
	}
    
    // Reset genome for subsequent traversals.
    g_genome.reset();
    
    std::map<int, std::string> seq_name_dictionary = get_sequence_name_dictionary(current_state);
   
    searchMEI(mei_data, genome, seq_name_dictionary, userSettings, current_state, file_output);
    file_output.close();
    return 0;
}
Example #20
0
void Window::reshapeFunc(int, int) {
    currentWindow().resized();
}