Exemplo n.º 1
0
void BookmarkView::onSearchText( wxCommandEvent& /* event */ ) {

    std::wstring searchText = m_searchText->GetValue().Trim().Lower().ToStdWstring();
    
   searchKeywords.clear();
    
   if (searchText.length() != 0) {
        std::wstringstream searchTextLo(searchText);
        std::wstring tmp;
        
        while(std::getline(searchTextLo, tmp, L' ')) {
            if (tmp.length() != 0 && tmp.find(L"search.") == std::wstring::npos) {
                searchKeywords.push_back(tmp);
//                std::wcout << L"Keyword: " << tmp << '\n';
            }
        }
    }
    
    if (searchKeywords.size() != 0 && !m_clearSearchButton->IsShown()) {
        m_clearSearchButton->Show();
        refreshLayout();
    } else if (searchKeywords.size() == 0 && m_clearSearchButton->IsShown()) {
        m_clearSearchButton->Hide();
        refreshLayout();
    }
    
    wxGetApp().getBookmarkMgr().updateActiveList();
    wxGetApp().getBookmarkMgr().updateBookmarks();
}
Exemplo n.º 2
0
InterlinearChunkEditor::InterlinearChunkEditor(Text *text, Project *project, View::Type type, int chunkSize, QWidget *parent) :
    QWidget(parent),
    ui(new Ui::InterlinearChunkEditor)
{
    ui->setupUi(this);

    mTextTabWidget = 0;

    mText = text;
    mProject = project;
    mType = type;
    mChunkSize = chunkSize;
    mPosition = 0;

    connect( ui->previousButton , SIGNAL(clicked()), this, SLOT(previous()) );
    connect( ui->nextButton, SIGNAL(clicked()), this, SLOT(next()) );
    connect( ui->buttonGoTo, SIGNAL(clicked()), this, SLOT(goTo()) );
    connect( ui->beginningButton, SIGNAL(clicked()), this, SLOT(beginning()));
    connect( ui->endButton, SIGNAL(clicked()), this, SLOT(end()) );

    connect( text, SIGNAL(guiRefreshRequest()), this, SLOT(refreshLayout()));

    refreshLayout();

    mTextTabWidget = new TextTabWidget( mText, mProject, mType, makeLines(), QList<Focus>(), this );
    ui->ildLayout->addWidget(mTextTabWidget);

    setWindowTitle(tr("%1 [%2]").arg(mText->name()).arg(mProject->view(type)->name()));
}
Exemplo n.º 3
0
void BookmarkView::rangeSelection(BookmarkRangeEntryPtr re) {
    
    clearButtons();
    
    hideProps();
    
    m_labelText->SetValue(re->label);
    
    m_labelText->Show();
    m_labelLabel->Show();

    m_frequencyVal->Show();
    m_frequencyLabel->Show();

    std::string strFreq = frequencyToStr(re->startFreq) + "-" + frequencyToStr(re->endFreq);
    
    m_frequencyVal->SetLabelText(wxString(strFreq));
    
    showProps();

    addButton(m_buttonPanel, "Go to Range", wxCommandEventHandler( BookmarkView::onActivateRange ));
    addButton(m_buttonPanel, "Update Range", wxCommandEventHandler( BookmarkView::onUpdateRange ))->SetToolTip("Update range by setting it to the active range.");
    addButton(m_buttonPanel, "Remove Range", wxCommandEventHandler( BookmarkView::onRemoveRange ));
    
    showButtons();
    refreshLayout();
}
Exemplo n.º 4
0
void GuiWindow::setSize(SDL_Point position)
{
   m_absPosition.w = position.x;
   m_absPosition.h = position.y;

   refreshLayout();
}
Exemplo n.º 5
0
void BookmarkView::recentSelection(BookmarkEntryPtr bmSel) {
    
    m_frequencyVal->SetLabelText(frequencyToStr(bmSel->frequency));
    m_bandwidthVal->SetLabelText(frequencyToStr(bmSel->bandwidth));
    m_modulationVal->SetLabelText(bmSel->type);
    m_labelText->SetValue(bmSel->label);
    
    hideProps();
    
    m_frequencyVal->Show();
    m_frequencyLabel->Show();
    
    m_bandwidthVal->Show();
    m_bandwidthLabel->Show();
    
    m_modulationVal->Show();
    m_modulationLabel->Show();
    
    m_labelText->Show();
    m_labelLabel->Show();
    
    clearButtons();
    
    addBookmarkChoice(m_buttonPanel);
    addButton(m_buttonPanel, "Activate Recent", wxCommandEventHandler( BookmarkView::onActivateRecent ));
    addButton(m_buttonPanel, "Remove Recent", wxCommandEventHandler( BookmarkView::onRemoveRecent ));
    
    showProps();
    showButtons();
    refreshLayout();
}
Exemplo n.º 6
0
void BookmarkView::updateTheme() {
    wxColour bgColor(ThemeMgr::mgr.currentTheme->generalBackground);
    wxColour textColor(ThemeMgr::mgr.currentTheme->text);
    wxColour btn(ThemeMgr::mgr.currentTheme->button);
    wxColour btnHl(ThemeMgr::mgr.currentTheme->buttonHighlight);
    
    SetBackgroundColour(bgColor);

    m_treeView->SetBackgroundColour(bgColor);
    m_treeView->SetForegroundColour(textColor);
    
    m_propPanel->SetBackgroundColour(bgColor);
    m_propPanel->SetForegroundColour(textColor);

    m_buttonPanel->SetBackgroundColour(bgColor);
    m_buttonPanel->SetForegroundColour(textColor);
    
    m_labelLabel->SetForegroundColour(textColor);
    m_frequencyVal->SetForegroundColour(textColor);
    m_frequencyLabel->SetForegroundColour(textColor);
    m_bandwidthVal->SetForegroundColour(textColor);
    m_bandwidthLabel->SetForegroundColour(textColor);
    m_modulationVal->SetForegroundColour(textColor);
    m_modulationLabel->SetForegroundColour(textColor);
    
    refreshLayout();
}
Exemplo n.º 7
0
void GuiWindow::setPosition(SDL_Point position)
{
   
   m_relPosition.x = position.x;
   m_relPosition.y = position.y;
   
   refreshLayout();
}
Exemplo n.º 8
0
void BookmarkView::activeSelection(DemodulatorInstancePtr dsel) {
   
    if (dsel == nullptr) {
        hideProps();
        clearButtons();
        showProps();
        showButtons();
        refreshLayout();
        return;
    }

    m_frequencyVal->SetLabelText(frequencyToStr(dsel->getFrequency()));
    m_bandwidthVal->SetLabelText(frequencyToStr(dsel->getBandwidth()));
    m_modulationVal->SetLabelText(dsel->getDemodulatorType());
    m_labelText->SetValue(dsel->getDemodulatorUserLabel());
    
    hideProps();
    
    m_frequencyVal->Show();
    m_frequencyLabel->Show();
    
    m_bandwidthVal->Show();
    m_bandwidthLabel->Show();
    
    m_modulationVal->Show();
    m_modulationLabel->Show();
    
    m_labelText->Show();
    m_labelLabel->Show();
    
    clearButtons();

    addBookmarkChoice(m_buttonPanel);
    
    if (!(dsel->isRecording())) {
         addButton(m_buttonPanel, "Start Recording", wxCommandEventHandler(BookmarkView::onStartRecording));
     } else {
         addButton(m_buttonPanel, "Stop Recording", wxCommandEventHandler(BookmarkView::onStopRecording));
     }
   
    addButton(m_buttonPanel, "Remove Active", wxCommandEventHandler( BookmarkView::onRemoveActive ));
    
    showProps();
    showButtons();
    refreshLayout();
}
Exemplo n.º 9
0
void DTrashItemModel::changeThumbSize(int size)
{
    d->thumbSize = size;

    if (isEmpty())
        return;

    QTimer::singleShot(100, this, SLOT(refreshLayout()));
}
Exemplo n.º 10
0
void BookmarkView::bookmarkBranchSelection() {
    
    clearButtons();
    hideProps();
    
    addButton(m_buttonPanel, BOOKMARK_VIEW_STR_ADD_GROUP, wxCommandEventHandler( BookmarkView::onAddGroup ));
    
    showButtons();
    refreshLayout();
}
Exemplo n.º 11
0
void BookmarkView::recentBranchSelection() {
    clearButtons();
    hideProps();
    
    addButton(m_buttonPanel, BOOKMARK_VIEW_STR_CLEAR_RECENT, wxCommandEventHandler( BookmarkView::onClearRecents ));
    
    showButtons();
    refreshLayout();

    this->Layout();
}
Exemplo n.º 12
0
void BookmarkView::onClearSearch( wxCommandEvent& /* event */ ) {

    m_clearSearchButton->Hide();
    m_searchText->SetValue(L"Search..");
    m_treeView->SetFocus();

    searchKeywords.clear();

    wxGetApp().getBookmarkMgr().updateActiveList();
    wxGetApp().getBookmarkMgr().updateBookmarks();
    refreshLayout();
}
Exemplo n.º 13
0
void InterlinearChunkEditor::moveToPosition(int position)
{
    // out-of-bounds checks
    if( position < 0 )
        position = 0;

    if( position >= mText->phraseCount() )
        return;

    mPosition = position;

    refreshLayout();
}
Exemplo n.º 14
0
void Window::widgetResized(const gcn::Event &event)
{
    const gcn::Rectangle area = getChildrenArea();

    if (mGrip)
        mGrip->setPosition(getWidth() - mGrip->getWidth() - area.x,
                           getHeight() - mGrip->getHeight() - area.y);

    if (mClose)
        mClose->setPosition(getWidth() - getPadding() - mClose->getWidth(),
                            getPadding());

    refreshLayout();
}
Exemplo n.º 15
0
void FormPerson::loadLayout(QString tableName)
{
    // Recupero link al database
    QSqlDatabase db = QSqlDatabase::database("ConnectionToDB");
    // Creo un modello sche si riferirà alla tabella delle mail
    QSqlTableModel *model = new QSqlTableModel(this, db);

    // Imposto la tabella a cui si riferirà il modello
    model->setTable(tableName);
    // Imposto un filtro sulla persona a cui la tabella è collegata
    model->setFilter("id_person=" + QString::number(this->personId));
    model->select();

    // Per ciascuna riga della tabella...
    for (int i=0; i<model->rowCount(); i++)
    {
        QHBoxLayout *hbl = new QHBoxLayout();

        // Creo un nuovo oggetto QLineEdit
        QLineEdit *qlineedit = new QLineEdit();
        // Creo un pulsante per la successiva rimozione dell'entry nel database
        RemoveRowFromModel *button = new RemoveRowFromModel(i, model, tableName);
        // Collego il pulante alla funzione di refresh
        QObject::connect(button, SIGNAL(rowRemoved(QString)), this, SLOT(refreshLayout(QString)));

        // Creo un mapper
        QDataWidgetMapper *mapperEmailPerson = new QDataWidgetMapper();

        // Collego al mapper il modello della tabella
        mapperEmailPerson->setModel(model);
        // Aggiungo un mapping tra l'oggetto QLineEdit e il modello
        mapperEmailPerson->addMapping(qlineedit, 1);
        // Posiziono il mapper sull'indice opportuno
        mapperEmailPerson->setCurrentIndex(i);

        // Inserisco il mapper nella lista dei mapper per le email
        getQDataWidgetMapperList(tableName)->append(mapperEmailPerson);



        // qlineedit e button, li visualizzo sulla stessa riga (li inserisco in un layout orizzontale)
        hbl->addWidget(qlineedit);
        hbl->addWidget(button);
        // Inserisco il layout orizzontale nel layout delle mail
        getVerticalLayout(tableName)->addLayout(hbl);

        // Collego il pulsante ad uno slot, in modo che venga gestita la rimozione di una riga dal
        // modello
    }
}
Exemplo n.º 16
0
GuiContextMenu::GuiContextMenu(GuiManager * manager, ContextMenuList const& list)
    : GuiCollection(manager)
{
   assert(!list.empty());
   m_handles.reserve(list.size());

   for (auto const& entry : list)
   {
      auto handle = addChildWindow<GuiContextMenuEntry>(this, entry.first, entry.second);
      m_handles.push_back(handle);
   }

   setBackground(ColourPalette::GREY11);
   refreshLayout();
   layoutMenu();
}
Exemplo n.º 17
0
void BookmarkView::rangeBranchSelection() {
    clearButtons();
    hideProps();
    
    m_labelText->SetValue(wxT(""));
    m_labelText->Show();
    m_labelLabel->Show();

    showProps();

    addButton(m_buttonPanel, "Add Active Range", wxCommandEventHandler( BookmarkView::onAddRange ));
    
    showButtons();
    refreshLayout();
    
    this->Layout();
}
void SlidingStackComponent::handleStackFocusChange (Component* newFocusContent, int newIndex, int oldIndex, bool animate)
{
	if (!animate)
	{
		refreshLayout();
		return;
	}

	Component* panel;

	int w = getWidth ();
	int h = getHeight ();

	Rectangle<int> bounds (0,0,w,h);

	// Move the old panel...
	panel = getContentComponentAtIndex (oldIndex);
	if (panel != 0)
	{
		panel->setVisible (true);

		// Make sure the panel is currently on-screen to exit...
		bounds.setX (0);
		panel->setBounds (bounds);

		// Animate it to exit
		bounds.setX ((oldIndex < newIndex) ? -w : w);
		Desktop::getInstance().getAnimator().animateComponent(panel, bounds, 1.0f, slideDuration, true, startSpeed, endSpeed);
	}

	// Move the new panel...
	panel = getContentComponentAtIndex (newIndex);
	if (panel != 0)
	{
		panel->setVisible (true);

		// Place the panel in a suitable position for entry...
		bounds.setX ((newIndex < oldIndex) ? -w : w);
		panel->setBounds (bounds);

		// Animate it to enter and fill the bounds.
		bounds.setX (0);
		Desktop::getInstance().getAnimator().animateComponent(panel, bounds, 1.0f, slideDuration, true, startSpeed, endSpeed);
	}
}
Exemplo n.º 19
0
void BookmarkView::groupSelection(std::string groupName) {
    
    clearButtons();
    
    hideProps();
    
    m_labelText->SetValue(groupName);
    
    m_labelText->Show();
    m_labelLabel->Show();
    
    addButton(m_buttonPanel, "Remove Group", wxCommandEventHandler( BookmarkView::onRemoveGroup ));
    
    showProps();
    
    showButtons();
    refreshLayout();
}
void MApplicationMenuButtonViewPrivate::refreshIconImage()
{
    Q_Q(MApplicationMenuButtonView);

    QSize size = q->style()->iconSize();
    QString iconID = q->model()->iconID();

    if (toggleState() && !q->model()->toggledIconID().isEmpty())
        iconID = q->model()->toggledIconID();

    if (iconID != iconImage->image() ||
            (!iconID.isEmpty() && iconID == iconImage->image() && size != iconImage->imageSize())) {
        //Apply image and refresh layout only if image itself or size of the existing image
        //should be changed (avoid some flickering).
        iconImage->setImage(iconID, size);
        refreshLayout();
    }
}
Exemplo n.º 21
0
GuiContextMenuEntry::GuiContextMenuEntry(GuiManager *manager, GuiContextMenu* parent, uint32_t id, std::string label)
: GuiWindow(manager),
  m_id(id)
{
   setParent(parent);

   m_textTexture = GRAPHICS()->renderText(label, manager->getContentFont(), ColourPalette::BLACK);

   refreshLayout();

   setSize({ m_textPos.w + (2 * m_leftPad), m_textPos.h + (2 * m_topPad) });

   GUIEvts().registerCallback(GuiEvtType::MOUSE_EXIT,
            std::bind(&GuiContextMenuEntry::onMouseExit, this, std::placeholders::_1));
   GUIEvts().registerCallback(GuiEvtType::MOUSE_ENTER,
            std::bind(&GuiContextMenuEntry::onMouseEnter, this, std::placeholders::_1));
   GUIEvts().registerCallback(GuiEvtType::MOUSE_DOWN,
                              std::bind(&GuiContextMenuEntry::onMouseDown, this, std::placeholders::_1));
}
Exemplo n.º 22
0
void FormPerson::addAttributeToPerson(QString tableName, QString thirdAttribute)
{
     this->saveAttributes();

    // Recupero link al database
    QSqlDatabase db = QSqlDatabase::database("ConnectionToDB");
    QSqlQuery query(db);

    query.prepare("INSERT INTO " + tableName + "(id_person,value," + thirdAttribute + ") VALUES(:id_person,'',2)");


    query.bindValue(":id_person", this->personId);


    if (!query.exec())
    {
        qDebug() << tr("Non è stato possibile inserire il nuovo attributo: ") << query.lastError().text() << " " << query.lastQuery();
    }
    else
    {
        refreshLayout(tableName);
    }

}
Exemplo n.º 23
0
void Widget::setSizePercent(const Vec2 &percent)
{
    if (_usingLayoutComponent)
    {
        auto component = this->getOrCreateLayoutComponent();
        component->setUsingPercentContentSize(true);
        component->setPercentContentSize(percent);
        component->refreshLayout();
    }
    else
    {
        _sizePercent = percent;
        Size cSize = _customSize;
        if (_running)
        {
            Widget* widgetParent = getWidgetParent();
            if (widgetParent)
            {
                cSize = Size(widgetParent->getContentSize().width * percent.x, widgetParent->getContentSize().height * percent.y);
            }
            else
            {
                cSize = Size(_parent->getContentSize().width * percent.x, _parent->getContentSize().height * percent.y);
            }
        }
        if (_ignoreSize)
        {
            this->setContentSize(getVirtualRendererSize());
        }
        else
        {
            this->setContentSize(cSize);
        }
        _customSize = cSize;
    }
}
Exemplo n.º 24
0
void Widget::setPositionPercent(const Vec2 &percent)
{
    if (_usingLayoutComponent)
    {
        auto component = this->getOrCreateLayoutComponent();
        component->setPositionPercentX(percent.x);
        component->setPositionPercentY(percent.y);
        component->refreshLayout();
    }
    else
    {
        _positionPercent = percent;
        if (_running)
        {
            Widget* widgetParent = getWidgetParent();
            if (widgetParent)
            {
                Size parentSize = widgetParent->getContentSize();
                Vec2 absPos(parentSize.width * _positionPercent.x, parentSize.height * _positionPercent.y);
                setPosition(absPos);
            }
        }
    }
}
Exemplo n.º 25
0
void ThumbnailStrip::showEvent(QShowEvent *event)
{
  refreshLayout();
}
Exemplo n.º 26
0
void ThumbnailStrip::resizeEvent(QResizeEvent *event)
{
  refreshLayout();
}
void StackComponent::resized ()
{
    refreshLayout ();
}
void StackComponent::handleContentComponentAdded (Component* newContent, int index, bool animate)
{
    addAndMakeVisible (newContent);
    refreshLayout ();
}
void StackComponent::handleStackFocusChange (Component* newFocusContent, int newIndex, int oldIndex, bool animate)
{
    refreshLayout ();
}
Exemplo n.º 30
0
void CtrlSliderCursor::onUpdate( Subject<VarPercent> &rVariable,
                                 void *arg  )
{
    // The position has changed
    refreshLayout();
}