コード例 #1
0
ファイル: JuffEd.cpp プロジェクト: cessen/juffed
void JuffEd::initActions() {
	CommandStorageInt* st = Juff::Utils::commandStorage();
	
	st->addAction(FILE_NEW,         tr("&New"),     this, SLOT(slotFileNew()));
	st->addAction(FILE_OPEN,        tr("&Open"),    this, SLOT(slotFileOpen()));
	st->addAction(FILE_SAVE,        tr("&Save"),    this, SLOT(slotFileSave()));
	st->addAction(FILE_SAVE_AS,     tr("Save as"), this, SLOT(slotFileSaveAs()));
	st->addAction(FILE_SAVE_ALL,    tr("Save all"), this, SLOT(slotFileSaveAll()));
	st->addAction(FILE_RELOAD,      tr("&Reload"),  this, SLOT(slotFileReload()));
	st->addAction(FILE_RENAME,      tr("Rename"),  this, SLOT(slotFileRename()));
	st->addAction(FILE_CLOSE,       tr("Close"),  this, SLOT(slotFileClose()));
	st->addAction(FILE_CLOSE_ALL,   tr("Close All"),  this, SLOT(slotFileCloseAll()));
	st->addAction(FILE_PRINT,       tr("&Print"),  this, SLOT(slotFilePrint()));
	st->addAction(FILE_EXIT,        tr("Exit"),  this, SLOT(slotFileExit()));
	
	st->addAction(SESSION_NEW,      tr("New session"), this, SLOT(slotSessionNew()));
	st->addAction(SESSION_OPEN,     tr("Open session"), this, SLOT(slotSessionOpen()));
	st->addAction(SESSION_SAVE,     tr("Save session as..."), this, SLOT(slotSessionSaveAs()));
	
	st->addAction(EDIT_UNDO,        tr("Undo"), this, SLOT(slotEditUndo()));
	st->addAction(EDIT_REDO,        tr("Redo"), this, SLOT(slotEditRedo()));
	st->addAction(EDIT_CUT,         tr("Cut"), this, SLOT(slotEditCut()));
	st->addAction(EDIT_COPY,        tr("Copy"), this, SLOT(slotEditCopy()));
	st->addAction(EDIT_PASTE,       tr("Paste"), this, SLOT(slotEditPaste()));
	
	st->addAction(SEARCH_FIND,      tr("Find"), this, SLOT(slotFind()));
	st->addAction(SEARCH_FIND_NEXT, tr("Find next"), this, SLOT(slotFindNext()));
	st->addAction(SEARCH_FIND_PREV, tr("Find previous"), this, SLOT(slotFindPrev()));
	st->addAction(SEARCH_REPLACE,   tr("Replace"), this, SLOT(slotReplace()));
	st->addAction(SEARCH_GOTO_LINE, tr("Go to line"), this, SLOT(slotGotoLine()));
	st->addAction(SEARCH_GOTO_FILE, tr("Go to file"), this, SLOT(slotGotoFile()));
	
	st->addAction(VIEW_ZOOM_IN,      tr("Zoom In"), this, SLOT(slotZoomIn()));
	st->addAction(VIEW_ZOOM_OUT,     tr("Zoom Out"), this, SLOT(slotZoomOut()));
	st->addAction(VIEW_ZOOM_100,     tr("Zoom 100%"), this, SLOT(slotZoom100()));
	st->addAction(VIEW_FULLSCREEN,   tr("Fullscreen"), this, SLOT(slotFullscreen()));
	
	st->addAction(TOOLS_SETTINGS,    tr("Settings"), this, SLOT(slotSettings()));
	st->addAction(HELP_ABOUT,        tr("About"), mw_, SLOT(slotAbout()));
	st->addAction(HELP_ABOUT_QT,     tr("About Qt"), mw_, SLOT(slotAboutQt()));
}
コード例 #2
0
ファイル: editorpage.cpp プロジェクト: VicHao/kkscope
/**
 * Class constructor.
 * @param	pDoc	The document object associated with this page
 * @param	pMenu	A Cscope queries popup menu to use with the editor
 * @param	pParent	The parent widget
 * @param	szName	The widget's name
 */
EditorPage::EditorPage(KTextEditor::Document* pDoc, QPopupMenu* pMenu,
	QTabWidget* pParent, const char* szName) : QHBox(pParent, szName),
	m_pParentTab(pParent),
	m_pDoc(pDoc),
	m_bOpen(false),
	m_bNewFile(false),
	m_sName(""),
	m_bWritable(true), /* new documents are writable by default */
	m_bModified(false),
	m_nLine(0),
	m_bSaveNewSizes(false)
{
	KTextEditor::PopupMenuInterface* pMenuIf;
	KTextEditor::ViewCursorInterface* pCursorIf;
	
	// Create code-completion objects (will be deleted by QObject destructor)
	m_pCompletion = new SymbolCompletion(this, this);
	
	// Set read-only mode, if required
	if (Config().getReadOnlyMode())
		m_pDoc->setReadWrite(false);
	
	// Create the child widgets
	m_pSplit = new QSplitter(this);
	m_pCtagsList = new CtagsList(m_pSplit);
	m_pView = m_pDoc->createView(m_pSplit);
	m_pSplit->setResizeMode(m_pCtagsList, QSplitter::KeepSize);
	
	// Perform tasks only when the document has been loaded completely
	connect(m_pDoc, SIGNAL(completed()), this, SLOT(slotFileOpened()));
	
	// Be notified when the text in the editor changes
	connect(m_pDoc, SIGNAL(textChanged()), this, SLOT(slotSetModified()));
	connect(m_pDoc, SIGNAL(undoChanged()), this, SLOT(slotUndoChanged()));
	
	// Store the sizes of the child windows when the tag list is resized
	// (since it may imply a move of the splitter divider)
	connect(m_pCtagsList, SIGNAL(resized()), this, SLOT(slotChildResized()));

	// Go to a symbol's line if it is selected in the tag list
	connect(m_pCtagsList, SIGNAL(lineRequested(uint)), this,
		SLOT(slotGotoLine(uint)));

	// Add Ctag records to the tag list
	connect(&m_ctags, SIGNAL(dataReady(FrontendToken*)), m_pCtagsList,
		SLOT(slotDataReady(FrontendToken*)));
		
	// Monitor Ctags' operation
	connect(&m_ctags, SIGNAL(finished(uint)), m_pCtagsList, 
		SLOT(slotCtagsFinished(uint)));
		
	// Set the context menu
	pMenuIf = dynamic_cast<KTextEditor::PopupMenuInterface*>(m_pView);
	if (pMenuIf)
		pMenuIf->installPopup(pMenu);

	// Emit a signal whenever the cursor's position changes
	pCursorIf = dynamic_cast<KTextEditor::ViewCursorInterface*>(m_pView);
	if (pCursorIf) {
		connect(m_pView, SIGNAL(cursorPositionChanged()), this,
			SLOT(slotCursorPosChange()));
	}
}
コード例 #3
0
ファイル: editorpage.cpp プロジェクト: AlexanderStein/kscope4
/**
 * Class constructor.
 * @param	pDoc	The document object associated with this page
 * @param	pMenu	A Cscope queries popup menu to use with the editor
 * @param	pParent	The parent widget
 * @param	szName	The widget's name
 */
EditorPage::EditorPage(KTextEditor::Document* pDoc, QMenu* pMenu,
	QTabWidget* pParent, const char* szName) : QWidget(pParent),
	m_pParentTab(pParent),
	m_pDoc(pDoc),
	m_bOpen(false),
	m_bNewFile(false),
	m_sName(""),
	m_bWritable(true), /* new documents are writable by default */
	m_bModified(false),
	m_nLine(0),
	m_bSaveNewSizes(false)
{
	Q_UNUSED(pMenu);
	setObjectName(szName);

	// Create code-completion objects (will be deleted by QObject destructor)
	m_pCompletion = new SymbolCompletion(this, this);

	// Set read-only mode, if required
	if (Config().getReadOnlyMode())
		m_pDoc->setReadWrite(false);

	// Turn on modifiedOnHdWarning on a per document base; this must be done BEFORE
	// creating the view ( see KateDocument::KateDocument )
	KTextEditor::ModificationInterface *pModificationIf;
	pModificationIf = qobject_cast<KTextEditor::ModificationInterface *>(m_pDoc);
	if (pModificationIf)
		pModificationIf->setModifiedOnDiskWarning(Config().getWarnModifiedOnDisk());

	// Create the child widgets
	m_pSplit = new QSplitter(this);
	m_pCtagsList = new CtagsList(m_pSplit);
	m_pView = m_pDoc->createView(m_pSplit);

	QHBoxLayout* pLayout = new QHBoxLayout;
	pLayout->addWidget(m_pSplit);
	QWidget::setLayout(pLayout);

	// Perform tasks only when the document has been loaded completely
	connect(m_pDoc, SIGNAL(completed()), this, SLOT(slotFileOpened()));

	// Be notified when the text in the editor changes
	connect(m_pDoc, SIGNAL(textChanged(KTextEditor::Document*)), this, SLOT(slotSetModified(KTextEditor::Document*)));
	connect(m_pDoc, SIGNAL(undoChanged()), this, SLOT(slotUndoChanged()));

	// Store the sizes of the child windows when the tag list is resized
	// (since it may imply a move of the splitter divider)
	connect(m_pCtagsList, SIGNAL(resized()), this, SLOT(slotChildResized()));

	// Go to a symbol's line if it is selected in the tag list
	connect(m_pCtagsList, SIGNAL(lineRequested(uint)), this,
		SLOT(slotGotoLine(uint)));

	// Add Ctag records to the tag list
	connect(&m_ctags, SIGNAL(dataReady(FrontendToken*)), m_pCtagsList,
		SLOT(slotDataReady(FrontendToken*)));

	// Monitor Ctags' operation
	connect(&m_ctags, SIGNAL(finished(uint)), m_pCtagsList, 
		SLOT(slotCtagsFinished(uint)));

	// Set the context menu
	m_pView->setContextMenu(pMenu);
	connect(m_pView, SIGNAL(cursorPositionChanged(KTextEditor::View *, const KTextEditor::Cursor&)),
		this, SLOT(slotCursorPosChange(KTextEditor::View *)));
}
コード例 #4
0
ファイル: editorpage.cpp プロジェクト: choueric/kscope-4
/**
 * Class constructor.
 * @param	pDoc	The document object associated with this page
 * @param	pMenu	A Cscope queries popup menu to use with the editor
 * @param	pParent	The parent widget
 * @param	szName	The widget's name
 */
EditorPage::EditorPage(KTextEditor::Document* pDoc, QMenu* pMenu, QTabWidget* pParent) : 
    m_pParentTab(pParent),
	m_pDoc(pDoc),
	m_bOpen(false),
	m_bNewFile(false),
	m_sName(""),
	m_bWritable(true), /* new documents are writable by default */
	m_bModified(false),
	m_nLine(0),
	m_bSaveNewSizes(false)
{
    QHBoxLayout *layout = new QHBoxLayout(this);
	
	// Set read-only mode, if required
	if (Config().getReadOnlyMode())
		m_pDoc->setReadWrite(false);

	// Create the child widgets
	m_pSplit = new QSplitter(Qt::Horizontal, this);
	m_pCtagsListWidget = new CtagsListWidget(m_pSplit);
	m_pView = m_pDoc->createView(m_pSplit);

    m_pSplit->addWidget(m_pCtagsListWidget);
    m_pSplit->addWidget(m_pView);
	//m_pSplit->setResizeMode(m_pCtagsListWidget, QSplitter::KeepSize);

    layout->addWidget(m_pSplit);
	
	// Perform tasks only when the document has been loaded completely
	connect(m_pDoc, SIGNAL(completed()), this, SLOT(slotFileOpened()));
	
	// Be notified when the text in the editor changes
	connect(m_pDoc, SIGNAL(textChanged(KTextEditor::Document *)),
            this, SLOT(slotSetModified(KTextEditor::Document *)));
	connect(m_pDoc, SIGNAL(undoChanged()), this, SLOT(slotUndoChanged()));
	
	// Store the sizes of the child windows when the tag list is resized
	// (since it may imply a move of the splitter divider)
	connect(m_pCtagsListWidget, SIGNAL(resized()), this, SLOT(slotChildResized()));

	// Go to a symbol's line if it is selected in the tag list
	connect(m_pCtagsListWidget, SIGNAL(lineRequested(uint)), this,
		SLOT(slotGotoLine(uint)));

	// Add Ctag records to the tag list
	connect(&m_ctags, SIGNAL(dataReady(FrontendToken*)), m_pCtagsListWidget,
		SLOT(slotDataReady(FrontendToken*)));
		
	// Monitor Ctags' operation
	connect(&m_ctags, SIGNAL(finished(uint)), m_pCtagsListWidget, 
		SLOT(slotCtagsFinished(uint)));
		
	// Set the context menu
    m_pView->setContextMenu(pMenu);

	// Emit a signal whenever the cursor's position changes
    connect(m_pView, SIGNAL(cursorPositionChanged(KTextEditor::View *, 
                    const KTextEditor::Cursor &)), 
                this, SLOT(slotCursorPosChange(KTextEditor::View *, 
                        const KTextEditor::Cursor &)));

    setShowLinenum(Config().getShowLinenum());
}