added jump to block feature.
This commit is contained in:
parent
532b6f42ff
commit
3004823f36
@ -1,7 +1,7 @@
|
||||
# - musrfit --- DKS -----------------------------------------------------------
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
|
||||
project(musrfit VERSION 1.9.5 LANGUAGES C CXX)
|
||||
project(musrfit VERSION 1.9.6 LANGUAGES C CXX)
|
||||
|
||||
#--- musrfit specific options -------------------------------------------------
|
||||
option(dks "build musrfit with DKS (GPU/MIC) support" ON)
|
||||
|
@ -125,6 +125,7 @@ PTextEdit::PTextEdit( QWidget *parent )
|
||||
setupEditActions();
|
||||
setupTextActions();
|
||||
setupMusrActions();
|
||||
setupJumpToBlock();
|
||||
setupHelpActions();
|
||||
|
||||
fTabWidget = std::make_unique<QTabWidget>( this );
|
||||
@ -958,6 +959,31 @@ void PTextEdit::setupHelpActions()
|
||||
menu->addAction(a);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Setup the JumpToBlock actions.
|
||||
*/
|
||||
void PTextEdit::setupJumpToBlock()
|
||||
{
|
||||
QToolBar *tb = new QToolBar( this );
|
||||
tb->setWindowTitle( "JumpToBlock Actions" );
|
||||
addToolBar( tb );
|
||||
|
||||
QStringList jumpToBlockStr = {"FITPARAMETER", "THEORY", "FUNCTIONS", "GLOBAL", "RUN", "COMMANDS", "PLOT", "FOURIER", "STATISTIC"};
|
||||
fJumpToBlock = std::make_unique<QComboBox>();
|
||||
if (fJumpToBlock == nullptr)
|
||||
return;
|
||||
fJumpToBlock->addItems(jumpToBlockStr);
|
||||
fJumpToBlock->setEditable(false);
|
||||
|
||||
connect( fJumpToBlock.get(), SIGNAL( activated(int) ), this, SLOT( jumpToBlock(int) ));
|
||||
|
||||
QLabel *jstr = new QLabel(" Jump to block: ");
|
||||
|
||||
tb->addWidget(jstr);
|
||||
tb->addWidget(fJumpToBlock.get());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>load a msr-file.
|
||||
@ -3316,6 +3342,26 @@ void PTextEdit::setFileSystemWatcherActive()
|
||||
fFileSystemWatcherActive = true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>slot called when jumpToBlock combobox is selected
|
||||
* @param idx
|
||||
*/
|
||||
void PTextEdit::jumpToBlock(int idx)
|
||||
{
|
||||
QString str = fJumpToBlock->itemText(idx);
|
||||
|
||||
QTextDocument::FindFlags flags= QTextDocument::FindCaseSensitively | QTextDocument::FindWholeWords;
|
||||
|
||||
bool found = currentEditor()->find(str, flags);
|
||||
if (found)
|
||||
return;
|
||||
|
||||
// set cursor to start
|
||||
currentEditor()->moveCursor(QTextCursor::Start);
|
||||
currentEditor()->find(str, flags);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief PTextEdit::getTheme
|
||||
|
@ -86,6 +86,7 @@ private:
|
||||
void setupTextActions();
|
||||
void setupMusrActions();
|
||||
void setupHelpActions();
|
||||
void setupJumpToBlock();
|
||||
void load( const QString &f, const int index=-1 );
|
||||
PSubTextEdit *currentEditor() const;
|
||||
void doConnections( PSubTextEdit *e );
|
||||
@ -167,6 +168,8 @@ private slots:
|
||||
void fileChanged(const QString &fileName);
|
||||
void setFileSystemWatcherActive();
|
||||
|
||||
void jumpToBlock(int idx);
|
||||
|
||||
private:
|
||||
bool fDarkMenuIcon; ///< flag indicating if a dark or plain icon shall be used in the menu pull-downs
|
||||
bool fDarkToolBarIcon; ///< flag indicating if a dark or plain icon shall be used in the toolbar
|
||||
@ -187,6 +190,7 @@ private:
|
||||
std::unique_ptr<QComboBox> fComboFont; ///< combo box for the font selector
|
||||
std::unique_ptr<QComboBox> fComboSize; ///< combo box for the font size
|
||||
bool fFontChanging; ///< flag needed to prevent some textChanged feature to occure when only the font changed
|
||||
std::unique_ptr<QComboBox> fJumpToBlock; ///< combo box used to jump to the msr-file blocks
|
||||
|
||||
std::unique_ptr<QTabWidget> fTabWidget; ///< tab widget in which the text editor(s) are placed
|
||||
QMap<PSubTextEdit*, QString> fFilenames; ///< mapper between tab widget object and filename
|
||||
|
@ -127,6 +127,7 @@ PTextEdit::PTextEdit( QWidget *parent )
|
||||
setupEditActions();
|
||||
setupTextActions();
|
||||
setupMusrActions();
|
||||
setupJumpToBlock();
|
||||
setupHelpActions();
|
||||
|
||||
fTabWidget = std::make_unique<QTabWidget>( this );
|
||||
@ -965,6 +966,31 @@ void PTextEdit::setupHelpActions()
|
||||
menu->addAction(a);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Setup the JumpToBlock actions.
|
||||
*/
|
||||
void PTextEdit::setupJumpToBlock()
|
||||
{
|
||||
QToolBar *tb = new QToolBar( this );
|
||||
tb->setWindowTitle( "JumpToBlock Actions" );
|
||||
addToolBar( tb );
|
||||
|
||||
QStringList jumpToBlockStr = {"FITPARAMETER", "THEORY", "FUNCTIONS", "GLOBAL", "RUN", "COMMANDS", "PLOT", "FOURIER", "STATISTIC"};
|
||||
fJumpToBlock = std::make_unique<QComboBox>();
|
||||
if (fJumpToBlock == nullptr)
|
||||
return;
|
||||
fJumpToBlock->addItems(jumpToBlockStr);
|
||||
fJumpToBlock->setEditable(false);
|
||||
|
||||
connect( fJumpToBlock.get(), SIGNAL( activated(int) ), this, SLOT( jumpToBlock(int) ));
|
||||
|
||||
QLabel *jstr = new QLabel(" Jump to block: ");
|
||||
|
||||
tb->addWidget(jstr);
|
||||
tb->addWidget(fJumpToBlock.get());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>load a msr-file.
|
||||
@ -3291,6 +3317,26 @@ void PTextEdit::setFileSystemWatcherActive()
|
||||
fFileSystemWatcherActive = true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>slot called when jumpToBlock combobox is selected
|
||||
* @param idx
|
||||
*/
|
||||
void PTextEdit::jumpToBlock(int idx)
|
||||
{
|
||||
QString str = fJumpToBlock->itemText(idx);
|
||||
|
||||
QTextDocument::FindFlags flags= QTextDocument::FindCaseSensitively | QTextDocument::FindWholeWords;
|
||||
|
||||
bool found = currentEditor()->find(str, flags);
|
||||
if (found)
|
||||
return;
|
||||
|
||||
// set cursor to start
|
||||
currentEditor()->moveCursor(QTextCursor::Start);
|
||||
currentEditor()->find(str, flags);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief PTextEdit::getTheme
|
||||
|
@ -86,6 +86,7 @@ private:
|
||||
void setupTextActions();
|
||||
void setupMusrActions();
|
||||
void setupHelpActions();
|
||||
void setupJumpToBlock();
|
||||
void load( const QString &f, const int index=-1 );
|
||||
PSubTextEdit *currentEditor() const;
|
||||
void doConnections( PSubTextEdit *e );
|
||||
@ -167,6 +168,8 @@ private slots:
|
||||
void fileChanged(const QString &fileName);
|
||||
void setFileSystemWatcherActive();
|
||||
|
||||
void jumpToBlock(int idx);
|
||||
|
||||
private:
|
||||
bool fDarkMenuIcon; ///< flag indicating if a dark or plain icon shall be used in the menu pull-downs
|
||||
bool fDarkToolBarIcon; ///< flag indicating if a dark or plain icon shall be used in the toolbar
|
||||
@ -187,6 +190,7 @@ private:
|
||||
std::unique_ptr<QComboBox> fComboFont; ///< combo box for the font selector
|
||||
std::unique_ptr<QComboBox> fComboSize; ///< combo box for the font size
|
||||
bool fFontChanging; ///< flag needed to prevent some textChanged feature to occure when only the font changed
|
||||
std::unique_ptr<QComboBox> fJumpToBlock; ///< combo box used to jump to the msr-file blocks
|
||||
|
||||
std::unique_ptr<QTabWidget> fTabWidget; ///< tab widget in which the text editor(s) are placed
|
||||
QMap<PSubTextEdit*, QString> fFilenames; ///< mapper between tab widget object and filename
|
||||
|
Loading…
x
Reference in New Issue
Block a user