Exemplo n.º 1
0
void RightClickStrategy::finishInteraction( Qt::KeyboardModifiers modifiers )
{
    Q_UNUSED(modifiers);
    QMenu menu;
    QAction *save = 0, *zoomInAction = 0, *zoomOutAction = 0, *removeFolder = 0;
    QAction *load = new QAction(i18n("Open..."), &menu);
    menu.addAction(load);

    if (m_canvas->shapeManager()->selection()->count()) {
        save = new QAction(i18n("Save Book..."), &menu);
        menu.addAction(save);
    }
    QAction *newFolder = new QAction(i18n("New Folder..."), &menu);
    menu.addAction(newFolder);

    if (m_canvas->zoomIndex() < 2) {
        zoomInAction = new QAction(i18n("Zoom In"), &menu);
        menu.addAction(zoomInAction);
    }
    if (m_canvas->zoomIndex() >= 0) {
        zoomOutAction = new QAction(i18n("Zoom Out"), &menu);
        menu.addAction(zoomOutAction);
    }
    FolderShape *folder = dynamic_cast<FolderShape*>(m_clickedShape);
    if (folder && folder != m_canvas->itemStore()->mainFolder()) {
        removeFolder = new QAction(i18n("Remove Folder"), &menu);
        menu.addAction(removeFolder);
    }

    QAction *selected = m_canvas->popup(&menu, m_lastPosition);
    if (selected == 0)
        return;
    if (selected == save) {
        saveSelection();
    } else if (selected == load) {
        this->load();
    } else if (selected == newFolder) {
        createNewFolder();
    } else if (selected == zoomInAction) {
        m_canvas->zoomIn(m_lastPosition);
    } else if (selected == zoomOutAction) {
        m_canvas->zoomOut(m_lastPosition);
    } else if (selected == removeFolder) {
        Q_ASSERT(folder);
        m_canvas->itemStore()->removeFolder(folder);
        FolderShape *main = m_canvas->itemStore()->mainFolder();
        if (main) {
            main->update();
            main->setBorder(0);
            main->setSize(m_canvas->size());
            main->update();
            main->setPosition(QPointF(0,0));
            m_canvas->resetDocumentOffset();
        }
        delete folder;
    }
}
Exemplo n.º 2
0
/**
 * This function is provided for convenience. Please see 
 * PsiRichText::appendText() documentation for usage details.
 */
void PsiTextView::appendText(const QString &text)
{
	QTextCursor cursor = textCursor();
	Selection selection = saveSelection(cursor);
	
	PsiRichText::appendText(document(), cursor, text);
	
	restoreSelection(cursor, selection);
	setTextCursor(cursor);
}
Exemplo n.º 3
0
EditorWindow::EditorWindow(QWidget *parent) :
QMainWindow(parent)
{
    setupUi(this);

    QStringList headers;
    headers << tr("Title") << tr("Type") << tr("Instances") << tr("Osc") << tr("Midi");

    SoftwaresProxy = new FilterJsonProxy(this);
    Softwares = new SoftwareModel(this);
    Softwares->load(":/SoftwareTree.json");

    SoftwaresProxy->setSourceModel(Softwares);
    SoftwareTree->setModel(SoftwaresProxy);

//    SoftwareTree->setSortingEnabled(true);
//    SoftwareTree->sortByColumn(0);

    Controllers = new ControlModel(this);

    //Headbar Connections
    connect(actionSave_Software_File, SIGNAL(triggered()), this, SLOT(saveSoftware()));
    connect(actionSave_Selection, SIGNAL(triggered()), this, SLOT(saveSelection()));
    connect(actionHide_Options, SIGNAL(toggled(bool)), this, SLOT(hideSoftwareOptions(bool)));
    connect(actionHide_Groups, SIGNAL(toggled(bool)), this, SLOT(hideSoftwareGroups(bool)));

    connect(actionOpen_Controller_UI, SIGNAL(triggered()), this, SLOT(addControlUI()));

    //Software Buttons Connection
    connect(SoftAdd, SIGNAL(clicked()), this, SLOT(addSoftware()));
    connect(SoftDel, SIGNAL(clicked()), this, SLOT(delSoftware()));
    connect(SoftItemAdd, SIGNAL(clicked()), this, SLOT(addSoftwareItem()));
    connect(SoftItemDel , SIGNAL(clicked()), this, SLOT(delSoftwareItem()));
    connect(SoftGroupAdd, SIGNAL(clicked()), this, SLOT(addSoftwareGroup()));
    connect(SoftGroupDel, SIGNAL(clicked()), this, SLOT(delSoftwareGroup()));
    connect(SoftInstanceAdd, SIGNAL(clicked()), this, SLOT(addSoftwareInstance()));
    connect(SoftInstanceDel, SIGNAL(clicked()), this, SLOT(delSoftwareInstance()));

    //Controllers Buttons Connections
    connect(ControllerControls, SIGNAL(clicked()), this, SLOT(manageControl()));
    //Debug
    //connect(SoftwareTree->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(selection(QItemSelection,QItemSelection)));
}
Exemplo n.º 4
0
LRESULT ListViewNotify(PCSpotify spotify, HWND hWnd, LPARAM lParam, DWORD setting)
{
	LPNMHDR  lpnmh{ (LPNMHDR)lParam };
	HWND     hwndListView{ GetDlgItem(hWnd, ID_LISTVIEW) };

	switch (lpnmh->code)
	{
	case LVN_GETDISPINFO:
	{
		LV_DISPINFO *lpdi = reinterpret_cast<LV_DISPINFO*>(lParam);

		if (lpdi->item.iSubItem)
		{
			if (lpdi->item.mask & LVIF_TEXT)
			{
				lpdi->item.pszText = const_cast<LPTSTR>(g_windows[lpdi->item.iItem].second.c_str());
			}
		}
		else
		{
			if (lpdi->item.mask & LVIF_TEXT)
			{
				lpdi->item.pszText = const_cast<LPTSTR>(g_windows[lpdi->item.iItem].first.c_str());
			}
		}
	}
	return 0;

	case NM_DBLCLK:
	{
		saveSelection(spotify, hwndListView, setting);
		EndDialog(hWnd, 0);
	}
	return 0;

	}
	return 0;
}
MainWindow::MainWindow(QWidget *parent, Qt::WFlags flags)
    : QMainWindow(parent, flags),
    m(0), a(NULL), b(NULL), __a__(NULL), x(NULL), selectionSize(100),
    inputDataLoaded(false), selectionGenerated(false), kxy(0.0), middleX(0.0), middleY(0.0),
    shiftX(10.0), shiftY(10.0), sigmaX(0.0), sigmaY(0.0), r(0.0), scene(NULL)
{
    ui.setupUi(this);

    connect(ui.loadButton, SIGNAL(clicked()), this, SLOT(load()));
    connect(ui.generateButton, SIGNAL(clicked()), this, SLOT(generate()));
    connect(ui.drawButton, SIGNAL(clicked()), this, SLOT(calculate_values()));
    //connect(ui.drawButton, SIGNAL(clicked()), this, SLOT(draw()));
    connect(ui.zoomX, SIGNAL(valueChanged(int)), this, SLOT(draw()));
    connect(ui.zoomY, SIGNAL(valueChanged(int)), this, SLOT(draw()));
    connect(ui.checkBoxSelection, SIGNAL(stateChanged(int)), this, SLOT(draw()));
    connect(ui.checkBoxMiddle, SIGNAL(stateChanged(int)), this, SLOT(draw()));
    connect(ui.checkBoxIsolines, SIGNAL(stateChanged(int)), this, SLOT(draw()));
    connect(ui.component1, SIGNAL(editingFinished()), this, SLOT(calculate_values()));
    connect(ui.component2, SIGNAL(editingFinished()), this, SLOT(calculate_values()));
    connect(ui.buttonSaveSelection, SIGNAL(clicked()), this, SLOT(saveSelection()));

    srand(QTime::currentTime().elapsed());
}
Exemplo n.º 6
0
INT_PTR CALLBACK ListDlgPRoc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	static HWND hList = NULL;
	static LVCOLUMN lvCol{ 0 };
	static LVITEM lvItem{ 0 };
	static CSettings* settings{ 0 };
	switch (message)
	{
	case WM_INITDIALOG:
		InitCommonControls();
		settings = reinterpret_cast<CSettings*>(lParam);
		EnumWindows(EnumWindowsProc, NULL);
		hList = CreateListView(hWnd);
		InitListView(hList);
		break;
	case WM_NOTIFY:
		return ListViewNotify(settings->spotify, hWnd, lParam, settings->program);
	case WM_SIZE:
		ResizeListView(hList, hWnd);
		break;
	case WM_COMMAND:
		if (LOWORD(wParam) == IDOK)
		{
			saveSelection(settings->spotify, hList, settings->program);
			EndDialog(hWnd, 0);
		}
		break;
	case WM_CLOSE:
	case WM_DESTROY:
		EndDialog(hWnd, 0);
		break;
	default:
		break;
	}
	return 0;
}
Exemplo n.º 7
0
void CSaveMenu::processSpecific()
{
	if(!mp_OverwriteMenu)
	{
		if( m_selection != NO_SELECTION )
		{
			if( mp_Dialog->getInputMode(INPUT_MODE_UP_DOWN) )
			{
				if( m_SavedGame.getSlotList().size() > m_selection )
					mp_Dialog->m_name = m_SavedGame.getSlotList().at(m_selection);

				if( m_SavedGame.getSlotList().size() > m_selection && mp_Dialog->m_name != m_SavedGame.getEmptyString() )
				{
					mp_OverwriteMenu = new CConfirmMenu("Overwrite?", m_overwrite, m_dlg_theme);
					m_suspended = true;
				}
				else
				{
#ifndef NOKEYBOARD
					mp_Dialog->m_name = "Slot" + itoa(m_selection);
					mp_Dialog->m_length = TEXT_WIDTH;
					mp_Dialog->setInputMode(INPUT_MODE_TEXT);
#else

					mp_Dialog->m_name = m_SavedGame.getUnnamedSlotName();
					mp_Dialog->m_length = TEXT_WIDTH;

					// save right away
					saveSelection();
#endif
					return;
				}

			}
			else if ( mp_Dialog->getInputMode(INPUT_MODE_TEXT) &&
					(g_pInput->getPressedKey(KENTER) || g_pInput->getPressedKey(KCTRL) || g_pInput->getPressedCommand(IC_JUMP) || g_pInput->getPressedCommand(IC_STATUS) ) )
			{
				saveSelection();
			}
		}
	}
	else
	{
		mp_OverwriteMenu->processCommon();
		mp_OverwriteMenu->processSpecific();
		mp_OverwriteMenu->postProcess();

		if(mp_OverwriteMenu->mustClose())
		{
			SAFE_DELETE(mp_OverwriteMenu);
			m_suspended = false;
			mp_Dialog->m_length = TEXT_WIDTH;

			if(m_overwrite)
			{
#ifndef NOKEYBOARD
				mp_Dialog->setInputMode(INPUT_MODE_TEXT);
#else
				mp_Dialog->m_name = m_SavedGame.getUnnamedSlotName();
				mp_Dialog->m_length = TEXT_WIDTH;
				saveSelection();
#endif

			}
			else
			{
				mp_Dialog->setInputMode(INPUT_MODE_UP_DOWN);
				m_selection = NO_SELECTION;
			}

		}
	}
}
Exemplo n.º 8
0
void Converter::convertSingleDocQuick( const string_t& fileName )
{
	tDocumentsSp docs = word()->getDocuments();
    tDocumentSp  doc  = docs->open(toUtf16(getInputAbsPath(fileName)));
    if (!doc) {
        logError(logger(), "Error while opening document: " + fileName);
        return;
    }

    tCharMappingSp cm;
    string_t       fontName, newFontName;
    wstring_t      text, textUnicode, docAsText;
    int            c = 0;

	tSelectionSp s = word()->getSelection();
    int pos = 0;
    int totalCharsQty = s->getStoryLength();

    do {
        s->setStart(pos);
        s->setEnd(pos + 1);
        s->selectCurrentFont();
        fontName = s->getFont()->getName();

        if ( canSkipFont(fontName) ) {
            //s->getFont()->haveCommonAttributes();
            pos = s->getEnd();
            docAsText += s->getText();
            std::cout << "\r" << percentageStr(pos, totalCharsQty - 1);
            continue;
        }

        text = s->getText();
        if ( fontName.empty() ) {
            saveSelection(s);
            fontName = makeGuess(s);            
            restoreSelection(s);

            /// if after all we have empty font name, log about that event
            /// and go forward
            if (fontName.empty()) {
                logError(logger(), "EMPTY FONT NAME: Investigate");
                pos = s->getEnd();
                docAsText += text;
                std::cout << "\r" << percentageStr(pos, totalCharsQty - 1);
                continue;
            }
        }

        /// use mapping
        textUnicode.clear();
        cm = getCM(fontName);
        if (cm) {
            bool spacingOnly = cm->doConversion(text, textUnicode, fontName);
            newFontName = getFontSubstitution(cm, fontName);
            //tFontSp fontDup = s->getFont()->duplicate();
            s->setText(textUnicode);
            //s->getFont()->haveCommonAttributes();
            s->getFont()->setName(newFontName);
            //s->setFont(fontDup);
        }

        /// extract text from the document as well
        docAsText += textUnicode;
        pos = s->getEnd();

        std::cout << "\r" << percentageStr(pos, totalCharsQty - 1);
    } while ( pos < totalCharsQty - 1 );


    /// -------------------------------------------///
    /// now save result in the appropriate folder  ///
    string_t outputDir = getOutputAbsPath(fileName);
    Poco::File(outputDir).createDirectories();
    Poco::Path p(fileName);
    doc->saveAs( outputDir + p.getBaseName() + " QUICK." + p.getExtension() );
    doc->close();

    if ( config_->getBool("app.saveAlsoAsUTF8", false) )
        writeFileAsBinary( outputDir + p.getBaseName() + " UTF8 QUICK.txt", toUtf8(docAsText));
}